1
0
mirror of https://github.com/rancher/types.git synced 2025-09-17 23:38:20 +00:00

Update types

This commit is contained in:
Darren Shepherd
2017-11-29 14:38:12 -07:00
parent 4bd90956c0
commit 143e41f471
6 changed files with 188 additions and 12 deletions

View File

@@ -2,8 +2,9 @@ package schema
import (
"github.com/rancher/norman/types"
"github.com/rancher/norman/types/factory"
"github.com/rancher/norman/types/mapper"
"github.com/rancher/types/apis/cluster.cattle.io/v1"
"github.com/rancher/types/factory"
)
var (
@@ -14,6 +15,13 @@ var (
}
Schemas = factory.Schemas(&Version).
AddMapperForType(&Version, v1.Cluster{}, mapper.DisplayName{}).
AddMapperForType(&Version, v1.Machine{}, mapper.DisplayName{}).
AddMapperForType(&Version, v1.MachineDriver{}, mapper.DisplayName{}).
AddMapperForType(&Version, v1.MachineTemplate{}, mapper.DisplayName{}).
MustImport(&Version, v1.Cluster{}).
MustImport(&Version, v1.ClusterNode{})
MustImport(&Version, v1.ClusterNode{}).
MustImport(&Version, v1.Machine{}).
MustImport(&Version, v1.MachineDriver{}).
MustImport(&Version, v1.MachineTemplate{})
)

View File

