From e794f064305a7e45f2d06202e3825fa003cdb087 Mon Sep 17 00:00:00 2001 From: Darren Shepherd Date: Tue, 20 Feb 2018 12:44:22 -0700 Subject: [PATCH] Update generated code --- .../v3/zz_generated_deepcopy.go | 168 ++++++++---- .../v3/zz_generated_k8s_client.go | 16 ++ .../v3/zz_generated_node_pool_controller.go | 252 ++++++++++++++++++ ...z_generated_node_pool_lifecycle_adapter.go | 51 ++++ .../v3/zz_generated_scheme.go | 2 + client/management/v3/zz_generated_client.go | 2 + client/management/v3/zz_generated_cluster.go | 2 - ...zz_generated_cluster_registration_token.go | 2 + ...rated_cluster_registration_token_status.go | 20 +- .../v3/zz_generated_cluster_spec.go | 2 - .../management/v3/zz_generated_condition.go | 20 ++ client/management/v3/zz_generated_node.go | 8 +- .../v3/zz_generated_node_driver_condition.go | 20 -- .../v3/zz_generated_node_driver_status.go | 2 +- .../management/v3/zz_generated_node_pool.go | 133 +++++++-- .../v3/zz_generated_node_pool_spec.go | 28 ++ .../v3/zz_generated_node_pool_status.go | 10 + .../management/v3/zz_generated_node_spec.go | 4 +- 18 files changed, 631 insertions(+), 111 deletions(-) create mode 100644 apis/management.cattle.io/v3/zz_generated_node_pool_controller.go create mode 100644 apis/management.cattle.io/v3/zz_generated_node_pool_lifecycle_adapter.go create mode 100644 client/management/v3/zz_generated_condition.go delete mode 100644 client/management/v3/zz_generated_node_driver_condition.go create mode 100644 client/management/v3/zz_generated_node_pool_spec.go create mode 100644 client/management/v3/zz_generated_node_pool_status.go diff --git a/apis/management.cattle.io/v3/zz_generated_deepcopy.go b/apis/management.cattle.io/v3/zz_generated_deepcopy.go index 77a8147e..f247ab70 100644 --- a/apis/management.cattle.io/v3/zz_generated_deepcopy.go +++ b/apis/management.cattle.io/v3/zz_generated_deepcopy.go @@ -188,9 +188,9 @@ func RegisterDeepCopies(scheme *runtime.Scheme) error { return nil }, InType: reflect.TypeOf(&ClusterStatus{})}, conversion.GeneratedDeepCopyFunc{Fn: func(in interface{}, out interface{}, c *conversion.Cloner) error { - in.(*CommonNodeSpec).DeepCopyInto(out.(*CommonNodeSpec)) + in.(*Condition).DeepCopyInto(out.(*Condition)) return nil - }, InType: reflect.TypeOf(&CommonNodeSpec{})}, + }, InType: reflect.TypeOf(&Condition{})}, conversion.GeneratedDeepCopyFunc{Fn: func(in interface{}, out interface{}, c *conversion.Cloner) error { in.(*CustomConfig).DeepCopyInto(out.(*CustomConfig)) return nil @@ -367,10 +367,6 @@ func RegisterDeepCopies(scheme *runtime.Scheme) error { in.(*NodeDriver).DeepCopyInto(out.(*NodeDriver)) return nil }, InType: reflect.TypeOf(&NodeDriver{})}, - conversion.GeneratedDeepCopyFunc{Fn: func(in interface{}, out interface{}, c *conversion.Cloner) error { - in.(*NodeDriverCondition).DeepCopyInto(out.(*NodeDriverCondition)) - return nil - }, InType: reflect.TypeOf(&NodeDriverCondition{})}, conversion.GeneratedDeepCopyFunc{Fn: func(in interface{}, out interface{}, c *conversion.Cloner) error { in.(*NodeDriverList).DeepCopyInto(out.(*NodeDriverList)) return nil @@ -391,6 +387,18 @@ func RegisterDeepCopies(scheme *runtime.Scheme) error { in.(*NodePool).DeepCopyInto(out.(*NodePool)) return nil }, InType: reflect.TypeOf(&NodePool{})}, + conversion.GeneratedDeepCopyFunc{Fn: func(in interface{}, out interface{}, c *conversion.Cloner) error { + in.(*NodePoolList).DeepCopyInto(out.(*NodePoolList)) + return nil + }, InType: reflect.TypeOf(&NodePoolList{})}, + conversion.GeneratedDeepCopyFunc{Fn: func(in interface{}, out interface{}, c *conversion.Cloner) error { + in.(*NodePoolSpec).DeepCopyInto(out.(*NodePoolSpec)) + return nil + }, InType: reflect.TypeOf(&NodePoolSpec{})}, + conversion.GeneratedDeepCopyFunc{Fn: func(in interface{}, out interface{}, c *conversion.Cloner) error { + in.(*NodePoolStatus).DeepCopyInto(out.(*NodePoolStatus)) + return nil + }, InType: reflect.TypeOf(&NodePoolStatus{})}, conversion.GeneratedDeepCopyFunc{Fn: func(in interface{}, out interface{}, c *conversion.Cloner) error { in.(*NodeSpec).DeepCopyInto(out.(*NodeSpec)) return nil @@ -1830,13 +1838,6 @@ func (in *ClusterRoleTemplateBindingList) DeepCopyObject() runtime.Object { // 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.NodePools != nil { - in, out := &in.NodePools, &out.NodePools - *out = make([]NodePool, len(*in)) - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) - } - } if in.ImportedConfig != nil { in, out := &in.ImportedConfig, &out.ImportedConfig if *in == nil { @@ -1953,17 +1954,17 @@ func (in *ClusterStatus) DeepCopy() *ClusterStatus { } // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *CommonNodeSpec) DeepCopyInto(out *CommonNodeSpec) { +func (in *Condition) DeepCopyInto(out *Condition) { *out = *in return } -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new CommonNodeSpec. -func (in *CommonNodeSpec) DeepCopy() *CommonNodeSpec { +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Condition. +func (in *Condition) DeepCopy() *Condition { if in == nil { return nil } - out := new(CommonNodeSpec) + out := new(Condition) in.DeepCopyInto(out) return out } @@ -3129,22 +3130,6 @@ func (in *NodeDriver) DeepCopyObject() runtime.Object { } } -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *NodeDriverCondition) DeepCopyInto(out *NodeDriverCondition) { - *out = *in - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new NodeDriverCondition. -func (in *NodeDriverCondition) DeepCopy() *NodeDriverCondition { - if in == nil { - return nil - } - out := new(NodeDriverCondition) - in.DeepCopyInto(out) - return out -} - // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *NodeDriverList) DeepCopyInto(out *NodeDriverList) { *out = *in @@ -3200,7 +3185,7 @@ func (in *NodeDriverStatus) DeepCopyInto(out *NodeDriverStatus) { *out = *in if in.Conditions != nil { in, out := &in.Conditions, &out.Conditions - *out = make([]NodeDriverCondition, len(*in)) + *out = make([]Condition, len(*in)) copy(*out, *in) } return @@ -3253,21 +3238,11 @@ func (in *NodeList) DeepCopyObject() runtime.Object { // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *NodePool) DeepCopyInto(out *NodePool) { *out = *in - out.CommonNodeSpec = in.CommonNodeSpec - 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 - } - } - if in.Annotations != nil { - in, out := &in.Annotations, &out.Annotations - *out = make(map[string]string, len(*in)) - for key, val := range *in { - (*out)[key] = val - } - } + out.Namespaced = in.Namespaced + out.TypeMeta = in.TypeMeta + in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) + in.Spec.DeepCopyInto(&out.Spec) + in.Status.DeepCopyInto(&out.Status) return } @@ -3281,10 +3256,103 @@ func (in *NodePool) DeepCopy() *NodePool { return out } +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *NodePool) 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 *NodePoolList) DeepCopyInto(out *NodePoolList) { + *out = *in + out.TypeMeta = in.TypeMeta + out.ListMeta = in.ListMeta + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]NodePool, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new NodePoolList. +func (in *NodePoolList) DeepCopy() *NodePoolList { + if in == nil { + return nil + } + out := new(NodePoolList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *NodePoolList) 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 *NodePoolSpec) DeepCopyInto(out *NodePoolSpec) { + *out = *in + if in.NodeLabels != nil { + in, out := &in.NodeLabels, &out.NodeLabels + *out = make(map[string]string, len(*in)) + for key, val := range *in { + (*out)[key] = val + } + } + if in.NodeAnnotations != nil { + in, out := &in.NodeAnnotations, &out.NodeAnnotations + *out = make(map[string]string, len(*in)) + for key, val := range *in { + (*out)[key] = val + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new NodePoolSpec. +func (in *NodePoolSpec) DeepCopy() *NodePoolSpec { + if in == nil { + return nil + } + out := new(NodePoolSpec) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *NodePoolStatus) DeepCopyInto(out *NodePoolStatus) { + *out = *in + if in.Conditions != nil { + in, out := &in.Conditions, &out.Conditions + *out = make([]Condition, len(*in)) + copy(*out, *in) + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new NodePoolStatus. +func (in *NodePoolStatus) DeepCopy() *NodePoolStatus { + if in == nil { + return nil + } + out := new(NodePoolStatus) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *NodeSpec) DeepCopyInto(out *NodeSpec) { *out = *in - out.CommonNodeSpec = in.CommonNodeSpec if in.CustomConfig != nil { in, out := &in.CustomConfig, &out.CustomConfig if *in == nil { diff --git a/apis/management.cattle.io/v3/zz_generated_k8s_client.go b/apis/management.cattle.io/v3/zz_generated_k8s_client.go index d785cf2a..fcf95e04 100644 --- a/apis/management.cattle.io/v3/zz_generated_k8s_client.go +++ b/apis/management.cattle.io/v3/zz_generated_k8s_client.go @@ -14,6 +14,7 @@ type Interface interface { RESTClient() rest.Interface controller.Starter + NodePoolsGetter NodesGetter NodeDriversGetter NodeTemplatesGetter @@ -59,6 +60,7 @@ type Client struct { restClient rest.Interface starters []controller.Starter + nodePoolControllers map[string]NodePoolController nodeControllers map[string]NodeController nodeDriverControllers map[string]NodeDriverController nodeTemplateControllers map[string]NodeTemplateController @@ -113,6 +115,7 @@ func NewForConfig(config rest.Config) (Interface, error) { return &Client{ restClient: restClient, + nodePoolControllers: map[string]NodePoolController{}, nodeControllers: map[string]NodeController{}, nodeDriverControllers: map[string]NodeDriverController{}, nodeTemplateControllers: map[string]NodeTemplateController{}, @@ -166,6 +169,19 @@ func (c *Client) Start(ctx context.Context, threadiness int) error { return controller.Start(ctx, threadiness, c.starters...) } +type NodePoolsGetter interface { + NodePools(namespace string) NodePoolInterface +} + +func (c *Client) NodePools(namespace string) NodePoolInterface { + objectClient := clientbase.NewObjectClient(namespace, c.restClient, &NodePoolResource, NodePoolGroupVersionKind, nodePoolFactory{}) + return &nodePoolClient{ + ns: namespace, + client: c, + objectClient: objectClient, + } +} + type NodesGetter interface { Nodes(namespace string) NodeInterface } diff --git a/apis/management.cattle.io/v3/zz_generated_node_pool_controller.go b/apis/management.cattle.io/v3/zz_generated_node_pool_controller.go new file mode 100644 index 00000000..a7f63f4b --- /dev/null +++ b/apis/management.cattle.io/v3/zz_generated_node_pool_controller.go @@ -0,0 +1,252 @@ +package v3 + +import ( + "context" + + "github.com/rancher/norman/clientbase" + "github.com/rancher/norman/controller" + "k8s.io/apimachinery/pkg/api/errors" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/labels" + "k8s.io/apimachinery/pkg/runtime" + "k8s.io/apimachinery/pkg/runtime/schema" + "k8s.io/apimachinery/pkg/watch" + "k8s.io/client-go/tools/cache" +) + +var ( + NodePoolGroupVersionKind = schema.GroupVersionKind{ + Version: Version, + Group: GroupName, + Kind: "NodePool", + } + NodePoolResource = metav1.APIResource{ + Name: "nodepools", + SingularName: "nodepool", + Namespaced: true, + + Kind: NodePoolGroupVersionKind.Kind, + } +) + +type NodePoolList struct { + metav1.TypeMeta `json:",inline"` + metav1.ListMeta `json:"metadata,omitempty"` + Items []NodePool +} + +type NodePoolHandlerFunc func(key string, obj *NodePool) error + +type NodePoolLister interface { + List(namespace string, selector labels.Selector) (ret []*NodePool, err error) + Get(namespace, name string) (*NodePool, error) +} + +type NodePoolController interface { + Informer() cache.SharedIndexInformer + Lister() NodePoolLister + AddHandler(name string, handler NodePoolHandlerFunc) + AddClusterScopedHandler(name, clusterName string, handler NodePoolHandlerFunc) + Enqueue(namespace, name string) + Sync(ctx context.Context) error + Start(ctx context.Context, threadiness int) error +} + +type NodePoolInterface interface { + ObjectClient() *clientbase.ObjectClient + Create(*NodePool) (*NodePool, error) + GetNamespaced(namespace, name string, opts metav1.GetOptions) (*NodePool, error) + Get(name string, opts metav1.GetOptions) (*NodePool, error) + Update(*NodePool) (*NodePool, error) + Delete(name string, options *metav1.DeleteOptions) error + DeleteNamespaced(namespace, name string, options *metav1.DeleteOptions) error + List(opts metav1.ListOptions) (*NodePoolList, error) + Watch(opts metav1.ListOptions) (watch.Interface, error) + DeleteCollection(deleteOpts *metav1.DeleteOptions, listOpts metav1.ListOptions) error + Controller() NodePoolController + AddHandler(name string, sync NodePoolHandlerFunc) + AddLifecycle(name string, lifecycle NodePoolLifecycle) + AddClusterScopedHandler(name, clusterName string, sync NodePoolHandlerFunc) + AddClusterScopedLifecycle(name, clusterName string, lifecycle NodePoolLifecycle) +} + +type nodePoolLister struct { + controller *nodePoolController +} + +func (l *nodePoolLister) List(namespace string, selector labels.Selector) (ret []*NodePool, err error) { + err = cache.ListAllByNamespace(l.controller.Informer().GetIndexer(), namespace, selector, func(obj interface{}) { + ret = append(ret, obj.(*NodePool)) + }) + return +} + +func (l *nodePoolLister) Get(namespace, name string) (*NodePool, error) { + var key string + if namespace != "" { + key = namespace + "/" + name + } else { + key = name + } + obj, exists, err := l.controller.Informer().GetIndexer().GetByKey(key) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(schema.GroupResource{ + Group: NodePoolGroupVersionKind.Group, + Resource: "nodePool", + }, name) + } + return obj.(*NodePool), nil +} + +type nodePoolController struct { + controller.GenericController +} + +func (c *nodePoolController) Lister() NodePoolLister { + return &nodePoolLister{ + controller: c, + } +} + +func (c *nodePoolController) AddHandler(name string, handler NodePoolHandlerFunc) { + c.GenericController.AddHandler(name, 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.(*NodePool)) + }) +} + +func (c *nodePoolController) AddClusterScopedHandler(name, cluster string, handler NodePoolHandlerFunc) { + c.GenericController.AddHandler(name, func(key string) error { + obj, exists, err := c.Informer().GetStore().GetByKey(key) + if err != nil { + return err + } + if !exists { + return handler(key, nil) + } + + if !controller.ObjectInCluster(cluster, obj) { + return nil + } + + return handler(key, obj.(*NodePool)) + }) +} + +type nodePoolFactory struct { +} + +func (c nodePoolFactory) Object() runtime.Object { + return &NodePool{} +} + +func (c nodePoolFactory) List() runtime.Object { + return &NodePoolList{} +} + +func (s *nodePoolClient) Controller() NodePoolController { + s.client.Lock() + defer s.client.Unlock() + + c, ok := s.client.nodePoolControllers[s.ns] + if ok { + return c + } + + genericController := controller.NewGenericController(NodePoolGroupVersionKind.Kind+"Controller", + s.objectClient) + + c = &nodePoolController{ + GenericController: genericController, + } + + s.client.nodePoolControllers[s.ns] = c + s.client.starters = append(s.client.starters, c) + + return c +} + +type nodePoolClient struct { + client *Client + ns string + objectClient *clientbase.ObjectClient + controller NodePoolController +} + +func (s *nodePoolClient) ObjectClient() *clientbase.ObjectClient { + return s.objectClient +} + +func (s *nodePoolClient) Create(o *NodePool) (*NodePool, error) { + obj, err := s.objectClient.Create(o) + return obj.(*NodePool), err +} + +func (s *nodePoolClient) Get(name string, opts metav1.GetOptions) (*NodePool, error) { + obj, err := s.objectClient.Get(name, opts) + return obj.(*NodePool), err +} + +func (s *nodePoolClient) GetNamespaced(namespace, name string, opts metav1.GetOptions) (*NodePool, error) { + obj, err := s.objectClient.GetNamespaced(namespace, name, opts) + return obj.(*NodePool), err +} + +func (s *nodePoolClient) Update(o *NodePool) (*NodePool, error) { + obj, err := s.objectClient.Update(o.Name, o) + return obj.(*NodePool), err +} + +func (s *nodePoolClient) Delete(name string, options *metav1.DeleteOptions) error { + return s.objectClient.Delete(name, options) +} + +func (s *nodePoolClient) DeleteNamespaced(namespace, name string, options *metav1.DeleteOptions) error { + return s.objectClient.DeleteNamespaced(namespace, name, options) +} + +func (s *nodePoolClient) List(opts metav1.ListOptions) (*NodePoolList, error) { + obj, err := s.objectClient.List(opts) + return obj.(*NodePoolList), err +} + +func (s *nodePoolClient) Watch(opts metav1.ListOptions) (watch.Interface, error) { + return s.objectClient.Watch(opts) +} + +// Patch applies the patch and returns the patched deployment. +func (s *nodePoolClient) Patch(o *NodePool, data []byte, subresources ...string) (*NodePool, error) { + obj, err := s.objectClient.Patch(o.Name, o, data, subresources...) + return obj.(*NodePool), err +} + +func (s *nodePoolClient) DeleteCollection(deleteOpts *metav1.DeleteOptions, listOpts metav1.ListOptions) error { + return s.objectClient.DeleteCollection(deleteOpts, listOpts) +} + +func (s *nodePoolClient) AddHandler(name string, sync NodePoolHandlerFunc) { + s.Controller().AddHandler(name, sync) +} + +func (s *nodePoolClient) AddLifecycle(name string, lifecycle NodePoolLifecycle) { + sync := NewNodePoolLifecycleAdapter(name, false, s, lifecycle) + s.AddHandler(name, sync) +} + +func (s *nodePoolClient) AddClusterScopedHandler(name, clusterName string, sync NodePoolHandlerFunc) { + s.Controller().AddClusterScopedHandler(name, clusterName, sync) +} + +func (s *nodePoolClient) AddClusterScopedLifecycle(name, clusterName string, lifecycle NodePoolLifecycle) { + sync := NewNodePoolLifecycleAdapter(name+"_"+clusterName, true, s, lifecycle) + s.AddClusterScopedHandler(name, clusterName, sync) +} diff --git a/apis/management.cattle.io/v3/zz_generated_node_pool_lifecycle_adapter.go b/apis/management.cattle.io/v3/zz_generated_node_pool_lifecycle_adapter.go new file mode 100644 index 00000000..ce46d30a --- /dev/null +++ b/apis/management.cattle.io/v3/zz_generated_node_pool_lifecycle_adapter.go @@ -0,0 +1,51 @@ +package v3 + +import ( + "github.com/rancher/norman/lifecycle" + "k8s.io/apimachinery/pkg/runtime" +) + +type NodePoolLifecycle interface { + Create(obj *NodePool) (*NodePool, error) + Remove(obj *NodePool) (*NodePool, error) + Updated(obj *NodePool) (*NodePool, error) +} + +type nodePoolLifecycleAdapter struct { + lifecycle NodePoolLifecycle +} + +func (w *nodePoolLifecycleAdapter) Create(obj runtime.Object) (runtime.Object, error) { + o, err := w.lifecycle.Create(obj.(*NodePool)) + if o == nil { + return nil, err + } + return o, err +} + +func (w *nodePoolLifecycleAdapter) Finalize(obj runtime.Object) (runtime.Object, error) { + o, err := w.lifecycle.Remove(obj.(*NodePool)) + if o == nil { + return nil, err + } + return o, err +} + +func (w *nodePoolLifecycleAdapter) Updated(obj runtime.Object) (runtime.Object, error) { + o, err := w.lifecycle.Updated(obj.(*NodePool)) + if o == nil { + return nil, err + } + return o, err +} + +func NewNodePoolLifecycleAdapter(name string, clusterScoped bool, client NodePoolInterface, l NodePoolLifecycle) NodePoolHandlerFunc { + adapter := &nodePoolLifecycleAdapter{lifecycle: l} + syncFn := lifecycle.NewObjectLifecycleAdapter(name, clusterScoped, adapter, client.ObjectClient()) + return func(key string, obj *NodePool) error { + if obj == nil { + return syncFn(key, nil) + } + return syncFn(key, obj) + } +} diff --git a/apis/management.cattle.io/v3/zz_generated_scheme.go b/apis/management.cattle.io/v3/zz_generated_scheme.go index 47a14063..f6701774 100644 --- a/apis/management.cattle.io/v3/zz_generated_scheme.go +++ b/apis/management.cattle.io/v3/zz_generated_scheme.go @@ -33,6 +33,8 @@ func addKnownTypes(scheme *runtime.Scheme) error { // TODO this gets cleaned up when the types are fixed scheme.AddKnownTypes(SchemeGroupVersion, + &NodePool{}, + &NodePoolList{}, &Node{}, &NodeList{}, &NodeDriver{}, diff --git a/client/management/v3/zz_generated_client.go b/client/management/v3/zz_generated_client.go index c4f96497..9fa4a4eb 100644 --- a/client/management/v3/zz_generated_client.go +++ b/client/management/v3/zz_generated_client.go @@ -7,6 +7,7 @@ import ( type Client struct { clientbase.APIBaseClient + NodePool NodePoolOperations Node NodeOperations NodeDriver NodeDriverOperations NodeTemplate NodeTemplateOperations @@ -57,6 +58,7 @@ func NewClient(opts *clientbase.ClientOpts) (*Client, error) { APIBaseClient: baseClient, } + client.NodePool = newNodePoolClient(client) client.Node = newNodeClient(client) client.NodeDriver = newNodeDriverClient(client) client.NodeTemplate = newNodeTemplateClient(client) diff --git a/client/management/v3/zz_generated_cluster.go b/client/management/v3/zz_generated_cluster.go index 6f68b396..c83d6f40 100644 --- a/client/management/v3/zz_generated_cluster.go +++ b/client/management/v3/zz_generated_cluster.go @@ -27,7 +27,6 @@ const ( ClusterFieldLabels = "labels" ClusterFieldLimits = "limits" ClusterFieldName = "name" - ClusterFieldNodePools = "nodePools" ClusterFieldOwnerReferences = "ownerReferences" ClusterFieldRancherKubernetesEngineConfig = "rancherKubernetesEngineConfig" ClusterFieldRemoved = "removed" @@ -61,7 +60,6 @@ type Cluster struct { Labels map[string]string `json:"labels,omitempty"` Limits map[string]string `json:"limits,omitempty"` Name string `json:"name,omitempty"` - NodePools []NodePool `json:"nodePools,omitempty"` OwnerReferences []OwnerReference `json:"ownerReferences,omitempty"` RancherKubernetesEngineConfig *RancherKubernetesEngineConfig `json:"rancherKubernetesEngineConfig,omitempty"` Removed string `json:"removed,omitempty"` diff --git a/client/management/v3/zz_generated_cluster_registration_token.go b/client/management/v3/zz_generated_cluster_registration_token.go index 5896bd2e..a749703e 100644 --- a/client/management/v3/zz_generated_cluster_registration_token.go +++ b/client/management/v3/zz_generated_cluster_registration_token.go @@ -11,6 +11,7 @@ const ( ClusterRegistrationTokenFieldCommand = "command" ClusterRegistrationTokenFieldCreated = "created" ClusterRegistrationTokenFieldCreatorID = "creatorId" + ClusterRegistrationTokenFieldInsecureCommand = "insecureCommand" ClusterRegistrationTokenFieldLabels = "labels" ClusterRegistrationTokenFieldManifestURL = "manifestUrl" ClusterRegistrationTokenFieldName = "name" @@ -32,6 +33,7 @@ type ClusterRegistrationToken struct { Command string `json:"command,omitempty"` Created string `json:"created,omitempty"` CreatorID string `json:"creatorId,omitempty"` + InsecureCommand string `json:"insecureCommand,omitempty"` Labels map[string]string `json:"labels,omitempty"` ManifestURL string `json:"manifestUrl,omitempty"` Name string `json:"name,omitempty"` diff --git a/client/management/v3/zz_generated_cluster_registration_token_status.go b/client/management/v3/zz_generated_cluster_registration_token_status.go index e7257c1b..feaef8a3 100644 --- a/client/management/v3/zz_generated_cluster_registration_token_status.go +++ b/client/management/v3/zz_generated_cluster_registration_token_status.go @@ -1,16 +1,18 @@ package client const ( - ClusterRegistrationTokenStatusType = "clusterRegistrationTokenStatus" - ClusterRegistrationTokenStatusFieldCommand = "command" - ClusterRegistrationTokenStatusFieldManifestURL = "manifestUrl" - ClusterRegistrationTokenStatusFieldNodeCommand = "nodeCommand" - ClusterRegistrationTokenStatusFieldToken = "token" + ClusterRegistrationTokenStatusType = "clusterRegistrationTokenStatus" + ClusterRegistrationTokenStatusFieldCommand = "command" + ClusterRegistrationTokenStatusFieldInsecureCommand = "insecureCommand" + ClusterRegistrationTokenStatusFieldManifestURL = "manifestUrl" + ClusterRegistrationTokenStatusFieldNodeCommand = "nodeCommand" + ClusterRegistrationTokenStatusFieldToken = "token" ) type ClusterRegistrationTokenStatus struct { - Command string `json:"command,omitempty"` - ManifestURL string `json:"manifestUrl,omitempty"` - NodeCommand string `json:"nodeCommand,omitempty"` - Token string `json:"token,omitempty"` + Command string `json:"command,omitempty"` + InsecureCommand string `json:"insecureCommand,omitempty"` + ManifestURL string `json:"manifestUrl,omitempty"` + NodeCommand string `json:"nodeCommand,omitempty"` + Token string `json:"token,omitempty"` } diff --git a/client/management/v3/zz_generated_cluster_spec.go b/client/management/v3/zz_generated_cluster_spec.go index 35afc8ab..2641f4cd 100644 --- a/client/management/v3/zz_generated_cluster_spec.go +++ b/client/management/v3/zz_generated_cluster_spec.go @@ -10,7 +10,6 @@ const ( ClusterSpecFieldGoogleKubernetesEngineConfig = "googleKubernetesEngineConfig" ClusterSpecFieldImportedConfig = "importedConfig" ClusterSpecFieldInternal = "internal" - ClusterSpecFieldNodePools = "nodePools" ClusterSpecFieldRancherKubernetesEngineConfig = "rancherKubernetesEngineConfig" ) @@ -23,6 +22,5 @@ type ClusterSpec struct { GoogleKubernetesEngineConfig *GoogleKubernetesEngineConfig `json:"googleKubernetesEngineConfig,omitempty"` ImportedConfig *ImportedConfig `json:"importedConfig,omitempty"` Internal bool `json:"internal,omitempty"` - NodePools []NodePool `json:"nodePools,omitempty"` RancherKubernetesEngineConfig *RancherKubernetesEngineConfig `json:"rancherKubernetesEngineConfig,omitempty"` } diff --git a/client/management/v3/zz_generated_condition.go b/client/management/v3/zz_generated_condition.go new file mode 100644 index 00000000..25bb9d83 --- /dev/null +++ b/client/management/v3/zz_generated_condition.go @@ -0,0 +1,20 @@ +package client + +const ( + ConditionType = "condition" + ConditionFieldLastTransitionTime = "lastTransitionTime" + ConditionFieldLastUpdateTime = "lastUpdateTime" + ConditionFieldMessage = "message" + ConditionFieldReason = "reason" + ConditionFieldStatus = "status" + ConditionFieldType = "type" +) + +type Condition struct { + LastTransitionTime string `json:"lastTransitionTime,omitempty"` + LastUpdateTime string `json:"lastUpdateTime,omitempty"` + Message string `json:"message,omitempty"` + Reason string `json:"reason,omitempty"` + Status string `json:"status,omitempty"` + Type string `json:"type,omitempty"` +} diff --git a/client/management/v3/zz_generated_node.go b/client/management/v3/zz_generated_node.go index b9bdab6a..4f537ff4 100644 --- a/client/management/v3/zz_generated_node.go +++ b/client/management/v3/zz_generated_node.go @@ -25,10 +25,8 @@ const ( NodeFieldLimits = "limits" NodeFieldName = "name" NodeFieldNamespaceId = "namespaceId" - NodeFieldNodeAnnotations = "nodeAnnotations" - NodeFieldNodeLabels = "nodeLabels" NodeFieldNodeName = "nodeName" - NodeFieldNodePoolUUID = "nodePoolUuid" + NodeFieldNodePoolName = "nodePoolUuid" NodeFieldNodeTaints = "nodeTaints" NodeFieldNodeTemplateId = "nodeTemplateId" NodeFieldOwnerReferences = "ownerReferences" @@ -70,10 +68,8 @@ type Node struct { Limits map[string]string `json:"limits,omitempty"` Name string `json:"name,omitempty"` NamespaceId string `json:"namespaceId,omitempty"` - NodeAnnotations map[string]string `json:"nodeAnnotations,omitempty"` - NodeLabels map[string]string `json:"nodeLabels,omitempty"` NodeName string `json:"nodeName,omitempty"` - NodePoolUUID string `json:"nodePoolUuid,omitempty"` + NodePoolName string `json:"nodePoolUuid,omitempty"` NodeTaints []Taint `json:"nodeTaints,omitempty"` NodeTemplateId string `json:"nodeTemplateId,omitempty"` OwnerReferences []OwnerReference `json:"ownerReferences,omitempty"` diff --git a/client/management/v3/zz_generated_node_driver_condition.go b/client/management/v3/zz_generated_node_driver_condition.go deleted file mode 100644 index d5b70905..00000000 --- a/client/management/v3/zz_generated_node_driver_condition.go +++ /dev/null @@ -1,20 +0,0 @@ -package client - -const ( - NodeDriverConditionType = "nodeDriverCondition" - NodeDriverConditionFieldLastTransitionTime = "lastTransitionTime" - NodeDriverConditionFieldLastUpdateTime = "lastUpdateTime" - NodeDriverConditionFieldMessage = "message" - NodeDriverConditionFieldReason = "reason" - NodeDriverConditionFieldStatus = "status" - NodeDriverConditionFieldType = "type" -) - -type NodeDriverCondition struct { - LastTransitionTime string `json:"lastTransitionTime,omitempty"` - LastUpdateTime string `json:"lastUpdateTime,omitempty"` - Message string `json:"message,omitempty"` - Reason string `json:"reason,omitempty"` - Status string `json:"status,omitempty"` - Type string `json:"type,omitempty"` -} diff --git a/client/management/v3/zz_generated_node_driver_status.go b/client/management/v3/zz_generated_node_driver_status.go index c0d78584..aa6c6dbc 100644 --- a/client/management/v3/zz_generated_node_driver_status.go +++ b/client/management/v3/zz_generated_node_driver_status.go @@ -6,5 +6,5 @@ const ( ) type NodeDriverStatus struct { - Conditions []NodeDriverCondition `json:"conditions,omitempty"` + Conditions []Condition `json:"conditions,omitempty"` } diff --git a/client/management/v3/zz_generated_node_pool.go b/client/management/v3/zz_generated_node_pool.go index 591f42fd..2b723cdb 100644 --- a/client/management/v3/zz_generated_node_pool.go +++ b/client/management/v3/zz_generated_node_pool.go @@ -1,26 +1,121 @@ package client +import ( + "github.com/rancher/norman/types" +) + const ( - NodePoolType = "nodePool" - NodePoolFieldAnnotations = "annotations" - NodePoolFieldControlPlane = "controlPlane" - NodePoolFieldEtcd = "etcd" - NodePoolFieldHostnamePrefix = "hostnamePrefix" - NodePoolFieldLabels = "labels" - NodePoolFieldNodeTemplateId = "nodeTemplateId" - NodePoolFieldQuantity = "quantity" - NodePoolFieldUUID = "uuid" - NodePoolFieldWorker = "worker" + NodePoolType = "nodePool" + NodePoolFieldAnnotations = "annotations" + NodePoolFieldClusterId = "clusterId" + NodePoolFieldControlPlane = "controlPlane" + NodePoolFieldCreated = "created" + NodePoolFieldCreatorID = "creatorId" + NodePoolFieldDisplayName = "displayName" + NodePoolFieldEtcd = "etcd" + NodePoolFieldHostnamePrefix = "hostnamePrefix" + NodePoolFieldLabels = "labels" + NodePoolFieldName = "name" + NodePoolFieldNamespaceId = "namespaceId" + NodePoolFieldNodeAnnotations = "nodeAnnotations" + NodePoolFieldNodeLabels = "nodeLabels" + NodePoolFieldNodeTemplateId = "nodeTemplateId" + NodePoolFieldOwnerReferences = "ownerReferences" + NodePoolFieldQuantity = "quantity" + NodePoolFieldRemoved = "removed" + NodePoolFieldState = "state" + NodePoolFieldStatus = "status" + NodePoolFieldTransitioning = "transitioning" + NodePoolFieldTransitioningMessage = "transitioningMessage" + NodePoolFieldUuid = "uuid" + NodePoolFieldWorker = "worker" ) type NodePool struct { - Annotations map[string]string `json:"annotations,omitempty"` - ControlPlane bool `json:"controlPlane,omitempty"` - Etcd bool `json:"etcd,omitempty"` - HostnamePrefix string `json:"hostnamePrefix,omitempty"` - Labels map[string]string `json:"labels,omitempty"` - NodeTemplateId string `json:"nodeTemplateId,omitempty"` - Quantity *int64 `json:"quantity,omitempty"` - UUID string `json:"uuid,omitempty"` - Worker bool `json:"worker,omitempty"` + types.Resource + Annotations map[string]string `json:"annotations,omitempty"` + ClusterId string `json:"clusterId,omitempty"` + ControlPlane bool `json:"controlPlane,omitempty"` + Created string `json:"created,omitempty"` + CreatorID string `json:"creatorId,omitempty"` + DisplayName string `json:"displayName,omitempty"` + Etcd bool `json:"etcd,omitempty"` + HostnamePrefix string `json:"hostnamePrefix,omitempty"` + Labels map[string]string `json:"labels,omitempty"` + Name string `json:"name,omitempty"` + NamespaceId string `json:"namespaceId,omitempty"` + NodeAnnotations map[string]string `json:"nodeAnnotations,omitempty"` + NodeLabels map[string]string `json:"nodeLabels,omitempty"` + NodeTemplateId string `json:"nodeTemplateId,omitempty"` + OwnerReferences []OwnerReference `json:"ownerReferences,omitempty"` + Quantity *int64 `json:"quantity,omitempty"` + Removed string `json:"removed,omitempty"` + State string `json:"state,omitempty"` + Status *NodePoolStatus `json:"status,omitempty"` + Transitioning string `json:"transitioning,omitempty"` + TransitioningMessage string `json:"transitioningMessage,omitempty"` + Uuid string `json:"uuid,omitempty"` + Worker bool `json:"worker,omitempty"` +} +type NodePoolCollection struct { + types.Collection + Data []NodePool `json:"data,omitempty"` + client *NodePoolClient +} + +type NodePoolClient struct { + apiClient *Client +} + +type NodePoolOperations interface { + List(opts *types.ListOpts) (*NodePoolCollection, error) + Create(opts *NodePool) (*NodePool, error) + Update(existing *NodePool, updates interface{}) (*NodePool, error) + ByID(id string) (*NodePool, error) + Delete(container *NodePool) error +} + +func newNodePoolClient(apiClient *Client) *NodePoolClient { + return &NodePoolClient{ + apiClient: apiClient, + } +} + +func (c *NodePoolClient) Create(container *NodePool) (*NodePool, error) { + resp := &NodePool{} + err := c.apiClient.Ops.DoCreate(NodePoolType, container, resp) + return resp, err +} + +func (c *NodePoolClient) Update(existing *NodePool, updates interface{}) (*NodePool, error) { + resp := &NodePool{} + err := c.apiClient.Ops.DoUpdate(NodePoolType, &existing.Resource, updates, resp) + return resp, err +} + +func (c *NodePoolClient) List(opts *types.ListOpts) (*NodePoolCollection, error) { + resp := &NodePoolCollection{} + err := c.apiClient.Ops.DoList(NodePoolType, opts, resp) + resp.client = c + return resp, err +} + +func (cc *NodePoolCollection) Next() (*NodePoolCollection, error) { + if cc != nil && cc.Pagination != nil && cc.Pagination.Next != "" { + resp := &NodePoolCollection{} + err := cc.client.apiClient.Ops.DoNext(cc.Pagination.Next, resp) + resp.client = cc.client + return resp, err + } + return nil, nil +} + +func (c *NodePoolClient) ByID(id string) (*NodePool, error) { + resp := &NodePool{} + err := c.apiClient.Ops.DoByID(NodePoolType, id, resp) + return resp, err +} + +func (c *NodePoolClient) Delete(container *NodePool) error { + return c.apiClient.Ops.DoResourceDelete(NodePoolType, &container.Resource) } diff --git a/client/management/v3/zz_generated_node_pool_spec.go b/client/management/v3/zz_generated_node_pool_spec.go new file mode 100644 index 00000000..929b8ac0 --- /dev/null +++ b/client/management/v3/zz_generated_node_pool_spec.go @@ -0,0 +1,28 @@ +package client + +const ( + NodePoolSpecType = "nodePoolSpec" + NodePoolSpecFieldClusterId = "clusterId" + NodePoolSpecFieldControlPlane = "controlPlane" + NodePoolSpecFieldDisplayName = "displayName" + NodePoolSpecFieldEtcd = "etcd" + NodePoolSpecFieldHostnamePrefix = "hostnamePrefix" + NodePoolSpecFieldNodeAnnotations = "nodeAnnotations" + NodePoolSpecFieldNodeLabels = "nodeLabels" + NodePoolSpecFieldNodeTemplateId = "nodeTemplateId" + NodePoolSpecFieldQuantity = "quantity" + NodePoolSpecFieldWorker = "worker" +) + +type NodePoolSpec struct { + ClusterId string `json:"clusterId,omitempty"` + ControlPlane bool `json:"controlPlane,omitempty"` + DisplayName string `json:"displayName,omitempty"` + Etcd bool `json:"etcd,omitempty"` + HostnamePrefix string `json:"hostnamePrefix,omitempty"` + NodeAnnotations map[string]string `json:"nodeAnnotations,omitempty"` + NodeLabels map[string]string `json:"nodeLabels,omitempty"` + NodeTemplateId string `json:"nodeTemplateId,omitempty"` + Quantity *int64 `json:"quantity,omitempty"` + Worker bool `json:"worker,omitempty"` +} diff --git a/client/management/v3/zz_generated_node_pool_status.go b/client/management/v3/zz_generated_node_pool_status.go new file mode 100644 index 00000000..eb99ff14 --- /dev/null +++ b/client/management/v3/zz_generated_node_pool_status.go @@ -0,0 +1,10 @@ +package client + +const ( + NodePoolStatusType = "nodePoolStatus" + NodePoolStatusFieldConditions = "conditions" +) + +type NodePoolStatus struct { + Conditions []Condition `json:"conditions,omitempty"` +} diff --git a/client/management/v3/zz_generated_node_spec.go b/client/management/v3/zz_generated_node_spec.go index e3aa9951..5f5beb8c 100644 --- a/client/management/v3/zz_generated_node_spec.go +++ b/client/management/v3/zz_generated_node_spec.go @@ -9,7 +9,7 @@ const ( NodeSpecFieldDisplayName = "displayName" NodeSpecFieldEtcd = "etcd" NodeSpecFieldImported = "imported" - NodeSpecFieldNodePoolUUID = "nodePoolUuid" + NodeSpecFieldNodePoolName = "nodePoolUuid" NodeSpecFieldNodeTemplateId = "nodeTemplateId" NodeSpecFieldPodCidr = "podCidr" NodeSpecFieldProviderId = "providerId" @@ -27,7 +27,7 @@ type NodeSpec struct { DisplayName string `json:"displayName,omitempty"` Etcd bool `json:"etcd,omitempty"` Imported bool `json:"imported,omitempty"` - NodePoolUUID string `json:"nodePoolUuid,omitempty"` + NodePoolName string `json:"nodePoolUuid,omitempty"` NodeTemplateId string `json:"nodeTemplateId,omitempty"` PodCidr string `json:"podCidr,omitempty"` ProviderId string `json:"providerId,omitempty"`