From 14f9cc58b89ed06866ec81ab87c916dd4a2a0284 Mon Sep 17 00:00:00 2001 From: Alvaro Aleman Date: Mon, 3 Jun 2019 17:35:36 +0200 Subject: [PATCH] Add cluster-api api and generate clientset --- .../clientset/versioned/clientset.go | 98 ++ .../clusterapi/clientset/versioned/doc.go | 20 + .../versioned/fake/clientset_generated.go | 82 ++ .../clientset/versioned/fake/doc.go | 20 + .../clientset/versioned/fake/register.go | 54 + .../clientset/versioned/scheme/doc.go | 20 + .../clientset/versioned/scheme/register.go | 54 + .../typed/cluster/v1alpha1/cluster.go | 174 ++++ .../typed/cluster/v1alpha1/cluster_client.go | 110 ++ .../versioned/typed/cluster/v1alpha1/doc.go | 20 + .../typed/cluster/v1alpha1/fake/doc.go | 20 + .../cluster/v1alpha1/fake/fake_cluster.go | 140 +++ .../v1alpha1/fake/fake_cluster_client.go | 56 ++ .../cluster/v1alpha1/fake/fake_machine.go | 140 +++ .../v1alpha1/fake/fake_machineclass.go | 128 +++ .../v1alpha1/fake/fake_machinedeployment.go | 140 +++ .../cluster/v1alpha1/fake/fake_machineset.go | 140 +++ .../cluster/v1alpha1/generated_expansion.go | 29 + .../typed/cluster/v1alpha1/machine.go | 174 ++++ .../typed/cluster/v1alpha1/machineclass.go | 157 +++ .../cluster/v1alpha1/machinedeployment.go | 174 ++++ .../typed/cluster/v1alpha1/machineset.go | 174 ++++ .../externalversions/cluster/interface.go | 46 + .../cluster/v1alpha1/cluster.go | 89 ++ .../cluster/v1alpha1/interface.go | 73 ++ .../cluster/v1alpha1/machine.go | 89 ++ .../cluster/v1alpha1/machineclass.go | 89 ++ .../cluster/v1alpha1/machinedeployment.go | 89 ++ .../cluster/v1alpha1/machineset.go | 89 ++ .../informers/externalversions/factory.go | 180 ++++ .../informers/externalversions/generic.go | 70 ++ .../internalinterfaces/factory_interfaces.go | 38 + .../listers/cluster/v1alpha1/cluster.go | 94 ++ .../cluster/v1alpha1/expansion_generated.go | 59 ++ .../listers/cluster/v1alpha1/machine.go | 94 ++ .../listers/cluster/v1alpha1/machineclass.go | 94 ++ .../cluster/v1alpha1/machinedeployment.go | 94 ++ .../listers/cluster/v1alpha1/machineset.go | 94 ++ .../clusterapi/clusterapi_controller.go | 18 +- .../clusterapi/clusterapi_controller_test.go | 2 +- .../clusterapi_machinedeployment.go | 2 +- .../clusterapi/clusterapi_machineset.go | 2 +- .../clusterapi/clusterapi_nodegroup.go | 2 +- .../clusterapi/clusterapi_provider.go | 16 +- .../vendor/k8s.io/utils/pointer/OWNERS | 10 + .../vendor/k8s.io/utils/pointer/pointer.go | 86 ++ .../k8s.io/utils/pointer/pointer_test.go | 72 ++ .../cluster-api/pkg/apis/BUILD.bazel | 15 + .../pkg/apis/addtoscheme_cluster_v1alpha1.go | 26 + .../sigs.k8s.io/cluster-api/pkg/apis/apis.go | 33 + .../cluster-api/pkg/apis/cluster/BUILD.bazel | 8 + .../pkg/apis/cluster/common/BUILD.bazel | 15 + .../pkg/apis/cluster/common/consts.go | 121 +++ .../pkg/apis/cluster/common/plugins.go | 51 + .../cluster-api/pkg/apis/cluster/group.go | 18 + .../pkg/apis/cluster/v1alpha1/BUILD.bazel | 52 + .../apis/cluster/v1alpha1/cluster_types.go | 164 +++ .../pkg/apis/cluster/v1alpha1/common_types.go | 58 ++ .../pkg/apis/cluster/v1alpha1/defaults.go | 74 ++ .../pkg/apis/cluster/v1alpha1/doc.go | 23 + .../apis/cluster/v1alpha1/machine_types.go | 250 +++++ .../cluster/v1alpha1/machineclass_types.go | 78 ++ .../v1alpha1/machinedeployment_types.go | 193 ++++ .../apis/cluster/v1alpha1/machineset_types.go | 221 ++++ .../pkg/apis/cluster/v1alpha1/register.go | 73 ++ .../cluster/v1alpha1/testutil/BUILD.bazel | 9 + .../cluster/v1alpha1/testutil/testutil.go | 36 + .../cluster/v1alpha1/zz_generated.deepcopy.go | 946 ++++++++++++++++++ 68 files changed, 6158 insertions(+), 21 deletions(-) create mode 100644 cluster-autoscaler/client/clusterapi/clientset/versioned/clientset.go create mode 100644 cluster-autoscaler/client/clusterapi/clientset/versioned/doc.go create mode 100644 cluster-autoscaler/client/clusterapi/clientset/versioned/fake/clientset_generated.go create mode 100644 cluster-autoscaler/client/clusterapi/clientset/versioned/fake/doc.go create mode 100644 cluster-autoscaler/client/clusterapi/clientset/versioned/fake/register.go create mode 100644 cluster-autoscaler/client/clusterapi/clientset/versioned/scheme/doc.go create mode 100644 cluster-autoscaler/client/clusterapi/clientset/versioned/scheme/register.go create mode 100644 cluster-autoscaler/client/clusterapi/clientset/versioned/typed/cluster/v1alpha1/cluster.go create mode 100644 cluster-autoscaler/client/clusterapi/clientset/versioned/typed/cluster/v1alpha1/cluster_client.go create mode 100644 cluster-autoscaler/client/clusterapi/clientset/versioned/typed/cluster/v1alpha1/doc.go create mode 100644 cluster-autoscaler/client/clusterapi/clientset/versioned/typed/cluster/v1alpha1/fake/doc.go create mode 100644 cluster-autoscaler/client/clusterapi/clientset/versioned/typed/cluster/v1alpha1/fake/fake_cluster.go create mode 100644 cluster-autoscaler/client/clusterapi/clientset/versioned/typed/cluster/v1alpha1/fake/fake_cluster_client.go create mode 100644 cluster-autoscaler/client/clusterapi/clientset/versioned/typed/cluster/v1alpha1/fake/fake_machine.go create mode 100644 cluster-autoscaler/client/clusterapi/clientset/versioned/typed/cluster/v1alpha1/fake/fake_machineclass.go create mode 100644 cluster-autoscaler/client/clusterapi/clientset/versioned/typed/cluster/v1alpha1/fake/fake_machinedeployment.go create mode 100644 cluster-autoscaler/client/clusterapi/clientset/versioned/typed/cluster/v1alpha1/fake/fake_machineset.go create mode 100644 cluster-autoscaler/client/clusterapi/clientset/versioned/typed/cluster/v1alpha1/generated_expansion.go create mode 100644 cluster-autoscaler/client/clusterapi/clientset/versioned/typed/cluster/v1alpha1/machine.go create mode 100644 cluster-autoscaler/client/clusterapi/clientset/versioned/typed/cluster/v1alpha1/machineclass.go create mode 100644 cluster-autoscaler/client/clusterapi/clientset/versioned/typed/cluster/v1alpha1/machinedeployment.go create mode 100644 cluster-autoscaler/client/clusterapi/clientset/versioned/typed/cluster/v1alpha1/machineset.go create mode 100644 cluster-autoscaler/client/clusterapi/informers/externalversions/cluster/interface.go create mode 100644 cluster-autoscaler/client/clusterapi/informers/externalversions/cluster/v1alpha1/cluster.go create mode 100644 cluster-autoscaler/client/clusterapi/informers/externalversions/cluster/v1alpha1/interface.go create mode 100644 cluster-autoscaler/client/clusterapi/informers/externalversions/cluster/v1alpha1/machine.go create mode 100644 cluster-autoscaler/client/clusterapi/informers/externalversions/cluster/v1alpha1/machineclass.go create mode 100644 cluster-autoscaler/client/clusterapi/informers/externalversions/cluster/v1alpha1/machinedeployment.go create mode 100644 cluster-autoscaler/client/clusterapi/informers/externalversions/cluster/v1alpha1/machineset.go create mode 100644 cluster-autoscaler/client/clusterapi/informers/externalversions/factory.go create mode 100644 cluster-autoscaler/client/clusterapi/informers/externalversions/generic.go create mode 100644 cluster-autoscaler/client/clusterapi/informers/externalversions/internalinterfaces/factory_interfaces.go create mode 100644 cluster-autoscaler/client/clusterapi/listers/cluster/v1alpha1/cluster.go create mode 100644 cluster-autoscaler/client/clusterapi/listers/cluster/v1alpha1/expansion_generated.go create mode 100644 cluster-autoscaler/client/clusterapi/listers/cluster/v1alpha1/machine.go create mode 100644 cluster-autoscaler/client/clusterapi/listers/cluster/v1alpha1/machineclass.go create mode 100644 cluster-autoscaler/client/clusterapi/listers/cluster/v1alpha1/machinedeployment.go create mode 100644 cluster-autoscaler/client/clusterapi/listers/cluster/v1alpha1/machineset.go create mode 100644 cluster-autoscaler/vendor/k8s.io/utils/pointer/OWNERS create mode 100644 cluster-autoscaler/vendor/k8s.io/utils/pointer/pointer.go create mode 100644 cluster-autoscaler/vendor/k8s.io/utils/pointer/pointer_test.go create mode 100644 cluster-autoscaler/vendor/sigs.k8s.io/cluster-api/pkg/apis/BUILD.bazel create mode 100644 cluster-autoscaler/vendor/sigs.k8s.io/cluster-api/pkg/apis/addtoscheme_cluster_v1alpha1.go create mode 100644 cluster-autoscaler/vendor/sigs.k8s.io/cluster-api/pkg/apis/apis.go create mode 100644 cluster-autoscaler/vendor/sigs.k8s.io/cluster-api/pkg/apis/cluster/BUILD.bazel create mode 100644 cluster-autoscaler/vendor/sigs.k8s.io/cluster-api/pkg/apis/cluster/common/BUILD.bazel create mode 100644 cluster-autoscaler/vendor/sigs.k8s.io/cluster-api/pkg/apis/cluster/common/consts.go create mode 100644 cluster-autoscaler/vendor/sigs.k8s.io/cluster-api/pkg/apis/cluster/common/plugins.go create mode 100644 cluster-autoscaler/vendor/sigs.k8s.io/cluster-api/pkg/apis/cluster/group.go create mode 100644 cluster-autoscaler/vendor/sigs.k8s.io/cluster-api/pkg/apis/cluster/v1alpha1/BUILD.bazel create mode 100644 cluster-autoscaler/vendor/sigs.k8s.io/cluster-api/pkg/apis/cluster/v1alpha1/cluster_types.go create mode 100644 cluster-autoscaler/vendor/sigs.k8s.io/cluster-api/pkg/apis/cluster/v1alpha1/common_types.go create mode 100644 cluster-autoscaler/vendor/sigs.k8s.io/cluster-api/pkg/apis/cluster/v1alpha1/defaults.go create mode 100644 cluster-autoscaler/vendor/sigs.k8s.io/cluster-api/pkg/apis/cluster/v1alpha1/doc.go create mode 100644 cluster-autoscaler/vendor/sigs.k8s.io/cluster-api/pkg/apis/cluster/v1alpha1/machine_types.go create mode 100644 cluster-autoscaler/vendor/sigs.k8s.io/cluster-api/pkg/apis/cluster/v1alpha1/machineclass_types.go create mode 100644 cluster-autoscaler/vendor/sigs.k8s.io/cluster-api/pkg/apis/cluster/v1alpha1/machinedeployment_types.go create mode 100644 cluster-autoscaler/vendor/sigs.k8s.io/cluster-api/pkg/apis/cluster/v1alpha1/machineset_types.go create mode 100644 cluster-autoscaler/vendor/sigs.k8s.io/cluster-api/pkg/apis/cluster/v1alpha1/register.go create mode 100644 cluster-autoscaler/vendor/sigs.k8s.io/cluster-api/pkg/apis/cluster/v1alpha1/testutil/BUILD.bazel create mode 100644 cluster-autoscaler/vendor/sigs.k8s.io/cluster-api/pkg/apis/cluster/v1alpha1/testutil/testutil.go create mode 100644 cluster-autoscaler/vendor/sigs.k8s.io/cluster-api/pkg/apis/cluster/v1alpha1/zz_generated.deepcopy.go diff --git a/cluster-autoscaler/client/clusterapi/clientset/versioned/clientset.go b/cluster-autoscaler/client/clusterapi/clientset/versioned/clientset.go new file mode 100644 index 000000000000..0f94ab062bd9 --- /dev/null +++ b/cluster-autoscaler/client/clusterapi/clientset/versioned/clientset.go @@ -0,0 +1,98 @@ +/* +Copyright 2019 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by client-gen. DO NOT EDIT. + +package versioned + +import ( + clusterv1alpha1 "k8s.io/autoscaler/cluster-autoscaler/client/clusterapi/clientset/versioned/typed/cluster/v1alpha1" + discovery "k8s.io/client-go/discovery" + rest "k8s.io/client-go/rest" + flowcontrol "k8s.io/client-go/util/flowcontrol" +) + +type Interface interface { + Discovery() discovery.DiscoveryInterface + ClusterV1alpha1() clusterv1alpha1.ClusterV1alpha1Interface + // Deprecated: please explicitly pick a version if possible. + Cluster() clusterv1alpha1.ClusterV1alpha1Interface +} + +// Clientset contains the clients for groups. Each group has exactly one +// version included in a Clientset. +type Clientset struct { + *discovery.DiscoveryClient + clusterV1alpha1 *clusterv1alpha1.ClusterV1alpha1Client +} + +// ClusterV1alpha1 retrieves the ClusterV1alpha1Client +func (c *Clientset) ClusterV1alpha1() clusterv1alpha1.ClusterV1alpha1Interface { + return c.clusterV1alpha1 +} + +// Deprecated: Cluster retrieves the default version of ClusterClient. +// Please explicitly pick a version. +func (c *Clientset) Cluster() clusterv1alpha1.ClusterV1alpha1Interface { + return c.clusterV1alpha1 +} + +// Discovery retrieves the DiscoveryClient +func (c *Clientset) Discovery() discovery.DiscoveryInterface { + if c == nil { + return nil + } + return c.DiscoveryClient +} + +// NewForConfig creates a new Clientset for the given config. +func NewForConfig(c *rest.Config) (*Clientset, error) { + configShallowCopy := *c + if configShallowCopy.RateLimiter == nil && configShallowCopy.QPS > 0 { + configShallowCopy.RateLimiter = flowcontrol.NewTokenBucketRateLimiter(configShallowCopy.QPS, configShallowCopy.Burst) + } + var cs Clientset + var err error + cs.clusterV1alpha1, err = clusterv1alpha1.NewForConfig(&configShallowCopy) + if err != nil { + return nil, err + } + + cs.DiscoveryClient, err = discovery.NewDiscoveryClientForConfig(&configShallowCopy) + if err != nil { + return nil, err + } + return &cs, nil +} + +// NewForConfigOrDie creates a new Clientset for the given config and +// panics if there is an error in the config. +func NewForConfigOrDie(c *rest.Config) *Clientset { + var cs Clientset + cs.clusterV1alpha1 = clusterv1alpha1.NewForConfigOrDie(c) + + cs.DiscoveryClient = discovery.NewDiscoveryClientForConfigOrDie(c) + return &cs +} + +// New creates a new Clientset for the given RESTClient. +func New(c rest.Interface) *Clientset { + var cs Clientset + cs.clusterV1alpha1 = clusterv1alpha1.New(c) + + cs.DiscoveryClient = discovery.NewDiscoveryClient(c) + return &cs +} diff --git a/cluster-autoscaler/client/clusterapi/clientset/versioned/doc.go b/cluster-autoscaler/client/clusterapi/clientset/versioned/doc.go new file mode 100644 index 000000000000..dc992b90b144 --- /dev/null +++ b/cluster-autoscaler/client/clusterapi/clientset/versioned/doc.go @@ -0,0 +1,20 @@ +/* +Copyright 2019 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by client-gen. DO NOT EDIT. + +// This package has the automatically generated clientset. +package versioned diff --git a/cluster-autoscaler/client/clusterapi/clientset/versioned/fake/clientset_generated.go b/cluster-autoscaler/client/clusterapi/clientset/versioned/fake/clientset_generated.go new file mode 100644 index 000000000000..1eade68f9e0a --- /dev/null +++ b/cluster-autoscaler/client/clusterapi/clientset/versioned/fake/clientset_generated.go @@ -0,0 +1,82 @@ +/* +Copyright 2019 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by client-gen. DO NOT EDIT. + +package fake + +import ( + "k8s.io/apimachinery/pkg/runtime" + "k8s.io/apimachinery/pkg/watch" + clientset "k8s.io/autoscaler/cluster-autoscaler/client/clusterapi/clientset/versioned" + clusterv1alpha1 "k8s.io/autoscaler/cluster-autoscaler/client/clusterapi/clientset/versioned/typed/cluster/v1alpha1" + fakeclusterv1alpha1 "k8s.io/autoscaler/cluster-autoscaler/client/clusterapi/clientset/versioned/typed/cluster/v1alpha1/fake" + "k8s.io/client-go/discovery" + fakediscovery "k8s.io/client-go/discovery/fake" + "k8s.io/client-go/testing" +) + +// NewSimpleClientset returns a clientset that will respond with the provided objects. +// It's backed by a very simple object tracker that processes creates, updates and deletions as-is, +// without applying any validations and/or defaults. It shouldn't be considered a replacement +// for a real clientset and is mostly useful in simple unit tests. +func NewSimpleClientset(objects ...runtime.Object) *Clientset { + o := testing.NewObjectTracker(scheme, codecs.UniversalDecoder()) + for _, obj := range objects { + if err := o.Add(obj); err != nil { + panic(err) + } + } + + cs := &Clientset{} + cs.discovery = &fakediscovery.FakeDiscovery{Fake: &cs.Fake} + cs.AddReactor("*", "*", testing.ObjectReaction(o)) + cs.AddWatchReactor("*", func(action testing.Action) (handled bool, ret watch.Interface, err error) { + gvr := action.GetResource() + ns := action.GetNamespace() + watch, err := o.Watch(gvr, ns) + if err != nil { + return false, nil, err + } + return true, watch, nil + }) + + return cs +} + +// Clientset implements clientset.Interface. Meant to be embedded into a +// struct to get a default implementation. This makes faking out just the method +// you want to test easier. +type Clientset struct { + testing.Fake + discovery *fakediscovery.FakeDiscovery +} + +func (c *Clientset) Discovery() discovery.DiscoveryInterface { + return c.discovery +} + +var _ clientset.Interface = &Clientset{} + +// ClusterV1alpha1 retrieves the ClusterV1alpha1Client +func (c *Clientset) ClusterV1alpha1() clusterv1alpha1.ClusterV1alpha1Interface { + return &fakeclusterv1alpha1.FakeClusterV1alpha1{Fake: &c.Fake} +} + +// Cluster retrieves the ClusterV1alpha1Client +func (c *Clientset) Cluster() clusterv1alpha1.ClusterV1alpha1Interface { + return &fakeclusterv1alpha1.FakeClusterV1alpha1{Fake: &c.Fake} +} diff --git a/cluster-autoscaler/client/clusterapi/clientset/versioned/fake/doc.go b/cluster-autoscaler/client/clusterapi/clientset/versioned/fake/doc.go new file mode 100644 index 000000000000..acfa6173b9e8 --- /dev/null +++ b/cluster-autoscaler/client/clusterapi/clientset/versioned/fake/doc.go @@ -0,0 +1,20 @@ +/* +Copyright 2019 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by client-gen. DO NOT EDIT. + +// This package has the automatically generated fake clientset. +package fake diff --git a/cluster-autoscaler/client/clusterapi/clientset/versioned/fake/register.go b/cluster-autoscaler/client/clusterapi/clientset/versioned/fake/register.go new file mode 100644 index 000000000000..e97b75701e17 --- /dev/null +++ b/cluster-autoscaler/client/clusterapi/clientset/versioned/fake/register.go @@ -0,0 +1,54 @@ +/* +Copyright 2019 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by client-gen. DO NOT EDIT. + +package fake + +import ( + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + schema "k8s.io/apimachinery/pkg/runtime/schema" + serializer "k8s.io/apimachinery/pkg/runtime/serializer" + clusterv1alpha1 "sigs.k8s.io/cluster-api/pkg/apis/cluster/v1alpha1" +) + +var scheme = runtime.NewScheme() +var codecs = serializer.NewCodecFactory(scheme) +var parameterCodec = runtime.NewParameterCodec(scheme) + +func init() { + v1.AddToGroupVersion(scheme, schema.GroupVersion{Version: "v1"}) + AddToScheme(scheme) +} + +// AddToScheme adds all types of this clientset into the given scheme. This allows composition +// of clientsets, like in: +// +// import ( +// "k8s.io/client-go/kubernetes" +// clientsetscheme "k8s.io/client-go/kubernetes/scheme" +// aggregatorclientsetscheme "k8s.io/kube-aggregator/pkg/client/clientset_generated/clientset/scheme" +// ) +// +// kclientset, _ := kubernetes.NewForConfig(c) +// aggregatorclientsetscheme.AddToScheme(clientsetscheme.Scheme) +// +// After this, RawExtensions in Kubernetes types will serialize kube-aggregator types +// correctly. +func AddToScheme(scheme *runtime.Scheme) { + clusterv1alpha1.AddToScheme(scheme) +} diff --git a/cluster-autoscaler/client/clusterapi/clientset/versioned/scheme/doc.go b/cluster-autoscaler/client/clusterapi/clientset/versioned/scheme/doc.go new file mode 100644 index 000000000000..7f61dc1f9f6e --- /dev/null +++ b/cluster-autoscaler/client/clusterapi/clientset/versioned/scheme/doc.go @@ -0,0 +1,20 @@ +/* +Copyright 2019 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by client-gen. DO NOT EDIT. + +// This package contains the scheme of the automatically generated clientset. +package scheme diff --git a/cluster-autoscaler/client/clusterapi/clientset/versioned/scheme/register.go b/cluster-autoscaler/client/clusterapi/clientset/versioned/scheme/register.go new file mode 100644 index 000000000000..6af219210e0f --- /dev/null +++ b/cluster-autoscaler/client/clusterapi/clientset/versioned/scheme/register.go @@ -0,0 +1,54 @@ +/* +Copyright 2019 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by client-gen. DO NOT EDIT. + +package scheme + +import ( + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + schema "k8s.io/apimachinery/pkg/runtime/schema" + serializer "k8s.io/apimachinery/pkg/runtime/serializer" + clusterv1alpha1 "sigs.k8s.io/cluster-api/pkg/apis/cluster/v1alpha1" +) + +var Scheme = runtime.NewScheme() +var Codecs = serializer.NewCodecFactory(Scheme) +var ParameterCodec = runtime.NewParameterCodec(Scheme) + +func init() { + v1.AddToGroupVersion(Scheme, schema.GroupVersion{Version: "v1"}) + AddToScheme(Scheme) +} + +// AddToScheme adds all types of this clientset into the given scheme. This allows composition +// of clientsets, like in: +// +// import ( +// "k8s.io/client-go/kubernetes" +// clientsetscheme "k8s.io/client-go/kubernetes/scheme" +// aggregatorclientsetscheme "k8s.io/kube-aggregator/pkg/client/clientset_generated/clientset/scheme" +// ) +// +// kclientset, _ := kubernetes.NewForConfig(c) +// aggregatorclientsetscheme.AddToScheme(clientsetscheme.Scheme) +// +// After this, RawExtensions in Kubernetes types will serialize kube-aggregator types +// correctly. +func AddToScheme(scheme *runtime.Scheme) { + clusterv1alpha1.AddToScheme(scheme) +} diff --git a/cluster-autoscaler/client/clusterapi/clientset/versioned/typed/cluster/v1alpha1/cluster.go b/cluster-autoscaler/client/clusterapi/clientset/versioned/typed/cluster/v1alpha1/cluster.go new file mode 100644 index 000000000000..4e662feca576 --- /dev/null +++ b/cluster-autoscaler/client/clusterapi/clientset/versioned/typed/cluster/v1alpha1/cluster.go @@ -0,0 +1,174 @@ +/* +Copyright 2019 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by client-gen. DO NOT EDIT. + +package v1alpha1 + +import ( + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + types "k8s.io/apimachinery/pkg/types" + watch "k8s.io/apimachinery/pkg/watch" + scheme "k8s.io/autoscaler/cluster-autoscaler/client/clusterapi/clientset/versioned/scheme" + rest "k8s.io/client-go/rest" + v1alpha1 "sigs.k8s.io/cluster-api/pkg/apis/cluster/v1alpha1" +) + +// ClustersGetter has a method to return a ClusterInterface. +// A group's client should implement this interface. +type ClustersGetter interface { + Clusters(namespace string) ClusterInterface +} + +// ClusterInterface has methods to work with Cluster resources. +type ClusterInterface interface { + Create(*v1alpha1.Cluster) (*v1alpha1.Cluster, error) + Update(*v1alpha1.Cluster) (*v1alpha1.Cluster, error) + UpdateStatus(*v1alpha1.Cluster) (*v1alpha1.Cluster, error) + Delete(name string, options *v1.DeleteOptions) error + DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error + Get(name string, options v1.GetOptions) (*v1alpha1.Cluster, error) + List(opts v1.ListOptions) (*v1alpha1.ClusterList, error) + Watch(opts v1.ListOptions) (watch.Interface, error) + Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1alpha1.Cluster, err error) + ClusterExpansion +} + +// clusters implements ClusterInterface +type clusters struct { + client rest.Interface + ns string +} + +// newClusters returns a Clusters +func newClusters(c *ClusterV1alpha1Client, namespace string) *clusters { + return &clusters{ + client: c.RESTClient(), + ns: namespace, + } +} + +// Get takes name of the cluster, and returns the corresponding cluster object, and an error if there is any. +func (c *clusters) Get(name string, options v1.GetOptions) (result *v1alpha1.Cluster, err error) { + result = &v1alpha1.Cluster{} + err = c.client.Get(). + Namespace(c.ns). + Resource("clusters"). + Name(name). + VersionedParams(&options, scheme.ParameterCodec). + Do(). + Into(result) + return +} + +// List takes label and field selectors, and returns the list of Clusters that match those selectors. +func (c *clusters) List(opts v1.ListOptions) (result *v1alpha1.ClusterList, err error) { + result = &v1alpha1.ClusterList{} + err = c.client.Get(). + Namespace(c.ns). + Resource("clusters"). + VersionedParams(&opts, scheme.ParameterCodec). + Do(). + Into(result) + return +} + +// Watch returns a watch.Interface that watches the requested clusters. +func (c *clusters) Watch(opts v1.ListOptions) (watch.Interface, error) { + opts.Watch = true + return c.client.Get(). + Namespace(c.ns). + Resource("clusters"). + VersionedParams(&opts, scheme.ParameterCodec). + Watch() +} + +// Create takes the representation of a cluster and creates it. Returns the server's representation of the cluster, and an error, if there is any. +func (c *clusters) Create(cluster *v1alpha1.Cluster) (result *v1alpha1.Cluster, err error) { + result = &v1alpha1.Cluster{} + err = c.client.Post(). + Namespace(c.ns). + Resource("clusters"). + Body(cluster). + Do(). + Into(result) + return +} + +// Update takes the representation of a cluster and updates it. Returns the server's representation of the cluster, and an error, if there is any. +func (c *clusters) Update(cluster *v1alpha1.Cluster) (result *v1alpha1.Cluster, err error) { + result = &v1alpha1.Cluster{} + err = c.client.Put(). + Namespace(c.ns). + Resource("clusters"). + Name(cluster.Name). + Body(cluster). + Do(). + Into(result) + return +} + +// UpdateStatus was generated because the type contains a Status member. +// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). + +func (c *clusters) UpdateStatus(cluster *v1alpha1.Cluster) (result *v1alpha1.Cluster, err error) { + result = &v1alpha1.Cluster{} + err = c.client.Put(). + Namespace(c.ns). + Resource("clusters"). + Name(cluster.Name). + SubResource("status"). + Body(cluster). + Do(). + Into(result) + return +} + +// Delete takes name of the cluster and deletes it. Returns an error if one occurs. +func (c *clusters) Delete(name string, options *v1.DeleteOptions) error { + return c.client.Delete(). + Namespace(c.ns). + Resource("clusters"). + Name(name). + Body(options). + Do(). + Error() +} + +// DeleteCollection deletes a collection of objects. +func (c *clusters) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error { + return c.client.Delete(). + Namespace(c.ns). + Resource("clusters"). + VersionedParams(&listOptions, scheme.ParameterCodec). + Body(options). + Do(). + Error() +} + +// Patch applies the patch and returns the patched cluster. +func (c *clusters) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1alpha1.Cluster, err error) { + result = &v1alpha1.Cluster{} + err = c.client.Patch(pt). + Namespace(c.ns). + Resource("clusters"). + SubResource(subresources...). + Name(name). + Body(data). + Do(). + Into(result) + return +} diff --git a/cluster-autoscaler/client/clusterapi/clientset/versioned/typed/cluster/v1alpha1/cluster_client.go b/cluster-autoscaler/client/clusterapi/clientset/versioned/typed/cluster/v1alpha1/cluster_client.go new file mode 100644 index 000000000000..10a6a1268094 --- /dev/null +++ b/cluster-autoscaler/client/clusterapi/clientset/versioned/typed/cluster/v1alpha1/cluster_client.go @@ -0,0 +1,110 @@ +/* +Copyright 2019 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by client-gen. DO NOT EDIT. + +package v1alpha1 + +import ( + serializer "k8s.io/apimachinery/pkg/runtime/serializer" + "k8s.io/autoscaler/cluster-autoscaler/client/clusterapi/clientset/versioned/scheme" + rest "k8s.io/client-go/rest" + v1alpha1 "sigs.k8s.io/cluster-api/pkg/apis/cluster/v1alpha1" +) + +type ClusterV1alpha1Interface interface { + RESTClient() rest.Interface + ClustersGetter + MachinesGetter + MachineClassesGetter + MachineDeploymentsGetter + MachineSetsGetter +} + +// ClusterV1alpha1Client is used to interact with features provided by the cluster.k8s.io group. +type ClusterV1alpha1Client struct { + restClient rest.Interface +} + +func (c *ClusterV1alpha1Client) Clusters(namespace string) ClusterInterface { + return newClusters(c, namespace) +} + +func (c *ClusterV1alpha1Client) Machines(namespace string) MachineInterface { + return newMachines(c, namespace) +} + +func (c *ClusterV1alpha1Client) MachineClasses(namespace string) MachineClassInterface { + return newMachineClasses(c, namespace) +} + +func (c *ClusterV1alpha1Client) MachineDeployments(namespace string) MachineDeploymentInterface { + return newMachineDeployments(c, namespace) +} + +func (c *ClusterV1alpha1Client) MachineSets(namespace string) MachineSetInterface { + return newMachineSets(c, namespace) +} + +// NewForConfig creates a new ClusterV1alpha1Client for the given config. +func NewForConfig(c *rest.Config) (*ClusterV1alpha1Client, error) { + config := *c + if err := setConfigDefaults(&config); err != nil { + return nil, err + } + client, err := rest.RESTClientFor(&config) + if err != nil { + return nil, err + } + return &ClusterV1alpha1Client{client}, nil +} + +// NewForConfigOrDie creates a new ClusterV1alpha1Client for the given config and +// panics if there is an error in the config. +func NewForConfigOrDie(c *rest.Config) *ClusterV1alpha1Client { + client, err := NewForConfig(c) + if err != nil { + panic(err) + } + return client +} + +// New creates a new ClusterV1alpha1Client for the given RESTClient. +func New(c rest.Interface) *ClusterV1alpha1Client { + return &ClusterV1alpha1Client{c} +} + +func setConfigDefaults(config *rest.Config) error { + gv := v1alpha1.SchemeGroupVersion + config.GroupVersion = &gv + config.APIPath = "/apis" + config.NegotiatedSerializer = serializer.DirectCodecFactory{CodecFactory: scheme.Codecs} + + if config.UserAgent == "" { + config.UserAgent = rest.DefaultKubernetesUserAgent() + } + + return nil +} + +// RESTClient returns a RESTClient that is used to communicate +// with API server by this client implementation. +func (c *ClusterV1alpha1Client) RESTClient() rest.Interface { + if c == nil { + return nil + } + return c.restClient +} diff --git a/cluster-autoscaler/client/clusterapi/clientset/versioned/typed/cluster/v1alpha1/doc.go b/cluster-autoscaler/client/clusterapi/clientset/versioned/typed/cluster/v1alpha1/doc.go new file mode 100644 index 000000000000..9752e759caa0 --- /dev/null +++ b/cluster-autoscaler/client/clusterapi/clientset/versioned/typed/cluster/v1alpha1/doc.go @@ -0,0 +1,20 @@ +/* +Copyright 2019 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by client-gen. DO NOT EDIT. + +// This package has the automatically generated typed clients. +package v1alpha1 diff --git a/cluster-autoscaler/client/clusterapi/clientset/versioned/typed/cluster/v1alpha1/fake/doc.go b/cluster-autoscaler/client/clusterapi/clientset/versioned/typed/cluster/v1alpha1/fake/doc.go new file mode 100644 index 000000000000..ab4fd43ad6e0 --- /dev/null +++ b/cluster-autoscaler/client/clusterapi/clientset/versioned/typed/cluster/v1alpha1/fake/doc.go @@ -0,0 +1,20 @@ +/* +Copyright 2019 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by client-gen. DO NOT EDIT. + +// Package fake has the automatically generated clients. +package fake diff --git a/cluster-autoscaler/client/clusterapi/clientset/versioned/typed/cluster/v1alpha1/fake/fake_cluster.go b/cluster-autoscaler/client/clusterapi/clientset/versioned/typed/cluster/v1alpha1/fake/fake_cluster.go new file mode 100644 index 000000000000..f3878e530ed4 --- /dev/null +++ b/cluster-autoscaler/client/clusterapi/clientset/versioned/typed/cluster/v1alpha1/fake/fake_cluster.go @@ -0,0 +1,140 @@ +/* +Copyright 2019 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by client-gen. DO NOT EDIT. + +package fake + +import ( + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + labels "k8s.io/apimachinery/pkg/labels" + schema "k8s.io/apimachinery/pkg/runtime/schema" + types "k8s.io/apimachinery/pkg/types" + watch "k8s.io/apimachinery/pkg/watch" + testing "k8s.io/client-go/testing" + v1alpha1 "sigs.k8s.io/cluster-api/pkg/apis/cluster/v1alpha1" +) + +// FakeClusters implements ClusterInterface +type FakeClusters struct { + Fake *FakeClusterV1alpha1 + ns string +} + +var clustersResource = schema.GroupVersionResource{Group: "cluster.k8s.io", Version: "v1alpha1", Resource: "clusters"} + +var clustersKind = schema.GroupVersionKind{Group: "cluster.k8s.io", Version: "v1alpha1", Kind: "Cluster"} + +// Get takes name of the cluster, and returns the corresponding cluster object, and an error if there is any. +func (c *FakeClusters) Get(name string, options v1.GetOptions) (result *v1alpha1.Cluster, err error) { + obj, err := c.Fake. + Invokes(testing.NewGetAction(clustersResource, c.ns, name), &v1alpha1.Cluster{}) + + if obj == nil { + return nil, err + } + return obj.(*v1alpha1.Cluster), err +} + +// List takes label and field selectors, and returns the list of Clusters that match those selectors. +func (c *FakeClusters) List(opts v1.ListOptions) (result *v1alpha1.ClusterList, err error) { + obj, err := c.Fake. + Invokes(testing.NewListAction(clustersResource, clustersKind, c.ns, opts), &v1alpha1.ClusterList{}) + + if obj == nil { + return nil, err + } + + label, _, _ := testing.ExtractFromListOptions(opts) + if label == nil { + label = labels.Everything() + } + list := &v1alpha1.ClusterList{ListMeta: obj.(*v1alpha1.ClusterList).ListMeta} + for _, item := range obj.(*v1alpha1.ClusterList).Items { + if label.Matches(labels.Set(item.Labels)) { + list.Items = append(list.Items, item) + } + } + return list, err +} + +// Watch returns a watch.Interface that watches the requested clusters. +func (c *FakeClusters) Watch(opts v1.ListOptions) (watch.Interface, error) { + return c.Fake. + InvokesWatch(testing.NewWatchAction(clustersResource, c.ns, opts)) + +} + +// Create takes the representation of a cluster and creates it. Returns the server's representation of the cluster, and an error, if there is any. +func (c *FakeClusters) Create(cluster *v1alpha1.Cluster) (result *v1alpha1.Cluster, err error) { + obj, err := c.Fake. + Invokes(testing.NewCreateAction(clustersResource, c.ns, cluster), &v1alpha1.Cluster{}) + + if obj == nil { + return nil, err + } + return obj.(*v1alpha1.Cluster), err +} + +// Update takes the representation of a cluster and updates it. Returns the server's representation of the cluster, and an error, if there is any. +func (c *FakeClusters) Update(cluster *v1alpha1.Cluster) (result *v1alpha1.Cluster, err error) { + obj, err := c.Fake. + Invokes(testing.NewUpdateAction(clustersResource, c.ns, cluster), &v1alpha1.Cluster{}) + + if obj == nil { + return nil, err + } + return obj.(*v1alpha1.Cluster), err +} + +// UpdateStatus was generated because the type contains a Status member. +// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). +func (c *FakeClusters) UpdateStatus(cluster *v1alpha1.Cluster) (*v1alpha1.Cluster, error) { + obj, err := c.Fake. + Invokes(testing.NewUpdateSubresourceAction(clustersResource, "status", c.ns, cluster), &v1alpha1.Cluster{}) + + if obj == nil { + return nil, err + } + return obj.(*v1alpha1.Cluster), err +} + +// Delete takes name of the cluster and deletes it. Returns an error if one occurs. +func (c *FakeClusters) Delete(name string, options *v1.DeleteOptions) error { + _, err := c.Fake. + Invokes(testing.NewDeleteAction(clustersResource, c.ns, name), &v1alpha1.Cluster{}) + + return err +} + +// DeleteCollection deletes a collection of objects. +func (c *FakeClusters) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error { + action := testing.NewDeleteCollectionAction(clustersResource, c.ns, listOptions) + + _, err := c.Fake.Invokes(action, &v1alpha1.ClusterList{}) + return err +} + +// Patch applies the patch and returns the patched cluster. +func (c *FakeClusters) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1alpha1.Cluster, err error) { + obj, err := c.Fake. + Invokes(testing.NewPatchSubresourceAction(clustersResource, c.ns, name, data, subresources...), &v1alpha1.Cluster{}) + + if obj == nil { + return nil, err + } + return obj.(*v1alpha1.Cluster), err +} diff --git a/cluster-autoscaler/client/clusterapi/clientset/versioned/typed/cluster/v1alpha1/fake/fake_cluster_client.go b/cluster-autoscaler/client/clusterapi/clientset/versioned/typed/cluster/v1alpha1/fake/fake_cluster_client.go new file mode 100644 index 000000000000..d8e560999cdc --- /dev/null +++ b/cluster-autoscaler/client/clusterapi/clientset/versioned/typed/cluster/v1alpha1/fake/fake_cluster_client.go @@ -0,0 +1,56 @@ +/* +Copyright 2019 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by client-gen. DO NOT EDIT. + +package fake + +import ( + v1alpha1 "k8s.io/autoscaler/cluster-autoscaler/client/clusterapi/clientset/versioned/typed/cluster/v1alpha1" + rest "k8s.io/client-go/rest" + testing "k8s.io/client-go/testing" +) + +type FakeClusterV1alpha1 struct { + *testing.Fake +} + +func (c *FakeClusterV1alpha1) Clusters(namespace string) v1alpha1.ClusterInterface { + return &FakeClusters{c, namespace} +} + +func (c *FakeClusterV1alpha1) Machines(namespace string) v1alpha1.MachineInterface { + return &FakeMachines{c, namespace} +} + +func (c *FakeClusterV1alpha1) MachineClasses(namespace string) v1alpha1.MachineClassInterface { + return &FakeMachineClasses{c, namespace} +} + +func (c *FakeClusterV1alpha1) MachineDeployments(namespace string) v1alpha1.MachineDeploymentInterface { + return &FakeMachineDeployments{c, namespace} +} + +func (c *FakeClusterV1alpha1) MachineSets(namespace string) v1alpha1.MachineSetInterface { + return &FakeMachineSets{c, namespace} +} + +// RESTClient returns a RESTClient that is used to communicate +// with API server by this client implementation. +func (c *FakeClusterV1alpha1) RESTClient() rest.Interface { + var ret *rest.RESTClient + return ret +} diff --git a/cluster-autoscaler/client/clusterapi/clientset/versioned/typed/cluster/v1alpha1/fake/fake_machine.go b/cluster-autoscaler/client/clusterapi/clientset/versioned/typed/cluster/v1alpha1/fake/fake_machine.go new file mode 100644 index 000000000000..fb2f01aa4e9d --- /dev/null +++ b/cluster-autoscaler/client/clusterapi/clientset/versioned/typed/cluster/v1alpha1/fake/fake_machine.go @@ -0,0 +1,140 @@ +/* +Copyright 2019 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by client-gen. DO NOT EDIT. + +package fake + +import ( + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + labels "k8s.io/apimachinery/pkg/labels" + schema "k8s.io/apimachinery/pkg/runtime/schema" + types "k8s.io/apimachinery/pkg/types" + watch "k8s.io/apimachinery/pkg/watch" + testing "k8s.io/client-go/testing" + v1alpha1 "sigs.k8s.io/cluster-api/pkg/apis/cluster/v1alpha1" +) + +// FakeMachines implements MachineInterface +type FakeMachines struct { + Fake *FakeClusterV1alpha1 + ns string +} + +var machinesResource = schema.GroupVersionResource{Group: "cluster.k8s.io", Version: "v1alpha1", Resource: "machines"} + +var machinesKind = schema.GroupVersionKind{Group: "cluster.k8s.io", Version: "v1alpha1", Kind: "Machine"} + +// Get takes name of the machine, and returns the corresponding machine object, and an error if there is any. +func (c *FakeMachines) Get(name string, options v1.GetOptions) (result *v1alpha1.Machine, err error) { + obj, err := c.Fake. + Invokes(testing.NewGetAction(machinesResource, c.ns, name), &v1alpha1.Machine{}) + + if obj == nil { + return nil, err + } + return obj.(*v1alpha1.Machine), err +} + +// List takes label and field selectors, and returns the list of Machines that match those selectors. +func (c *FakeMachines) List(opts v1.ListOptions) (result *v1alpha1.MachineList, err error) { + obj, err := c.Fake. + Invokes(testing.NewListAction(machinesResource, machinesKind, c.ns, opts), &v1alpha1.MachineList{}) + + if obj == nil { + return nil, err + } + + label, _, _ := testing.ExtractFromListOptions(opts) + if label == nil { + label = labels.Everything() + } + list := &v1alpha1.MachineList{ListMeta: obj.(*v1alpha1.MachineList).ListMeta} + for _, item := range obj.(*v1alpha1.MachineList).Items { + if label.Matches(labels.Set(item.Labels)) { + list.Items = append(list.Items, item) + } + } + return list, err +} + +// Watch returns a watch.Interface that watches the requested machines. +func (c *FakeMachines) Watch(opts v1.ListOptions) (watch.Interface, error) { + return c.Fake. + InvokesWatch(testing.NewWatchAction(machinesResource, c.ns, opts)) + +} + +// Create takes the representation of a machine and creates it. Returns the server's representation of the machine, and an error, if there is any. +func (c *FakeMachines) Create(machine *v1alpha1.Machine) (result *v1alpha1.Machine, err error) { + obj, err := c.Fake. + Invokes(testing.NewCreateAction(machinesResource, c.ns, machine), &v1alpha1.Machine{}) + + if obj == nil { + return nil, err + } + return obj.(*v1alpha1.Machine), err +} + +// Update takes the representation of a machine and updates it. Returns the server's representation of the machine, and an error, if there is any. +func (c *FakeMachines) Update(machine *v1alpha1.Machine) (result *v1alpha1.Machine, err error) { + obj, err := c.Fake. + Invokes(testing.NewUpdateAction(machinesResource, c.ns, machine), &v1alpha1.Machine{}) + + if obj == nil { + return nil, err + } + return obj.(*v1alpha1.Machine), err +} + +// UpdateStatus was generated because the type contains a Status member. +// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). +func (c *FakeMachines) UpdateStatus(machine *v1alpha1.Machine) (*v1alpha1.Machine, error) { + obj, err := c.Fake. + Invokes(testing.NewUpdateSubresourceAction(machinesResource, "status", c.ns, machine), &v1alpha1.Machine{}) + + if obj == nil { + return nil, err + } + return obj.(*v1alpha1.Machine), err +} + +// Delete takes name of the machine and deletes it. Returns an error if one occurs. +func (c *FakeMachines) Delete(name string, options *v1.DeleteOptions) error { + _, err := c.Fake. + Invokes(testing.NewDeleteAction(machinesResource, c.ns, name), &v1alpha1.Machine{}) + + return err +} + +// DeleteCollection deletes a collection of objects. +func (c *FakeMachines) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error { + action := testing.NewDeleteCollectionAction(machinesResource, c.ns, listOptions) + + _, err := c.Fake.Invokes(action, &v1alpha1.MachineList{}) + return err +} + +// Patch applies the patch and returns the patched machine. +func (c *FakeMachines) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1alpha1.Machine, err error) { + obj, err := c.Fake. + Invokes(testing.NewPatchSubresourceAction(machinesResource, c.ns, name, data, subresources...), &v1alpha1.Machine{}) + + if obj == nil { + return nil, err + } + return obj.(*v1alpha1.Machine), err +} diff --git a/cluster-autoscaler/client/clusterapi/clientset/versioned/typed/cluster/v1alpha1/fake/fake_machineclass.go b/cluster-autoscaler/client/clusterapi/clientset/versioned/typed/cluster/v1alpha1/fake/fake_machineclass.go new file mode 100644 index 000000000000..ee69eb4554b1 --- /dev/null +++ b/cluster-autoscaler/client/clusterapi/clientset/versioned/typed/cluster/v1alpha1/fake/fake_machineclass.go @@ -0,0 +1,128 @@ +/* +Copyright 2019 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by client-gen. DO NOT EDIT. + +package fake + +import ( + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + labels "k8s.io/apimachinery/pkg/labels" + schema "k8s.io/apimachinery/pkg/runtime/schema" + types "k8s.io/apimachinery/pkg/types" + watch "k8s.io/apimachinery/pkg/watch" + testing "k8s.io/client-go/testing" + v1alpha1 "sigs.k8s.io/cluster-api/pkg/apis/cluster/v1alpha1" +) + +// FakeMachineClasses implements MachineClassInterface +type FakeMachineClasses struct { + Fake *FakeClusterV1alpha1 + ns string +} + +var machineclassesResource = schema.GroupVersionResource{Group: "cluster.k8s.io", Version: "v1alpha1", Resource: "machineclasses"} + +var machineclassesKind = schema.GroupVersionKind{Group: "cluster.k8s.io", Version: "v1alpha1", Kind: "MachineClass"} + +// Get takes name of the machineClass, and returns the corresponding machineClass object, and an error if there is any. +func (c *FakeMachineClasses) Get(name string, options v1.GetOptions) (result *v1alpha1.MachineClass, err error) { + obj, err := c.Fake. + Invokes(testing.NewGetAction(machineclassesResource, c.ns, name), &v1alpha1.MachineClass{}) + + if obj == nil { + return nil, err + } + return obj.(*v1alpha1.MachineClass), err +} + +// List takes label and field selectors, and returns the list of MachineClasses that match those selectors. +func (c *FakeMachineClasses) List(opts v1.ListOptions) (result *v1alpha1.MachineClassList, err error) { + obj, err := c.Fake. + Invokes(testing.NewListAction(machineclassesResource, machineclassesKind, c.ns, opts), &v1alpha1.MachineClassList{}) + + if obj == nil { + return nil, err + } + + label, _, _ := testing.ExtractFromListOptions(opts) + if label == nil { + label = labels.Everything() + } + list := &v1alpha1.MachineClassList{ListMeta: obj.(*v1alpha1.MachineClassList).ListMeta} + for _, item := range obj.(*v1alpha1.MachineClassList).Items { + if label.Matches(labels.Set(item.Labels)) { + list.Items = append(list.Items, item) + } + } + return list, err +} + +// Watch returns a watch.Interface that watches the requested machineClasses. +func (c *FakeMachineClasses) Watch(opts v1.ListOptions) (watch.Interface, error) { + return c.Fake. + InvokesWatch(testing.NewWatchAction(machineclassesResource, c.ns, opts)) + +} + +// Create takes the representation of a machineClass and creates it. Returns the server's representation of the machineClass, and an error, if there is any. +func (c *FakeMachineClasses) Create(machineClass *v1alpha1.MachineClass) (result *v1alpha1.MachineClass, err error) { + obj, err := c.Fake. + Invokes(testing.NewCreateAction(machineclassesResource, c.ns, machineClass), &v1alpha1.MachineClass{}) + + if obj == nil { + return nil, err + } + return obj.(*v1alpha1.MachineClass), err +} + +// Update takes the representation of a machineClass and updates it. Returns the server's representation of the machineClass, and an error, if there is any. +func (c *FakeMachineClasses) Update(machineClass *v1alpha1.MachineClass) (result *v1alpha1.MachineClass, err error) { + obj, err := c.Fake. + Invokes(testing.NewUpdateAction(machineclassesResource, c.ns, machineClass), &v1alpha1.MachineClass{}) + + if obj == nil { + return nil, err + } + return obj.(*v1alpha1.MachineClass), err +} + +// Delete takes name of the machineClass and deletes it. Returns an error if one occurs. +func (c *FakeMachineClasses) Delete(name string, options *v1.DeleteOptions) error { + _, err := c.Fake. + Invokes(testing.NewDeleteAction(machineclassesResource, c.ns, name), &v1alpha1.MachineClass{}) + + return err +} + +// DeleteCollection deletes a collection of objects. +func (c *FakeMachineClasses) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error { + action := testing.NewDeleteCollectionAction(machineclassesResource, c.ns, listOptions) + + _, err := c.Fake.Invokes(action, &v1alpha1.MachineClassList{}) + return err +} + +// Patch applies the patch and returns the patched machineClass. +func (c *FakeMachineClasses) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1alpha1.MachineClass, err error) { + obj, err := c.Fake. + Invokes(testing.NewPatchSubresourceAction(machineclassesResource, c.ns, name, data, subresources...), &v1alpha1.MachineClass{}) + + if obj == nil { + return nil, err + } + return obj.(*v1alpha1.MachineClass), err +} diff --git a/cluster-autoscaler/client/clusterapi/clientset/versioned/typed/cluster/v1alpha1/fake/fake_machinedeployment.go b/cluster-autoscaler/client/clusterapi/clientset/versioned/typed/cluster/v1alpha1/fake/fake_machinedeployment.go new file mode 100644 index 000000000000..ab500c937275 --- /dev/null +++ b/cluster-autoscaler/client/clusterapi/clientset/versioned/typed/cluster/v1alpha1/fake/fake_machinedeployment.go @@ -0,0 +1,140 @@ +/* +Copyright 2019 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by client-gen. DO NOT EDIT. + +package fake + +import ( + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + labels "k8s.io/apimachinery/pkg/labels" + schema "k8s.io/apimachinery/pkg/runtime/schema" + types "k8s.io/apimachinery/pkg/types" + watch "k8s.io/apimachinery/pkg/watch" + testing "k8s.io/client-go/testing" + v1alpha1 "sigs.k8s.io/cluster-api/pkg/apis/cluster/v1alpha1" +) + +// FakeMachineDeployments implements MachineDeploymentInterface +type FakeMachineDeployments struct { + Fake *FakeClusterV1alpha1 + ns string +} + +var machinedeploymentsResource = schema.GroupVersionResource{Group: "cluster.k8s.io", Version: "v1alpha1", Resource: "machinedeployments"} + +var machinedeploymentsKind = schema.GroupVersionKind{Group: "cluster.k8s.io", Version: "v1alpha1", Kind: "MachineDeployment"} + +// Get takes name of the machineDeployment, and returns the corresponding machineDeployment object, and an error if there is any. +func (c *FakeMachineDeployments) Get(name string, options v1.GetOptions) (result *v1alpha1.MachineDeployment, err error) { + obj, err := c.Fake. + Invokes(testing.NewGetAction(machinedeploymentsResource, c.ns, name), &v1alpha1.MachineDeployment{}) + + if obj == nil { + return nil, err + } + return obj.(*v1alpha1.MachineDeployment), err +} + +// List takes label and field selectors, and returns the list of MachineDeployments that match those selectors. +func (c *FakeMachineDeployments) List(opts v1.ListOptions) (result *v1alpha1.MachineDeploymentList, err error) { + obj, err := c.Fake. + Invokes(testing.NewListAction(machinedeploymentsResource, machinedeploymentsKind, c.ns, opts), &v1alpha1.MachineDeploymentList{}) + + if obj == nil { + return nil, err + } + + label, _, _ := testing.ExtractFromListOptions(opts) + if label == nil { + label = labels.Everything() + } + list := &v1alpha1.MachineDeploymentList{ListMeta: obj.(*v1alpha1.MachineDeploymentList).ListMeta} + for _, item := range obj.(*v1alpha1.MachineDeploymentList).Items { + if label.Matches(labels.Set(item.Labels)) { + list.Items = append(list.Items, item) + } + } + return list, err +} + +// Watch returns a watch.Interface that watches the requested machineDeployments. +func (c *FakeMachineDeployments) Watch(opts v1.ListOptions) (watch.Interface, error) { + return c.Fake. + InvokesWatch(testing.NewWatchAction(machinedeploymentsResource, c.ns, opts)) + +} + +// Create takes the representation of a machineDeployment and creates it. Returns the server's representation of the machineDeployment, and an error, if there is any. +func (c *FakeMachineDeployments) Create(machineDeployment *v1alpha1.MachineDeployment) (result *v1alpha1.MachineDeployment, err error) { + obj, err := c.Fake. + Invokes(testing.NewCreateAction(machinedeploymentsResource, c.ns, machineDeployment), &v1alpha1.MachineDeployment{}) + + if obj == nil { + return nil, err + } + return obj.(*v1alpha1.MachineDeployment), err +} + +// Update takes the representation of a machineDeployment and updates it. Returns the server's representation of the machineDeployment, and an error, if there is any. +func (c *FakeMachineDeployments) Update(machineDeployment *v1alpha1.MachineDeployment) (result *v1alpha1.MachineDeployment, err error) { + obj, err := c.Fake. + Invokes(testing.NewUpdateAction(machinedeploymentsResource, c.ns, machineDeployment), &v1alpha1.MachineDeployment{}) + + if obj == nil { + return nil, err + } + return obj.(*v1alpha1.MachineDeployment), err +} + +// UpdateStatus was generated because the type contains a Status member. +// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). +func (c *FakeMachineDeployments) UpdateStatus(machineDeployment *v1alpha1.MachineDeployment) (*v1alpha1.MachineDeployment, error) { + obj, err := c.Fake. + Invokes(testing.NewUpdateSubresourceAction(machinedeploymentsResource, "status", c.ns, machineDeployment), &v1alpha1.MachineDeployment{}) + + if obj == nil { + return nil, err + } + return obj.(*v1alpha1.MachineDeployment), err +} + +// Delete takes name of the machineDeployment and deletes it. Returns an error if one occurs. +func (c *FakeMachineDeployments) Delete(name string, options *v1.DeleteOptions) error { + _, err := c.Fake. + Invokes(testing.NewDeleteAction(machinedeploymentsResource, c.ns, name), &v1alpha1.MachineDeployment{}) + + return err +} + +// DeleteCollection deletes a collection of objects. +func (c *FakeMachineDeployments) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error { + action := testing.NewDeleteCollectionAction(machinedeploymentsResource, c.ns, listOptions) + + _, err := c.Fake.Invokes(action, &v1alpha1.MachineDeploymentList{}) + return err +} + +// Patch applies the patch and returns the patched machineDeployment. +func (c *FakeMachineDeployments) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1alpha1.MachineDeployment, err error) { + obj, err := c.Fake. + Invokes(testing.NewPatchSubresourceAction(machinedeploymentsResource, c.ns, name, data, subresources...), &v1alpha1.MachineDeployment{}) + + if obj == nil { + return nil, err + } + return obj.(*v1alpha1.MachineDeployment), err +} diff --git a/cluster-autoscaler/client/clusterapi/clientset/versioned/typed/cluster/v1alpha1/fake/fake_machineset.go b/cluster-autoscaler/client/clusterapi/clientset/versioned/typed/cluster/v1alpha1/fake/fake_machineset.go new file mode 100644 index 000000000000..f9441f498a83 --- /dev/null +++ b/cluster-autoscaler/client/clusterapi/clientset/versioned/typed/cluster/v1alpha1/fake/fake_machineset.go @@ -0,0 +1,140 @@ +/* +Copyright 2019 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by client-gen. DO NOT EDIT. + +package fake + +import ( + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + labels "k8s.io/apimachinery/pkg/labels" + schema "k8s.io/apimachinery/pkg/runtime/schema" + types "k8s.io/apimachinery/pkg/types" + watch "k8s.io/apimachinery/pkg/watch" + testing "k8s.io/client-go/testing" + v1alpha1 "sigs.k8s.io/cluster-api/pkg/apis/cluster/v1alpha1" +) + +// FakeMachineSets implements MachineSetInterface +type FakeMachineSets struct { + Fake *FakeClusterV1alpha1 + ns string +} + +var machinesetsResource = schema.GroupVersionResource{Group: "cluster.k8s.io", Version: "v1alpha1", Resource: "machinesets"} + +var machinesetsKind = schema.GroupVersionKind{Group: "cluster.k8s.io", Version: "v1alpha1", Kind: "MachineSet"} + +// Get takes name of the machineSet, and returns the corresponding machineSet object, and an error if there is any. +func (c *FakeMachineSets) Get(name string, options v1.GetOptions) (result *v1alpha1.MachineSet, err error) { + obj, err := c.Fake. + Invokes(testing.NewGetAction(machinesetsResource, c.ns, name), &v1alpha1.MachineSet{}) + + if obj == nil { + return nil, err + } + return obj.(*v1alpha1.MachineSet), err +} + +// List takes label and field selectors, and returns the list of MachineSets that match those selectors. +func (c *FakeMachineSets) List(opts v1.ListOptions) (result *v1alpha1.MachineSetList, err error) { + obj, err := c.Fake. + Invokes(testing.NewListAction(machinesetsResource, machinesetsKind, c.ns, opts), &v1alpha1.MachineSetList{}) + + if obj == nil { + return nil, err + } + + label, _, _ := testing.ExtractFromListOptions(opts) + if label == nil { + label = labels.Everything() + } + list := &v1alpha1.MachineSetList{ListMeta: obj.(*v1alpha1.MachineSetList).ListMeta} + for _, item := range obj.(*v1alpha1.MachineSetList).Items { + if label.Matches(labels.Set(item.Labels)) { + list.Items = append(list.Items, item) + } + } + return list, err +} + +// Watch returns a watch.Interface that watches the requested machineSets. +func (c *FakeMachineSets) Watch(opts v1.ListOptions) (watch.Interface, error) { + return c.Fake. + InvokesWatch(testing.NewWatchAction(machinesetsResource, c.ns, opts)) + +} + +// Create takes the representation of a machineSet and creates it. Returns the server's representation of the machineSet, and an error, if there is any. +func (c *FakeMachineSets) Create(machineSet *v1alpha1.MachineSet) (result *v1alpha1.MachineSet, err error) { + obj, err := c.Fake. + Invokes(testing.NewCreateAction(machinesetsResource, c.ns, machineSet), &v1alpha1.MachineSet{}) + + if obj == nil { + return nil, err + } + return obj.(*v1alpha1.MachineSet), err +} + +// Update takes the representation of a machineSet and updates it. Returns the server's representation of the machineSet, and an error, if there is any. +func (c *FakeMachineSets) Update(machineSet *v1alpha1.MachineSet) (result *v1alpha1.MachineSet, err error) { + obj, err := c.Fake. + Invokes(testing.NewUpdateAction(machinesetsResource, c.ns, machineSet), &v1alpha1.MachineSet{}) + + if obj == nil { + return nil, err + } + return obj.(*v1alpha1.MachineSet), err +} + +// UpdateStatus was generated because the type contains a Status member. +// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). +func (c *FakeMachineSets) UpdateStatus(machineSet *v1alpha1.MachineSet) (*v1alpha1.MachineSet, error) { + obj, err := c.Fake. + Invokes(testing.NewUpdateSubresourceAction(machinesetsResource, "status", c.ns, machineSet), &v1alpha1.MachineSet{}) + + if obj == nil { + return nil, err + } + return obj.(*v1alpha1.MachineSet), err +} + +// Delete takes name of the machineSet and deletes it. Returns an error if one occurs. +func (c *FakeMachineSets) Delete(name string, options *v1.DeleteOptions) error { + _, err := c.Fake. + Invokes(testing.NewDeleteAction(machinesetsResource, c.ns, name), &v1alpha1.MachineSet{}) + + return err +} + +// DeleteCollection deletes a collection of objects. +func (c *FakeMachineSets) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error { + action := testing.NewDeleteCollectionAction(machinesetsResource, c.ns, listOptions) + + _, err := c.Fake.Invokes(action, &v1alpha1.MachineSetList{}) + return err +} + +// Patch applies the patch and returns the patched machineSet. +func (c *FakeMachineSets) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1alpha1.MachineSet, err error) { + obj, err := c.Fake. + Invokes(testing.NewPatchSubresourceAction(machinesetsResource, c.ns, name, data, subresources...), &v1alpha1.MachineSet{}) + + if obj == nil { + return nil, err + } + return obj.(*v1alpha1.MachineSet), err +} diff --git a/cluster-autoscaler/client/clusterapi/clientset/versioned/typed/cluster/v1alpha1/generated_expansion.go b/cluster-autoscaler/client/clusterapi/clientset/versioned/typed/cluster/v1alpha1/generated_expansion.go new file mode 100644 index 000000000000..27ca6fab5793 --- /dev/null +++ b/cluster-autoscaler/client/clusterapi/clientset/versioned/typed/cluster/v1alpha1/generated_expansion.go @@ -0,0 +1,29 @@ +/* +Copyright 2019 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by client-gen. DO NOT EDIT. + +package v1alpha1 + +type ClusterExpansion interface{} + +type MachineExpansion interface{} + +type MachineClassExpansion interface{} + +type MachineDeploymentExpansion interface{} + +type MachineSetExpansion interface{} diff --git a/cluster-autoscaler/client/clusterapi/clientset/versioned/typed/cluster/v1alpha1/machine.go b/cluster-autoscaler/client/clusterapi/clientset/versioned/typed/cluster/v1alpha1/machine.go new file mode 100644 index 000000000000..9cd5dca30a6e --- /dev/null +++ b/cluster-autoscaler/client/clusterapi/clientset/versioned/typed/cluster/v1alpha1/machine.go @@ -0,0 +1,174 @@ +/* +Copyright 2019 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by client-gen. DO NOT EDIT. + +package v1alpha1 + +import ( + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + types "k8s.io/apimachinery/pkg/types" + watch "k8s.io/apimachinery/pkg/watch" + scheme "k8s.io/autoscaler/cluster-autoscaler/client/clusterapi/clientset/versioned/scheme" + rest "k8s.io/client-go/rest" + v1alpha1 "sigs.k8s.io/cluster-api/pkg/apis/cluster/v1alpha1" +) + +// MachinesGetter has a method to return a MachineInterface. +// A group's client should implement this interface. +type MachinesGetter interface { + Machines(namespace string) MachineInterface +} + +// MachineInterface has methods to work with Machine resources. +type MachineInterface interface { + Create(*v1alpha1.Machine) (*v1alpha1.Machine, error) + Update(*v1alpha1.Machine) (*v1alpha1.Machine, error) + UpdateStatus(*v1alpha1.Machine) (*v1alpha1.Machine, error) + Delete(name string, options *v1.DeleteOptions) error + DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error + Get(name string, options v1.GetOptions) (*v1alpha1.Machine, error) + List(opts v1.ListOptions) (*v1alpha1.MachineList, error) + Watch(opts v1.ListOptions) (watch.Interface, error) + Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1alpha1.Machine, err error) + MachineExpansion +} + +// machines implements MachineInterface +type machines struct { + client rest.Interface + ns string +} + +// newMachines returns a Machines +func newMachines(c *ClusterV1alpha1Client, namespace string) *machines { + return &machines{ + client: c.RESTClient(), + ns: namespace, + } +} + +// Get takes name of the machine, and returns the corresponding machine object, and an error if there is any. +func (c *machines) Get(name string, options v1.GetOptions) (result *v1alpha1.Machine, err error) { + result = &v1alpha1.Machine{} + err = c.client.Get(). + Namespace(c.ns). + Resource("machines"). + Name(name). + VersionedParams(&options, scheme.ParameterCodec). + Do(). + Into(result) + return +} + +// List takes label and field selectors, and returns the list of Machines that match those selectors. +func (c *machines) List(opts v1.ListOptions) (result *v1alpha1.MachineList, err error) { + result = &v1alpha1.MachineList{} + err = c.client.Get(). + Namespace(c.ns). + Resource("machines"). + VersionedParams(&opts, scheme.ParameterCodec). + Do(). + Into(result) + return +} + +// Watch returns a watch.Interface that watches the requested machines. +func (c *machines) Watch(opts v1.ListOptions) (watch.Interface, error) { + opts.Watch = true + return c.client.Get(). + Namespace(c.ns). + Resource("machines"). + VersionedParams(&opts, scheme.ParameterCodec). + Watch() +} + +// Create takes the representation of a machine and creates it. Returns the server's representation of the machine, and an error, if there is any. +func (c *machines) Create(machine *v1alpha1.Machine) (result *v1alpha1.Machine, err error) { + result = &v1alpha1.Machine{} + err = c.client.Post(). + Namespace(c.ns). + Resource("machines"). + Body(machine). + Do(). + Into(result) + return +} + +// Update takes the representation of a machine and updates it. Returns the server's representation of the machine, and an error, if there is any. +func (c *machines) Update(machine *v1alpha1.Machine) (result *v1alpha1.Machine, err error) { + result = &v1alpha1.Machine{} + err = c.client.Put(). + Namespace(c.ns). + Resource("machines"). + Name(machine.Name). + Body(machine). + Do(). + Into(result) + return +} + +// UpdateStatus was generated because the type contains a Status member. +// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). + +func (c *machines) UpdateStatus(machine *v1alpha1.Machine) (result *v1alpha1.Machine, err error) { + result = &v1alpha1.Machine{} + err = c.client.Put(). + Namespace(c.ns). + Resource("machines"). + Name(machine.Name). + SubResource("status"). + Body(machine). + Do(). + Into(result) + return +} + +// Delete takes name of the machine and deletes it. Returns an error if one occurs. +func (c *machines) Delete(name string, options *v1.DeleteOptions) error { + return c.client.Delete(). + Namespace(c.ns). + Resource("machines"). + Name(name). + Body(options). + Do(). + Error() +} + +// DeleteCollection deletes a collection of objects. +func (c *machines) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error { + return c.client.Delete(). + Namespace(c.ns). + Resource("machines"). + VersionedParams(&listOptions, scheme.ParameterCodec). + Body(options). + Do(). + Error() +} + +// Patch applies the patch and returns the patched machine. +func (c *machines) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1alpha1.Machine, err error) { + result = &v1alpha1.Machine{} + err = c.client.Patch(pt). + Namespace(c.ns). + Resource("machines"). + SubResource(subresources...). + Name(name). + Body(data). + Do(). + Into(result) + return +} diff --git a/cluster-autoscaler/client/clusterapi/clientset/versioned/typed/cluster/v1alpha1/machineclass.go b/cluster-autoscaler/client/clusterapi/clientset/versioned/typed/cluster/v1alpha1/machineclass.go new file mode 100644 index 000000000000..aeee512ee6cc --- /dev/null +++ b/cluster-autoscaler/client/clusterapi/clientset/versioned/typed/cluster/v1alpha1/machineclass.go @@ -0,0 +1,157 @@ +/* +Copyright 2019 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by client-gen. DO NOT EDIT. + +package v1alpha1 + +import ( + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + types "k8s.io/apimachinery/pkg/types" + watch "k8s.io/apimachinery/pkg/watch" + scheme "k8s.io/autoscaler/cluster-autoscaler/client/clusterapi/clientset/versioned/scheme" + rest "k8s.io/client-go/rest" + v1alpha1 "sigs.k8s.io/cluster-api/pkg/apis/cluster/v1alpha1" +) + +// MachineClassesGetter has a method to return a MachineClassInterface. +// A group's client should implement this interface. +type MachineClassesGetter interface { + MachineClasses(namespace string) MachineClassInterface +} + +// MachineClassInterface has methods to work with MachineClass resources. +type MachineClassInterface interface { + Create(*v1alpha1.MachineClass) (*v1alpha1.MachineClass, error) + Update(*v1alpha1.MachineClass) (*v1alpha1.MachineClass, error) + Delete(name string, options *v1.DeleteOptions) error + DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error + Get(name string, options v1.GetOptions) (*v1alpha1.MachineClass, error) + List(opts v1.ListOptions) (*v1alpha1.MachineClassList, error) + Watch(opts v1.ListOptions) (watch.Interface, error) + Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1alpha1.MachineClass, err error) + MachineClassExpansion +} + +// machineClasses implements MachineClassInterface +type machineClasses struct { + client rest.Interface + ns string +} + +// newMachineClasses returns a MachineClasses +func newMachineClasses(c *ClusterV1alpha1Client, namespace string) *machineClasses { + return &machineClasses{ + client: c.RESTClient(), + ns: namespace, + } +} + +// Get takes name of the machineClass, and returns the corresponding machineClass object, and an error if there is any. +func (c *machineClasses) Get(name string, options v1.GetOptions) (result *v1alpha1.MachineClass, err error) { + result = &v1alpha1.MachineClass{} + err = c.client.Get(). + Namespace(c.ns). + Resource("machineclasses"). + Name(name). + VersionedParams(&options, scheme.ParameterCodec). + Do(). + Into(result) + return +} + +// List takes label and field selectors, and returns the list of MachineClasses that match those selectors. +func (c *machineClasses) List(opts v1.ListOptions) (result *v1alpha1.MachineClassList, err error) { + result = &v1alpha1.MachineClassList{} + err = c.client.Get(). + Namespace(c.ns). + Resource("machineclasses"). + VersionedParams(&opts, scheme.ParameterCodec). + Do(). + Into(result) + return +} + +// Watch returns a watch.Interface that watches the requested machineClasses. +func (c *machineClasses) Watch(opts v1.ListOptions) (watch.Interface, error) { + opts.Watch = true + return c.client.Get(). + Namespace(c.ns). + Resource("machineclasses"). + VersionedParams(&opts, scheme.ParameterCodec). + Watch() +} + +// Create takes the representation of a machineClass and creates it. Returns the server's representation of the machineClass, and an error, if there is any. +func (c *machineClasses) Create(machineClass *v1alpha1.MachineClass) (result *v1alpha1.MachineClass, err error) { + result = &v1alpha1.MachineClass{} + err = c.client.Post(). + Namespace(c.ns). + Resource("machineclasses"). + Body(machineClass). + Do(). + Into(result) + return +} + +// Update takes the representation of a machineClass and updates it. Returns the server's representation of the machineClass, and an error, if there is any. +func (c *machineClasses) Update(machineClass *v1alpha1.MachineClass) (result *v1alpha1.MachineClass, err error) { + result = &v1alpha1.MachineClass{} + err = c.client.Put(). + Namespace(c.ns). + Resource("machineclasses"). + Name(machineClass.Name). + Body(machineClass). + Do(). + Into(result) + return +} + +// Delete takes name of the machineClass and deletes it. Returns an error if one occurs. +func (c *machineClasses) Delete(name string, options *v1.DeleteOptions) error { + return c.client.Delete(). + Namespace(c.ns). + Resource("machineclasses"). + Name(name). + Body(options). + Do(). + Error() +} + +// DeleteCollection deletes a collection of objects. +func (c *machineClasses) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error { + return c.client.Delete(). + Namespace(c.ns). + Resource("machineclasses"). + VersionedParams(&listOptions, scheme.ParameterCodec). + Body(options). + Do(). + Error() +} + +// Patch applies the patch and returns the patched machineClass. +func (c *machineClasses) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1alpha1.MachineClass, err error) { + result = &v1alpha1.MachineClass{} + err = c.client.Patch(pt). + Namespace(c.ns). + Resource("machineclasses"). + SubResource(subresources...). + Name(name). + Body(data). + Do(). + Into(result) + return +} diff --git a/cluster-autoscaler/client/clusterapi/clientset/versioned/typed/cluster/v1alpha1/machinedeployment.go b/cluster-autoscaler/client/clusterapi/clientset/versioned/typed/cluster/v1alpha1/machinedeployment.go new file mode 100644 index 000000000000..064793935aa3 --- /dev/null +++ b/cluster-autoscaler/client/clusterapi/clientset/versioned/typed/cluster/v1alpha1/machinedeployment.go @@ -0,0 +1,174 @@ +/* +Copyright 2019 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by client-gen. DO NOT EDIT. + +package v1alpha1 + +import ( + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + types "k8s.io/apimachinery/pkg/types" + watch "k8s.io/apimachinery/pkg/watch" + scheme "k8s.io/autoscaler/cluster-autoscaler/client/clusterapi/clientset/versioned/scheme" + rest "k8s.io/client-go/rest" + v1alpha1 "sigs.k8s.io/cluster-api/pkg/apis/cluster/v1alpha1" +) + +// MachineDeploymentsGetter has a method to return a MachineDeploymentInterface. +// A group's client should implement this interface. +type MachineDeploymentsGetter interface { + MachineDeployments(namespace string) MachineDeploymentInterface +} + +// MachineDeploymentInterface has methods to work with MachineDeployment resources. +type MachineDeploymentInterface interface { + Create(*v1alpha1.MachineDeployment) (*v1alpha1.MachineDeployment, error) + Update(*v1alpha1.MachineDeployment) (*v1alpha1.MachineDeployment, error) + UpdateStatus(*v1alpha1.MachineDeployment) (*v1alpha1.MachineDeployment, error) + Delete(name string, options *v1.DeleteOptions) error + DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error + Get(name string, options v1.GetOptions) (*v1alpha1.MachineDeployment, error) + List(opts v1.ListOptions) (*v1alpha1.MachineDeploymentList, error) + Watch(opts v1.ListOptions) (watch.Interface, error) + Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1alpha1.MachineDeployment, err error) + MachineDeploymentExpansion +} + +// machineDeployments implements MachineDeploymentInterface +type machineDeployments struct { + client rest.Interface + ns string +} + +// newMachineDeployments returns a MachineDeployments +func newMachineDeployments(c *ClusterV1alpha1Client, namespace string) *machineDeployments { + return &machineDeployments{ + client: c.RESTClient(), + ns: namespace, + } +} + +// Get takes name of the machineDeployment, and returns the corresponding machineDeployment object, and an error if there is any. +func (c *machineDeployments) Get(name string, options v1.GetOptions) (result *v1alpha1.MachineDeployment, err error) { + result = &v1alpha1.MachineDeployment{} + err = c.client.Get(). + Namespace(c.ns). + Resource("machinedeployments"). + Name(name). + VersionedParams(&options, scheme.ParameterCodec). + Do(). + Into(result) + return +} + +// List takes label and field selectors, and returns the list of MachineDeployments that match those selectors. +func (c *machineDeployments) List(opts v1.ListOptions) (result *v1alpha1.MachineDeploymentList, err error) { + result = &v1alpha1.MachineDeploymentList{} + err = c.client.Get(). + Namespace(c.ns). + Resource("machinedeployments"). + VersionedParams(&opts, scheme.ParameterCodec). + Do(). + Into(result) + return +} + +// Watch returns a watch.Interface that watches the requested machineDeployments. +func (c *machineDeployments) Watch(opts v1.ListOptions) (watch.Interface, error) { + opts.Watch = true + return c.client.Get(). + Namespace(c.ns). + Resource("machinedeployments"). + VersionedParams(&opts, scheme.ParameterCodec). + Watch() +} + +// Create takes the representation of a machineDeployment and creates it. Returns the server's representation of the machineDeployment, and an error, if there is any. +func (c *machineDeployments) Create(machineDeployment *v1alpha1.MachineDeployment) (result *v1alpha1.MachineDeployment, err error) { + result = &v1alpha1.MachineDeployment{} + err = c.client.Post(). + Namespace(c.ns). + Resource("machinedeployments"). + Body(machineDeployment). + Do(). + Into(result) + return +} + +// Update takes the representation of a machineDeployment and updates it. Returns the server's representation of the machineDeployment, and an error, if there is any. +func (c *machineDeployments) Update(machineDeployment *v1alpha1.MachineDeployment) (result *v1alpha1.MachineDeployment, err error) { + result = &v1alpha1.MachineDeployment{} + err = c.client.Put(). + Namespace(c.ns). + Resource("machinedeployments"). + Name(machineDeployment.Name). + Body(machineDeployment). + Do(). + Into(result) + return +} + +// UpdateStatus was generated because the type contains a Status member. +// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). + +func (c *machineDeployments) UpdateStatus(machineDeployment *v1alpha1.MachineDeployment) (result *v1alpha1.MachineDeployment, err error) { + result = &v1alpha1.MachineDeployment{} + err = c.client.Put(). + Namespace(c.ns). + Resource("machinedeployments"). + Name(machineDeployment.Name). + SubResource("status"). + Body(machineDeployment). + Do(). + Into(result) + return +} + +// Delete takes name of the machineDeployment and deletes it. Returns an error if one occurs. +func (c *machineDeployments) Delete(name string, options *v1.DeleteOptions) error { + return c.client.Delete(). + Namespace(c.ns). + Resource("machinedeployments"). + Name(name). + Body(options). + Do(). + Error() +} + +// DeleteCollection deletes a collection of objects. +func (c *machineDeployments) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error { + return c.client.Delete(). + Namespace(c.ns). + Resource("machinedeployments"). + VersionedParams(&listOptions, scheme.ParameterCodec). + Body(options). + Do(). + Error() +} + +// Patch applies the patch and returns the patched machineDeployment. +func (c *machineDeployments) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1alpha1.MachineDeployment, err error) { + result = &v1alpha1.MachineDeployment{} + err = c.client.Patch(pt). + Namespace(c.ns). + Resource("machinedeployments"). + SubResource(subresources...). + Name(name). + Body(data). + Do(). + Into(result) + return +} diff --git a/cluster-autoscaler/client/clusterapi/clientset/versioned/typed/cluster/v1alpha1/machineset.go b/cluster-autoscaler/client/clusterapi/clientset/versioned/typed/cluster/v1alpha1/machineset.go new file mode 100644 index 000000000000..f08345aeaaba --- /dev/null +++ b/cluster-autoscaler/client/clusterapi/clientset/versioned/typed/cluster/v1alpha1/machineset.go @@ -0,0 +1,174 @@ +/* +Copyright 2019 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by client-gen. DO NOT EDIT. + +package v1alpha1 + +import ( + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + types "k8s.io/apimachinery/pkg/types" + watch "k8s.io/apimachinery/pkg/watch" + scheme "k8s.io/autoscaler/cluster-autoscaler/client/clusterapi/clientset/versioned/scheme" + rest "k8s.io/client-go/rest" + v1alpha1 "sigs.k8s.io/cluster-api/pkg/apis/cluster/v1alpha1" +) + +// MachineSetsGetter has a method to return a MachineSetInterface. +// A group's client should implement this interface. +type MachineSetsGetter interface { + MachineSets(namespace string) MachineSetInterface +} + +// MachineSetInterface has methods to work with MachineSet resources. +type MachineSetInterface interface { + Create(*v1alpha1.MachineSet) (*v1alpha1.MachineSet, error) + Update(*v1alpha1.MachineSet) (*v1alpha1.MachineSet, error) + UpdateStatus(*v1alpha1.MachineSet) (*v1alpha1.MachineSet, error) + Delete(name string, options *v1.DeleteOptions) error + DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error + Get(name string, options v1.GetOptions) (*v1alpha1.MachineSet, error) + List(opts v1.ListOptions) (*v1alpha1.MachineSetList, error) + Watch(opts v1.ListOptions) (watch.Interface, error) + Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1alpha1.MachineSet, err error) + MachineSetExpansion +} + +// machineSets implements MachineSetInterface +type machineSets struct { + client rest.Interface + ns string +} + +// newMachineSets returns a MachineSets +func newMachineSets(c *ClusterV1alpha1Client, namespace string) *machineSets { + return &machineSets{ + client: c.RESTClient(), + ns: namespace, + } +} + +// Get takes name of the machineSet, and returns the corresponding machineSet object, and an error if there is any. +func (c *machineSets) Get(name string, options v1.GetOptions) (result *v1alpha1.MachineSet, err error) { + result = &v1alpha1.MachineSet{} + err = c.client.Get(). + Namespace(c.ns). + Resource("machinesets"). + Name(name). + VersionedParams(&options, scheme.ParameterCodec). + Do(). + Into(result) + return +} + +// List takes label and field selectors, and returns the list of MachineSets that match those selectors. +func (c *machineSets) List(opts v1.ListOptions) (result *v1alpha1.MachineSetList, err error) { + result = &v1alpha1.MachineSetList{} + err = c.client.Get(). + Namespace(c.ns). + Resource("machinesets"). + VersionedParams(&opts, scheme.ParameterCodec). + Do(). + Into(result) + return +} + +// Watch returns a watch.Interface that watches the requested machineSets. +func (c *machineSets) Watch(opts v1.ListOptions) (watch.Interface, error) { + opts.Watch = true + return c.client.Get(). + Namespace(c.ns). + Resource("machinesets"). + VersionedParams(&opts, scheme.ParameterCodec). + Watch() +} + +// Create takes the representation of a machineSet and creates it. Returns the server's representation of the machineSet, and an error, if there is any. +func (c *machineSets) Create(machineSet *v1alpha1.MachineSet) (result *v1alpha1.MachineSet, err error) { + result = &v1alpha1.MachineSet{} + err = c.client.Post(). + Namespace(c.ns). + Resource("machinesets"). + Body(machineSet). + Do(). + Into(result) + return +} + +// Update takes the representation of a machineSet and updates it. Returns the server's representation of the machineSet, and an error, if there is any. +func (c *machineSets) Update(machineSet *v1alpha1.MachineSet) (result *v1alpha1.MachineSet, err error) { + result = &v1alpha1.MachineSet{} + err = c.client.Put(). + Namespace(c.ns). + Resource("machinesets"). + Name(machineSet.Name). + Body(machineSet). + Do(). + Into(result) + return +} + +// UpdateStatus was generated because the type contains a Status member. +// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). + +func (c *machineSets) UpdateStatus(machineSet *v1alpha1.MachineSet) (result *v1alpha1.MachineSet, err error) { + result = &v1alpha1.MachineSet{} + err = c.client.Put(). + Namespace(c.ns). + Resource("machinesets"). + Name(machineSet.Name). + SubResource("status"). + Body(machineSet). + Do(). + Into(result) + return +} + +// Delete takes name of the machineSet and deletes it. Returns an error if one occurs. +func (c *machineSets) Delete(name string, options *v1.DeleteOptions) error { + return c.client.Delete(). + Namespace(c.ns). + Resource("machinesets"). + Name(name). + Body(options). + Do(). + Error() +} + +// DeleteCollection deletes a collection of objects. +func (c *machineSets) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error { + return c.client.Delete(). + Namespace(c.ns). + Resource("machinesets"). + VersionedParams(&listOptions, scheme.ParameterCodec). + Body(options). + Do(). + Error() +} + +// Patch applies the patch and returns the patched machineSet. +func (c *machineSets) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1alpha1.MachineSet, err error) { + result = &v1alpha1.MachineSet{} + err = c.client.Patch(pt). + Namespace(c.ns). + Resource("machinesets"). + SubResource(subresources...). + Name(name). + Body(data). + Do(). + Into(result) + return +} diff --git a/cluster-autoscaler/client/clusterapi/informers/externalversions/cluster/interface.go b/cluster-autoscaler/client/clusterapi/informers/externalversions/cluster/interface.go new file mode 100644 index 000000000000..08871d563c0f --- /dev/null +++ b/cluster-autoscaler/client/clusterapi/informers/externalversions/cluster/interface.go @@ -0,0 +1,46 @@ +/* +Copyright 2019 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by informer-gen. DO NOT EDIT. + +package cluster + +import ( + v1alpha1 "k8s.io/autoscaler/cluster-autoscaler/client/clusterapi/informers/externalversions/cluster/v1alpha1" + internalinterfaces "k8s.io/autoscaler/cluster-autoscaler/client/clusterapi/informers/externalversions/internalinterfaces" +) + +// Interface provides access to each of this group's versions. +type Interface interface { + // V1alpha1 provides access to shared informers for resources in V1alpha1. + V1alpha1() v1alpha1.Interface +} + +type group struct { + factory internalinterfaces.SharedInformerFactory + namespace string + tweakListOptions internalinterfaces.TweakListOptionsFunc +} + +// New returns a new Interface. +func New(f internalinterfaces.SharedInformerFactory, namespace string, tweakListOptions internalinterfaces.TweakListOptionsFunc) Interface { + return &group{factory: f, namespace: namespace, tweakListOptions: tweakListOptions} +} + +// V1alpha1 returns a new v1alpha1.Interface. +func (g *group) V1alpha1() v1alpha1.Interface { + return v1alpha1.New(g.factory, g.namespace, g.tweakListOptions) +} diff --git a/cluster-autoscaler/client/clusterapi/informers/externalversions/cluster/v1alpha1/cluster.go b/cluster-autoscaler/client/clusterapi/informers/externalversions/cluster/v1alpha1/cluster.go new file mode 100644 index 000000000000..d03dc59ee525 --- /dev/null +++ b/cluster-autoscaler/client/clusterapi/informers/externalversions/cluster/v1alpha1/cluster.go @@ -0,0 +1,89 @@ +/* +Copyright 2019 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by informer-gen. DO NOT EDIT. + +package v1alpha1 + +import ( + time "time" + + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + watch "k8s.io/apimachinery/pkg/watch" + versioned "k8s.io/autoscaler/cluster-autoscaler/client/clusterapi/clientset/versioned" + internalinterfaces "k8s.io/autoscaler/cluster-autoscaler/client/clusterapi/informers/externalversions/internalinterfaces" + v1alpha1 "k8s.io/autoscaler/cluster-autoscaler/client/clusterapi/listers/cluster/v1alpha1" + cache "k8s.io/client-go/tools/cache" + cluster_v1alpha1 "sigs.k8s.io/cluster-api/pkg/apis/cluster/v1alpha1" +) + +// ClusterInformer provides access to a shared informer and lister for +// Clusters. +type ClusterInformer interface { + Informer() cache.SharedIndexInformer + Lister() v1alpha1.ClusterLister +} + +type clusterInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc + namespace string +} + +// NewClusterInformer constructs a new informer for Cluster type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewClusterInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredClusterInformer(client, namespace, resyncPeriod, indexers, nil) +} + +// NewFilteredClusterInformer constructs a new informer for Cluster type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewFilteredClusterInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { + return cache.NewSharedIndexInformer( + &cache.ListWatch{ + ListFunc: func(options v1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.ClusterV1alpha1().Clusters(namespace).List(options) + }, + WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.ClusterV1alpha1().Clusters(namespace).Watch(options) + }, + }, + &cluster_v1alpha1.Cluster{}, + resyncPeriod, + indexers, + ) +} + +func (f *clusterInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredClusterInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) +} + +func (f *clusterInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&cluster_v1alpha1.Cluster{}, f.defaultInformer) +} + +func (f *clusterInformer) Lister() v1alpha1.ClusterLister { + return v1alpha1.NewClusterLister(f.Informer().GetIndexer()) +} diff --git a/cluster-autoscaler/client/clusterapi/informers/externalversions/cluster/v1alpha1/interface.go b/cluster-autoscaler/client/clusterapi/informers/externalversions/cluster/v1alpha1/interface.go new file mode 100644 index 000000000000..65864ca0173d --- /dev/null +++ b/cluster-autoscaler/client/clusterapi/informers/externalversions/cluster/v1alpha1/interface.go @@ -0,0 +1,73 @@ +/* +Copyright 2019 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by informer-gen. DO NOT EDIT. + +package v1alpha1 + +import ( + internalinterfaces "k8s.io/autoscaler/cluster-autoscaler/client/clusterapi/informers/externalversions/internalinterfaces" +) + +// Interface provides access to all the informers in this group version. +type Interface interface { + // Clusters returns a ClusterInformer. + Clusters() ClusterInformer + // Machines returns a MachineInformer. + Machines() MachineInformer + // MachineClasses returns a MachineClassInformer. + MachineClasses() MachineClassInformer + // MachineDeployments returns a MachineDeploymentInformer. + MachineDeployments() MachineDeploymentInformer + // MachineSets returns a MachineSetInformer. + MachineSets() MachineSetInformer +} + +type version struct { + factory internalinterfaces.SharedInformerFactory + namespace string + tweakListOptions internalinterfaces.TweakListOptionsFunc +} + +// New returns a new Interface. +func New(f internalinterfaces.SharedInformerFactory, namespace string, tweakListOptions internalinterfaces.TweakListOptionsFunc) Interface { + return &version{factory: f, namespace: namespace, tweakListOptions: tweakListOptions} +} + +// Clusters returns a ClusterInformer. +func (v *version) Clusters() ClusterInformer { + return &clusterInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} +} + +// Machines returns a MachineInformer. +func (v *version) Machines() MachineInformer { + return &machineInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} +} + +// MachineClasses returns a MachineClassInformer. +func (v *version) MachineClasses() MachineClassInformer { + return &machineClassInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} +} + +// MachineDeployments returns a MachineDeploymentInformer. +func (v *version) MachineDeployments() MachineDeploymentInformer { + return &machineDeploymentInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} +} + +// MachineSets returns a MachineSetInformer. +func (v *version) MachineSets() MachineSetInformer { + return &machineSetInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} +} diff --git a/cluster-autoscaler/client/clusterapi/informers/externalversions/cluster/v1alpha1/machine.go b/cluster-autoscaler/client/clusterapi/informers/externalversions/cluster/v1alpha1/machine.go new file mode 100644 index 000000000000..96cd3fab21e4 --- /dev/null +++ b/cluster-autoscaler/client/clusterapi/informers/externalversions/cluster/v1alpha1/machine.go @@ -0,0 +1,89 @@ +/* +Copyright 2019 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by informer-gen. DO NOT EDIT. + +package v1alpha1 + +import ( + time "time" + + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + watch "k8s.io/apimachinery/pkg/watch" + versioned "k8s.io/autoscaler/cluster-autoscaler/client/clusterapi/clientset/versioned" + internalinterfaces "k8s.io/autoscaler/cluster-autoscaler/client/clusterapi/informers/externalversions/internalinterfaces" + v1alpha1 "k8s.io/autoscaler/cluster-autoscaler/client/clusterapi/listers/cluster/v1alpha1" + cache "k8s.io/client-go/tools/cache" + cluster_v1alpha1 "sigs.k8s.io/cluster-api/pkg/apis/cluster/v1alpha1" +) + +// MachineInformer provides access to a shared informer and lister for +// Machines. +type MachineInformer interface { + Informer() cache.SharedIndexInformer + Lister() v1alpha1.MachineLister +} + +type machineInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc + namespace string +} + +// NewMachineInformer constructs a new informer for Machine type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewMachineInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredMachineInformer(client, namespace, resyncPeriod, indexers, nil) +} + +// NewFilteredMachineInformer constructs a new informer for Machine type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewFilteredMachineInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { + return cache.NewSharedIndexInformer( + &cache.ListWatch{ + ListFunc: func(options v1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.ClusterV1alpha1().Machines(namespace).List(options) + }, + WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.ClusterV1alpha1().Machines(namespace).Watch(options) + }, + }, + &cluster_v1alpha1.Machine{}, + resyncPeriod, + indexers, + ) +} + +func (f *machineInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredMachineInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) +} + +func (f *machineInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&cluster_v1alpha1.Machine{}, f.defaultInformer) +} + +func (f *machineInformer) Lister() v1alpha1.MachineLister { + return v1alpha1.NewMachineLister(f.Informer().GetIndexer()) +} diff --git a/cluster-autoscaler/client/clusterapi/informers/externalversions/cluster/v1alpha1/machineclass.go b/cluster-autoscaler/client/clusterapi/informers/externalversions/cluster/v1alpha1/machineclass.go new file mode 100644 index 000000000000..a15aa35b9c3a --- /dev/null +++ b/cluster-autoscaler/client/clusterapi/informers/externalversions/cluster/v1alpha1/machineclass.go @@ -0,0 +1,89 @@ +/* +Copyright 2019 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by informer-gen. DO NOT EDIT. + +package v1alpha1 + +import ( + time "time" + + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + watch "k8s.io/apimachinery/pkg/watch" + versioned "k8s.io/autoscaler/cluster-autoscaler/client/clusterapi/clientset/versioned" + internalinterfaces "k8s.io/autoscaler/cluster-autoscaler/client/clusterapi/informers/externalversions/internalinterfaces" + v1alpha1 "k8s.io/autoscaler/cluster-autoscaler/client/clusterapi/listers/cluster/v1alpha1" + cache "k8s.io/client-go/tools/cache" + cluster_v1alpha1 "sigs.k8s.io/cluster-api/pkg/apis/cluster/v1alpha1" +) + +// MachineClassInformer provides access to a shared informer and lister for +// MachineClasses. +type MachineClassInformer interface { + Informer() cache.SharedIndexInformer + Lister() v1alpha1.MachineClassLister +} + +type machineClassInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc + namespace string +} + +// NewMachineClassInformer constructs a new informer for MachineClass type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewMachineClassInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredMachineClassInformer(client, namespace, resyncPeriod, indexers, nil) +} + +// NewFilteredMachineClassInformer constructs a new informer for MachineClass type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewFilteredMachineClassInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { + return cache.NewSharedIndexInformer( + &cache.ListWatch{ + ListFunc: func(options v1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.ClusterV1alpha1().MachineClasses(namespace).List(options) + }, + WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.ClusterV1alpha1().MachineClasses(namespace).Watch(options) + }, + }, + &cluster_v1alpha1.MachineClass{}, + resyncPeriod, + indexers, + ) +} + +func (f *machineClassInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredMachineClassInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) +} + +func (f *machineClassInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&cluster_v1alpha1.MachineClass{}, f.defaultInformer) +} + +func (f *machineClassInformer) Lister() v1alpha1.MachineClassLister { + return v1alpha1.NewMachineClassLister(f.Informer().GetIndexer()) +} diff --git a/cluster-autoscaler/client/clusterapi/informers/externalversions/cluster/v1alpha1/machinedeployment.go b/cluster-autoscaler/client/clusterapi/informers/externalversions/cluster/v1alpha1/machinedeployment.go new file mode 100644 index 000000000000..24c3cfe0b538 --- /dev/null +++ b/cluster-autoscaler/client/clusterapi/informers/externalversions/cluster/v1alpha1/machinedeployment.go @@ -0,0 +1,89 @@ +/* +Copyright 2019 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by informer-gen. DO NOT EDIT. + +package v1alpha1 + +import ( + time "time" + + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + watch "k8s.io/apimachinery/pkg/watch" + versioned "k8s.io/autoscaler/cluster-autoscaler/client/clusterapi/clientset/versioned" + internalinterfaces "k8s.io/autoscaler/cluster-autoscaler/client/clusterapi/informers/externalversions/internalinterfaces" + v1alpha1 "k8s.io/autoscaler/cluster-autoscaler/client/clusterapi/listers/cluster/v1alpha1" + cache "k8s.io/client-go/tools/cache" + cluster_v1alpha1 "sigs.k8s.io/cluster-api/pkg/apis/cluster/v1alpha1" +) + +// MachineDeploymentInformer provides access to a shared informer and lister for +// MachineDeployments. +type MachineDeploymentInformer interface { + Informer() cache.SharedIndexInformer + Lister() v1alpha1.MachineDeploymentLister +} + +type machineDeploymentInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc + namespace string +} + +// NewMachineDeploymentInformer constructs a new informer for MachineDeployment type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewMachineDeploymentInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredMachineDeploymentInformer(client, namespace, resyncPeriod, indexers, nil) +} + +// NewFilteredMachineDeploymentInformer constructs a new informer for MachineDeployment type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewFilteredMachineDeploymentInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { + return cache.NewSharedIndexInformer( + &cache.ListWatch{ + ListFunc: func(options v1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.ClusterV1alpha1().MachineDeployments(namespace).List(options) + }, + WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.ClusterV1alpha1().MachineDeployments(namespace).Watch(options) + }, + }, + &cluster_v1alpha1.MachineDeployment{}, + resyncPeriod, + indexers, + ) +} + +func (f *machineDeploymentInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredMachineDeploymentInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) +} + +func (f *machineDeploymentInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&cluster_v1alpha1.MachineDeployment{}, f.defaultInformer) +} + +func (f *machineDeploymentInformer) Lister() v1alpha1.MachineDeploymentLister { + return v1alpha1.NewMachineDeploymentLister(f.Informer().GetIndexer()) +} diff --git a/cluster-autoscaler/client/clusterapi/informers/externalversions/cluster/v1alpha1/machineset.go b/cluster-autoscaler/client/clusterapi/informers/externalversions/cluster/v1alpha1/machineset.go new file mode 100644 index 000000000000..e2e3badbd07c --- /dev/null +++ b/cluster-autoscaler/client/clusterapi/informers/externalversions/cluster/v1alpha1/machineset.go @@ -0,0 +1,89 @@ +/* +Copyright 2019 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by informer-gen. DO NOT EDIT. + +package v1alpha1 + +import ( + time "time" + + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + watch "k8s.io/apimachinery/pkg/watch" + versioned "k8s.io/autoscaler/cluster-autoscaler/client/clusterapi/clientset/versioned" + internalinterfaces "k8s.io/autoscaler/cluster-autoscaler/client/clusterapi/informers/externalversions/internalinterfaces" + v1alpha1 "k8s.io/autoscaler/cluster-autoscaler/client/clusterapi/listers/cluster/v1alpha1" + cache "k8s.io/client-go/tools/cache" + cluster_v1alpha1 "sigs.k8s.io/cluster-api/pkg/apis/cluster/v1alpha1" +) + +// MachineSetInformer provides access to a shared informer and lister for +// MachineSets. +type MachineSetInformer interface { + Informer() cache.SharedIndexInformer + Lister() v1alpha1.MachineSetLister +} + +type machineSetInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc + namespace string +} + +// NewMachineSetInformer constructs a new informer for MachineSet type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewMachineSetInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredMachineSetInformer(client, namespace, resyncPeriod, indexers, nil) +} + +// NewFilteredMachineSetInformer constructs a new informer for MachineSet type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewFilteredMachineSetInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { + return cache.NewSharedIndexInformer( + &cache.ListWatch{ + ListFunc: func(options v1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.ClusterV1alpha1().MachineSets(namespace).List(options) + }, + WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.ClusterV1alpha1().MachineSets(namespace).Watch(options) + }, + }, + &cluster_v1alpha1.MachineSet{}, + resyncPeriod, + indexers, + ) +} + +func (f *machineSetInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredMachineSetInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) +} + +func (f *machineSetInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&cluster_v1alpha1.MachineSet{}, f.defaultInformer) +} + +func (f *machineSetInformer) Lister() v1alpha1.MachineSetLister { + return v1alpha1.NewMachineSetLister(f.Informer().GetIndexer()) +} diff --git a/cluster-autoscaler/client/clusterapi/informers/externalversions/factory.go b/cluster-autoscaler/client/clusterapi/informers/externalversions/factory.go new file mode 100644 index 000000000000..2e461e30c06f --- /dev/null +++ b/cluster-autoscaler/client/clusterapi/informers/externalversions/factory.go @@ -0,0 +1,180 @@ +/* +Copyright 2019 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by informer-gen. DO NOT EDIT. + +package externalversions + +import ( + reflect "reflect" + sync "sync" + time "time" + + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + schema "k8s.io/apimachinery/pkg/runtime/schema" + versioned "k8s.io/autoscaler/cluster-autoscaler/client/clusterapi/clientset/versioned" + cluster "k8s.io/autoscaler/cluster-autoscaler/client/clusterapi/informers/externalversions/cluster" + internalinterfaces "k8s.io/autoscaler/cluster-autoscaler/client/clusterapi/informers/externalversions/internalinterfaces" + cache "k8s.io/client-go/tools/cache" +) + +// SharedInformerOption defines the functional option type for SharedInformerFactory. +type SharedInformerOption func(*sharedInformerFactory) *sharedInformerFactory + +type sharedInformerFactory struct { + client versioned.Interface + namespace string + tweakListOptions internalinterfaces.TweakListOptionsFunc + lock sync.Mutex + defaultResync time.Duration + customResync map[reflect.Type]time.Duration + + informers map[reflect.Type]cache.SharedIndexInformer + // startedInformers is used for tracking which informers have been started. + // This allows Start() to be called multiple times safely. + startedInformers map[reflect.Type]bool +} + +// WithCustomResyncConfig sets a custom resync period for the specified informer types. +func WithCustomResyncConfig(resyncConfig map[v1.Object]time.Duration) SharedInformerOption { + return func(factory *sharedInformerFactory) *sharedInformerFactory { + for k, v := range resyncConfig { + factory.customResync[reflect.TypeOf(k)] = v + } + return factory + } +} + +// WithTweakListOptions sets a custom filter on all listers of the configured SharedInformerFactory. +func WithTweakListOptions(tweakListOptions internalinterfaces.TweakListOptionsFunc) SharedInformerOption { + return func(factory *sharedInformerFactory) *sharedInformerFactory { + factory.tweakListOptions = tweakListOptions + return factory + } +} + +// WithNamespace limits the SharedInformerFactory to the specified namespace. +func WithNamespace(namespace string) SharedInformerOption { + return func(factory *sharedInformerFactory) *sharedInformerFactory { + factory.namespace = namespace + return factory + } +} + +// NewSharedInformerFactory constructs a new instance of sharedInformerFactory for all namespaces. +func NewSharedInformerFactory(client versioned.Interface, defaultResync time.Duration) SharedInformerFactory { + return NewSharedInformerFactoryWithOptions(client, defaultResync) +} + +// NewFilteredSharedInformerFactory constructs a new instance of sharedInformerFactory. +// Listers obtained via this SharedInformerFactory will be subject to the same filters +// as specified here. +// Deprecated: Please use NewSharedInformerFactoryWithOptions instead +func NewFilteredSharedInformerFactory(client versioned.Interface, defaultResync time.Duration, namespace string, tweakListOptions internalinterfaces.TweakListOptionsFunc) SharedInformerFactory { + return NewSharedInformerFactoryWithOptions(client, defaultResync, WithNamespace(namespace), WithTweakListOptions(tweakListOptions)) +} + +// NewSharedInformerFactoryWithOptions constructs a new instance of a SharedInformerFactory with additional options. +func NewSharedInformerFactoryWithOptions(client versioned.Interface, defaultResync time.Duration, options ...SharedInformerOption) SharedInformerFactory { + factory := &sharedInformerFactory{ + client: client, + namespace: v1.NamespaceAll, + defaultResync: defaultResync, + informers: make(map[reflect.Type]cache.SharedIndexInformer), + startedInformers: make(map[reflect.Type]bool), + customResync: make(map[reflect.Type]time.Duration), + } + + // Apply all options + for _, opt := range options { + factory = opt(factory) + } + + return factory +} + +// Start initializes all requested informers. +func (f *sharedInformerFactory) Start(stopCh <-chan struct{}) { + f.lock.Lock() + defer f.lock.Unlock() + + for informerType, informer := range f.informers { + if !f.startedInformers[informerType] { + go informer.Run(stopCh) + f.startedInformers[informerType] = true + } + } +} + +// WaitForCacheSync waits for all started informers' cache were synced. +func (f *sharedInformerFactory) WaitForCacheSync(stopCh <-chan struct{}) map[reflect.Type]bool { + informers := func() map[reflect.Type]cache.SharedIndexInformer { + f.lock.Lock() + defer f.lock.Unlock() + + informers := map[reflect.Type]cache.SharedIndexInformer{} + for informerType, informer := range f.informers { + if f.startedInformers[informerType] { + informers[informerType] = informer + } + } + return informers + }() + + res := map[reflect.Type]bool{} + for informType, informer := range informers { + res[informType] = cache.WaitForCacheSync(stopCh, informer.HasSynced) + } + return res +} + +// InternalInformerFor returns the SharedIndexInformer for obj using an internal +// client. +func (f *sharedInformerFactory) InformerFor(obj runtime.Object, newFunc internalinterfaces.NewInformerFunc) cache.SharedIndexInformer { + f.lock.Lock() + defer f.lock.Unlock() + + informerType := reflect.TypeOf(obj) + informer, exists := f.informers[informerType] + if exists { + return informer + } + + resyncPeriod, exists := f.customResync[informerType] + if !exists { + resyncPeriod = f.defaultResync + } + + informer = newFunc(f.client, resyncPeriod) + f.informers[informerType] = informer + + return informer +} + +// SharedInformerFactory provides shared informers for resources in all known +// API group versions. +type SharedInformerFactory interface { + internalinterfaces.SharedInformerFactory + ForResource(resource schema.GroupVersionResource) (GenericInformer, error) + WaitForCacheSync(stopCh <-chan struct{}) map[reflect.Type]bool + + Cluster() cluster.Interface +} + +func (f *sharedInformerFactory) Cluster() cluster.Interface { + return cluster.New(f, f.namespace, f.tweakListOptions) +} diff --git a/cluster-autoscaler/client/clusterapi/informers/externalversions/generic.go b/cluster-autoscaler/client/clusterapi/informers/externalversions/generic.go new file mode 100644 index 000000000000..ebee718881c9 --- /dev/null +++ b/cluster-autoscaler/client/clusterapi/informers/externalversions/generic.go @@ -0,0 +1,70 @@ +/* +Copyright 2019 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by informer-gen. DO NOT EDIT. + +package externalversions + +import ( + "fmt" + + schema "k8s.io/apimachinery/pkg/runtime/schema" + cache "k8s.io/client-go/tools/cache" + v1alpha1 "sigs.k8s.io/cluster-api/pkg/apis/cluster/v1alpha1" +) + +// GenericInformer is type of SharedIndexInformer which will locate and delegate to other +// sharedInformers based on type +type GenericInformer interface { + Informer() cache.SharedIndexInformer + Lister() cache.GenericLister +} + +type genericInformer struct { + informer cache.SharedIndexInformer + resource schema.GroupResource +} + +// Informer returns the SharedIndexInformer. +func (f *genericInformer) Informer() cache.SharedIndexInformer { + return f.informer +} + +// Lister returns the GenericLister. +func (f *genericInformer) Lister() cache.GenericLister { + return cache.NewGenericLister(f.Informer().GetIndexer(), f.resource) +} + +// ForResource gives generic access to a shared informer of the matching type +// TODO extend this to unknown resources with a client pool +func (f *sharedInformerFactory) ForResource(resource schema.GroupVersionResource) (GenericInformer, error) { + switch resource { + // Group=cluster.k8s.io, Version=v1alpha1 + case v1alpha1.SchemeGroupVersion.WithResource("clusters"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Cluster().V1alpha1().Clusters().Informer()}, nil + case v1alpha1.SchemeGroupVersion.WithResource("machines"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Cluster().V1alpha1().Machines().Informer()}, nil + case v1alpha1.SchemeGroupVersion.WithResource("machineclasses"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Cluster().V1alpha1().MachineClasses().Informer()}, nil + case v1alpha1.SchemeGroupVersion.WithResource("machinedeployments"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Cluster().V1alpha1().MachineDeployments().Informer()}, nil + case v1alpha1.SchemeGroupVersion.WithResource("machinesets"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Cluster().V1alpha1().MachineSets().Informer()}, nil + + } + + return nil, fmt.Errorf("no informer found for %v", resource) +} diff --git a/cluster-autoscaler/client/clusterapi/informers/externalversions/internalinterfaces/factory_interfaces.go b/cluster-autoscaler/client/clusterapi/informers/externalversions/internalinterfaces/factory_interfaces.go new file mode 100644 index 000000000000..78cff71391b3 --- /dev/null +++ b/cluster-autoscaler/client/clusterapi/informers/externalversions/internalinterfaces/factory_interfaces.go @@ -0,0 +1,38 @@ +/* +Copyright 2019 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by informer-gen. DO NOT EDIT. + +package internalinterfaces + +import ( + time "time" + + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + versioned "k8s.io/autoscaler/cluster-autoscaler/client/clusterapi/clientset/versioned" + cache "k8s.io/client-go/tools/cache" +) + +type NewInformerFunc func(versioned.Interface, time.Duration) cache.SharedIndexInformer + +// SharedInformerFactory a small interface to allow for adding an informer without an import cycle +type SharedInformerFactory interface { + Start(stopCh <-chan struct{}) + InformerFor(obj runtime.Object, newFunc NewInformerFunc) cache.SharedIndexInformer +} + +type TweakListOptionsFunc func(*v1.ListOptions) diff --git a/cluster-autoscaler/client/clusterapi/listers/cluster/v1alpha1/cluster.go b/cluster-autoscaler/client/clusterapi/listers/cluster/v1alpha1/cluster.go new file mode 100644 index 000000000000..3c3d8b3bbc7f --- /dev/null +++ b/cluster-autoscaler/client/clusterapi/listers/cluster/v1alpha1/cluster.go @@ -0,0 +1,94 @@ +/* +Copyright 2019 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by lister-gen. DO NOT EDIT. + +package v1alpha1 + +import ( + "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/tools/cache" + v1alpha1 "sigs.k8s.io/cluster-api/pkg/apis/cluster/v1alpha1" +) + +// ClusterLister helps list Clusters. +type ClusterLister interface { + // List lists all Clusters in the indexer. + List(selector labels.Selector) (ret []*v1alpha1.Cluster, err error) + // Clusters returns an object that can list and get Clusters. + Clusters(namespace string) ClusterNamespaceLister + ClusterListerExpansion +} + +// clusterLister implements the ClusterLister interface. +type clusterLister struct { + indexer cache.Indexer +} + +// NewClusterLister returns a new ClusterLister. +func NewClusterLister(indexer cache.Indexer) ClusterLister { + return &clusterLister{indexer: indexer} +} + +// List lists all Clusters in the indexer. +func (s *clusterLister) List(selector labels.Selector) (ret []*v1alpha1.Cluster, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*v1alpha1.Cluster)) + }) + return ret, err +} + +// Clusters returns an object that can list and get Clusters. +func (s *clusterLister) Clusters(namespace string) ClusterNamespaceLister { + return clusterNamespaceLister{indexer: s.indexer, namespace: namespace} +} + +// ClusterNamespaceLister helps list and get Clusters. +type ClusterNamespaceLister interface { + // List lists all Clusters in the indexer for a given namespace. + List(selector labels.Selector) (ret []*v1alpha1.Cluster, err error) + // Get retrieves the Cluster from the indexer for a given namespace and name. + Get(name string) (*v1alpha1.Cluster, error) + ClusterNamespaceListerExpansion +} + +// clusterNamespaceLister implements the ClusterNamespaceLister +// interface. +type clusterNamespaceLister struct { + indexer cache.Indexer + namespace string +} + +// List lists all Clusters in the indexer for a given namespace. +func (s clusterNamespaceLister) List(selector labels.Selector) (ret []*v1alpha1.Cluster, err error) { + err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { + ret = append(ret, m.(*v1alpha1.Cluster)) + }) + return ret, err +} + +// Get retrieves the Cluster from the indexer for a given namespace and name. +func (s clusterNamespaceLister) Get(name string) (*v1alpha1.Cluster, error) { + obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(v1alpha1.Resource("cluster"), name) + } + return obj.(*v1alpha1.Cluster), nil +} diff --git a/cluster-autoscaler/client/clusterapi/listers/cluster/v1alpha1/expansion_generated.go b/cluster-autoscaler/client/clusterapi/listers/cluster/v1alpha1/expansion_generated.go new file mode 100644 index 000000000000..133b38960e38 --- /dev/null +++ b/cluster-autoscaler/client/clusterapi/listers/cluster/v1alpha1/expansion_generated.go @@ -0,0 +1,59 @@ +/* +Copyright 2019 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by lister-gen. DO NOT EDIT. + +package v1alpha1 + +// ClusterListerExpansion allows custom methods to be added to +// ClusterLister. +type ClusterListerExpansion interface{} + +// ClusterNamespaceListerExpansion allows custom methods to be added to +// ClusterNamespaceLister. +type ClusterNamespaceListerExpansion interface{} + +// MachineListerExpansion allows custom methods to be added to +// MachineLister. +type MachineListerExpansion interface{} + +// MachineNamespaceListerExpansion allows custom methods to be added to +// MachineNamespaceLister. +type MachineNamespaceListerExpansion interface{} + +// MachineClassListerExpansion allows custom methods to be added to +// MachineClassLister. +type MachineClassListerExpansion interface{} + +// MachineClassNamespaceListerExpansion allows custom methods to be added to +// MachineClassNamespaceLister. +type MachineClassNamespaceListerExpansion interface{} + +// MachineDeploymentListerExpansion allows custom methods to be added to +// MachineDeploymentLister. +type MachineDeploymentListerExpansion interface{} + +// MachineDeploymentNamespaceListerExpansion allows custom methods to be added to +// MachineDeploymentNamespaceLister. +type MachineDeploymentNamespaceListerExpansion interface{} + +// MachineSetListerExpansion allows custom methods to be added to +// MachineSetLister. +type MachineSetListerExpansion interface{} + +// MachineSetNamespaceListerExpansion allows custom methods to be added to +// MachineSetNamespaceLister. +type MachineSetNamespaceListerExpansion interface{} diff --git a/cluster-autoscaler/client/clusterapi/listers/cluster/v1alpha1/machine.go b/cluster-autoscaler/client/clusterapi/listers/cluster/v1alpha1/machine.go new file mode 100644 index 000000000000..0d8af443ed45 --- /dev/null +++ b/cluster-autoscaler/client/clusterapi/listers/cluster/v1alpha1/machine.go @@ -0,0 +1,94 @@ +/* +Copyright 2019 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by lister-gen. DO NOT EDIT. + +package v1alpha1 + +import ( + "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/tools/cache" + v1alpha1 "sigs.k8s.io/cluster-api/pkg/apis/cluster/v1alpha1" +) + +// MachineLister helps list Machines. +type MachineLister interface { + // List lists all Machines in the indexer. + List(selector labels.Selector) (ret []*v1alpha1.Machine, err error) + // Machines returns an object that can list and get Machines. + Machines(namespace string) MachineNamespaceLister + MachineListerExpansion +} + +// machineLister implements the MachineLister interface. +type machineLister struct { + indexer cache.Indexer +} + +// NewMachineLister returns a new MachineLister. +func NewMachineLister(indexer cache.Indexer) MachineLister { + return &machineLister{indexer: indexer} +} + +// List lists all Machines in the indexer. +func (s *machineLister) List(selector labels.Selector) (ret []*v1alpha1.Machine, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*v1alpha1.Machine)) + }) + return ret, err +} + +// Machines returns an object that can list and get Machines. +func (s *machineLister) Machines(namespace string) MachineNamespaceLister { + return machineNamespaceLister{indexer: s.indexer, namespace: namespace} +} + +// MachineNamespaceLister helps list and get Machines. +type MachineNamespaceLister interface { + // List lists all Machines in the indexer for a given namespace. + List(selector labels.Selector) (ret []*v1alpha1.Machine, err error) + // Get retrieves the Machine from the indexer for a given namespace and name. + Get(name string) (*v1alpha1.Machine, error) + MachineNamespaceListerExpansion +} + +// machineNamespaceLister implements the MachineNamespaceLister +// interface. +type machineNamespaceLister struct { + indexer cache.Indexer + namespace string +} + +// List lists all Machines in the indexer for a given namespace. +func (s machineNamespaceLister) List(selector labels.Selector) (ret []*v1alpha1.Machine, err error) { + err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { + ret = append(ret, m.(*v1alpha1.Machine)) + }) + return ret, err +} + +// Get retrieves the Machine from the indexer for a given namespace and name. +func (s machineNamespaceLister) Get(name string) (*v1alpha1.Machine, error) { + obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(v1alpha1.Resource("machine"), name) + } + return obj.(*v1alpha1.Machine), nil +} diff --git a/cluster-autoscaler/client/clusterapi/listers/cluster/v1alpha1/machineclass.go b/cluster-autoscaler/client/clusterapi/listers/cluster/v1alpha1/machineclass.go new file mode 100644 index 000000000000..ebe91208145c --- /dev/null +++ b/cluster-autoscaler/client/clusterapi/listers/cluster/v1alpha1/machineclass.go @@ -0,0 +1,94 @@ +/* +Copyright 2019 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by lister-gen. DO NOT EDIT. + +package v1alpha1 + +import ( + "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/tools/cache" + v1alpha1 "sigs.k8s.io/cluster-api/pkg/apis/cluster/v1alpha1" +) + +// MachineClassLister helps list MachineClasses. +type MachineClassLister interface { + // List lists all MachineClasses in the indexer. + List(selector labels.Selector) (ret []*v1alpha1.MachineClass, err error) + // MachineClasses returns an object that can list and get MachineClasses. + MachineClasses(namespace string) MachineClassNamespaceLister + MachineClassListerExpansion +} + +// machineClassLister implements the MachineClassLister interface. +type machineClassLister struct { + indexer cache.Indexer +} + +// NewMachineClassLister returns a new MachineClassLister. +func NewMachineClassLister(indexer cache.Indexer) MachineClassLister { + return &machineClassLister{indexer: indexer} +} + +// List lists all MachineClasses in the indexer. +func (s *machineClassLister) List(selector labels.Selector) (ret []*v1alpha1.MachineClass, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*v1alpha1.MachineClass)) + }) + return ret, err +} + +// MachineClasses returns an object that can list and get MachineClasses. +func (s *machineClassLister) MachineClasses(namespace string) MachineClassNamespaceLister { + return machineClassNamespaceLister{indexer: s.indexer, namespace: namespace} +} + +// MachineClassNamespaceLister helps list and get MachineClasses. +type MachineClassNamespaceLister interface { + // List lists all MachineClasses in the indexer for a given namespace. + List(selector labels.Selector) (ret []*v1alpha1.MachineClass, err error) + // Get retrieves the MachineClass from the indexer for a given namespace and name. + Get(name string) (*v1alpha1.MachineClass, error) + MachineClassNamespaceListerExpansion +} + +// machineClassNamespaceLister implements the MachineClassNamespaceLister +// interface. +type machineClassNamespaceLister struct { + indexer cache.Indexer + namespace string +} + +// List lists all MachineClasses in the indexer for a given namespace. +func (s machineClassNamespaceLister) List(selector labels.Selector) (ret []*v1alpha1.MachineClass, err error) { + err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { + ret = append(ret, m.(*v1alpha1.MachineClass)) + }) + return ret, err +} + +// Get retrieves the MachineClass from the indexer for a given namespace and name. +func (s machineClassNamespaceLister) Get(name string) (*v1alpha1.MachineClass, error) { + obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(v1alpha1.Resource("machineclass"), name) + } + return obj.(*v1alpha1.MachineClass), nil +} diff --git a/cluster-autoscaler/client/clusterapi/listers/cluster/v1alpha1/machinedeployment.go b/cluster-autoscaler/client/clusterapi/listers/cluster/v1alpha1/machinedeployment.go new file mode 100644 index 000000000000..a9b70e2e9a73 --- /dev/null +++ b/cluster-autoscaler/client/clusterapi/listers/cluster/v1alpha1/machinedeployment.go @@ -0,0 +1,94 @@ +/* +Copyright 2019 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by lister-gen. DO NOT EDIT. + +package v1alpha1 + +import ( + "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/tools/cache" + v1alpha1 "sigs.k8s.io/cluster-api/pkg/apis/cluster/v1alpha1" +) + +// MachineDeploymentLister helps list MachineDeployments. +type MachineDeploymentLister interface { + // List lists all MachineDeployments in the indexer. + List(selector labels.Selector) (ret []*v1alpha1.MachineDeployment, err error) + // MachineDeployments returns an object that can list and get MachineDeployments. + MachineDeployments(namespace string) MachineDeploymentNamespaceLister + MachineDeploymentListerExpansion +} + +// machineDeploymentLister implements the MachineDeploymentLister interface. +type machineDeploymentLister struct { + indexer cache.Indexer +} + +// NewMachineDeploymentLister returns a new MachineDeploymentLister. +func NewMachineDeploymentLister(indexer cache.Indexer) MachineDeploymentLister { + return &machineDeploymentLister{indexer: indexer} +} + +// List lists all MachineDeployments in the indexer. +func (s *machineDeploymentLister) List(selector labels.Selector) (ret []*v1alpha1.MachineDeployment, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*v1alpha1.MachineDeployment)) + }) + return ret, err +} + +// MachineDeployments returns an object that can list and get MachineDeployments. +func (s *machineDeploymentLister) MachineDeployments(namespace string) MachineDeploymentNamespaceLister { + return machineDeploymentNamespaceLister{indexer: s.indexer, namespace: namespace} +} + +// MachineDeploymentNamespaceLister helps list and get MachineDeployments. +type MachineDeploymentNamespaceLister interface { + // List lists all MachineDeployments in the indexer for a given namespace. + List(selector labels.Selector) (ret []*v1alpha1.MachineDeployment, err error) + // Get retrieves the MachineDeployment from the indexer for a given namespace and name. + Get(name string) (*v1alpha1.MachineDeployment, error) + MachineDeploymentNamespaceListerExpansion +} + +// machineDeploymentNamespaceLister implements the MachineDeploymentNamespaceLister +// interface. +type machineDeploymentNamespaceLister struct { + indexer cache.Indexer + namespace string +} + +// List lists all MachineDeployments in the indexer for a given namespace. +func (s machineDeploymentNamespaceLister) List(selector labels.Selector) (ret []*v1alpha1.MachineDeployment, err error) { + err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { + ret = append(ret, m.(*v1alpha1.MachineDeployment)) + }) + return ret, err +} + +// Get retrieves the MachineDeployment from the indexer for a given namespace and name. +func (s machineDeploymentNamespaceLister) Get(name string) (*v1alpha1.MachineDeployment, error) { + obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(v1alpha1.Resource("machinedeployment"), name) + } + return obj.(*v1alpha1.MachineDeployment), nil +} diff --git a/cluster-autoscaler/client/clusterapi/listers/cluster/v1alpha1/machineset.go b/cluster-autoscaler/client/clusterapi/listers/cluster/v1alpha1/machineset.go new file mode 100644 index 000000000000..b39fbd6ec2d5 --- /dev/null +++ b/cluster-autoscaler/client/clusterapi/listers/cluster/v1alpha1/machineset.go @@ -0,0 +1,94 @@ +/* +Copyright 2019 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by lister-gen. DO NOT EDIT. + +package v1alpha1 + +import ( + "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/tools/cache" + v1alpha1 "sigs.k8s.io/cluster-api/pkg/apis/cluster/v1alpha1" +) + +// MachineSetLister helps list MachineSets. +type MachineSetLister interface { + // List lists all MachineSets in the indexer. + List(selector labels.Selector) (ret []*v1alpha1.MachineSet, err error) + // MachineSets returns an object that can list and get MachineSets. + MachineSets(namespace string) MachineSetNamespaceLister + MachineSetListerExpansion +} + +// machineSetLister implements the MachineSetLister interface. +type machineSetLister struct { + indexer cache.Indexer +} + +// NewMachineSetLister returns a new MachineSetLister. +func NewMachineSetLister(indexer cache.Indexer) MachineSetLister { + return &machineSetLister{indexer: indexer} +} + +// List lists all MachineSets in the indexer. +func (s *machineSetLister) List(selector labels.Selector) (ret []*v1alpha1.MachineSet, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*v1alpha1.MachineSet)) + }) + return ret, err +} + +// MachineSets returns an object that can list and get MachineSets. +func (s *machineSetLister) MachineSets(namespace string) MachineSetNamespaceLister { + return machineSetNamespaceLister{indexer: s.indexer, namespace: namespace} +} + +// MachineSetNamespaceLister helps list and get MachineSets. +type MachineSetNamespaceLister interface { + // List lists all MachineSets in the indexer for a given namespace. + List(selector labels.Selector) (ret []*v1alpha1.MachineSet, err error) + // Get retrieves the MachineSet from the indexer for a given namespace and name. + Get(name string) (*v1alpha1.MachineSet, error) + MachineSetNamespaceListerExpansion +} + +// machineSetNamespaceLister implements the MachineSetNamespaceLister +// interface. +type machineSetNamespaceLister struct { + indexer cache.Indexer + namespace string +} + +// List lists all MachineSets in the indexer for a given namespace. +func (s machineSetNamespaceLister) List(selector labels.Selector) (ret []*v1alpha1.MachineSet, err error) { + err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { + ret = append(ret, m.(*v1alpha1.MachineSet)) + }) + return ret, err +} + +// Get retrieves the MachineSet from the indexer for a given namespace and name. +func (s machineSetNamespaceLister) Get(name string) (*v1alpha1.MachineSet, error) { + obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(v1alpha1.Resource("machineset"), name) + } + return obj.(*v1alpha1.MachineSet), nil +} diff --git a/cluster-autoscaler/cloudprovider/clusterapi/clusterapi_controller.go b/cluster-autoscaler/cloudprovider/clusterapi/clusterapi_controller.go index e144f03d1390..bd6d3a498180 100644 --- a/cluster-autoscaler/cloudprovider/clusterapi/clusterapi_controller.go +++ b/cluster-autoscaler/cloudprovider/clusterapi/clusterapi_controller.go @@ -25,11 +25,11 @@ import ( kubeinformers "k8s.io/client-go/informers" kubeclient "k8s.io/client-go/kubernetes" "k8s.io/client-go/tools/cache" - "k8s.io/klog" + "github.com/golang/glog" "sigs.k8s.io/cluster-api/pkg/apis/cluster/v1alpha1" - clusterclient "sigs.k8s.io/cluster-api/pkg/client/clientset_generated/clientset" - clusterinformers "sigs.k8s.io/cluster-api/pkg/client/informers_generated/externalversions" - clusterv1alpha1 "sigs.k8s.io/cluster-api/pkg/client/informers_generated/externalversions/cluster/v1alpha1" + clusterclient "k8s.io/autoscaler/cluster-autoscaler/client/clusterapi/clientset/versioned" + clusterinformers "k8s.io/autoscaler/cluster-autoscaler/client/clusterapi/informers/externalversions" + clusterv1alpha1 "k8s.io/autoscaler/cluster-autoscaler/client/clusterapi/informers/externalversions/cluster/v1alpha1" ) const ( @@ -131,7 +131,7 @@ func (c *machineController) run(stopCh <-chan struct{}) error { c.kubeInformerFactory.Start(stopCh) c.clusterInformerFactory.Start(stopCh) - klog.V(4).Infof("waiting for caches to sync") + glog.V(4).Infof("waiting for caches to sync") if !cache.WaitForCacheSync(stopCh, c.nodeInformer.HasSynced, c.machineInformer.Informer().HasSynced, @@ -264,11 +264,11 @@ func (c *machineController) machineSetNodeNames(machineSet *v1alpha1.MachineSet) for _, machine := range machines { if machine.Status.NodeRef == nil { - klog.V(4).Infof("Status.NodeRef of machine %q is currently nil", machine.Name) + glog.V(4).Infof("Status.NodeRef of machine %q is currently nil", machine.Name) continue } if machine.Status.NodeRef.Kind != "Node" { - klog.Errorf("Status.NodeRef of machine %q does not reference a node (rather %q)", machine.Name, machine.Status.NodeRef.Kind) + glog.Errorf("Status.NodeRef of machine %q does not reference a node (rather %q)", machine.Name, machine.Status.NodeRef.Kind) continue } @@ -282,7 +282,7 @@ func (c *machineController) machineSetNodeNames(machineSet *v1alpha1.MachineSet) } } - klog.V(4).Infof("nodegroup %s has nodes %v", machineSet.Name, nodes) + glog.V(4).Infof("nodegroup %s has nodes %v", machineSet.Name, nodes) return nodes, nil } @@ -412,6 +412,6 @@ func (c *machineController) nodeGroupForNode(node *corev1.Node) (*nodegroup, err return nil, nil } - klog.V(4).Infof("node %q is in nodegroup %q", node.Name, machineSet.Name) + glog.V(4).Infof("node %q is in nodegroup %q", node.Name, machineSet.Name) return nodegroup, nil } diff --git a/cluster-autoscaler/cloudprovider/clusterapi/clusterapi_controller_test.go b/cluster-autoscaler/cloudprovider/clusterapi/clusterapi_controller_test.go index 117306584bf8..75e29bef6ada 100644 --- a/cluster-autoscaler/cloudprovider/clusterapi/clusterapi_controller_test.go +++ b/cluster-autoscaler/cloudprovider/clusterapi/clusterapi_controller_test.go @@ -31,7 +31,7 @@ import ( "k8s.io/apimachinery/pkg/types" fakekube "k8s.io/client-go/kubernetes/fake" "sigs.k8s.io/cluster-api/pkg/apis/cluster/v1alpha1" - fakeclusterapi "sigs.k8s.io/cluster-api/pkg/client/clientset_generated/clientset/fake" + fakeclusterapi "k8s.io/autoscaler/cluster-autoscaler/client/clusterapi/clientset/versioned/fake" ) type testControllerShutdownFunc func() diff --git a/cluster-autoscaler/cloudprovider/clusterapi/clusterapi_machinedeployment.go b/cluster-autoscaler/cloudprovider/clusterapi/clusterapi_machinedeployment.go index d995213068b0..7902a8a9c7c6 100644 --- a/cluster-autoscaler/cloudprovider/clusterapi/clusterapi_machinedeployment.go +++ b/cluster-autoscaler/cloudprovider/clusterapi/clusterapi_machinedeployment.go @@ -23,7 +23,7 @@ import ( metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/utils/pointer" "sigs.k8s.io/cluster-api/pkg/apis/cluster/v1alpha1" - clusterv1alpha1 "sigs.k8s.io/cluster-api/pkg/client/clientset_generated/clientset/typed/cluster/v1alpha1" + clusterv1alpha1 "k8s.io/autoscaler/cluster-autoscaler/client/clusterapi/clientset/versioned/typed/cluster/v1alpha1" ) type machineDeploymentScalableResource struct { diff --git a/cluster-autoscaler/cloudprovider/clusterapi/clusterapi_machineset.go b/cluster-autoscaler/cloudprovider/clusterapi/clusterapi_machineset.go index eb2f04cf0484..81832e3c9dca 100644 --- a/cluster-autoscaler/cloudprovider/clusterapi/clusterapi_machineset.go +++ b/cluster-autoscaler/cloudprovider/clusterapi/clusterapi_machineset.go @@ -23,7 +23,7 @@ import ( metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/utils/pointer" "sigs.k8s.io/cluster-api/pkg/apis/cluster/v1alpha1" - clusterv1alpha1 "sigs.k8s.io/cluster-api/pkg/client/clientset_generated/clientset/typed/cluster/v1alpha1" + clusterv1alpha1 "k8s.io/autoscaler/cluster-autoscaler/client/clusterapi/clientset/versioned/typed/cluster/v1alpha1" ) type machineSetScalableResource struct { diff --git a/cluster-autoscaler/cloudprovider/clusterapi/clusterapi_nodegroup.go b/cluster-autoscaler/cloudprovider/clusterapi/clusterapi_nodegroup.go index e6870e14476b..b512f5bbfa5d 100644 --- a/cluster-autoscaler/cloudprovider/clusterapi/clusterapi_nodegroup.go +++ b/cluster-autoscaler/cloudprovider/clusterapi/clusterapi_nodegroup.go @@ -21,10 +21,10 @@ import ( "time" corev1 "k8s.io/api/core/v1" + clusterv1alpha1 "k8s.io/autoscaler/cluster-autoscaler/client/clusterapi/clientset/versioned/typed/cluster/v1alpha1" "k8s.io/autoscaler/cluster-autoscaler/cloudprovider" schedulercache "k8s.io/kubernetes/pkg/scheduler/cache" "sigs.k8s.io/cluster-api/pkg/apis/cluster/v1alpha1" - clusterv1alpha1 "sigs.k8s.io/cluster-api/pkg/client/clientset_generated/clientset/typed/cluster/v1alpha1" ) const ( diff --git a/cluster-autoscaler/cloudprovider/clusterapi/clusterapi_provider.go b/cluster-autoscaler/cloudprovider/clusterapi/clusterapi_provider.go index 1b5dd8a77f35..492fb31cd7eb 100644 --- a/cluster-autoscaler/cloudprovider/clusterapi/clusterapi_provider.go +++ b/cluster-autoscaler/cloudprovider/clusterapi/clusterapi_provider.go @@ -66,11 +66,11 @@ func (p *provider) NodeGroups() []cloudprovider.NodeGroup { var result []cloudprovider.NodeGroup nodegroups, err := p.controller.nodeGroups() if err != nil { - klog.Errorf("error getting node groups: %v", err) + glog.Errorf("error getting node groups: %v", err) return nil } for _, ng := range nodegroups { - klog.V(4).Infof("discovered node group: %s", ng.Debug()) + glog.V(4).Infof("discovered node group: %s", ng.Debug()) result = append(result, ng) } return result @@ -137,23 +137,23 @@ func BuildClusterAPI(kubeconfigPath string, do cloudprovider.NodeGroupDiscoveryO config, err = clientcmd.BuildConfigFromFlags("", kubeconfigPath) if err != nil { - klog.Fatalf("cannot build config: %v", err) + glog.Fatalf("cannot build config: %v", err) } kubeclient, err := kubernetes.NewForConfig(config) if err != nil { - klog.Fatalf("create kube clientset failed: %v", err) + glog.Fatalf("create kube clientset failed: %v", err) } clusterclient, err := clusterclientset.NewForConfig(config) if err != nil { - klog.Fatalf("create cluster clientset failed: %v", err) + glog.Fatalf("create cluster clientset failed: %v", err) } controller, err := newMachineController(kubeclient, clusterclient) if err != nil { - klog.Fatal(err) + glog.Fatal(err) } // Ideally this would be passed in but the builder is not @@ -161,12 +161,12 @@ func BuildClusterAPI(kubeconfigPath string, do cloudprovider.NodeGroupDiscoveryO stopCh := make(chan struct{}) if err := controller.run(stopCh); err != nil { - klog.Fatal(err) + glog.Fatal(err) } provider, err := newProvider(ProviderName, rl, controller) if err != nil { - klog.Fatal(err) + glog.Fatal(err) } return provider diff --git a/cluster-autoscaler/vendor/k8s.io/utils/pointer/OWNERS b/cluster-autoscaler/vendor/k8s.io/utils/pointer/OWNERS new file mode 100644 index 000000000000..0d6392752af2 --- /dev/null +++ b/cluster-autoscaler/vendor/k8s.io/utils/pointer/OWNERS @@ -0,0 +1,10 @@ +# See the OWNERS docs at https://go.k8s.io/owners + +approvers: +- apelisse +- stewart-yu +- thockin +reviewers: +- apelisse +- stewart-yu +- thockin diff --git a/cluster-autoscaler/vendor/k8s.io/utils/pointer/pointer.go b/cluster-autoscaler/vendor/k8s.io/utils/pointer/pointer.go new file mode 100644 index 000000000000..5365a11365a1 --- /dev/null +++ b/cluster-autoscaler/vendor/k8s.io/utils/pointer/pointer.go @@ -0,0 +1,86 @@ +/* +Copyright 2018 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package pointer + +import ( + "fmt" + "reflect" +) + +// AllPtrFieldsNil tests whether all pointer fields in a struct are nil. This is useful when, +// for example, an API struct is handled by plugins which need to distinguish +// "no plugin accepted this spec" from "this spec is empty". +// +// This function is only valid for structs and pointers to structs. Any other +// type will cause a panic. Passing a typed nil pointer will return true. +func AllPtrFieldsNil(obj interface{}) bool { + v := reflect.ValueOf(obj) + if !v.IsValid() { + panic(fmt.Sprintf("reflect.ValueOf() produced a non-valid Value for %#v", obj)) + } + if v.Kind() == reflect.Ptr { + if v.IsNil() { + return true + } + v = v.Elem() + } + for i := 0; i < v.NumField(); i++ { + if v.Field(i).Kind() == reflect.Ptr && !v.Field(i).IsNil() { + return false + } + } + return true +} + +// Int32Ptr returns a pointer to an int32 +func Int32Ptr(i int32) *int32 { + return &i +} + +// Int64Ptr returns a pointer to an int64 +func Int64Ptr(i int64) *int64 { + return &i +} + +// Int32PtrDerefOr dereference the int32 ptr and returns it if not nil, +// else returns def. +func Int32PtrDerefOr(ptr *int32, def int32) int32 { + if ptr != nil { + return *ptr + } + return def +} + +// BoolPtr returns a pointer to a bool +func BoolPtr(b bool) *bool { + return &b +} + +// StringPtr returns a pointer to the passed string. +func StringPtr(s string) *string { + return &s +} + +// Float32Ptr returns a pointer to the passed float32. +func Float32Ptr(i float32) *float32 { + return &i +} + +// Float64Ptr returns a pointer to the passed float64. +func Float64Ptr(i float64) *float64 { + return &i +} diff --git a/cluster-autoscaler/vendor/k8s.io/utils/pointer/pointer_test.go b/cluster-autoscaler/vendor/k8s.io/utils/pointer/pointer_test.go new file mode 100644 index 000000000000..62d4359ae1e8 --- /dev/null +++ b/cluster-autoscaler/vendor/k8s.io/utils/pointer/pointer_test.go @@ -0,0 +1,72 @@ +/* +Copyright 2018 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package pointer + +import ( + "fmt" + "reflect" + "testing" +) + +func TestAllPtrFieldsNil(t *testing.T) { + testCases := []struct { + obj interface{} + expected bool + }{ + {struct{}{}, true}, + {struct{ Foo int }{12345}, true}, + {&struct{ Foo int }{12345}, true}, + {struct{ Foo *int }{nil}, true}, + {&struct{ Foo *int }{nil}, true}, + {struct { + Foo int + Bar *int + }{12345, nil}, true}, + {&struct { + Foo int + Bar *int + }{12345, nil}, true}, + {struct { + Foo *int + Bar *int + }{nil, nil}, true}, + {&struct { + Foo *int + Bar *int + }{nil, nil}, true}, + {struct{ Foo *int }{new(int)}, false}, + {&struct{ Foo *int }{new(int)}, false}, + {struct { + Foo *int + Bar *int + }{nil, new(int)}, false}, + {&struct { + Foo *int + Bar *int + }{nil, new(int)}, false}, + {(*struct{})(nil), true}, + } + for i, tc := range testCases { + name := fmt.Sprintf("case[%d]", i) + t.Run(name, func(t *testing.T) { + actualErr := AllPtrFieldsNil(tc.obj) + if !reflect.DeepEqual(tc.expected, actualErr) { + t.Errorf("%s: expected %t, got %t", name, tc.expected, !tc.expected) + } + }) + } +} diff --git a/cluster-autoscaler/vendor/sigs.k8s.io/cluster-api/pkg/apis/BUILD.bazel b/cluster-autoscaler/vendor/sigs.k8s.io/cluster-api/pkg/apis/BUILD.bazel new file mode 100644 index 000000000000..5fb1263e9996 --- /dev/null +++ b/cluster-autoscaler/vendor/sigs.k8s.io/cluster-api/pkg/apis/BUILD.bazel @@ -0,0 +1,15 @@ +load("@io_bazel_rules_go//go:def.bzl", "go_library") + +go_library( + name = "go_default_library", + srcs = [ + "addtoscheme_cluster_v1alpha1.go", + "apis.go", + ], + importpath = "sigs.k8s.io/cluster-api/pkg/apis", + visibility = ["//visibility:public"], + deps = [ + "//pkg/apis/cluster/v1alpha1:go_default_library", + "//vendor/k8s.io/apimachinery/pkg/runtime:go_default_library", + ], +) diff --git a/cluster-autoscaler/vendor/sigs.k8s.io/cluster-api/pkg/apis/addtoscheme_cluster_v1alpha1.go b/cluster-autoscaler/vendor/sigs.k8s.io/cluster-api/pkg/apis/addtoscheme_cluster_v1alpha1.go new file mode 100644 index 000000000000..5c1ec47ea6e5 --- /dev/null +++ b/cluster-autoscaler/vendor/sigs.k8s.io/cluster-api/pkg/apis/addtoscheme_cluster_v1alpha1.go @@ -0,0 +1,26 @@ +/* +Copyright 2018 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package apis + +import ( + "sigs.k8s.io/cluster-api/pkg/apis/cluster/v1alpha1" +) + +func init() { + // Register the types with the Scheme so the components can map objects to GroupVersionKinds and back + AddToSchemes = append(AddToSchemes, v1alpha1.SchemeBuilder.AddToScheme) +} diff --git a/cluster-autoscaler/vendor/sigs.k8s.io/cluster-api/pkg/apis/apis.go b/cluster-autoscaler/vendor/sigs.k8s.io/cluster-api/pkg/apis/apis.go new file mode 100644 index 000000000000..cc8034a1cdc4 --- /dev/null +++ b/cluster-autoscaler/vendor/sigs.k8s.io/cluster-api/pkg/apis/apis.go @@ -0,0 +1,33 @@ +/* +Copyright 2018 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Generate deepcopy for apis +//go:generate go run ../../vendor/k8s.io/code-generator/cmd/deepcopy-gen/main.go -O zz_generated.deepcopy -i ./... -h ../../hack/boilerplate.go.txt + +// Package apis contains Kubernetes API groups. +package apis + +import ( + "k8s.io/apimachinery/pkg/runtime" +) + +// AddToSchemes may be used to add all resources defined in the project to a Scheme +var AddToSchemes runtime.SchemeBuilder + +// AddToScheme adds all Resources to the Scheme +func AddToScheme(s *runtime.Scheme) error { + return AddToSchemes.AddToScheme(s) +} diff --git a/cluster-autoscaler/vendor/sigs.k8s.io/cluster-api/pkg/apis/cluster/BUILD.bazel b/cluster-autoscaler/vendor/sigs.k8s.io/cluster-api/pkg/apis/cluster/BUILD.bazel new file mode 100644 index 000000000000..f8a8882a796d --- /dev/null +++ b/cluster-autoscaler/vendor/sigs.k8s.io/cluster-api/pkg/apis/cluster/BUILD.bazel @@ -0,0 +1,8 @@ +load("@io_bazel_rules_go//go:def.bzl", "go_library") + +go_library( + name = "go_default_library", + srcs = ["group.go"], + importpath = "sigs.k8s.io/cluster-api/pkg/apis/cluster", + visibility = ["//visibility:public"], +) diff --git a/cluster-autoscaler/vendor/sigs.k8s.io/cluster-api/pkg/apis/cluster/common/BUILD.bazel b/cluster-autoscaler/vendor/sigs.k8s.io/cluster-api/pkg/apis/cluster/common/BUILD.bazel new file mode 100644 index 000000000000..7c61c7175231 --- /dev/null +++ b/cluster-autoscaler/vendor/sigs.k8s.io/cluster-api/pkg/apis/cluster/common/BUILD.bazel @@ -0,0 +1,15 @@ +load("@io_bazel_rules_go//go:def.bzl", "go_library") + +go_library( + name = "go_default_library", + srcs = [ + "consts.go", + "plugins.go", + ], + importpath = "sigs.k8s.io/cluster-api/pkg/apis/cluster/common", + visibility = ["//visibility:public"], + deps = [ + "//vendor/github.com/pkg/errors:go_default_library", + "//vendor/github.com/golang/glog:go_default_library", + ], +) diff --git a/cluster-autoscaler/vendor/sigs.k8s.io/cluster-api/pkg/apis/cluster/common/consts.go b/cluster-autoscaler/vendor/sigs.k8s.io/cluster-api/pkg/apis/cluster/common/consts.go new file mode 100644 index 000000000000..dfa87062d97f --- /dev/null +++ b/cluster-autoscaler/vendor/sigs.k8s.io/cluster-api/pkg/apis/cluster/common/consts.go @@ -0,0 +1,121 @@ +/* +Copyright 2018 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package common + +// Constants aren't automatically generated for unversioned packages. +// Instead share the same constant for all versioned packages +type MachineStatusError string + +const ( + // Represents that the combination of configuration in the MachineSpec + // is not supported by this cluster. This is not a transient error, but + // indicates a state that must be fixed before progress can be made. + // + // Example: the ProviderSpec specifies an instance type that doesn't exist, + InvalidConfigurationMachineError MachineStatusError = "InvalidConfiguration" + + // This indicates that the MachineSpec has been updated in a way that + // is not supported for reconciliation on this cluster. The spec may be + // completely valid from a configuration standpoint, but the controller + // does not support changing the real world state to match the new + // spec. + // + // Example: the responsible controller is not capable of changing the + // container runtime from docker to rkt. + UnsupportedChangeMachineError MachineStatusError = "UnsupportedChange" + + // This generally refers to exceeding one's quota in a cloud provider, + // or running out of physical machines in an on-premise environment. + InsufficientResourcesMachineError MachineStatusError = "InsufficientResources" + + // There was an error while trying to create a Node to match this + // Machine. This may indicate a transient problem that will be fixed + // automatically with time, such as a service outage, or a terminal + // error during creation that doesn't match a more specific + // MachineStatusError value. + // + // Example: timeout trying to connect to GCE. + CreateMachineError MachineStatusError = "CreateError" + + // There was an error while trying to update a Node that this + // Machine represents. This may indicate a transient problem that will be + // fixed automatically with time, such as a service outage, + // + // Example: error updating load balancers + UpdateMachineError MachineStatusError = "UpdateError" + + // An error was encountered while trying to delete the Node that this + // Machine represents. This could be a transient or terminal error, but + // will only be observable if the provider's Machine controller has + // added a finalizer to the object to more gracefully handle deletions. + // + // Example: cannot resolve EC2 IP address. + DeleteMachineError MachineStatusError = "DeleteError" + + // This error indicates that the machine did not join the cluster + // as a new node within the expected timeframe after instance + // creation at the provider succeeded + // + // Example use case: A controller that deletes Machines which do + // not result in a Node joining the cluster within a given timeout + // and that are managed by a MachineSet + JoinClusterTimeoutMachineError = "JoinClusterTimeoutError" +) + +type ClusterStatusError string + +const ( + // InvalidConfigurationClusterError indicates that the cluster + // configuration is invalid. + InvalidConfigurationClusterError ClusterStatusError = "InvalidConfiguration" + + // UnsupportedChangeClusterError indicates that the cluster + // spec has been updated in an unsupported way. That cannot be + // reconciled. + UnsupportedChangeClusterError ClusterStatusError = "UnsupportedChange" + + // CreateClusterError indicates that an error was encountered + // when trying to create the cluster. + CreateClusterError ClusterStatusError = "CreateError" + + // UpdateClusterError indicates that an error was encountered + // when trying to update the cluster. + UpdateClusterError ClusterStatusError = "UpdateError" + + // DeleteClusterError indicates that an error was encountered + // when trying to delete the cluster. + DeleteClusterError ClusterStatusError = "DeleteError" +) + +type MachineSetStatusError string + +const ( + // Represents that the combination of configuration in the MachineTemplateSpec + // is not supported by this cluster. This is not a transient error, but + // indicates a state that must be fixed before progress can be made. + // + // Example: the ProviderSpec specifies an instance type that doesn't exist. + InvalidConfigurationMachineSetError MachineSetStatusError = "InvalidConfiguration" +) + +type MachineDeploymentStrategyType string + +const ( + // Replace the old MachineSet by new one using rolling update + // i.e. gradually scale down the old MachineSet and scale up the new one. + RollingUpdateMachineDeploymentStrategyType MachineDeploymentStrategyType = "RollingUpdate" +) diff --git a/cluster-autoscaler/vendor/sigs.k8s.io/cluster-api/pkg/apis/cluster/common/plugins.go b/cluster-autoscaler/vendor/sigs.k8s.io/cluster-api/pkg/apis/cluster/common/plugins.go new file mode 100644 index 000000000000..3c1ca3c2be91 --- /dev/null +++ b/cluster-autoscaler/vendor/sigs.k8s.io/cluster-api/pkg/apis/cluster/common/plugins.go @@ -0,0 +1,51 @@ +/* +Copyright 2018 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package common + +import ( + "sync" + + "github.com/pkg/errors" + "github.com/golang/glog" +) + +var ( + providersMutex sync.Mutex + providers = make(map[string]interface{}) +) + +// RegisterClusterProvisioner registers a ClusterProvisioner by name. This +// is expected to happen during app startup. +func RegisterClusterProvisioner(name string, provisioner interface{}) { + providersMutex.Lock() + defer providersMutex.Unlock() + if _, found := providers[name]; found { + glog.Fatalf("Cluster provisioner %q was registered twice", name) + } + glog.V(1).Infof("Registered cluster provisioner %q", name) + providers[name] = provisioner +} + +func ClusterProvisioner(name string) (interface{}, error) { + providersMutex.Lock() + defer providersMutex.Unlock() + provisioner, found := providers[name] + if !found { + return nil, errors.Errorf("unable to find provisioner for %s", name) + } + return provisioner, nil +} diff --git a/cluster-autoscaler/vendor/sigs.k8s.io/cluster-api/pkg/apis/cluster/group.go b/cluster-autoscaler/vendor/sigs.k8s.io/cluster-api/pkg/apis/cluster/group.go new file mode 100644 index 000000000000..4450b450fb3d --- /dev/null +++ b/cluster-autoscaler/vendor/sigs.k8s.io/cluster-api/pkg/apis/cluster/group.go @@ -0,0 +1,18 @@ +/* +Copyright 2018 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Package cluster contains cluster API versions +package cluster diff --git a/cluster-autoscaler/vendor/sigs.k8s.io/cluster-api/pkg/apis/cluster/v1alpha1/BUILD.bazel b/cluster-autoscaler/vendor/sigs.k8s.io/cluster-api/pkg/apis/cluster/v1alpha1/BUILD.bazel new file mode 100644 index 000000000000..074fbc10c0fc --- /dev/null +++ b/cluster-autoscaler/vendor/sigs.k8s.io/cluster-api/pkg/apis/cluster/v1alpha1/BUILD.bazel @@ -0,0 +1,52 @@ +load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test") + +go_library( + name = "go_default_library", + srcs = [ + "cluster_types.go", + "common_types.go", + "defaults.go", + "doc.go", + "machine_types.go", + "machineclass_types.go", + "machinedeployment_types.go", + "machineset_types.go", + "register.go", + "zz_generated.deepcopy.go", + ], + importpath = "sigs.k8s.io/cluster-api/pkg/apis/cluster/v1alpha1", + visibility = ["//visibility:public"], + deps = [ + "//pkg/apis/cluster/common:go_default_library", + "//vendor/k8s.io/api/core/v1:go_default_library", + "//vendor/k8s.io/apimachinery/pkg/apis/meta/v1:go_default_library", + "//vendor/k8s.io/apimachinery/pkg/apis/meta/v1/validation:go_default_library", + "//vendor/k8s.io/apimachinery/pkg/labels:go_default_library", + "//vendor/k8s.io/apimachinery/pkg/runtime:go_default_library", + "//vendor/k8s.io/apimachinery/pkg/runtime/schema:go_default_library", + "//vendor/k8s.io/apimachinery/pkg/util/intstr:go_default_library", + "//vendor/k8s.io/apimachinery/pkg/util/validation/field:go_default_library", + "//vendor/sigs.k8s.io/controller-runtime/pkg/runtime/scheme:go_default_library", + ], +) + +go_test( + name = "go_default_test", + srcs = [ + "cluster_types_test.go", + "machine_types_test.go", + "machinedeployment_types_test.go", + "machineset_types_test.go", + "v1alpha1_suite_test.go", + ], + embed = [":go_default_library"], + deps = [ + "//vendor/golang.org/x/net/context:go_default_library", + "//vendor/k8s.io/apimachinery/pkg/apis/meta/v1:go_default_library", + "//vendor/k8s.io/apimachinery/pkg/types:go_default_library", + "//vendor/k8s.io/client-go/kubernetes/scheme:go_default_library", + "//vendor/k8s.io/client-go/rest:go_default_library", + "//vendor/sigs.k8s.io/controller-runtime/pkg/client:go_default_library", + "//vendor/sigs.k8s.io/controller-runtime/pkg/envtest:go_default_library", + ], +) diff --git a/cluster-autoscaler/vendor/sigs.k8s.io/cluster-api/pkg/apis/cluster/v1alpha1/cluster_types.go b/cluster-autoscaler/vendor/sigs.k8s.io/cluster-api/pkg/apis/cluster/v1alpha1/cluster_types.go new file mode 100644 index 000000000000..eb3c2a94123d --- /dev/null +++ b/cluster-autoscaler/vendor/sigs.k8s.io/cluster-api/pkg/apis/cluster/v1alpha1/cluster_types.go @@ -0,0 +1,164 @@ +/* +Copyright 2018 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package v1alpha1 + +import ( + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/runtime" + "k8s.io/apimachinery/pkg/util/validation/field" + "sigs.k8s.io/cluster-api/pkg/apis/cluster/common" +) + +const ClusterFinalizer = "cluster.cluster.k8s.io" + +// +genclient +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object + +/// [Cluster] +// Cluster is the Schema for the clusters API +// +k8s:openapi-gen=true +// +kubebuilder:resource:shortName=cl +// +kubebuilder:subresource:status +type Cluster struct { + metav1.TypeMeta `json:",inline"` + metav1.ObjectMeta `json:"metadata,omitempty"` + + Spec ClusterSpec `json:"spec,omitempty"` + Status ClusterStatus `json:"status,omitempty"` +} + +/// [Cluster] + +/// [ClusterSpec] +// ClusterSpec defines the desired state of Cluster +type ClusterSpec struct { + // Cluster network configuration + ClusterNetwork ClusterNetworkingConfig `json:"clusterNetwork"` + + // Provider-specific serialized configuration to use during + // cluster creation. It is recommended that providers maintain + // their own versioned API types that should be + // serialized/deserialized from this field. + // +optional + ProviderSpec ProviderSpec `json:"providerSpec,omitempty"` +} + +/// [ClusterSpec] + +/// [ClusterNetworkingConfig] +// ClusterNetworkingConfig specifies the different networking +// parameters for a cluster. +type ClusterNetworkingConfig struct { + // The network ranges from which service VIPs are allocated. + Services NetworkRanges `json:"services"` + + // The network ranges from which Pod networks are allocated. + Pods NetworkRanges `json:"pods"` + + // Domain name for services. + ServiceDomain string `json:"serviceDomain"` +} + +/// [ClusterNetworkingConfig] + +/// [NetworkRanges] +// NetworkRanges represents ranges of network addresses. +type NetworkRanges struct { + CIDRBlocks []string `json:"cidrBlocks"` +} + +/// [NetworkRanges] + +/// [ClusterStatus] +// ClusterStatus defines the observed state of Cluster +type ClusterStatus struct { + // APIEndpoint represents the endpoint to communicate with the IP. + // +optional + APIEndpoints []APIEndpoint `json:"apiEndpoints,omitempty"` + + // NB: Eventually we will redefine ErrorReason as ClusterStatusError once the + // following issue is fixed. + // https://github.com/kubernetes-incubator/apiserver-builder/issues/176 + + // If set, indicates that there is a problem reconciling the + // state, and will be set to a token value suitable for + // programmatic interpretation. + // +optional + ErrorReason common.ClusterStatusError `json:"errorReason,omitempty"` + + // If set, indicates that there is a problem reconciling the + // state, and will be set to a descriptive error message. + // +optional + ErrorMessage string `json:"errorMessage,omitempty"` + + // Provider-specific status. + // It is recommended that providers maintain their + // own versioned API types that should be + // serialized/deserialized from this field. + // +optional + ProviderStatus *runtime.RawExtension `json:"providerStatus,omitempty"` +} + +/// [ClusterStatus] + +/// [APIEndpoint] +// APIEndpoint represents a reachable Kubernetes API endpoint. +type APIEndpoint struct { + // The hostname on which the API server is serving. + Host string `json:"host"` + + // The port on which the API server is serving. + Port int `json:"port"` +} + +/// [APIEndpoint] + +func (o *Cluster) Validate() field.ErrorList { + errors := field.ErrorList{} + // perform validation here and add to errors using field.Invalid + if o.Spec.ClusterNetwork.ServiceDomain == "" { + errors = append(errors, field.Invalid( + field.NewPath("Spec", "ClusterNetwork", "ServiceDomain"), + o.Spec.ClusterNetwork.ServiceDomain, + "invalid cluster configuration: missing Cluster.Spec.ClusterNetwork.ServiceDomain")) + } + if len(o.Spec.ClusterNetwork.Pods.CIDRBlocks) == 0 { + errors = append(errors, field.Invalid( + field.NewPath("Spec", "ClusterNetwork", "Pods"), + o.Spec.ClusterNetwork.Pods, + "invalid cluster configuration: missing Cluster.Spec.ClusterNetwork.Pods")) + } + if len(o.Spec.ClusterNetwork.Services.CIDRBlocks) == 0 { + errors = append(errors, field.Invalid( + field.NewPath("Spec", "ClusterNetwork", "Services"), + o.Spec.ClusterNetwork.Services, + "invalid cluster configuration: missing Cluster.Spec.ClusterNetwork.Services")) + } + return errors +} + +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object + +// ClusterList contains a list of Cluster +type ClusterList struct { + metav1.TypeMeta `json:",inline"` + metav1.ListMeta `json:"metadata,omitempty"` + Items []Cluster `json:"items"` +} + +func init() { +} diff --git a/cluster-autoscaler/vendor/sigs.k8s.io/cluster-api/pkg/apis/cluster/v1alpha1/common_types.go b/cluster-autoscaler/vendor/sigs.k8s.io/cluster-api/pkg/apis/cluster/v1alpha1/common_types.go new file mode 100644 index 000000000000..7a9c647fe296 --- /dev/null +++ b/cluster-autoscaler/vendor/sigs.k8s.io/cluster-api/pkg/apis/cluster/v1alpha1/common_types.go @@ -0,0 +1,58 @@ +/* +Copyright 2018 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package v1alpha1 + +import ( + corev1 "k8s.io/api/core/v1" + runtime "k8s.io/apimachinery/pkg/runtime" +) + +// ProviderSpec defines the configuration to use during node creation. +type ProviderSpec struct { + + // No more than one of the following may be specified. + + // Value is an inlined, serialized representation of the resource + // configuration. It is recommended that providers maintain their own + // versioned API types that should be serialized/deserialized from this + // field, akin to component config. + // +optional + Value *runtime.RawExtension `json:"value,omitempty"` + + // Source for the provider configuration. Cannot be used if value is + // not empty. + // +optional + ValueFrom *ProviderSpecSource `json:"valueFrom,omitempty"` +} + +// ProviderSpecSource represents a source for the provider-specific +// resource configuration. +type ProviderSpecSource struct { + // The machine class from which the provider config should be sourced. + // +optional + MachineClass *MachineClassRef `json:"machineClass,omitempty"` +} + +// MachineClassRef is a reference to the MachineClass object. Controllers should find the right MachineClass using this reference. +type MachineClassRef struct { + // +optional + *corev1.ObjectReference `json:",inline"` + + // Provider is the name of the cloud-provider which MachineClass is intended for. + // +optional + Provider string `json:"provider,omitempty"` +} diff --git a/cluster-autoscaler/vendor/sigs.k8s.io/cluster-api/pkg/apis/cluster/v1alpha1/defaults.go b/cluster-autoscaler/vendor/sigs.k8s.io/cluster-api/pkg/apis/cluster/v1alpha1/defaults.go new file mode 100644 index 000000000000..f9aeb4b438c7 --- /dev/null +++ b/cluster-autoscaler/vendor/sigs.k8s.io/cluster-api/pkg/apis/cluster/v1alpha1/defaults.go @@ -0,0 +1,74 @@ +/* +Copyright 2018 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package v1alpha1 + +import ( + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/util/intstr" + "sigs.k8s.io/cluster-api/pkg/apis/cluster/common" +) + +// PopulateDefaultsMachineDeployment fills in default field values +// Currently it is called after reading objects, but it could be called in an admission webhook also +func PopulateDefaultsMachineDeployment(d *MachineDeployment) { + if d.Spec.Replicas == nil { + d.Spec.Replicas = new(int32) + *d.Spec.Replicas = 1 + } + + if d.Spec.MinReadySeconds == nil { + d.Spec.MinReadySeconds = new(int32) + *d.Spec.MinReadySeconds = 0 + } + + if d.Spec.RevisionHistoryLimit == nil { + d.Spec.RevisionHistoryLimit = new(int32) + *d.Spec.RevisionHistoryLimit = 1 + } + + if d.Spec.ProgressDeadlineSeconds == nil { + d.Spec.ProgressDeadlineSeconds = new(int32) + *d.Spec.ProgressDeadlineSeconds = 600 + } + + if d.Spec.Strategy == nil { + d.Spec.Strategy = &MachineDeploymentStrategy{} + } + + if d.Spec.Strategy.Type == "" { + d.Spec.Strategy.Type = common.RollingUpdateMachineDeploymentStrategyType + } + + // Default RollingUpdate strategy only if strategy type is RollingUpdate. + if d.Spec.Strategy.Type == common.RollingUpdateMachineDeploymentStrategyType { + if d.Spec.Strategy.RollingUpdate == nil { + d.Spec.Strategy.RollingUpdate = &MachineRollingUpdateDeployment{} + } + if d.Spec.Strategy.RollingUpdate.MaxSurge == nil { + ios1 := intstr.FromInt(1) + d.Spec.Strategy.RollingUpdate.MaxSurge = &ios1 + } + if d.Spec.Strategy.RollingUpdate.MaxUnavailable == nil { + ios0 := intstr.FromInt(0) + d.Spec.Strategy.RollingUpdate.MaxUnavailable = &ios0 + } + } + + if len(d.Namespace) == 0 { + d.Namespace = metav1.NamespaceDefault + } +} diff --git a/cluster-autoscaler/vendor/sigs.k8s.io/cluster-api/pkg/apis/cluster/v1alpha1/doc.go b/cluster-autoscaler/vendor/sigs.k8s.io/cluster-api/pkg/apis/cluster/v1alpha1/doc.go new file mode 100644 index 000000000000..9bd92e435252 --- /dev/null +++ b/cluster-autoscaler/vendor/sigs.k8s.io/cluster-api/pkg/apis/cluster/v1alpha1/doc.go @@ -0,0 +1,23 @@ +/* +Copyright 2018 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Package v1alpha1 contains API Schema definitions for the cluster v1alpha1 API group +// +k8s:openapi-gen=true +// +k8s:deepcopy-gen=package,register +// +k8s:conversion-gen=sigs.k8s.io/cluster-api/pkg/apis/cluster +// +k8s:defaulter-gen=TypeMeta +// +groupName=cluster.k8s.io +package v1alpha1 diff --git a/cluster-autoscaler/vendor/sigs.k8s.io/cluster-api/pkg/apis/cluster/v1alpha1/machine_types.go b/cluster-autoscaler/vendor/sigs.k8s.io/cluster-api/pkg/apis/cluster/v1alpha1/machine_types.go new file mode 100644 index 000000000000..b67a902a376c --- /dev/null +++ b/cluster-autoscaler/vendor/sigs.k8s.io/cluster-api/pkg/apis/cluster/v1alpha1/machine_types.go @@ -0,0 +1,250 @@ +/* +Copyright 2018 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package v1alpha1 + +import ( + corev1 "k8s.io/api/core/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/runtime" + "sigs.k8s.io/cluster-api/pkg/apis/cluster/common" +) + +const ( + // MachineFinalizer is set on PrepareForCreate callback. + MachineFinalizer = "machine.cluster.k8s.io" + + // MachineClusterLabelName is the label set on machines linked to a cluster. + MachineClusterLabelName = "cluster.k8s.io/cluster-name" +) + +// +genclient +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object + +/// [Machine] +// Machine is the Schema for the machines API +// +k8s:openapi-gen=true +// +kubebuilder:resource:shortName=ma +// +kubebuilder:subresource:status +// +kubebuilder:printcolumn:name="ProviderID",type="string",JSONPath=".spec.providerID",description="Provider ID" +// +kubebuilder:printcolumn:name="Phase",type="string",JSONPath=".status.phase",description="Machine status such as Terminating/Pending/Running/Failed etc" +// +kubebuilder:printcolumn:name="NodeName",type="string",JSONPath=".status.nodeRef.name",description="Node name associated with this machine",priority=1 +type Machine struct { + metav1.TypeMeta `json:",inline"` + metav1.ObjectMeta `json:"metadata,omitempty"` + + Spec MachineSpec `json:"spec,omitempty"` + Status MachineStatus `json:"status,omitempty"` +} + +/// [Machine] + +/// [MachineSpec] +// MachineSpec defines the desired state of Machine +type MachineSpec struct { + // ObjectMeta will autopopulate the Node created. Use this to + // indicate what labels, annotations, name prefix, etc., should be used + // when creating the Node. + // +optional + metav1.ObjectMeta `json:"metadata,omitempty"` + + // The list of the taints to be applied to the corresponding Node in additive + // manner. This list will not overwrite any other taints added to the Node on + // an ongoing basis by other entities. These taints should be actively reconciled + // e.g. if you ask the machine controller to apply a taint and then manually remove + // the taint the machine controller will put it back) but not have the machine controller + // remove any taints + // +optional + Taints []corev1.Taint `json:"taints,omitempty"` + + // ProviderSpec details Provider-specific configuration to use during node creation. + // +optional + ProviderSpec ProviderSpec `json:"providerSpec"` + + // Versions of key software to use. This field is optional at cluster + // creation time, and omitting the field indicates that the cluster + // installation tool should select defaults for the user. These + // defaults may differ based on the cluster installer, but the tool + // should populate the values it uses when persisting Machine objects. + // A Machine spec missing this field at runtime is invalid. + // +optional + Versions MachineVersionInfo `json:"versions,omitempty"` + + // ConfigSource is used to populate in the associated Node for dynamic kubelet config. This + // field already exists in Node, so any updates to it in the Machine + // spec will be automatically copied to the linked NodeRef from the + // status. The rest of dynamic kubelet config support should then work + // as-is. + // +optional + ConfigSource *corev1.NodeConfigSource `json:"configSource,omitempty"` + + // ProviderID is the identification ID of the machine provided by the provider. + // This field must match the provider ID as seen on the node object corresponding to this machine. + // This field is required by higher level consumers of cluster-api. Example use case is cluster autoscaler + // with cluster-api as provider. Clean-up logic in the autoscaler compares machines to nodes to find out + // machines at provider which could not get registered as Kubernetes nodes. With cluster-api as a + // generic out-of-tree provider for autoscaler, this field is required by autoscaler to be + // able to have a provider view of the list of machines. Another list of nodes is queried from the k8s apiserver + // and then a comparison is done to find out unregistered machines and are marked for delete. + // This field will be set by the actuators and consumed by higher level entities like autoscaler that will + // be interfacing with cluster-api as generic provider. + // +optional + ProviderID *string `json:"providerID,omitempty"` +} + +/// [MachineSpec] + +/// [MachineStatus] +// MachineStatus defines the observed state of Machine +type MachineStatus struct { + // NodeRef will point to the corresponding Node if it exists. + // +optional + NodeRef *corev1.ObjectReference `json:"nodeRef,omitempty"` + + // LastUpdated identifies when this status was last observed. + // +optional + LastUpdated *metav1.Time `json:"lastUpdated,omitempty"` + + // Versions specifies the current versions of software on the corresponding Node (if it + // exists). This is provided for a few reasons: + // + // 1) It is more convenient than checking the NodeRef, traversing it to + // the Node, and finding the appropriate field in Node.Status.NodeInfo + // (which uses different field names and formatting). + // 2) It removes some of the dependency on the structure of the Node, + // so that if the structure of Node.Status.NodeInfo changes, only + // machine controllers need to be updated, rather than every client + // of the Machines API. + // 3) There is no other simple way to check the control plane + // version. A client would have to connect directly to the apiserver + // running on the target node in order to find out its version. + // +optional + Versions *MachineVersionInfo `json:"versions,omitempty"` + + // ErrorReason will be set in the event that there is a terminal problem + // reconciling the Machine and will contain a succinct value suitable + // for machine interpretation. + // + // This field should not be set for transitive errors that a controller + // faces that are expected to be fixed automatically over + // time (like service outages), but instead indicate that something is + // fundamentally wrong with the Machine's spec or the configuration of + // the controller, and that manual intervention is required. Examples + // of terminal errors would be invalid combinations of settings in the + // spec, values that are unsupported by the controller, or the + // responsible controller itself being critically misconfigured. + // + // Any transient errors that occur during the reconciliation of Machines + // can be added as events to the Machine object and/or logged in the + // controller's output. + // +optional + ErrorReason *common.MachineStatusError `json:"errorReason,omitempty"` + + // ErrorMessage will be set in the event that there is a terminal problem + // reconciling the Machine and will contain a more verbose string suitable + // for logging and human consumption. + // + // This field should not be set for transitive errors that a controller + // faces that are expected to be fixed automatically over + // time (like service outages), but instead indicate that something is + // fundamentally wrong with the Machine's spec or the configuration of + // the controller, and that manual intervention is required. Examples + // of terminal errors would be invalid combinations of settings in the + // spec, values that are unsupported by the controller, or the + // responsible controller itself being critically misconfigured. + // + // Any transient errors that occur during the reconciliation of Machines + // can be added as events to the Machine object and/or logged in the + // controller's output. + // +optional + ErrorMessage *string `json:"errorMessage,omitempty"` + + // ProviderStatus details a Provider-specific status. + // It is recommended that providers maintain their + // own versioned API types that should be + // serialized/deserialized from this field. + // +optional + ProviderStatus *runtime.RawExtension `json:"providerStatus,omitempty"` + + // Addresses is a list of addresses assigned to the machine. Queried from cloud provider, if available. + // +optional + Addresses []corev1.NodeAddress `json:"addresses,omitempty"` + + // Conditions lists the conditions synced from the node conditions of the corresponding node-object. + // Machine-controller is responsible for keeping conditions up-to-date. + // MachineSet controller will be taking these conditions as a signal to decide if + // machine is healthy or needs to be replaced. + // Refer: https://kubernetes.io/docs/concepts/architecture/nodes/#condition + // +optional + Conditions []corev1.NodeCondition `json:"conditions,omitempty"` + + // LastOperation describes the last-operation performed by the machine-controller. + // This API should be useful as a history in terms of the latest operation performed on the + // specific machine. It should also convey the state of the latest-operation for example if + // it is still on-going, failed or completed successfully. + // +optional + LastOperation *LastOperation `json:"lastOperation,omitempty"` + + // Phase represents the current phase of machine actuation. + // E.g. Pending, Running, Terminating, Failed etc. + // +optional + Phase *string `json:"phase,omitempty"` +} + +// LastOperation represents the detail of the last performed operation on the MachineObject. +type LastOperation struct { + // Description is the human-readable description of the last operation. + Description *string `json:"description,omitempty"` + + // LastUpdated is the timestamp at which LastOperation API was last-updated. + LastUpdated *metav1.Time `json:"lastUpdated,omitempty"` + + // State is the current status of the last performed operation. + // E.g. Processing, Failed, Successful etc + State *string `json:"state,omitempty"` + + // Type is the type of operation which was last performed. + // E.g. Create, Delete, Update etc + Type *string `json:"type,omitempty"` +} + +/// [MachineStatus] + +/// [MachineVersionInfo] +type MachineVersionInfo struct { + // Kubelet is the semantic version of kubelet to run + Kubelet string `json:"kubelet"` + + // ControlPlane is the semantic version of the Kubernetes control plane to + // run. This should only be populated when the machine is a + // control plane. + // +optional + ControlPlane string `json:"controlPlane,omitempty"` +} + +/// [MachineVersionInfo] + +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object + +// MachineList contains a list of Machine +type MachineList struct { + metav1.TypeMeta `json:",inline"` + metav1.ListMeta `json:"metadata,omitempty"` + Items []Machine `json:"items"` +} + +func init() { +} diff --git a/cluster-autoscaler/vendor/sigs.k8s.io/cluster-api/pkg/apis/cluster/v1alpha1/machineclass_types.go b/cluster-autoscaler/vendor/sigs.k8s.io/cluster-api/pkg/apis/cluster/v1alpha1/machineclass_types.go new file mode 100644 index 000000000000..1d962ad87b24 --- /dev/null +++ b/cluster-autoscaler/vendor/sigs.k8s.io/cluster-api/pkg/apis/cluster/v1alpha1/machineclass_types.go @@ -0,0 +1,78 @@ +/* +Copyright 2018 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package v1alpha1 + +import ( + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/runtime" +) + +// +genclient +// +genclient:noStatus +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object + +/// [MachineClass] +// MachineClass can be used to templatize and re-use provider configuration +// across multiple Machines / MachineSets / MachineDeployments. +// +k8s:openapi-gen=true +// +resource:path=machineclasses +// +kubebuilder:resource:shortName=mc +type MachineClass struct { + metav1.TypeMeta `json:",inline"` + // +optional + metav1.ObjectMeta `json:"metadata,omitempty"` + + // The total capacity available on this machine type (cpu/memory/disk). + // + // WARNING: It is up to the creator of the MachineClass to ensure that + // this field is consistent with the underlying machine that will + // be provisioned when this class is used, to inform higher level + // automation (e.g. the cluster autoscaler). + // TODO(hardikdr) Add allocatable field once requirements are clear from autoscaler-clusterapi // integration topic. + // Capacity corev1.ResourceList `json:"capacity"` + + // How much capacity is actually allocatable on this machine. + // Must be equal to or less than the capacity, and when less + // indicates the resources reserved for system overhead. + // + // WARNING: It is up to the creator of the MachineClass to ensure that + // this field is consistent with the underlying machine that will + // be provisioned when this class is used, to inform higher level + // automation (e.g. the cluster autoscaler). + // TODO(hardikdr) Add allocatable field once requirements are clear from autoscaler-clusterapi // integration topic. + // Allocatable corev1.ResourceList `json:"allocatable"` + + // Provider-specific configuration to use during node creation. + ProviderSpec runtime.RawExtension `json:"providerSpec"` + + // TODO: should this use an api.ObjectReference to a 'MachineTemplate' instead? + // A link to the MachineTemplate that will be used to create provider + // specific configuration for Machines of this class. + // MachineTemplate corev1.ObjectReference `json:machineTemplate` +} + +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object + +// MachineClassList contains a list of MachineClasses +type MachineClassList struct { + metav1.TypeMeta `json:",inline"` + metav1.ListMeta `json:"metadata,omitempty"` + Items []MachineClass `json:"items"` +} + +func init() { +} diff --git a/cluster-autoscaler/vendor/sigs.k8s.io/cluster-api/pkg/apis/cluster/v1alpha1/machinedeployment_types.go b/cluster-autoscaler/vendor/sigs.k8s.io/cluster-api/pkg/apis/cluster/v1alpha1/machinedeployment_types.go new file mode 100644 index 000000000000..9de070e01da8 --- /dev/null +++ b/cluster-autoscaler/vendor/sigs.k8s.io/cluster-api/pkg/apis/cluster/v1alpha1/machinedeployment_types.go @@ -0,0 +1,193 @@ +/* +Copyright 2018 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package v1alpha1 + +import ( + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/util/intstr" + "sigs.k8s.io/cluster-api/pkg/apis/cluster/common" +) + +/// [MachineDeploymentSpec] +// MachineDeploymentSpec defines the desired state of MachineDeployment +type MachineDeploymentSpec struct { + // Number of desired machines. Defaults to 1. + // This is a pointer to distinguish between explicit zero and not specified. + Replicas *int32 `json:"replicas,omitempty"` + + // Label selector for machines. Existing MachineSets whose machines are + // selected by this will be the ones affected by this deployment. + // It must match the machine template's labels. + Selector metav1.LabelSelector `json:"selector"` + + // Template describes the machines that will be created. + Template MachineTemplateSpec `json:"template"` + + // The deployment strategy to use to replace existing machines with + // new ones. + // +optional + Strategy *MachineDeploymentStrategy `json:"strategy,omitempty"` + + // Minimum number of seconds for which a newly created machine should + // be ready. + // Defaults to 0 (machine will be considered available as soon as it + // is ready) + // +optional + MinReadySeconds *int32 `json:"minReadySeconds,omitempty"` + + // The number of old MachineSets to retain to allow rollback. + // This is a pointer to distinguish between explicit zero and not specified. + // Defaults to 1. + // +optional + RevisionHistoryLimit *int32 `json:"revisionHistoryLimit,omitempty"` + + // Indicates that the deployment is paused. + // +optional + Paused bool `json:"paused,omitempty"` + + // The maximum time in seconds for a deployment to make progress before it + // is considered to be failed. The deployment controller will continue to + // process failed deployments and a condition with a ProgressDeadlineExceeded + // reason will be surfaced in the deployment status. Note that progress will + // not be estimated during the time a deployment is paused. Defaults to 600s. + ProgressDeadlineSeconds *int32 `json:"progressDeadlineSeconds,omitempty"` +} + +/// [MachineDeploymentSpec] + +/// [MachineDeploymentStrategy] +// MachineDeploymentStrategy describes how to replace existing machines +// with new ones. +type MachineDeploymentStrategy struct { + // Type of deployment. Currently the only supported strategy is + // "RollingUpdate". + // Default is RollingUpdate. + // +optional + Type common.MachineDeploymentStrategyType `json:"type,omitempty"` + + // Rolling update config params. Present only if + // MachineDeploymentStrategyType = RollingUpdate. + // +optional + RollingUpdate *MachineRollingUpdateDeployment `json:"rollingUpdate,omitempty"` +} + +/// [MachineDeploymentStrategy] + +/// [MachineRollingUpdateDeployment] +// Spec to control the desired behavior of rolling update. +type MachineRollingUpdateDeployment struct { + // The maximum number of machines that can be unavailable during the update. + // Value can be an absolute number (ex: 5) or a percentage of desired + // machines (ex: 10%). + // Absolute number is calculated from percentage by rounding down. + // This can not be 0 if MaxSurge is 0. + // Defaults to 0. + // Example: when this is set to 30%, the old MachineSet can be scaled + // down to 70% of desired machines immediately when the rolling update + // starts. Once new machines are ready, old MachineSet can be scaled + // down further, followed by scaling up the new MachineSet, ensuring + // that the total number of machines available at all times + // during the update is at least 70% of desired machines. + // +optional + MaxUnavailable *intstr.IntOrString `json:"maxUnavailable,omitempty" protobuf:"bytes,1,opt,name=maxUnavailable"` + + // The maximum number of machines that can be scheduled above the + // desired number of machines. + // Value can be an absolute number (ex: 5) or a percentage of + // desired machines (ex: 10%). + // This can not be 0 if MaxUnavailable is 0. + // Absolute number is calculated from percentage by rounding up. + // Defaults to 1. + // Example: when this is set to 30%, the new MachineSet can be scaled + // up immediately when the rolling update starts, such that the total + // number of old and new machines do not exceed 130% of desired + // machines. Once old machines have been killed, new MachineSet can + // be scaled up further, ensuring that total number of machines running + // at any time during the update is at most 130% of desired machines. + // +optional + MaxSurge *intstr.IntOrString `json:"maxSurge,omitempty" protobuf:"bytes,2,opt,name=maxSurge"` +} + +/// [MachineRollingUpdateDeployment] + +/// [MachineDeploymentStatus] +// MachineDeploymentStatus defines the observed state of MachineDeployment +type MachineDeploymentStatus struct { + // The generation observed by the deployment controller. + // +optional + ObservedGeneration int64 `json:"observedGeneration,omitempty" protobuf:"varint,1,opt,name=observedGeneration"` + + // Total number of non-terminated machines targeted by this deployment + // (their labels match the selector). + // +optional + Replicas int32 `json:"replicas,omitempty" protobuf:"varint,2,opt,name=replicas"` + + // Total number of non-terminated machines targeted by this deployment + // that have the desired template spec. + // +optional + UpdatedReplicas int32 `json:"updatedReplicas,omitempty" protobuf:"varint,3,opt,name=updatedReplicas"` + + // Total number of ready machines targeted by this deployment. + // +optional + ReadyReplicas int32 `json:"readyReplicas,omitempty" protobuf:"varint,7,opt,name=readyReplicas"` + + // Total number of available machines (ready for at least minReadySeconds) + // targeted by this deployment. + // +optional + AvailableReplicas int32 `json:"availableReplicas,omitempty" protobuf:"varint,4,opt,name=availableReplicas"` + + // Total number of unavailable machines targeted by this deployment. + // This is the total number of machines that are still required for + // the deployment to have 100% available capacity. They may either + // be machines that are running but not yet available or machines + // that still have not been created. + // +optional + UnavailableReplicas int32 `json:"unavailableReplicas,omitempty" protobuf:"varint,5,opt,name=unavailableReplicas"` +} + +/// [MachineDeploymentStatus] + +// +genclient +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object + +/// [MachineDeployment] +// MachineDeployment is the Schema for the machinedeployments API +// +k8s:openapi-gen=true +// +kubebuilder:resource:shortName=md +// +kubebuilder:subresource:status +// +kubebuilder:subresource:scale:specpath=.spec.replicas,statuspath=.status.replicas,selectorpath=.status.labelSelector +type MachineDeployment struct { + metav1.TypeMeta `json:",inline"` + metav1.ObjectMeta `json:"metadata,omitempty"` + + Spec MachineDeploymentSpec `json:"spec,omitempty"` + Status MachineDeploymentStatus `json:"status,omitempty"` +} + +/// [MachineDeployment] + +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object + +// MachineDeploymentList contains a list of MachineDeployment +type MachineDeploymentList struct { + metav1.TypeMeta `json:",inline"` + metav1.ListMeta `json:"metadata,omitempty"` + Items []MachineDeployment `json:"items"` +} + +func init() { +} diff --git a/cluster-autoscaler/vendor/sigs.k8s.io/cluster-api/pkg/apis/cluster/v1alpha1/machineset_types.go b/cluster-autoscaler/vendor/sigs.k8s.io/cluster-api/pkg/apis/cluster/v1alpha1/machineset_types.go new file mode 100644 index 000000000000..362a06af767c --- /dev/null +++ b/cluster-autoscaler/vendor/sigs.k8s.io/cluster-api/pkg/apis/cluster/v1alpha1/machineset_types.go @@ -0,0 +1,221 @@ +/* +Copyright 2018 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package v1alpha1 + +import ( + "log" + + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + metav1validation "k8s.io/apimachinery/pkg/apis/meta/v1/validation" + "k8s.io/apimachinery/pkg/labels" + "k8s.io/apimachinery/pkg/util/validation/field" + "sigs.k8s.io/cluster-api/pkg/apis/cluster/common" +) + +// +genclient +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object + +/// [MachineSet] +// MachineSet ensures that a specified number of machines replicas are running at any given time. +// +k8s:openapi-gen=true +// +kubebuilder:resource:shortName=ms +// +kubebuilder:subresource:status +// +kubebuilder:subresource:scale:specpath=.spec.replicas,statuspath=.status.replicas,selectorpath=.status.labelSelector +type MachineSet struct { + metav1.TypeMeta `json:",inline"` + metav1.ObjectMeta `json:"metadata,omitempty"` + + Spec MachineSetSpec `json:"spec,omitempty"` + Status MachineSetStatus `json:"status,omitempty"` +} + +/// [MachineSet] + +/// [MachineSetSpec] +// MachineSetSpec defines the desired state of MachineSet +type MachineSetSpec struct { + // Replicas is the number of desired replicas. + // This is a pointer to distinguish between explicit zero and unspecified. + // Defaults to 1. + // +optional + Replicas *int32 `json:"replicas,omitempty"` + + // MinReadySeconds is the minimum number of seconds for which a newly created machine should be ready. + // Defaults to 0 (machine will be considered available as soon as it is ready) + // +optional + MinReadySeconds int32 `json:"minReadySeconds,omitempty"` + + // DeletePolicy defines the policy used to identify nodes to delete when downscaling. + // Defaults to "Random". Valid values are "Random, "Newest", "Oldest" + // +kubebuilder:validation:Enum=Random,Newest,Oldest + DeletePolicy string `json:"deletePolicy,omitempty"` + + // Selector is a label query over machines that should match the replica count. + // Label keys and values that must match in order to be controlled by this MachineSet. + // It must match the machine template's labels. + // More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/labels/#label-selectors + Selector metav1.LabelSelector `json:"selector"` + + // Template is the object that describes the machine that will be created if + // insufficient replicas are detected. + // +optional + Template MachineTemplateSpec `json:"template,omitempty"` +} + +// MachineSetDeletePolicy defines how priority is assigned to nodes to delete when +// downscaling a MachineSet. Defaults to "Random". +type MachineSetDeletePolicy string + +const ( + // RandomMachineSetDeletePolicy prioritizes both Machines that have the annotation + // "cluster.k8s.io/delete-machine=yes" and Machines that are unhealthy + // (Status.ErrorReason or Status.ErrorMessage are set to a non-empty value). + // Finally, it picks Machines at random to delete. + RandomMachineSetDeletePolicy MachineSetDeletePolicy = "Random" + + // NewestMachineSetDeletePolicy prioritizes both Machines that have the annotation + // "cluster.k8s.io/delete-machine=yes" and Machines that are unhealthy + // (Status.ErrorReason or Status.ErrorMessage are set to a non-empty value). + // It then prioritizes the newest Machines for deletion based on the Machine's CreationTimestamp. + NewestMachineSetDeletePolicy MachineSetDeletePolicy = "Newest" + + // OldestMachineSetDeletePolicy prioritizes both Machines that have the annotation + // "cluster.k8s.io/delete-machine=yes" and Machines that are unhealthy + // (Status.ErrorReason or Status.ErrorMessage are set to a non-empty value). + // It then prioritizes the oldest Machines for deletion based on the Machine's CreationTimestamp. + OldestMachineSetDeletePolicy MachineSetDeletePolicy = "Oldest" +) + +/// [MachineSetSpec] // doxygen marker + +/// [MachineTemplateSpec] // doxygen marker +// MachineTemplateSpec describes the data needed to create a Machine from a template +type MachineTemplateSpec struct { + // Standard object's metadata. + // More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#metadata + // +optional + metav1.ObjectMeta `json:"metadata,omitempty"` + + // Specification of the desired behavior of the machine. + // More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#spec-and-status + // +optional + Spec MachineSpec `json:"spec,omitempty"` +} + +/// [MachineTemplateSpec] + +/// [MachineSetStatus] +// MachineSetStatus defines the observed state of MachineSet +type MachineSetStatus struct { + // Replicas is the most recently observed number of replicas. + Replicas int32 `json:"replicas"` + + // The number of replicas that have labels matching the labels of the machine template of the MachineSet. + // +optional + FullyLabeledReplicas int32 `json:"fullyLabeledReplicas,omitempty"` + + // The number of ready replicas for this MachineSet. A machine is considered ready when the node has been created and is "Ready". + // +optional + ReadyReplicas int32 `json:"readyReplicas,omitempty"` + + // The number of available replicas (ready for at least minReadySeconds) for this MachineSet. + // +optional + AvailableReplicas int32 `json:"availableReplicas,omitempty"` + + // ObservedGeneration reflects the generation of the most recently observed MachineSet. + // +optional + ObservedGeneration int64 `json:"observedGeneration,omitempty"` + + // In the event that there is a terminal problem reconciling the + // replicas, both ErrorReason and ErrorMessage will be set. ErrorReason + // will be populated with a succinct value suitable for machine + // interpretation, while ErrorMessage will contain a more verbose + // string suitable for logging and human consumption. + // + // These fields should not be set for transitive errors that a + // controller faces that are expected to be fixed automatically over + // time (like service outages), but instead indicate that something is + // fundamentally wrong with the MachineTemplate's spec or the configuration of + // the machine controller, and that manual intervention is required. Examples + // of terminal errors would be invalid combinations of settings in the + // spec, values that are unsupported by the machine controller, or the + // responsible machine controller itself being critically misconfigured. + // + // Any transient errors that occur during the reconciliation of Machines + // can be added as events to the MachineSet object and/or logged in the + // controller's output. + // +optional + ErrorReason *common.MachineSetStatusError `json:"errorReason,omitempty"` + // +optional + ErrorMessage *string `json:"errorMessage,omitempty"` +} + +/// [MachineSetStatus] + +func (m *MachineSet) Validate() field.ErrorList { + errors := field.ErrorList{} + + // validate spec.selector and spec.template.labels + fldPath := field.NewPath("spec") + errors = append(errors, metav1validation.ValidateLabelSelector(&m.Spec.Selector, fldPath.Child("selector"))...) + if len(m.Spec.Selector.MatchLabels)+len(m.Spec.Selector.MatchExpressions) == 0 { + errors = append(errors, field.Invalid(fldPath.Child("selector"), m.Spec.Selector, "empty selector is not valid for MachineSet.")) + } + selector, err := metav1.LabelSelectorAsSelector(&m.Spec.Selector) + if err != nil { + errors = append(errors, field.Invalid(fldPath.Child("selector"), m.Spec.Selector, "invalid label selector.")) + } else { + labels := labels.Set(m.Spec.Template.Labels) + if !selector.Matches(labels) { + errors = append(errors, field.Invalid(fldPath.Child("template", "metadata", "labels"), m.Spec.Template.Labels, "`selector` does not match template `labels`")) + } + } + + return errors +} + +// DefaultingFunction sets default MachineSet field values +func (m *MachineSet) Default() { + log.Printf("Defaulting fields for MachineSet %s\n", m.Name) + + if m.Spec.Replicas == nil { + m.Spec.Replicas = new(int32) + *m.Spec.Replicas = 1 + } + + if len(m.Namespace) == 0 { + m.Namespace = metav1.NamespaceDefault + } + + if m.Spec.DeletePolicy == "" { + randomPolicy := string(RandomMachineSetDeletePolicy) + log.Printf("Defaulting to %s\n", randomPolicy) + m.Spec.DeletePolicy = randomPolicy + } +} + +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object + +// MachineSetList contains a list of MachineSet +type MachineSetList struct { + metav1.TypeMeta `json:",inline"` + metav1.ListMeta `json:"metadata,omitempty"` + Items []MachineSet `json:"items"` +} + +func init() { +} diff --git a/cluster-autoscaler/vendor/sigs.k8s.io/cluster-api/pkg/apis/cluster/v1alpha1/register.go b/cluster-autoscaler/vendor/sigs.k8s.io/cluster-api/pkg/apis/cluster/v1alpha1/register.go new file mode 100644 index 000000000000..3f621a0fa57f --- /dev/null +++ b/cluster-autoscaler/vendor/sigs.k8s.io/cluster-api/pkg/apis/cluster/v1alpha1/register.go @@ -0,0 +1,73 @@ +/* +Copyright 2018 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// NOTE: Boilerplate only. Ignore this file. + +// Package v1alpha1 contains API Schema definitions for the cluster v1alpha1 API group +// +k8s:openapi-gen=true +// +k8s:deepcopy-gen=package,register +// +k8s:conversion-gen=sigs.k8s.io/cluster-api/pkg/apis/cluster +// +k8s:defaulter-gen=TypeMeta +// +groupName=cluster.k8s.io +package v1alpha1 + +import ( + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/runtime" + "k8s.io/apimachinery/pkg/runtime/schema" + //"sigs.k8s.io/controller-runtime/pkg/runtime/scheme" +) + +var ( + // SchemeGroupVersion is group version used to register these objects. + SchemeGroupVersion = schema.GroupVersion{Group: "cluster.k8s.io", Version: "v1alpha1"} + + // SchemeBuilder is used to add go types to the GroupVersionKind scheme. + //SchemeBuilder = &scheme.Builder{GroupVersion: SchemeGroupVersion} + SchemeBuilder = runtime.NewSchemeBuilder(addKnownTypes, addDefaultingFuncs) + + // AddToScheme adds registered types to the builder. + // Required by pkg/client/... + // TODO(pwittrock): Remove this after removing pkg/client/... + AddToScheme = SchemeBuilder.AddToScheme +) + +// Required by pkg/client/listers/... +// TODO(pwittrock): Remove this after removing pkg/client/... +func Resource(resource string) schema.GroupResource { + return SchemeGroupVersion.WithResource(resource).GroupResource() +} + +// Adds the list of known types to api.Scheme. +func addKnownTypes(scheme *runtime.Scheme) error { + scheme.AddKnownTypes(SchemeGroupVersion, + &Machine{}, + &MachineList{}, + &MachineSet{}, + &MachineSetList{}, + &MachineDeployment{}, + &MachineDeploymentList{}, + &MachineClass{}, + &MachineClassList{}, + ) + + metav1.AddToGroupVersion(scheme, SchemeGroupVersion) + return nil +} + +func addDefaultingFuncs(scheme *runtime.Scheme) error { + return nil +} diff --git a/cluster-autoscaler/vendor/sigs.k8s.io/cluster-api/pkg/apis/cluster/v1alpha1/testutil/BUILD.bazel b/cluster-autoscaler/vendor/sigs.k8s.io/cluster-api/pkg/apis/cluster/v1alpha1/testutil/BUILD.bazel new file mode 100644 index 000000000000..bcee50bdc5b5 --- /dev/null +++ b/cluster-autoscaler/vendor/sigs.k8s.io/cluster-api/pkg/apis/cluster/v1alpha1/testutil/BUILD.bazel @@ -0,0 +1,9 @@ +load("@io_bazel_rules_go//go:def.bzl", "go_library") + +go_library( + name = "go_default_library", + srcs = ["testutil.go"], + importpath = "sigs.k8s.io/cluster-api/pkg/apis/cluster/v1alpha1/testutil", + visibility = ["//visibility:public"], + deps = ["//pkg/apis/cluster/v1alpha1:go_default_library"], +) diff --git a/cluster-autoscaler/vendor/sigs.k8s.io/cluster-api/pkg/apis/cluster/v1alpha1/testutil/testutil.go b/cluster-autoscaler/vendor/sigs.k8s.io/cluster-api/pkg/apis/cluster/v1alpha1/testutil/testutil.go new file mode 100644 index 000000000000..2af50c96d8ca --- /dev/null +++ b/cluster-autoscaler/vendor/sigs.k8s.io/cluster-api/pkg/apis/cluster/v1alpha1/testutil/testutil.go @@ -0,0 +1,36 @@ +/* +Copyright 2018 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package testutil + +import "sigs.k8s.io/cluster-api/pkg/apis/cluster/v1alpha1" + +// GetVanillaCluster return a bare minimum functional cluster resource object +func GetVanillaCluster() v1alpha1.Cluster { + return v1alpha1.Cluster{ + Spec: v1alpha1.ClusterSpec{ + ClusterNetwork: v1alpha1.ClusterNetworkingConfig{ + Services: v1alpha1.NetworkRanges{ + CIDRBlocks: []string{"10.96.0.0/12"}, + }, + Pods: v1alpha1.NetworkRanges{ + CIDRBlocks: []string{"192.168.0.0/16"}, + }, + ServiceDomain: "cluster.local", + }, + }, + } +} diff --git a/cluster-autoscaler/vendor/sigs.k8s.io/cluster-api/pkg/apis/cluster/v1alpha1/zz_generated.deepcopy.go b/cluster-autoscaler/vendor/sigs.k8s.io/cluster-api/pkg/apis/cluster/v1alpha1/zz_generated.deepcopy.go new file mode 100644 index 000000000000..2eae6cd14cac --- /dev/null +++ b/cluster-autoscaler/vendor/sigs.k8s.io/cluster-api/pkg/apis/cluster/v1alpha1/zz_generated.deepcopy.go @@ -0,0 +1,946 @@ +// +build !ignore_autogenerated + +/* +Copyright 2019 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by deepcopy-gen. DO NOT EDIT. + +package v1alpha1 + +import ( + v1 "k8s.io/api/core/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + intstr "k8s.io/apimachinery/pkg/util/intstr" + common "sigs.k8s.io/cluster-api/pkg/apis/cluster/common" +) + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *APIEndpoint) DeepCopyInto(out *APIEndpoint) { + *out = *in + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new APIEndpoint. +func (in *APIEndpoint) DeepCopy() *APIEndpoint { + if in == nil { + return nil + } + out := new(APIEndpoint) + 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) + in.Status.DeepCopyInto(&out.Status) + 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 + } + return nil +} + +// 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 + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ClusterNetworkingConfig) DeepCopyInto(out *ClusterNetworkingConfig) { + *out = *in + in.Services.DeepCopyInto(&out.Services) + in.Pods.DeepCopyInto(&out.Pods) + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ClusterNetworkingConfig. +func (in *ClusterNetworkingConfig) DeepCopy() *ClusterNetworkingConfig { + if in == nil { + return nil + } + out := new(ClusterNetworkingConfig) + in.DeepCopyInto(out) + return out +} + +// 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 + in.ClusterNetwork.DeepCopyInto(&out.ClusterNetwork) + in.ProviderSpec.DeepCopyInto(&out.ProviderSpec) + 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.APIEndpoints != nil { + in, out := &in.APIEndpoints, &out.APIEndpoints + *out = make([]APIEndpoint, len(*in)) + copy(*out, *in) + } + if in.ProviderStatus != nil { + in, out := &in.ProviderStatus, &out.ProviderStatus + if *in == nil { + *out = nil + } else { + *out = new(runtime.RawExtension) + (*in).DeepCopyInto(*out) + } + } + 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 *LastOperation) DeepCopyInto(out *LastOperation) { + *out = *in + if in.Description != nil { + in, out := &in.Description, &out.Description + if *in == nil { + *out = nil + } else { + *out = new(string) + **out = **in + } + } + if in.LastUpdated != nil { + in, out := &in.LastUpdated, &out.LastUpdated + if *in == nil { + *out = nil + } else { + *out = (*in).DeepCopy() + } + } + if in.State != nil { + in, out := &in.State, &out.State + if *in == nil { + *out = nil + } else { + *out = new(string) + **out = **in + } + } + if in.Type != nil { + in, out := &in.Type, &out.Type + if *in == nil { + *out = nil + } else { + *out = new(string) + **out = **in + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new LastOperation. +func (in *LastOperation) DeepCopy() *LastOperation { + if in == nil { + return nil + } + out := new(LastOperation) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *Machine) DeepCopyInto(out *Machine) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) + in.Spec.DeepCopyInto(&out.Spec) + in.Status.DeepCopyInto(&out.Status) + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Machine. +func (in *Machine) DeepCopy() *Machine { + if in == nil { + return nil + } + out := new(Machine) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *Machine) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *MachineClass) DeepCopyInto(out *MachineClass) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) + in.ProviderSpec.DeepCopyInto(&out.ProviderSpec) + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new MachineClass. +func (in *MachineClass) DeepCopy() *MachineClass { + if in == nil { + return nil + } + out := new(MachineClass) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *MachineClass) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *MachineClassList) DeepCopyInto(out *MachineClassList) { + *out = *in + out.TypeMeta = in.TypeMeta + out.ListMeta = in.ListMeta + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]MachineClass, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new MachineClassList. +func (in *MachineClassList) DeepCopy() *MachineClassList { + if in == nil { + return nil + } + out := new(MachineClassList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *MachineClassList) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *MachineClassRef) DeepCopyInto(out *MachineClassRef) { + *out = *in + if in.ObjectReference != nil { + in, out := &in.ObjectReference, &out.ObjectReference + if *in == nil { + *out = nil + } else { + *out = new(v1.ObjectReference) + **out = **in + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new MachineClassRef. +func (in *MachineClassRef) DeepCopy() *MachineClassRef { + if in == nil { + return nil + } + out := new(MachineClassRef) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *MachineDeployment) DeepCopyInto(out *MachineDeployment) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) + in.Spec.DeepCopyInto(&out.Spec) + out.Status = in.Status + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new MachineDeployment. +func (in *MachineDeployment) DeepCopy() *MachineDeployment { + if in == nil { + return nil + } + out := new(MachineDeployment) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *MachineDeployment) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *MachineDeploymentList) DeepCopyInto(out *MachineDeploymentList) { + *out = *in + out.TypeMeta = in.TypeMeta + out.ListMeta = in.ListMeta + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]MachineDeployment, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new MachineDeploymentList. +func (in *MachineDeploymentList) DeepCopy() *MachineDeploymentList { + if in == nil { + return nil + } + out := new(MachineDeploymentList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *MachineDeploymentList) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *MachineDeploymentSpec) DeepCopyInto(out *MachineDeploymentSpec) { + *out = *in + if in.Replicas != nil { + in, out := &in.Replicas, &out.Replicas + if *in == nil { + *out = nil + } else { + *out = new(int32) + **out = **in + } + } + in.Selector.DeepCopyInto(&out.Selector) + in.Template.DeepCopyInto(&out.Template) + if in.Strategy != nil { + in, out := &in.Strategy, &out.Strategy + if *in == nil { + *out = nil + } else { + *out = new(MachineDeploymentStrategy) + (*in).DeepCopyInto(*out) + } + } + if in.MinReadySeconds != nil { + in, out := &in.MinReadySeconds, &out.MinReadySeconds + if *in == nil { + *out = nil + } else { + *out = new(int32) + **out = **in + } + } + if in.RevisionHistoryLimit != nil { + in, out := &in.RevisionHistoryLimit, &out.RevisionHistoryLimit + if *in == nil { + *out = nil + } else { + *out = new(int32) + **out = **in + } + } + if in.ProgressDeadlineSeconds != nil { + in, out := &in.ProgressDeadlineSeconds, &out.ProgressDeadlineSeconds + if *in == nil { + *out = nil + } else { + *out = new(int32) + **out = **in + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new MachineDeploymentSpec. +func (in *MachineDeploymentSpec) DeepCopy() *MachineDeploymentSpec { + if in == nil { + return nil + } + out := new(MachineDeploymentSpec) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *MachineDeploymentStatus) DeepCopyInto(out *MachineDeploymentStatus) { + *out = *in + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new MachineDeploymentStatus. +func (in *MachineDeploymentStatus) DeepCopy() *MachineDeploymentStatus { + if in == nil { + return nil + } + out := new(MachineDeploymentStatus) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *MachineDeploymentStrategy) DeepCopyInto(out *MachineDeploymentStrategy) { + *out = *in + if in.RollingUpdate != nil { + in, out := &in.RollingUpdate, &out.RollingUpdate + if *in == nil { + *out = nil + } else { + *out = new(MachineRollingUpdateDeployment) + (*in).DeepCopyInto(*out) + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new MachineDeploymentStrategy. +func (in *MachineDeploymentStrategy) DeepCopy() *MachineDeploymentStrategy { + if in == nil { + return nil + } + out := new(MachineDeploymentStrategy) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *MachineList) DeepCopyInto(out *MachineList) { + *out = *in + out.TypeMeta = in.TypeMeta + out.ListMeta = in.ListMeta + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]Machine, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new MachineList. +func (in *MachineList) DeepCopy() *MachineList { + if in == nil { + return nil + } + out := new(MachineList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *MachineList) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *MachineRollingUpdateDeployment) DeepCopyInto(out *MachineRollingUpdateDeployment) { + *out = *in + if in.MaxUnavailable != nil { + in, out := &in.MaxUnavailable, &out.MaxUnavailable + if *in == nil { + *out = nil + } else { + *out = new(intstr.IntOrString) + **out = **in + } + } + if in.MaxSurge != nil { + in, out := &in.MaxSurge, &out.MaxSurge + if *in == nil { + *out = nil + } else { + *out = new(intstr.IntOrString) + **out = **in + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new MachineRollingUpdateDeployment. +func (in *MachineRollingUpdateDeployment) DeepCopy() *MachineRollingUpdateDeployment { + if in == nil { + return nil + } + out := new(MachineRollingUpdateDeployment) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *MachineSet) DeepCopyInto(out *MachineSet) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) + in.Spec.DeepCopyInto(&out.Spec) + in.Status.DeepCopyInto(&out.Status) + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new MachineSet. +func (in *MachineSet) DeepCopy() *MachineSet { + if in == nil { + return nil + } + out := new(MachineSet) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *MachineSet) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *MachineSetList) DeepCopyInto(out *MachineSetList) { + *out = *in + out.TypeMeta = in.TypeMeta + out.ListMeta = in.ListMeta + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]MachineSet, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new MachineSetList. +func (in *MachineSetList) DeepCopy() *MachineSetList { + if in == nil { + return nil + } + out := new(MachineSetList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *MachineSetList) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *MachineSetSpec) DeepCopyInto(out *MachineSetSpec) { + *out = *in + if in.Replicas != nil { + in, out := &in.Replicas, &out.Replicas + if *in == nil { + *out = nil + } else { + *out = new(int32) + **out = **in + } + } + in.Selector.DeepCopyInto(&out.Selector) + in.Template.DeepCopyInto(&out.Template) + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new MachineSetSpec. +func (in *MachineSetSpec) DeepCopy() *MachineSetSpec { + if in == nil { + return nil + } + out := new(MachineSetSpec) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *MachineSetStatus) DeepCopyInto(out *MachineSetStatus) { + *out = *in + if in.ErrorReason != nil { + in, out := &in.ErrorReason, &out.ErrorReason + if *in == nil { + *out = nil + } else { + *out = new(common.MachineSetStatusError) + **out = **in + } + } + if in.ErrorMessage != nil { + in, out := &in.ErrorMessage, &out.ErrorMessage + if *in == nil { + *out = nil + } else { + *out = new(string) + **out = **in + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new MachineSetStatus. +func (in *MachineSetStatus) DeepCopy() *MachineSetStatus { + if in == nil { + return nil + } + out := new(MachineSetStatus) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *MachineSpec) DeepCopyInto(out *MachineSpec) { + *out = *in + in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) + if in.Taints != nil { + in, out := &in.Taints, &out.Taints + *out = make([]v1.Taint, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + in.ProviderSpec.DeepCopyInto(&out.ProviderSpec) + out.Versions = in.Versions + if in.ConfigSource != nil { + in, out := &in.ConfigSource, &out.ConfigSource + if *in == nil { + *out = nil + } else { + *out = new(v1.NodeConfigSource) + (*in).DeepCopyInto(*out) + } + } + if in.ProviderID != nil { + in, out := &in.ProviderID, &out.ProviderID + if *in == nil { + *out = nil + } else { + *out = new(string) + **out = **in + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new MachineSpec. +func (in *MachineSpec) DeepCopy() *MachineSpec { + if in == nil { + return nil + } + out := new(MachineSpec) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *MachineStatus) DeepCopyInto(out *MachineStatus) { + *out = *in + if in.NodeRef != nil { + in, out := &in.NodeRef, &out.NodeRef + if *in == nil { + *out = nil + } else { + *out = new(v1.ObjectReference) + **out = **in + } + } + if in.LastUpdated != nil { + in, out := &in.LastUpdated, &out.LastUpdated + if *in == nil { + *out = nil + } else { + *out = (*in).DeepCopy() + } + } + if in.Versions != nil { + in, out := &in.Versions, &out.Versions + if *in == nil { + *out = nil + } else { + *out = new(MachineVersionInfo) + **out = **in + } + } + if in.ErrorReason != nil { + in, out := &in.ErrorReason, &out.ErrorReason + if *in == nil { + *out = nil + } else { + *out = new(common.MachineStatusError) + **out = **in + } + } + if in.ErrorMessage != nil { + in, out := &in.ErrorMessage, &out.ErrorMessage + if *in == nil { + *out = nil + } else { + *out = new(string) + **out = **in + } + } + if in.ProviderStatus != nil { + in, out := &in.ProviderStatus, &out.ProviderStatus + if *in == nil { + *out = nil + } else { + *out = new(runtime.RawExtension) + (*in).DeepCopyInto(*out) + } + } + if in.Addresses != nil { + in, out := &in.Addresses, &out.Addresses + *out = make([]v1.NodeAddress, len(*in)) + copy(*out, *in) + } + if in.Conditions != nil { + in, out := &in.Conditions, &out.Conditions + *out = make([]v1.NodeCondition, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + if in.LastOperation != nil { + in, out := &in.LastOperation, &out.LastOperation + if *in == nil { + *out = nil + } else { + *out = new(LastOperation) + (*in).DeepCopyInto(*out) + } + } + if in.Phase != nil { + in, out := &in.Phase, &out.Phase + if *in == nil { + *out = nil + } else { + *out = new(string) + **out = **in + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new MachineStatus. +func (in *MachineStatus) DeepCopy() *MachineStatus { + if in == nil { + return nil + } + out := new(MachineStatus) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *MachineTemplateSpec) DeepCopyInto(out *MachineTemplateSpec) { + *out = *in + in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) + in.Spec.DeepCopyInto(&out.Spec) + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new MachineTemplateSpec. +func (in *MachineTemplateSpec) DeepCopy() *MachineTemplateSpec { + if in == nil { + return nil + } + out := new(MachineTemplateSpec) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *MachineVersionInfo) DeepCopyInto(out *MachineVersionInfo) { + *out = *in + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new MachineVersionInfo. +func (in *MachineVersionInfo) DeepCopy() *MachineVersionInfo { + if in == nil { + return nil + } + out := new(MachineVersionInfo) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *NetworkRanges) DeepCopyInto(out *NetworkRanges) { + *out = *in + if in.CIDRBlocks != nil { + in, out := &in.CIDRBlocks, &out.CIDRBlocks + *out = make([]string, len(*in)) + copy(*out, *in) + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new NetworkRanges. +func (in *NetworkRanges) DeepCopy() *NetworkRanges { + if in == nil { + return nil + } + out := new(NetworkRanges) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ProviderSpec) DeepCopyInto(out *ProviderSpec) { + *out = *in + if in.Value != nil { + in, out := &in.Value, &out.Value + if *in == nil { + *out = nil + } else { + *out = new(runtime.RawExtension) + (*in).DeepCopyInto(*out) + } + } + if in.ValueFrom != nil { + in, out := &in.ValueFrom, &out.ValueFrom + if *in == nil { + *out = nil + } else { + *out = new(ProviderSpecSource) + (*in).DeepCopyInto(*out) + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ProviderSpec. +func (in *ProviderSpec) DeepCopy() *ProviderSpec { + if in == nil { + return nil + } + out := new(ProviderSpec) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ProviderSpecSource) DeepCopyInto(out *ProviderSpecSource) { + *out = *in + if in.MachineClass != nil { + in, out := &in.MachineClass, &out.MachineClass + if *in == nil { + *out = nil + } else { + *out = new(MachineClassRef) + (*in).DeepCopyInto(*out) + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ProviderSpecSource. +func (in *ProviderSpecSource) DeepCopy() *ProviderSpecSource { + if in == nil { + return nil + } + out := new(ProviderSpecSource) + in.DeepCopyInto(out) + return out +}