1
0
mirror of https://github.com/rancher/types.git synced 2025-06-28 14:36:50 +00:00

Update cluster API

This commit is contained in:
Darren Shepherd 2017-11-10 21:57:13 -07:00
parent e5fba2b896
commit 01267d288d
3 changed files with 47 additions and 13 deletions

View File

@ -0,0 +1,3 @@
// +k8s:deepcopy-gen=package,register
package v1

View File

@ -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{})
)

View File

@ -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 objects 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
}