1
0
mirror of https://github.com/rancher/types.git synced 2025-08-31 12:48:45 +00:00

Fix backward CRD group name

This commit is contained in:
Darren Shepherd
2017-11-13 14:49:28 -07:00
parent 4ab7475968
commit 62e4fa6ac7
23 changed files with 19 additions and 18 deletions

View File

@@ -0,0 +1,25 @@
package schema
import (
"github.com/rancher/norman/types"
m "github.com/rancher/norman/types/mapping/mapper"
"github.com/rancher/types/apis/cluster.cattle.io/v1"
"github.com/rancher/types/commonmappers"
)
var (
Version = types.APIVersion{
Version: "v1",
Group: "cluster.cattle.io",
Path: "/v1-cluster",
SubContexts: map[string]bool{
"projects": true,
},
}
Schemas = commonmappers.Add(&Version, types.NewSchemas()).
AddMapperForType(&Version, v1.Cluster{}, m.NewObject(nil)).
AddMapperForType(&Version, v1.ClusterNode{}, m.NewObject(nil)).
MustImport(&Version, v1.Cluster{}).
MustImport(&Version, v1.ClusterNode{})
)

View File

@@ -0,0 +1,211 @@
package v1
import (
"k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)
type ClusterConditionType string
const (
// ClusterConditionReady Cluster ready to serve API (healthy when true, unehalthy when false)
ClusterConditionReady = "Ready"
// ClusterConditionProvisioned Cluster is provisioned
ClusterConditionProvisioned = "Provisioned"
// ClusterConditionUpdating Cluster is being updating (upgrading, scaling up)
ClusterConditionUpdating = "Updating"
// ClusterConditionSufficientDisk true when all cluster nodes have sufficient disk
ClusterConditionSufficientDisk = "SufficientDisk"
// ClusterConditionSufficientMemory true when all cluster nodes have sufficient memory
ClusterConditionSufficientMemory = "SufficientMemory"
// ClusterConditionNoDiskPressure true when all cluster nodes have no disk pressure
ClusterConditionNoDiskPressure = "NoDiskPressure"
// More conditions can be added if unredlying controllers request it
)
type Cluster 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 ClusterSpec `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 *ClusterStatus `json:"status"`
}
type ClusterSpec struct {
GKEConfig *GKEConfig `json:"gkeConfig,omitempty"`
AKSConfig *AKSConfig `json:"aksConfig,omitempty"`
RKEConfig *RKEConfig `json:"rkeConfig,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
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 []ClusterComponentStatus
APIEndpoint string `json:"apiEndpoint,omitempty"`
ServiceAccountToken string `json:"serviceAccountToken,omitempty"`
CACert string `json:"caCert,omitempty"`
Capacity v1.ResourceList `json:"capacity,omitempty"`
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"`
// 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 GKEConfig struct {
// ProjectID is the ID of your project to use when creating a cluster
ProjectID string `json:"projectId,omitempty"`
// The zone to launch the cluster
Zone string `json:"zone,omitempty"`
// The IP address range of the container pods
ClusterIpv4Cidr string `json:"clusterIpv4Cidr,omitempty"`
// An optional description of this cluster
Description string `json:"description,omitempty"`
// The number of nodes to create in this cluster
InitialNodeCount int64 `json:"initialNodeCount,omitempty"`
// Size of the disk attached to each node
DiskSizeGb int64 `json:"diskSizeGb,omitempty"`
// The name of a Google Compute Engine
MachineType string `json:"machineType,omitempty"`
// the initial kubernetes version
InitialClusterVersion string `json:"initialClusterVersion,omitempty"`
// The map of Kubernetes labels (key/value pairs) to be applied
// to each node.
Labels map[string]string `json:"labels,omitempty"`
// The path to the credential file(key.json)
CredentialPath string `json:"credentialPath,omitempty"`
// Enable alpha feature
EnableAlphaFeature bool `json:"enableAlphaFeature,omitempty"`
// NodePool id
NodePoolID string `json:"nodePoolId,omitempty"`
// Update Config
UpdateConfig gkeUpdateConfig `json:"updateConfig,omitempty"`
}
type gkeUpdateConfig struct {
// the number of node
NodeCount int64 `json:"nodeCount,omitempty"`
// Master kubernetes version
MasterVersion string `json:"masterVersion,omitempty"`
// Node kubernetes version
NodeVersion string `json:"nodeVersion,omitempty"`
}
type AKSConfig struct {
//TBD
}
type RKEConfig struct {
// Kubernetes nodes
Hosts []RKEConfigHost `yaml:"hosts"`
// Kubernetes components
Services RKEConfigServices `yaml:"services"`
// Network plugin used in the kubernetes cluster (flannel, calico)
NetworkPlugin string `yaml:"network_plugin"`
// Authentication type used in the cluster (default: x509)
AuthType string `yaml:"auth_type"`
}
type RKEConfigHost struct {
// SSH IP address of the host
IP string `yaml:"ip"`
// Advertised address that will be used for components communication
AdvertiseAddress string `yaml:"advertise_address"`
// Host role in kubernetes cluster (controlplane, worker, or etcd)
Role []string `yaml:"role"`
// Hostname of the host
Hostname string `yaml:"hostname"`
// SSH usesr that will be used by RKE
User string `yaml:"user"`
// Docker socket on the host that will be used in tunneling
DockerSocket string `yaml:"docker_socket"`
}
type RKEConfigServices struct {
// Etcd Service
Etcd ETCDService `yaml:"etcd"`
// KubeAPI Service
KubeAPI KubeAPIService `yaml:"kube-api"`
// KubeController Service
KubeController KubeControllerService `yaml:"kube-controller"`
// Scheduler Service
Scheduler SchedulerService `yaml:"scheduler"`
// Kubelet Service
Kubelet KubeletService `yaml:"kubelet"`
// KubeProxy Service
Kubeproxy KubeproxyService `yaml:"kubeproxy"`
}
type ETCDService struct {
// Base service properties
baseService `yaml:",inline"`
}
type KubeAPIService struct {
// Base service properties
baseService `yaml:",inline"`
// Virtual IP range that will be used by Kubernetes services
ServiceClusterIPRange string `yaml:"service_cluster_ip_range"`
}
type KubeControllerService struct {
// Base service properties
baseService `yaml:",inline"`
// CIDR Range for Pods in cluster
ClusterCIDR string `yaml:"cluster_cidr"`
// Virtual IP range that will be used by Kubernetes services
ServiceClusterIPRange string `yaml:"service_cluster_ip_range"`
}
type KubeletService struct {
// Base service properties
baseService `yaml:",inline"`
// Domain of the cluster (default: "cluster.local")
ClusterDomain string `yaml:"cluster_domain"`
// The image whose network/ipc namespaces containers in each pod will use
InfraContainerImage string `yaml:"infra_container_image"`
// Cluster DNS service ip
ClusterDNSServer string `yaml:"cluster_dns_server"`
}
type KubeproxyService struct {
// Base service properties
baseService `yaml:",inline"`
}
type SchedulerService struct {
// Base service properties
baseService `yaml:",inline"`
}
type baseService struct {
// Docker image of the service
Image string `yaml:"image"`
}
type ClusterNode struct {
v1.Node
}

