-
Notifications
You must be signed in to change notification settings - Fork 46
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add initial version of PMKS Common API for Driver
- Loading branch information
1 parent
b71511c
commit 68638b3
Showing
1 changed file
with
107 additions
and
0 deletions.
There are no files selected for viewing
107 changes: 107 additions & 0 deletions
107
cloud-control-manager/cloud-driver/interfaces/resources/ClusterHandler.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,107 @@ | ||
// Cloud Driver Interface of CB-Spider. | ||
// The CB-Spider is a sub-Framework of the Cloud-Barista Multi-Cloud Project. | ||
// The CB-Spider Mission is to connect all the clouds with a single interface. | ||
// | ||
// * Cloud-Barista: https://github.com/cloud-barista | ||
// | ||
// This is Resouces interfaces of Cloud Driver. | ||
// | ||
// by CB-Spider Team, 2022.08. | ||
|
||
package resources | ||
|
||
import "time" | ||
|
||
|
||
//-------- Const | ||
type ClusterStatus string | ||
|
||
const ( | ||
ClusterCreating ClusterStatus = "Creating" | ||
ClusterActive ClusterStatus = "Active" | ||
ClusterInactive ClusterStatus = "Inactive" | ||
ClusterUpdating ClusterStatus = "Updating" | ||
ClusterDeleting ClusterStatus = "Deleting" | ||
) | ||
|
||
//-------- Info Structure | ||
type ClusterInfo struct { | ||
IId IID // {NameId, SystemId} | ||
|
||
Version string // Kubernetes Version, ex) 1.23.3 | ||
|
||
Network NetworkInfo | ||
NodeGroupList []NodeGroupInfo | ||
Addons AddonsInfo | ||
|
||
|
||
status ClusterStatus | ||
|
||
CreatedTime time.Time | ||
KeyValueList []KeyValue | ||
} | ||
|
||
type NetworkInfo struct { | ||
VpcIID IID // {NameId, SystemId} | ||
SubnetIID []IID | ||
SecurityGroupIIDs []IID | ||
|
||
KeyValueList []KeyValue | ||
} | ||
|
||
type NodeGroupInfo struct { | ||
IId IID // {NameId, SystemId} | ||
|
||
// VM config. | ||
ImageIID IID | ||
VMSpecName string | ||
RootDiskType string // "SSD(gp2)", "Premium SSD", ... | ||
RootDiskSize string // "", "default", "50", "1000" (GB) | ||
KeyPairIID IID | ||
|
||
// Auto Scaling config. | ||
AutoScaling bool | ||
MinNumberNodes int | ||
MaxNumberNodes int | ||
|
||
DesiredNumberNodes int | ||
|
||
NodeList []IID | ||
KeyValueList []KeyValue | ||
} | ||
|
||
// CNI, DNS, .... @todo | ||
type AddonsInfo struct { | ||
KeyValueList []KeyValue | ||
} | ||
|
||
|
||
//-------- Cluster API | ||
type ClusterHandler interface { | ||
|
||
//------ Cluster Management | ||
CreateCluster(clusterReqInfo ClusterInfo) (ClusterInfo, error) | ||
ListCluster() ([]*ClusterInfo, error) | ||
GetCluster(clusterIID IID) (ClusterInfo, error) | ||
DeleteCluster(clusterIID IID) (bool, error) | ||
|
||
AddNodeGroup(clusterIID IID, nodeGroup IID) (ClusterInfo, error) | ||
RemoveNodeGroup(clusterIID IID, nodeGroup IID) (bool, error) | ||
|
||
//------ Upgrade K8S | ||
UpgradeCluster(clusterIID IID, newVersion string) (ClusterInfo, error) | ||
|
||
} | ||
|
||
//-------- NodeGroup API | ||
type NodeGroupHandler interface { | ||
|
||
//------ NodeGroup Management | ||
CreateNodeGroup(nodeGroupReqInfo NodeGroupInfo) (NodeGroupInfo, error) | ||
ListNodeGroup() ([]*NodeGroupInfo, error) | ||
GetNodeGroup(nodeGroupIID IID) (NodeGroupInfo, error) | ||
DeleteNodeGroup(nodeGroupIID IID) (bool, error) | ||
|
||
AddNodes(nodeGroupIID IID, number int) (NodeGroupInfo, error) | ||
RemoveNodes(nodeGroupIID IID, vmIIDs *[]IID) (bool, error) | ||
} |