@@ -35,6 +35,8 @@ type Cluster struct {
}
type ClusterSpec struct {
DisplayName string `json:"displayName"`
Description string `json:"description"`
GoogleKubernetesEngineConfig *GoogleKubernetesEngineConfig `json:"googleKubernetesEngineConfig,omitempty"`
AzureKubernetesServiceConfig *AzureKubernetesServiceConfig `json:"azureKubernetesServiceConfig,omitempty"`
RancherKubernetesEngineConfig *RancherKubernetesEngineConfig `json:"rancherKubernetesEngineConfig,omitempty"`
@@ -56,7 +58,7 @@ type ClusterStatus struct {
}
type ClusterComponentStatus struct {
Name string
Name string `json:"name"`
Conditions []v1.ComponentCondition `json:"conditions,omitempty" patchStrategy:"merge" patchMergeKey:"type" protobuf:"bytes,2,rep,name=conditions"`
}
@@ -216,3 +218,152 @@ type AuthConfig struct {
type ClusterNode struct {
v1.Node
}
type MachineTemplate struct {
metav1.TypeMeta `json:",inline"`
// Standard objects metadata. More info:
// https://github.com/kubernetes/community/blob/master/contributors/devel/api-conventions.md#metadata
metav1.ObjectMeta `json:"metadata,omitempty"`
// Specification of the desired behavior of the the cluster. More info:
// https://github.com/kubernetes/community/blob/master/contributors/devel/api-conventions.md#spec-and-status
Spec MachineTemplateSpec `json:"spec"`
// Most recent observed status of the cluster. More info:
// https://github.com/kubernetes/community/blob/master/contributors/devel/api-conventions.md#spec-and-status
Status MachineTemplateStatus `json:"status"`
}
type MachineTemplateStatus struct {
Conditions []MachineTemplateCondition `json:"conditions"`
}
type MachineTemplateCondition struct {
// Type of cluster condition.
Type string `json:"type"`
// Status of the condition, one of True, False, Unknown.
Status v1.ConditionStatus `json:"status"`
// The last time this condition was updated.
LastUpdateTime string `json:"lastUpdateTime,omitempty"`
// Last time the condition transitioned from one status to another.
LastTransitionTime string `json:"lastTransitionTime,omitempty"`
// The reason for the condition's last transition.
Reason string `json:"reason,omitempty"`
}
type MachineTemplateSpec struct {
DisplayName string `json:"displayName"`
Description string `json:"description"`
FlavorPrefix string `json:"flavorPrefix"`
Driver string `json:"driver"`
SecretValues map[string]string `json:"secretValues"`
SecretName string `norman:"type=reference[/v1-cluster/schemas/globalSecret]"`
PublicValues map[string]string `json:"publicValues"`
}
type Machine struct {
metav1.TypeMeta `json:",inline"`
// Standard objects metadata. More info:
// https://github.com/kubernetes/community/blob/master/contributors/devel/api-conventions.md#metadata
metav1.ObjectMeta `json:"metadata,omitempty"`
// Specification of the desired behavior of the the cluster. More info:
// https://github.com/kubernetes/community/blob/master/contributors/devel/api-conventions.md#spec-and-status
Spec MachineSpec `json:"spec"`
// Most recent observed status of the cluster. More info:
// https://github.com/kubernetes/community/blob/master/contributors/devel/api-conventions.md#spec-and-status
Status MachineStatus `json:"status"`
}
type MachineStatus struct {
Conditions []MachineCondition `json:"conditions"`
}
type MachineCondition struct {
// Type of cluster condition.
Type string `json:"type"`
// Status of the condition, one of True, False, Unknown.
Status v1.ConditionStatus `json:"status"`
// The last time this condition was updated.
LastUpdateTime string `json:"lastUpdateTime,omitempty"`
// Last time the condition transitioned from one status to another.
LastTransitionTime string `json:"lastTransitionTime,omitempty"`
// The reason for the condition's last transition.
Reason string `json:"reason,omitempty"`
}
type MachineSpec struct {
ClusterName string `norman:"type=reference[cluster]"`
ExternalID string `json:"externalId"`
MachineTemplateName string `norman:"type=reference[machineTemplate]"`
DisplayName string `json:"displayName"`
Description string `json:"description"`
Hostname string `json:"hostname"`
Driver string `json:"driver"`
MachineGeneralParams `json:",inline"`
AmazonEC2Config AmazonEC2Config `json:"amazonEc2Config"`
AzureConfig AzureConfig `json:"azureConfig"`
DigitalOceanConfig DigitalOceanConfig `json:"digitalOceanConfig"`
}
type AmazonEC2Config struct {
}
type AzureConfig struct {
}
type DigitalOceanConfig struct {
}
type MachineGeneralParams struct {
AuthCertificateAuthority string `json:"authCertificateAuthority"`
AuthKey string `json:"authKey"`
EngineInstallURL string `json:"engineInstallURL"`
DockerVersion string `json:"dockerVersion"`
EngineOpt map[string]string `json:"engineOpt"`
EngineInsecureRegistry []string `json:"engineInsecureRegistry"`
EngineRegistryMirror []string `json:"engineRegistryMirror"`
EngineLabel map[string]string `json:"engineLabel"`
EngineStorageDriver string `json:"engineStorageDriver"`
EngineEnv map[string]string `json:"engineEnv"`
}
type MachineDriver struct {
metav1.TypeMeta `json:",inline"`
// Standard objects metadata. More info:
// https://github.com/kubernetes/community/blob/master/contributors/devel/api-conventions.md#metadata
metav1.ObjectMeta `json:"metadata,omitempty"`
// Specification of the desired behavior of the the cluster. More info:
// https://github.com/kubernetes/community/blob/master/contributors/devel/api-conventions.md#spec-and-status
Spec MachineDriverSpec `json:"spec"`
// Most recent observed status of the cluster. More info:
// https://github.com/kubernetes/community/blob/master/contributors/devel/api-conventions.md#spec-and-status
Status MachineDriverStatus `json:"status"`
}
type MachineDriverStatus struct {
Conditions []MachineDriverCondition `json:"conditions"`
}
type MachineDriverCondition struct {
// Type of cluster condition.
Type string `json:"type"`
// Status of the condition, one of True, False, Unknown.
Status v1.ConditionStatus `json:"status"`
// The last time this condition was updated.
LastUpdateTime string `json:"lastUpdateTime,omitempty"`
// Last time the condition transitioned from one status to another.
LastTransitionTime string `json:"lastTransitionTime,omitempty"`
// The reason for the condition's last transition.
Reason string `json:"reason,omitempty"`
}
type MachineDriverSpec struct {
DisplayName string `json:"displayName"`
Description string `json:"description"`
URL string `json:"url"`
ExternalID string `json:"externalId"`
Builtin bool `json:"builtin"`
DefaultActive bool `json:"defaultActive"`
ActivateOnCreate bool `json:"activateOnCreate"`
Checksum string `json:"checksum"`
UIURL string `json:"uiUrl"`
}