View File

@@ -0,0 +1,141 @@
package v1
import (
"context"
"github.com/rancher/norman/clientbase"
"github.com/rancher/norman/controller"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/runtime"
"k8s.io/apimachinery/pkg/runtime/schema"
"k8s.io/apimachinery/pkg/watch"
"k8s.io/client-go/tools/cache"
)
var (
ClusterGroupVersionKind = schema.GroupVersionKind{
Version: "v1",
Group: "cluster.cattle.io",
Kind: "Cluster",
}
ClusterResource = metav1.APIResource{
Name: "",
SingularName: "cluster",
Namespaced: false,
Kind: ClusterGroupVersionKind.Kind,
}
)
type ClusterList struct {
metav1.TypeMeta `json:",inline"`
metav1.ListMeta `json:"metadata,omitempty"`
Items []Cluster
}
type ClusterHandlerFunc func(key string, obj *Cluster) error
type ClusterController interface {
Informer() cache.SharedIndexInformer
AddHandler(handler ClusterHandlerFunc)
Enqueue(namespace, name string)
Start(threadiness int, ctx context.Context) error
}
type ClusterInterface interface {
Create(*Cluster) (*Cluster, error)
Get(name string, opts metav1.GetOptions) (*Cluster, error)
Update(*Cluster) (*Cluster, error)
Delete(name string, options *metav1.DeleteOptions) error
List(opts metav1.ListOptions) (*ClusterList, error)
Watch(opts metav1.ListOptions) (watch.Interface, error)
DeleteCollection(deleteOpts *metav1.DeleteOptions, listOpts metav1.ListOptions) error
Controller() ClusterController
}
type clusterController struct {
controller.GenericController
}
func (c *clusterController) AddHandler(handler ClusterHandlerFunc) {
c.GenericController.AddHandler(func(key string) error {
obj, exists, err := c.Informer().GetStore().GetByKey(key)
if err != nil {
return err
}
if !exists {
return handler(key, nil)
}
return handler(key, obj.(*Cluster))
})
}
type clusterFactory struct {
}
func (c clusterFactory) Object() runtime.Object {
return &Cluster{}
}
func (c clusterFactory) List() runtime.Object {
return &ClusterList{}
}
func (s *clusterClient) Controller() ClusterController {
s.client.Lock()
defer s.client.Unlock()
c, ok := s.client.clusterControllers[s.ns]
if ok {
return c
}
genericController := controller.NewGenericController(ClusterGroupVersionKind.Kind+"Controller",
s.objectClient)
c = &clusterController{
GenericController: genericController,
}
s.client.clusterControllers[s.ns] = c
return c
}
type clusterClient struct {
client *Client
ns string
objectClient *clientbase.ObjectClient
controller ClusterController
}
func (s *clusterClient) Create(o *Cluster) (*Cluster, error) {
obj, err := s.objectClient.Create(o)
return obj.(*Cluster), err
}
func (s *clusterClient) Get(name string, opts metav1.GetOptions) (*Cluster, error) {
obj, err := s.objectClient.Get(name, opts)
return obj.(*Cluster), err
}
func (s *clusterClient) Update(o *Cluster) (*Cluster, error) {
obj, err := s.objectClient.Update(o.Name, o)
return obj.(*Cluster), err
}
func (s *clusterClient) Delete(name string, options *metav1.DeleteOptions) error {
return s.objectClient.Delete(name, options)
}
func (s *clusterClient) List(opts metav1.ListOptions) (*ClusterList, error) {
obj, err := s.objectClient.List(opts)
return obj.(*ClusterList), err
}
func (s *clusterClient) Watch(opts metav1.ListOptions) (watch.Interface, error) {
return s.objectClient.Watch(opts)
}
func (s *clusterClient) DeleteCollection(deleteOpts *metav1.DeleteOptions, listOpts metav1.ListOptions) error {
return s.objectClient.DeleteCollection(deleteOpts, listOpts)
}

