diff --git a/io.cattle.cluster/v1/doc.go b/io.cattle.cluster/v1/doc.go new file mode 100644 index 00000000..b463deda --- /dev/null +++ b/io.cattle.cluster/v1/doc.go @@ -0,0 +1,3 @@ +// +k8s:deepcopy-gen=package,register + +package v1 diff --git a/io.cattle.cluster/v1/schema/schema.go b/io.cattle.cluster/v1/schema/schema.go new file mode 100644 index 00000000..c5120f24 --- /dev/null +++ b/io.cattle.cluster/v1/schema/schema.go @@ -0,0 +1,21 @@ +package schema + +import ( + "github.com/rancher/norman/types" + "github.com/rancher/types/io.cattle.cluster/v1" +) + +var ( + Version = types.APIVersion{ + Version: "v1", + Group: "io.cattle.cluster", + Path: "/v1-cluster", + SubContexts: map[string]bool{ + "projects": true, + }, + } + + Schemas = types.NewSchemas(). + MustImport(&Version, v1.Cluster{}). + MustImport(&Version, v1.ClusterNode{}) +) diff --git a/io.cattle.management/v1/types.go b/io.cattle.cluster/v1/types.go similarity index 89% rename from io.cattle.management/v1/types.go rename to io.cattle.cluster/v1/types.go index 24498622..d8b9114f 100644 --- a/io.cattle.management/v1/types.go +++ b/io.cattle.cluster/v1/types.go @@ -3,8 +3,11 @@ package v1 import ( "k8s.io/api/core/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/runtime" ) +var SchemeBuilder = runtime.NewSchemeBuilder() + type ClusterConditionType string const ( @@ -23,6 +26,8 @@ const ( // More conditions can be added if unredlying controllers request it ) +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object + type Cluster struct { metav1.TypeMeta `json:",inline"` // Standard object’s metadata. More info: @@ -36,13 +41,12 @@ type Cluster struct { Status *ClusterStatus `json:"status"` } +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object + type ClusterList struct { - metav1.TypeMeta `json:",inline"` - // Standard list metadata - // More info: https://github.com/kubernetes/community/blob/master/contributors/devel/api-conventions.md#metadata - metav1.ListMeta `json:"metadata,omitempty"` - // List of Clusters - Items []*Cluster `json:"items"` + metav1.TypeMeta `json:",inline"` + metav1.ObjectMeta `json:"metadata,omitempty"` + Items []Cluster } type ClusterSpec struct { @@ -57,7 +61,7 @@ type ClusterStatus struct { Conditions []ClusterCondition `json:"conditions,omitempty"` //Component statuses will represent cluster's components (etcd/controller/scheduler) health // https://kubernetes.io/docs/api-reference/v1.8/#componentstatus-v1-core - ComponentStatuses []v1.ComponentStatus + ComponentStatuses []ClusterComponentStatus APIEndpoint string `json:"apiEndpoint,omitempty"` ServiceAccountToken string `json:"serviceAccountToken,omitempty"` CACert string `json:"caCert,omitempty"` @@ -65,6 +69,11 @@ type ClusterStatus struct { Allocatable v1.ResourceList `json:"allocatable,omitempty"` } +type ClusterComponentStatus struct { + Name string + Conditions []v1.ComponentCondition `json:"conditions,omitempty" patchStrategy:"merge" patchMergeKey:"type" protobuf:"bytes,2,rep,name=conditions"` +} + type ClusterCondition struct { // Type of cluster condition. Type ClusterConditionType `json:"type"` @@ -210,15 +219,16 @@ type baseService struct { Image string `yaml:"image"` } +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object + type ClusterNode struct { v1.Node } +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object + type ClusterNodeList struct { - metav1.TypeMeta `json:",inline"` - // Standard list metadata - // More info: https://github.com/kubernetes/community/blob/master/contributors/devel/api-conventions.md#metadata - metav1.ListMeta `json:"metadata,omitempty"` - // List of Clusters - Items []*Cluster `json:"items"` + metav1.TypeMeta `json:",inline"` + metav1.ObjectMeta `json:"metadata,omitempty"` + Items []ClusterNode }