1
0
mirror of https://github.com/rancher/types.git synced 2025-07-14 21:54:03 +00:00

Add nodepools

This commit is contained in:
Darren Shepherd 2018-02-13 09:01:53 -07:00
parent c494fd1585
commit df797dfd8e
4 changed files with 47 additions and 42 deletions

View File

@ -11,13 +11,12 @@ type ClusterConditionType string
const (
// ClusterConditionReady Cluster ready to serve API (healthy when true, unhealthy when false)
ClusterConditionReady condition.Cond = "Ready"
ClusterConditionNodesCreated condition.Cond = "NodesCreated"
ClusterConditionReady condition.Cond = "Ready"
ClusterConditionPending condition.Cond = "Pending"
// ClusterConditionProvisioned Cluster is provisioned
ClusterConditionProvisioned condition.Cond = "Provisioned"
ClusterConditionUpdated condition.Cond = "Updated"
ClusterConditionRemoved condition.Cond = "Removed"
ClusterConditionRegistered condition.Cond = "Registered"
// ClusterConditionNoDiskPressure true when all cluster nodes have sufficient disk
ClusterConditionNoDiskPressure condition.Cond = "NoDiskPressure"
// ClusterConditionNoMemoryPressure true when all cluster nodes have sufficient memory
@ -43,12 +42,11 @@ type Cluster struct {
}
type ClusterSpec struct {
Nodes []NodeConfig `json:"nodes"`
NodePools []NodePool `json:"nodePools"`
DisplayName string `json:"displayName"`
Description string `json:"description"`
Internal bool `json:"internal" norman:"nocreate,noupdate"`
ImportedConfig *ImportedConfig `json:"importedConfig" norman:"noupdate"`
EmbeddedConfig *K8sServerConfig `json:"embeddedConfig" norman:"noupdate"`
ImportedConfig *ImportedConfig `json:"importedConfig,omitempty" norman:"nocreate,noupdate"`
GoogleKubernetesEngineConfig *GoogleKubernetesEngineConfig `json:"googleKubernetesEngineConfig,omitempty"`
AzureKubernetesServiceConfig *AzureKubernetesServiceConfig `json:"azureKubernetesServiceConfig,omitempty"`
RancherKubernetesEngineConfig *RancherKubernetesEngineConfig `json:"rancherKubernetesEngineConfig,omitempty"`
@ -60,11 +58,6 @@ type ImportedConfig struct {
KubeConfig string `json:"kubeConfig" norman:"type=password"`
}
type K8sServerConfig struct {
AdmissionControllers []string `json:"admissionControllers,omitempty"`
ServiceNetCIDR string `json:"serviceNetCidr,omitempty"`
}
type ClusterStatus struct {
//Conditions represent the latest available observations of an object's current state:
//More info: https://github.com/kubernetes/community/blob/master/contributors/devel/api-conventions.md#typical-status-properties
@ -215,6 +208,7 @@ type ClusterRegistrationTokenSpec struct {
type ClusterRegistrationTokenStatus struct {
Command string `json:"command"`
NodeCommand string `json:"nodeCommand"`
ManifestURL string `json:"manifestUrl"`
Token string `json:"token"`
}

View File

@ -60,18 +60,16 @@ type Node struct {
}
type NodeStatus struct {
Conditions []NodeCondition `json:"conditions,omitempty"`
NodeStatus v1.NodeStatus `json:"nodeStatus,omitempty"`
NodeName string `json:"nodeName,omitempty"`
Requested v1.ResourceList `json:"requested,omitempty"`
Limits v1.ResourceList `json:"limits,omitempty"`
NodeTemplateSpec *NodeTemplateSpec `json:"nodeTemplateSpec,omitempty"`
NodeConfig *RKEConfigNode `json:"rkeNode,omitempty"`
SSHUser string `json:"sshUser,omitempty"`
NodeDriverConfig string `json:"nodeDriverConfig,omitempty"`
NodeAnnotations map[string]string `json:"nodeAnnotations,omitempty"`
NodeLabels map[string]string `json:"nodeLabels,omitempty"`
NodeTaints []v1.Taint `json:"nodeTaints,omitempty"`
Conditions []NodeCondition `json:"conditions,omitempty"`
InternalNodeStatus v1.NodeStatus `json:"internalNodeStatus,omitempty"`
NodeName string `json:"nodeName,omitempty"`
Requested v1.ResourceList `json:"requested,omitempty"`
Limits v1.ResourceList `json:"limits,omitempty"`
NodeTemplateSpec *NodeTemplateSpec `json:"nodeTemplateSpec,omitempty"`
NodeConfig *RKEConfigNode `json:"rkeNode,omitempty"`
NodeAnnotations map[string]string `json:"nodeAnnotations,omitempty"`
NodeLabels map[string]string `json:"nodeLabels,omitempty"`
NodeTaints []v1.Taint `json:"nodeTaints,omitempty"`
}
var (
@ -96,10 +94,14 @@ type NodeCondition struct {
Message string `json:"message,omitempty"`
}
type NodeConfig struct {
NodeSpec
Labels map[string]string `json:"labels"`
Annotations map[string]string `json:"annotations"`
type NodePool struct {
CommonNodeSpec
UUID string `json:"uuid" norman:"nocreate,noupdate"`
HostnamePrefix string `json:"hostnamePrefix" norman:"required"`
Quantity int `json:"quantity" norman:"required,default=1"`
Labels map[string]string `json:"labels"`
Annotations map[string]string `json:"annotations"`
}
type CustomConfig struct {
@ -113,19 +115,27 @@ type CustomConfig struct {
DockerSocket string `yaml:"docker_socket" json:"dockerSocket,omitempty"`
// SSH Private Key
SSHKey string `yaml:"ssh_key" json:"sshKey,omitempty"`
// Roles
Roles []string `yaml:"roles" json:"roles,omitempty"`
}
type CommonNodeSpec struct {
Etcd bool `json:"etcd"`
ControlPlane bool `json:"controlPlane"`
Worker bool `json:"worker"`
NodeTemplateName string `json:"nodeTemplateName,omitempty" norman:"type=reference[nodeTemplate],noupdate"`
}
type NodeSpec struct {
NodeSpec v1.NodeSpec `json:"nodeSpec"`
CustomConfig *CustomConfig `json:"customConfig"`
Imported bool `json:"imported"`
Description string `json:"description,omitempty"`
DisplayName string `json:"displayName"`
RequestedHostname string `json:"requestedHostname,omitempty" norman:"type=dnsLabel,nullable,noupdate,required"`
ClusterName string `json:"clusterName,omitempty" norman:"type=reference[cluster],noupdate,required"`
Role []string `json:"role,omitempty" norman:"noupdate,type=array[enum],options=etcd|worker|controlplane"`
NodeTemplateName string `json:"nodeTemplateName,omitempty" norman:"type=reference[nodeTemplate],noupdate"`
UseInternalIPAddress bool `json:"useInternalIpAddress,omitempty" norman:"default=true,noupdate"`
CommonNodeSpec `json:",inline"`
NodePoolUUID string `json:"nodePoolUuid" norman:"nocreate,noupdate"`
CustomConfig *CustomConfig `json:"customConfig"`
Imported bool `json:"imported"`
Description string `json:"description,omitempty"`
DisplayName string `json:"displayName"`
RequestedHostname string `json:"requestedHostname,omitempty" norman:"type=dnsLabel,nullable,noupdate,required"`
ClusterName string `json:"clusterName,omitempty" norman:"type=reference[cluster],noupdate,required"`
InternalNodeSpec v1.NodeSpec `json:"internalNodeSpec"`
}
type NodeCommonParams struct {
@ -139,6 +149,7 @@ type NodeCommonParams struct {
EngineLabel map[string]string `json:"engineLabel,omitempty"`
EngineStorageDriver string `json:"engineStorageDriver,omitempty"`
EngineEnv map[string]string `json:"engineEnv,omitempty"`
UseInternalIPAddress bool `json:"useInternalIpAddress,omitempty" norman:"default=true,noupdate"`
}
type NodeDriver struct {

View File

@ -153,15 +153,12 @@ func authzTypes(schemas *types.Schemas) *types.Schemas {
func nodeTypes(schemas *types.Schemas) *types.Schemas {
return schemas.
AddMapperForType(&Version, v3.NodeSpec{}, &m.Embed{Field: "nodeSpec"}).
AddMapperForType(&Version, v3.NodeSpec{}, &m.Embed{Field: "internalNodeSpec"}).
AddMapperForType(&Version, v3.NodeStatus{},
&m.Drop{Field: "rkeNode"},
&m.Drop{Field: "nodeTemplateSpec"},
&m.Drop{Field: "nodeDriverConfig"},
&m.Embed{Field: "nodeStatus"},
&m.Embed{Field: "internalNodeStatus"},
&m.SliceMerge{From: []string{"conditions", "nodeConditions"}, To: "conditions"}).
AddMapperForType(&Version, v3.NodeConfig{},
&m.Drop{Field: "clusterName"}).
AddMapperForType(&Version, v3.Node{},
&m.Embed{Field: "status"},
m.DisplayName{}).

View File

@ -25,14 +25,17 @@ var transitioningMap = map[string]string{
"BackingNamespaceCreated": "configuring",
"ConfigOK": "configuring",
"CreatorMadeOwner": "configuring",
"Created": "creating",
"DefaultNamespaceAssigned": "configuring",
"DefaultProjectCreated": "configuring",
"Downloaded": "downloading",
"Inactive": "deactivating",
"Initialized": "initializing",
"NodesCreated": "provisioning",
"Pending": "pending",
"PodScheduled": "scheduling",
"Progressing": "updating",
"DockerProvisioned": "provisioning",
"Provisioned": "provisioning",
"Registered": "waiting",
"Removed": "removing",