View File

@@ -0,0 +1,141 @@
package v1
import (
"context"
"github.com/rancher/norman/clientbase"
"github.com/rancher/norman/controller"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/runtime"
"k8s.io/apimachinery/pkg/runtime/schema"
"k8s.io/apimachinery/pkg/watch"
"k8s.io/client-go/tools/cache"
)
var (
ClusterNodeGroupVersionKind = schema.GroupVersionKind{
Version: "v1",
Group: "cluster.cattle.io",
Kind: "ClusterNode",
}
ClusterNodeResource = metav1.APIResource{
Name: "",
SingularName: "clusternode",
Namespaced: false,
Kind: ClusterNodeGroupVersionKind.Kind,
}
)
type ClusterNodeList struct {
metav1.TypeMeta `json:",inline"`
metav1.ListMeta `json:"metadata,omitempty"`
Items []ClusterNode
}
type ClusterNodeHandlerFunc func(key string, obj *ClusterNode) error
type ClusterNodeController interface {
Informer() cache.SharedIndexInformer
AddHandler(handler ClusterNodeHandlerFunc)
Enqueue(namespace, name string)
Start(threadiness int, ctx context.Context) error
}
type ClusterNodeInterface interface {
Create(*ClusterNode) (*ClusterNode, error)
Get(name string, opts metav1.GetOptions) (*ClusterNode, error)
Update(*ClusterNode) (*ClusterNode, error)
Delete(name string, options *metav1.DeleteOptions) error
List(opts metav1.ListOptions) (*ClusterNodeList, error)
Watch(opts metav1.ListOptions) (watch.Interface, error)
DeleteCollection(deleteOpts *metav1.DeleteOptions, listOpts metav1.ListOptions) error
Controller() ClusterNodeController
}
type clusterNodeController struct {
controller.GenericController
}
func (c *clusterNodeController) AddHandler(handler ClusterNodeHandlerFunc) {
c.GenericController.AddHandler(func(key string) error {
obj, exists, err := c.Informer().GetStore().GetByKey(key)
if err != nil {
return err
}
if !exists {
return handler(key, nil)
}
return handler(key, obj.(*ClusterNode))
})
}
type clusterNodeFactory struct {
}
func (c clusterNodeFactory) Object() runtime.Object {
return &ClusterNode{}
}
func (c clusterNodeFactory) List() runtime.Object {
return &ClusterNodeList{}
}
func (s *clusterNodeClient) Controller() ClusterNodeController {
s.client.Lock()
defer s.client.Unlock()
c, ok := s.client.clusterNodeControllers[s.ns]
if ok {
return c
}
genericController := controller.NewGenericController(ClusterNodeGroupVersionKind.Kind+"Controller",
s.objectClient)
c = &clusterNodeController{
GenericController: genericController,
}
s.client.clusterNodeControllers[s.ns] = c
return c
}
type clusterNodeClient struct {
client *Client
ns string
objectClient *clientbase.ObjectClient
controller ClusterNodeController
}
func (s *clusterNodeClient) Create(o *ClusterNode) (*ClusterNode, error) {
obj, err := s.objectClient.Create(o)
return obj.(*ClusterNode), err
}
func (s *clusterNodeClient) Get(name string, opts metav1.GetOptions) (*ClusterNode, error) {
obj, err := s.objectClient.Get(name, opts)
return obj.(*ClusterNode), err
}
func (s *clusterNodeClient) Update(o *ClusterNode) (*ClusterNode, error) {
obj, err := s.objectClient.Update(o.Name, o)
return obj.(*ClusterNode), err
}
func (s *clusterNodeClient) Delete(name string, options *metav1.DeleteOptions) error {
return s.objectClient.Delete(name, options)
}
func (s *clusterNodeClient) List(opts metav1.ListOptions) (*ClusterNodeList, error) {
obj, err := s.objectClient.List(opts)
return obj.(*ClusterNodeList), err
}
func (s *clusterNodeClient) Watch(opts metav1.ListOptions) (watch.Interface, error) {
return s.objectClient.Watch(opts)
}
func (s *clusterNodeClient) DeleteCollection(deleteOpts *metav1.DeleteOptions, listOpts metav1.ListOptions) error {
return s.objectClient.DeleteCollection(deleteOpts, listOpts)
}

View File

@@ -0,0 +1,468 @@
package v1
import (
core_v1 "k8s.io/api/core/v1"
runtime "k8s.io/apimachinery/pkg/runtime"
)
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *AKSConfig) DeepCopyInto(out *AKSConfig) {
*out = *in
return
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new AKSConfig.
func (in *AKSConfig) DeepCopy() *AKSConfig {
if in == nil {
return nil
}
out := new(AKSConfig)
in.DeepCopyInto(out)
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *Cluster) DeepCopyInto(out *Cluster) {
*out = *in
out.TypeMeta = in.TypeMeta
in.ObjectMeta.DeepCopyInto(&out.ObjectMeta)
in.Spec.DeepCopyInto(&out.Spec)
if in.Status != nil {
in, out := &in.Status, &out.Status
if *in == nil {
*out = nil
} else {
*out = new(ClusterStatus)
(*in).DeepCopyInto(*out)
}
}
return
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Cluster.
func (in *Cluster) DeepCopy() *Cluster {
if in == nil {
return nil
}
out := new(Cluster)
in.DeepCopyInto(out)
return out
}
// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
func (in *Cluster) DeepCopyObject() runtime.Object {
if c := in.DeepCopy(); c != nil {
return c
} else {
return nil
}
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *ClusterComponentStatus) DeepCopyInto(out *ClusterComponentStatus) {
*out = *in
if in.Conditions != nil {
in, out := &in.Conditions, &out.Conditions
*out = make([]core_v1.ComponentCondition, len(*in))
copy(*out, *in)
}
return
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ClusterComponentStatus.
func (in *ClusterComponentStatus) DeepCopy() *ClusterComponentStatus {
if in == nil {
return nil
}
out := new(ClusterComponentStatus)
in.DeepCopyInto(out)
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *ClusterCondition) DeepCopyInto(out *ClusterCondition) {
*out = *in
return
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ClusterCondition.
func (in *ClusterCondition) DeepCopy() *ClusterCondition {
if in == nil {
return nil
}
out := new(ClusterCondition)
in.DeepCopyInto(out)
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *ClusterList) DeepCopyInto(out *ClusterList) {
*out = *in
out.TypeMeta = in.TypeMeta
out.ListMeta = in.ListMeta
if in.Items != nil {
in, out := &in.Items, &out.Items
*out = make([]Cluster, len(*in))
for i := range *in {
(*in)[i].DeepCopyInto(&(*out)[i])
}
}
return
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ClusterList.
func (in *ClusterList) DeepCopy() *ClusterList {
if in == nil {
return nil
}
out := new(ClusterList)
in.DeepCopyInto(out)
return out
}
// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
func (in *ClusterList) DeepCopyObject() runtime.Object {
if c := in.DeepCopy(); c != nil {
return c
} else {
return nil
}
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *ClusterNode) DeepCopyInto(out *ClusterNode) {
*out = *in
in.Node.DeepCopyInto(&out.Node)
return
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ClusterNode.
func (in *ClusterNode) DeepCopy() *ClusterNode {
if in == nil {
return nil
}
out := new(ClusterNode)
in.DeepCopyInto(out)
return out
}
// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
func (in *ClusterNode) DeepCopyObject() runtime.Object {
if c := in.DeepCopy(); c != nil {
return c
} else {
return nil
}
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *ClusterNodeList) DeepCopyInto(out *ClusterNodeList) {
*out = *in
out.TypeMeta = in.TypeMeta
out.ListMeta = in.ListMeta
if in.Items != nil {
in, out := &in.Items, &out.Items
*out = make([]ClusterNode, len(*in))
for i := range *in {
(*in)[i].DeepCopyInto(&(*out)[i])
}
}
return
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ClusterNodeList.
func (in *ClusterNodeList) DeepCopy() *ClusterNodeList {
if in == nil {
return nil
}
out := new(ClusterNodeList)
in.DeepCopyInto(out)
return out
}
// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
func (in *ClusterNodeList) DeepCopyObject() runtime.Object {
if c := in.DeepCopy(); c != nil {
return c
} else {
return nil
}
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *ClusterSpec) DeepCopyInto(out *ClusterSpec) {
*out = *in
if in.GKEConfig != nil {
in, out := &in.GKEConfig, &out.GKEConfig
if *in == nil {
*out = nil
} else {
*out = new(GKEConfig)
(*in).DeepCopyInto(*out)
}
}
if in.AKSConfig != nil {
in, out := &in.AKSConfig, &out.AKSConfig
if *in == nil {
*out = nil
} else {
*out = new(AKSConfig)
**out = **in
}
}
if in.RKEConfig != nil {
in, out := &in.RKEConfig, &out.RKEConfig
if *in == nil {
*out = nil
} else {
*out = new(RKEConfig)
(*in).DeepCopyInto(*out)
}
}
return
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ClusterSpec.
func (in *ClusterSpec) DeepCopy() *ClusterSpec {
if in == nil {
return nil
}
out := new(ClusterSpec)
in.DeepCopyInto(out)
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *ClusterStatus) DeepCopyInto(out *ClusterStatus) {
*out = *in
if in.Conditions != nil {
in, out := &in.Conditions, &out.Conditions
*out = make([]ClusterCondition, len(*in))
copy(*out, *in)
}
if in.ComponentStatuses != nil {
in, out := &in.ComponentStatuses, &out.ComponentStatuses
*out = make([]ClusterComponentStatus, len(*in))
for i := range *in {
(*in)[i].DeepCopyInto(&(*out)[i])
}
}
if in.Capacity != nil {
in, out := &in.Capacity, &out.Capacity
*out = make(core_v1.ResourceList, len(*in))
for key, val := range *in {
(*out)[key] = val.DeepCopy()
}
}
if in.Allocatable != nil {
in, out := &in.Allocatable, &out.Allocatable
*out = make(core_v1.ResourceList, len(*in))
for key, val := range *in {
(*out)[key] = val.DeepCopy()
}
}
return
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ClusterStatus.
func (in *ClusterStatus) DeepCopy() *ClusterStatus {
if in == nil {
return nil
}
out := new(ClusterStatus)
in.DeepCopyInto(out)
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *ETCDService) DeepCopyInto(out *ETCDService) {
*out = *in
out.baseService = in.baseService
return
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ETCDService.
func (in *ETCDService) DeepCopy() *ETCDService {
if in == nil {
return nil
}
out := new(ETCDService)
in.DeepCopyInto(out)
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *GKEConfig) DeepCopyInto(out *GKEConfig) {
*out = *in
if in.Labels != nil {
in, out := &in.Labels, &out.Labels
*out = make(map[string]string, len(*in))
for key, val := range *in {
(*out)[key] = val
}
}
out.UpdateConfig = in.UpdateConfig
return
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new GKEConfig.
func (in *GKEConfig) DeepCopy() *GKEConfig {
if in == nil {
return nil
}
out := new(GKEConfig)
in.DeepCopyInto(out)
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *KubeAPIService) DeepCopyInto(out *KubeAPIService) {
*out = *in
out.baseService = in.baseService
return
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new KubeAPIService.
func (in *KubeAPIService) DeepCopy() *KubeAPIService {
if in == nil {
return nil
}
out := new(KubeAPIService)
in.DeepCopyInto(out)
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *KubeControllerService) DeepCopyInto(out *KubeControllerService) {
*out = *in
out.baseService = in.baseService
return
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new KubeControllerService.
func (in *KubeControllerService) DeepCopy() *KubeControllerService {
if in == nil {
return nil
}
out := new(KubeControllerService)
in.DeepCopyInto(out)
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *KubeletService) DeepCopyInto(out *KubeletService) {
*out = *in
out.baseService = in.baseService
return
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new KubeletService.
func (in *KubeletService) DeepCopy() *KubeletService {
if in == nil {
return nil
}
out := new(KubeletService)
in.DeepCopyInto(out)
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *KubeproxyService) DeepCopyInto(out *KubeproxyService) {
*out = *in
out.baseService = in.baseService
return
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new KubeproxyService.
func (in *KubeproxyService) DeepCopy() *KubeproxyService {
if in == nil {
return nil
}
out := new(KubeproxyService)
in.DeepCopyInto(out)
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *RKEConfig) DeepCopyInto(out *RKEConfig) {
*out = *in
if in.Hosts != nil {
in, out := &in.Hosts, &out.Hosts
*out = make([]RKEConfigHost, len(*in))
for i := range *in {
(*in)[i].DeepCopyInto(&(*out)[i])
}
}
out.Services = in.Services
return
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new RKEConfig.
func (in *RKEConfig) DeepCopy() *RKEConfig {
if in == nil {
return nil
}
out := new(RKEConfig)
in.DeepCopyInto(out)
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *RKEConfigHost) DeepCopyInto(out *RKEConfigHost) {
*out = *in
if in.Role != nil {
in, out := &in.Role, &out.Role
*out = make([]string, len(*in))
copy(*out, *in)
}
return
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new RKEConfigHost.
func (in *RKEConfigHost) DeepCopy() *RKEConfigHost {
if in == nil {
return nil
}
out := new(RKEConfigHost)
in.DeepCopyInto(out)
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *RKEConfigServices) DeepCopyInto(out *RKEConfigServices) {
*out = *in
out.Etcd = in.Etcd
out.KubeAPI = in.KubeAPI
out.KubeController = in.KubeController
out.Scheduler = in.Scheduler
out.Kubelet = in.Kubelet
out.Kubeproxy = in.Kubeproxy
return
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new RKEConfigServices.
func (in *RKEConfigServices) DeepCopy() *RKEConfigServices {
if in == nil {
return nil
}
out := new(RKEConfigServices)
in.DeepCopyInto(out)
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *SchedulerService) DeepCopyInto(out *SchedulerService) {
*out = *in
out.baseService = in.baseService
return
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new SchedulerService.
func (in *SchedulerService) DeepCopy() *SchedulerService {
if in == nil {
return nil
}
out := new(SchedulerService)
in.DeepCopyInto(out)
return out
}

View File

@@ -0,0 +1,73 @@
package v1
import (
"sync"
"github.com/rancher/norman/clientbase"
"k8s.io/client-go/dynamic"
"k8s.io/client-go/rest"
)
type Interface interface {
RESTClient() rest.Interface
ClustersGetter
ClusterNodesGetter
}
type Client struct {
sync.Mutex
restClient rest.Interface
clusterControllers map[string]ClusterController
clusterNodeControllers map[string]ClusterNodeController
}
func NewForConfig(config rest.Config) (Interface, error) {
if config.NegotiatedSerializer == nil {
configConfig := dynamic.ContentConfig()
config.NegotiatedSerializer = configConfig.NegotiatedSerializer
}
restClient, err := rest.UnversionedRESTClientFor(&config)
if err != nil {
return nil, err
}
return &Client{
restClient: restClient,
clusterControllers: map[string]ClusterController{},
clusterNodeControllers: map[string]ClusterNodeController{},
}, nil
}
func (c *Client) RESTClient() rest.Interface {
return c.restClient
}
type ClustersGetter interface {
Clusters(namespace string) ClusterInterface
}
func (c *Client) Clusters(namespace string) ClusterInterface {
objectClient := clientbase.NewObjectClient(namespace, c.restClient, &ClusterResource, ClusterGroupVersionKind, clusterFactory{})
return &clusterClient{
ns: namespace,
client: c,
objectClient: objectClient,
}
}
type ClusterNodesGetter interface {
ClusterNodes(namespace string) ClusterNodeInterface
}
func (c *Client) ClusterNodes(namespace string) ClusterNodeInterface {
objectClient := clientbase.NewObjectClient(namespace, c.restClient, &ClusterNodeResource, ClusterNodeGroupVersionKind, clusterNodeFactory{})
return &clusterNodeClient{
ns: namespace,
client: c,
objectClient: objectClient,
}
}