From eb4d4e5e9231729dfe65cdb3dba781dbde68f411 Mon Sep 17 00:00:00 2001 From: Prashanth Date: Mon, 8 Jan 2018 23:28:23 +0530 Subject: [PATCH] Change of terminology, renamed instances to machines --- Makefile | 32 +- NOTICE.md | 8 +- README.md | 9 +- .../app/controllermanager.go | 16 +- docs/README.md | 6 +- docs/design/README.md | 20 +- docs/usage/instance_set.md | 107 -- docs/usage/{instance.md => machine.md} | 50 +- ...ce_deployment.md => machine_deployment.md} | 121 +- docs/usage/machine_set.md | 107 ++ docs/usage/prerequisite.md | 26 +- ...ance-class.yaml => aws-machine-class.yaml} | 22 +- kubernetes/crds.yaml | 40 +- kubernetes/deployment/clusterrole.yaml | 10 +- kubernetes/deployment/deployment.yaml | 2 +- kubernetes/instance-deployment.yaml | 28 - kubernetes/instance.yaml | 12 - kubernetes/machine-deployment.yaml | 28 + .../{instance-set.yaml => machine-set.yaml} | 14 +- kubernetes/machine.yaml | 12 + pkg/apis/{node => machine}/doc.go | 4 +- pkg/apis/{node => machine}/install/install.go | 6 +- pkg/apis/{node => machine}/register.go | 20 +- pkg/apis/{node => machine}/types.go | 264 ++-- .../{node => machine}/v1alpha1/defaults.go | 0 pkg/apis/{node => machine}/v1alpha1/doc.go | 4 +- .../{node => machine}/v1alpha1/register.go | 18 +- pkg/apis/{node => machine}/v1alpha1/types.go | 262 ++-- .../v1alpha1/zz_generated.conversion.go | 1060 +++++++++++++++++ .../v1alpha1/zz_generated.deepcopy.go | 354 +++--- .../v1alpha1/zz_generated.defaults.go | 0 .../validation/awsmachineclass.go} | 24 +- .../validation/machine.go} | 16 +- .../validation/machinedeployment.go} | 16 +- .../validation/machineset.go} | 16 +- .../zz_generated.deepcopy.go | 356 +++--- .../zz_generated.defaults.go | 2 +- .../node/v1alpha1/zz_generated.conversion.go | 1060 ----------------- pkg/client/clientset/clientset.go | 26 +- .../clientset/fake/clientset_generated.go | 16 +- pkg/client/clientset/fake/register.go | 4 +- pkg/client/clientset/scheme/register.go | 4 +- .../typed/machine/v1alpha1/awsmachineclass.go | 129 ++ .../typed/{node => machine}/v1alpha1/doc.go | 0 .../{node => machine}/v1alpha1/fake/doc.go | 0 .../v1alpha1/fake/fake_awsmachineclass.go | 102 ++ .../machine/v1alpha1/fake/fake_machine.go | 102 ++ .../v1alpha1/fake/fake_machine_client.go | 42 + .../v1alpha1/fake/fake_machinedeployment.go | 133 +++ .../machine/v1alpha1/fake/fake_machineset.go | 113 ++ .../v1alpha1/fake/fake_machinetemplate.go | 110 ++ .../v1alpha1/fake/fake_scale.go | 2 +- .../machine/v1alpha1/generated_expansion.go | 13 + .../typed/machine/v1alpha1/machine.go | 129 ++ .../typed/machine/v1alpha1/machine_client.go | 97 ++ .../machine/v1alpha1/machinedeployment.go | 174 +++ .../typed/machine/v1alpha1/machineset.go | 145 +++ .../typed/machine/v1alpha1/machinetemplate.go | 139 +++ .../typed/{node => machine}/v1alpha1/scale.go | 2 +- .../typed/node/v1alpha1/awsinstanceclass.go | 129 -- .../v1alpha1/fake/fake_awsinstanceclass.go | 102 -- .../typed/node/v1alpha1/fake/fake_instance.go | 102 -- .../v1alpha1/fake/fake_instancedeployment.go | 133 --- .../node/v1alpha1/fake/fake_instanceset.go | 113 -- .../v1alpha1/fake/fake_instancetemplate.go | 110 -- .../node/v1alpha1/fake/fake_node_client.go | 42 - .../node/v1alpha1/generated_expansion.go | 13 - .../clientset/typed/node/v1alpha1/instance.go | 129 -- .../typed/node/v1alpha1/instancedeployment.go | 174 --- .../typed/node/v1alpha1/instanceset.go | 145 --- .../typed/node/v1alpha1/instancetemplate.go | 139 --- .../typed/node/v1alpha1/node_client.go | 97 -- .../informers/externalversions/factory.go | 8 +- .../informers/externalversions/generic.go | 24 +- .../{node => machine}/interface.go | 4 +- .../machine/v1alpha1/awsmachineclass.go | 57 + .../machine/v1alpha1/interface.go | 55 + .../machine/v1alpha1/machine.go | 57 + .../machine/v1alpha1/machinedeployment.go | 57 + .../machine/v1alpha1/machineset.go | 57 + .../machine/v1alpha1/machinetemplate.go | 57 + .../node/v1alpha1/awsinstanceclass.go | 57 - .../node/v1alpha1/instance.go | 57 - .../node/v1alpha1/instancedeployment.go | 57 - .../node/v1alpha1/instanceset.go | 57 - .../node/v1alpha1/instancetemplate.go | 57 - .../node/v1alpha1/interface.go | 55 - .../informers/internalversion/factory.go | 8 +- .../informers/internalversion/generic.go | 24 +- .../{node => machine}/interface.go | 4 +- .../internalversion/awsmachineclass.go | 57 + .../machine/internalversion/interface.go | 55 + .../machine/internalversion/machine.go | 57 + .../internalversion/machinedeployment.go | 57 + .../machine/internalversion/machineset.go | 57 + .../internalversion/machinetemplate.go | 57 + .../node/internalversion/awsinstanceclass.go | 57 - .../node/internalversion/instance.go | 57 - .../internalversion/instancedeployment.go | 57 - .../node/internalversion/instanceset.go | 57 - .../node/internalversion/instancetemplate.go | 57 - .../node/internalversion/interface.go | 55 - pkg/client/internalclientset/clientset.go | 18 +- .../fake/clientset_generated.go | 10 +- pkg/client/internalclientset/fake/register.go | 4 +- .../internalclientset/scheme/register.go | 4 +- .../internalversion/awsmachineclass.go | 129 ++ .../{node => machine}/internalversion/doc.go | 0 .../internalversion/fake/doc.go | 0 .../fake/fake_awsmachineclass.go | 102 ++ .../internalversion/fake/fake_machine.go | 102 ++ .../fake/fake_machine_client.go | 42 + .../fake/fake_machinedeployment.go | 133 +++ .../internalversion/fake/fake_machineset.go | 113 ++ .../fake/fake_machinetemplate.go | 110 ++ .../internalversion/fake/fake_scale.go | 2 +- .../internalversion/generated_expansion.go | 13 + .../typed/machine/internalversion/machine.go | 129 ++ .../machine/internalversion/machine_client.go | 108 ++ .../internalversion/machinedeployment.go | 174 +++ .../machine/internalversion/machineset.go | 145 +++ .../internalversion/machinetemplate.go | 139 +++ .../internalversion/scale.go | 2 +- .../node/internalversion/awsinstanceclass.go | 129 -- .../fake/fake_awsinstanceclass.go | 102 -- .../internalversion/fake/fake_instance.go | 102 -- .../fake/fake_instancedeployment.go | 133 --- .../internalversion/fake/fake_instanceset.go | 113 -- .../fake/fake_instancetemplate.go | 110 -- .../internalversion/fake/fake_node_client.go | 42 - .../internalversion/generated_expansion.go | 13 - .../typed/node/internalversion/instance.go | 129 -- .../internalversion/instancedeployment.go | 174 --- .../typed/node/internalversion/instanceset.go | 145 --- .../node/internalversion/instancetemplate.go | 139 --- .../typed/node/internalversion/node_client.go | 108 -- .../internalversion/awsmachineclass.go | 51 + .../internalversion/expansion_generated.go | 35 + .../machine/internalversion/machine.go | 51 + .../internalversion/machinedeployment.go | 51 + .../machine/internalversion/machineset.go | 51 + .../internalversion/machinetemplate.go | 78 ++ .../internalversion/scale.go | 22 +- .../machine/v1alpha1/awsmachineclass.go | 51 + .../machine/v1alpha1/expansion_generated.go | 35 + .../listers/machine/v1alpha1/machine.go | 51 + .../machine/v1alpha1/machinedeployment.go | 51 + .../listers/machine/v1alpha1/machineset.go | 51 + .../machine/v1alpha1/machinetemplate.go | 78 ++ .../{node => machine}/v1alpha1/scale.go | 2 +- .../node/internalversion/awsinstanceclass.go | 51 - .../internalversion/expansion_generated.go | 35 - .../listers/node/internalversion/instance.go | 51 - .../internalversion/instancedeployment.go | 51 - .../node/internalversion/instanceset.go | 51 - .../node/internalversion/instancetemplate.go | 78 -- .../listers/node/v1alpha1/awsinstanceclass.go | 51 - .../node/v1alpha1/expansion_generated.go | 35 - pkg/client/listers/node/v1alpha1/instance.go | 51 - .../node/v1alpha1/instancedeployment.go | 51 - .../listers/node/v1alpha1/instanceset.go | 51 - .../listers/node/v1alpha1/instancetemplate.go | 78 -- pkg/controller/controller.go | 174 ++- pkg/controller/controller_ref_manager.go | 164 +-- pkg/controller/controller_utls.go | 248 ++-- pkg/controller/deployment_controller.go | 324 ++--- ..._util.go => deployment_machineset_util.go} | 88 +- pkg/controller/deployment_progress.go | 82 +- pkg/controller/deployment_recreate.go | 52 +- pkg/controller/deployment_rollback.go | 40 +- pkg/controller/deployment_rolling.go | 100 +- pkg/controller/deployment_sync.go | 338 +++--- pkg/controller/deployment_util.go | 446 +++---- pkg/controller/hashtest.go | 34 +- pkg/controller/instance.go | 650 ---------- pkg/controller/instanceclass.go | 120 -- pkg/controller/machine.go | 652 ++++++++++ .../{instance_util.go => machine_util.go} | 30 +- pkg/controller/machineclass.go | 120 ++ .../{instanceset.go => machineset.go} | 402 +++---- ...instanceset_util.go => machineset_util.go} | 18 +- pkg/driver/driver.go | 8 +- pkg/driver/driver_aws.go | 50 +- pkg/driver/driver_fake.go | 2 +- pkg/openapi/openapi_generated.go | 326 ++--- 185 files changed, 8586 insertions(+), 8586 deletions(-) delete mode 100644 docs/usage/instance_set.md rename docs/usage/{instance.md => machine.md} (60%) rename docs/usage/{instance_deployment.md => machine_deployment.md} (51%) create mode 100644 docs/usage/machine_set.md rename kubernetes/{aws-instance-class.yaml => aws-machine-class.yaml} (51%) delete mode 100644 kubernetes/instance-deployment.yaml delete mode 100644 kubernetes/instance.yaml create mode 100644 kubernetes/machine-deployment.yaml rename kubernetes/{instance-set.yaml => machine-set.yaml} (51%) create mode 100644 kubernetes/machine.yaml rename pkg/apis/{node => machine}/doc.go (54%) rename pkg/apis/{node => machine}/install/install.go (86%) rename pkg/apis/{node => machine}/register.go (88%) rename pkg/apis/{node => machine}/types.go (73%) rename pkg/apis/{node => machine}/v1alpha1/defaults.go (100%) rename pkg/apis/{node => machine}/v1alpha1/doc.go (83%) rename pkg/apis/{node => machine}/v1alpha1/register.go (89%) rename pkg/apis/{node => machine}/v1alpha1/types.go (75%) create mode 100644 pkg/apis/machine/v1alpha1/zz_generated.conversion.go rename pkg/apis/{node => machine}/v1alpha1/zz_generated.deepcopy.go (74%) rename pkg/apis/{node => machine}/v1alpha1/zz_generated.defaults.go (100%) rename pkg/apis/{node/validation/awsinstanceclass.go => machine/validation/awsmachineclass.go} (81%) rename pkg/apis/{node/validation/instance.go => machine/validation/machine.go} (67%) rename pkg/apis/{node/validation/instancedeployment.go => machine/validation/machinedeployment.go} (72%) rename pkg/apis/{node/validation/instanceset.go => machine/validation/machineset.go} (72%) rename pkg/apis/{node => machine}/zz_generated.deepcopy.go (74%) rename pkg/apis/{node => machine}/zz_generated.defaults.go (96%) delete mode 100644 pkg/apis/node/v1alpha1/zz_generated.conversion.go create mode 100644 pkg/client/clientset/typed/machine/v1alpha1/awsmachineclass.go rename pkg/client/clientset/typed/{node => machine}/v1alpha1/doc.go (100%) rename pkg/client/clientset/typed/{node => machine}/v1alpha1/fake/doc.go (100%) create mode 100644 pkg/client/clientset/typed/machine/v1alpha1/fake/fake_awsmachineclass.go create mode 100644 pkg/client/clientset/typed/machine/v1alpha1/fake/fake_machine.go create mode 100644 pkg/client/clientset/typed/machine/v1alpha1/fake/fake_machine_client.go create mode 100644 pkg/client/clientset/typed/machine/v1alpha1/fake/fake_machinedeployment.go create mode 100644 pkg/client/clientset/typed/machine/v1alpha1/fake/fake_machineset.go create mode 100644 pkg/client/clientset/typed/machine/v1alpha1/fake/fake_machinetemplate.go rename pkg/client/clientset/typed/{node => machine}/v1alpha1/fake/fake_scale.go (77%) create mode 100644 pkg/client/clientset/typed/machine/v1alpha1/generated_expansion.go create mode 100644 pkg/client/clientset/typed/machine/v1alpha1/machine.go create mode 100644 pkg/client/clientset/typed/machine/v1alpha1/machine_client.go create mode 100644 pkg/client/clientset/typed/machine/v1alpha1/machinedeployment.go create mode 100644 pkg/client/clientset/typed/machine/v1alpha1/machineset.go create mode 100644 pkg/client/clientset/typed/machine/v1alpha1/machinetemplate.go rename pkg/client/clientset/typed/{node => machine}/v1alpha1/scale.go (88%) delete mode 100644 pkg/client/clientset/typed/node/v1alpha1/awsinstanceclass.go delete mode 100644 pkg/client/clientset/typed/node/v1alpha1/fake/fake_awsinstanceclass.go delete mode 100644 pkg/client/clientset/typed/node/v1alpha1/fake/fake_instance.go delete mode 100644 pkg/client/clientset/typed/node/v1alpha1/fake/fake_instancedeployment.go delete mode 100644 pkg/client/clientset/typed/node/v1alpha1/fake/fake_instanceset.go delete mode 100644 pkg/client/clientset/typed/node/v1alpha1/fake/fake_instancetemplate.go delete mode 100644 pkg/client/clientset/typed/node/v1alpha1/fake/fake_node_client.go delete mode 100644 pkg/client/clientset/typed/node/v1alpha1/generated_expansion.go delete mode 100644 pkg/client/clientset/typed/node/v1alpha1/instance.go delete mode 100644 pkg/client/clientset/typed/node/v1alpha1/instancedeployment.go delete mode 100644 pkg/client/clientset/typed/node/v1alpha1/instanceset.go delete mode 100644 pkg/client/clientset/typed/node/v1alpha1/instancetemplate.go delete mode 100644 pkg/client/clientset/typed/node/v1alpha1/node_client.go rename pkg/client/informers/externalversions/{node => machine}/interface.go (92%) create mode 100644 pkg/client/informers/externalversions/machine/v1alpha1/awsmachineclass.go create mode 100644 pkg/client/informers/externalversions/machine/v1alpha1/interface.go create mode 100644 pkg/client/informers/externalversions/machine/v1alpha1/machine.go create mode 100644 pkg/client/informers/externalversions/machine/v1alpha1/machinedeployment.go create mode 100644 pkg/client/informers/externalversions/machine/v1alpha1/machineset.go create mode 100644 pkg/client/informers/externalversions/machine/v1alpha1/machinetemplate.go delete mode 100644 pkg/client/informers/externalversions/node/v1alpha1/awsinstanceclass.go delete mode 100644 pkg/client/informers/externalversions/node/v1alpha1/instance.go delete mode 100644 pkg/client/informers/externalversions/node/v1alpha1/instancedeployment.go delete mode 100644 pkg/client/informers/externalversions/node/v1alpha1/instanceset.go delete mode 100644 pkg/client/informers/externalversions/node/v1alpha1/instancetemplate.go delete mode 100644 pkg/client/informers/externalversions/node/v1alpha1/interface.go rename pkg/client/informers/internalversion/{node => machine}/interface.go (91%) create mode 100644 pkg/client/informers/internalversion/machine/internalversion/awsmachineclass.go create mode 100644 pkg/client/informers/internalversion/machine/internalversion/interface.go create mode 100644 pkg/client/informers/internalversion/machine/internalversion/machine.go create mode 100644 pkg/client/informers/internalversion/machine/internalversion/machinedeployment.go create mode 100644 pkg/client/informers/internalversion/machine/internalversion/machineset.go create mode 100644 pkg/client/informers/internalversion/machine/internalversion/machinetemplate.go delete mode 100644 pkg/client/informers/internalversion/node/internalversion/awsinstanceclass.go delete mode 100644 pkg/client/informers/internalversion/node/internalversion/instance.go delete mode 100644 pkg/client/informers/internalversion/node/internalversion/instancedeployment.go delete mode 100644 pkg/client/informers/internalversion/node/internalversion/instanceset.go delete mode 100644 pkg/client/informers/internalversion/node/internalversion/instancetemplate.go delete mode 100644 pkg/client/informers/internalversion/node/internalversion/interface.go create mode 100644 pkg/client/internalclientset/typed/machine/internalversion/awsmachineclass.go rename pkg/client/internalclientset/typed/{node => machine}/internalversion/doc.go (100%) rename pkg/client/internalclientset/typed/{node => machine}/internalversion/fake/doc.go (100%) create mode 100644 pkg/client/internalclientset/typed/machine/internalversion/fake/fake_awsmachineclass.go create mode 100644 pkg/client/internalclientset/typed/machine/internalversion/fake/fake_machine.go create mode 100644 pkg/client/internalclientset/typed/machine/internalversion/fake/fake_machine_client.go create mode 100644 pkg/client/internalclientset/typed/machine/internalversion/fake/fake_machinedeployment.go create mode 100644 pkg/client/internalclientset/typed/machine/internalversion/fake/fake_machineset.go create mode 100644 pkg/client/internalclientset/typed/machine/internalversion/fake/fake_machinetemplate.go rename pkg/client/internalclientset/typed/{node => machine}/internalversion/fake/fake_scale.go (83%) create mode 100644 pkg/client/internalclientset/typed/machine/internalversion/generated_expansion.go create mode 100644 pkg/client/internalclientset/typed/machine/internalversion/machine.go create mode 100644 pkg/client/internalclientset/typed/machine/internalversion/machine_client.go create mode 100644 pkg/client/internalclientset/typed/machine/internalversion/machinedeployment.go create mode 100644 pkg/client/internalclientset/typed/machine/internalversion/machineset.go create mode 100644 pkg/client/internalclientset/typed/machine/internalversion/machinetemplate.go rename pkg/client/internalclientset/typed/{node => machine}/internalversion/scale.go (90%) delete mode 100644 pkg/client/internalclientset/typed/node/internalversion/awsinstanceclass.go delete mode 100644 pkg/client/internalclientset/typed/node/internalversion/fake/fake_awsinstanceclass.go delete mode 100644 pkg/client/internalclientset/typed/node/internalversion/fake/fake_instance.go delete mode 100644 pkg/client/internalclientset/typed/node/internalversion/fake/fake_instancedeployment.go delete mode 100644 pkg/client/internalclientset/typed/node/internalversion/fake/fake_instanceset.go delete mode 100644 pkg/client/internalclientset/typed/node/internalversion/fake/fake_instancetemplate.go delete mode 100644 pkg/client/internalclientset/typed/node/internalversion/fake/fake_node_client.go delete mode 100644 pkg/client/internalclientset/typed/node/internalversion/generated_expansion.go delete mode 100644 pkg/client/internalclientset/typed/node/internalversion/instance.go delete mode 100644 pkg/client/internalclientset/typed/node/internalversion/instancedeployment.go delete mode 100644 pkg/client/internalclientset/typed/node/internalversion/instanceset.go delete mode 100644 pkg/client/internalclientset/typed/node/internalversion/instancetemplate.go delete mode 100644 pkg/client/internalclientset/typed/node/internalversion/node_client.go create mode 100644 pkg/client/listers/machine/internalversion/awsmachineclass.go create mode 100644 pkg/client/listers/machine/internalversion/expansion_generated.go create mode 100644 pkg/client/listers/machine/internalversion/machine.go create mode 100644 pkg/client/listers/machine/internalversion/machinedeployment.go create mode 100644 pkg/client/listers/machine/internalversion/machineset.go create mode 100644 pkg/client/listers/machine/internalversion/machinetemplate.go rename pkg/client/listers/{node => machine}/internalversion/scale.go (75%) create mode 100644 pkg/client/listers/machine/v1alpha1/awsmachineclass.go create mode 100644 pkg/client/listers/machine/v1alpha1/expansion_generated.go create mode 100644 pkg/client/listers/machine/v1alpha1/machine.go create mode 100644 pkg/client/listers/machine/v1alpha1/machinedeployment.go create mode 100644 pkg/client/listers/machine/v1alpha1/machineset.go create mode 100644 pkg/client/listers/machine/v1alpha1/machinetemplate.go rename pkg/client/listers/{node => machine}/v1alpha1/scale.go (99%) delete mode 100644 pkg/client/listers/node/internalversion/awsinstanceclass.go delete mode 100644 pkg/client/listers/node/internalversion/expansion_generated.go delete mode 100644 pkg/client/listers/node/internalversion/instance.go delete mode 100644 pkg/client/listers/node/internalversion/instancedeployment.go delete mode 100644 pkg/client/listers/node/internalversion/instanceset.go delete mode 100644 pkg/client/listers/node/internalversion/instancetemplate.go delete mode 100644 pkg/client/listers/node/v1alpha1/awsinstanceclass.go delete mode 100644 pkg/client/listers/node/v1alpha1/expansion_generated.go delete mode 100644 pkg/client/listers/node/v1alpha1/instance.go delete mode 100644 pkg/client/listers/node/v1alpha1/instancedeployment.go delete mode 100644 pkg/client/listers/node/v1alpha1/instanceset.go delete mode 100644 pkg/client/listers/node/v1alpha1/instancetemplate.go rename pkg/controller/{deployment_instanceset_util.go => deployment_machineset_util.go} (56%) delete mode 100644 pkg/controller/instance.go delete mode 100644 pkg/controller/instanceclass.go create mode 100644 pkg/controller/machine.go rename pkg/controller/{instance_util.go => machine_util.go} (59%) create mode 100644 pkg/controller/machineclass.go rename pkg/controller/{instanceset.go => machineset.go} (50%) rename pkg/controller/{instanceset_util.go => machineset_util.go} (76%) diff --git a/Makefile b/Makefile index 9608274b9..c54f879d4 100644 --- a/Makefile +++ b/Makefile @@ -8,7 +8,7 @@ LINT_FOLDERS := $(shell echo $(PACKAGES) | sed "s|$(REPOSITORY)|.|g") BINARY_PATH := $(REPOSITORY)/cmd/$(PROJECT) IMAGE_REPOSITORY := kvmprashanth/node-controller-manager -IMAGE_TAG := v1 +IMAGE_TAG := v2 TYPES_FILES := $(shell find pkg/apis -name types.go) @@ -52,17 +52,17 @@ generate-files: .generate_files $(BINDIR)/defaulter-gen \ --v 1 --logtostderr \ --go-header-file "verify/boilerplate/boilerplate.go.txt" \ - --input-dirs "$(REPOSITORY)/pkg/apis/node" \ - --input-dirs "$(REPOSITORY)/pkg/apis/node/v1alpha1" \ - --extra-peer-dirs "$(REPOSITORY)/pkg/apis/node" \ - --extra-peer-dirs "$(REPOSITORY)/pkg/apis/node/v1alpha1" \ + --input-dirs "$(REPOSITORY)/pkg/apis/machine" \ + --input-dirs "$(REPOSITORY)/pkg/apis/machine/v1alpha1" \ + --extra-peer-dirs "$(REPOSITORY)/pkg/apis/machine" \ + --extra-peer-dirs "$(REPOSITORY)/pkg/apis/machine/v1alpha1" \ --output-file-base "zz_generated.defaults" # Generate deep copies $(BINDIR)/deepcopy-gen \ --v 1 --logtostderr \ --go-header-file "verify/boilerplate/boilerplate.go.txt" \ - --input-dirs "$(REPOSITORY)/pkg/apis/node" \ - --input-dirs "$(REPOSITORY)/pkg/apis/node/v1alpha1" \ + --input-dirs "$(REPOSITORY)/pkg/apis/machine" \ + --input-dirs "$(REPOSITORY)/pkg/apis/machine/v1alpha1" \ --bounding-dirs "$(REPOSITORY)" \ --output-file-base zz_generated.deepcopy # Generate conversions @@ -70,41 +70,41 @@ generate-files: .generate_files --v 1 --logtostderr \ --extra-peer-dirs k8s.io/api/core/v1,k8s.io/apimachinery/pkg/apis/meta/v1,k8s.io/apimachinery/pkg/conversion,k8s.io/apimachinery/pkg/runtime \ --go-header-file "verify/boilerplate/boilerplate.go.txt" \ - --input-dirs "$(REPOSITORY)/pkg/apis/node" \ - --input-dirs "$(REPOSITORY)/pkg/apis/node/v1alpha1" \ + --input-dirs "$(REPOSITORY)/pkg/apis/machine" \ + --input-dirs "$(REPOSITORY)/pkg/apis/machine/v1alpha1" \ --output-file-base zz_generated.conversion # generate openapi $(BINDIR)/openapi-gen \ --v 1 --logtostderr \ --go-header-file "verify/boilerplate/boilerplate.go.txt" \ - --input-dirs "$(REPOSITORY)/pkg/apis/node/v1alpha1,k8s.io/api/core/v1,k8s.io/apimachinery/pkg/apis/meta/v1" \ + --input-dirs "$(REPOSITORY)/pkg/apis/machine/v1alpha1,k8s.io/api/core/v1,k8s.io/apimachinery/pkg/apis/meta/v1" \ --output-package "$(REPOSITORY)/pkg/openapi" # Generate the internal clientset (pkg/client/internalclientset) ${BINDIR}/client-gen "$@" \ --go-header-file "verify/boilerplate/boilerplate.go.txt" \ --input-base "$(REPOSITORY)/pkg/apis/" \ - --input node \ + --input machine \ --clientset-path "$(REPOSITORY)/pkg/client" \ --clientset-name internalclientset \ # Generate the versioned clientset (pkg/client/clientset/clientset) ${BINDIR}/client-gen "$@" \ --go-header-file "verify/boilerplate/boilerplate.go.txt" \ --input-base "$(REPOSITORY)/pkg/apis/" \ - --input "node/v1alpha1" \ + --input "machine/v1alpha1" \ --clientset-path "$(REPOSITORY)/pkg/client" \ --clientset-name "clientset" \ # generate lister ${BINDIR}/lister-gen "$@" \ --go-header-file "verify/boilerplate/boilerplate.go.txt" \ - --input-dirs="$(REPOSITORY)/pkg/apis/node" \ - --input-dirs="$(REPOSITORY)/pkg/apis/node/v1alpha1" \ + --input-dirs="$(REPOSITORY)/pkg/apis/machine" \ + --input-dirs="$(REPOSITORY)/pkg/apis/machine/v1alpha1" \ --output-package "$(REPOSITORY)/pkg/client/listers" \ # generate informer ${BINDIR}/informer-gen "$@" \ --go-header-file "verify/boilerplate/boilerplate.go.txt" \ - --input-dirs "$(REPOSITORY)/pkg/apis/node" \ - --input-dirs "$(REPOSITORY)/pkg/apis/node/v1alpha1" \ + --input-dirs "$(REPOSITORY)/pkg/apis/machine" \ + --input-dirs "$(REPOSITORY)/pkg/apis/machine/v1alpha1" \ --versioned-clientset-package "$(REPOSITORY)/pkg/client/clientset" \ --internal-clientset-package "$(REPOSITORY)/pkg/client/internalclientset" \ --listers-package "$(REPOSITORY)/pkg/client/listers" \ diff --git a/NOTICE.md b/NOTICE.md index 501d063be..09749e8da 100644 --- a/NOTICE.md +++ b/NOTICE.md @@ -20,7 +20,7 @@ To the left are the list of copied files -> and to the right the current locatio cmd/kube-controller-manager/app/options/options.go -> cmd/node-controller-manager/app/options/options.go cmd/kube-controller-manager/controller_manager.go -> cmd/node-controller-manager/controller_manager.go pkg/controller/deployment/deployment_controller.go -> pkg/controller/deployment_controller.go - pkg/controller/deployment/util/instanceset_util.go -> pkg/controller/deployment_instanceset_util.go + pkg/controller/deployment/util/replicaset_util.go -> pkg/controller/deployment_machineset_util.go pkg/controller/deployment/progress.go -> pkg/controller/deployment_progress.go pkg/controller/deployment/recreate.go -> pkg/controller/deployment_recreate.go pkg/controller/deployment/rollback.go -> pkg/controller/deployment_rollback.go @@ -28,9 +28,9 @@ To the left are the list of copied files -> and to the right the current locatio pkg/controller/deployment/sync.go -> pkg/controller/deployment_sync.go pkg/controller/deployment/util/deployment_util.go -> pkg/controller/deployment_util.go pkg/controller/deployment/util/hash_test.go -> pkg/controller/hasttest.go - pkg/controller/deployment/util/pod_util.go -> pkg/controller/instance_util.go - pkg/controller/replicaset/replica_set.go -> pkg/controller/instanceset.go - pkg/controller/deployment/util/replicaset_util.go -> pkg/controller/instanceset_util.go + pkg/controller/deployment/util/pod_util.go -> pkg/controller/machine_util.go + pkg/controller/replicaset/replica_set.go -> pkg/controller/machineset.go + pkg/controller/deployment/util/replicaset_util.go -> pkg/controller/machineset_util.go ## Dependencies diff --git a/README.md b/README.md index c35b37c08..62f01599f 100644 --- a/README.md +++ b/README.md @@ -2,19 +2,18 @@ Node Controller Manager (NCM) manages VMs as another kubernetes custom resource. It provides a declarative way to manage VMs. The current implementation only supports AWS but can be (and will be) easily extended to support other cloud providers. -Example of managing VM: +Example of managing machine: ``` -kubectl create/get/delete instance vm1 +kubectl create/get/delete machine vm1 ``` ### Key terminologies -Nodes/Instances/Machines/VMs are different terminologies used to represent similar things. We use these terms in the following way +Nodes/Machines/VMs are different terminologies used to represent similar things. We use these terms in the following way 1. VM: A virtual machine running on any cloud provider. 1. Node: Native kubernetes node objects. The objects you get to see when you do a *"kubectl get nodes"*. Although nodes can be either physical/virtual machines, for the purposes of our discussions it refers to a VM. -1. Instance: A VM that is provisioned/managed by the Node Controller Manager. -1. Machine: Community's terminology for an Instance. The term instance shall be replaced by machines in the near future. +1. Machine: A VM that is provisioned/managed by the Node Controller Manager. ## Design of Node Controller Manager diff --git a/cmd/node-controller-manager/app/controllermanager.go b/cmd/node-controller-manager/app/controllermanager.go index d11105cef..2388d2c3e 100644 --- a/cmd/node-controller-manager/app/controllermanager.go +++ b/cmd/node-controller-manager/app/controllermanager.go @@ -65,7 +65,7 @@ const ( controllerDiscoveryAgentName = "node-controller-discovery" ) -var nodeGVR = schema.GroupVersionResource{Group: "node.sapcloud.io", Version: "v1alpha1", Resource: "awsinstanceclasses"} +var nodeGVR = schema.GroupVersionResource{Group: "machine.sapcloud.io", Version: "v1alpha1", Resource: "awsmachineclasses"} // Run runs the NCMServer. This should never exit. func Run(s *options.NCMServer) error { @@ -184,18 +184,18 @@ func StartControllers(s *options.NCMServer, s.MinResyncPeriod.Duration, ) // All shared informers are v1alpha1 API level - nodeSharedInformers := nodeInformerFactory.Node().V1alpha1() + nodeSharedInformers := nodeInformerFactory.Machine().V1alpha1() glog.V(5).Infof("Creating controllers...") nodeController, err := nodecontroller.NewController( coreClient, - nodeClientBuilder.ClientOrDie(controllerManagerAgentName).NodeV1alpha1(), + nodeClientBuilder.ClientOrDie(controllerManagerAgentName).MachineV1alpha1(), coreInformerFactory.Core().V1().Secrets(), coreInformerFactory.Core().V1().Nodes(), - nodeSharedInformers.AWSInstanceClasses(), - nodeSharedInformers.Instances(), - nodeSharedInformers.InstanceSets(), - nodeSharedInformers.InstanceDeployments(), + nodeSharedInformers.AWSMachineClasses(), + nodeSharedInformers.Machines(), + nodeSharedInformers.MachineSets(), + nodeSharedInformers.MachineDeployments(), recorder, ) if err != nil { @@ -210,7 +210,7 @@ func StartControllers(s *options.NCMServer, go nodeController.Run(int(s.ConcurrentNodeSyncs), stop) } else { - return fmt.Errorf("unable to start instance controller: API GroupVersion %q is not available; found %#v", nodeGVR, availableResources) + return fmt.Errorf("unable to start machine controller: API GroupVersion %q is not available; found %#v", nodeGVR, availableResources) } select {} diff --git a/docs/README.md b/docs/README.md index f14e655e2..ad7dad5ca 100644 --- a/docs/README.md +++ b/docs/README.md @@ -8,9 +8,9 @@ ## Usage * [Setting up your usage environment](usage/prerequisite.md) -* [Creating/Deleting instances (VM)](usage/instance.md) -* [Maintaining instance replicas using instances-sets](usage/instance_set.md) -* [Updating instances using instances-deployments](usage/instance_deployment.md) +* [Creating/Deleting machines (VM)](usage/machine.md) +* [Maintaining machine replicas using machines-sets](usage/machine_set.md) +* [Updating machines using machines-deployments](usage/machine_deployment.md) ## Deployment diff --git a/docs/design/README.md b/docs/design/README.md index b0914dab8..fbb321a5b 100644 --- a/docs/design/README.md +++ b/docs/design/README.md @@ -17,24 +17,24 @@ It's designed to run in the master plane of a Kubernetes cluster. It follows the ## Objects of Node Controller Manager Node Controller Manager makes use of 4 CRD objects and 1 Kubernetes secret object to manage machines. They are as follows, -1. Instance-class: A template that contains cloud provider specific details used to create instances. -1. Instance: Node Controller Manager's object that actually represents a VM. -1. Instance-set: A group of instances managed by the Node Controller Manager. -1. Instance-deploy: A group of instance-sets managed by the Node Controller Manager to allow updating instances. -1. Secret: A kubernetes secret that stores cloudconfig (initialization scripts used to create VMs) and cloud specific credentials +1. Machine-class: Represents a template that contains cloud provider specific details used to create machines. +1. Machine: Represents an VM object that is backed by the cloud provider. +1. Machine-set: Represents a group of machines managed by the Node Controller Manager. +1. Machine-deployment: Represents a group of machine-sets managed by the Node Controller Manager to allow updating machines. +1. Secret: Represents a kubernetes secret that stores cloudconfig (initialization scripts used to create VMs) and cloud specific credentials ## Components of Node Controller Manager Node Controller Manager is made up of 3 sub-controllers as of now. They are - -1. Instance Controller: Used to create/update/delete instances. It is the only controller which actually talks to the cloud providers. -1. Instance Set Controller: Used to manage instance-sets. This controller makes sure that desired number of instances are always up and running healthy. -1. Instance Deployment Controller: Used to update instances from one version to another by manipulating the instance-set objects. +1. Machine Controller: Used to create/update/delete machines. It is the only controller which actually talks to the cloud providers. +1. Machine Set Controller: Used to manage machine-sets. This controller makes sure that desired number of machines are always up and running healthy. +1. Machine Deployment Controller: Used to update machines from one version to another by manipulating the machine-set objects. -All these controllers work in an co-operative manner. They form a parent-child relationship with Instance Deployment Controller being the grandparent, Instance Set Controller being the parent, and Instance Controller being the child. +All these controllers work in an co-operative manner. They form a parent-child relationship with Machine Deployment Controller being the grandparent, Machine Set Controller being the parent, and Machine Controller being the child. ## Future Plans The following is a short list of future plans, -1. **Integrate the cluster-autoscaler** to act upon instance-deployment objects, used to manage the required number of instances based on the load of the cluster. +1. **Integrate the cluster-autoscaler** to act upon machine-deployment objects, used to manage the required number of machines based on the load of the cluster. 2. **Support other cloud providers** like Azure, GCP, OpenStack to name a few. 3. Integrate a garbage collector to terminate any orphan VMs. 4. Build a comprehensive testing framework. diff --git a/docs/usage/instance_set.md b/docs/usage/instance_set.md deleted file mode 100644 index fbf7504bc..000000000 --- a/docs/usage/instance_set.md +++ /dev/null @@ -1,107 +0,0 @@ -# Maintaining instance replicas using instances-sets - -## Setting up your usage environment - -* Follow the [steps described here](prerequisite.md) - -## Important :warning: -- Make sure that the `kubernetes/instance-set.yaml` points to the same class name as the `kubernetes/aws-instance-class.yaml`. -- Similarily `kubernetes/aws-instance-class.yaml` secret name and namespace should be same as that mentioned in `kubernetes/secret.yaml` - -## Creating instance-set - -- Modify `kubernetes/instance-set.yaml` as per your requirement. You can modify the number of replicas to the desired number of instances. Then, create an instance-set -```bash -$ kubectl apply -f kubernetes/instance-set.yaml -``` -You should notice that the Node Controller Manager has immediately picked up your manifest and started to create a new instances based on the number of replicas you have provided in the manifest. - -- Check Node Controller Manager instance-sets in the cluster -```bash -$ kubectl get instanceset -NAME KIND -test-instance-set InstanceSet.v1alpha1.node.sapcloud.io -``` -You will see a new instance-set with your given name - -- Check Node Controller Manager instances in the cluster -```bash -$ kubectl get instance -NAME KIND -test-instance-set-b57zs Instance.v1alpha1.node.sapcloud.io -test-instance-set-c4bg8 Instance.v1alpha1.node.sapcloud.io -test-instance-set-kvskg Instance.v1alpha1.node.sapcloud.io -``` -Now you will see N (number of replicas specified in the manifest) new instances whose names are prefixed with the instance-set object name that you created. - -- After a few minutes (~3 minutes for AWS), you should notice new nodes joining the cluster. You can verify this by running, -```bash -$ kubectl get nodes -NAME STATUS AGE VERSION -ip-10-250-0-234.eu-west-1.compute.internal Ready 3m v1.8.0 -ip-10-250-15-98.eu-west-1.compute.internal Ready 3m v1.8.0 -ip-10-250-6-21.eu-west-1.compute.internal Ready 2m v1.8.0 -``` -This shows how new nodes have joined your cluster - -## Inspect status of instance-set - -- To inspect the status of any created instance-set run the following command, -```bash -$ kubectl get instanceset test-instance-set -o yaml -apiVersion: node.sapcloud.io/v1alpha1 -kind: InstanceSet -metadata: - annotations: - kubectl.kubernetes.io/last-applied-configuration: | - {"apiVersion":"node.sapcloud.io/v1alpha1","kind":"InstanceSet","metadata":{"annotations":{},"name":"test-instance-set","namespace":"","test-label":"test-label"},"spec":{"minReadySeconds":200,"replicas":3,"selector":{"matchLabels":{"test-label":"test-label"}},"template":{"metadata":{"labels":{"test-label":"test-label"}},"spec":{"class":{"kind":"AWSInstanceClass","name":"test-aws"}}}}} - clusterName: "" - creationTimestamp: 2017-12-27T08:37:42Z - finalizers: - - node.sapcloud.io/operator - generation: 0 - initializers: null - name: test-instance-set - namespace: "" - resourceVersion: "12630893" - selfLink: /apis/node.sapcloud.io/v1alpha1/test-instance-set - uid: 3469faaa-eae1-11e7-a6c0-828f843e4186 -spec: - instanceClass: {} - minReadySeconds: 200 - replicas: 3 - selector: - matchLabels: - test-label: test-label - template: - metadata: - creationTimestamp: null - labels: - test-label: test-label - spec: - class: - kind: AWSInstanceClass - name: test-aws -status: - availableReplicas: 3 - fullyLabeledReplicas: 3 - instanceSetCondition: null - lastOperation: - lastUpdateTime: null - observedGeneration: 0 - readyReplicas: 3 - replicas: 3 -``` - -## Health monitoring - -- If you try to delete/terminate any of the instances backing the instance-set by either talking to the Node Controller Manager or from the cloud provider, the Node Controller Manager recreates a matching healthy instance to replace the deleted instance. -- Similarly, if any of your instances are unreachable or in an unhealthy state (kubelet not ready / disk pressure) for longer than the configured timeout (~ 5mins), the Node Controller Manager recreates the nodes to replace the unhealthy nodes. - -## Delete instance-set - -- To delete the VM using the `kubernetes/instance-set.yaml` -```bash -$ kubectl delete -f kubernetes/instance-set.yaml -``` -Now the Node Controller Manager has immediately picked up your manifest and started to delete the existing VMs by talking to the cloud provider. Your nodes should be detached from the cluster in a few minutes (~1min for AWS). \ No newline at end of file diff --git a/docs/usage/instance.md b/docs/usage/machine.md similarity index 60% rename from docs/usage/instance.md rename to docs/usage/machine.md index 98cf124dc..20c90a5ac 100644 --- a/docs/usage/instance.md +++ b/docs/usage/machine.md @@ -1,27 +1,27 @@ -# Creating/Deleting instances (VM) +# Creating/Deleting machines (VM) ## Setting up your usage environment * Follow the [steps described here](prerequisite.md) ## Important :warning: -- Make sure that the `kubernetes/instance.yaml` points to the same class name as the `kubernetes/aws-instance-class.yaml`. -- Similarily `kubernetes/aws-instance-class.yaml` secret name and namespace should be same as that mentioned in `kubernetes/secret.yaml` +- Make sure that the `kubernetes/machine.yaml` points to the same class name as the `kubernetes/aws-machine-class.yaml`. +- Similarily `kubernetes/aws-machine-class.yaml` secret name and namespace should be same as that mentioned in `kubernetes/secret.yaml` -## Creating instance +## Creating machine -- Modify `kubernetes/instance.yaml` as per your requirement and create the VM as shown below +- Modify `kubernetes/machine.yaml` as per your requirement and create the VM as shown below ```bash -$ kubectl apply -f kubernetes/instance.yaml +$ kubectl apply -f kubernetes/machine.yaml ``` -You should notice that the Node Controller Manager has immediately picked up your manifest and started to create a new instance by talking to the cloud provider. +You should notice that the Node Controller Manager has immediately picked up your manifest and started to create a new machine by talking to the cloud provider. -- Check Node Controller Manager instances in the cluster +- Check Node Controller Manager machines in the cluster ```bash -$ kubectl get instance -test-instance Instance.v1alpha1.node.sapcloud.io +$ kubectl get machine +test-machine Machine.v1alpha1.machine.sapcloud.io ``` -A new instance is created with the name provided in the `kubernetes/instance.yaml` file. +A new machine is created with the name provided in the `kubernetes/machine.yaml` file. - After a few minutes (~3 minutes for AWS), you should notice a new node joining the cluster. You can verify this by running, ```bash @@ -31,34 +31,34 @@ ip-10-250-14-52.eu-east-1.compute.internal. Ready 1m v1.8.0 ``` This shows that a new node has successfully joined the cluster. -## Inspect status of instance +## Inspect status of machine -- To inspect the status of any created instance, run the command given below. +- To inspect the status of any created machine, run the command given below. ```bash -$ kubectl get instance test-instance -o yaml -apiVersion: node.sapcloud.io/v1alpha1 -kind: Instance +$ kubectl get machine test-machine -o yaml +apiVersion: machine.sapcloud.io/v1alpha1 +kind: Machine metadata: annotations: kubectl.kubernetes.io/last-applied-configuration: | - {"apiVersion":"node.sapcloud.io/v1alpha1","kind":"Instance","metadata":{"annotations":{},"labels":{"test-label":"test-label"},"name":"test-instance","namespace":""},"spec":{"class":{"kind":"AWSInstanceClass","name":"test-aws"}}} + {"apiVersion":"machine.sapcloud.io/v1alpha1","kind":"Machine","metadata":{"annotations":{},"labels":{"test-label":"test-label"},"name":"test-machine","namespace":""},"spec":{"class":{"kind":"AWSMachineClass","name":"test-aws"}}} clusterName: "" creationTimestamp: 2017-12-27T06:58:21Z finalizers: - - node.sapcloud.io/operator + - machine.sapcloud.io/operator generation: 0 initializers: null labels: node: ip-10-250-14-52.eu-east-1.compute.internal test-label: test-label - name: test-instance + name: test-machine namespace: "" resourceVersion: "12616948" - selfLink: /apis/node.sapcloud.io/v1alpha1/test-instance + selfLink: /apis/machine.sapcloud.io/v1alpha1/test-machine uid: 535e596c-ead3-11e7-a6c0-828f843e4186 spec: class: - kind: AWSInstanceClass + kind: AWSMachineClass name: test-aws providerID: aws:///eu-east-1/i-00bef3f2618ffef23 status: @@ -91,17 +91,17 @@ status: lastUpdateTime: 2017-12-27T07:00:06Z phase: Running lastOperation: - description: Instance is now ready + description: Machine is now ready lastUpdateTime: 2017-12-27T07:00:06Z state: Successful type: Create node: ip-10-250-14-52.eu-west-1.compute.internal ``` -## Delete instance +## Delete machine -- To delete the VM using the `kubernetes/instance.yaml` as shown below +- To delete the VM using the `kubernetes/machine.yaml` as shown below ```bash -$ kubectl delete -f kubernetes/instance.yaml +$ kubectl delete -f kubernetes/machine.yaml ``` Now the Node Controller Manager picks up the manifest immediately and starts to delete the existing VM by talking to the cloud provider. The node should be detached from the cluster in a few minutes (~1min for AWS). \ No newline at end of file diff --git a/docs/usage/instance_deployment.md b/docs/usage/machine_deployment.md similarity index 51% rename from docs/usage/instance_deployment.md rename to docs/usage/machine_deployment.md index 3b5ef2e92..3b80fc2cf 100644 --- a/docs/usage/instance_deployment.md +++ b/docs/usage/machine_deployment.md @@ -1,46 +1,46 @@ -# Maintaining instance replicas using instances-deployments +# Maintaining machine replicas using machines-deployments ## Setting up your usage environment * Follow the [steps described here](prerequisite.md) ## Important :warning: -- Make sure that the `kubernetes/instance-deployment.yaml` points to the same class name as the `kubernetes/aws-instance-class.yaml`. -- Similarily `kubernetes/aws-instance-class.yaml` secret name and namespace should be same as that mentioned in `kubernetes/secret.yaml` +- Make sure that the `kubernetes/machine-deployment.yaml` points to the same class name as the `kubernetes/aws-machine-class.yaml`. +- Similarily `kubernetes/aws-machine-class.yaml` secret name and namespace should be same as that mentioned in `kubernetes/secret.yaml` -## Creating instance-deployment +## Creating machine-deployment -- Modify `kubernetes/instance-deployment.yaml` as per your requirement. Modify the number of replicas to the desired number of instances. Then, create an instance-deployment +- Modify `kubernetes/machine-deployment.yaml` as per your requirement. Modify the number of replicas to the desired number of machines. Then, create an machine-deployment ```bash -$ kubectl apply -f kubernetes/instance-deployment.yaml +$ kubectl apply -f kubernetes/machine-deployment.yaml ``` -Now the Node Controller Manager picks up the manifest immediately and starts to create a new instances based on the number of replicas you have provided in the manifest. +Now the Node Controller Manager picks up the manifest immediately and starts to create a new machines based on the number of replicas you have provided in the manifest. -- Check Node Controller Manager instance-deployments in the cluster +- Check Node Controller Manager machine-deployments in the cluster ```bash -$ kubectl get instancedeployment +$ kubectl get machinedeployment NAME KIND -test-instance-deployment InstanceDeployment.v1alpha1.node.sapcloud.io +test-machine-deployment MachineDeployment.v1alpha1.machine.sapcloud.io ``` -You will notice a new instance-deployment with your given name +You will notice a new machine-deployment with your given name -- Check Node Controller Manager instance-sets in the cluster +- Check Node Controller Manager machine-sets in the cluster ```bash -$ kubectl get instanceset +$ kubectl get machineset NAME KIND -test-instance-deployment-5bc6dd7c8f InstanceSet.v1alpha1.node.sapcloud.io +test-machine-deployment-5bc6dd7c8f MachineSet.v1alpha1.machine.sapcloud.io ``` -You will notice a new instance-set backing your instance-deployment +You will notice a new machine-set backing your machine-deployment -- Check Node Controller Manager instances in the cluster +- Check Node Controller Manager machines in the cluster ```bash -$ kubectl get instance +$ kubectl get machine NAME KIND -test-instance-deployment-5bc6dd7c8f-5d24b Instance.v1alpha1.node.sapcloud.io -test-instance-deployment-5bc6dd7c8f-6mpn4 Instance.v1alpha1.node.sapcloud.io -test-instance-deployment-5bc6dd7c8f-dpt2q Instance.v1alpha1.node.sapcloud.io +test-machine-deployment-5bc6dd7c8f-5d24b Machine.v1alpha1.machine.sapcloud.io +test-machine-deployment-5bc6dd7c8f-6mpn4 Machine.v1alpha1.machine.sapcloud.io +test-machine-deployment-5bc6dd7c8f-dpt2q Machine.v1alpha1.machine.sapcloud.io ``` -Now you will notice N (number of replicas specified in the manifest) new instances whose name are prefixed with the instance-deployment object name that you created. +Now you will notice N (number of replicas specified in the manifest) new machines whose name are prefixed with the machine-deployment object name that you created. - After a few minutes (~3 minutes for AWS), you would see that new nodes have joined the cluster. You can see this using ```bash @@ -52,26 +52,26 @@ ip-10-250-31-80.eu-west-1.compute.internal Ready 1m v1.8.0 ``` This shows how new nodes have joined your cluster -## Inspect status of instance-deployment +## Inspect status of machine-deployment -To inspect the status of any created instance-deployment run the command below, +To inspect the status of any created machine-deployment run the command below, ```bash -$ kubectl get instancedeployment test-instance-deployment -o yaml -apiVersion: node.sapcloud.io/v1alpha1 -kind: InstanceDeployment +$ kubectl get machinedeployment test-machine-deployment -o yaml +apiVersion: machine.sapcloud.io/v1alpha1 +kind: MachineDeployment metadata: annotations: deployment.kubernetes.io/revision: "1" kubectl.kubernetes.io/last-applied-configuration: | - {"apiVersion":"node.sapcloud.io/v1alpha1","kind":"InstanceDeployment","metadata":{"annotations":{},"name":"test-instance-deployment","namespace":""},"spec":{"minReadySeconds":200,"replicas":3,"selector":{"matchLabels":{"test-label":"test-label"}},"strategy":{"rollingUpdate":{"maxSurge":1,"maxUnavailable":1},"type":"RollingUpdate"},"template":{"metadata":{"labels":{"test-label":"test-label"}},"spec":{"class":{"kind":"AWSInstanceClass","name":"test-aws"}}}}} + {"apiVersion":"machine.sapcloud.io/v1alpha1","kind":"MachineDeployment","metadata":{"annotations":{},"name":"test-machine-deployment","namespace":""},"spec":{"minReadySeconds":200,"replicas":3,"selector":{"matchLabels":{"test-label":"test-label"}},"strategy":{"rollingUpdate":{"maxSurge":1,"maxUnavailable":1},"type":"RollingUpdate"},"template":{"metadata":{"labels":{"test-label":"test-label"}},"spec":{"class":{"kind":"AWSMachineClass","name":"test-aws"}}}}} clusterName: "" creationTimestamp: 2017-12-27T08:55:56Z generation: 0 initializers: null - name: test-instance-deployment + name: test-machine-deployment namespace: "" resourceVersion: "12634168" - selfLink: /apis/node.sapcloud.io/v1alpha1/test-instance-deployment + selfLink: /apis/machine.sapcloud.io/v1alpha1/test-machine-deployment uid: c0b488f7-eae3-11e7-a6c0-828f843e4186 spec: minReadySeconds: 200 @@ -91,7 +91,7 @@ spec: test-label: test-label spec: class: - kind: AWSInstanceClass + kind: AWSMachineClass name: test-aws status: availableReplicas: 3 @@ -109,45 +109,46 @@ status: ## Health monitoring -Health monitor is also applied similar to how it's described for [instance-sets](instance_set.md) +Health monitor is also applied similar to how it's described for [machine-sets](machine_set.md) -## Update your instances +## Update your machines -Let us consider the scenario where you wish to update all nodes of your cluster from t2.xlarge instances to m4.xlarge instances. Assume that your current *test-aws* has its **spec.instanceType: t2.xlarge** and your deployment *test-instance-deployment* points to this AWSInstanceClass. +Let us consider the scenario where you wish to update all nodes of your cluster from t2.xlarge machines to m4.xlarge machines. Assume that your current *test-aws* has its **spec.machineType: t2.xlarge** and your deployment *test-machine-deployment* points to this AWSMachineClass. #### Inspect existing cluster configuration - Check Nodes present in the cluster ```bash -$ kubectl get nodes +$ kubectl get nodes NAME STATUS AGE VERSION ip-10-250-20-19.eu-west-1.compute.internal Ready 1m v1.8.0 ip-10-250-27-123.eu-west-1.compute.internal Ready 1m v1.8.0 ip-10-250-31-80.eu-west-1.compute.internal Ready 1m v1.8.0 ``` -- Check Node Controller Manager instance-sets in the cluster. You will notice one instance-set backing your instance-deployment +- Check Node Controller Manager machine-sets in the cluster. You will notice one machine-set backing your machine-deployment ```bash -$ NAME KIND -test-instance-deployment-5bc6dd7c8f InstanceSet.v1alpha1.node.sapcloud.io +$ kubectl get machineset +NAME KIND +test-machine-deployment-5bc6dd7c8f MachineSet.v1alpha1.machine.sapcloud.io ``` - Login to your cloud provider (AWS). In the VM management console, you will find N VMs created of type t2.xlarge. #### Perform a rolling update -To update this instance-deployment VMs to m4.xlarge, we would do the following: +To update this machine-deployment VMs to m4.xlarge, we would do the following: -- Copy your existing aws-instance-class.yaml +- Copy your existing aws-machine-class.yaml ```bash -$ cp kubernetes/aws-instance-class.yaml kubernetes/aws-instance-class-new.yaml +$ cp kubernetes/aws-machine-class.yaml kubernetes/aws-machine-class-new.yaml ``` -- Modify aws-instance-class-new.yaml, and update its *metadata.name: test-aws2* and *spec.instanceType: m4.xlarge* -- Now create this modified InstanceClass +- Modify aws-machine-class-new.yaml, and update its *metadata.name: test-aws2* and *spec.machineType: m4.xlarge* +- Now create this modified MachineClass ```bash -$ kubectl apply -f kubernetes/aws-instance-class-new.yaml +$ kubectl apply -f kubernetes/aws-machine-class-new.yaml ``` -- Edit your existing instance-deployment +- Edit your existing machine-deployment ```bash -$ kubectl edit instancedeployment test-instance-deployment +$ kubectl edit machinedeployment test-machine-deployment ``` - Update from *spec.template.spec.class.name: test-aws* to *spec.template.spec.class.name: test-aws2* @@ -157,18 +158,18 @@ After a few minutes (~ 3mins) - Check nodes present in cluster now. They are different nodes. ```bash -k get nodes +kubectl get nodes NAME STATUS AGE VERSION ip-10-250-11-171.eu-west-1.compute.internal Ready 4m v1.8.0 ip-10-250-17-213.eu-west-1.compute.internal Ready 5m v1.8.0 ip-10-250-31-81.eu-west-1.compute.internal Ready 5m v1.8.0 ``` -- Check Node Controller Manager instance-sets in the cluster. You will notice two instance-sets backing your instance-deployment +- Check Node Controller Manager machine-sets in the cluster. You will notice two machine-sets backing your machine-deployment ```bash -$ kubectl get instanceset +$ kubectl get machineset NAME KIND -test-instance-deployment-5bc6dd7c8f InstanceSet.v1alpha1.node.sapcloud.io -test-instance-deployment-86ff45cc5 InstanceSet.v1alpha1.node.sapcloud.io +test-machine-deployment-5bc6dd7c8f MachineSet.v1alpha1.machine.sapcloud.io +test-machine-deployment-86ff45cc5 MachineSet.v1alpha1.machine.sapcloud.io ``` - Login to your cloud provider (AWS). In the VM management console, you will find N VMs created of type t2.xlarge in terminated state, and N new VMs of type m4.xlarge in running state. @@ -177,34 +178,34 @@ This shows how a rolling update of a cluster from nodes with t2.xlarge to m4.xla #### More variants of updates - The above demonstration was a simple use case. This could be more complex like - updating the system disk image versions/ kubelet versions/ security patches etc. -- You can also play around with the maxSurge and maxUnavailable fields in instance-deployment.yaml +- You can also play around with the maxSurge and maxUnavailable fields in machine-deployment.yaml - You can also change the update strategy from rollingupdate to recreate ## Undo an update -- Edit the existing instance-deployment +- Edit the existing machine-deployment ```bash -$ kubectl edit instancedeployment test-instance-deployment +$ kubectl edit machinedeployment test-machine-deployment ``` -- Edit the deployment to have this new field of *spec.rollbackTo.revision: 0* as shown as comments in `kubernetes/instance-deployment.yaml` +- Edit the deployment to have this new field of *spec.rollbackTo.revision: 0* as shown as comments in `kubernetes/machine-deployment.yaml` - This will undo your update to the previous version. ## Pause an update -- You can also pause the update while update is going on by editing the existing instance-deployment +- You can also pause the update while update is going on by editing the existing machine-deployment ```bash -$ kubectl edit instancedeployment test-instance-deployment +$ kubectl edit machinedeployment test-machine-deployment ``` -- Edit the deployment to have this new field of *spec.paused: true* as shown as comments in `kubernetes/instance-deployment.yaml` +- Edit the deployment to have this new field of *spec.paused: true* as shown as comments in `kubernetes/machine-deployment.yaml` - This will pause the rollingUpdate if it's in process - To resume the update, edit the deployment as mentioned above and remove the field *spec.paused: true* updated earlier -## Delete instance-deployment +## Delete machine-deployment -- To delete the VM using the `kubernetes/instance-deployment.yaml` +- To delete the VM using the `kubernetes/machine-deployment.yaml` ```bash -$ kubectl delete -f kubernetes/instance-deployment.yaml +$ kubectl delete -f kubernetes/machine-deployment.yaml ``` The Node Controller Manager picks up the manifest and starts to delete the existing VMs by talking to the cloud provider. The nodes should be detached from the cluster in a few minutes (~1min for AWS). \ No newline at end of file diff --git a/docs/usage/machine_set.md b/docs/usage/machine_set.md new file mode 100644 index 000000000..cbdbe0916 --- /dev/null +++ b/docs/usage/machine_set.md @@ -0,0 +1,107 @@ +# Maintaining machine replicas using machines-sets + +## Setting up your usage environment + +* Follow the [steps described here](prerequisite.md) + +## Important :warning: +- Make sure that the `kubernetes/machine-set.yaml` points to the same class name as the `kubernetes/aws-machine-class.yaml`. +- Similarily `kubernetes/aws-machine-class.yaml` secret name and namespace should be same as that mentioned in `kubernetes/secret.yaml` + +## Creating machine-set + +- Modify `kubernetes/machine-set.yaml` as per your requirement. You can modify the number of replicas to the desired number of machines. Then, create an machine-set +```bash +$ kubectl apply -f kubernetes/machine-set.yaml +``` +You should notice that the Node Controller Manager has immediately picked up your manifest and started to create a new machines based on the number of replicas you have provided in the manifest. + +- Check Node Controller Manager machine-sets in the cluster +```bash +$ kubectl get machineset +NAME KIND +test-machine-set MachineSet.v1alpha1.machine.sapcloud.io +``` +You will see a new machine-set with your given name + +- Check Node Controller Manager machines in the cluster +```bash +$ kubectl get machine +NAME KIND +test-machine-set-b57zs Machine.v1alpha1.machine.sapcloud.io +test-machine-set-c4bg8 Machine.v1alpha1.machine.sapcloud.io +test-machine-set-kvskg Machine.v1alpha1.machine.sapcloud.io +``` +Now you will see N (number of replicas specified in the manifest) new machines whose names are prefixed with the machine-set object name that you created. + +- After a few minutes (~3 minutes for AWS), you should notice new nodes joining the cluster. You can verify this by running, +```bash +$ kubectl get nodes +NAME STATUS AGE VERSION +ip-10-250-0-234.eu-west-1.compute.internal Ready 3m v1.8.0 +ip-10-250-15-98.eu-west-1.compute.internal Ready 3m v1.8.0 +ip-10-250-6-21.eu-west-1.compute.internal Ready 2m v1.8.0 +``` +This shows how new nodes have joined your cluster + +## Inspect status of machine-set + +- To inspect the status of any created machine-set run the following command, +```bash +$ kubectl get machineset test-machine-set -o yaml +apiVersion: machine.sapcloud.io/v1alpha1 +kind: MachineSet +metadata: + annotations: + kubectl.kubernetes.io/last-applied-configuration: | + {"apiVersion":"machine.sapcloud.io/v1alpha1","kind":"MachineSet","metadata":{"annotations":{},"name":"test-machine-set","namespace":"","test-label":"test-label"},"spec":{"minReadySeconds":200,"replicas":3,"selector":{"matchLabels":{"test-label":"test-label"}},"template":{"metadata":{"labels":{"test-label":"test-label"}},"spec":{"class":{"kind":"AWSMachineClass","name":"test-aws"}}}}} + clusterName: "" + creationTimestamp: 2017-12-27T08:37:42Z + finalizers: + - machine.sapcloud.io/operator + generation: 0 + initializers: null + name: test-machine-set + namespace: "" + resourceVersion: "12630893" + selfLink: /apis/machine.sapcloud.io/v1alpha1/test-machine-set + uid: 3469faaa-eae1-11e7-a6c0-828f843e4186 +spec: + machineClass: {} + minReadySeconds: 200 + replicas: 3 + selector: + matchLabels: + test-label: test-label + template: + metadata: + creationTimestamp: null + labels: + test-label: test-label + spec: + class: + kind: AWSMachineClass + name: test-aws +status: + availableReplicas: 3 + fullyLabeledReplicas: 3 + machineSetCondition: null + lastOperation: + lastUpdateTime: null + observedGeneration: 0 + readyReplicas: 3 + replicas: 3 +``` + +## Health monitoring + +- If you try to delete/terminate any of the machines backing the machine-set by either talking to the Node Controller Manager or from the cloud provider, the Node Controller Manager recreates a matching healthy machine to replace the deleted machine. +- Similarly, if any of your machines are unreachable or in an unhealthy state (kubelet not ready / disk pressure) for longer than the configured timeout (~ 5mins), the Node Controller Manager recreates the nodes to replace the unhealthy nodes. + +## Delete machine-set + +- To delete the VM using the `kubernetes/machine-set.yaml` +```bash +$ kubectl delete -f kubernetes/machine-set.yaml +``` +Now the Node Controller Manager has immediately picked up your manifest and started to delete the existing VMs by talking to the cloud provider. Your nodes should be detached from the cluster in a few minutes (~1min for AWS). \ No newline at end of file diff --git a/docs/usage/prerequisite.md b/docs/usage/prerequisite.md index bd00ec520..57a6b998d 100644 --- a/docs/usage/prerequisite.md +++ b/docs/usage/prerequisite.md @@ -3,7 +3,7 @@ :warning: All paths are relative to the root location of this project repository. - Run the Node Controller Manager either as described in [Setting up a local development environment](../development/local_setup.md) or [Deploying the Node Controller Manager into a Kubernetes cluster](../deployment/kubernetes.md). -- Make sure that the following steps are run before managing instances/ instance-sets/ instance-deploys. +- Make sure that the following steps are run before managing machines/ machine-sets/ machine-deploys. ## Set KUBECONFIG @@ -15,7 +15,7 @@ $ export KUBECONFIG=$GOPATH/src/github.com/gardener/node-controller-manager/dev/ ## Replace provider credentials and desired VM configurations -Open `kubernetes/aws-instance-class.yaml` and replace required values there with the desired VM configurations. +Open `kubernetes/aws-machine-class.yaml` and replace required values there with the desired VM configurations. Similarily open `kubernetes/secret.yaml` and replace - *userData, providerAccessKeyId, providerSecretAccessKey* with base64 encoded values of cloudconfig file, AWS access key id, and AWS secret access key respectively. Use the following command to get the base64 encoded value of your details @@ -33,9 +33,9 @@ Create all the required CRDs in the cluster using `kubernetes/crds.yaml` $ kubectl apply -f kubernetes/crds.yaml ``` -Create the class template that will be used as an instance template to create VMs using `kubernetes/aws-instance-class.yaml` +Create the class template that will be used as an machine template to create VMs using `kubernetes/aws-machine-class.yaml` ```bash -$ kubectl apply -f kubernetes/aws-instance-class.yaml +$ kubectl apply -f kubernetes/aws-machine-class.yaml ``` Create the secret used for the cloud credentials and cloudconfig using `kubernetes/secret.yaml` @@ -47,11 +47,11 @@ $ kubectl apply -f kubernetes/secret.yaml Get to know the current cluster state using the following commands, -- Checking aws-instance-class in the cluster +- Checking aws-machine-class in the cluster ```bash -$ kubectl get awsinstanceclass +$ kubectl get awsmachineclass NAME KIND -test-aws AWSInstanceClass.v1alpha1.node.sapcloud.io +test-aws AWSMachineClass.v1alpha1.machine.sapcloud.io ``` - Checking kubernetes secrets in the cluster @@ -67,20 +67,20 @@ $ kubectl get nodes ``` Lists the default set of nodes attached to your cluster -- Checking Node Controller Manager instances in the cluster +- Checking Node Controller Manager machines in the cluster ```bash -$ kubectl get instance +$ kubectl get machine No resources found. ``` -- Checking Node Controller Manager instance-sets in the cluster +- Checking Node Controller Manager machine-sets in the cluster ```bash -$ kubectl get instanceset +$ kubectl get machineset No resources found. ``` -- Checking Node Controller Manager instance-deploys in the cluster +- Checking Node Controller Manager machine-deploys in the cluster ```bash -$ kubectl get instancedeployment +$ kubectl get machinedeployment No resources found. ``` \ No newline at end of file diff --git a/kubernetes/aws-instance-class.yaml b/kubernetes/aws-machine-class.yaml similarity index 51% rename from kubernetes/aws-instance-class.yaml rename to kubernetes/aws-machine-class.yaml index 6d3d0ee0c..d172c9182 100644 --- a/kubernetes/aws-instance-class.yaml +++ b/kubernetes/aws-machine-class.yaml @@ -1,23 +1,23 @@ -# Sample AWS instance class +# Sample AWS machine class -apiVersion: node.sapcloud.io/v1alpha1 -kind: AWSInstanceClass +apiVersion: machine.sapcloud.io/v1alpha1 +kind: AWSMachineClass metadata: - name: test-aws # Name of aws instance class goes here + name: test-aws # Name of aws machine class goes here spec: ami: ami-123456 # Amazon machine image name goes here - availabilityZone: eu-east-1 # Region in which instance is to be deployed - instanceType: t2.large # Type of ec2 instance + availabilityZone: eu-east-1 # Region in which machine is to be deployed + machineType: t2.large # Type of ec2 machine iam: name: iam-name # Name of the AWS Identity and Access Management - keyName: key-value-pair-name # EC2 keypair used to access ec2 instance + keyName: key-value-pair-name # EC2 keypair used to access ec2 machine networkInterfaces: - - subnetID: subnet-acbd1234 # The subnetID in which instance is to be deployed + - subnetID: subnet-acbd1234 # The subnetID in which machine is to be deployed securityGroupID: ["sg-xyz12345"] # The security group to which it is attached to tags: - Name: sample-instance-name # Name tag that can be used to identify a instance - tag1: tag1-value # A set of additional tags attached to a instance (optional) - tag2: tag2-value # A set of additional tags attached to a instance (optional) + Name: sample-machine-name # Name tag that can be used to identify a machine + tag1: tag1-value # A set of additional tags attached to a machine (optional) + tag2: tag2-value # A set of additional tags attached to a machine (optional) secretRef: # Secret pointing to a secret which contains the provider secret and cloudconfig namespace: default # Namespace name: test-secret # Name of the secret diff --git a/kubernetes/crds.yaml b/kubernetes/crds.yaml index e690a816b..52019f92c 100644 --- a/kubernetes/crds.yaml +++ b/kubernetes/crds.yaml @@ -3,15 +3,15 @@ apiVersion: apiextensions.k8s.io/v1beta1 kind: CustomResourceDefinition metadata: - name: awsinstanceclasses.node.sapcloud.io + name: awsmachineclasses.machine.sapcloud.io spec: - group: node.sapcloud.io + group: machine.sapcloud.io version: v1alpha1 scope: Cluster names: - kind: AWSInstanceClass - plural: awsinstanceclasses - singular: awsinstanceclass + kind: AWSMachineClass + plural: awsmachineclasses + singular: awsmachineclass shortNames: - instcls @@ -20,15 +20,15 @@ spec: apiVersion: apiextensions.k8s.io/v1beta1 kind: CustomResourceDefinition metadata: - name: instances.node.sapcloud.io + name: machines.machine.sapcloud.io spec: - group: node.sapcloud.io + group: machine.sapcloud.io version: v1alpha1 scope: Cluster names: - kind: Instance - plural: instances - singular: instance + kind: Machine + plural: machines + singular: machine shortNames: - inst @@ -37,15 +37,15 @@ spec: apiVersion: apiextensions.k8s.io/v1beta1 kind: CustomResourceDefinition metadata: - name: instancesets.node.sapcloud.io + name: machinesets.machine.sapcloud.io spec: - group: node.sapcloud.io + group: machine.sapcloud.io version: v1alpha1 scope: Cluster names: - kind: InstanceSet - plural: instancesets - singular: instanceset + kind: MachineSet + plural: machinesets + singular: machineset shortNames: - instset --- @@ -53,14 +53,14 @@ spec: apiVersion: apiextensions.k8s.io/v1beta1 kind: CustomResourceDefinition metadata: - name: instancedeployments.node.sapcloud.io + name: machinedeployments.machine.sapcloud.io spec: - group: node.sapcloud.io + group: machine.sapcloud.io version: v1alpha1 scope: Cluster names: - kind: InstanceDeployment - plural: instancedeployments - singular: instancedeployment + kind: MachineDeployment + plural: machinedeployments + singular: machinedeployment shortNames: - instdeploy \ No newline at end of file diff --git a/kubernetes/deployment/clusterrole.yaml b/kubernetes/deployment/clusterrole.yaml index 3538f1894..dde043ca2 100644 --- a/kubernetes/deployment/clusterrole.yaml +++ b/kubernetes/deployment/clusterrole.yaml @@ -8,12 +8,12 @@ metadata: name: node-controller-manager rules: - apiGroups: - - "node.sapcloud.io" + - "machine.sapcloud.io" resources: - - awsinstanceclasses - - instancedeployments - - instances - - instancesets + - awsmachineclasses + - machinedeployments + - machines + - machinesets verbs: - create - delete diff --git a/kubernetes/deployment/deployment.yaml b/kubernetes/deployment/deployment.yaml index afaf3fdbe..2c4edb7c5 100644 --- a/kubernetes/deployment/deployment.yaml +++ b/kubernetes/deployment/deployment.yaml @@ -13,7 +13,7 @@ spec: spec: containers: - name: node-controller-manager - image: kvmprashanth/node-controller-manager:v1 + image: kvmprashanth/node-controller-manager:v2 imagePullPolicy: Always command: - ./node-controller-manager diff --git a/kubernetes/instance-deployment.yaml b/kubernetes/instance-deployment.yaml deleted file mode 100644 index 10ac6d4f1..000000000 --- a/kubernetes/instance-deployment.yaml +++ /dev/null @@ -1,28 +0,0 @@ -# Sample instance-deploy object - -apiVersion: node.sapcloud.io/v1alpha1 -kind: InstanceDeployment -metadata: - name: test-instance-deployment # Name of the instance deploy -spec: - #paused: true [uncommment this when you want to pause] - #rollbackTo: - #revision: 0 [uncommment this when you want to rollback to previous version] - replicas: 3 # Number of healthy replicas that should always be healthy - minReadySeconds: 200 # Minimum time to wait for instance to be ready - strategy: - type: RollingUpdate # Strategy for update RollingUpdate/Recreate - rollingUpdate: - maxSurge: 1 # Maximum addition instances that spawned over the desired replicas during update - maxUnavailable: 1 # Maximum unavailable instances that the cluster can tolerate - selector: - matchLabels: - test-label: test-label # Label to match the template (XXXXX) - template: - metadata: - labels: - test-label: test-label # Label to match with selector (XXXXX) - spec: - class: - kind: AWSInstanceClass # Instance class template used to create instance, could be AWS/GCP/Azure/Other-cloud-providers - name: test-aws # Name of the instance class \ No newline at end of file diff --git a/kubernetes/instance.yaml b/kubernetes/instance.yaml deleted file mode 100644 index 30de3eef0..000000000 --- a/kubernetes/instance.yaml +++ /dev/null @@ -1,12 +0,0 @@ -# Sample instance object - -apiVersion: node.sapcloud.io/v1alpha1 -kind: Instance -metadata: - name: test-instance # Name of the instance to be created - labels: - test-label: test-label # Label used by instance-set to match (optional) -spec: - class: - kind: AWSInstanceClass # Instance class template used to create instance, could be AWS/GCP/Azure/Other-cloud-providers - name: test-aws # Name of the instance class diff --git a/kubernetes/machine-deployment.yaml b/kubernetes/machine-deployment.yaml new file mode 100644 index 000000000..5587d5132 --- /dev/null +++ b/kubernetes/machine-deployment.yaml @@ -0,0 +1,28 @@ +# Sample machine-deploy object + +apiVersion: machine.sapcloud.io/v1alpha1 +kind: MachineDeployment +metadata: + name: test-machine-deployment # Name of the machine deploy +spec: + #paused: true [uncommment this when you want to pause] + #rollbackTo: + #revision: 0 [uncommment this when you want to rollback to previous version] + replicas: 3 # Number of healthy replicas that should always be healthy + minReadySeconds: 200 # Minimum time to wait for machine to be ready + strategy: + type: RollingUpdate # Strategy for update RollingUpdate/Recreate + rollingUpdate: + maxSurge: 1 # Maximum addition machines that spawned over the desired replicas during update + maxUnavailable: 1 # Maximum unavailable machines that the cluster can tolerate + selector: + matchLabels: + test-label: test-label # Label to match the template (XXXXX) + template: + metadata: + labels: + test-label: test-label # Label to match with selector (XXXXX) + spec: + class: + kind: AWSMachineClass # Machine class template used to create machine, could be AWS/GCP/Azure/Other-cloud-providers + name: test-aws # Name of the machine class \ No newline at end of file diff --git a/kubernetes/instance-set.yaml b/kubernetes/machine-set.yaml similarity index 51% rename from kubernetes/instance-set.yaml rename to kubernetes/machine-set.yaml index 68b66612b..6c4400213 100644 --- a/kubernetes/instance-set.yaml +++ b/kubernetes/machine-set.yaml @@ -1,13 +1,13 @@ -# Sample instance-set object +# Sample machine-set object -apiVersion: node.sapcloud.io/v1alpha1 -kind: InstanceSet +apiVersion: machine.sapcloud.io/v1alpha1 +kind: MachineSet metadata: - name: test-instance-set # Name of instance-set - test-label: test-label # Label used by instance-deployment to match (optional) + name: test-machine-set # Name of machine-set + test-label: test-label # Label used by machine-deployment to match (optional) spec: replicas: 3 # Number of healthy replicas that should always be healthy - minReadySeconds: 200 # Minimum time to wait for instance to be ready + minReadySeconds: 200 # Minimum time to wait for machine to be ready selector: matchLabels: test-label: test-label # Label to match the template (XXXXX) @@ -17,5 +17,5 @@ spec: test-label: test-label # Label to match the selector (XXXXX) spec: class: - kind: AWSInstanceClass + kind: AWSMachineClass name: test-aws diff --git a/kubernetes/machine.yaml b/kubernetes/machine.yaml new file mode 100644 index 000000000..624f76702 --- /dev/null +++ b/kubernetes/machine.yaml @@ -0,0 +1,12 @@ +# Sample machine object + +apiVersion: machine.sapcloud.io/v1alpha1 +kind: Machine +metadata: + name: test-machine # Name of the machine to be created + labels: + test-label: test-label # Label used by machine-set to match (optional) +spec: + class: + kind: AWSMachineClass # Machine class template used to create machine, could be AWS/GCP/Azure/Other-cloud-providers + name: test-aws # Name of the machine class diff --git a/pkg/apis/node/doc.go b/pkg/apis/machine/doc.go similarity index 54% rename from pkg/apis/node/doc.go rename to pkg/apis/machine/doc.go index 42a3abfb4..23596e7c3 100644 --- a/pkg/apis/node/doc.go +++ b/pkg/apis/machine/doc.go @@ -1,4 +1,4 @@ // Package node TODO // +k8s:deepcopy-gen=package,register -// +groupName=node.sapcloud.io -package node +// +groupName=machine.sapcloud.io +package machine diff --git a/pkg/apis/node/install/install.go b/pkg/apis/machine/install/install.go similarity index 86% rename from pkg/apis/node/install/install.go rename to pkg/apis/machine/install/install.go index 2e08a8235..cf2986a3d 100644 --- a/pkg/apis/node/install/install.go +++ b/pkg/apis/machine/install/install.go @@ -22,8 +22,8 @@ import ( "k8s.io/apimachinery/pkg/runtime" "k8s.io/apimachinery/pkg/util/sets" - "github.com/gardener/node-controller-manager/pkg/apis/node" - "github.com/gardener/node-controller-manager/pkg/apis/node/v1alpha1" + "github.com/gardener/node-controller-manager/pkg/apis/machine" + "github.com/gardener/node-controller-manager/pkg/apis/machine/v1alpha1" ) // Install registers the API group and adds types to a scheme @@ -33,7 +33,7 @@ func Install(groupFactoryRegistry announced.APIGroupFactoryRegistry, registry *r GroupName: v1alpha1.GroupName, VersionPreferenceOrder: []string{v1alpha1.SchemeGroupVersion.Version}, AddInternalObjectsToScheme: node.AddToScheme, - RootScopedKinds: sets.NewString("AWSInstanceClass","InstanceSet", "Instance", "InstanceDeployment"), + RootScopedKinds: sets.NewString("AWSMachineClass","MachineSet", "Machine", "MachineDeployment"), }, announced.VersionToSchemeFunc{ v1.SchemeGroupVersion.Version: v1.AddToScheme, diff --git a/pkg/apis/node/register.go b/pkg/apis/machine/register.go similarity index 88% rename from pkg/apis/node/register.go rename to pkg/apis/machine/register.go index 449b7f91f..654bf4e34 100644 --- a/pkg/apis/node/register.go +++ b/pkg/apis/machine/register.go @@ -13,7 +13,7 @@ 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 node +package machine import ( metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" @@ -21,7 +21,7 @@ import ( "k8s.io/apimachinery/pkg/runtime/schema" ) -const GroupName = "node.sapcloud.io" +const GroupName = "machine.sapcloud.io" // SchemeGroupVersion is group version used to register these objects var SchemeGroupVersion = schema.GroupVersion{Group: GroupName, Version: runtime.APIVersionInternal } @@ -47,17 +47,17 @@ var ( func addKnownTypes(scheme *runtime.Scheme) error { scheme.AddKnownTypes(SchemeGroupVersion, - &AWSInstanceClass{}, - &AWSInstanceClassList{}, + &AWSMachineClass{}, + &AWSMachineClassList{}, - &Instance{}, - &InstanceList{}, + &Machine{}, + &MachineList{}, - &InstanceSet{}, - &InstanceSetList{}, + &MachineSet{}, + &MachineSetList{}, - &InstanceDeployment{}, - &InstanceDeploymentList{}, + &MachineDeployment{}, + &MachineDeploymentList{}, ) metav1.AddToGroupVersion(scheme, SchemeGroupVersion) return nil diff --git a/pkg/apis/node/types.go b/pkg/apis/machine/types.go similarity index 73% rename from pkg/apis/node/types.go rename to pkg/apis/machine/types.go index e5169373a..eab962b21 100644 --- a/pkg/apis/node/types.go +++ b/pkg/apis/machine/types.go @@ -13,7 +13,7 @@ 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 node +package machine import ( corev1 "k8s.io/api/core/v1" @@ -37,36 +37,36 @@ const ( // +genclient:nonNamespaced // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object -// AWSInstanceClass TODO -type AWSInstanceClass struct { +// AWSMachineClass TODO +type AWSMachineClass struct { metav1.ObjectMeta metav1.TypeMeta - Spec AWSInstanceClassSpec + Spec AWSMachineClassSpec } // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object -// AWSInstanceClassList is a collection of AWSInstanceClasses. -type AWSInstanceClassList struct { +// AWSMachineClassList is a collection of AWSMachineClasses. +type AWSMachineClassList struct { metav1.TypeMeta metav1.ListMeta - Items []AWSInstanceClass + Items []AWSMachineClass } -// AWSInstanceClassSpec is the specification of a Shoot cluster. -type AWSInstanceClassSpec struct { +// AWSMachineClassSpec is the specification of a Shoot cluster. +type AWSMachineClassSpec struct { AMI string AvailabilityZone string BlockDevices []AWSBlockDeviceMappingSpec EbsOptimized bool IAM AWSIAMProfileSpec - InstanceType string + MachineType string KeyName string Monitoring bool NetworkInterfaces []AWSNetworkInterfaceSpec @@ -76,10 +76,10 @@ type AWSInstanceClassSpec struct { type AWSBlockDeviceMappingSpec struct { - // The device name exposed to the instance (for example, /dev/sdh or xvdh). + // The device name exposed to the machine (for example, /dev/sdh or xvdh). DeviceName string - // Parameters used to automatically set up EBS volumes when the instance is + // Parameters used to automatically set up EBS volumes when the machine is // launched. Ebs AWSEbsBlockDeviceSpec @@ -87,15 +87,15 @@ type AWSBlockDeviceMappingSpec struct { // AMI. NoDevice string - // The virtual device name (ephemeralN). Instance store volumes are numbered - // starting from 0. An instance type with 2 available instance store volumes + // The virtual device name (ephemeralN). Machine store volumes are numbered + // starting from 0. An machine type with 2 available machine store volumes // can specify mappings for ephemeral0 and ephemeral1.The number of available - // instance store volumes depends on the instance type. After you connect to - // the instance, you must mount the volume. + // machine store volumes depends on the machine type. After you connect to + // the machine, you must mount the volume. // - // Constraints: For M3 instances, you must specify instance store volumes in - // the block device mapping for the instance. When you launch an M3 instance, - // we ignore any instance store volumes specified in the block device mapping + // Constraints: For M3 machines, you must specify machine store volumes in + // the block device mapping for the machine. When you launch an M3 machine, + // we ignore any machine store volumes specified in the block device mapping // for the AMI. VirtualName string } @@ -104,11 +104,11 @@ type AWSBlockDeviceMappingSpec struct { // Please also see https://docs.aws.amazon.com/goto/WebAPI/ec2-2016-11-15/EbsBlockDevice type AWSEbsBlockDeviceSpec struct { - // Indicates whether the EBS volume is deleted on instance termination. + // Indicates whether the EBS volume is deleted on machine termination. DeleteOnTermination bool // Indicates whether the EBS volume is encrypted. Encrypted Amazon EBS volumes - // may only be attached to instances that support Amazon EBS encryption. + // may only be attached to machines that support Amazon EBS encryption. Encrypted bool // The number of I/O operations per second (IOPS) that the volume supports. @@ -144,75 +144,75 @@ type AWSEbsBlockDeviceSpec struct { VolumeType string } -// Describes an IAM instance profile. +// Describes an IAM machine profile. type AWSIAMProfileSpec struct { - // The Amazon Resource Name (ARN) of the instance profile. + // The Amazon Resource Name (ARN) of the machine profile. ARN string - // The name of the instance profile. + // The name of the machine profile. Name string } // Describes a network interface. -// Please also see https://docs.aws.amazon.com/goto/WebAPI/ec2-2016-11-15/InstanceAWSNetworkInterfaceSpecification +// Please also see https://docs.aws.amazon.com/goto/WebAPI/ec2-2016-11-15/MachineAWSNetworkInterfaceSpecification type AWSNetworkInterfaceSpec struct { - // Indicates whether to assign a public IPv4 address to an instance you launch + // Indicates whether to assign a public IPv4 address to an machine you launch // in a VPC. The public IP address can only be assigned to a network interface // for eth0, and can only be assigned to a new network interface, not an existing // one. You cannot specify more than one network interface in the request. If // launching into a default subnet, the default value is true. AssociatePublicIPAddress bool - // If set to true, the interface is deleted when the instance is terminated. + // If set to true, the interface is deleted when the machine is terminated. // You can specify true only if creating a new network interface when launching - // an instance. + // an machine. DeleteOnTermination bool // The description of the network interface. Applies only if creating a network - // interface when launching an instance. + // interface when launching an machine. Description string // The IDs of the security groups for the network interface. Applies only if - // creating a network interface when launching an instance. + // creating a network interface when launching an machine. SecurityGroupID []string // The ID of the subnet associated with the network string. Applies only if - // creating a network interface when launching an instance. + // creating a network interface when launching an machine. SubnetID string } -// InstancePhase is a label for the condition of a instances at the current time. -type InstancePhase string +// MachinePhase is a label for the condition of a machines at the current time. +type MachinePhase string -// These are the valid statuses of instances. +// These are the valid statuses of machines. const ( - // InstancePending means that the instance is being created - InstancePending InstancePhase = "Pending" - // InstancePending means that instance is present on provider but hasn't joined cluster yet - InstanceAvailable InstancePhase = "Available" - // InstanceRunning means node is ready and running succesfully - InstanceRunning InstancePhase = "Running" - // InstanceRunning means node is terminating - InstanceTerminating InstancePhase = "Terminating" - // InstanceUnknown indicates that the node is not ready at the movement - InstanceUnknown InstancePhase = "Unknown" - // InstanceFailed means operation failed leading to instance status failure - InstanceFailed InstancePhase = "Failed" + // MachinePending means that the machine is being created + MachinePending MachinePhase = "Pending" + // MachinePending means that machine is present on provider but hasn't joined cluster yet + MachineAvailable MachinePhase = "Available" + // MachineRunning means node is ready and running succesfully + MachineRunning MachinePhase = "Running" + // MachineRunning means node is terminating + MachineTerminating MachinePhase = "Terminating" + // MachineUnknown indicates that the node is not ready at the movement + MachineUnknown MachinePhase = "Unknown" + // MachineFailed means operation failed leading to machine status failure + MachineFailed MachinePhase = "Failed" ) -// InstancePhase is a label for the condition of a instances at the current time. -type InstanceState string +// MachinePhase is a label for the condition of a machines at the current time. +type MachineState string -// These are the valid statuses of instances. +// These are the valid statuses of machines. const ( - // InstancePending means there are operations pending on this instance state - InstanceStateProcessing InstanceState = "Processing" - // InstanceFailed means operation failed leading to instance status failure - InstanceStateFailed InstanceState = "Failed" - // InstanceUnknown indicates that the node is not ready at the movement - InstanceStateSuccessful InstanceState = "Successful" + // MachinePending means there are operations pending on this machine state + MachineStateProcessing MachineState = "Processing" + // MachineFailed means operation failed leading to machine status failure + MachineStateFailed MachineState = "Failed" + // MachineUnknown indicates that the node is not ready at the movement + MachineStateSuccessful MachineState = "Successful" ) // The below types are used by kube_client and api_server. @@ -234,31 +234,31 @@ const ( // +genclient:noStatus // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object -// Instance TODO -type Instance struct { +// Machine TODO +type Machine struct { metav1.ObjectMeta metav1.TypeMeta - Spec InstanceSpec + Spec MachineSpec - Status InstanceStatus + Status MachineStatus } // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object -// InstanceList is a collection of Instances. -type InstanceList struct { +// MachineList is a collection of Machines. +type MachineList struct { metav1.TypeMeta metav1.ListMeta - Items []Instance + Items []Machine } -// InstanceSpec is the specification of a Shoot cluster. -type InstanceSpec struct { +// MachineSpec is the specification of a Shoot cluster. +type MachineSpec struct { Class ClassSpec @@ -267,21 +267,21 @@ type InstanceSpec struct { // PodTemplateSpec describes the data a pod should have when created from a template -type InstanceTemplateSpec struct { +type MachineTemplateSpec struct { // Standard object's metadata. // More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#metadata metav1.ObjectMeta // Specification of the desired behavior of the pod. // More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#spec-and-status - Spec InstanceSpec + Spec MachineSpec } // +genclient // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object // PodTemplate describes a template for creating copies of a predefined pod. -type InstanceTemplate struct { +type MachineTemplate struct { metav1.TypeMeta // Standard object's metadata. // More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#metadata @@ -289,52 +289,52 @@ type InstanceTemplate struct { // Template defines the pods that will be created from this pod template. // https://git.k8s.io/community/contributors/devel/api-conventions.md#spec-and-status - Template InstanceTemplateSpec + Template MachineTemplateSpec } // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object // PodTemplateList is a list of PodTemplates. -type InstanceTemplateList struct { +type MachineTemplateList struct { metav1.TypeMeta // Standard list metadata. // More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#types-kinds metav1.ListMeta // List of pod templates - Items []InstanceTemplate + Items []MachineTemplate } -// ClassSpec is the class specification of instance +// ClassSpec is the class specification of machine type ClassSpec struct { // API group to which it belongs APIGroup string - // Kind for instance class + // Kind for machine class Kind string - // Name of instance class + // Name of machine class Name string } //type CurrentStatus type CurrentStatus struct { // API group to which it belongs - Phase InstancePhase - // Name of instance class + Phase MachinePhase + // Name of machine class TimeoutActive bool // Last update time of current status LastUpdateTime metav1.Time } -// InstanceStatus TODO -type InstanceStatus struct { +// MachineStatus TODO +type MachineStatus struct { // Node string Node string - // Conditions of this instance, same as node + // Conditions of this machine, same as node Conditions []corev1.NodeCondition // Last operation refers to the status of the last operation performed LastOperation LastOperation - // Current status of the instance object + // Current status of the machine object CurrentStatus CurrentStatus } @@ -345,7 +345,7 @@ type LastOperation struct { // Last update time of current operation LastUpdateTime metav1.Time // State of operation - State InstanceState + State MachineState // Type of operation Type string } @@ -354,58 +354,58 @@ type LastOperation struct { // +genclient:nonNamespaced // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object -// InstanceSet TODO -type InstanceSet struct { +// MachineSet TODO +type MachineSet struct { metav1.ObjectMeta metav1.TypeMeta - Spec InstanceSetSpec + Spec MachineSetSpec - Status InstanceSetStatus + Status MachineSetStatus } // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object -// InstanceSetList is a collection of InstanceSet. -type InstanceSetList struct { +// MachineSetList is a collection of MachineSet. +type MachineSetList struct { metav1.TypeMeta metav1.ListMeta - Items []InstanceSet + Items []MachineSet } -// InstanceSetSpec is the specification of a Shoot cluster. -type InstanceSetSpec struct { +// MachineSetSpec is the specification of a Shoot cluster. +type MachineSetSpec struct { Replicas int32 Selector *metav1.LabelSelector - InstanceClass ClassSpec + MachineClass ClassSpec - Template InstanceTemplateSpec + Template MachineTemplateSpec MinReadySeconds int } -type InstanceSetConditionType string +type MachineSetConditionType string -// These are valid conditions of a instance set. +// These are valid conditions of a machine set. const ( - // ReplicaSetReplicaFailure is added in a instance set when one of its pods fails to be created + // ReplicaSetReplicaFailure is added in a machine set when one of its pods fails to be created // due to insufficient quota, limit ranges, pod security policy, node selectors, etc. or deleted // due to kubelet being down or finalizers are failing. - InstanceSetReplicaFailure InstanceSetConditionType = "ReplicaFailure" + MachineSetReplicaFailure MachineSetConditionType = "ReplicaFailure" ) -// ReplicaSetCondition describes the state of a instance set at a certain point. -type InstanceSetCondition struct { - // Type of instance set condition. - Type InstanceSetConditionType +// ReplicaSetCondition describes the state of a machine set at a certain point. +type MachineSetCondition struct { + // Type of machine set condition. + Type MachineSetConditionType // Status of the condition, one of True, False, Unknown. Status ConditionStatus // The last time the condition transitioned from one status to another. @@ -416,9 +416,9 @@ type InstanceSetCondition struct { Message string } -// InstanceSetStatus TODO -type InstanceSetStatus struct { - // Conditions of this instance, same as node +// MachineSetStatus TODO +type MachineSetStatus struct { + // Conditions of this machine, same as node LastOperation LastOperation Replicas int32 @@ -429,13 +429,13 @@ type InstanceSetStatus struct { AvailableReplicas int32 - Conditions []InstanceSetCondition + Conditions []MachineSetCondition ObservedGeneration int64 } -/***************** InstanceDeploymennt APIs. ******************/ +/***************** MachineDeploymennt APIs. ******************/ // +genclient // +genclient:nonNamespaced @@ -443,21 +443,21 @@ type InstanceSetStatus struct { // +genclient:method=UpdateScale,verb=update,subresource=scale,input=Scale,result=Scale // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object -type InstanceDeployment struct { +type MachineDeployment struct { metav1.TypeMeta // +optional metav1.ObjectMeta // Specification of the desired behavior of the Deployment. // +optional - Spec InstanceDeploymentSpec + Spec MachineDeploymentSpec // Most recently observed status of the Deployment. // +optional - Status InstanceDeploymentStatus + Status MachineDeploymentStatus } -type InstanceDeploymentSpec struct { +type MachineDeploymentSpec struct { // Number of desired pods. This is a pointer to distinguish between explicit // zero and not specified. Defaults to 1. // +optional @@ -469,11 +469,11 @@ type InstanceDeploymentSpec struct { Selector *metav1.LabelSelector // Template describes the pods that will be created. - Template InstanceTemplateSpec + Template MachineTemplateSpec // The deployment strategy to use to replace existing pods with new ones. // +optional - Strategy InstanceDeploymentStrategy + Strategy MachineDeploymentStrategy // Minimum number of seconds for which a newly created pod should be ready // without any of its container crashing, for it to be considered available. @@ -510,7 +510,7 @@ type InstanceDeploymentSpec struct { // DEPRECATED. // DeploymentRollback stores the information required to rollback a deployment. -type InstanceDeploymentRollback struct { +type MachineDeploymentRollback struct { metav1.TypeMeta // Required: This must match the Name of a deployment. Name string @@ -532,13 +532,13 @@ const ( // DefaultDeploymentUniqueLabelKey is the default key of the selector that is added // to existing RCs (and label key that is added to its pods) to prevent the existing RCs // to select new pods (and old pods being select by new RC). - DefaultInstanceDeploymentUniqueLabelKey string = "instance-template-hash" + DefaultMachineDeploymentUniqueLabelKey string = "machine-template-hash" ) -type InstanceDeploymentStrategy struct { +type MachineDeploymentStrategy struct { // Type of deployment. Can be "Recreate" or "RollingUpdate". Default is RollingUpdate. // +optional - Type InstanceDeploymentStrategyType + Type MachineDeploymentStrategyType // Rolling update config params. Present only if DeploymentStrategyType = // RollingUpdate. @@ -546,21 +546,21 @@ type InstanceDeploymentStrategy struct { // TODO: Update this to follow our convention for oneOf, whatever we decide it // to be. // +optional - RollingUpdate *RollingUpdateInstanceDeployment + RollingUpdate *RollingUpdateMachineDeployment } -type InstanceDeploymentStrategyType string +type MachineDeploymentStrategyType string const ( // Kill all existing pods before creating new ones. - RecreateInstanceDeploymentStrategyType InstanceDeploymentStrategyType = "Recreate" + RecreateMachineDeploymentStrategyType MachineDeploymentStrategyType = "Recreate" // Replace the old RCs by new one using rolling update i.e gradually scale down the old RCs and scale up the new one. - RollingUpdateInstanceDeploymentStrategyType InstanceDeploymentStrategyType = "RollingUpdate" + RollingUpdateMachineDeploymentStrategyType MachineDeploymentStrategyType = "RollingUpdate" ) // Spec to control the desired behavior of rolling update. -type RollingUpdateInstanceDeployment struct { +type RollingUpdateMachineDeployment struct { // The maximum number of pods that can be unavailable during the update. // Value can be an absolute number (ex: 5) or a percentage of total pods at the start of update (ex: 10%). // Absolute number is calculated from percentage by rounding down. @@ -588,7 +588,7 @@ type RollingUpdateInstanceDeployment struct { MaxSurge *intstr.IntOrString } -type InstanceDeploymentStatus struct { +type MachineDeploymentStatus struct { // The generation observed by the deployment controller. // +optional ObservedGeneration int64 @@ -616,7 +616,7 @@ type InstanceDeploymentStatus struct { UnavailableReplicas int32 // Represents the latest available observations of a deployment's current state. - Conditions []InstanceDeploymentCondition + Conditions []MachineDeploymentCondition // Count of hash collisions for the Deployment. The Deployment controller uses this // field as a collision avoidance mechanism when it needs to create the name for the @@ -625,27 +625,27 @@ type InstanceDeploymentStatus struct { CollisionCount *int32 } -type InstanceDeploymentConditionType string +type MachineDeploymentConditionType string // These are valid conditions of a deployment. const ( // Available means the deployment is available, ie. at least the minimum available // replicas required are up and running for at least minReadySeconds. - InstanceDeploymentAvailable InstanceDeploymentConditionType = "Available" + MachineDeploymentAvailable MachineDeploymentConditionType = "Available" // Progressing means the deployment is progressing. Progress for a deployment is - // considered when a new instance set is created or adopted, and when new pods scale + // considered when a new machine set is created or adopted, and when new pods scale // up or old pods scale down. Progress is not estimated for paused deployments or // when progressDeadlineSeconds is not specified. - InstanceDeploymentProgressing InstanceDeploymentConditionType = "Progressing" + MachineDeploymentProgressing MachineDeploymentConditionType = "Progressing" // ReplicaFailure is added in a deployment when one of its pods fails to be created // or deleted. - InstanceDeploymentReplicaFailure InstanceDeploymentConditionType = "ReplicaFailure" + MachineDeploymentReplicaFailure MachineDeploymentConditionType = "ReplicaFailure" ) // DeploymentCondition describes the state of a deployment at a certain point. -type InstanceDeploymentCondition struct { +type MachineDeploymentCondition struct { // Type of deployment condition. - Type InstanceDeploymentConditionType + Type MachineDeploymentConditionType // Status of the condition, one of True, False, Unknown. Status ConditionStatus // The last time this condition was updated. @@ -660,25 +660,25 @@ type InstanceDeploymentCondition struct { // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object -type InstanceDeploymentList struct { +type MachineDeploymentList struct { metav1.TypeMeta // +optional metav1.ListMeta // Items is the list of deployments. - Items []InstanceDeployment + Items []MachineDeployment } // describes the attributes of a scale subresource type ScaleSpec struct { - // desired number of instances for the scaled object. + // desired number of machines for the scaled object. // +optional Replicas int32 } // represents the current status of a scale subresource. type ScaleStatus struct { - // actual number of observed instances of the scaled object. + // actual number of observed machines of the scaled object. Replicas int32 // label query over pods that should match the replicas count. diff --git a/pkg/apis/node/v1alpha1/defaults.go b/pkg/apis/machine/v1alpha1/defaults.go similarity index 100% rename from pkg/apis/node/v1alpha1/defaults.go rename to pkg/apis/machine/v1alpha1/defaults.go diff --git a/pkg/apis/node/v1alpha1/doc.go b/pkg/apis/machine/v1alpha1/doc.go similarity index 83% rename from pkg/apis/node/v1alpha1/doc.go rename to pkg/apis/machine/v1alpha1/doc.go index 674d4f1c4..b3d211494 100644 --- a/pkg/apis/node/v1alpha1/doc.go +++ b/pkg/apis/machine/v1alpha1/doc.go @@ -1,9 +1,9 @@ // +k8s:deepcopy-gen=package,register -// +k8s:conversion-gen=github.com/gardener/node-controller-manager/pkg/apis/node +// +k8s:conversion-gen=github.com/gardener/node-controller-manager/pkg/apis/machine // +k8s:openapi-gen=true // +k8s:defaulter-gen=TypeMeta // Package v1alpha1 defines all of the versioned (v1) definitions // of the shoot model. -// +groupName=node.sapcloud.io +// +groupName=machine.sapcloud.io package v1alpha1 diff --git a/pkg/apis/node/v1alpha1/register.go b/pkg/apis/machine/v1alpha1/register.go similarity index 89% rename from pkg/apis/node/v1alpha1/register.go rename to pkg/apis/machine/v1alpha1/register.go index a8d0a6314..e4710765a 100644 --- a/pkg/apis/node/v1alpha1/register.go +++ b/pkg/apis/machine/v1alpha1/register.go @@ -32,7 +32,7 @@ var ( ) // GroupName is the group name use in this package -const GroupName = "node.sapcloud.io" +const GroupName = "machine.sapcloud.io" // SchemeGroupVersion is group version used to register these objects var SchemeGroupVersion = schema.GroupVersion{Group: GroupName, Version: "v1alpha1"} @@ -52,17 +52,17 @@ func Resource(resource string) schema.GroupResource { // Adds the list of known types to api.Scheme. func addKnownTypes(scheme *runtime.Scheme) error { scheme.AddKnownTypes(SchemeGroupVersion, - &AWSInstanceClass{}, - &AWSInstanceClassList{}, + &AWSMachineClass{}, + &AWSMachineClassList{}, - &Instance{}, - &InstanceList{}, + &Machine{}, + &MachineList{}, - &InstanceSet{}, - &InstanceSetList{}, + &MachineSet{}, + &MachineSetList{}, - &InstanceDeployment{}, - &InstanceDeploymentList{}, + &MachineDeployment{}, + &MachineDeploymentList{}, ) metav1.AddToGroupVersion(scheme, SchemeGroupVersion) return nil diff --git a/pkg/apis/node/v1alpha1/types.go b/pkg/apis/machine/v1alpha1/types.go similarity index 75% rename from pkg/apis/node/v1alpha1/types.go rename to pkg/apis/machine/v1alpha1/types.go index 7809daddc..ffc4c16b0 100644 --- a/pkg/apis/node/v1alpha1/types.go +++ b/pkg/apis/machine/v1alpha1/types.go @@ -37,8 +37,8 @@ const ( // +genclient:nonNamespaced // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object -// AWSInstanceClass TODO -type AWSInstanceClass struct { +// AWSMachineClass TODO +type AWSMachineClass struct { // +optional metav1.ObjectMeta `json:"metadata,omitempty"` @@ -46,30 +46,30 @@ type AWSInstanceClass struct { metav1.TypeMeta `json:",inline"` // +optional - Spec AWSInstanceClassSpec `json:"spec,omitempty"` + Spec AWSMachineClassSpec `json:"spec,omitempty"` } // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object -// AWSInstanceClassList is a collection of AWSInstanceClasses. -type AWSInstanceClassList struct { +// AWSMachineClassList is a collection of AWSMachineClasses. +type AWSMachineClassList struct { metav1.TypeMeta `json:",inline"` // +optional metav1.ListMeta `json:"metadata,omitempty"` - Items []AWSInstanceClass `json:"items"` + Items []AWSMachineClass `json:"items"` } -// AWSInstanceClassSpec is the specification of a Shoot cluster. -type AWSInstanceClassSpec struct { +// AWSMachineClassSpec is the specification of a Shoot cluster. +type AWSMachineClassSpec struct { AMI string `json:"ami,omitempty"` AvailabilityZone string `json:"availabilityZone,omitempty"` BlockDevices []AWSBlockDeviceMappingSpec `json:"blockDevices,omitempty"` EbsOptimized bool `json:"ebsOptimized,omitempty"` IAM AWSIAMProfileSpec `json:"iam,omitempty"` - InstanceType string `json:"instanceType,omitempty"` + MachineType string `json:"machineType,omitempty"` KeyName string `json:"keyName,omitempty"` Monitoring bool `json:"monitoring,omitempty"` NetworkInterfaces []AWSNetworkInterfaceSpec `json:"networkInterfaces,omitempty"` @@ -81,10 +81,10 @@ type AWSInstanceClassSpec struct { type AWSBlockDeviceMappingSpec struct { - // The device name exposed to the instance (for example, /dev/sdh or xvdh). + // The device name exposed to the machine (for example, /dev/sdh or xvdh). DeviceName string `json:"deviceName,omitempty"` - // Parameters used to automatically set up EBS volumes when the instance is + // Parameters used to automatically set up EBS volumes when the machine is // launched. Ebs AWSEbsBlockDeviceSpec `json:"ebs,omitempty"` @@ -92,15 +92,15 @@ type AWSBlockDeviceMappingSpec struct { // AMI. NoDevice string `json:"noDevice,omitempty"` - // The virtual device name (ephemeralN). Instance store volumes are numbered - // starting from 0. An instance type with 2 available instance store volumes + // The virtual device name (ephemeralN). Machine store volumes are numbered + // starting from 0. An machine type with 2 available machine store volumes // can specify mappings for ephemeral0 and ephemeral1.The number of available - // instance store volumes depends on the instance type. After you connect to - // the instance, you must mount the volume. + // machine store volumes depends on the machine type. After you connect to + // the machine, you must mount the volume. // - // Constraints: For M3 instances, you must specify instance store volumes in - // the block device mapping for the instance. When you launch an M3 instance, - // we ignore any instance store volumes specified in the block device mapping + // Constraints: For M3 machines, you must specify machine store volumes in + // the block device mapping for the machine. When you launch an M3 machine, + // we ignore any machine store volumes specified in the block device mapping // for the AMI. VirtualName string `json:"virtualName,omitempty"` } @@ -109,11 +109,11 @@ type AWSBlockDeviceMappingSpec struct { // Please also see https://docs.aws.amazon.com/goto/WebAPI/ec2-2016-11-15/EbsBlockDevice type AWSEbsBlockDeviceSpec struct { - // Indicates whether the EBS volume is deleted on instance termination. + // Indicates whether the EBS volume is deleted on machine termination. DeleteOnTermination bool `json:"deleteOnTermination,omitempty"` // Indicates whether the EBS volume is encrypted. Encrypted Amazon EBS volumes - // may only be attached to instances that support Amazon EBS encryption. + // may only be attached to machines that support Amazon EBS encryption. Encrypted bool `json:"encrypted,omitempty"` // The number of I/O operations per second (IOPS) that the volume supports. @@ -149,76 +149,76 @@ type AWSEbsBlockDeviceSpec struct { VolumeType string `json:"volumeType,omitempty"` } -// Describes an IAM instance profile. +// Describes an IAM machine profile. type AWSIAMProfileSpec struct { - // The Amazon Resource Name (ARN) of the instance profile. + // The Amazon Resource Name (ARN) of the machine profile. ARN string `json:"arn,omitempty"` - // The name of the instance profile. + // The name of the machine profile. Name string `json:"name,omitempty"` } // Describes a network interface. -// Please also see https://docs.aws.amazon.com/goto/WebAPI/ec2-2016-11-15/InstanceAWSNetworkInterfaceSpecification +// Please also see https://docs.aws.amazon.com/goto/WebAPI/ec2-2016-11-15/MachineAWSNetworkInterfaceSpecification type AWSNetworkInterfaceSpec struct { - // Indicates whether to assign a public IPv4 address to an instance you launch + // Indicates whether to assign a public IPv4 address to an machine you launch // in a VPC. The public IP address can only be assigned to a network interface // for eth0, and can only be assigned to a new network interface, not an existing // one. You cannot specify more than one network interface in the request. If // launching into a default subnet, the default value is true. AssociatePublicIPAddress bool `json:"associatePublicIPAddress,omitempty"` - // If set to true, the interface is deleted when the instance is terminated. + // If set to true, the interface is deleted when the machine is terminated. // You can specify true only if creating a new network interface when launching - // an instance. + // an machine. DeleteOnTermination bool `json:"deleteOnTermination,omitempty"` // The description of the network interface. Applies only if creating a network - // interface when launching an instance. + // interface when launching an machine. Description string `json:"description,omitempty"` // The IDs of the security groups for the network interface. Applies only if - // creating a network interface when launching an instance. + // creating a network interface when launching an machine. SecurityGroupID []string `json:"securityGroupID,omitempty"` // The ID of the subnet associated with the network string. Applies only if - // creating a network interface when launching an instance. + // creating a network interface when launching an machine. SubnetID string `json:"subnetID,omitempty"` } -// InstancePhase is a label for the condition of a instances at the current time. -type InstancePhase string +// MachinePhase is a label for the condition of a machines at the current time. +type MachinePhase string -// These are the valid statuses of instances. +// These are the valid statuses of machines. const ( - // InstancePending means that the instance is being created - InstancePending InstancePhase = "Pending" - // InstancePending means that instance is present on provider but hasn't joined cluster yet - InstanceAvailable InstancePhase = "Available" - // InstanceRunning means node is ready and running succesfully - InstanceRunning InstancePhase = "Running" - // InstanceRunning means node is terminating - InstanceTerminating InstancePhase = "Terminating" - // InstanceUnknown indicates that the node is not ready at the movement - InstanceUnknown InstancePhase = "Unknown" - // InstanceFailed means operation failed leading to instance status failure - InstanceFailed InstancePhase = "Failed" + // MachinePending means that the machine is being created + MachinePending MachinePhase = "Pending" + // MachinePending means that machine is present on provider but hasn't joined cluster yet + MachineAvailable MachinePhase = "Available" + // MachineRunning means node is ready and running succesfully + MachineRunning MachinePhase = "Running" + // MachineRunning means node is terminating + MachineTerminating MachinePhase = "Terminating" + // MachineUnknown indicates that the node is not ready at the movement + MachineUnknown MachinePhase = "Unknown" + // MachineFailed means operation failed leading to machine status failure + MachineFailed MachinePhase = "Failed" ) -// InstancePhase is a label for the condition of a instances at the current time. -type InstanceState string +// MachinePhase is a label for the condition of a machines at the current time. +type MachineState string -// These are the valid statuses of instances. +// These are the valid statuses of machines. const ( - // InstancePending means there are operations pending on this instance state - InstanceStateProcessing InstanceState = "Processing" - // InstanceFailed means operation failed leading to instance status failure - InstanceStateFailed InstanceState = "Failed" - // InstanceUnknown indicates that the node is not ready at the movement - InstanceStateSuccessful InstanceState = "Successful" + // MachinePending means there are operations pending on this machine state + MachineStateProcessing MachineState = "Processing" + // MachineFailed means operation failed leading to machine status failure + MachineStateFailed MachineState = "Failed" + // MachineUnknown indicates that the node is not ready at the movement + MachineStateSuccessful MachineState = "Successful" ) // The below types are used by kube_client and api_server. @@ -241,8 +241,8 @@ const ( // +genclient:noStatus // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object -// Instance TODO -type Instance struct { +// Machine TODO +type Machine struct { // +optional metav1.ObjectMeta `json:"metadata,omitempty"` @@ -250,26 +250,26 @@ type Instance struct { metav1.TypeMeta `json:",inline"` // +optional - Spec InstanceSpec `json:"spec,omitempty"` + Spec MachineSpec `json:"spec,omitempty"` // +optional - Status InstanceStatus `json:"status,omitempty"` + Status MachineStatus `json:"status,omitempty"` } // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object -// InstanceList is a collection of Instances. -type InstanceList struct { +// MachineList is a collection of Machines. +type MachineList struct { metav1.TypeMeta `json:",inline"` // +optional metav1.ListMeta `json:"metadata,omitempty"` - Items []Instance `json:"items"` + Items []Machine `json:"items"` } -// InstanceSpec is the specification of a Shoot cluster. -type InstanceSpec struct { +// MachineSpec is the specification of a Shoot cluster. +type MachineSpec struct { // +optional Class ClassSpec `json:"class,omitempty"` @@ -280,7 +280,7 @@ type InstanceSpec struct { // PodTemplateSpec describes the data a pod should have when created from a template -type InstanceTemplateSpec struct { +type MachineTemplateSpec struct { // Standard object's metadata. // More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#metadata // +optional @@ -289,14 +289,14 @@ type InstanceTemplateSpec struct { // Specification of the desired behavior of the pod. // More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#spec-and-status // +optional - Spec InstanceSpec `json:"spec,omitempty" protobuf:"bytes,2,opt,name=spec"` + Spec MachineSpec `json:"spec,omitempty" protobuf:"bytes,2,opt,name=spec"` } // +genclient // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object // PodTemplate describes a template for creating copies of a predefined pod. -type InstanceTemplate struct { +type MachineTemplate struct { metav1.TypeMeta `json:",inline"` // Standard object's metadata. // More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#metadata @@ -306,13 +306,13 @@ type InstanceTemplate struct { // Template defines the pods that will be created from this pod template. // https://git.k8s.io/community/contributors/devel/api-conventions.md#spec-and-status // +optional - Template InstanceTemplateSpec `json:"template,omitempty" protobuf:"bytes,2,opt,name=template"` + Template MachineTemplateSpec `json:"template,omitempty" protobuf:"bytes,2,opt,name=template"` } // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object // PodTemplateList is a list of PodTemplates. -type InstanceTemplateList struct { +type MachineTemplateList struct { metav1.TypeMeta `json:",inline"` // Standard list metadata. // More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#types-kinds @@ -320,39 +320,39 @@ type InstanceTemplateList struct { metav1.ListMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` // List of pod templates - Items []InstanceTemplate `json:"items" protobuf:"bytes,2,rep,name=items"` + Items []MachineTemplate `json:"items" protobuf:"bytes,2,rep,name=items"` } -// ClassSpec is the class specification of instance +// ClassSpec is the class specification of machine type ClassSpec struct { // API group to which it belongs APIGroup string `json:"apiGroup,omitempty"` - // Kind for instance class + // Kind for machine class Kind string `json:"kind,omitempty"` - // Name of instance class + // Name of machine class Name string `json:"name,omitempty"` } //type CurrentStatus type CurrentStatus struct { // API group to which it belongs - Phase InstancePhase `json:"phase,omitempty" protobuf:"bytes,1,opt,name=phase,casttype=InstancePhase"` - // Name of instance class + Phase MachinePhase `json:"phase,omitempty" protobuf:"bytes,1,opt,name=phase,casttype=MachinePhase"` + // Name of machine class TimeoutActive bool `json:"timeoutActive,omitempty"` // Last update time of current status LastUpdateTime metav1.Time `json:"lastUpdateTime,omitempty"` } -// InstanceStatus TODO -type InstanceStatus struct { +// MachineStatus TODO +type MachineStatus struct { // Node string Node string `json:"node,omitempty"` - // Conditions of this instance, same as node + // Conditions of this machine, same as node Conditions []corev1.NodeCondition `json:"conditions,omitempty"` // Last operation refers to the status of the last operation performed LastOperation LastOperation `json:"lastOperation,omitempty"` - // Current status of the instance object + // Current status of the machine object CurrentStatus CurrentStatus `json:"currentStatus,omitempty"` } @@ -363,7 +363,7 @@ type LastOperation struct { // Last update time of current operation LastUpdateTime metav1.Time `json:"lastUpdateTime,omitempty"` // State of operation - State InstanceState `json:"state,omitempty"` + State MachineState `json:"state,omitempty"` // Type of operation Type string `json:"type,omitempty"` } @@ -372,8 +372,8 @@ type LastOperation struct { // +genclient:nonNamespaced // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object -// InstanceSet TODO -type InstanceSet struct { +// MachineSet TODO +type MachineSet struct { // +optional metav1.ObjectMeta `json:"metadata,omitempty"` @@ -381,54 +381,54 @@ type InstanceSet struct { metav1.TypeMeta `json:",inline"` // +optional - Spec InstanceSetSpec `json:"spec,omitempty"` + Spec MachineSetSpec `json:"spec,omitempty"` // +optional - Status InstanceSetStatus `json:"status,omitempty"` + Status MachineSetStatus `json:"status,omitempty"` } // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object -// InstanceSetList is a collection of InstanceSet. -type InstanceSetList struct { +// MachineSetList is a collection of MachineSet. +type MachineSetList struct { metav1.TypeMeta `json:",inline"` // +optional metav1.ListMeta `json:"metadata,omitempty"` - Items []InstanceSet `json:"items"` + Items []MachineSet `json:"items"` } -// InstanceSetSpec is the specification of a Shoot cluster. -type InstanceSetSpec struct { +// MachineSetSpec is the specification of a Shoot cluster. +type MachineSetSpec struct { Replicas int32 `json:"replicas,inline"` Selector *metav1.LabelSelector `json:"selector,omitempty"` - InstanceClass ClassSpec `json:"instanceClass,omitempty"` + MachineClass ClassSpec `json:"machineClass,omitempty"` // +optional - Template InstanceTemplateSpec `json:"template,omitempty" protobuf:"bytes,2,opt,name=template"` + Template MachineTemplateSpec `json:"template,omitempty" protobuf:"bytes,2,opt,name=template"` MinReadySeconds int32 `json:"minReadySeconds,inline"` } -type InstanceSetConditionType string +type MachineSetConditionType string -// These are valid conditions of a instance set. +// These are valid conditions of a machine set. const ( - // ReplicaSetReplicaFailure is added in a instance set when one of its pods fails to be created + // ReplicaSetReplicaFailure is added in a machine set when one of its pods fails to be created // due to insufficient quota, limit ranges, pod security policy, node selectors, etc. or deleted // due to kubelet being down or finalizers are failing. - InstanceSetReplicaFailure InstanceSetConditionType = "ReplicaFailure" + MachineSetReplicaFailure MachineSetConditionType = "ReplicaFailure" ) -// ReplicaSetCondition describes the state of a instance set at a certain point. -type InstanceSetCondition struct { - // Type of instance set condition. - Type InstanceSetConditionType `json:"type" protobuf:"bytes,1,opt,name=type,casttype=ReplicaSetConditionType"` +// ReplicaSetCondition describes the state of a machine set at a certain point. +type MachineSetCondition struct { + // Type of machine set condition. + Type MachineSetConditionType `json:"type" protobuf:"bytes,1,opt,name=type,casttype=ReplicaSetConditionType"` // Status of the condition, one of True, False, Unknown. Status ConditionStatus `json:"status" protobuf:"bytes,2,opt,name=status,casttype=k8s.io/api/core/v1.ConditionStatus"` // The last time the condition transitioned from one status to another. @@ -442,9 +442,9 @@ type InstanceSetCondition struct { Message string `json:"message,omitempty" protobuf:"bytes,5,opt,name=message"` } -// InstanceSetStatus TODO -type InstanceSetStatus struct { - // Conditions of this instance, same as node +// MachineSetStatus TODO +type MachineSetStatus struct { + // Conditions of this machine, same as node LastOperation LastOperation `json:"lastOperation,omitempty"` Replicas int32 `json:"replicas,inline"` @@ -455,12 +455,12 @@ type InstanceSetStatus struct { AvailableReplicas int32 `json:"availableReplicas,inline"` - Conditions []InstanceSetCondition `json:"instanceSetCondition,inline"` + Conditions []MachineSetCondition `json:"machineSetCondition,inline"` ObservedGeneration int64 `json:"observedGeneration,inline"` } -/********************** InstanceDeployment APIs ***************/ +/********************** MachineDeployment APIs ***************/ // +genclient // +genclient:nonNamespaced @@ -471,7 +471,7 @@ type InstanceSetStatus struct { // DEPRECATED - This group version of Deployment is deprecated by apps/v1beta2/Deployment. See the release notes for // more information. // Deployment enables declarative updates for Pods and ReplicaSets. -type InstanceDeployment struct { +type MachineDeployment struct { metav1.TypeMeta `json:",inline"` // Standard object metadata. // +optional @@ -479,15 +479,15 @@ type InstanceDeployment struct { // Specification of the desired behavior of the Deployment. // +optional - Spec InstanceDeploymentSpec `json:"spec,omitempty"` + Spec MachineDeploymentSpec `json:"spec,omitempty"` // Most recently observed status of the Deployment. // +optional - Status InstanceDeploymentStatus `json:"status,omitempty"` + Status MachineDeploymentStatus `json:"status,omitempty"` } // DeploymentSpec is the specification of the desired behavior of the Deployment. -type InstanceDeploymentSpec struct { +type MachineDeploymentSpec struct { // Number of desired pods. This is a pointer to distinguish between explicit // zero and not specified. Defaults to 1. // +optional @@ -499,12 +499,12 @@ type InstanceDeploymentSpec struct { Selector *metav1.LabelSelector `json:"selector,omitempty" protobuf:"bytes,2,opt,name=selector"` // Template describes the pods that will be created. - Template InstanceTemplateSpec `json:"template" protobuf:"bytes,3,opt,name=template"` + Template MachineTemplateSpec `json:"template" protobuf:"bytes,3,opt,name=template"` // The deployment strategy to use to replace existing pods with new ones. // +optional // +patchStrategy=retainKeys - Strategy InstanceDeploymentStrategy `json:"strategy,omitempty" patchStrategy:"retainKeys" protobuf:"bytes,4,opt,name=strategy"` + Strategy MachineDeploymentStrategy `json:"strategy,omitempty" patchStrategy:"retainKeys" protobuf:"bytes,4,opt,name=strategy"` // Minimum number of seconds for which a newly created pod should be ready // without any of its container crashing, for it to be considered available. @@ -541,7 +541,7 @@ type InstanceDeploymentSpec struct { // DEPRECATED. // DeploymentRollback stores the information required to rollback a deployment. -type InstanceDeploymentRollback struct { +type MachineDeploymentRollback struct { metav1.TypeMeta `json:",inline"` // Required: This must match the Name of a deployment. Name string `json:"name" protobuf:"bytes,1,opt,name=name"` @@ -563,14 +563,14 @@ const ( // DefaultDeploymentUniqueLabelKey is the default key of the selector that is added // to existing RCs (and label key that is added to its pods) to prevent the existing RCs // to select new pods (and old pods being select by new RC). - DefaultInstanceDeploymentUniqueLabelKey string = "pod-template-hash" + DefaultMachineDeploymentUniqueLabelKey string = "pod-template-hash" ) // DeploymentStrategy describes how to replace existing pods with new ones. -type InstanceDeploymentStrategy struct { +type MachineDeploymentStrategy struct { // Type of deployment. Can be "Recreate" or "RollingUpdate". Default is RollingUpdate. // +optional - Type InstanceDeploymentStrategyType `json:"type,omitempty" protobuf:"bytes,1,opt,name=type,casttype=DeploymentStrategyType"` + Type MachineDeploymentStrategyType `json:"type,omitempty" protobuf:"bytes,1,opt,name=type,casttype=DeploymentStrategyType"` // Rolling update config params. Present only if DeploymentStrategyType = // RollingUpdate. @@ -578,21 +578,21 @@ type InstanceDeploymentStrategy struct { // TODO: Update this to follow our convention for oneOf, whatever we decide it // to be. // +optional - RollingUpdate *RollingUpdateInstanceDeployment `json:"rollingUpdate,omitempty" protobuf:"bytes,2,opt,name=rollingUpdate"` + RollingUpdate *RollingUpdateMachineDeployment `json:"rollingUpdate,omitempty" protobuf:"bytes,2,opt,name=rollingUpdate"` } -type InstanceDeploymentStrategyType string +type MachineDeploymentStrategyType string const ( // Kill all existing pods before creating new ones. - RecreateInstanceDeploymentStrategyType InstanceDeploymentStrategyType = "Recreate" + RecreateMachineDeploymentStrategyType MachineDeploymentStrategyType = "Recreate" // Replace the old RCs by new one using rolling update i.e gradually scale down the old RCs and scale up the new one. - RollingUpdateInstanceDeploymentStrategyType InstanceDeploymentStrategyType = "RollingUpdate" + RollingUpdateMachineDeploymentStrategyType MachineDeploymentStrategyType = "RollingUpdate" ) // Spec to control the desired behavior of rolling update. -type RollingUpdateInstanceDeployment struct { +type RollingUpdateMachineDeployment struct { // The maximum number of pods that can be unavailable during the update. // Value can be an absolute number (ex: 5) or a percentage of desired pods (ex: 10%). // Absolute number is calculated from percentage by rounding down. @@ -622,7 +622,7 @@ type RollingUpdateInstanceDeployment struct { } // DeploymentStatus is the most recently observed status of the Deployment. -type InstanceDeploymentStatus struct { +type MachineDeploymentStatus struct { // The generation observed by the deployment controller. // +optional ObservedGeneration int64 `json:"observedGeneration,omitempty" protobuf:"varint,1,opt,name=observedGeneration"` @@ -652,7 +652,7 @@ type InstanceDeploymentStatus struct { // Represents the latest available observations of a deployment's current state. // +patchMergeKey=type // +patchStrategy=merge - Conditions []InstanceDeploymentCondition `json:"conditions,omitempty" patchStrategy:"merge" patchMergeKey:"type" protobuf:"bytes,6,rep,name=conditions"` + Conditions []MachineDeploymentCondition `json:"conditions,omitempty" patchStrategy:"merge" patchMergeKey:"type" protobuf:"bytes,6,rep,name=conditions"` // Count of hash collisions for the Deployment. The Deployment controller uses this // field as a collision avoidance mechanism when it needs to create the name for the @@ -661,27 +661,27 @@ type InstanceDeploymentStatus struct { CollisionCount *int32 `json:"collisionCount,omitempty" protobuf:"varint,8,opt,name=collisionCount"` } -type InstanceDeploymentConditionType string +type MachineDeploymentConditionType string // These are valid conditions of a deployment. const ( // Available means the deployment is available, ie. at least the minimum available // replicas required are up and running for at least minReadySeconds. - InstanceDeploymentAvailable InstanceDeploymentConditionType = "Available" + MachineDeploymentAvailable MachineDeploymentConditionType = "Available" // Progressing means the deployment is progressing. Progress for a deployment is - // considered when a new instance set is created or adopted, and when new pods scale + // considered when a new machine set is created or adopted, and when new pods scale // up or old pods scale down. Progress is not estimated for paused deployments or // when progressDeadlineSeconds is not specified. - InstanceDeploymentProgressing InstanceDeploymentConditionType = "Progressing" + MachineDeploymentProgressing MachineDeploymentConditionType = "Progressing" // ReplicaFailure is added in a deployment when one of its pods fails to be created // or deleted. - InstanceDeploymentReplicaFailure InstanceDeploymentConditionType = "ReplicaFailure" + MachineDeploymentReplicaFailure MachineDeploymentConditionType = "ReplicaFailure" ) // DeploymentCondition describes the state of a deployment at a certain point. -type InstanceDeploymentCondition struct { +type MachineDeploymentCondition struct { // Type of deployment condition. - Type InstanceDeploymentConditionType `json:"type" protobuf:"bytes,1,opt,name=type,casttype=InstanceDeploymentConditionType"` + Type MachineDeploymentConditionType `json:"type" protobuf:"bytes,1,opt,name=type,casttype=MachineDeploymentConditionType"` // Status of the condition, one of True, False, Unknown. Status ConditionStatus `json:"status" protobuf:"bytes,2,opt,name=status,casttype=corev1.ConditionStatus"` // The last time this condition was updated. @@ -697,26 +697,26 @@ type InstanceDeploymentCondition struct { // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object // DeploymentList is a list of Deployments. -type InstanceDeploymentList struct { +type MachineDeploymentList struct { metav1.TypeMeta `json:",inline"` // Standard list metadata. // +optional metav1.ListMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` // Items is the list of Deployments. - Items []InstanceDeployment `json:"items" protobuf:"bytes,2,rep,name=items"` + Items []MachineDeployment `json:"items" protobuf:"bytes,2,rep,name=items"` } // describes the attributes of a scale subresource type ScaleSpec struct { - // desired number of instances for the scaled object. + // desired number of machines for the scaled object. // +optional Replicas int32 `json:"replicas,omitempty" protobuf:"varint,1,opt,name=replicas"` } // represents the current status of a scale subresource. type ScaleStatus struct { - // actual number of observed instances of the scaled object. + // actual number of observed machines of the scaled object. Replicas int32 `json:"replicas" protobuf:"varint,1,opt,name=replicas"` // label query over pods that should match the replicas count. More info: http://kubernetes.io/docs/user-guide/labels#label-selectors diff --git a/pkg/apis/machine/v1alpha1/zz_generated.conversion.go b/pkg/apis/machine/v1alpha1/zz_generated.conversion.go new file mode 100644 index 000000000..e7493d02c --- /dev/null +++ b/pkg/apis/machine/v1alpha1/zz_generated.conversion.go @@ -0,0 +1,1060 @@ +// +build !ignore_autogenerated + +// This file was autogenerated by conversion-gen. Do not edit it manually! + +package v1alpha1 + +import ( + machine "github.com/gardener/node-controller-manager/pkg/apis/machine" + v1 "k8s.io/api/core/v1" + meta_v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + conversion "k8s.io/apimachinery/pkg/conversion" + runtime "k8s.io/apimachinery/pkg/runtime" + intstr "k8s.io/apimachinery/pkg/util/intstr" + unsafe "unsafe" +) + +func init() { + localSchemeBuilder.Register(RegisterConversions) +} + +// RegisterConversions adds conversion functions to the given scheme. +// Public to allow building arbitrary schemes. +func RegisterConversions(scheme *runtime.Scheme) error { + return scheme.AddGeneratedConversionFuncs( + Convert_v1alpha1_AWSBlockDeviceMappingSpec_To_machine_AWSBlockDeviceMappingSpec, + Convert_machine_AWSBlockDeviceMappingSpec_To_v1alpha1_AWSBlockDeviceMappingSpec, + Convert_v1alpha1_AWSEbsBlockDeviceSpec_To_machine_AWSEbsBlockDeviceSpec, + Convert_machine_AWSEbsBlockDeviceSpec_To_v1alpha1_AWSEbsBlockDeviceSpec, + Convert_v1alpha1_AWSIAMProfileSpec_To_machine_AWSIAMProfileSpec, + Convert_machine_AWSIAMProfileSpec_To_v1alpha1_AWSIAMProfileSpec, + Convert_v1alpha1_AWSMachineClass_To_machine_AWSMachineClass, + Convert_machine_AWSMachineClass_To_v1alpha1_AWSMachineClass, + Convert_v1alpha1_AWSMachineClassList_To_machine_AWSMachineClassList, + Convert_machine_AWSMachineClassList_To_v1alpha1_AWSMachineClassList, + Convert_v1alpha1_AWSMachineClassSpec_To_machine_AWSMachineClassSpec, + Convert_machine_AWSMachineClassSpec_To_v1alpha1_AWSMachineClassSpec, + Convert_v1alpha1_AWSNetworkInterfaceSpec_To_machine_AWSNetworkInterfaceSpec, + Convert_machine_AWSNetworkInterfaceSpec_To_v1alpha1_AWSNetworkInterfaceSpec, + Convert_v1alpha1_ClassSpec_To_machine_ClassSpec, + Convert_machine_ClassSpec_To_v1alpha1_ClassSpec, + Convert_v1alpha1_CurrentStatus_To_machine_CurrentStatus, + Convert_machine_CurrentStatus_To_v1alpha1_CurrentStatus, + Convert_v1alpha1_LastOperation_To_machine_LastOperation, + Convert_machine_LastOperation_To_v1alpha1_LastOperation, + Convert_v1alpha1_Machine_To_machine_Machine, + Convert_machine_Machine_To_v1alpha1_Machine, + Convert_v1alpha1_MachineDeployment_To_machine_MachineDeployment, + Convert_machine_MachineDeployment_To_v1alpha1_MachineDeployment, + Convert_v1alpha1_MachineDeploymentCondition_To_machine_MachineDeploymentCondition, + Convert_machine_MachineDeploymentCondition_To_v1alpha1_MachineDeploymentCondition, + Convert_v1alpha1_MachineDeploymentList_To_machine_MachineDeploymentList, + Convert_machine_MachineDeploymentList_To_v1alpha1_MachineDeploymentList, + Convert_v1alpha1_MachineDeploymentRollback_To_machine_MachineDeploymentRollback, + Convert_machine_MachineDeploymentRollback_To_v1alpha1_MachineDeploymentRollback, + Convert_v1alpha1_MachineDeploymentSpec_To_machine_MachineDeploymentSpec, + Convert_machine_MachineDeploymentSpec_To_v1alpha1_MachineDeploymentSpec, + Convert_v1alpha1_MachineDeploymentStatus_To_machine_MachineDeploymentStatus, + Convert_machine_MachineDeploymentStatus_To_v1alpha1_MachineDeploymentStatus, + Convert_v1alpha1_MachineDeploymentStrategy_To_machine_MachineDeploymentStrategy, + Convert_machine_MachineDeploymentStrategy_To_v1alpha1_MachineDeploymentStrategy, + Convert_v1alpha1_MachineList_To_machine_MachineList, + Convert_machine_MachineList_To_v1alpha1_MachineList, + Convert_v1alpha1_MachineSet_To_machine_MachineSet, + Convert_machine_MachineSet_To_v1alpha1_MachineSet, + Convert_v1alpha1_MachineSetCondition_To_machine_MachineSetCondition, + Convert_machine_MachineSetCondition_To_v1alpha1_MachineSetCondition, + Convert_v1alpha1_MachineSetList_To_machine_MachineSetList, + Convert_machine_MachineSetList_To_v1alpha1_MachineSetList, + Convert_v1alpha1_MachineSetSpec_To_machine_MachineSetSpec, + Convert_machine_MachineSetSpec_To_v1alpha1_MachineSetSpec, + Convert_v1alpha1_MachineSetStatus_To_machine_MachineSetStatus, + Convert_machine_MachineSetStatus_To_v1alpha1_MachineSetStatus, + Convert_v1alpha1_MachineSpec_To_machine_MachineSpec, + Convert_machine_MachineSpec_To_v1alpha1_MachineSpec, + Convert_v1alpha1_MachineStatus_To_machine_MachineStatus, + Convert_machine_MachineStatus_To_v1alpha1_MachineStatus, + Convert_v1alpha1_MachineTemplate_To_machine_MachineTemplate, + Convert_machine_MachineTemplate_To_v1alpha1_MachineTemplate, + Convert_v1alpha1_MachineTemplateList_To_machine_MachineTemplateList, + Convert_machine_MachineTemplateList_To_v1alpha1_MachineTemplateList, + Convert_v1alpha1_MachineTemplateSpec_To_machine_MachineTemplateSpec, + Convert_machine_MachineTemplateSpec_To_v1alpha1_MachineTemplateSpec, + Convert_v1alpha1_RollbackConfig_To_machine_RollbackConfig, + Convert_machine_RollbackConfig_To_v1alpha1_RollbackConfig, + Convert_v1alpha1_RollingUpdateMachineDeployment_To_machine_RollingUpdateMachineDeployment, + Convert_machine_RollingUpdateMachineDeployment_To_v1alpha1_RollingUpdateMachineDeployment, + Convert_v1alpha1_Scale_To_machine_Scale, + Convert_machine_Scale_To_v1alpha1_Scale, + Convert_v1alpha1_ScaleSpec_To_machine_ScaleSpec, + Convert_machine_ScaleSpec_To_v1alpha1_ScaleSpec, + Convert_v1alpha1_ScaleStatus_To_machine_ScaleStatus, + Convert_machine_ScaleStatus_To_v1alpha1_ScaleStatus, + ) +} + +func autoConvert_v1alpha1_AWSBlockDeviceMappingSpec_To_machine_AWSBlockDeviceMappingSpec(in *AWSBlockDeviceMappingSpec, out *machine.AWSBlockDeviceMappingSpec, s conversion.Scope) error { + out.DeviceName = in.DeviceName + if err := Convert_v1alpha1_AWSEbsBlockDeviceSpec_To_machine_AWSEbsBlockDeviceSpec(&in.Ebs, &out.Ebs, s); err != nil { + return err + } + out.NoDevice = in.NoDevice + out.VirtualName = in.VirtualName + return nil +} + +// Convert_v1alpha1_AWSBlockDeviceMappingSpec_To_machine_AWSBlockDeviceMappingSpec is an autogenerated conversion function. +func Convert_v1alpha1_AWSBlockDeviceMappingSpec_To_machine_AWSBlockDeviceMappingSpec(in *AWSBlockDeviceMappingSpec, out *machine.AWSBlockDeviceMappingSpec, s conversion.Scope) error { + return autoConvert_v1alpha1_AWSBlockDeviceMappingSpec_To_machine_AWSBlockDeviceMappingSpec(in, out, s) +} + +func autoConvert_machine_AWSBlockDeviceMappingSpec_To_v1alpha1_AWSBlockDeviceMappingSpec(in *machine.AWSBlockDeviceMappingSpec, out *AWSBlockDeviceMappingSpec, s conversion.Scope) error { + out.DeviceName = in.DeviceName + if err := Convert_machine_AWSEbsBlockDeviceSpec_To_v1alpha1_AWSEbsBlockDeviceSpec(&in.Ebs, &out.Ebs, s); err != nil { + return err + } + out.NoDevice = in.NoDevice + out.VirtualName = in.VirtualName + return nil +} + +// Convert_machine_AWSBlockDeviceMappingSpec_To_v1alpha1_AWSBlockDeviceMappingSpec is an autogenerated conversion function. +func Convert_machine_AWSBlockDeviceMappingSpec_To_v1alpha1_AWSBlockDeviceMappingSpec(in *machine.AWSBlockDeviceMappingSpec, out *AWSBlockDeviceMappingSpec, s conversion.Scope) error { + return autoConvert_machine_AWSBlockDeviceMappingSpec_To_v1alpha1_AWSBlockDeviceMappingSpec(in, out, s) +} + +func autoConvert_v1alpha1_AWSEbsBlockDeviceSpec_To_machine_AWSEbsBlockDeviceSpec(in *AWSEbsBlockDeviceSpec, out *machine.AWSEbsBlockDeviceSpec, s conversion.Scope) error { + out.DeleteOnTermination = in.DeleteOnTermination + out.Encrypted = in.Encrypted + out.Iops = in.Iops + out.VolumeSize = in.VolumeSize + out.VolumeType = in.VolumeType + return nil +} + +// Convert_v1alpha1_AWSEbsBlockDeviceSpec_To_machine_AWSEbsBlockDeviceSpec is an autogenerated conversion function. +func Convert_v1alpha1_AWSEbsBlockDeviceSpec_To_machine_AWSEbsBlockDeviceSpec(in *AWSEbsBlockDeviceSpec, out *machine.AWSEbsBlockDeviceSpec, s conversion.Scope) error { + return autoConvert_v1alpha1_AWSEbsBlockDeviceSpec_To_machine_AWSEbsBlockDeviceSpec(in, out, s) +} + +func autoConvert_machine_AWSEbsBlockDeviceSpec_To_v1alpha1_AWSEbsBlockDeviceSpec(in *machine.AWSEbsBlockDeviceSpec, out *AWSEbsBlockDeviceSpec, s conversion.Scope) error { + out.DeleteOnTermination = in.DeleteOnTermination + out.Encrypted = in.Encrypted + out.Iops = in.Iops + out.VolumeSize = in.VolumeSize + out.VolumeType = in.VolumeType + return nil +} + +// Convert_machine_AWSEbsBlockDeviceSpec_To_v1alpha1_AWSEbsBlockDeviceSpec is an autogenerated conversion function. +func Convert_machine_AWSEbsBlockDeviceSpec_To_v1alpha1_AWSEbsBlockDeviceSpec(in *machine.AWSEbsBlockDeviceSpec, out *AWSEbsBlockDeviceSpec, s conversion.Scope) error { + return autoConvert_machine_AWSEbsBlockDeviceSpec_To_v1alpha1_AWSEbsBlockDeviceSpec(in, out, s) +} + +func autoConvert_v1alpha1_AWSIAMProfileSpec_To_machine_AWSIAMProfileSpec(in *AWSIAMProfileSpec, out *machine.AWSIAMProfileSpec, s conversion.Scope) error { + out.ARN = in.ARN + out.Name = in.Name + return nil +} + +// Convert_v1alpha1_AWSIAMProfileSpec_To_machine_AWSIAMProfileSpec is an autogenerated conversion function. +func Convert_v1alpha1_AWSIAMProfileSpec_To_machine_AWSIAMProfileSpec(in *AWSIAMProfileSpec, out *machine.AWSIAMProfileSpec, s conversion.Scope) error { + return autoConvert_v1alpha1_AWSIAMProfileSpec_To_machine_AWSIAMProfileSpec(in, out, s) +} + +func autoConvert_machine_AWSIAMProfileSpec_To_v1alpha1_AWSIAMProfileSpec(in *machine.AWSIAMProfileSpec, out *AWSIAMProfileSpec, s conversion.Scope) error { + out.ARN = in.ARN + out.Name = in.Name + return nil +} + +// Convert_machine_AWSIAMProfileSpec_To_v1alpha1_AWSIAMProfileSpec is an autogenerated conversion function. +func Convert_machine_AWSIAMProfileSpec_To_v1alpha1_AWSIAMProfileSpec(in *machine.AWSIAMProfileSpec, out *AWSIAMProfileSpec, s conversion.Scope) error { + return autoConvert_machine_AWSIAMProfileSpec_To_v1alpha1_AWSIAMProfileSpec(in, out, s) +} + +func autoConvert_v1alpha1_AWSMachineClass_To_machine_AWSMachineClass(in *AWSMachineClass, out *machine.AWSMachineClass, s conversion.Scope) error { + out.ObjectMeta = in.ObjectMeta + if err := Convert_v1alpha1_AWSMachineClassSpec_To_machine_AWSMachineClassSpec(&in.Spec, &out.Spec, s); err != nil { + return err + } + return nil +} + +// Convert_v1alpha1_AWSMachineClass_To_machine_AWSMachineClass is an autogenerated conversion function. +func Convert_v1alpha1_AWSMachineClass_To_machine_AWSMachineClass(in *AWSMachineClass, out *machine.AWSMachineClass, s conversion.Scope) error { + return autoConvert_v1alpha1_AWSMachineClass_To_machine_AWSMachineClass(in, out, s) +} + +func autoConvert_machine_AWSMachineClass_To_v1alpha1_AWSMachineClass(in *machine.AWSMachineClass, out *AWSMachineClass, s conversion.Scope) error { + out.ObjectMeta = in.ObjectMeta + if err := Convert_machine_AWSMachineClassSpec_To_v1alpha1_AWSMachineClassSpec(&in.Spec, &out.Spec, s); err != nil { + return err + } + return nil +} + +// Convert_machine_AWSMachineClass_To_v1alpha1_AWSMachineClass is an autogenerated conversion function. +func Convert_machine_AWSMachineClass_To_v1alpha1_AWSMachineClass(in *machine.AWSMachineClass, out *AWSMachineClass, s conversion.Scope) error { + return autoConvert_machine_AWSMachineClass_To_v1alpha1_AWSMachineClass(in, out, s) +} + +func autoConvert_v1alpha1_AWSMachineClassList_To_machine_AWSMachineClassList(in *AWSMachineClassList, out *machine.AWSMachineClassList, s conversion.Scope) error { + out.ListMeta = in.ListMeta + out.Items = *(*[]machine.AWSMachineClass)(unsafe.Pointer(&in.Items)) + return nil +} + +// Convert_v1alpha1_AWSMachineClassList_To_machine_AWSMachineClassList is an autogenerated conversion function. +func Convert_v1alpha1_AWSMachineClassList_To_machine_AWSMachineClassList(in *AWSMachineClassList, out *machine.AWSMachineClassList, s conversion.Scope) error { + return autoConvert_v1alpha1_AWSMachineClassList_To_machine_AWSMachineClassList(in, out, s) +} + +func autoConvert_machine_AWSMachineClassList_To_v1alpha1_AWSMachineClassList(in *machine.AWSMachineClassList, out *AWSMachineClassList, s conversion.Scope) error { + out.ListMeta = in.ListMeta + out.Items = *(*[]AWSMachineClass)(unsafe.Pointer(&in.Items)) + return nil +} + +// Convert_machine_AWSMachineClassList_To_v1alpha1_AWSMachineClassList is an autogenerated conversion function. +func Convert_machine_AWSMachineClassList_To_v1alpha1_AWSMachineClassList(in *machine.AWSMachineClassList, out *AWSMachineClassList, s conversion.Scope) error { + return autoConvert_machine_AWSMachineClassList_To_v1alpha1_AWSMachineClassList(in, out, s) +} + +func autoConvert_v1alpha1_AWSMachineClassSpec_To_machine_AWSMachineClassSpec(in *AWSMachineClassSpec, out *machine.AWSMachineClassSpec, s conversion.Scope) error { + out.AMI = in.AMI + out.AvailabilityZone = in.AvailabilityZone + out.BlockDevices = *(*[]machine.AWSBlockDeviceMappingSpec)(unsafe.Pointer(&in.BlockDevices)) + out.EbsOptimized = in.EbsOptimized + if err := Convert_v1alpha1_AWSIAMProfileSpec_To_machine_AWSIAMProfileSpec(&in.IAM, &out.IAM, s); err != nil { + return err + } + out.MachineType = in.MachineType + out.KeyName = in.KeyName + out.Monitoring = in.Monitoring + out.NetworkInterfaces = *(*[]machine.AWSNetworkInterfaceSpec)(unsafe.Pointer(&in.NetworkInterfaces)) + out.Tags = *(*map[string]string)(unsafe.Pointer(&in.Tags)) + out.SecretRef = (*v1.SecretReference)(unsafe.Pointer(in.SecretRef)) + return nil +} + +// Convert_v1alpha1_AWSMachineClassSpec_To_machine_AWSMachineClassSpec is an autogenerated conversion function. +func Convert_v1alpha1_AWSMachineClassSpec_To_machine_AWSMachineClassSpec(in *AWSMachineClassSpec, out *machine.AWSMachineClassSpec, s conversion.Scope) error { + return autoConvert_v1alpha1_AWSMachineClassSpec_To_machine_AWSMachineClassSpec(in, out, s) +} + +func autoConvert_machine_AWSMachineClassSpec_To_v1alpha1_AWSMachineClassSpec(in *machine.AWSMachineClassSpec, out *AWSMachineClassSpec, s conversion.Scope) error { + out.AMI = in.AMI + out.AvailabilityZone = in.AvailabilityZone + out.BlockDevices = *(*[]AWSBlockDeviceMappingSpec)(unsafe.Pointer(&in.BlockDevices)) + out.EbsOptimized = in.EbsOptimized + if err := Convert_machine_AWSIAMProfileSpec_To_v1alpha1_AWSIAMProfileSpec(&in.IAM, &out.IAM, s); err != nil { + return err + } + out.MachineType = in.MachineType + out.KeyName = in.KeyName + out.Monitoring = in.Monitoring + out.NetworkInterfaces = *(*[]AWSNetworkInterfaceSpec)(unsafe.Pointer(&in.NetworkInterfaces)) + out.Tags = *(*map[string]string)(unsafe.Pointer(&in.Tags)) + out.SecretRef = (*v1.SecretReference)(unsafe.Pointer(in.SecretRef)) + return nil +} + +// Convert_machine_AWSMachineClassSpec_To_v1alpha1_AWSMachineClassSpec is an autogenerated conversion function. +func Convert_machine_AWSMachineClassSpec_To_v1alpha1_AWSMachineClassSpec(in *machine.AWSMachineClassSpec, out *AWSMachineClassSpec, s conversion.Scope) error { + return autoConvert_machine_AWSMachineClassSpec_To_v1alpha1_AWSMachineClassSpec(in, out, s) +} + +func autoConvert_v1alpha1_AWSNetworkInterfaceSpec_To_machine_AWSNetworkInterfaceSpec(in *AWSNetworkInterfaceSpec, out *machine.AWSNetworkInterfaceSpec, s conversion.Scope) error { + out.AssociatePublicIPAddress = in.AssociatePublicIPAddress + out.DeleteOnTermination = in.DeleteOnTermination + out.Description = in.Description + out.SecurityGroupID = *(*[]string)(unsafe.Pointer(&in.SecurityGroupID)) + out.SubnetID = in.SubnetID + return nil +} + +// Convert_v1alpha1_AWSNetworkInterfaceSpec_To_machine_AWSNetworkInterfaceSpec is an autogenerated conversion function. +func Convert_v1alpha1_AWSNetworkInterfaceSpec_To_machine_AWSNetworkInterfaceSpec(in *AWSNetworkInterfaceSpec, out *machine.AWSNetworkInterfaceSpec, s conversion.Scope) error { + return autoConvert_v1alpha1_AWSNetworkInterfaceSpec_To_machine_AWSNetworkInterfaceSpec(in, out, s) +} + +func autoConvert_machine_AWSNetworkInterfaceSpec_To_v1alpha1_AWSNetworkInterfaceSpec(in *machine.AWSNetworkInterfaceSpec, out *AWSNetworkInterfaceSpec, s conversion.Scope) error { + out.AssociatePublicIPAddress = in.AssociatePublicIPAddress + out.DeleteOnTermination = in.DeleteOnTermination + out.Description = in.Description + out.SecurityGroupID = *(*[]string)(unsafe.Pointer(&in.SecurityGroupID)) + out.SubnetID = in.SubnetID + return nil +} + +// Convert_machine_AWSNetworkInterfaceSpec_To_v1alpha1_AWSNetworkInterfaceSpec is an autogenerated conversion function. +func Convert_machine_AWSNetworkInterfaceSpec_To_v1alpha1_AWSNetworkInterfaceSpec(in *machine.AWSNetworkInterfaceSpec, out *AWSNetworkInterfaceSpec, s conversion.Scope) error { + return autoConvert_machine_AWSNetworkInterfaceSpec_To_v1alpha1_AWSNetworkInterfaceSpec(in, out, s) +} + +func autoConvert_v1alpha1_ClassSpec_To_machine_ClassSpec(in *ClassSpec, out *machine.ClassSpec, s conversion.Scope) error { + out.APIGroup = in.APIGroup + out.Kind = in.Kind + out.Name = in.Name + return nil +} + +// Convert_v1alpha1_ClassSpec_To_machine_ClassSpec is an autogenerated conversion function. +func Convert_v1alpha1_ClassSpec_To_machine_ClassSpec(in *ClassSpec, out *machine.ClassSpec, s conversion.Scope) error { + return autoConvert_v1alpha1_ClassSpec_To_machine_ClassSpec(in, out, s) +} + +func autoConvert_machine_ClassSpec_To_v1alpha1_ClassSpec(in *machine.ClassSpec, out *ClassSpec, s conversion.Scope) error { + out.APIGroup = in.APIGroup + out.Kind = in.Kind + out.Name = in.Name + return nil +} + +// Convert_machine_ClassSpec_To_v1alpha1_ClassSpec is an autogenerated conversion function. +func Convert_machine_ClassSpec_To_v1alpha1_ClassSpec(in *machine.ClassSpec, out *ClassSpec, s conversion.Scope) error { + return autoConvert_machine_ClassSpec_To_v1alpha1_ClassSpec(in, out, s) +} + +func autoConvert_v1alpha1_CurrentStatus_To_machine_CurrentStatus(in *CurrentStatus, out *machine.CurrentStatus, s conversion.Scope) error { + out.Phase = machine.MachinePhase(in.Phase) + out.TimeoutActive = in.TimeoutActive + out.LastUpdateTime = in.LastUpdateTime + return nil +} + +// Convert_v1alpha1_CurrentStatus_To_machine_CurrentStatus is an autogenerated conversion function. +func Convert_v1alpha1_CurrentStatus_To_machine_CurrentStatus(in *CurrentStatus, out *machine.CurrentStatus, s conversion.Scope) error { + return autoConvert_v1alpha1_CurrentStatus_To_machine_CurrentStatus(in, out, s) +} + +func autoConvert_machine_CurrentStatus_To_v1alpha1_CurrentStatus(in *machine.CurrentStatus, out *CurrentStatus, s conversion.Scope) error { + out.Phase = MachinePhase(in.Phase) + out.TimeoutActive = in.TimeoutActive + out.LastUpdateTime = in.LastUpdateTime + return nil +} + +// Convert_machine_CurrentStatus_To_v1alpha1_CurrentStatus is an autogenerated conversion function. +func Convert_machine_CurrentStatus_To_v1alpha1_CurrentStatus(in *machine.CurrentStatus, out *CurrentStatus, s conversion.Scope) error { + return autoConvert_machine_CurrentStatus_To_v1alpha1_CurrentStatus(in, out, s) +} + +func autoConvert_v1alpha1_LastOperation_To_machine_LastOperation(in *LastOperation, out *machine.LastOperation, s conversion.Scope) error { + out.Description = in.Description + out.LastUpdateTime = in.LastUpdateTime + out.State = machine.MachineState(in.State) + out.Type = in.Type + return nil +} + +// Convert_v1alpha1_LastOperation_To_machine_LastOperation is an autogenerated conversion function. +func Convert_v1alpha1_LastOperation_To_machine_LastOperation(in *LastOperation, out *machine.LastOperation, s conversion.Scope) error { + return autoConvert_v1alpha1_LastOperation_To_machine_LastOperation(in, out, s) +} + +func autoConvert_machine_LastOperation_To_v1alpha1_LastOperation(in *machine.LastOperation, out *LastOperation, s conversion.Scope) error { + out.Description = in.Description + out.LastUpdateTime = in.LastUpdateTime + out.State = MachineState(in.State) + out.Type = in.Type + return nil +} + +// Convert_machine_LastOperation_To_v1alpha1_LastOperation is an autogenerated conversion function. +func Convert_machine_LastOperation_To_v1alpha1_LastOperation(in *machine.LastOperation, out *LastOperation, s conversion.Scope) error { + return autoConvert_machine_LastOperation_To_v1alpha1_LastOperation(in, out, s) +} + +func autoConvert_v1alpha1_Machine_To_machine_Machine(in *Machine, out *machine.Machine, s conversion.Scope) error { + out.ObjectMeta = in.ObjectMeta + if err := Convert_v1alpha1_MachineSpec_To_machine_MachineSpec(&in.Spec, &out.Spec, s); err != nil { + return err + } + if err := Convert_v1alpha1_MachineStatus_To_machine_MachineStatus(&in.Status, &out.Status, s); err != nil { + return err + } + return nil +} + +// Convert_v1alpha1_Machine_To_machine_Machine is an autogenerated conversion function. +func Convert_v1alpha1_Machine_To_machine_Machine(in *Machine, out *machine.Machine, s conversion.Scope) error { + return autoConvert_v1alpha1_Machine_To_machine_Machine(in, out, s) +} + +func autoConvert_machine_Machine_To_v1alpha1_Machine(in *machine.Machine, out *Machine, s conversion.Scope) error { + out.ObjectMeta = in.ObjectMeta + if err := Convert_machine_MachineSpec_To_v1alpha1_MachineSpec(&in.Spec, &out.Spec, s); err != nil { + return err + } + if err := Convert_machine_MachineStatus_To_v1alpha1_MachineStatus(&in.Status, &out.Status, s); err != nil { + return err + } + return nil +} + +// Convert_machine_Machine_To_v1alpha1_Machine is an autogenerated conversion function. +func Convert_machine_Machine_To_v1alpha1_Machine(in *machine.Machine, out *Machine, s conversion.Scope) error { + return autoConvert_machine_Machine_To_v1alpha1_Machine(in, out, s) +} + +func autoConvert_v1alpha1_MachineDeployment_To_machine_MachineDeployment(in *MachineDeployment, out *machine.MachineDeployment, s conversion.Scope) error { + out.ObjectMeta = in.ObjectMeta + if err := Convert_v1alpha1_MachineDeploymentSpec_To_machine_MachineDeploymentSpec(&in.Spec, &out.Spec, s); err != nil { + return err + } + if err := Convert_v1alpha1_MachineDeploymentStatus_To_machine_MachineDeploymentStatus(&in.Status, &out.Status, s); err != nil { + return err + } + return nil +} + +// Convert_v1alpha1_MachineDeployment_To_machine_MachineDeployment is an autogenerated conversion function. +func Convert_v1alpha1_MachineDeployment_To_machine_MachineDeployment(in *MachineDeployment, out *machine.MachineDeployment, s conversion.Scope) error { + return autoConvert_v1alpha1_MachineDeployment_To_machine_MachineDeployment(in, out, s) +} + +func autoConvert_machine_MachineDeployment_To_v1alpha1_MachineDeployment(in *machine.MachineDeployment, out *MachineDeployment, s conversion.Scope) error { + out.ObjectMeta = in.ObjectMeta + if err := Convert_machine_MachineDeploymentSpec_To_v1alpha1_MachineDeploymentSpec(&in.Spec, &out.Spec, s); err != nil { + return err + } + if err := Convert_machine_MachineDeploymentStatus_To_v1alpha1_MachineDeploymentStatus(&in.Status, &out.Status, s); err != nil { + return err + } + return nil +} + +// Convert_machine_MachineDeployment_To_v1alpha1_MachineDeployment is an autogenerated conversion function. +func Convert_machine_MachineDeployment_To_v1alpha1_MachineDeployment(in *machine.MachineDeployment, out *MachineDeployment, s conversion.Scope) error { + return autoConvert_machine_MachineDeployment_To_v1alpha1_MachineDeployment(in, out, s) +} + +func autoConvert_v1alpha1_MachineDeploymentCondition_To_machine_MachineDeploymentCondition(in *MachineDeploymentCondition, out *machine.MachineDeploymentCondition, s conversion.Scope) error { + out.Type = machine.MachineDeploymentConditionType(in.Type) + out.Status = machine.ConditionStatus(in.Status) + out.LastUpdateTime = in.LastUpdateTime + out.LastTransitionTime = in.LastTransitionTime + out.Reason = in.Reason + out.Message = in.Message + return nil +} + +// Convert_v1alpha1_MachineDeploymentCondition_To_machine_MachineDeploymentCondition is an autogenerated conversion function. +func Convert_v1alpha1_MachineDeploymentCondition_To_machine_MachineDeploymentCondition(in *MachineDeploymentCondition, out *machine.MachineDeploymentCondition, s conversion.Scope) error { + return autoConvert_v1alpha1_MachineDeploymentCondition_To_machine_MachineDeploymentCondition(in, out, s) +} + +func autoConvert_machine_MachineDeploymentCondition_To_v1alpha1_MachineDeploymentCondition(in *machine.MachineDeploymentCondition, out *MachineDeploymentCondition, s conversion.Scope) error { + out.Type = MachineDeploymentConditionType(in.Type) + out.Status = ConditionStatus(in.Status) + out.LastUpdateTime = in.LastUpdateTime + out.LastTransitionTime = in.LastTransitionTime + out.Reason = in.Reason + out.Message = in.Message + return nil +} + +// Convert_machine_MachineDeploymentCondition_To_v1alpha1_MachineDeploymentCondition is an autogenerated conversion function. +func Convert_machine_MachineDeploymentCondition_To_v1alpha1_MachineDeploymentCondition(in *machine.MachineDeploymentCondition, out *MachineDeploymentCondition, s conversion.Scope) error { + return autoConvert_machine_MachineDeploymentCondition_To_v1alpha1_MachineDeploymentCondition(in, out, s) +} + +func autoConvert_v1alpha1_MachineDeploymentList_To_machine_MachineDeploymentList(in *MachineDeploymentList, out *machine.MachineDeploymentList, s conversion.Scope) error { + out.ListMeta = in.ListMeta + out.Items = *(*[]machine.MachineDeployment)(unsafe.Pointer(&in.Items)) + return nil +} + +// Convert_v1alpha1_MachineDeploymentList_To_machine_MachineDeploymentList is an autogenerated conversion function. +func Convert_v1alpha1_MachineDeploymentList_To_machine_MachineDeploymentList(in *MachineDeploymentList, out *machine.MachineDeploymentList, s conversion.Scope) error { + return autoConvert_v1alpha1_MachineDeploymentList_To_machine_MachineDeploymentList(in, out, s) +} + +func autoConvert_machine_MachineDeploymentList_To_v1alpha1_MachineDeploymentList(in *machine.MachineDeploymentList, out *MachineDeploymentList, s conversion.Scope) error { + out.ListMeta = in.ListMeta + out.Items = *(*[]MachineDeployment)(unsafe.Pointer(&in.Items)) + return nil +} + +// Convert_machine_MachineDeploymentList_To_v1alpha1_MachineDeploymentList is an autogenerated conversion function. +func Convert_machine_MachineDeploymentList_To_v1alpha1_MachineDeploymentList(in *machine.MachineDeploymentList, out *MachineDeploymentList, s conversion.Scope) error { + return autoConvert_machine_MachineDeploymentList_To_v1alpha1_MachineDeploymentList(in, out, s) +} + +func autoConvert_v1alpha1_MachineDeploymentRollback_To_machine_MachineDeploymentRollback(in *MachineDeploymentRollback, out *machine.MachineDeploymentRollback, s conversion.Scope) error { + out.Name = in.Name + out.UpdatedAnnotations = *(*map[string]string)(unsafe.Pointer(&in.UpdatedAnnotations)) + if err := Convert_v1alpha1_RollbackConfig_To_machine_RollbackConfig(&in.RollbackTo, &out.RollbackTo, s); err != nil { + return err + } + return nil +} + +// Convert_v1alpha1_MachineDeploymentRollback_To_machine_MachineDeploymentRollback is an autogenerated conversion function. +func Convert_v1alpha1_MachineDeploymentRollback_To_machine_MachineDeploymentRollback(in *MachineDeploymentRollback, out *machine.MachineDeploymentRollback, s conversion.Scope) error { + return autoConvert_v1alpha1_MachineDeploymentRollback_To_machine_MachineDeploymentRollback(in, out, s) +} + +func autoConvert_machine_MachineDeploymentRollback_To_v1alpha1_MachineDeploymentRollback(in *machine.MachineDeploymentRollback, out *MachineDeploymentRollback, s conversion.Scope) error { + out.Name = in.Name + out.UpdatedAnnotations = *(*map[string]string)(unsafe.Pointer(&in.UpdatedAnnotations)) + if err := Convert_machine_RollbackConfig_To_v1alpha1_RollbackConfig(&in.RollbackTo, &out.RollbackTo, s); err != nil { + return err + } + return nil +} + +// Convert_machine_MachineDeploymentRollback_To_v1alpha1_MachineDeploymentRollback is an autogenerated conversion function. +func Convert_machine_MachineDeploymentRollback_To_v1alpha1_MachineDeploymentRollback(in *machine.MachineDeploymentRollback, out *MachineDeploymentRollback, s conversion.Scope) error { + return autoConvert_machine_MachineDeploymentRollback_To_v1alpha1_MachineDeploymentRollback(in, out, s) +} + +func autoConvert_v1alpha1_MachineDeploymentSpec_To_machine_MachineDeploymentSpec(in *MachineDeploymentSpec, out *machine.MachineDeploymentSpec, s conversion.Scope) error { + out.Replicas = in.Replicas + out.Selector = (*meta_v1.LabelSelector)(unsafe.Pointer(in.Selector)) + if err := Convert_v1alpha1_MachineTemplateSpec_To_machine_MachineTemplateSpec(&in.Template, &out.Template, s); err != nil { + return err + } + if err := Convert_v1alpha1_MachineDeploymentStrategy_To_machine_MachineDeploymentStrategy(&in.Strategy, &out.Strategy, s); err != nil { + return err + } + out.MinReadySeconds = in.MinReadySeconds + out.RevisionHistoryLimit = (*int32)(unsafe.Pointer(in.RevisionHistoryLimit)) + out.Paused = in.Paused + out.RollbackTo = (*machine.RollbackConfig)(unsafe.Pointer(in.RollbackTo)) + out.ProgressDeadlineSeconds = (*int32)(unsafe.Pointer(in.ProgressDeadlineSeconds)) + return nil +} + +// Convert_v1alpha1_MachineDeploymentSpec_To_machine_MachineDeploymentSpec is an autogenerated conversion function. +func Convert_v1alpha1_MachineDeploymentSpec_To_machine_MachineDeploymentSpec(in *MachineDeploymentSpec, out *machine.MachineDeploymentSpec, s conversion.Scope) error { + return autoConvert_v1alpha1_MachineDeploymentSpec_To_machine_MachineDeploymentSpec(in, out, s) +} + +func autoConvert_machine_MachineDeploymentSpec_To_v1alpha1_MachineDeploymentSpec(in *machine.MachineDeploymentSpec, out *MachineDeploymentSpec, s conversion.Scope) error { + out.Replicas = in.Replicas + out.Selector = (*meta_v1.LabelSelector)(unsafe.Pointer(in.Selector)) + if err := Convert_machine_MachineTemplateSpec_To_v1alpha1_MachineTemplateSpec(&in.Template, &out.Template, s); err != nil { + return err + } + if err := Convert_machine_MachineDeploymentStrategy_To_v1alpha1_MachineDeploymentStrategy(&in.Strategy, &out.Strategy, s); err != nil { + return err + } + out.MinReadySeconds = in.MinReadySeconds + out.RevisionHistoryLimit = (*int32)(unsafe.Pointer(in.RevisionHistoryLimit)) + out.Paused = in.Paused + out.RollbackTo = (*RollbackConfig)(unsafe.Pointer(in.RollbackTo)) + out.ProgressDeadlineSeconds = (*int32)(unsafe.Pointer(in.ProgressDeadlineSeconds)) + return nil +} + +// Convert_machine_MachineDeploymentSpec_To_v1alpha1_MachineDeploymentSpec is an autogenerated conversion function. +func Convert_machine_MachineDeploymentSpec_To_v1alpha1_MachineDeploymentSpec(in *machine.MachineDeploymentSpec, out *MachineDeploymentSpec, s conversion.Scope) error { + return autoConvert_machine_MachineDeploymentSpec_To_v1alpha1_MachineDeploymentSpec(in, out, s) +} + +func autoConvert_v1alpha1_MachineDeploymentStatus_To_machine_MachineDeploymentStatus(in *MachineDeploymentStatus, out *machine.MachineDeploymentStatus, s conversion.Scope) error { + out.ObservedGeneration = in.ObservedGeneration + out.Replicas = in.Replicas + out.UpdatedReplicas = in.UpdatedReplicas + out.ReadyReplicas = in.ReadyReplicas + out.AvailableReplicas = in.AvailableReplicas + out.UnavailableReplicas = in.UnavailableReplicas + out.Conditions = *(*[]machine.MachineDeploymentCondition)(unsafe.Pointer(&in.Conditions)) + out.CollisionCount = (*int32)(unsafe.Pointer(in.CollisionCount)) + return nil +} + +// Convert_v1alpha1_MachineDeploymentStatus_To_machine_MachineDeploymentStatus is an autogenerated conversion function. +func Convert_v1alpha1_MachineDeploymentStatus_To_machine_MachineDeploymentStatus(in *MachineDeploymentStatus, out *machine.MachineDeploymentStatus, s conversion.Scope) error { + return autoConvert_v1alpha1_MachineDeploymentStatus_To_machine_MachineDeploymentStatus(in, out, s) +} + +func autoConvert_machine_MachineDeploymentStatus_To_v1alpha1_MachineDeploymentStatus(in *machine.MachineDeploymentStatus, out *MachineDeploymentStatus, s conversion.Scope) error { + out.ObservedGeneration = in.ObservedGeneration + out.Replicas = in.Replicas + out.UpdatedReplicas = in.UpdatedReplicas + out.ReadyReplicas = in.ReadyReplicas + out.AvailableReplicas = in.AvailableReplicas + out.UnavailableReplicas = in.UnavailableReplicas + out.Conditions = *(*[]MachineDeploymentCondition)(unsafe.Pointer(&in.Conditions)) + out.CollisionCount = (*int32)(unsafe.Pointer(in.CollisionCount)) + return nil +} + +// Convert_machine_MachineDeploymentStatus_To_v1alpha1_MachineDeploymentStatus is an autogenerated conversion function. +func Convert_machine_MachineDeploymentStatus_To_v1alpha1_MachineDeploymentStatus(in *machine.MachineDeploymentStatus, out *MachineDeploymentStatus, s conversion.Scope) error { + return autoConvert_machine_MachineDeploymentStatus_To_v1alpha1_MachineDeploymentStatus(in, out, s) +} + +func autoConvert_v1alpha1_MachineDeploymentStrategy_To_machine_MachineDeploymentStrategy(in *MachineDeploymentStrategy, out *machine.MachineDeploymentStrategy, s conversion.Scope) error { + out.Type = machine.MachineDeploymentStrategyType(in.Type) + out.RollingUpdate = (*machine.RollingUpdateMachineDeployment)(unsafe.Pointer(in.RollingUpdate)) + return nil +} + +// Convert_v1alpha1_MachineDeploymentStrategy_To_machine_MachineDeploymentStrategy is an autogenerated conversion function. +func Convert_v1alpha1_MachineDeploymentStrategy_To_machine_MachineDeploymentStrategy(in *MachineDeploymentStrategy, out *machine.MachineDeploymentStrategy, s conversion.Scope) error { + return autoConvert_v1alpha1_MachineDeploymentStrategy_To_machine_MachineDeploymentStrategy(in, out, s) +} + +func autoConvert_machine_MachineDeploymentStrategy_To_v1alpha1_MachineDeploymentStrategy(in *machine.MachineDeploymentStrategy, out *MachineDeploymentStrategy, s conversion.Scope) error { + out.Type = MachineDeploymentStrategyType(in.Type) + out.RollingUpdate = (*RollingUpdateMachineDeployment)(unsafe.Pointer(in.RollingUpdate)) + return nil +} + +// Convert_machine_MachineDeploymentStrategy_To_v1alpha1_MachineDeploymentStrategy is an autogenerated conversion function. +func Convert_machine_MachineDeploymentStrategy_To_v1alpha1_MachineDeploymentStrategy(in *machine.MachineDeploymentStrategy, out *MachineDeploymentStrategy, s conversion.Scope) error { + return autoConvert_machine_MachineDeploymentStrategy_To_v1alpha1_MachineDeploymentStrategy(in, out, s) +} + +func autoConvert_v1alpha1_MachineList_To_machine_MachineList(in *MachineList, out *machine.MachineList, s conversion.Scope) error { + out.ListMeta = in.ListMeta + out.Items = *(*[]machine.Machine)(unsafe.Pointer(&in.Items)) + return nil +} + +// Convert_v1alpha1_MachineList_To_machine_MachineList is an autogenerated conversion function. +func Convert_v1alpha1_MachineList_To_machine_MachineList(in *MachineList, out *machine.MachineList, s conversion.Scope) error { + return autoConvert_v1alpha1_MachineList_To_machine_MachineList(in, out, s) +} + +func autoConvert_machine_MachineList_To_v1alpha1_MachineList(in *machine.MachineList, out *MachineList, s conversion.Scope) error { + out.ListMeta = in.ListMeta + out.Items = *(*[]Machine)(unsafe.Pointer(&in.Items)) + return nil +} + +// Convert_machine_MachineList_To_v1alpha1_MachineList is an autogenerated conversion function. +func Convert_machine_MachineList_To_v1alpha1_MachineList(in *machine.MachineList, out *MachineList, s conversion.Scope) error { + return autoConvert_machine_MachineList_To_v1alpha1_MachineList(in, out, s) +} + +func autoConvert_v1alpha1_MachineSet_To_machine_MachineSet(in *MachineSet, out *machine.MachineSet, s conversion.Scope) error { + out.ObjectMeta = in.ObjectMeta + if err := Convert_v1alpha1_MachineSetSpec_To_machine_MachineSetSpec(&in.Spec, &out.Spec, s); err != nil { + return err + } + if err := Convert_v1alpha1_MachineSetStatus_To_machine_MachineSetStatus(&in.Status, &out.Status, s); err != nil { + return err + } + return nil +} + +// Convert_v1alpha1_MachineSet_To_machine_MachineSet is an autogenerated conversion function. +func Convert_v1alpha1_MachineSet_To_machine_MachineSet(in *MachineSet, out *machine.MachineSet, s conversion.Scope) error { + return autoConvert_v1alpha1_MachineSet_To_machine_MachineSet(in, out, s) +} + +func autoConvert_machine_MachineSet_To_v1alpha1_MachineSet(in *machine.MachineSet, out *MachineSet, s conversion.Scope) error { + out.ObjectMeta = in.ObjectMeta + if err := Convert_machine_MachineSetSpec_To_v1alpha1_MachineSetSpec(&in.Spec, &out.Spec, s); err != nil { + return err + } + if err := Convert_machine_MachineSetStatus_To_v1alpha1_MachineSetStatus(&in.Status, &out.Status, s); err != nil { + return err + } + return nil +} + +// Convert_machine_MachineSet_To_v1alpha1_MachineSet is an autogenerated conversion function. +func Convert_machine_MachineSet_To_v1alpha1_MachineSet(in *machine.MachineSet, out *MachineSet, s conversion.Scope) error { + return autoConvert_machine_MachineSet_To_v1alpha1_MachineSet(in, out, s) +} + +func autoConvert_v1alpha1_MachineSetCondition_To_machine_MachineSetCondition(in *MachineSetCondition, out *machine.MachineSetCondition, s conversion.Scope) error { + out.Type = machine.MachineSetConditionType(in.Type) + out.Status = machine.ConditionStatus(in.Status) + out.LastTransitionTime = in.LastTransitionTime + out.Reason = in.Reason + out.Message = in.Message + return nil +} + +// Convert_v1alpha1_MachineSetCondition_To_machine_MachineSetCondition is an autogenerated conversion function. +func Convert_v1alpha1_MachineSetCondition_To_machine_MachineSetCondition(in *MachineSetCondition, out *machine.MachineSetCondition, s conversion.Scope) error { + return autoConvert_v1alpha1_MachineSetCondition_To_machine_MachineSetCondition(in, out, s) +} + +func autoConvert_machine_MachineSetCondition_To_v1alpha1_MachineSetCondition(in *machine.MachineSetCondition, out *MachineSetCondition, s conversion.Scope) error { + out.Type = MachineSetConditionType(in.Type) + out.Status = ConditionStatus(in.Status) + out.LastTransitionTime = in.LastTransitionTime + out.Reason = in.Reason + out.Message = in.Message + return nil +} + +// Convert_machine_MachineSetCondition_To_v1alpha1_MachineSetCondition is an autogenerated conversion function. +func Convert_machine_MachineSetCondition_To_v1alpha1_MachineSetCondition(in *machine.MachineSetCondition, out *MachineSetCondition, s conversion.Scope) error { + return autoConvert_machine_MachineSetCondition_To_v1alpha1_MachineSetCondition(in, out, s) +} + +func autoConvert_v1alpha1_MachineSetList_To_machine_MachineSetList(in *MachineSetList, out *machine.MachineSetList, s conversion.Scope) error { + out.ListMeta = in.ListMeta + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]machine.MachineSet, len(*in)) + for i := range *in { + if err := Convert_v1alpha1_MachineSet_To_machine_MachineSet(&(*in)[i], &(*out)[i], s); err != nil { + return err + } + } + } else { + out.Items = nil + } + return nil +} + +// Convert_v1alpha1_MachineSetList_To_machine_MachineSetList is an autogenerated conversion function. +func Convert_v1alpha1_MachineSetList_To_machine_MachineSetList(in *MachineSetList, out *machine.MachineSetList, s conversion.Scope) error { + return autoConvert_v1alpha1_MachineSetList_To_machine_MachineSetList(in, out, s) +} + +func autoConvert_machine_MachineSetList_To_v1alpha1_MachineSetList(in *machine.MachineSetList, out *MachineSetList, s conversion.Scope) error { + out.ListMeta = in.ListMeta + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]MachineSet, len(*in)) + for i := range *in { + if err := Convert_machine_MachineSet_To_v1alpha1_MachineSet(&(*in)[i], &(*out)[i], s); err != nil { + return err + } + } + } else { + out.Items = nil + } + return nil +} + +// Convert_machine_MachineSetList_To_v1alpha1_MachineSetList is an autogenerated conversion function. +func Convert_machine_MachineSetList_To_v1alpha1_MachineSetList(in *machine.MachineSetList, out *MachineSetList, s conversion.Scope) error { + return autoConvert_machine_MachineSetList_To_v1alpha1_MachineSetList(in, out, s) +} + +func autoConvert_v1alpha1_MachineSetSpec_To_machine_MachineSetSpec(in *MachineSetSpec, out *machine.MachineSetSpec, s conversion.Scope) error { + out.Replicas = in.Replicas + out.Selector = (*meta_v1.LabelSelector)(unsafe.Pointer(in.Selector)) + if err := Convert_v1alpha1_ClassSpec_To_machine_ClassSpec(&in.MachineClass, &out.MachineClass, s); err != nil { + return err + } + if err := Convert_v1alpha1_MachineTemplateSpec_To_machine_MachineTemplateSpec(&in.Template, &out.Template, s); err != nil { + return err + } + out.MinReadySeconds = int(in.MinReadySeconds) + return nil +} + +// Convert_v1alpha1_MachineSetSpec_To_machine_MachineSetSpec is an autogenerated conversion function. +func Convert_v1alpha1_MachineSetSpec_To_machine_MachineSetSpec(in *MachineSetSpec, out *machine.MachineSetSpec, s conversion.Scope) error { + return autoConvert_v1alpha1_MachineSetSpec_To_machine_MachineSetSpec(in, out, s) +} + +func autoConvert_machine_MachineSetSpec_To_v1alpha1_MachineSetSpec(in *machine.MachineSetSpec, out *MachineSetSpec, s conversion.Scope) error { + out.Replicas = in.Replicas + out.Selector = (*meta_v1.LabelSelector)(unsafe.Pointer(in.Selector)) + if err := Convert_machine_ClassSpec_To_v1alpha1_ClassSpec(&in.MachineClass, &out.MachineClass, s); err != nil { + return err + } + if err := Convert_machine_MachineTemplateSpec_To_v1alpha1_MachineTemplateSpec(&in.Template, &out.Template, s); err != nil { + return err + } + out.MinReadySeconds = int32(in.MinReadySeconds) + return nil +} + +// Convert_machine_MachineSetSpec_To_v1alpha1_MachineSetSpec is an autogenerated conversion function. +func Convert_machine_MachineSetSpec_To_v1alpha1_MachineSetSpec(in *machine.MachineSetSpec, out *MachineSetSpec, s conversion.Scope) error { + return autoConvert_machine_MachineSetSpec_To_v1alpha1_MachineSetSpec(in, out, s) +} + +func autoConvert_v1alpha1_MachineSetStatus_To_machine_MachineSetStatus(in *MachineSetStatus, out *machine.MachineSetStatus, s conversion.Scope) error { + if err := Convert_v1alpha1_LastOperation_To_machine_LastOperation(&in.LastOperation, &out.LastOperation, s); err != nil { + return err + } + out.Replicas = in.Replicas + out.FullyLabeledReplicas = in.FullyLabeledReplicas + out.ReadyReplicas = in.ReadyReplicas + out.AvailableReplicas = in.AvailableReplicas + out.Conditions = *(*[]machine.MachineSetCondition)(unsafe.Pointer(&in.Conditions)) + out.ObservedGeneration = in.ObservedGeneration + return nil +} + +// Convert_v1alpha1_MachineSetStatus_To_machine_MachineSetStatus is an autogenerated conversion function. +func Convert_v1alpha1_MachineSetStatus_To_machine_MachineSetStatus(in *MachineSetStatus, out *machine.MachineSetStatus, s conversion.Scope) error { + return autoConvert_v1alpha1_MachineSetStatus_To_machine_MachineSetStatus(in, out, s) +} + +func autoConvert_machine_MachineSetStatus_To_v1alpha1_MachineSetStatus(in *machine.MachineSetStatus, out *MachineSetStatus, s conversion.Scope) error { + if err := Convert_machine_LastOperation_To_v1alpha1_LastOperation(&in.LastOperation, &out.LastOperation, s); err != nil { + return err + } + out.Replicas = in.Replicas + out.FullyLabeledReplicas = in.FullyLabeledReplicas + out.ReadyReplicas = in.ReadyReplicas + out.AvailableReplicas = in.AvailableReplicas + out.Conditions = *(*[]MachineSetCondition)(unsafe.Pointer(&in.Conditions)) + out.ObservedGeneration = in.ObservedGeneration + return nil +} + +// Convert_machine_MachineSetStatus_To_v1alpha1_MachineSetStatus is an autogenerated conversion function. +func Convert_machine_MachineSetStatus_To_v1alpha1_MachineSetStatus(in *machine.MachineSetStatus, out *MachineSetStatus, s conversion.Scope) error { + return autoConvert_machine_MachineSetStatus_To_v1alpha1_MachineSetStatus(in, out, s) +} + +func autoConvert_v1alpha1_MachineSpec_To_machine_MachineSpec(in *MachineSpec, out *machine.MachineSpec, s conversion.Scope) error { + if err := Convert_v1alpha1_ClassSpec_To_machine_ClassSpec(&in.Class, &out.Class, s); err != nil { + return err + } + out.ProviderID = in.ProviderID + return nil +} + +// Convert_v1alpha1_MachineSpec_To_machine_MachineSpec is an autogenerated conversion function. +func Convert_v1alpha1_MachineSpec_To_machine_MachineSpec(in *MachineSpec, out *machine.MachineSpec, s conversion.Scope) error { + return autoConvert_v1alpha1_MachineSpec_To_machine_MachineSpec(in, out, s) +} + +func autoConvert_machine_MachineSpec_To_v1alpha1_MachineSpec(in *machine.MachineSpec, out *MachineSpec, s conversion.Scope) error { + if err := Convert_machine_ClassSpec_To_v1alpha1_ClassSpec(&in.Class, &out.Class, s); err != nil { + return err + } + out.ProviderID = in.ProviderID + return nil +} + +// Convert_machine_MachineSpec_To_v1alpha1_MachineSpec is an autogenerated conversion function. +func Convert_machine_MachineSpec_To_v1alpha1_MachineSpec(in *machine.MachineSpec, out *MachineSpec, s conversion.Scope) error { + return autoConvert_machine_MachineSpec_To_v1alpha1_MachineSpec(in, out, s) +} + +func autoConvert_v1alpha1_MachineStatus_To_machine_MachineStatus(in *MachineStatus, out *machine.MachineStatus, s conversion.Scope) error { + out.Node = in.Node + out.Conditions = *(*[]v1.NodeCondition)(unsafe.Pointer(&in.Conditions)) + if err := Convert_v1alpha1_LastOperation_To_machine_LastOperation(&in.LastOperation, &out.LastOperation, s); err != nil { + return err + } + if err := Convert_v1alpha1_CurrentStatus_To_machine_CurrentStatus(&in.CurrentStatus, &out.CurrentStatus, s); err != nil { + return err + } + return nil +} + +// Convert_v1alpha1_MachineStatus_To_machine_MachineStatus is an autogenerated conversion function. +func Convert_v1alpha1_MachineStatus_To_machine_MachineStatus(in *MachineStatus, out *machine.MachineStatus, s conversion.Scope) error { + return autoConvert_v1alpha1_MachineStatus_To_machine_MachineStatus(in, out, s) +} + +func autoConvert_machine_MachineStatus_To_v1alpha1_MachineStatus(in *machine.MachineStatus, out *MachineStatus, s conversion.Scope) error { + out.Node = in.Node + out.Conditions = *(*[]v1.NodeCondition)(unsafe.Pointer(&in.Conditions)) + if err := Convert_machine_LastOperation_To_v1alpha1_LastOperation(&in.LastOperation, &out.LastOperation, s); err != nil { + return err + } + if err := Convert_machine_CurrentStatus_To_v1alpha1_CurrentStatus(&in.CurrentStatus, &out.CurrentStatus, s); err != nil { + return err + } + return nil +} + +// Convert_machine_MachineStatus_To_v1alpha1_MachineStatus is an autogenerated conversion function. +func Convert_machine_MachineStatus_To_v1alpha1_MachineStatus(in *machine.MachineStatus, out *MachineStatus, s conversion.Scope) error { + return autoConvert_machine_MachineStatus_To_v1alpha1_MachineStatus(in, out, s) +} + +func autoConvert_v1alpha1_MachineTemplate_To_machine_MachineTemplate(in *MachineTemplate, out *machine.MachineTemplate, s conversion.Scope) error { + out.ObjectMeta = in.ObjectMeta + if err := Convert_v1alpha1_MachineTemplateSpec_To_machine_MachineTemplateSpec(&in.Template, &out.Template, s); err != nil { + return err + } + return nil +} + +// Convert_v1alpha1_MachineTemplate_To_machine_MachineTemplate is an autogenerated conversion function. +func Convert_v1alpha1_MachineTemplate_To_machine_MachineTemplate(in *MachineTemplate, out *machine.MachineTemplate, s conversion.Scope) error { + return autoConvert_v1alpha1_MachineTemplate_To_machine_MachineTemplate(in, out, s) +} + +func autoConvert_machine_MachineTemplate_To_v1alpha1_MachineTemplate(in *machine.MachineTemplate, out *MachineTemplate, s conversion.Scope) error { + out.ObjectMeta = in.ObjectMeta + if err := Convert_machine_MachineTemplateSpec_To_v1alpha1_MachineTemplateSpec(&in.Template, &out.Template, s); err != nil { + return err + } + return nil +} + +// Convert_machine_MachineTemplate_To_v1alpha1_MachineTemplate is an autogenerated conversion function. +func Convert_machine_MachineTemplate_To_v1alpha1_MachineTemplate(in *machine.MachineTemplate, out *MachineTemplate, s conversion.Scope) error { + return autoConvert_machine_MachineTemplate_To_v1alpha1_MachineTemplate(in, out, s) +} + +func autoConvert_v1alpha1_MachineTemplateList_To_machine_MachineTemplateList(in *MachineTemplateList, out *machine.MachineTemplateList, s conversion.Scope) error { + out.ListMeta = in.ListMeta + out.Items = *(*[]machine.MachineTemplate)(unsafe.Pointer(&in.Items)) + return nil +} + +// Convert_v1alpha1_MachineTemplateList_To_machine_MachineTemplateList is an autogenerated conversion function. +func Convert_v1alpha1_MachineTemplateList_To_machine_MachineTemplateList(in *MachineTemplateList, out *machine.MachineTemplateList, s conversion.Scope) error { + return autoConvert_v1alpha1_MachineTemplateList_To_machine_MachineTemplateList(in, out, s) +} + +func autoConvert_machine_MachineTemplateList_To_v1alpha1_MachineTemplateList(in *machine.MachineTemplateList, out *MachineTemplateList, s conversion.Scope) error { + out.ListMeta = in.ListMeta + out.Items = *(*[]MachineTemplate)(unsafe.Pointer(&in.Items)) + return nil +} + +// Convert_machine_MachineTemplateList_To_v1alpha1_MachineTemplateList is an autogenerated conversion function. +func Convert_machine_MachineTemplateList_To_v1alpha1_MachineTemplateList(in *machine.MachineTemplateList, out *MachineTemplateList, s conversion.Scope) error { + return autoConvert_machine_MachineTemplateList_To_v1alpha1_MachineTemplateList(in, out, s) +} + +func autoConvert_v1alpha1_MachineTemplateSpec_To_machine_MachineTemplateSpec(in *MachineTemplateSpec, out *machine.MachineTemplateSpec, s conversion.Scope) error { + out.ObjectMeta = in.ObjectMeta + if err := Convert_v1alpha1_MachineSpec_To_machine_MachineSpec(&in.Spec, &out.Spec, s); err != nil { + return err + } + return nil +} + +// Convert_v1alpha1_MachineTemplateSpec_To_machine_MachineTemplateSpec is an autogenerated conversion function. +func Convert_v1alpha1_MachineTemplateSpec_To_machine_MachineTemplateSpec(in *MachineTemplateSpec, out *machine.MachineTemplateSpec, s conversion.Scope) error { + return autoConvert_v1alpha1_MachineTemplateSpec_To_machine_MachineTemplateSpec(in, out, s) +} + +func autoConvert_machine_MachineTemplateSpec_To_v1alpha1_MachineTemplateSpec(in *machine.MachineTemplateSpec, out *MachineTemplateSpec, s conversion.Scope) error { + out.ObjectMeta = in.ObjectMeta + if err := Convert_machine_MachineSpec_To_v1alpha1_MachineSpec(&in.Spec, &out.Spec, s); err != nil { + return err + } + return nil +} + +// Convert_machine_MachineTemplateSpec_To_v1alpha1_MachineTemplateSpec is an autogenerated conversion function. +func Convert_machine_MachineTemplateSpec_To_v1alpha1_MachineTemplateSpec(in *machine.MachineTemplateSpec, out *MachineTemplateSpec, s conversion.Scope) error { + return autoConvert_machine_MachineTemplateSpec_To_v1alpha1_MachineTemplateSpec(in, out, s) +} + +func autoConvert_v1alpha1_RollbackConfig_To_machine_RollbackConfig(in *RollbackConfig, out *machine.RollbackConfig, s conversion.Scope) error { + out.Revision = in.Revision + return nil +} + +// Convert_v1alpha1_RollbackConfig_To_machine_RollbackConfig is an autogenerated conversion function. +func Convert_v1alpha1_RollbackConfig_To_machine_RollbackConfig(in *RollbackConfig, out *machine.RollbackConfig, s conversion.Scope) error { + return autoConvert_v1alpha1_RollbackConfig_To_machine_RollbackConfig(in, out, s) +} + +func autoConvert_machine_RollbackConfig_To_v1alpha1_RollbackConfig(in *machine.RollbackConfig, out *RollbackConfig, s conversion.Scope) error { + out.Revision = in.Revision + return nil +} + +// Convert_machine_RollbackConfig_To_v1alpha1_RollbackConfig is an autogenerated conversion function. +func Convert_machine_RollbackConfig_To_v1alpha1_RollbackConfig(in *machine.RollbackConfig, out *RollbackConfig, s conversion.Scope) error { + return autoConvert_machine_RollbackConfig_To_v1alpha1_RollbackConfig(in, out, s) +} + +func autoConvert_v1alpha1_RollingUpdateMachineDeployment_To_machine_RollingUpdateMachineDeployment(in *RollingUpdateMachineDeployment, out *machine.RollingUpdateMachineDeployment, s conversion.Scope) error { + out.MaxUnavailable = (*intstr.IntOrString)(unsafe.Pointer(in.MaxUnavailable)) + out.MaxSurge = (*intstr.IntOrString)(unsafe.Pointer(in.MaxSurge)) + return nil +} + +// Convert_v1alpha1_RollingUpdateMachineDeployment_To_machine_RollingUpdateMachineDeployment is an autogenerated conversion function. +func Convert_v1alpha1_RollingUpdateMachineDeployment_To_machine_RollingUpdateMachineDeployment(in *RollingUpdateMachineDeployment, out *machine.RollingUpdateMachineDeployment, s conversion.Scope) error { + return autoConvert_v1alpha1_RollingUpdateMachineDeployment_To_machine_RollingUpdateMachineDeployment(in, out, s) +} + +func autoConvert_machine_RollingUpdateMachineDeployment_To_v1alpha1_RollingUpdateMachineDeployment(in *machine.RollingUpdateMachineDeployment, out *RollingUpdateMachineDeployment, s conversion.Scope) error { + out.MaxUnavailable = (*intstr.IntOrString)(unsafe.Pointer(in.MaxUnavailable)) + out.MaxSurge = (*intstr.IntOrString)(unsafe.Pointer(in.MaxSurge)) + return nil +} + +// Convert_machine_RollingUpdateMachineDeployment_To_v1alpha1_RollingUpdateMachineDeployment is an autogenerated conversion function. +func Convert_machine_RollingUpdateMachineDeployment_To_v1alpha1_RollingUpdateMachineDeployment(in *machine.RollingUpdateMachineDeployment, out *RollingUpdateMachineDeployment, s conversion.Scope) error { + return autoConvert_machine_RollingUpdateMachineDeployment_To_v1alpha1_RollingUpdateMachineDeployment(in, out, s) +} + +func autoConvert_v1alpha1_Scale_To_machine_Scale(in *Scale, out *machine.Scale, s conversion.Scope) error { + out.ObjectMeta = in.ObjectMeta + if err := Convert_v1alpha1_ScaleSpec_To_machine_ScaleSpec(&in.Spec, &out.Spec, s); err != nil { + return err + } + if err := Convert_v1alpha1_ScaleStatus_To_machine_ScaleStatus(&in.Status, &out.Status, s); err != nil { + return err + } + return nil +} + +// Convert_v1alpha1_Scale_To_machine_Scale is an autogenerated conversion function. +func Convert_v1alpha1_Scale_To_machine_Scale(in *Scale, out *machine.Scale, s conversion.Scope) error { + return autoConvert_v1alpha1_Scale_To_machine_Scale(in, out, s) +} + +func autoConvert_machine_Scale_To_v1alpha1_Scale(in *machine.Scale, out *Scale, s conversion.Scope) error { + out.ObjectMeta = in.ObjectMeta + if err := Convert_machine_ScaleSpec_To_v1alpha1_ScaleSpec(&in.Spec, &out.Spec, s); err != nil { + return err + } + if err := Convert_machine_ScaleStatus_To_v1alpha1_ScaleStatus(&in.Status, &out.Status, s); err != nil { + return err + } + return nil +} + +// Convert_machine_Scale_To_v1alpha1_Scale is an autogenerated conversion function. +func Convert_machine_Scale_To_v1alpha1_Scale(in *machine.Scale, out *Scale, s conversion.Scope) error { + return autoConvert_machine_Scale_To_v1alpha1_Scale(in, out, s) +} + +func autoConvert_v1alpha1_ScaleSpec_To_machine_ScaleSpec(in *ScaleSpec, out *machine.ScaleSpec, s conversion.Scope) error { + out.Replicas = in.Replicas + return nil +} + +// Convert_v1alpha1_ScaleSpec_To_machine_ScaleSpec is an autogenerated conversion function. +func Convert_v1alpha1_ScaleSpec_To_machine_ScaleSpec(in *ScaleSpec, out *machine.ScaleSpec, s conversion.Scope) error { + return autoConvert_v1alpha1_ScaleSpec_To_machine_ScaleSpec(in, out, s) +} + +func autoConvert_machine_ScaleSpec_To_v1alpha1_ScaleSpec(in *machine.ScaleSpec, out *ScaleSpec, s conversion.Scope) error { + out.Replicas = in.Replicas + return nil +} + +// Convert_machine_ScaleSpec_To_v1alpha1_ScaleSpec is an autogenerated conversion function. +func Convert_machine_ScaleSpec_To_v1alpha1_ScaleSpec(in *machine.ScaleSpec, out *ScaleSpec, s conversion.Scope) error { + return autoConvert_machine_ScaleSpec_To_v1alpha1_ScaleSpec(in, out, s) +} + +func autoConvert_v1alpha1_ScaleStatus_To_machine_ScaleStatus(in *ScaleStatus, out *machine.ScaleStatus, s conversion.Scope) error { + out.Replicas = in.Replicas + out.Selector = (*meta_v1.LabelSelector)(unsafe.Pointer(in.Selector)) + out.TargetSelector = in.TargetSelector + return nil +} + +// Convert_v1alpha1_ScaleStatus_To_machine_ScaleStatus is an autogenerated conversion function. +func Convert_v1alpha1_ScaleStatus_To_machine_ScaleStatus(in *ScaleStatus, out *machine.ScaleStatus, s conversion.Scope) error { + return autoConvert_v1alpha1_ScaleStatus_To_machine_ScaleStatus(in, out, s) +} + +func autoConvert_machine_ScaleStatus_To_v1alpha1_ScaleStatus(in *machine.ScaleStatus, out *ScaleStatus, s conversion.Scope) error { + out.Replicas = in.Replicas + out.Selector = (*meta_v1.LabelSelector)(unsafe.Pointer(in.Selector)) + out.TargetSelector = in.TargetSelector + return nil +} + +// Convert_machine_ScaleStatus_To_v1alpha1_ScaleStatus is an autogenerated conversion function. +func Convert_machine_ScaleStatus_To_v1alpha1_ScaleStatus(in *machine.ScaleStatus, out *ScaleStatus, s conversion.Scope) error { + return autoConvert_machine_ScaleStatus_To_v1alpha1_ScaleStatus(in, out, s) +} diff --git a/pkg/apis/node/v1alpha1/zz_generated.deepcopy.go b/pkg/apis/machine/v1alpha1/zz_generated.deepcopy.go similarity index 74% rename from pkg/apis/node/v1alpha1/zz_generated.deepcopy.go rename to pkg/apis/machine/v1alpha1/zz_generated.deepcopy.go index be75cd651..5d51357ac 100644 --- a/pkg/apis/node/v1alpha1/zz_generated.deepcopy.go +++ b/pkg/apis/machine/v1alpha1/zz_generated.deepcopy.go @@ -36,17 +36,17 @@ func RegisterDeepCopies(scheme *runtime.Scheme) error { return nil }, InType: reflect.TypeOf(&AWSIAMProfileSpec{})}, conversion.GeneratedDeepCopyFunc{Fn: func(in interface{}, out interface{}, c *conversion.Cloner) error { - in.(*AWSInstanceClass).DeepCopyInto(out.(*AWSInstanceClass)) + in.(*AWSMachineClass).DeepCopyInto(out.(*AWSMachineClass)) return nil - }, InType: reflect.TypeOf(&AWSInstanceClass{})}, + }, InType: reflect.TypeOf(&AWSMachineClass{})}, conversion.GeneratedDeepCopyFunc{Fn: func(in interface{}, out interface{}, c *conversion.Cloner) error { - in.(*AWSInstanceClassList).DeepCopyInto(out.(*AWSInstanceClassList)) + in.(*AWSMachineClassList).DeepCopyInto(out.(*AWSMachineClassList)) return nil - }, InType: reflect.TypeOf(&AWSInstanceClassList{})}, + }, InType: reflect.TypeOf(&AWSMachineClassList{})}, conversion.GeneratedDeepCopyFunc{Fn: func(in interface{}, out interface{}, c *conversion.Cloner) error { - in.(*AWSInstanceClassSpec).DeepCopyInto(out.(*AWSInstanceClassSpec)) + in.(*AWSMachineClassSpec).DeepCopyInto(out.(*AWSMachineClassSpec)) return nil - }, InType: reflect.TypeOf(&AWSInstanceClassSpec{})}, + }, InType: reflect.TypeOf(&AWSMachineClassSpec{})}, conversion.GeneratedDeepCopyFunc{Fn: func(in interface{}, out interface{}, c *conversion.Cloner) error { in.(*AWSNetworkInterfaceSpec).DeepCopyInto(out.(*AWSNetworkInterfaceSpec)) return nil @@ -60,93 +60,93 @@ func RegisterDeepCopies(scheme *runtime.Scheme) error { return nil }, InType: reflect.TypeOf(&CurrentStatus{})}, conversion.GeneratedDeepCopyFunc{Fn: func(in interface{}, out interface{}, c *conversion.Cloner) error { - in.(*Instance).DeepCopyInto(out.(*Instance)) + in.(*LastOperation).DeepCopyInto(out.(*LastOperation)) return nil - }, InType: reflect.TypeOf(&Instance{})}, + }, InType: reflect.TypeOf(&LastOperation{})}, conversion.GeneratedDeepCopyFunc{Fn: func(in interface{}, out interface{}, c *conversion.Cloner) error { - in.(*InstanceDeployment).DeepCopyInto(out.(*InstanceDeployment)) + in.(*Machine).DeepCopyInto(out.(*Machine)) return nil - }, InType: reflect.TypeOf(&InstanceDeployment{})}, + }, InType: reflect.TypeOf(&Machine{})}, conversion.GeneratedDeepCopyFunc{Fn: func(in interface{}, out interface{}, c *conversion.Cloner) error { - in.(*InstanceDeploymentCondition).DeepCopyInto(out.(*InstanceDeploymentCondition)) + in.(*MachineDeployment).DeepCopyInto(out.(*MachineDeployment)) return nil - }, InType: reflect.TypeOf(&InstanceDeploymentCondition{})}, + }, InType: reflect.TypeOf(&MachineDeployment{})}, conversion.GeneratedDeepCopyFunc{Fn: func(in interface{}, out interface{}, c *conversion.Cloner) error { - in.(*InstanceDeploymentList).DeepCopyInto(out.(*InstanceDeploymentList)) + in.(*MachineDeploymentCondition).DeepCopyInto(out.(*MachineDeploymentCondition)) return nil - }, InType: reflect.TypeOf(&InstanceDeploymentList{})}, + }, InType: reflect.TypeOf(&MachineDeploymentCondition{})}, conversion.GeneratedDeepCopyFunc{Fn: func(in interface{}, out interface{}, c *conversion.Cloner) error { - in.(*InstanceDeploymentRollback).DeepCopyInto(out.(*InstanceDeploymentRollback)) + in.(*MachineDeploymentList).DeepCopyInto(out.(*MachineDeploymentList)) return nil - }, InType: reflect.TypeOf(&InstanceDeploymentRollback{})}, + }, InType: reflect.TypeOf(&MachineDeploymentList{})}, conversion.GeneratedDeepCopyFunc{Fn: func(in interface{}, out interface{}, c *conversion.Cloner) error { - in.(*InstanceDeploymentSpec).DeepCopyInto(out.(*InstanceDeploymentSpec)) + in.(*MachineDeploymentRollback).DeepCopyInto(out.(*MachineDeploymentRollback)) return nil - }, InType: reflect.TypeOf(&InstanceDeploymentSpec{})}, + }, InType: reflect.TypeOf(&MachineDeploymentRollback{})}, conversion.GeneratedDeepCopyFunc{Fn: func(in interface{}, out interface{}, c *conversion.Cloner) error { - in.(*InstanceDeploymentStatus).DeepCopyInto(out.(*InstanceDeploymentStatus)) + in.(*MachineDeploymentSpec).DeepCopyInto(out.(*MachineDeploymentSpec)) return nil - }, InType: reflect.TypeOf(&InstanceDeploymentStatus{})}, + }, InType: reflect.TypeOf(&MachineDeploymentSpec{})}, conversion.GeneratedDeepCopyFunc{Fn: func(in interface{}, out interface{}, c *conversion.Cloner) error { - in.(*InstanceDeploymentStrategy).DeepCopyInto(out.(*InstanceDeploymentStrategy)) + in.(*MachineDeploymentStatus).DeepCopyInto(out.(*MachineDeploymentStatus)) return nil - }, InType: reflect.TypeOf(&InstanceDeploymentStrategy{})}, + }, InType: reflect.TypeOf(&MachineDeploymentStatus{})}, conversion.GeneratedDeepCopyFunc{Fn: func(in interface{}, out interface{}, c *conversion.Cloner) error { - in.(*InstanceList).DeepCopyInto(out.(*InstanceList)) + in.(*MachineDeploymentStrategy).DeepCopyInto(out.(*MachineDeploymentStrategy)) return nil - }, InType: reflect.TypeOf(&InstanceList{})}, + }, InType: reflect.TypeOf(&MachineDeploymentStrategy{})}, conversion.GeneratedDeepCopyFunc{Fn: func(in interface{}, out interface{}, c *conversion.Cloner) error { - in.(*InstanceSet).DeepCopyInto(out.(*InstanceSet)) + in.(*MachineList).DeepCopyInto(out.(*MachineList)) return nil - }, InType: reflect.TypeOf(&InstanceSet{})}, + }, InType: reflect.TypeOf(&MachineList{})}, conversion.GeneratedDeepCopyFunc{Fn: func(in interface{}, out interface{}, c *conversion.Cloner) error { - in.(*InstanceSetCondition).DeepCopyInto(out.(*InstanceSetCondition)) + in.(*MachineSet).DeepCopyInto(out.(*MachineSet)) return nil - }, InType: reflect.TypeOf(&InstanceSetCondition{})}, + }, InType: reflect.TypeOf(&MachineSet{})}, conversion.GeneratedDeepCopyFunc{Fn: func(in interface{}, out interface{}, c *conversion.Cloner) error { - in.(*InstanceSetList).DeepCopyInto(out.(*InstanceSetList)) + in.(*MachineSetCondition).DeepCopyInto(out.(*MachineSetCondition)) return nil - }, InType: reflect.TypeOf(&InstanceSetList{})}, + }, InType: reflect.TypeOf(&MachineSetCondition{})}, conversion.GeneratedDeepCopyFunc{Fn: func(in interface{}, out interface{}, c *conversion.Cloner) error { - in.(*InstanceSetSpec).DeepCopyInto(out.(*InstanceSetSpec)) + in.(*MachineSetList).DeepCopyInto(out.(*MachineSetList)) return nil - }, InType: reflect.TypeOf(&InstanceSetSpec{})}, + }, InType: reflect.TypeOf(&MachineSetList{})}, conversion.GeneratedDeepCopyFunc{Fn: func(in interface{}, out interface{}, c *conversion.Cloner) error { - in.(*InstanceSetStatus).DeepCopyInto(out.(*InstanceSetStatus)) + in.(*MachineSetSpec).DeepCopyInto(out.(*MachineSetSpec)) return nil - }, InType: reflect.TypeOf(&InstanceSetStatus{})}, + }, InType: reflect.TypeOf(&MachineSetSpec{})}, conversion.GeneratedDeepCopyFunc{Fn: func(in interface{}, out interface{}, c *conversion.Cloner) error { - in.(*InstanceSpec).DeepCopyInto(out.(*InstanceSpec)) + in.(*MachineSetStatus).DeepCopyInto(out.(*MachineSetStatus)) return nil - }, InType: reflect.TypeOf(&InstanceSpec{})}, + }, InType: reflect.TypeOf(&MachineSetStatus{})}, conversion.GeneratedDeepCopyFunc{Fn: func(in interface{}, out interface{}, c *conversion.Cloner) error { - in.(*InstanceStatus).DeepCopyInto(out.(*InstanceStatus)) + in.(*MachineSpec).DeepCopyInto(out.(*MachineSpec)) return nil - }, InType: reflect.TypeOf(&InstanceStatus{})}, + }, InType: reflect.TypeOf(&MachineSpec{})}, conversion.GeneratedDeepCopyFunc{Fn: func(in interface{}, out interface{}, c *conversion.Cloner) error { - in.(*InstanceTemplate).DeepCopyInto(out.(*InstanceTemplate)) + in.(*MachineStatus).DeepCopyInto(out.(*MachineStatus)) return nil - }, InType: reflect.TypeOf(&InstanceTemplate{})}, + }, InType: reflect.TypeOf(&MachineStatus{})}, conversion.GeneratedDeepCopyFunc{Fn: func(in interface{}, out interface{}, c *conversion.Cloner) error { - in.(*InstanceTemplateList).DeepCopyInto(out.(*InstanceTemplateList)) + in.(*MachineTemplate).DeepCopyInto(out.(*MachineTemplate)) return nil - }, InType: reflect.TypeOf(&InstanceTemplateList{})}, + }, InType: reflect.TypeOf(&MachineTemplate{})}, conversion.GeneratedDeepCopyFunc{Fn: func(in interface{}, out interface{}, c *conversion.Cloner) error { - in.(*InstanceTemplateSpec).DeepCopyInto(out.(*InstanceTemplateSpec)) + in.(*MachineTemplateList).DeepCopyInto(out.(*MachineTemplateList)) return nil - }, InType: reflect.TypeOf(&InstanceTemplateSpec{})}, + }, InType: reflect.TypeOf(&MachineTemplateList{})}, conversion.GeneratedDeepCopyFunc{Fn: func(in interface{}, out interface{}, c *conversion.Cloner) error { - in.(*LastOperation).DeepCopyInto(out.(*LastOperation)) + in.(*MachineTemplateSpec).DeepCopyInto(out.(*MachineTemplateSpec)) return nil - }, InType: reflect.TypeOf(&LastOperation{})}, + }, InType: reflect.TypeOf(&MachineTemplateSpec{})}, conversion.GeneratedDeepCopyFunc{Fn: func(in interface{}, out interface{}, c *conversion.Cloner) error { in.(*RollbackConfig).DeepCopyInto(out.(*RollbackConfig)) return nil }, InType: reflect.TypeOf(&RollbackConfig{})}, conversion.GeneratedDeepCopyFunc{Fn: func(in interface{}, out interface{}, c *conversion.Cloner) error { - in.(*RollingUpdateInstanceDeployment).DeepCopyInto(out.(*RollingUpdateInstanceDeployment)) + in.(*RollingUpdateMachineDeployment).DeepCopyInto(out.(*RollingUpdateMachineDeployment)) return nil - }, InType: reflect.TypeOf(&RollingUpdateInstanceDeployment{})}, + }, InType: reflect.TypeOf(&RollingUpdateMachineDeployment{})}, conversion.GeneratedDeepCopyFunc{Fn: func(in interface{}, out interface{}, c *conversion.Cloner) error { in.(*Scale).DeepCopyInto(out.(*Scale)) return nil @@ -212,7 +212,7 @@ func (in *AWSIAMProfileSpec) DeepCopy() *AWSIAMProfileSpec { } // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *AWSInstanceClass) DeepCopyInto(out *AWSInstanceClass) { +func (in *AWSMachineClass) DeepCopyInto(out *AWSMachineClass) { *out = *in in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) out.TypeMeta = in.TypeMeta @@ -220,18 +220,18 @@ func (in *AWSInstanceClass) DeepCopyInto(out *AWSInstanceClass) { return } -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new AWSInstanceClass. -func (in *AWSInstanceClass) DeepCopy() *AWSInstanceClass { +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new AWSMachineClass. +func (in *AWSMachineClass) DeepCopy() *AWSMachineClass { if in == nil { return nil } - out := new(AWSInstanceClass) + out := new(AWSMachineClass) in.DeepCopyInto(out) return out } // DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. -func (in *AWSInstanceClass) DeepCopyObject() runtime.Object { +func (in *AWSMachineClass) DeepCopyObject() runtime.Object { if c := in.DeepCopy(); c != nil { return c } else { @@ -240,13 +240,13 @@ func (in *AWSInstanceClass) DeepCopyObject() runtime.Object { } // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *AWSInstanceClassList) DeepCopyInto(out *AWSInstanceClassList) { +func (in *AWSMachineClassList) DeepCopyInto(out *AWSMachineClassList) { *out = *in out.TypeMeta = in.TypeMeta out.ListMeta = in.ListMeta if in.Items != nil { in, out := &in.Items, &out.Items - *out = make([]AWSInstanceClass, len(*in)) + *out = make([]AWSMachineClass, len(*in)) for i := range *in { (*in)[i].DeepCopyInto(&(*out)[i]) } @@ -254,18 +254,18 @@ func (in *AWSInstanceClassList) DeepCopyInto(out *AWSInstanceClassList) { return } -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new AWSInstanceClassList. -func (in *AWSInstanceClassList) DeepCopy() *AWSInstanceClassList { +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new AWSMachineClassList. +func (in *AWSMachineClassList) DeepCopy() *AWSMachineClassList { if in == nil { return nil } - out := new(AWSInstanceClassList) + out := new(AWSMachineClassList) in.DeepCopyInto(out) return out } // DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. -func (in *AWSInstanceClassList) DeepCopyObject() runtime.Object { +func (in *AWSMachineClassList) DeepCopyObject() runtime.Object { if c := in.DeepCopy(); c != nil { return c } else { @@ -274,7 +274,7 @@ func (in *AWSInstanceClassList) DeepCopyObject() runtime.Object { } // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *AWSInstanceClassSpec) DeepCopyInto(out *AWSInstanceClassSpec) { +func (in *AWSMachineClassSpec) DeepCopyInto(out *AWSMachineClassSpec) { *out = *in if in.BlockDevices != nil { in, out := &in.BlockDevices, &out.BlockDevices @@ -308,12 +308,12 @@ func (in *AWSInstanceClassSpec) DeepCopyInto(out *AWSInstanceClassSpec) { return } -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new AWSInstanceClassSpec. -func (in *AWSInstanceClassSpec) DeepCopy() *AWSInstanceClassSpec { +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new AWSMachineClassSpec. +func (in *AWSMachineClassSpec) DeepCopy() *AWSMachineClassSpec { if in == nil { return nil } - out := new(AWSInstanceClassSpec) + out := new(AWSMachineClassSpec) in.DeepCopyInto(out) return out } @@ -373,7 +373,24 @@ func (in *CurrentStatus) DeepCopy() *CurrentStatus { } // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *Instance) DeepCopyInto(out *Instance) { +func (in *LastOperation) DeepCopyInto(out *LastOperation) { + *out = *in + in.LastUpdateTime.DeepCopyInto(&out.LastUpdateTime) + 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 in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) out.TypeMeta = in.TypeMeta @@ -382,18 +399,18 @@ func (in *Instance) DeepCopyInto(out *Instance) { return } -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Instance. -func (in *Instance) DeepCopy() *Instance { +// 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(Instance) + out := new(Machine) in.DeepCopyInto(out) return out } // DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. -func (in *Instance) DeepCopyObject() runtime.Object { +func (in *Machine) DeepCopyObject() runtime.Object { if c := in.DeepCopy(); c != nil { return c } else { @@ -402,7 +419,7 @@ func (in *Instance) DeepCopyObject() runtime.Object { } // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *InstanceDeployment) DeepCopyInto(out *InstanceDeployment) { +func (in *MachineDeployment) DeepCopyInto(out *MachineDeployment) { *out = *in out.TypeMeta = in.TypeMeta in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) @@ -411,18 +428,18 @@ func (in *InstanceDeployment) DeepCopyInto(out *InstanceDeployment) { return } -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new InstanceDeployment. -func (in *InstanceDeployment) DeepCopy() *InstanceDeployment { +// 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(InstanceDeployment) + out := new(MachineDeployment) in.DeepCopyInto(out) return out } // DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. -func (in *InstanceDeployment) DeepCopyObject() runtime.Object { +func (in *MachineDeployment) DeepCopyObject() runtime.Object { if c := in.DeepCopy(); c != nil { return c } else { @@ -431,31 +448,31 @@ func (in *InstanceDeployment) DeepCopyObject() runtime.Object { } // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *InstanceDeploymentCondition) DeepCopyInto(out *InstanceDeploymentCondition) { +func (in *MachineDeploymentCondition) DeepCopyInto(out *MachineDeploymentCondition) { *out = *in in.LastUpdateTime.DeepCopyInto(&out.LastUpdateTime) in.LastTransitionTime.DeepCopyInto(&out.LastTransitionTime) return } -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new InstanceDeploymentCondition. -func (in *InstanceDeploymentCondition) DeepCopy() *InstanceDeploymentCondition { +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new MachineDeploymentCondition. +func (in *MachineDeploymentCondition) DeepCopy() *MachineDeploymentCondition { if in == nil { return nil } - out := new(InstanceDeploymentCondition) + out := new(MachineDeploymentCondition) in.DeepCopyInto(out) return out } // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *InstanceDeploymentList) DeepCopyInto(out *InstanceDeploymentList) { +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([]InstanceDeployment, len(*in)) + *out = make([]MachineDeployment, len(*in)) for i := range *in { (*in)[i].DeepCopyInto(&(*out)[i]) } @@ -463,18 +480,18 @@ func (in *InstanceDeploymentList) DeepCopyInto(out *InstanceDeploymentList) { return } -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new InstanceDeploymentList. -func (in *InstanceDeploymentList) DeepCopy() *InstanceDeploymentList { +// 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(InstanceDeploymentList) + out := new(MachineDeploymentList) in.DeepCopyInto(out) return out } // DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. -func (in *InstanceDeploymentList) DeepCopyObject() runtime.Object { +func (in *MachineDeploymentList) DeepCopyObject() runtime.Object { if c := in.DeepCopy(); c != nil { return c } else { @@ -483,7 +500,7 @@ func (in *InstanceDeploymentList) DeepCopyObject() runtime.Object { } // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *InstanceDeploymentRollback) DeepCopyInto(out *InstanceDeploymentRollback) { +func (in *MachineDeploymentRollback) DeepCopyInto(out *MachineDeploymentRollback) { *out = *in out.TypeMeta = in.TypeMeta if in.UpdatedAnnotations != nil { @@ -497,18 +514,18 @@ func (in *InstanceDeploymentRollback) DeepCopyInto(out *InstanceDeploymentRollba return } -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new InstanceDeploymentRollback. -func (in *InstanceDeploymentRollback) DeepCopy() *InstanceDeploymentRollback { +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new MachineDeploymentRollback. +func (in *MachineDeploymentRollback) DeepCopy() *MachineDeploymentRollback { if in == nil { return nil } - out := new(InstanceDeploymentRollback) + out := new(MachineDeploymentRollback) in.DeepCopyInto(out) return out } // DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. -func (in *InstanceDeploymentRollback) DeepCopyObject() runtime.Object { +func (in *MachineDeploymentRollback) DeepCopyObject() runtime.Object { if c := in.DeepCopy(); c != nil { return c } else { @@ -517,7 +534,7 @@ func (in *InstanceDeploymentRollback) DeepCopyObject() runtime.Object { } // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *InstanceDeploymentSpec) DeepCopyInto(out *InstanceDeploymentSpec) { +func (in *MachineDeploymentSpec) DeepCopyInto(out *MachineDeploymentSpec) { *out = *in if in.Selector != nil { in, out := &in.Selector, &out.Selector @@ -560,22 +577,22 @@ func (in *InstanceDeploymentSpec) DeepCopyInto(out *InstanceDeploymentSpec) { return } -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new InstanceDeploymentSpec. -func (in *InstanceDeploymentSpec) DeepCopy() *InstanceDeploymentSpec { +// 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(InstanceDeploymentSpec) + 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 *InstanceDeploymentStatus) DeepCopyInto(out *InstanceDeploymentStatus) { +func (in *MachineDeploymentStatus) DeepCopyInto(out *MachineDeploymentStatus) { *out = *in if in.Conditions != nil { in, out := &in.Conditions, &out.Conditions - *out = make([]InstanceDeploymentCondition, len(*in)) + *out = make([]MachineDeploymentCondition, len(*in)) for i := range *in { (*in)[i].DeepCopyInto(&(*out)[i]) } @@ -592,49 +609,49 @@ func (in *InstanceDeploymentStatus) DeepCopyInto(out *InstanceDeploymentStatus) return } -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new InstanceDeploymentStatus. -func (in *InstanceDeploymentStatus) DeepCopy() *InstanceDeploymentStatus { +// 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(InstanceDeploymentStatus) + 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 *InstanceDeploymentStrategy) DeepCopyInto(out *InstanceDeploymentStrategy) { +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(RollingUpdateInstanceDeployment) + *out = new(RollingUpdateMachineDeployment) (*in).DeepCopyInto(*out) } } return } -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new InstanceDeploymentStrategy. -func (in *InstanceDeploymentStrategy) DeepCopy() *InstanceDeploymentStrategy { +// 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(InstanceDeploymentStrategy) + 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 *InstanceList) DeepCopyInto(out *InstanceList) { +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([]Instance, len(*in)) + *out = make([]Machine, len(*in)) for i := range *in { (*in)[i].DeepCopyInto(&(*out)[i]) } @@ -642,18 +659,18 @@ func (in *InstanceList) DeepCopyInto(out *InstanceList) { return } -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new InstanceList. -func (in *InstanceList) DeepCopy() *InstanceList { +// 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(InstanceList) + out := new(MachineList) in.DeepCopyInto(out) return out } // DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. -func (in *InstanceList) DeepCopyObject() runtime.Object { +func (in *MachineList) DeepCopyObject() runtime.Object { if c := in.DeepCopy(); c != nil { return c } else { @@ -662,7 +679,7 @@ func (in *InstanceList) DeepCopyObject() runtime.Object { } // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *InstanceSet) DeepCopyInto(out *InstanceSet) { +func (in *MachineSet) DeepCopyInto(out *MachineSet) { *out = *in in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) out.TypeMeta = in.TypeMeta @@ -671,18 +688,18 @@ func (in *InstanceSet) DeepCopyInto(out *InstanceSet) { return } -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new InstanceSet. -func (in *InstanceSet) DeepCopy() *InstanceSet { +// 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(InstanceSet) + out := new(MachineSet) in.DeepCopyInto(out) return out } // DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. -func (in *InstanceSet) DeepCopyObject() runtime.Object { +func (in *MachineSet) DeepCopyObject() runtime.Object { if c := in.DeepCopy(); c != nil { return c } else { @@ -691,30 +708,30 @@ func (in *InstanceSet) DeepCopyObject() runtime.Object { } // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *InstanceSetCondition) DeepCopyInto(out *InstanceSetCondition) { +func (in *MachineSetCondition) DeepCopyInto(out *MachineSetCondition) { *out = *in in.LastTransitionTime.DeepCopyInto(&out.LastTransitionTime) return } -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new InstanceSetCondition. -func (in *InstanceSetCondition) DeepCopy() *InstanceSetCondition { +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new MachineSetCondition. +func (in *MachineSetCondition) DeepCopy() *MachineSetCondition { if in == nil { return nil } - out := new(InstanceSetCondition) + out := new(MachineSetCondition) in.DeepCopyInto(out) return out } // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *InstanceSetList) DeepCopyInto(out *InstanceSetList) { +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([]InstanceSet, len(*in)) + *out = make([]MachineSet, len(*in)) for i := range *in { (*in)[i].DeepCopyInto(&(*out)[i]) } @@ -722,18 +739,18 @@ func (in *InstanceSetList) DeepCopyInto(out *InstanceSetList) { return } -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new InstanceSetList. -func (in *InstanceSetList) DeepCopy() *InstanceSetList { +// 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(InstanceSetList) + out := new(MachineSetList) in.DeepCopyInto(out) return out } // DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. -func (in *InstanceSetList) DeepCopyObject() runtime.Object { +func (in *MachineSetList) DeepCopyObject() runtime.Object { if c := in.DeepCopy(); c != nil { return c } else { @@ -742,7 +759,7 @@ func (in *InstanceSetList) DeepCopyObject() runtime.Object { } // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *InstanceSetSpec) DeepCopyInto(out *InstanceSetSpec) { +func (in *MachineSetSpec) DeepCopyInto(out *MachineSetSpec) { *out = *in if in.Selector != nil { in, out := &in.Selector, &out.Selector @@ -753,28 +770,28 @@ func (in *InstanceSetSpec) DeepCopyInto(out *InstanceSetSpec) { (*in).DeepCopyInto(*out) } } - out.InstanceClass = in.InstanceClass + out.MachineClass = in.MachineClass in.Template.DeepCopyInto(&out.Template) return } -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new InstanceSetSpec. -func (in *InstanceSetSpec) DeepCopy() *InstanceSetSpec { +// 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(InstanceSetSpec) + 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 *InstanceSetStatus) DeepCopyInto(out *InstanceSetStatus) { +func (in *MachineSetStatus) DeepCopyInto(out *MachineSetStatus) { *out = *in in.LastOperation.DeepCopyInto(&out.LastOperation) if in.Conditions != nil { in, out := &in.Conditions, &out.Conditions - *out = make([]InstanceSetCondition, len(*in)) + *out = make([]MachineSetCondition, len(*in)) for i := range *in { (*in)[i].DeepCopyInto(&(*out)[i]) } @@ -782,35 +799,35 @@ func (in *InstanceSetStatus) DeepCopyInto(out *InstanceSetStatus) { return } -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new InstanceSetStatus. -func (in *InstanceSetStatus) DeepCopy() *InstanceSetStatus { +// 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(InstanceSetStatus) + 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 *InstanceSpec) DeepCopyInto(out *InstanceSpec) { +func (in *MachineSpec) DeepCopyInto(out *MachineSpec) { *out = *in out.Class = in.Class return } -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new InstanceSpec. -func (in *InstanceSpec) DeepCopy() *InstanceSpec { +// 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(InstanceSpec) + 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 *InstanceStatus) DeepCopyInto(out *InstanceStatus) { +func (in *MachineStatus) DeepCopyInto(out *MachineStatus) { *out = *in if in.Conditions != nil { in, out := &in.Conditions, &out.Conditions @@ -824,18 +841,18 @@ func (in *InstanceStatus) DeepCopyInto(out *InstanceStatus) { return } -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new InstanceStatus. -func (in *InstanceStatus) DeepCopy() *InstanceStatus { +// 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(InstanceStatus) + 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 *InstanceTemplate) DeepCopyInto(out *InstanceTemplate) { +func (in *MachineTemplate) DeepCopyInto(out *MachineTemplate) { *out = *in out.TypeMeta = in.TypeMeta in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) @@ -843,18 +860,18 @@ func (in *InstanceTemplate) DeepCopyInto(out *InstanceTemplate) { return } -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new InstanceTemplate. -func (in *InstanceTemplate) DeepCopy() *InstanceTemplate { +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new MachineTemplate. +func (in *MachineTemplate) DeepCopy() *MachineTemplate { if in == nil { return nil } - out := new(InstanceTemplate) + out := new(MachineTemplate) in.DeepCopyInto(out) return out } // DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. -func (in *InstanceTemplate) DeepCopyObject() runtime.Object { +func (in *MachineTemplate) DeepCopyObject() runtime.Object { if c := in.DeepCopy(); c != nil { return c } else { @@ -863,13 +880,13 @@ func (in *InstanceTemplate) DeepCopyObject() runtime.Object { } // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *InstanceTemplateList) DeepCopyInto(out *InstanceTemplateList) { +func (in *MachineTemplateList) DeepCopyInto(out *MachineTemplateList) { *out = *in out.TypeMeta = in.TypeMeta out.ListMeta = in.ListMeta if in.Items != nil { in, out := &in.Items, &out.Items - *out = make([]InstanceTemplate, len(*in)) + *out = make([]MachineTemplate, len(*in)) for i := range *in { (*in)[i].DeepCopyInto(&(*out)[i]) } @@ -877,18 +894,18 @@ func (in *InstanceTemplateList) DeepCopyInto(out *InstanceTemplateList) { return } -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new InstanceTemplateList. -func (in *InstanceTemplateList) DeepCopy() *InstanceTemplateList { +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new MachineTemplateList. +func (in *MachineTemplateList) DeepCopy() *MachineTemplateList { if in == nil { return nil } - out := new(InstanceTemplateList) + out := new(MachineTemplateList) in.DeepCopyInto(out) return out } // DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. -func (in *InstanceTemplateList) DeepCopyObject() runtime.Object { +func (in *MachineTemplateList) DeepCopyObject() runtime.Object { if c := in.DeepCopy(); c != nil { return c } else { @@ -897,36 +914,19 @@ func (in *InstanceTemplateList) DeepCopyObject() runtime.Object { } // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *InstanceTemplateSpec) DeepCopyInto(out *InstanceTemplateSpec) { +func (in *MachineTemplateSpec) DeepCopyInto(out *MachineTemplateSpec) { *out = *in in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) out.Spec = in.Spec return } -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new InstanceTemplateSpec. -func (in *InstanceTemplateSpec) DeepCopy() *InstanceTemplateSpec { +// 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(InstanceTemplateSpec) - 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 - in.LastUpdateTime.DeepCopyInto(&out.LastUpdateTime) - 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) + out := new(MachineTemplateSpec) in.DeepCopyInto(out) return out } @@ -948,7 +948,7 @@ func (in *RollbackConfig) DeepCopy() *RollbackConfig { } // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *RollingUpdateInstanceDeployment) DeepCopyInto(out *RollingUpdateInstanceDeployment) { +func (in *RollingUpdateMachineDeployment) DeepCopyInto(out *RollingUpdateMachineDeployment) { *out = *in if in.MaxUnavailable != nil { in, out := &in.MaxUnavailable, &out.MaxUnavailable @@ -971,12 +971,12 @@ func (in *RollingUpdateInstanceDeployment) DeepCopyInto(out *RollingUpdateInstan return } -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new RollingUpdateInstanceDeployment. -func (in *RollingUpdateInstanceDeployment) DeepCopy() *RollingUpdateInstanceDeployment { +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new RollingUpdateMachineDeployment. +func (in *RollingUpdateMachineDeployment) DeepCopy() *RollingUpdateMachineDeployment { if in == nil { return nil } - out := new(RollingUpdateInstanceDeployment) + out := new(RollingUpdateMachineDeployment) in.DeepCopyInto(out) return out } diff --git a/pkg/apis/node/v1alpha1/zz_generated.defaults.go b/pkg/apis/machine/v1alpha1/zz_generated.defaults.go similarity index 100% rename from pkg/apis/node/v1alpha1/zz_generated.defaults.go rename to pkg/apis/machine/v1alpha1/zz_generated.defaults.go diff --git a/pkg/apis/node/validation/awsinstanceclass.go b/pkg/apis/machine/validation/awsmachineclass.go similarity index 81% rename from pkg/apis/node/validation/awsinstanceclass.go rename to pkg/apis/machine/validation/awsmachineclass.go index 794a3e4e8..6f7ef1720 100644 --- a/pkg/apis/node/validation/awsinstanceclass.go +++ b/pkg/apis/machine/validation/awsmachineclass.go @@ -25,7 +25,7 @@ import ( utilvalidation "k8s.io/apimachinery/pkg/util/validation" "k8s.io/apimachinery/pkg/util/validation/field" - "github.com/gardener/node-controller-manager/pkg/apis/node" + "github.com/gardener/node-controller-manager/pkg/apis/machine" ) const nameFmt string = `[-a-z0-9]+` @@ -46,23 +46,23 @@ func validateName(value string, prefix bool) []string { return errs } -// ValidateAWSInstanceClass validates a AWSInstanceClass and returns a list of errors. -func ValidateAWSInstanceClass(AWSInstanceClass *node.AWSInstanceClass) field.ErrorList { - return internalValidateAWSInstanceClass(AWSInstanceClass) +// ValidateAWSMachineClass validates a AWSMachineClass and returns a list of errors. +func ValidateAWSMachineClass(AWSMachineClass *machine.AWSMachineClass) field.ErrorList { + return internalValidateAWSMachineClass(AWSMachineClass) } -func internalValidateAWSInstanceClass(AWSInstanceClass *node.AWSInstanceClass) field.ErrorList { +func internalValidateAWSMachineClass(AWSMachineClass *machine.AWSMachineClass) field.ErrorList { allErrs := field.ErrorList{} - allErrs = append(allErrs, apivalidation.ValidateObjectMeta(&AWSInstanceClass.ObjectMeta, false, /*namespace*/ + allErrs = append(allErrs, apivalidation.ValidateObjectMeta(&AWSMachineClass.ObjectMeta, false, /*namespace*/ validateName, field.NewPath("metadata"))...) - allErrs = append(allErrs, validateAWSInstanceClassSpec(&AWSInstanceClass.Spec, field.NewPath("spec"))...) + allErrs = append(allErrs, validateAWSMachineClassSpec(&AWSMachineClass.Spec, field.NewPath("spec"))...) return allErrs } -func validateAWSInstanceClassSpec(spec *node.AWSInstanceClassSpec, fldPath *field.Path) field.ErrorList { +func validateAWSMachineClassSpec(spec *machine.AWSMachineClassSpec, fldPath *field.Path) field.ErrorList { allErrs := field.ErrorList{} if "" == spec.AMI { @@ -71,8 +71,8 @@ func validateAWSInstanceClassSpec(spec *node.AWSInstanceClassSpec, fldPath *fiel if "" == spec.AvailabilityZone { allErrs = append(allErrs, field.Required(fldPath.Child("availabilityZone"), "AvailabilityZone is required")) } - if "" == spec.InstanceType { - allErrs = append(allErrs, field.Required(fldPath.Child("instanceType"), "InstanceType is required")) + if "" == spec.MachineType { + allErrs = append(allErrs, field.Required(fldPath.Child("machineType"), "MachineType is required")) } if "" == spec.IAM.Name { allErrs = append(allErrs, field.Required(fldPath.Child("iam.name"), "IAM Name is required")) @@ -88,7 +88,7 @@ func validateAWSInstanceClassSpec(spec *node.AWSInstanceClassSpec, fldPath *fiel return allErrs } -func validateBlockDevices(blockDevices []node.AWSBlockDeviceMappingSpec, fldPath *field.Path) field.ErrorList { +func validateBlockDevices(blockDevices []machine.AWSBlockDeviceMappingSpec, fldPath *field.Path) field.ErrorList { allErrs := field.ErrorList{} if len(blockDevices) > 1 { allErrs = append(allErrs, field.Required(fldPath.Child(""), "Can only specify one (root) block device")) @@ -103,7 +103,7 @@ func validateBlockDevices(blockDevices []node.AWSBlockDeviceMappingSpec, fldPath return allErrs } -func validateNetworkInterfaces(networkInterfaces []node.AWSNetworkInterfaceSpec, fldPath *field.Path) field.ErrorList { +func validateNetworkInterfaces(networkInterfaces []machine.AWSNetworkInterfaceSpec, fldPath *field.Path) field.ErrorList { allErrs := field.ErrorList{} if len(networkInterfaces) == 0 { allErrs = append(allErrs, field.Required(fldPath.Child(""), "Mention atleast one NetworkInterface")) diff --git a/pkg/apis/node/validation/instance.go b/pkg/apis/machine/validation/machine.go similarity index 67% rename from pkg/apis/node/validation/instance.go rename to pkg/apis/machine/validation/machine.go index 6162a44d9..848ee2f88 100644 --- a/pkg/apis/node/validation/instance.go +++ b/pkg/apis/machine/validation/machine.go @@ -16,28 +16,28 @@ limitations under the License. package validation import ( - "github.com/gardener/node-controller-manager/pkg/apis/node" + "github.com/gardener/node-controller-manager/pkg/apis/machine" "k8s.io/apimachinery/pkg/util/validation/field" ) -// ValidateInstance and returns a list of errors. -func ValidateInstance(instance *node.Instance) field.ErrorList { - return internalValidateInstance(instance) +// ValidateMachine and returns a list of errors. +func ValidateMachine(machine *machine.Machine) field.ErrorList { + return internalValidateMachine(machine) } -func internalValidateInstance(instance *node.Instance) field.ErrorList { +func internalValidateMachine(machine *machine.Machine) field.ErrorList { allErrs := field.ErrorList{} - allErrs = append(allErrs, validateInstanceSpec(&instance.Spec, field.NewPath("spec"))...) + allErrs = append(allErrs, validateMachineSpec(&machine.Spec, field.NewPath("spec"))...) return allErrs } -func validateInstanceSpec(spec *node.InstanceSpec, fldPath *field.Path) field.ErrorList { +func validateMachineSpec(spec *machine.MachineSpec, fldPath *field.Path) field.ErrorList { allErrs := field.ErrorList{} allErrs = append(allErrs, validateClassReference(&spec.Class, field.NewPath("spec.class"))...) return allErrs } -func validateClassReference(classSpec *node.ClassSpec, fldPath *field.Path) field.ErrorList { +func validateClassReference(classSpec *machine.ClassSpec, fldPath *field.Path) field.ErrorList { allErrs := field.ErrorList{} if "" == classSpec.Kind { allErrs = append(allErrs, field.Required(fldPath.Child("kind"), "Kind is required")) diff --git a/pkg/apis/node/validation/instancedeployment.go b/pkg/apis/machine/validation/machinedeployment.go similarity index 72% rename from pkg/apis/node/validation/instancedeployment.go rename to pkg/apis/machine/validation/machinedeployment.go index 2be16e707..121a6e2e9 100644 --- a/pkg/apis/node/validation/instancedeployment.go +++ b/pkg/apis/machine/validation/machinedeployment.go @@ -16,22 +16,22 @@ limitations under the License. package validation import ( - "github.com/gardener/node-controller-manager/pkg/apis/node" + "github.com/gardener/node-controller-manager/pkg/apis/machine" "k8s.io/apimachinery/pkg/util/validation/field" ) -// ValidateInstanceDeployment and returns a list of errors. -func ValidateInstanceDeployment(instanceDeployment *node.InstanceDeployment) field.ErrorList { - return internalValidateInstanceDeployment(instanceDeployment) +// ValidateMachineDeployment and returns a list of errors. +func ValidateMachineDeployment(machineDeployment *machine.MachineDeployment) field.ErrorList { + return internalValidateMachineDeployment(machineDeployment) } -func internalValidateInstanceDeployment(instanceDeployment *node.InstanceDeployment) field.ErrorList { +func internalValidateMachineDeployment(machineDeployment *machine.MachineDeployment) field.ErrorList { allErrs := field.ErrorList{} - allErrs = append(allErrs, validateInstanceDeploymentSpec(&instanceDeployment.Spec, field.NewPath("spec"))...) + allErrs = append(allErrs, validateMachineDeploymentSpec(&machineDeployment.Spec, field.NewPath("spec"))...) return allErrs } -func validateInstanceDeploymentSpec(spec *node.InstanceDeploymentSpec, fldPath *field.Path) field.ErrorList { +func validateMachineDeploymentSpec(spec *machine.MachineDeploymentSpec, fldPath *field.Path) field.ErrorList { allErrs := field.ErrorList{} if spec.Replicas < 0 { @@ -51,4 +51,4 @@ func validateInstanceDeploymentSpec(spec *node.InstanceDeploymentSpec, fldPath * allErrs = append(allErrs, validateClassReference(&spec.Template.Spec.Class, field.NewPath("spec.template.spec.class"))...) return allErrs -} \ No newline at end of file +} diff --git a/pkg/apis/node/validation/instanceset.go b/pkg/apis/machine/validation/machineset.go similarity index 72% rename from pkg/apis/node/validation/instanceset.go rename to pkg/apis/machine/validation/machineset.go index f1de58a89..645520301 100644 --- a/pkg/apis/node/validation/instanceset.go +++ b/pkg/apis/machine/validation/machineset.go @@ -18,22 +18,22 @@ package validation import ( //"strconv" - "github.com/gardener/node-controller-manager/pkg/apis/node" + "github.com/gardener/node-controller-manager/pkg/apis/machine" "k8s.io/apimachinery/pkg/util/validation/field" ) -// ValidateInstance and returns a list of errors. -func ValidateInstanceSet(instanceSet *node.InstanceSet) field.ErrorList { - return internalValidateInstanceSet(instanceSet) +// ValidateMachine and returns a list of errors. +func ValidateMachineSet(machineSet *machine.MachineSet) field.ErrorList { + return internalValidateMachineSet(machineSet) } -func internalValidateInstanceSet(instanceSet *node.InstanceSet) field.ErrorList { +func internalValidateMachineSet(machineSet *machine.MachineSet) field.ErrorList { allErrs := field.ErrorList{} - allErrs = append(allErrs, validateInstanceSetSpec(&instanceSet.Spec, field.NewPath("spec"))...) + allErrs = append(allErrs, validateMachineSetSpec(&machineSet.Spec, field.NewPath("spec"))...) return allErrs } -func validateInstanceSetSpec(spec *node.InstanceSetSpec, fldPath *field.Path) field.ErrorList { +func validateMachineSetSpec(spec *machine.MachineSetSpec, fldPath *field.Path) field.ErrorList { allErrs := field.ErrorList{} if spec.Replicas < 0 { @@ -49,4 +49,4 @@ func validateInstanceSetSpec(spec *node.InstanceSetSpec, fldPath *field.Path) fi allErrs = append(allErrs, validateClassReference(&spec.Template.Spec.Class, field.NewPath("spec.template.spec.class"))...) return allErrs -} \ No newline at end of file +} diff --git a/pkg/apis/node/zz_generated.deepcopy.go b/pkg/apis/machine/zz_generated.deepcopy.go similarity index 74% rename from pkg/apis/node/zz_generated.deepcopy.go rename to pkg/apis/machine/zz_generated.deepcopy.go index 134084bde..7623d81a1 100644 --- a/pkg/apis/node/zz_generated.deepcopy.go +++ b/pkg/apis/machine/zz_generated.deepcopy.go @@ -2,7 +2,7 @@ // This file was autogenerated by deepcopy-gen. Do not edit it manually! -package node +package machine import ( v1 "k8s.io/api/core/v1" @@ -36,17 +36,17 @@ func RegisterDeepCopies(scheme *runtime.Scheme) error { return nil }, InType: reflect.TypeOf(&AWSIAMProfileSpec{})}, conversion.GeneratedDeepCopyFunc{Fn: func(in interface{}, out interface{}, c *conversion.Cloner) error { - in.(*AWSInstanceClass).DeepCopyInto(out.(*AWSInstanceClass)) + in.(*AWSMachineClass).DeepCopyInto(out.(*AWSMachineClass)) return nil - }, InType: reflect.TypeOf(&AWSInstanceClass{})}, + }, InType: reflect.TypeOf(&AWSMachineClass{})}, conversion.GeneratedDeepCopyFunc{Fn: func(in interface{}, out interface{}, c *conversion.Cloner) error { - in.(*AWSInstanceClassList).DeepCopyInto(out.(*AWSInstanceClassList)) + in.(*AWSMachineClassList).DeepCopyInto(out.(*AWSMachineClassList)) return nil - }, InType: reflect.TypeOf(&AWSInstanceClassList{})}, + }, InType: reflect.TypeOf(&AWSMachineClassList{})}, conversion.GeneratedDeepCopyFunc{Fn: func(in interface{}, out interface{}, c *conversion.Cloner) error { - in.(*AWSInstanceClassSpec).DeepCopyInto(out.(*AWSInstanceClassSpec)) + in.(*AWSMachineClassSpec).DeepCopyInto(out.(*AWSMachineClassSpec)) return nil - }, InType: reflect.TypeOf(&AWSInstanceClassSpec{})}, + }, InType: reflect.TypeOf(&AWSMachineClassSpec{})}, conversion.GeneratedDeepCopyFunc{Fn: func(in interface{}, out interface{}, c *conversion.Cloner) error { in.(*AWSNetworkInterfaceSpec).DeepCopyInto(out.(*AWSNetworkInterfaceSpec)) return nil @@ -60,93 +60,93 @@ func RegisterDeepCopies(scheme *runtime.Scheme) error { return nil }, InType: reflect.TypeOf(&CurrentStatus{})}, conversion.GeneratedDeepCopyFunc{Fn: func(in interface{}, out interface{}, c *conversion.Cloner) error { - in.(*Instance).DeepCopyInto(out.(*Instance)) + in.(*LastOperation).DeepCopyInto(out.(*LastOperation)) return nil - }, InType: reflect.TypeOf(&Instance{})}, + }, InType: reflect.TypeOf(&LastOperation{})}, conversion.GeneratedDeepCopyFunc{Fn: func(in interface{}, out interface{}, c *conversion.Cloner) error { - in.(*InstanceDeployment).DeepCopyInto(out.(*InstanceDeployment)) + in.(*Machine).DeepCopyInto(out.(*Machine)) return nil - }, InType: reflect.TypeOf(&InstanceDeployment{})}, + }, InType: reflect.TypeOf(&Machine{})}, conversion.GeneratedDeepCopyFunc{Fn: func(in interface{}, out interface{}, c *conversion.Cloner) error { - in.(*InstanceDeploymentCondition).DeepCopyInto(out.(*InstanceDeploymentCondition)) + in.(*MachineDeployment).DeepCopyInto(out.(*MachineDeployment)) return nil - }, InType: reflect.TypeOf(&InstanceDeploymentCondition{})}, + }, InType: reflect.TypeOf(&MachineDeployment{})}, conversion.GeneratedDeepCopyFunc{Fn: func(in interface{}, out interface{}, c *conversion.Cloner) error { - in.(*InstanceDeploymentList).DeepCopyInto(out.(*InstanceDeploymentList)) + in.(*MachineDeploymentCondition).DeepCopyInto(out.(*MachineDeploymentCondition)) return nil - }, InType: reflect.TypeOf(&InstanceDeploymentList{})}, + }, InType: reflect.TypeOf(&MachineDeploymentCondition{})}, conversion.GeneratedDeepCopyFunc{Fn: func(in interface{}, out interface{}, c *conversion.Cloner) error { - in.(*InstanceDeploymentRollback).DeepCopyInto(out.(*InstanceDeploymentRollback)) + in.(*MachineDeploymentList).DeepCopyInto(out.(*MachineDeploymentList)) return nil - }, InType: reflect.TypeOf(&InstanceDeploymentRollback{})}, + }, InType: reflect.TypeOf(&MachineDeploymentList{})}, conversion.GeneratedDeepCopyFunc{Fn: func(in interface{}, out interface{}, c *conversion.Cloner) error { - in.(*InstanceDeploymentSpec).DeepCopyInto(out.(*InstanceDeploymentSpec)) + in.(*MachineDeploymentRollback).DeepCopyInto(out.(*MachineDeploymentRollback)) return nil - }, InType: reflect.TypeOf(&InstanceDeploymentSpec{})}, + }, InType: reflect.TypeOf(&MachineDeploymentRollback{})}, conversion.GeneratedDeepCopyFunc{Fn: func(in interface{}, out interface{}, c *conversion.Cloner) error { - in.(*InstanceDeploymentStatus).DeepCopyInto(out.(*InstanceDeploymentStatus)) + in.(*MachineDeploymentSpec).DeepCopyInto(out.(*MachineDeploymentSpec)) return nil - }, InType: reflect.TypeOf(&InstanceDeploymentStatus{})}, + }, InType: reflect.TypeOf(&MachineDeploymentSpec{})}, conversion.GeneratedDeepCopyFunc{Fn: func(in interface{}, out interface{}, c *conversion.Cloner) error { - in.(*InstanceDeploymentStrategy).DeepCopyInto(out.(*InstanceDeploymentStrategy)) + in.(*MachineDeploymentStatus).DeepCopyInto(out.(*MachineDeploymentStatus)) return nil - }, InType: reflect.TypeOf(&InstanceDeploymentStrategy{})}, + }, InType: reflect.TypeOf(&MachineDeploymentStatus{})}, conversion.GeneratedDeepCopyFunc{Fn: func(in interface{}, out interface{}, c *conversion.Cloner) error { - in.(*InstanceList).DeepCopyInto(out.(*InstanceList)) + in.(*MachineDeploymentStrategy).DeepCopyInto(out.(*MachineDeploymentStrategy)) return nil - }, InType: reflect.TypeOf(&InstanceList{})}, + }, InType: reflect.TypeOf(&MachineDeploymentStrategy{})}, conversion.GeneratedDeepCopyFunc{Fn: func(in interface{}, out interface{}, c *conversion.Cloner) error { - in.(*InstanceSet).DeepCopyInto(out.(*InstanceSet)) + in.(*MachineList).DeepCopyInto(out.(*MachineList)) return nil - }, InType: reflect.TypeOf(&InstanceSet{})}, + }, InType: reflect.TypeOf(&MachineList{})}, conversion.GeneratedDeepCopyFunc{Fn: func(in interface{}, out interface{}, c *conversion.Cloner) error { - in.(*InstanceSetCondition).DeepCopyInto(out.(*InstanceSetCondition)) + in.(*MachineSet).DeepCopyInto(out.(*MachineSet)) return nil - }, InType: reflect.TypeOf(&InstanceSetCondition{})}, + }, InType: reflect.TypeOf(&MachineSet{})}, conversion.GeneratedDeepCopyFunc{Fn: func(in interface{}, out interface{}, c *conversion.Cloner) error { - in.(*InstanceSetList).DeepCopyInto(out.(*InstanceSetList)) + in.(*MachineSetCondition).DeepCopyInto(out.(*MachineSetCondition)) return nil - }, InType: reflect.TypeOf(&InstanceSetList{})}, + }, InType: reflect.TypeOf(&MachineSetCondition{})}, conversion.GeneratedDeepCopyFunc{Fn: func(in interface{}, out interface{}, c *conversion.Cloner) error { - in.(*InstanceSetSpec).DeepCopyInto(out.(*InstanceSetSpec)) + in.(*MachineSetList).DeepCopyInto(out.(*MachineSetList)) return nil - }, InType: reflect.TypeOf(&InstanceSetSpec{})}, + }, InType: reflect.TypeOf(&MachineSetList{})}, conversion.GeneratedDeepCopyFunc{Fn: func(in interface{}, out interface{}, c *conversion.Cloner) error { - in.(*InstanceSetStatus).DeepCopyInto(out.(*InstanceSetStatus)) + in.(*MachineSetSpec).DeepCopyInto(out.(*MachineSetSpec)) return nil - }, InType: reflect.TypeOf(&InstanceSetStatus{})}, + }, InType: reflect.TypeOf(&MachineSetSpec{})}, conversion.GeneratedDeepCopyFunc{Fn: func(in interface{}, out interface{}, c *conversion.Cloner) error { - in.(*InstanceSpec).DeepCopyInto(out.(*InstanceSpec)) + in.(*MachineSetStatus).DeepCopyInto(out.(*MachineSetStatus)) return nil - }, InType: reflect.TypeOf(&InstanceSpec{})}, + }, InType: reflect.TypeOf(&MachineSetStatus{})}, conversion.GeneratedDeepCopyFunc{Fn: func(in interface{}, out interface{}, c *conversion.Cloner) error { - in.(*InstanceStatus).DeepCopyInto(out.(*InstanceStatus)) + in.(*MachineSpec).DeepCopyInto(out.(*MachineSpec)) return nil - }, InType: reflect.TypeOf(&InstanceStatus{})}, + }, InType: reflect.TypeOf(&MachineSpec{})}, conversion.GeneratedDeepCopyFunc{Fn: func(in interface{}, out interface{}, c *conversion.Cloner) error { - in.(*InstanceTemplate).DeepCopyInto(out.(*InstanceTemplate)) + in.(*MachineStatus).DeepCopyInto(out.(*MachineStatus)) return nil - }, InType: reflect.TypeOf(&InstanceTemplate{})}, + }, InType: reflect.TypeOf(&MachineStatus{})}, conversion.GeneratedDeepCopyFunc{Fn: func(in interface{}, out interface{}, c *conversion.Cloner) error { - in.(*InstanceTemplateList).DeepCopyInto(out.(*InstanceTemplateList)) + in.(*MachineTemplate).DeepCopyInto(out.(*MachineTemplate)) return nil - }, InType: reflect.TypeOf(&InstanceTemplateList{})}, + }, InType: reflect.TypeOf(&MachineTemplate{})}, conversion.GeneratedDeepCopyFunc{Fn: func(in interface{}, out interface{}, c *conversion.Cloner) error { - in.(*InstanceTemplateSpec).DeepCopyInto(out.(*InstanceTemplateSpec)) + in.(*MachineTemplateList).DeepCopyInto(out.(*MachineTemplateList)) return nil - }, InType: reflect.TypeOf(&InstanceTemplateSpec{})}, + }, InType: reflect.TypeOf(&MachineTemplateList{})}, conversion.GeneratedDeepCopyFunc{Fn: func(in interface{}, out interface{}, c *conversion.Cloner) error { - in.(*LastOperation).DeepCopyInto(out.(*LastOperation)) + in.(*MachineTemplateSpec).DeepCopyInto(out.(*MachineTemplateSpec)) return nil - }, InType: reflect.TypeOf(&LastOperation{})}, + }, InType: reflect.TypeOf(&MachineTemplateSpec{})}, conversion.GeneratedDeepCopyFunc{Fn: func(in interface{}, out interface{}, c *conversion.Cloner) error { in.(*RollbackConfig).DeepCopyInto(out.(*RollbackConfig)) return nil }, InType: reflect.TypeOf(&RollbackConfig{})}, conversion.GeneratedDeepCopyFunc{Fn: func(in interface{}, out interface{}, c *conversion.Cloner) error { - in.(*RollingUpdateInstanceDeployment).DeepCopyInto(out.(*RollingUpdateInstanceDeployment)) + in.(*RollingUpdateMachineDeployment).DeepCopyInto(out.(*RollingUpdateMachineDeployment)) return nil - }, InType: reflect.TypeOf(&RollingUpdateInstanceDeployment{})}, + }, InType: reflect.TypeOf(&RollingUpdateMachineDeployment{})}, conversion.GeneratedDeepCopyFunc{Fn: func(in interface{}, out interface{}, c *conversion.Cloner) error { in.(*Scale).DeepCopyInto(out.(*Scale)) return nil @@ -212,7 +212,7 @@ func (in *AWSIAMProfileSpec) DeepCopy() *AWSIAMProfileSpec { } // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *AWSInstanceClass) DeepCopyInto(out *AWSInstanceClass) { +func (in *AWSMachineClass) DeepCopyInto(out *AWSMachineClass) { *out = *in in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) out.TypeMeta = in.TypeMeta @@ -220,18 +220,18 @@ func (in *AWSInstanceClass) DeepCopyInto(out *AWSInstanceClass) { return } -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new AWSInstanceClass. -func (in *AWSInstanceClass) DeepCopy() *AWSInstanceClass { +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new AWSMachineClass. +func (in *AWSMachineClass) DeepCopy() *AWSMachineClass { if in == nil { return nil } - out := new(AWSInstanceClass) + out := new(AWSMachineClass) in.DeepCopyInto(out) return out } // DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. -func (in *AWSInstanceClass) DeepCopyObject() runtime.Object { +func (in *AWSMachineClass) DeepCopyObject() runtime.Object { if c := in.DeepCopy(); c != nil { return c } else { @@ -240,13 +240,13 @@ func (in *AWSInstanceClass) DeepCopyObject() runtime.Object { } // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *AWSInstanceClassList) DeepCopyInto(out *AWSInstanceClassList) { +func (in *AWSMachineClassList) DeepCopyInto(out *AWSMachineClassList) { *out = *in out.TypeMeta = in.TypeMeta out.ListMeta = in.ListMeta if in.Items != nil { in, out := &in.Items, &out.Items - *out = make([]AWSInstanceClass, len(*in)) + *out = make([]AWSMachineClass, len(*in)) for i := range *in { (*in)[i].DeepCopyInto(&(*out)[i]) } @@ -254,18 +254,18 @@ func (in *AWSInstanceClassList) DeepCopyInto(out *AWSInstanceClassList) { return } -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new AWSInstanceClassList. -func (in *AWSInstanceClassList) DeepCopy() *AWSInstanceClassList { +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new AWSMachineClassList. +func (in *AWSMachineClassList) DeepCopy() *AWSMachineClassList { if in == nil { return nil } - out := new(AWSInstanceClassList) + out := new(AWSMachineClassList) in.DeepCopyInto(out) return out } // DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. -func (in *AWSInstanceClassList) DeepCopyObject() runtime.Object { +func (in *AWSMachineClassList) DeepCopyObject() runtime.Object { if c := in.DeepCopy(); c != nil { return c } else { @@ -274,7 +274,7 @@ func (in *AWSInstanceClassList) DeepCopyObject() runtime.Object { } // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *AWSInstanceClassSpec) DeepCopyInto(out *AWSInstanceClassSpec) { +func (in *AWSMachineClassSpec) DeepCopyInto(out *AWSMachineClassSpec) { *out = *in if in.BlockDevices != nil { in, out := &in.BlockDevices, &out.BlockDevices @@ -308,12 +308,12 @@ func (in *AWSInstanceClassSpec) DeepCopyInto(out *AWSInstanceClassSpec) { return } -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new AWSInstanceClassSpec. -func (in *AWSInstanceClassSpec) DeepCopy() *AWSInstanceClassSpec { +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new AWSMachineClassSpec. +func (in *AWSMachineClassSpec) DeepCopy() *AWSMachineClassSpec { if in == nil { return nil } - out := new(AWSInstanceClassSpec) + out := new(AWSMachineClassSpec) in.DeepCopyInto(out) return out } @@ -373,7 +373,24 @@ func (in *CurrentStatus) DeepCopy() *CurrentStatus { } // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *Instance) DeepCopyInto(out *Instance) { +func (in *LastOperation) DeepCopyInto(out *LastOperation) { + *out = *in + in.LastUpdateTime.DeepCopyInto(&out.LastUpdateTime) + 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 in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) out.TypeMeta = in.TypeMeta @@ -382,18 +399,18 @@ func (in *Instance) DeepCopyInto(out *Instance) { return } -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Instance. -func (in *Instance) DeepCopy() *Instance { +// 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(Instance) + out := new(Machine) in.DeepCopyInto(out) return out } // DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. -func (in *Instance) DeepCopyObject() runtime.Object { +func (in *Machine) DeepCopyObject() runtime.Object { if c := in.DeepCopy(); c != nil { return c } else { @@ -402,7 +419,7 @@ func (in *Instance) DeepCopyObject() runtime.Object { } // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *InstanceDeployment) DeepCopyInto(out *InstanceDeployment) { +func (in *MachineDeployment) DeepCopyInto(out *MachineDeployment) { *out = *in out.TypeMeta = in.TypeMeta in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) @@ -411,18 +428,18 @@ func (in *InstanceDeployment) DeepCopyInto(out *InstanceDeployment) { return } -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new InstanceDeployment. -func (in *InstanceDeployment) DeepCopy() *InstanceDeployment { +// 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(InstanceDeployment) + out := new(MachineDeployment) in.DeepCopyInto(out) return out } // DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. -func (in *InstanceDeployment) DeepCopyObject() runtime.Object { +func (in *MachineDeployment) DeepCopyObject() runtime.Object { if c := in.DeepCopy(); c != nil { return c } else { @@ -431,31 +448,31 @@ func (in *InstanceDeployment) DeepCopyObject() runtime.Object { } // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *InstanceDeploymentCondition) DeepCopyInto(out *InstanceDeploymentCondition) { +func (in *MachineDeploymentCondition) DeepCopyInto(out *MachineDeploymentCondition) { *out = *in in.LastUpdateTime.DeepCopyInto(&out.LastUpdateTime) in.LastTransitionTime.DeepCopyInto(&out.LastTransitionTime) return } -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new InstanceDeploymentCondition. -func (in *InstanceDeploymentCondition) DeepCopy() *InstanceDeploymentCondition { +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new MachineDeploymentCondition. +func (in *MachineDeploymentCondition) DeepCopy() *MachineDeploymentCondition { if in == nil { return nil } - out := new(InstanceDeploymentCondition) + out := new(MachineDeploymentCondition) in.DeepCopyInto(out) return out } // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *InstanceDeploymentList) DeepCopyInto(out *InstanceDeploymentList) { +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([]InstanceDeployment, len(*in)) + *out = make([]MachineDeployment, len(*in)) for i := range *in { (*in)[i].DeepCopyInto(&(*out)[i]) } @@ -463,18 +480,18 @@ func (in *InstanceDeploymentList) DeepCopyInto(out *InstanceDeploymentList) { return } -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new InstanceDeploymentList. -func (in *InstanceDeploymentList) DeepCopy() *InstanceDeploymentList { +// 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(InstanceDeploymentList) + out := new(MachineDeploymentList) in.DeepCopyInto(out) return out } // DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. -func (in *InstanceDeploymentList) DeepCopyObject() runtime.Object { +func (in *MachineDeploymentList) DeepCopyObject() runtime.Object { if c := in.DeepCopy(); c != nil { return c } else { @@ -483,7 +500,7 @@ func (in *InstanceDeploymentList) DeepCopyObject() runtime.Object { } // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *InstanceDeploymentRollback) DeepCopyInto(out *InstanceDeploymentRollback) { +func (in *MachineDeploymentRollback) DeepCopyInto(out *MachineDeploymentRollback) { *out = *in out.TypeMeta = in.TypeMeta if in.UpdatedAnnotations != nil { @@ -497,18 +514,18 @@ func (in *InstanceDeploymentRollback) DeepCopyInto(out *InstanceDeploymentRollba return } -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new InstanceDeploymentRollback. -func (in *InstanceDeploymentRollback) DeepCopy() *InstanceDeploymentRollback { +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new MachineDeploymentRollback. +func (in *MachineDeploymentRollback) DeepCopy() *MachineDeploymentRollback { if in == nil { return nil } - out := new(InstanceDeploymentRollback) + out := new(MachineDeploymentRollback) in.DeepCopyInto(out) return out } // DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. -func (in *InstanceDeploymentRollback) DeepCopyObject() runtime.Object { +func (in *MachineDeploymentRollback) DeepCopyObject() runtime.Object { if c := in.DeepCopy(); c != nil { return c } else { @@ -517,7 +534,7 @@ func (in *InstanceDeploymentRollback) DeepCopyObject() runtime.Object { } // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *InstanceDeploymentSpec) DeepCopyInto(out *InstanceDeploymentSpec) { +func (in *MachineDeploymentSpec) DeepCopyInto(out *MachineDeploymentSpec) { *out = *in if in.Selector != nil { in, out := &in.Selector, &out.Selector @@ -560,22 +577,22 @@ func (in *InstanceDeploymentSpec) DeepCopyInto(out *InstanceDeploymentSpec) { return } -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new InstanceDeploymentSpec. -func (in *InstanceDeploymentSpec) DeepCopy() *InstanceDeploymentSpec { +// 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(InstanceDeploymentSpec) + 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 *InstanceDeploymentStatus) DeepCopyInto(out *InstanceDeploymentStatus) { +func (in *MachineDeploymentStatus) DeepCopyInto(out *MachineDeploymentStatus) { *out = *in if in.Conditions != nil { in, out := &in.Conditions, &out.Conditions - *out = make([]InstanceDeploymentCondition, len(*in)) + *out = make([]MachineDeploymentCondition, len(*in)) for i := range *in { (*in)[i].DeepCopyInto(&(*out)[i]) } @@ -592,49 +609,49 @@ func (in *InstanceDeploymentStatus) DeepCopyInto(out *InstanceDeploymentStatus) return } -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new InstanceDeploymentStatus. -func (in *InstanceDeploymentStatus) DeepCopy() *InstanceDeploymentStatus { +// 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(InstanceDeploymentStatus) + 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 *InstanceDeploymentStrategy) DeepCopyInto(out *InstanceDeploymentStrategy) { +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(RollingUpdateInstanceDeployment) + *out = new(RollingUpdateMachineDeployment) (*in).DeepCopyInto(*out) } } return } -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new InstanceDeploymentStrategy. -func (in *InstanceDeploymentStrategy) DeepCopy() *InstanceDeploymentStrategy { +// 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(InstanceDeploymentStrategy) + 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 *InstanceList) DeepCopyInto(out *InstanceList) { +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([]Instance, len(*in)) + *out = make([]Machine, len(*in)) for i := range *in { (*in)[i].DeepCopyInto(&(*out)[i]) } @@ -642,18 +659,18 @@ func (in *InstanceList) DeepCopyInto(out *InstanceList) { return } -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new InstanceList. -func (in *InstanceList) DeepCopy() *InstanceList { +// 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(InstanceList) + out := new(MachineList) in.DeepCopyInto(out) return out } // DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. -func (in *InstanceList) DeepCopyObject() runtime.Object { +func (in *MachineList) DeepCopyObject() runtime.Object { if c := in.DeepCopy(); c != nil { return c } else { @@ -662,7 +679,7 @@ func (in *InstanceList) DeepCopyObject() runtime.Object { } // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *InstanceSet) DeepCopyInto(out *InstanceSet) { +func (in *MachineSet) DeepCopyInto(out *MachineSet) { *out = *in in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) out.TypeMeta = in.TypeMeta @@ -671,18 +688,18 @@ func (in *InstanceSet) DeepCopyInto(out *InstanceSet) { return } -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new InstanceSet. -func (in *InstanceSet) DeepCopy() *InstanceSet { +// 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(InstanceSet) + out := new(MachineSet) in.DeepCopyInto(out) return out } // DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. -func (in *InstanceSet) DeepCopyObject() runtime.Object { +func (in *MachineSet) DeepCopyObject() runtime.Object { if c := in.DeepCopy(); c != nil { return c } else { @@ -691,30 +708,30 @@ func (in *InstanceSet) DeepCopyObject() runtime.Object { } // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *InstanceSetCondition) DeepCopyInto(out *InstanceSetCondition) { +func (in *MachineSetCondition) DeepCopyInto(out *MachineSetCondition) { *out = *in in.LastTransitionTime.DeepCopyInto(&out.LastTransitionTime) return } -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new InstanceSetCondition. -func (in *InstanceSetCondition) DeepCopy() *InstanceSetCondition { +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new MachineSetCondition. +func (in *MachineSetCondition) DeepCopy() *MachineSetCondition { if in == nil { return nil } - out := new(InstanceSetCondition) + out := new(MachineSetCondition) in.DeepCopyInto(out) return out } // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *InstanceSetList) DeepCopyInto(out *InstanceSetList) { +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([]InstanceSet, len(*in)) + *out = make([]MachineSet, len(*in)) for i := range *in { (*in)[i].DeepCopyInto(&(*out)[i]) } @@ -722,18 +739,18 @@ func (in *InstanceSetList) DeepCopyInto(out *InstanceSetList) { return } -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new InstanceSetList. -func (in *InstanceSetList) DeepCopy() *InstanceSetList { +// 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(InstanceSetList) + out := new(MachineSetList) in.DeepCopyInto(out) return out } // DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. -func (in *InstanceSetList) DeepCopyObject() runtime.Object { +func (in *MachineSetList) DeepCopyObject() runtime.Object { if c := in.DeepCopy(); c != nil { return c } else { @@ -742,7 +759,7 @@ func (in *InstanceSetList) DeepCopyObject() runtime.Object { } // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *InstanceSetSpec) DeepCopyInto(out *InstanceSetSpec) { +func (in *MachineSetSpec) DeepCopyInto(out *MachineSetSpec) { *out = *in if in.Selector != nil { in, out := &in.Selector, &out.Selector @@ -753,28 +770,28 @@ func (in *InstanceSetSpec) DeepCopyInto(out *InstanceSetSpec) { (*in).DeepCopyInto(*out) } } - out.InstanceClass = in.InstanceClass + out.MachineClass = in.MachineClass in.Template.DeepCopyInto(&out.Template) return } -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new InstanceSetSpec. -func (in *InstanceSetSpec) DeepCopy() *InstanceSetSpec { +// 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(InstanceSetSpec) + 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 *InstanceSetStatus) DeepCopyInto(out *InstanceSetStatus) { +func (in *MachineSetStatus) DeepCopyInto(out *MachineSetStatus) { *out = *in in.LastOperation.DeepCopyInto(&out.LastOperation) if in.Conditions != nil { in, out := &in.Conditions, &out.Conditions - *out = make([]InstanceSetCondition, len(*in)) + *out = make([]MachineSetCondition, len(*in)) for i := range *in { (*in)[i].DeepCopyInto(&(*out)[i]) } @@ -782,35 +799,35 @@ func (in *InstanceSetStatus) DeepCopyInto(out *InstanceSetStatus) { return } -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new InstanceSetStatus. -func (in *InstanceSetStatus) DeepCopy() *InstanceSetStatus { +// 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(InstanceSetStatus) + 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 *InstanceSpec) DeepCopyInto(out *InstanceSpec) { +func (in *MachineSpec) DeepCopyInto(out *MachineSpec) { *out = *in out.Class = in.Class return } -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new InstanceSpec. -func (in *InstanceSpec) DeepCopy() *InstanceSpec { +// 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(InstanceSpec) + 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 *InstanceStatus) DeepCopyInto(out *InstanceStatus) { +func (in *MachineStatus) DeepCopyInto(out *MachineStatus) { *out = *in if in.Conditions != nil { in, out := &in.Conditions, &out.Conditions @@ -824,18 +841,18 @@ func (in *InstanceStatus) DeepCopyInto(out *InstanceStatus) { return } -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new InstanceStatus. -func (in *InstanceStatus) DeepCopy() *InstanceStatus { +// 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(InstanceStatus) + 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 *InstanceTemplate) DeepCopyInto(out *InstanceTemplate) { +func (in *MachineTemplate) DeepCopyInto(out *MachineTemplate) { *out = *in out.TypeMeta = in.TypeMeta in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) @@ -843,18 +860,18 @@ func (in *InstanceTemplate) DeepCopyInto(out *InstanceTemplate) { return } -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new InstanceTemplate. -func (in *InstanceTemplate) DeepCopy() *InstanceTemplate { +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new MachineTemplate. +func (in *MachineTemplate) DeepCopy() *MachineTemplate { if in == nil { return nil } - out := new(InstanceTemplate) + out := new(MachineTemplate) in.DeepCopyInto(out) return out } // DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. -func (in *InstanceTemplate) DeepCopyObject() runtime.Object { +func (in *MachineTemplate) DeepCopyObject() runtime.Object { if c := in.DeepCopy(); c != nil { return c } else { @@ -863,13 +880,13 @@ func (in *InstanceTemplate) DeepCopyObject() runtime.Object { } // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *InstanceTemplateList) DeepCopyInto(out *InstanceTemplateList) { +func (in *MachineTemplateList) DeepCopyInto(out *MachineTemplateList) { *out = *in out.TypeMeta = in.TypeMeta out.ListMeta = in.ListMeta if in.Items != nil { in, out := &in.Items, &out.Items - *out = make([]InstanceTemplate, len(*in)) + *out = make([]MachineTemplate, len(*in)) for i := range *in { (*in)[i].DeepCopyInto(&(*out)[i]) } @@ -877,18 +894,18 @@ func (in *InstanceTemplateList) DeepCopyInto(out *InstanceTemplateList) { return } -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new InstanceTemplateList. -func (in *InstanceTemplateList) DeepCopy() *InstanceTemplateList { +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new MachineTemplateList. +func (in *MachineTemplateList) DeepCopy() *MachineTemplateList { if in == nil { return nil } - out := new(InstanceTemplateList) + out := new(MachineTemplateList) in.DeepCopyInto(out) return out } // DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. -func (in *InstanceTemplateList) DeepCopyObject() runtime.Object { +func (in *MachineTemplateList) DeepCopyObject() runtime.Object { if c := in.DeepCopy(); c != nil { return c } else { @@ -897,36 +914,19 @@ func (in *InstanceTemplateList) DeepCopyObject() runtime.Object { } // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *InstanceTemplateSpec) DeepCopyInto(out *InstanceTemplateSpec) { +func (in *MachineTemplateSpec) DeepCopyInto(out *MachineTemplateSpec) { *out = *in in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) out.Spec = in.Spec return } -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new InstanceTemplateSpec. -func (in *InstanceTemplateSpec) DeepCopy() *InstanceTemplateSpec { +// 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(InstanceTemplateSpec) - 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 - in.LastUpdateTime.DeepCopyInto(&out.LastUpdateTime) - 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) + out := new(MachineTemplateSpec) in.DeepCopyInto(out) return out } @@ -948,7 +948,7 @@ func (in *RollbackConfig) DeepCopy() *RollbackConfig { } // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *RollingUpdateInstanceDeployment) DeepCopyInto(out *RollingUpdateInstanceDeployment) { +func (in *RollingUpdateMachineDeployment) DeepCopyInto(out *RollingUpdateMachineDeployment) { *out = *in if in.MaxUnavailable != nil { in, out := &in.MaxUnavailable, &out.MaxUnavailable @@ -971,12 +971,12 @@ func (in *RollingUpdateInstanceDeployment) DeepCopyInto(out *RollingUpdateInstan return } -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new RollingUpdateInstanceDeployment. -func (in *RollingUpdateInstanceDeployment) DeepCopy() *RollingUpdateInstanceDeployment { +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new RollingUpdateMachineDeployment. +func (in *RollingUpdateMachineDeployment) DeepCopy() *RollingUpdateMachineDeployment { if in == nil { return nil } - out := new(RollingUpdateInstanceDeployment) + out := new(RollingUpdateMachineDeployment) in.DeepCopyInto(out) return out } diff --git a/pkg/apis/node/zz_generated.defaults.go b/pkg/apis/machine/zz_generated.defaults.go similarity index 96% rename from pkg/apis/node/zz_generated.defaults.go rename to pkg/apis/machine/zz_generated.defaults.go index 6d337d3eb..3fa68441f 100644 --- a/pkg/apis/node/zz_generated.defaults.go +++ b/pkg/apis/machine/zz_generated.defaults.go @@ -2,7 +2,7 @@ // This file was autogenerated by defaulter-gen. Do not edit it manually! -package node +package machine import ( runtime "k8s.io/apimachinery/pkg/runtime" diff --git a/pkg/apis/node/v1alpha1/zz_generated.conversion.go b/pkg/apis/node/v1alpha1/zz_generated.conversion.go deleted file mode 100644 index 330fe7732..000000000 --- a/pkg/apis/node/v1alpha1/zz_generated.conversion.go +++ /dev/null @@ -1,1060 +0,0 @@ -// +build !ignore_autogenerated - -// This file was autogenerated by conversion-gen. Do not edit it manually! - -package v1alpha1 - -import ( - node "github.com/gardener/node-controller-manager/pkg/apis/node" - v1 "k8s.io/api/core/v1" - meta_v1 "k8s.io/apimachinery/pkg/apis/meta/v1" - conversion "k8s.io/apimachinery/pkg/conversion" - runtime "k8s.io/apimachinery/pkg/runtime" - intstr "k8s.io/apimachinery/pkg/util/intstr" - unsafe "unsafe" -) - -func init() { - localSchemeBuilder.Register(RegisterConversions) -} - -// RegisterConversions adds conversion functions to the given scheme. -// Public to allow building arbitrary schemes. -func RegisterConversions(scheme *runtime.Scheme) error { - return scheme.AddGeneratedConversionFuncs( - Convert_v1alpha1_AWSBlockDeviceMappingSpec_To_node_AWSBlockDeviceMappingSpec, - Convert_node_AWSBlockDeviceMappingSpec_To_v1alpha1_AWSBlockDeviceMappingSpec, - Convert_v1alpha1_AWSEbsBlockDeviceSpec_To_node_AWSEbsBlockDeviceSpec, - Convert_node_AWSEbsBlockDeviceSpec_To_v1alpha1_AWSEbsBlockDeviceSpec, - Convert_v1alpha1_AWSIAMProfileSpec_To_node_AWSIAMProfileSpec, - Convert_node_AWSIAMProfileSpec_To_v1alpha1_AWSIAMProfileSpec, - Convert_v1alpha1_AWSInstanceClass_To_node_AWSInstanceClass, - Convert_node_AWSInstanceClass_To_v1alpha1_AWSInstanceClass, - Convert_v1alpha1_AWSInstanceClassList_To_node_AWSInstanceClassList, - Convert_node_AWSInstanceClassList_To_v1alpha1_AWSInstanceClassList, - Convert_v1alpha1_AWSInstanceClassSpec_To_node_AWSInstanceClassSpec, - Convert_node_AWSInstanceClassSpec_To_v1alpha1_AWSInstanceClassSpec, - Convert_v1alpha1_AWSNetworkInterfaceSpec_To_node_AWSNetworkInterfaceSpec, - Convert_node_AWSNetworkInterfaceSpec_To_v1alpha1_AWSNetworkInterfaceSpec, - Convert_v1alpha1_ClassSpec_To_node_ClassSpec, - Convert_node_ClassSpec_To_v1alpha1_ClassSpec, - Convert_v1alpha1_CurrentStatus_To_node_CurrentStatus, - Convert_node_CurrentStatus_To_v1alpha1_CurrentStatus, - Convert_v1alpha1_Instance_To_node_Instance, - Convert_node_Instance_To_v1alpha1_Instance, - Convert_v1alpha1_InstanceDeployment_To_node_InstanceDeployment, - Convert_node_InstanceDeployment_To_v1alpha1_InstanceDeployment, - Convert_v1alpha1_InstanceDeploymentCondition_To_node_InstanceDeploymentCondition, - Convert_node_InstanceDeploymentCondition_To_v1alpha1_InstanceDeploymentCondition, - Convert_v1alpha1_InstanceDeploymentList_To_node_InstanceDeploymentList, - Convert_node_InstanceDeploymentList_To_v1alpha1_InstanceDeploymentList, - Convert_v1alpha1_InstanceDeploymentRollback_To_node_InstanceDeploymentRollback, - Convert_node_InstanceDeploymentRollback_To_v1alpha1_InstanceDeploymentRollback, - Convert_v1alpha1_InstanceDeploymentSpec_To_node_InstanceDeploymentSpec, - Convert_node_InstanceDeploymentSpec_To_v1alpha1_InstanceDeploymentSpec, - Convert_v1alpha1_InstanceDeploymentStatus_To_node_InstanceDeploymentStatus, - Convert_node_InstanceDeploymentStatus_To_v1alpha1_InstanceDeploymentStatus, - Convert_v1alpha1_InstanceDeploymentStrategy_To_node_InstanceDeploymentStrategy, - Convert_node_InstanceDeploymentStrategy_To_v1alpha1_InstanceDeploymentStrategy, - Convert_v1alpha1_InstanceList_To_node_InstanceList, - Convert_node_InstanceList_To_v1alpha1_InstanceList, - Convert_v1alpha1_InstanceSet_To_node_InstanceSet, - Convert_node_InstanceSet_To_v1alpha1_InstanceSet, - Convert_v1alpha1_InstanceSetCondition_To_node_InstanceSetCondition, - Convert_node_InstanceSetCondition_To_v1alpha1_InstanceSetCondition, - Convert_v1alpha1_InstanceSetList_To_node_InstanceSetList, - Convert_node_InstanceSetList_To_v1alpha1_InstanceSetList, - Convert_v1alpha1_InstanceSetSpec_To_node_InstanceSetSpec, - Convert_node_InstanceSetSpec_To_v1alpha1_InstanceSetSpec, - Convert_v1alpha1_InstanceSetStatus_To_node_InstanceSetStatus, - Convert_node_InstanceSetStatus_To_v1alpha1_InstanceSetStatus, - Convert_v1alpha1_InstanceSpec_To_node_InstanceSpec, - Convert_node_InstanceSpec_To_v1alpha1_InstanceSpec, - Convert_v1alpha1_InstanceStatus_To_node_InstanceStatus, - Convert_node_InstanceStatus_To_v1alpha1_InstanceStatus, - Convert_v1alpha1_InstanceTemplate_To_node_InstanceTemplate, - Convert_node_InstanceTemplate_To_v1alpha1_InstanceTemplate, - Convert_v1alpha1_InstanceTemplateList_To_node_InstanceTemplateList, - Convert_node_InstanceTemplateList_To_v1alpha1_InstanceTemplateList, - Convert_v1alpha1_InstanceTemplateSpec_To_node_InstanceTemplateSpec, - Convert_node_InstanceTemplateSpec_To_v1alpha1_InstanceTemplateSpec, - Convert_v1alpha1_LastOperation_To_node_LastOperation, - Convert_node_LastOperation_To_v1alpha1_LastOperation, - Convert_v1alpha1_RollbackConfig_To_node_RollbackConfig, - Convert_node_RollbackConfig_To_v1alpha1_RollbackConfig, - Convert_v1alpha1_RollingUpdateInstanceDeployment_To_node_RollingUpdateInstanceDeployment, - Convert_node_RollingUpdateInstanceDeployment_To_v1alpha1_RollingUpdateInstanceDeployment, - Convert_v1alpha1_Scale_To_node_Scale, - Convert_node_Scale_To_v1alpha1_Scale, - Convert_v1alpha1_ScaleSpec_To_node_ScaleSpec, - Convert_node_ScaleSpec_To_v1alpha1_ScaleSpec, - Convert_v1alpha1_ScaleStatus_To_node_ScaleStatus, - Convert_node_ScaleStatus_To_v1alpha1_ScaleStatus, - ) -} - -func autoConvert_v1alpha1_AWSBlockDeviceMappingSpec_To_node_AWSBlockDeviceMappingSpec(in *AWSBlockDeviceMappingSpec, out *node.AWSBlockDeviceMappingSpec, s conversion.Scope) error { - out.DeviceName = in.DeviceName - if err := Convert_v1alpha1_AWSEbsBlockDeviceSpec_To_node_AWSEbsBlockDeviceSpec(&in.Ebs, &out.Ebs, s); err != nil { - return err - } - out.NoDevice = in.NoDevice - out.VirtualName = in.VirtualName - return nil -} - -// Convert_v1alpha1_AWSBlockDeviceMappingSpec_To_node_AWSBlockDeviceMappingSpec is an autogenerated conversion function. -func Convert_v1alpha1_AWSBlockDeviceMappingSpec_To_node_AWSBlockDeviceMappingSpec(in *AWSBlockDeviceMappingSpec, out *node.AWSBlockDeviceMappingSpec, s conversion.Scope) error { - return autoConvert_v1alpha1_AWSBlockDeviceMappingSpec_To_node_AWSBlockDeviceMappingSpec(in, out, s) -} - -func autoConvert_node_AWSBlockDeviceMappingSpec_To_v1alpha1_AWSBlockDeviceMappingSpec(in *node.AWSBlockDeviceMappingSpec, out *AWSBlockDeviceMappingSpec, s conversion.Scope) error { - out.DeviceName = in.DeviceName - if err := Convert_node_AWSEbsBlockDeviceSpec_To_v1alpha1_AWSEbsBlockDeviceSpec(&in.Ebs, &out.Ebs, s); err != nil { - return err - } - out.NoDevice = in.NoDevice - out.VirtualName = in.VirtualName - return nil -} - -// Convert_node_AWSBlockDeviceMappingSpec_To_v1alpha1_AWSBlockDeviceMappingSpec is an autogenerated conversion function. -func Convert_node_AWSBlockDeviceMappingSpec_To_v1alpha1_AWSBlockDeviceMappingSpec(in *node.AWSBlockDeviceMappingSpec, out *AWSBlockDeviceMappingSpec, s conversion.Scope) error { - return autoConvert_node_AWSBlockDeviceMappingSpec_To_v1alpha1_AWSBlockDeviceMappingSpec(in, out, s) -} - -func autoConvert_v1alpha1_AWSEbsBlockDeviceSpec_To_node_AWSEbsBlockDeviceSpec(in *AWSEbsBlockDeviceSpec, out *node.AWSEbsBlockDeviceSpec, s conversion.Scope) error { - out.DeleteOnTermination = in.DeleteOnTermination - out.Encrypted = in.Encrypted - out.Iops = in.Iops - out.VolumeSize = in.VolumeSize - out.VolumeType = in.VolumeType - return nil -} - -// Convert_v1alpha1_AWSEbsBlockDeviceSpec_To_node_AWSEbsBlockDeviceSpec is an autogenerated conversion function. -func Convert_v1alpha1_AWSEbsBlockDeviceSpec_To_node_AWSEbsBlockDeviceSpec(in *AWSEbsBlockDeviceSpec, out *node.AWSEbsBlockDeviceSpec, s conversion.Scope) error { - return autoConvert_v1alpha1_AWSEbsBlockDeviceSpec_To_node_AWSEbsBlockDeviceSpec(in, out, s) -} - -func autoConvert_node_AWSEbsBlockDeviceSpec_To_v1alpha1_AWSEbsBlockDeviceSpec(in *node.AWSEbsBlockDeviceSpec, out *AWSEbsBlockDeviceSpec, s conversion.Scope) error { - out.DeleteOnTermination = in.DeleteOnTermination - out.Encrypted = in.Encrypted - out.Iops = in.Iops - out.VolumeSize = in.VolumeSize - out.VolumeType = in.VolumeType - return nil -} - -// Convert_node_AWSEbsBlockDeviceSpec_To_v1alpha1_AWSEbsBlockDeviceSpec is an autogenerated conversion function. -func Convert_node_AWSEbsBlockDeviceSpec_To_v1alpha1_AWSEbsBlockDeviceSpec(in *node.AWSEbsBlockDeviceSpec, out *AWSEbsBlockDeviceSpec, s conversion.Scope) error { - return autoConvert_node_AWSEbsBlockDeviceSpec_To_v1alpha1_AWSEbsBlockDeviceSpec(in, out, s) -} - -func autoConvert_v1alpha1_AWSIAMProfileSpec_To_node_AWSIAMProfileSpec(in *AWSIAMProfileSpec, out *node.AWSIAMProfileSpec, s conversion.Scope) error { - out.ARN = in.ARN - out.Name = in.Name - return nil -} - -// Convert_v1alpha1_AWSIAMProfileSpec_To_node_AWSIAMProfileSpec is an autogenerated conversion function. -func Convert_v1alpha1_AWSIAMProfileSpec_To_node_AWSIAMProfileSpec(in *AWSIAMProfileSpec, out *node.AWSIAMProfileSpec, s conversion.Scope) error { - return autoConvert_v1alpha1_AWSIAMProfileSpec_To_node_AWSIAMProfileSpec(in, out, s) -} - -func autoConvert_node_AWSIAMProfileSpec_To_v1alpha1_AWSIAMProfileSpec(in *node.AWSIAMProfileSpec, out *AWSIAMProfileSpec, s conversion.Scope) error { - out.ARN = in.ARN - out.Name = in.Name - return nil -} - -// Convert_node_AWSIAMProfileSpec_To_v1alpha1_AWSIAMProfileSpec is an autogenerated conversion function. -func Convert_node_AWSIAMProfileSpec_To_v1alpha1_AWSIAMProfileSpec(in *node.AWSIAMProfileSpec, out *AWSIAMProfileSpec, s conversion.Scope) error { - return autoConvert_node_AWSIAMProfileSpec_To_v1alpha1_AWSIAMProfileSpec(in, out, s) -} - -func autoConvert_v1alpha1_AWSInstanceClass_To_node_AWSInstanceClass(in *AWSInstanceClass, out *node.AWSInstanceClass, s conversion.Scope) error { - out.ObjectMeta = in.ObjectMeta - if err := Convert_v1alpha1_AWSInstanceClassSpec_To_node_AWSInstanceClassSpec(&in.Spec, &out.Spec, s); err != nil { - return err - } - return nil -} - -// Convert_v1alpha1_AWSInstanceClass_To_node_AWSInstanceClass is an autogenerated conversion function. -func Convert_v1alpha1_AWSInstanceClass_To_node_AWSInstanceClass(in *AWSInstanceClass, out *node.AWSInstanceClass, s conversion.Scope) error { - return autoConvert_v1alpha1_AWSInstanceClass_To_node_AWSInstanceClass(in, out, s) -} - -func autoConvert_node_AWSInstanceClass_To_v1alpha1_AWSInstanceClass(in *node.AWSInstanceClass, out *AWSInstanceClass, s conversion.Scope) error { - out.ObjectMeta = in.ObjectMeta - if err := Convert_node_AWSInstanceClassSpec_To_v1alpha1_AWSInstanceClassSpec(&in.Spec, &out.Spec, s); err != nil { - return err - } - return nil -} - -// Convert_node_AWSInstanceClass_To_v1alpha1_AWSInstanceClass is an autogenerated conversion function. -func Convert_node_AWSInstanceClass_To_v1alpha1_AWSInstanceClass(in *node.AWSInstanceClass, out *AWSInstanceClass, s conversion.Scope) error { - return autoConvert_node_AWSInstanceClass_To_v1alpha1_AWSInstanceClass(in, out, s) -} - -func autoConvert_v1alpha1_AWSInstanceClassList_To_node_AWSInstanceClassList(in *AWSInstanceClassList, out *node.AWSInstanceClassList, s conversion.Scope) error { - out.ListMeta = in.ListMeta - out.Items = *(*[]node.AWSInstanceClass)(unsafe.Pointer(&in.Items)) - return nil -} - -// Convert_v1alpha1_AWSInstanceClassList_To_node_AWSInstanceClassList is an autogenerated conversion function. -func Convert_v1alpha1_AWSInstanceClassList_To_node_AWSInstanceClassList(in *AWSInstanceClassList, out *node.AWSInstanceClassList, s conversion.Scope) error { - return autoConvert_v1alpha1_AWSInstanceClassList_To_node_AWSInstanceClassList(in, out, s) -} - -func autoConvert_node_AWSInstanceClassList_To_v1alpha1_AWSInstanceClassList(in *node.AWSInstanceClassList, out *AWSInstanceClassList, s conversion.Scope) error { - out.ListMeta = in.ListMeta - out.Items = *(*[]AWSInstanceClass)(unsafe.Pointer(&in.Items)) - return nil -} - -// Convert_node_AWSInstanceClassList_To_v1alpha1_AWSInstanceClassList is an autogenerated conversion function. -func Convert_node_AWSInstanceClassList_To_v1alpha1_AWSInstanceClassList(in *node.AWSInstanceClassList, out *AWSInstanceClassList, s conversion.Scope) error { - return autoConvert_node_AWSInstanceClassList_To_v1alpha1_AWSInstanceClassList(in, out, s) -} - -func autoConvert_v1alpha1_AWSInstanceClassSpec_To_node_AWSInstanceClassSpec(in *AWSInstanceClassSpec, out *node.AWSInstanceClassSpec, s conversion.Scope) error { - out.AMI = in.AMI - out.AvailabilityZone = in.AvailabilityZone - out.BlockDevices = *(*[]node.AWSBlockDeviceMappingSpec)(unsafe.Pointer(&in.BlockDevices)) - out.EbsOptimized = in.EbsOptimized - if err := Convert_v1alpha1_AWSIAMProfileSpec_To_node_AWSIAMProfileSpec(&in.IAM, &out.IAM, s); err != nil { - return err - } - out.InstanceType = in.InstanceType - out.KeyName = in.KeyName - out.Monitoring = in.Monitoring - out.NetworkInterfaces = *(*[]node.AWSNetworkInterfaceSpec)(unsafe.Pointer(&in.NetworkInterfaces)) - out.Tags = *(*map[string]string)(unsafe.Pointer(&in.Tags)) - out.SecretRef = (*v1.SecretReference)(unsafe.Pointer(in.SecretRef)) - return nil -} - -// Convert_v1alpha1_AWSInstanceClassSpec_To_node_AWSInstanceClassSpec is an autogenerated conversion function. -func Convert_v1alpha1_AWSInstanceClassSpec_To_node_AWSInstanceClassSpec(in *AWSInstanceClassSpec, out *node.AWSInstanceClassSpec, s conversion.Scope) error { - return autoConvert_v1alpha1_AWSInstanceClassSpec_To_node_AWSInstanceClassSpec(in, out, s) -} - -func autoConvert_node_AWSInstanceClassSpec_To_v1alpha1_AWSInstanceClassSpec(in *node.AWSInstanceClassSpec, out *AWSInstanceClassSpec, s conversion.Scope) error { - out.AMI = in.AMI - out.AvailabilityZone = in.AvailabilityZone - out.BlockDevices = *(*[]AWSBlockDeviceMappingSpec)(unsafe.Pointer(&in.BlockDevices)) - out.EbsOptimized = in.EbsOptimized - if err := Convert_node_AWSIAMProfileSpec_To_v1alpha1_AWSIAMProfileSpec(&in.IAM, &out.IAM, s); err != nil { - return err - } - out.InstanceType = in.InstanceType - out.KeyName = in.KeyName - out.Monitoring = in.Monitoring - out.NetworkInterfaces = *(*[]AWSNetworkInterfaceSpec)(unsafe.Pointer(&in.NetworkInterfaces)) - out.Tags = *(*map[string]string)(unsafe.Pointer(&in.Tags)) - out.SecretRef = (*v1.SecretReference)(unsafe.Pointer(in.SecretRef)) - return nil -} - -// Convert_node_AWSInstanceClassSpec_To_v1alpha1_AWSInstanceClassSpec is an autogenerated conversion function. -func Convert_node_AWSInstanceClassSpec_To_v1alpha1_AWSInstanceClassSpec(in *node.AWSInstanceClassSpec, out *AWSInstanceClassSpec, s conversion.Scope) error { - return autoConvert_node_AWSInstanceClassSpec_To_v1alpha1_AWSInstanceClassSpec(in, out, s) -} - -func autoConvert_v1alpha1_AWSNetworkInterfaceSpec_To_node_AWSNetworkInterfaceSpec(in *AWSNetworkInterfaceSpec, out *node.AWSNetworkInterfaceSpec, s conversion.Scope) error { - out.AssociatePublicIPAddress = in.AssociatePublicIPAddress - out.DeleteOnTermination = in.DeleteOnTermination - out.Description = in.Description - out.SecurityGroupID = *(*[]string)(unsafe.Pointer(&in.SecurityGroupID)) - out.SubnetID = in.SubnetID - return nil -} - -// Convert_v1alpha1_AWSNetworkInterfaceSpec_To_node_AWSNetworkInterfaceSpec is an autogenerated conversion function. -func Convert_v1alpha1_AWSNetworkInterfaceSpec_To_node_AWSNetworkInterfaceSpec(in *AWSNetworkInterfaceSpec, out *node.AWSNetworkInterfaceSpec, s conversion.Scope) error { - return autoConvert_v1alpha1_AWSNetworkInterfaceSpec_To_node_AWSNetworkInterfaceSpec(in, out, s) -} - -func autoConvert_node_AWSNetworkInterfaceSpec_To_v1alpha1_AWSNetworkInterfaceSpec(in *node.AWSNetworkInterfaceSpec, out *AWSNetworkInterfaceSpec, s conversion.Scope) error { - out.AssociatePublicIPAddress = in.AssociatePublicIPAddress - out.DeleteOnTermination = in.DeleteOnTermination - out.Description = in.Description - out.SecurityGroupID = *(*[]string)(unsafe.Pointer(&in.SecurityGroupID)) - out.SubnetID = in.SubnetID - return nil -} - -// Convert_node_AWSNetworkInterfaceSpec_To_v1alpha1_AWSNetworkInterfaceSpec is an autogenerated conversion function. -func Convert_node_AWSNetworkInterfaceSpec_To_v1alpha1_AWSNetworkInterfaceSpec(in *node.AWSNetworkInterfaceSpec, out *AWSNetworkInterfaceSpec, s conversion.Scope) error { - return autoConvert_node_AWSNetworkInterfaceSpec_To_v1alpha1_AWSNetworkInterfaceSpec(in, out, s) -} - -func autoConvert_v1alpha1_ClassSpec_To_node_ClassSpec(in *ClassSpec, out *node.ClassSpec, s conversion.Scope) error { - out.APIGroup = in.APIGroup - out.Kind = in.Kind - out.Name = in.Name - return nil -} - -// Convert_v1alpha1_ClassSpec_To_node_ClassSpec is an autogenerated conversion function. -func Convert_v1alpha1_ClassSpec_To_node_ClassSpec(in *ClassSpec, out *node.ClassSpec, s conversion.Scope) error { - return autoConvert_v1alpha1_ClassSpec_To_node_ClassSpec(in, out, s) -} - -func autoConvert_node_ClassSpec_To_v1alpha1_ClassSpec(in *node.ClassSpec, out *ClassSpec, s conversion.Scope) error { - out.APIGroup = in.APIGroup - out.Kind = in.Kind - out.Name = in.Name - return nil -} - -// Convert_node_ClassSpec_To_v1alpha1_ClassSpec is an autogenerated conversion function. -func Convert_node_ClassSpec_To_v1alpha1_ClassSpec(in *node.ClassSpec, out *ClassSpec, s conversion.Scope) error { - return autoConvert_node_ClassSpec_To_v1alpha1_ClassSpec(in, out, s) -} - -func autoConvert_v1alpha1_CurrentStatus_To_node_CurrentStatus(in *CurrentStatus, out *node.CurrentStatus, s conversion.Scope) error { - out.Phase = node.InstancePhase(in.Phase) - out.TimeoutActive = in.TimeoutActive - out.LastUpdateTime = in.LastUpdateTime - return nil -} - -// Convert_v1alpha1_CurrentStatus_To_node_CurrentStatus is an autogenerated conversion function. -func Convert_v1alpha1_CurrentStatus_To_node_CurrentStatus(in *CurrentStatus, out *node.CurrentStatus, s conversion.Scope) error { - return autoConvert_v1alpha1_CurrentStatus_To_node_CurrentStatus(in, out, s) -} - -func autoConvert_node_CurrentStatus_To_v1alpha1_CurrentStatus(in *node.CurrentStatus, out *CurrentStatus, s conversion.Scope) error { - out.Phase = InstancePhase(in.Phase) - out.TimeoutActive = in.TimeoutActive - out.LastUpdateTime = in.LastUpdateTime - return nil -} - -// Convert_node_CurrentStatus_To_v1alpha1_CurrentStatus is an autogenerated conversion function. -func Convert_node_CurrentStatus_To_v1alpha1_CurrentStatus(in *node.CurrentStatus, out *CurrentStatus, s conversion.Scope) error { - return autoConvert_node_CurrentStatus_To_v1alpha1_CurrentStatus(in, out, s) -} - -func autoConvert_v1alpha1_Instance_To_node_Instance(in *Instance, out *node.Instance, s conversion.Scope) error { - out.ObjectMeta = in.ObjectMeta - if err := Convert_v1alpha1_InstanceSpec_To_node_InstanceSpec(&in.Spec, &out.Spec, s); err != nil { - return err - } - if err := Convert_v1alpha1_InstanceStatus_To_node_InstanceStatus(&in.Status, &out.Status, s); err != nil { - return err - } - return nil -} - -// Convert_v1alpha1_Instance_To_node_Instance is an autogenerated conversion function. -func Convert_v1alpha1_Instance_To_node_Instance(in *Instance, out *node.Instance, s conversion.Scope) error { - return autoConvert_v1alpha1_Instance_To_node_Instance(in, out, s) -} - -func autoConvert_node_Instance_To_v1alpha1_Instance(in *node.Instance, out *Instance, s conversion.Scope) error { - out.ObjectMeta = in.ObjectMeta - if err := Convert_node_InstanceSpec_To_v1alpha1_InstanceSpec(&in.Spec, &out.Spec, s); err != nil { - return err - } - if err := Convert_node_InstanceStatus_To_v1alpha1_InstanceStatus(&in.Status, &out.Status, s); err != nil { - return err - } - return nil -} - -// Convert_node_Instance_To_v1alpha1_Instance is an autogenerated conversion function. -func Convert_node_Instance_To_v1alpha1_Instance(in *node.Instance, out *Instance, s conversion.Scope) error { - return autoConvert_node_Instance_To_v1alpha1_Instance(in, out, s) -} - -func autoConvert_v1alpha1_InstanceDeployment_To_node_InstanceDeployment(in *InstanceDeployment, out *node.InstanceDeployment, s conversion.Scope) error { - out.ObjectMeta = in.ObjectMeta - if err := Convert_v1alpha1_InstanceDeploymentSpec_To_node_InstanceDeploymentSpec(&in.Spec, &out.Spec, s); err != nil { - return err - } - if err := Convert_v1alpha1_InstanceDeploymentStatus_To_node_InstanceDeploymentStatus(&in.Status, &out.Status, s); err != nil { - return err - } - return nil -} - -// Convert_v1alpha1_InstanceDeployment_To_node_InstanceDeployment is an autogenerated conversion function. -func Convert_v1alpha1_InstanceDeployment_To_node_InstanceDeployment(in *InstanceDeployment, out *node.InstanceDeployment, s conversion.Scope) error { - return autoConvert_v1alpha1_InstanceDeployment_To_node_InstanceDeployment(in, out, s) -} - -func autoConvert_node_InstanceDeployment_To_v1alpha1_InstanceDeployment(in *node.InstanceDeployment, out *InstanceDeployment, s conversion.Scope) error { - out.ObjectMeta = in.ObjectMeta - if err := Convert_node_InstanceDeploymentSpec_To_v1alpha1_InstanceDeploymentSpec(&in.Spec, &out.Spec, s); err != nil { - return err - } - if err := Convert_node_InstanceDeploymentStatus_To_v1alpha1_InstanceDeploymentStatus(&in.Status, &out.Status, s); err != nil { - return err - } - return nil -} - -// Convert_node_InstanceDeployment_To_v1alpha1_InstanceDeployment is an autogenerated conversion function. -func Convert_node_InstanceDeployment_To_v1alpha1_InstanceDeployment(in *node.InstanceDeployment, out *InstanceDeployment, s conversion.Scope) error { - return autoConvert_node_InstanceDeployment_To_v1alpha1_InstanceDeployment(in, out, s) -} - -func autoConvert_v1alpha1_InstanceDeploymentCondition_To_node_InstanceDeploymentCondition(in *InstanceDeploymentCondition, out *node.InstanceDeploymentCondition, s conversion.Scope) error { - out.Type = node.InstanceDeploymentConditionType(in.Type) - out.Status = node.ConditionStatus(in.Status) - out.LastUpdateTime = in.LastUpdateTime - out.LastTransitionTime = in.LastTransitionTime - out.Reason = in.Reason - out.Message = in.Message - return nil -} - -// Convert_v1alpha1_InstanceDeploymentCondition_To_node_InstanceDeploymentCondition is an autogenerated conversion function. -func Convert_v1alpha1_InstanceDeploymentCondition_To_node_InstanceDeploymentCondition(in *InstanceDeploymentCondition, out *node.InstanceDeploymentCondition, s conversion.Scope) error { - return autoConvert_v1alpha1_InstanceDeploymentCondition_To_node_InstanceDeploymentCondition(in, out, s) -} - -func autoConvert_node_InstanceDeploymentCondition_To_v1alpha1_InstanceDeploymentCondition(in *node.InstanceDeploymentCondition, out *InstanceDeploymentCondition, s conversion.Scope) error { - out.Type = InstanceDeploymentConditionType(in.Type) - out.Status = ConditionStatus(in.Status) - out.LastUpdateTime = in.LastUpdateTime - out.LastTransitionTime = in.LastTransitionTime - out.Reason = in.Reason - out.Message = in.Message - return nil -} - -// Convert_node_InstanceDeploymentCondition_To_v1alpha1_InstanceDeploymentCondition is an autogenerated conversion function. -func Convert_node_InstanceDeploymentCondition_To_v1alpha1_InstanceDeploymentCondition(in *node.InstanceDeploymentCondition, out *InstanceDeploymentCondition, s conversion.Scope) error { - return autoConvert_node_InstanceDeploymentCondition_To_v1alpha1_InstanceDeploymentCondition(in, out, s) -} - -func autoConvert_v1alpha1_InstanceDeploymentList_To_node_InstanceDeploymentList(in *InstanceDeploymentList, out *node.InstanceDeploymentList, s conversion.Scope) error { - out.ListMeta = in.ListMeta - out.Items = *(*[]node.InstanceDeployment)(unsafe.Pointer(&in.Items)) - return nil -} - -// Convert_v1alpha1_InstanceDeploymentList_To_node_InstanceDeploymentList is an autogenerated conversion function. -func Convert_v1alpha1_InstanceDeploymentList_To_node_InstanceDeploymentList(in *InstanceDeploymentList, out *node.InstanceDeploymentList, s conversion.Scope) error { - return autoConvert_v1alpha1_InstanceDeploymentList_To_node_InstanceDeploymentList(in, out, s) -} - -func autoConvert_node_InstanceDeploymentList_To_v1alpha1_InstanceDeploymentList(in *node.InstanceDeploymentList, out *InstanceDeploymentList, s conversion.Scope) error { - out.ListMeta = in.ListMeta - out.Items = *(*[]InstanceDeployment)(unsafe.Pointer(&in.Items)) - return nil -} - -// Convert_node_InstanceDeploymentList_To_v1alpha1_InstanceDeploymentList is an autogenerated conversion function. -func Convert_node_InstanceDeploymentList_To_v1alpha1_InstanceDeploymentList(in *node.InstanceDeploymentList, out *InstanceDeploymentList, s conversion.Scope) error { - return autoConvert_node_InstanceDeploymentList_To_v1alpha1_InstanceDeploymentList(in, out, s) -} - -func autoConvert_v1alpha1_InstanceDeploymentRollback_To_node_InstanceDeploymentRollback(in *InstanceDeploymentRollback, out *node.InstanceDeploymentRollback, s conversion.Scope) error { - out.Name = in.Name - out.UpdatedAnnotations = *(*map[string]string)(unsafe.Pointer(&in.UpdatedAnnotations)) - if err := Convert_v1alpha1_RollbackConfig_To_node_RollbackConfig(&in.RollbackTo, &out.RollbackTo, s); err != nil { - return err - } - return nil -} - -// Convert_v1alpha1_InstanceDeploymentRollback_To_node_InstanceDeploymentRollback is an autogenerated conversion function. -func Convert_v1alpha1_InstanceDeploymentRollback_To_node_InstanceDeploymentRollback(in *InstanceDeploymentRollback, out *node.InstanceDeploymentRollback, s conversion.Scope) error { - return autoConvert_v1alpha1_InstanceDeploymentRollback_To_node_InstanceDeploymentRollback(in, out, s) -} - -func autoConvert_node_InstanceDeploymentRollback_To_v1alpha1_InstanceDeploymentRollback(in *node.InstanceDeploymentRollback, out *InstanceDeploymentRollback, s conversion.Scope) error { - out.Name = in.Name - out.UpdatedAnnotations = *(*map[string]string)(unsafe.Pointer(&in.UpdatedAnnotations)) - if err := Convert_node_RollbackConfig_To_v1alpha1_RollbackConfig(&in.RollbackTo, &out.RollbackTo, s); err != nil { - return err - } - return nil -} - -// Convert_node_InstanceDeploymentRollback_To_v1alpha1_InstanceDeploymentRollback is an autogenerated conversion function. -func Convert_node_InstanceDeploymentRollback_To_v1alpha1_InstanceDeploymentRollback(in *node.InstanceDeploymentRollback, out *InstanceDeploymentRollback, s conversion.Scope) error { - return autoConvert_node_InstanceDeploymentRollback_To_v1alpha1_InstanceDeploymentRollback(in, out, s) -} - -func autoConvert_v1alpha1_InstanceDeploymentSpec_To_node_InstanceDeploymentSpec(in *InstanceDeploymentSpec, out *node.InstanceDeploymentSpec, s conversion.Scope) error { - out.Replicas = in.Replicas - out.Selector = (*meta_v1.LabelSelector)(unsafe.Pointer(in.Selector)) - if err := Convert_v1alpha1_InstanceTemplateSpec_To_node_InstanceTemplateSpec(&in.Template, &out.Template, s); err != nil { - return err - } - if err := Convert_v1alpha1_InstanceDeploymentStrategy_To_node_InstanceDeploymentStrategy(&in.Strategy, &out.Strategy, s); err != nil { - return err - } - out.MinReadySeconds = in.MinReadySeconds - out.RevisionHistoryLimit = (*int32)(unsafe.Pointer(in.RevisionHistoryLimit)) - out.Paused = in.Paused - out.RollbackTo = (*node.RollbackConfig)(unsafe.Pointer(in.RollbackTo)) - out.ProgressDeadlineSeconds = (*int32)(unsafe.Pointer(in.ProgressDeadlineSeconds)) - return nil -} - -// Convert_v1alpha1_InstanceDeploymentSpec_To_node_InstanceDeploymentSpec is an autogenerated conversion function. -func Convert_v1alpha1_InstanceDeploymentSpec_To_node_InstanceDeploymentSpec(in *InstanceDeploymentSpec, out *node.InstanceDeploymentSpec, s conversion.Scope) error { - return autoConvert_v1alpha1_InstanceDeploymentSpec_To_node_InstanceDeploymentSpec(in, out, s) -} - -func autoConvert_node_InstanceDeploymentSpec_To_v1alpha1_InstanceDeploymentSpec(in *node.InstanceDeploymentSpec, out *InstanceDeploymentSpec, s conversion.Scope) error { - out.Replicas = in.Replicas - out.Selector = (*meta_v1.LabelSelector)(unsafe.Pointer(in.Selector)) - if err := Convert_node_InstanceTemplateSpec_To_v1alpha1_InstanceTemplateSpec(&in.Template, &out.Template, s); err != nil { - return err - } - if err := Convert_node_InstanceDeploymentStrategy_To_v1alpha1_InstanceDeploymentStrategy(&in.Strategy, &out.Strategy, s); err != nil { - return err - } - out.MinReadySeconds = in.MinReadySeconds - out.RevisionHistoryLimit = (*int32)(unsafe.Pointer(in.RevisionHistoryLimit)) - out.Paused = in.Paused - out.RollbackTo = (*RollbackConfig)(unsafe.Pointer(in.RollbackTo)) - out.ProgressDeadlineSeconds = (*int32)(unsafe.Pointer(in.ProgressDeadlineSeconds)) - return nil -} - -// Convert_node_InstanceDeploymentSpec_To_v1alpha1_InstanceDeploymentSpec is an autogenerated conversion function. -func Convert_node_InstanceDeploymentSpec_To_v1alpha1_InstanceDeploymentSpec(in *node.InstanceDeploymentSpec, out *InstanceDeploymentSpec, s conversion.Scope) error { - return autoConvert_node_InstanceDeploymentSpec_To_v1alpha1_InstanceDeploymentSpec(in, out, s) -} - -func autoConvert_v1alpha1_InstanceDeploymentStatus_To_node_InstanceDeploymentStatus(in *InstanceDeploymentStatus, out *node.InstanceDeploymentStatus, s conversion.Scope) error { - out.ObservedGeneration = in.ObservedGeneration - out.Replicas = in.Replicas - out.UpdatedReplicas = in.UpdatedReplicas - out.ReadyReplicas = in.ReadyReplicas - out.AvailableReplicas = in.AvailableReplicas - out.UnavailableReplicas = in.UnavailableReplicas - out.Conditions = *(*[]node.InstanceDeploymentCondition)(unsafe.Pointer(&in.Conditions)) - out.CollisionCount = (*int32)(unsafe.Pointer(in.CollisionCount)) - return nil -} - -// Convert_v1alpha1_InstanceDeploymentStatus_To_node_InstanceDeploymentStatus is an autogenerated conversion function. -func Convert_v1alpha1_InstanceDeploymentStatus_To_node_InstanceDeploymentStatus(in *InstanceDeploymentStatus, out *node.InstanceDeploymentStatus, s conversion.Scope) error { - return autoConvert_v1alpha1_InstanceDeploymentStatus_To_node_InstanceDeploymentStatus(in, out, s) -} - -func autoConvert_node_InstanceDeploymentStatus_To_v1alpha1_InstanceDeploymentStatus(in *node.InstanceDeploymentStatus, out *InstanceDeploymentStatus, s conversion.Scope) error { - out.ObservedGeneration = in.ObservedGeneration - out.Replicas = in.Replicas - out.UpdatedReplicas = in.UpdatedReplicas - out.ReadyReplicas = in.ReadyReplicas - out.AvailableReplicas = in.AvailableReplicas - out.UnavailableReplicas = in.UnavailableReplicas - out.Conditions = *(*[]InstanceDeploymentCondition)(unsafe.Pointer(&in.Conditions)) - out.CollisionCount = (*int32)(unsafe.Pointer(in.CollisionCount)) - return nil -} - -// Convert_node_InstanceDeploymentStatus_To_v1alpha1_InstanceDeploymentStatus is an autogenerated conversion function. -func Convert_node_InstanceDeploymentStatus_To_v1alpha1_InstanceDeploymentStatus(in *node.InstanceDeploymentStatus, out *InstanceDeploymentStatus, s conversion.Scope) error { - return autoConvert_node_InstanceDeploymentStatus_To_v1alpha1_InstanceDeploymentStatus(in, out, s) -} - -func autoConvert_v1alpha1_InstanceDeploymentStrategy_To_node_InstanceDeploymentStrategy(in *InstanceDeploymentStrategy, out *node.InstanceDeploymentStrategy, s conversion.Scope) error { - out.Type = node.InstanceDeploymentStrategyType(in.Type) - out.RollingUpdate = (*node.RollingUpdateInstanceDeployment)(unsafe.Pointer(in.RollingUpdate)) - return nil -} - -// Convert_v1alpha1_InstanceDeploymentStrategy_To_node_InstanceDeploymentStrategy is an autogenerated conversion function. -func Convert_v1alpha1_InstanceDeploymentStrategy_To_node_InstanceDeploymentStrategy(in *InstanceDeploymentStrategy, out *node.InstanceDeploymentStrategy, s conversion.Scope) error { - return autoConvert_v1alpha1_InstanceDeploymentStrategy_To_node_InstanceDeploymentStrategy(in, out, s) -} - -func autoConvert_node_InstanceDeploymentStrategy_To_v1alpha1_InstanceDeploymentStrategy(in *node.InstanceDeploymentStrategy, out *InstanceDeploymentStrategy, s conversion.Scope) error { - out.Type = InstanceDeploymentStrategyType(in.Type) - out.RollingUpdate = (*RollingUpdateInstanceDeployment)(unsafe.Pointer(in.RollingUpdate)) - return nil -} - -// Convert_node_InstanceDeploymentStrategy_To_v1alpha1_InstanceDeploymentStrategy is an autogenerated conversion function. -func Convert_node_InstanceDeploymentStrategy_To_v1alpha1_InstanceDeploymentStrategy(in *node.InstanceDeploymentStrategy, out *InstanceDeploymentStrategy, s conversion.Scope) error { - return autoConvert_node_InstanceDeploymentStrategy_To_v1alpha1_InstanceDeploymentStrategy(in, out, s) -} - -func autoConvert_v1alpha1_InstanceList_To_node_InstanceList(in *InstanceList, out *node.InstanceList, s conversion.Scope) error { - out.ListMeta = in.ListMeta - out.Items = *(*[]node.Instance)(unsafe.Pointer(&in.Items)) - return nil -} - -// Convert_v1alpha1_InstanceList_To_node_InstanceList is an autogenerated conversion function. -func Convert_v1alpha1_InstanceList_To_node_InstanceList(in *InstanceList, out *node.InstanceList, s conversion.Scope) error { - return autoConvert_v1alpha1_InstanceList_To_node_InstanceList(in, out, s) -} - -func autoConvert_node_InstanceList_To_v1alpha1_InstanceList(in *node.InstanceList, out *InstanceList, s conversion.Scope) error { - out.ListMeta = in.ListMeta - out.Items = *(*[]Instance)(unsafe.Pointer(&in.Items)) - return nil -} - -// Convert_node_InstanceList_To_v1alpha1_InstanceList is an autogenerated conversion function. -func Convert_node_InstanceList_To_v1alpha1_InstanceList(in *node.InstanceList, out *InstanceList, s conversion.Scope) error { - return autoConvert_node_InstanceList_To_v1alpha1_InstanceList(in, out, s) -} - -func autoConvert_v1alpha1_InstanceSet_To_node_InstanceSet(in *InstanceSet, out *node.InstanceSet, s conversion.Scope) error { - out.ObjectMeta = in.ObjectMeta - if err := Convert_v1alpha1_InstanceSetSpec_To_node_InstanceSetSpec(&in.Spec, &out.Spec, s); err != nil { - return err - } - if err := Convert_v1alpha1_InstanceSetStatus_To_node_InstanceSetStatus(&in.Status, &out.Status, s); err != nil { - return err - } - return nil -} - -// Convert_v1alpha1_InstanceSet_To_node_InstanceSet is an autogenerated conversion function. -func Convert_v1alpha1_InstanceSet_To_node_InstanceSet(in *InstanceSet, out *node.InstanceSet, s conversion.Scope) error { - return autoConvert_v1alpha1_InstanceSet_To_node_InstanceSet(in, out, s) -} - -func autoConvert_node_InstanceSet_To_v1alpha1_InstanceSet(in *node.InstanceSet, out *InstanceSet, s conversion.Scope) error { - out.ObjectMeta = in.ObjectMeta - if err := Convert_node_InstanceSetSpec_To_v1alpha1_InstanceSetSpec(&in.Spec, &out.Spec, s); err != nil { - return err - } - if err := Convert_node_InstanceSetStatus_To_v1alpha1_InstanceSetStatus(&in.Status, &out.Status, s); err != nil { - return err - } - return nil -} - -// Convert_node_InstanceSet_To_v1alpha1_InstanceSet is an autogenerated conversion function. -func Convert_node_InstanceSet_To_v1alpha1_InstanceSet(in *node.InstanceSet, out *InstanceSet, s conversion.Scope) error { - return autoConvert_node_InstanceSet_To_v1alpha1_InstanceSet(in, out, s) -} - -func autoConvert_v1alpha1_InstanceSetCondition_To_node_InstanceSetCondition(in *InstanceSetCondition, out *node.InstanceSetCondition, s conversion.Scope) error { - out.Type = node.InstanceSetConditionType(in.Type) - out.Status = node.ConditionStatus(in.Status) - out.LastTransitionTime = in.LastTransitionTime - out.Reason = in.Reason - out.Message = in.Message - return nil -} - -// Convert_v1alpha1_InstanceSetCondition_To_node_InstanceSetCondition is an autogenerated conversion function. -func Convert_v1alpha1_InstanceSetCondition_To_node_InstanceSetCondition(in *InstanceSetCondition, out *node.InstanceSetCondition, s conversion.Scope) error { - return autoConvert_v1alpha1_InstanceSetCondition_To_node_InstanceSetCondition(in, out, s) -} - -func autoConvert_node_InstanceSetCondition_To_v1alpha1_InstanceSetCondition(in *node.InstanceSetCondition, out *InstanceSetCondition, s conversion.Scope) error { - out.Type = InstanceSetConditionType(in.Type) - out.Status = ConditionStatus(in.Status) - out.LastTransitionTime = in.LastTransitionTime - out.Reason = in.Reason - out.Message = in.Message - return nil -} - -// Convert_node_InstanceSetCondition_To_v1alpha1_InstanceSetCondition is an autogenerated conversion function. -func Convert_node_InstanceSetCondition_To_v1alpha1_InstanceSetCondition(in *node.InstanceSetCondition, out *InstanceSetCondition, s conversion.Scope) error { - return autoConvert_node_InstanceSetCondition_To_v1alpha1_InstanceSetCondition(in, out, s) -} - -func autoConvert_v1alpha1_InstanceSetList_To_node_InstanceSetList(in *InstanceSetList, out *node.InstanceSetList, s conversion.Scope) error { - out.ListMeta = in.ListMeta - if in.Items != nil { - in, out := &in.Items, &out.Items - *out = make([]node.InstanceSet, len(*in)) - for i := range *in { - if err := Convert_v1alpha1_InstanceSet_To_node_InstanceSet(&(*in)[i], &(*out)[i], s); err != nil { - return err - } - } - } else { - out.Items = nil - } - return nil -} - -// Convert_v1alpha1_InstanceSetList_To_node_InstanceSetList is an autogenerated conversion function. -func Convert_v1alpha1_InstanceSetList_To_node_InstanceSetList(in *InstanceSetList, out *node.InstanceSetList, s conversion.Scope) error { - return autoConvert_v1alpha1_InstanceSetList_To_node_InstanceSetList(in, out, s) -} - -func autoConvert_node_InstanceSetList_To_v1alpha1_InstanceSetList(in *node.InstanceSetList, out *InstanceSetList, s conversion.Scope) error { - out.ListMeta = in.ListMeta - if in.Items != nil { - in, out := &in.Items, &out.Items - *out = make([]InstanceSet, len(*in)) - for i := range *in { - if err := Convert_node_InstanceSet_To_v1alpha1_InstanceSet(&(*in)[i], &(*out)[i], s); err != nil { - return err - } - } - } else { - out.Items = nil - } - return nil -} - -// Convert_node_InstanceSetList_To_v1alpha1_InstanceSetList is an autogenerated conversion function. -func Convert_node_InstanceSetList_To_v1alpha1_InstanceSetList(in *node.InstanceSetList, out *InstanceSetList, s conversion.Scope) error { - return autoConvert_node_InstanceSetList_To_v1alpha1_InstanceSetList(in, out, s) -} - -func autoConvert_v1alpha1_InstanceSetSpec_To_node_InstanceSetSpec(in *InstanceSetSpec, out *node.InstanceSetSpec, s conversion.Scope) error { - out.Replicas = in.Replicas - out.Selector = (*meta_v1.LabelSelector)(unsafe.Pointer(in.Selector)) - if err := Convert_v1alpha1_ClassSpec_To_node_ClassSpec(&in.InstanceClass, &out.InstanceClass, s); err != nil { - return err - } - if err := Convert_v1alpha1_InstanceTemplateSpec_To_node_InstanceTemplateSpec(&in.Template, &out.Template, s); err != nil { - return err - } - out.MinReadySeconds = int(in.MinReadySeconds) - return nil -} - -// Convert_v1alpha1_InstanceSetSpec_To_node_InstanceSetSpec is an autogenerated conversion function. -func Convert_v1alpha1_InstanceSetSpec_To_node_InstanceSetSpec(in *InstanceSetSpec, out *node.InstanceSetSpec, s conversion.Scope) error { - return autoConvert_v1alpha1_InstanceSetSpec_To_node_InstanceSetSpec(in, out, s) -} - -func autoConvert_node_InstanceSetSpec_To_v1alpha1_InstanceSetSpec(in *node.InstanceSetSpec, out *InstanceSetSpec, s conversion.Scope) error { - out.Replicas = in.Replicas - out.Selector = (*meta_v1.LabelSelector)(unsafe.Pointer(in.Selector)) - if err := Convert_node_ClassSpec_To_v1alpha1_ClassSpec(&in.InstanceClass, &out.InstanceClass, s); err != nil { - return err - } - if err := Convert_node_InstanceTemplateSpec_To_v1alpha1_InstanceTemplateSpec(&in.Template, &out.Template, s); err != nil { - return err - } - out.MinReadySeconds = int32(in.MinReadySeconds) - return nil -} - -// Convert_node_InstanceSetSpec_To_v1alpha1_InstanceSetSpec is an autogenerated conversion function. -func Convert_node_InstanceSetSpec_To_v1alpha1_InstanceSetSpec(in *node.InstanceSetSpec, out *InstanceSetSpec, s conversion.Scope) error { - return autoConvert_node_InstanceSetSpec_To_v1alpha1_InstanceSetSpec(in, out, s) -} - -func autoConvert_v1alpha1_InstanceSetStatus_To_node_InstanceSetStatus(in *InstanceSetStatus, out *node.InstanceSetStatus, s conversion.Scope) error { - if err := Convert_v1alpha1_LastOperation_To_node_LastOperation(&in.LastOperation, &out.LastOperation, s); err != nil { - return err - } - out.Replicas = in.Replicas - out.FullyLabeledReplicas = in.FullyLabeledReplicas - out.ReadyReplicas = in.ReadyReplicas - out.AvailableReplicas = in.AvailableReplicas - out.Conditions = *(*[]node.InstanceSetCondition)(unsafe.Pointer(&in.Conditions)) - out.ObservedGeneration = in.ObservedGeneration - return nil -} - -// Convert_v1alpha1_InstanceSetStatus_To_node_InstanceSetStatus is an autogenerated conversion function. -func Convert_v1alpha1_InstanceSetStatus_To_node_InstanceSetStatus(in *InstanceSetStatus, out *node.InstanceSetStatus, s conversion.Scope) error { - return autoConvert_v1alpha1_InstanceSetStatus_To_node_InstanceSetStatus(in, out, s) -} - -func autoConvert_node_InstanceSetStatus_To_v1alpha1_InstanceSetStatus(in *node.InstanceSetStatus, out *InstanceSetStatus, s conversion.Scope) error { - if err := Convert_node_LastOperation_To_v1alpha1_LastOperation(&in.LastOperation, &out.LastOperation, s); err != nil { - return err - } - out.Replicas = in.Replicas - out.FullyLabeledReplicas = in.FullyLabeledReplicas - out.ReadyReplicas = in.ReadyReplicas - out.AvailableReplicas = in.AvailableReplicas - out.Conditions = *(*[]InstanceSetCondition)(unsafe.Pointer(&in.Conditions)) - out.ObservedGeneration = in.ObservedGeneration - return nil -} - -// Convert_node_InstanceSetStatus_To_v1alpha1_InstanceSetStatus is an autogenerated conversion function. -func Convert_node_InstanceSetStatus_To_v1alpha1_InstanceSetStatus(in *node.InstanceSetStatus, out *InstanceSetStatus, s conversion.Scope) error { - return autoConvert_node_InstanceSetStatus_To_v1alpha1_InstanceSetStatus(in, out, s) -} - -func autoConvert_v1alpha1_InstanceSpec_To_node_InstanceSpec(in *InstanceSpec, out *node.InstanceSpec, s conversion.Scope) error { - if err := Convert_v1alpha1_ClassSpec_To_node_ClassSpec(&in.Class, &out.Class, s); err != nil { - return err - } - out.ProviderID = in.ProviderID - return nil -} - -// Convert_v1alpha1_InstanceSpec_To_node_InstanceSpec is an autogenerated conversion function. -func Convert_v1alpha1_InstanceSpec_To_node_InstanceSpec(in *InstanceSpec, out *node.InstanceSpec, s conversion.Scope) error { - return autoConvert_v1alpha1_InstanceSpec_To_node_InstanceSpec(in, out, s) -} - -func autoConvert_node_InstanceSpec_To_v1alpha1_InstanceSpec(in *node.InstanceSpec, out *InstanceSpec, s conversion.Scope) error { - if err := Convert_node_ClassSpec_To_v1alpha1_ClassSpec(&in.Class, &out.Class, s); err != nil { - return err - } - out.ProviderID = in.ProviderID - return nil -} - -// Convert_node_InstanceSpec_To_v1alpha1_InstanceSpec is an autogenerated conversion function. -func Convert_node_InstanceSpec_To_v1alpha1_InstanceSpec(in *node.InstanceSpec, out *InstanceSpec, s conversion.Scope) error { - return autoConvert_node_InstanceSpec_To_v1alpha1_InstanceSpec(in, out, s) -} - -func autoConvert_v1alpha1_InstanceStatus_To_node_InstanceStatus(in *InstanceStatus, out *node.InstanceStatus, s conversion.Scope) error { - out.Node = in.Node - out.Conditions = *(*[]v1.NodeCondition)(unsafe.Pointer(&in.Conditions)) - if err := Convert_v1alpha1_LastOperation_To_node_LastOperation(&in.LastOperation, &out.LastOperation, s); err != nil { - return err - } - if err := Convert_v1alpha1_CurrentStatus_To_node_CurrentStatus(&in.CurrentStatus, &out.CurrentStatus, s); err != nil { - return err - } - return nil -} - -// Convert_v1alpha1_InstanceStatus_To_node_InstanceStatus is an autogenerated conversion function. -func Convert_v1alpha1_InstanceStatus_To_node_InstanceStatus(in *InstanceStatus, out *node.InstanceStatus, s conversion.Scope) error { - return autoConvert_v1alpha1_InstanceStatus_To_node_InstanceStatus(in, out, s) -} - -func autoConvert_node_InstanceStatus_To_v1alpha1_InstanceStatus(in *node.InstanceStatus, out *InstanceStatus, s conversion.Scope) error { - out.Node = in.Node - out.Conditions = *(*[]v1.NodeCondition)(unsafe.Pointer(&in.Conditions)) - if err := Convert_node_LastOperation_To_v1alpha1_LastOperation(&in.LastOperation, &out.LastOperation, s); err != nil { - return err - } - if err := Convert_node_CurrentStatus_To_v1alpha1_CurrentStatus(&in.CurrentStatus, &out.CurrentStatus, s); err != nil { - return err - } - return nil -} - -// Convert_node_InstanceStatus_To_v1alpha1_InstanceStatus is an autogenerated conversion function. -func Convert_node_InstanceStatus_To_v1alpha1_InstanceStatus(in *node.InstanceStatus, out *InstanceStatus, s conversion.Scope) error { - return autoConvert_node_InstanceStatus_To_v1alpha1_InstanceStatus(in, out, s) -} - -func autoConvert_v1alpha1_InstanceTemplate_To_node_InstanceTemplate(in *InstanceTemplate, out *node.InstanceTemplate, s conversion.Scope) error { - out.ObjectMeta = in.ObjectMeta - if err := Convert_v1alpha1_InstanceTemplateSpec_To_node_InstanceTemplateSpec(&in.Template, &out.Template, s); err != nil { - return err - } - return nil -} - -// Convert_v1alpha1_InstanceTemplate_To_node_InstanceTemplate is an autogenerated conversion function. -func Convert_v1alpha1_InstanceTemplate_To_node_InstanceTemplate(in *InstanceTemplate, out *node.InstanceTemplate, s conversion.Scope) error { - return autoConvert_v1alpha1_InstanceTemplate_To_node_InstanceTemplate(in, out, s) -} - -func autoConvert_node_InstanceTemplate_To_v1alpha1_InstanceTemplate(in *node.InstanceTemplate, out *InstanceTemplate, s conversion.Scope) error { - out.ObjectMeta = in.ObjectMeta - if err := Convert_node_InstanceTemplateSpec_To_v1alpha1_InstanceTemplateSpec(&in.Template, &out.Template, s); err != nil { - return err - } - return nil -} - -// Convert_node_InstanceTemplate_To_v1alpha1_InstanceTemplate is an autogenerated conversion function. -func Convert_node_InstanceTemplate_To_v1alpha1_InstanceTemplate(in *node.InstanceTemplate, out *InstanceTemplate, s conversion.Scope) error { - return autoConvert_node_InstanceTemplate_To_v1alpha1_InstanceTemplate(in, out, s) -} - -func autoConvert_v1alpha1_InstanceTemplateList_To_node_InstanceTemplateList(in *InstanceTemplateList, out *node.InstanceTemplateList, s conversion.Scope) error { - out.ListMeta = in.ListMeta - out.Items = *(*[]node.InstanceTemplate)(unsafe.Pointer(&in.Items)) - return nil -} - -// Convert_v1alpha1_InstanceTemplateList_To_node_InstanceTemplateList is an autogenerated conversion function. -func Convert_v1alpha1_InstanceTemplateList_To_node_InstanceTemplateList(in *InstanceTemplateList, out *node.InstanceTemplateList, s conversion.Scope) error { - return autoConvert_v1alpha1_InstanceTemplateList_To_node_InstanceTemplateList(in, out, s) -} - -func autoConvert_node_InstanceTemplateList_To_v1alpha1_InstanceTemplateList(in *node.InstanceTemplateList, out *InstanceTemplateList, s conversion.Scope) error { - out.ListMeta = in.ListMeta - out.Items = *(*[]InstanceTemplate)(unsafe.Pointer(&in.Items)) - return nil -} - -// Convert_node_InstanceTemplateList_To_v1alpha1_InstanceTemplateList is an autogenerated conversion function. -func Convert_node_InstanceTemplateList_To_v1alpha1_InstanceTemplateList(in *node.InstanceTemplateList, out *InstanceTemplateList, s conversion.Scope) error { - return autoConvert_node_InstanceTemplateList_To_v1alpha1_InstanceTemplateList(in, out, s) -} - -func autoConvert_v1alpha1_InstanceTemplateSpec_To_node_InstanceTemplateSpec(in *InstanceTemplateSpec, out *node.InstanceTemplateSpec, s conversion.Scope) error { - out.ObjectMeta = in.ObjectMeta - if err := Convert_v1alpha1_InstanceSpec_To_node_InstanceSpec(&in.Spec, &out.Spec, s); err != nil { - return err - } - return nil -} - -// Convert_v1alpha1_InstanceTemplateSpec_To_node_InstanceTemplateSpec is an autogenerated conversion function. -func Convert_v1alpha1_InstanceTemplateSpec_To_node_InstanceTemplateSpec(in *InstanceTemplateSpec, out *node.InstanceTemplateSpec, s conversion.Scope) error { - return autoConvert_v1alpha1_InstanceTemplateSpec_To_node_InstanceTemplateSpec(in, out, s) -} - -func autoConvert_node_InstanceTemplateSpec_To_v1alpha1_InstanceTemplateSpec(in *node.InstanceTemplateSpec, out *InstanceTemplateSpec, s conversion.Scope) error { - out.ObjectMeta = in.ObjectMeta - if err := Convert_node_InstanceSpec_To_v1alpha1_InstanceSpec(&in.Spec, &out.Spec, s); err != nil { - return err - } - return nil -} - -// Convert_node_InstanceTemplateSpec_To_v1alpha1_InstanceTemplateSpec is an autogenerated conversion function. -func Convert_node_InstanceTemplateSpec_To_v1alpha1_InstanceTemplateSpec(in *node.InstanceTemplateSpec, out *InstanceTemplateSpec, s conversion.Scope) error { - return autoConvert_node_InstanceTemplateSpec_To_v1alpha1_InstanceTemplateSpec(in, out, s) -} - -func autoConvert_v1alpha1_LastOperation_To_node_LastOperation(in *LastOperation, out *node.LastOperation, s conversion.Scope) error { - out.Description = in.Description - out.LastUpdateTime = in.LastUpdateTime - out.State = node.InstanceState(in.State) - out.Type = in.Type - return nil -} - -// Convert_v1alpha1_LastOperation_To_node_LastOperation is an autogenerated conversion function. -func Convert_v1alpha1_LastOperation_To_node_LastOperation(in *LastOperation, out *node.LastOperation, s conversion.Scope) error { - return autoConvert_v1alpha1_LastOperation_To_node_LastOperation(in, out, s) -} - -func autoConvert_node_LastOperation_To_v1alpha1_LastOperation(in *node.LastOperation, out *LastOperation, s conversion.Scope) error { - out.Description = in.Description - out.LastUpdateTime = in.LastUpdateTime - out.State = InstanceState(in.State) - out.Type = in.Type - return nil -} - -// Convert_node_LastOperation_To_v1alpha1_LastOperation is an autogenerated conversion function. -func Convert_node_LastOperation_To_v1alpha1_LastOperation(in *node.LastOperation, out *LastOperation, s conversion.Scope) error { - return autoConvert_node_LastOperation_To_v1alpha1_LastOperation(in, out, s) -} - -func autoConvert_v1alpha1_RollbackConfig_To_node_RollbackConfig(in *RollbackConfig, out *node.RollbackConfig, s conversion.Scope) error { - out.Revision = in.Revision - return nil -} - -// Convert_v1alpha1_RollbackConfig_To_node_RollbackConfig is an autogenerated conversion function. -func Convert_v1alpha1_RollbackConfig_To_node_RollbackConfig(in *RollbackConfig, out *node.RollbackConfig, s conversion.Scope) error { - return autoConvert_v1alpha1_RollbackConfig_To_node_RollbackConfig(in, out, s) -} - -func autoConvert_node_RollbackConfig_To_v1alpha1_RollbackConfig(in *node.RollbackConfig, out *RollbackConfig, s conversion.Scope) error { - out.Revision = in.Revision - return nil -} - -// Convert_node_RollbackConfig_To_v1alpha1_RollbackConfig is an autogenerated conversion function. -func Convert_node_RollbackConfig_To_v1alpha1_RollbackConfig(in *node.RollbackConfig, out *RollbackConfig, s conversion.Scope) error { - return autoConvert_node_RollbackConfig_To_v1alpha1_RollbackConfig(in, out, s) -} - -func autoConvert_v1alpha1_RollingUpdateInstanceDeployment_To_node_RollingUpdateInstanceDeployment(in *RollingUpdateInstanceDeployment, out *node.RollingUpdateInstanceDeployment, s conversion.Scope) error { - out.MaxUnavailable = (*intstr.IntOrString)(unsafe.Pointer(in.MaxUnavailable)) - out.MaxSurge = (*intstr.IntOrString)(unsafe.Pointer(in.MaxSurge)) - return nil -} - -// Convert_v1alpha1_RollingUpdateInstanceDeployment_To_node_RollingUpdateInstanceDeployment is an autogenerated conversion function. -func Convert_v1alpha1_RollingUpdateInstanceDeployment_To_node_RollingUpdateInstanceDeployment(in *RollingUpdateInstanceDeployment, out *node.RollingUpdateInstanceDeployment, s conversion.Scope) error { - return autoConvert_v1alpha1_RollingUpdateInstanceDeployment_To_node_RollingUpdateInstanceDeployment(in, out, s) -} - -func autoConvert_node_RollingUpdateInstanceDeployment_To_v1alpha1_RollingUpdateInstanceDeployment(in *node.RollingUpdateInstanceDeployment, out *RollingUpdateInstanceDeployment, s conversion.Scope) error { - out.MaxUnavailable = (*intstr.IntOrString)(unsafe.Pointer(in.MaxUnavailable)) - out.MaxSurge = (*intstr.IntOrString)(unsafe.Pointer(in.MaxSurge)) - return nil -} - -// Convert_node_RollingUpdateInstanceDeployment_To_v1alpha1_RollingUpdateInstanceDeployment is an autogenerated conversion function. -func Convert_node_RollingUpdateInstanceDeployment_To_v1alpha1_RollingUpdateInstanceDeployment(in *node.RollingUpdateInstanceDeployment, out *RollingUpdateInstanceDeployment, s conversion.Scope) error { - return autoConvert_node_RollingUpdateInstanceDeployment_To_v1alpha1_RollingUpdateInstanceDeployment(in, out, s) -} - -func autoConvert_v1alpha1_Scale_To_node_Scale(in *Scale, out *node.Scale, s conversion.Scope) error { - out.ObjectMeta = in.ObjectMeta - if err := Convert_v1alpha1_ScaleSpec_To_node_ScaleSpec(&in.Spec, &out.Spec, s); err != nil { - return err - } - if err := Convert_v1alpha1_ScaleStatus_To_node_ScaleStatus(&in.Status, &out.Status, s); err != nil { - return err - } - return nil -} - -// Convert_v1alpha1_Scale_To_node_Scale is an autogenerated conversion function. -func Convert_v1alpha1_Scale_To_node_Scale(in *Scale, out *node.Scale, s conversion.Scope) error { - return autoConvert_v1alpha1_Scale_To_node_Scale(in, out, s) -} - -func autoConvert_node_Scale_To_v1alpha1_Scale(in *node.Scale, out *Scale, s conversion.Scope) error { - out.ObjectMeta = in.ObjectMeta - if err := Convert_node_ScaleSpec_To_v1alpha1_ScaleSpec(&in.Spec, &out.Spec, s); err != nil { - return err - } - if err := Convert_node_ScaleStatus_To_v1alpha1_ScaleStatus(&in.Status, &out.Status, s); err != nil { - return err - } - return nil -} - -// Convert_node_Scale_To_v1alpha1_Scale is an autogenerated conversion function. -func Convert_node_Scale_To_v1alpha1_Scale(in *node.Scale, out *Scale, s conversion.Scope) error { - return autoConvert_node_Scale_To_v1alpha1_Scale(in, out, s) -} - -func autoConvert_v1alpha1_ScaleSpec_To_node_ScaleSpec(in *ScaleSpec, out *node.ScaleSpec, s conversion.Scope) error { - out.Replicas = in.Replicas - return nil -} - -// Convert_v1alpha1_ScaleSpec_To_node_ScaleSpec is an autogenerated conversion function. -func Convert_v1alpha1_ScaleSpec_To_node_ScaleSpec(in *ScaleSpec, out *node.ScaleSpec, s conversion.Scope) error { - return autoConvert_v1alpha1_ScaleSpec_To_node_ScaleSpec(in, out, s) -} - -func autoConvert_node_ScaleSpec_To_v1alpha1_ScaleSpec(in *node.ScaleSpec, out *ScaleSpec, s conversion.Scope) error { - out.Replicas = in.Replicas - return nil -} - -// Convert_node_ScaleSpec_To_v1alpha1_ScaleSpec is an autogenerated conversion function. -func Convert_node_ScaleSpec_To_v1alpha1_ScaleSpec(in *node.ScaleSpec, out *ScaleSpec, s conversion.Scope) error { - return autoConvert_node_ScaleSpec_To_v1alpha1_ScaleSpec(in, out, s) -} - -func autoConvert_v1alpha1_ScaleStatus_To_node_ScaleStatus(in *ScaleStatus, out *node.ScaleStatus, s conversion.Scope) error { - out.Replicas = in.Replicas - out.Selector = (*meta_v1.LabelSelector)(unsafe.Pointer(in.Selector)) - out.TargetSelector = in.TargetSelector - return nil -} - -// Convert_v1alpha1_ScaleStatus_To_node_ScaleStatus is an autogenerated conversion function. -func Convert_v1alpha1_ScaleStatus_To_node_ScaleStatus(in *ScaleStatus, out *node.ScaleStatus, s conversion.Scope) error { - return autoConvert_v1alpha1_ScaleStatus_To_node_ScaleStatus(in, out, s) -} - -func autoConvert_node_ScaleStatus_To_v1alpha1_ScaleStatus(in *node.ScaleStatus, out *ScaleStatus, s conversion.Scope) error { - out.Replicas = in.Replicas - out.Selector = (*meta_v1.LabelSelector)(unsafe.Pointer(in.Selector)) - out.TargetSelector = in.TargetSelector - return nil -} - -// Convert_node_ScaleStatus_To_v1alpha1_ScaleStatus is an autogenerated conversion function. -func Convert_node_ScaleStatus_To_v1alpha1_ScaleStatus(in *node.ScaleStatus, out *ScaleStatus, s conversion.Scope) error { - return autoConvert_node_ScaleStatus_To_v1alpha1_ScaleStatus(in, out, s) -} diff --git a/pkg/client/clientset/clientset.go b/pkg/client/clientset/clientset.go index cd56a3f8b..dade0529f 100644 --- a/pkg/client/clientset/clientset.go +++ b/pkg/client/clientset/clientset.go @@ -1,7 +1,7 @@ package clientset import ( - nodev1alpha1 "github.com/gardener/node-controller-manager/pkg/client/clientset/typed/node/v1alpha1" + machinev1alpha1 "github.com/gardener/node-controller-manager/pkg/client/clientset/typed/machine/v1alpha1" glog "github.com/golang/glog" discovery "k8s.io/client-go/discovery" rest "k8s.io/client-go/rest" @@ -10,27 +10,27 @@ import ( type Interface interface { Discovery() discovery.DiscoveryInterface - NodeV1alpha1() nodev1alpha1.NodeV1alpha1Interface + MachineV1alpha1() machinev1alpha1.MachineV1alpha1Interface // Deprecated: please explicitly pick a version if possible. - Node() nodev1alpha1.NodeV1alpha1Interface + Machine() machinev1alpha1.MachineV1alpha1Interface } // Clientset contains the clients for groups. Each group has exactly one // version included in a Clientset. type Clientset struct { *discovery.DiscoveryClient - nodeV1alpha1 *nodev1alpha1.NodeV1alpha1Client + machineV1alpha1 *machinev1alpha1.MachineV1alpha1Client } -// NodeV1alpha1 retrieves the NodeV1alpha1Client -func (c *Clientset) NodeV1alpha1() nodev1alpha1.NodeV1alpha1Interface { - return c.nodeV1alpha1 +// MachineV1alpha1 retrieves the MachineV1alpha1Client +func (c *Clientset) MachineV1alpha1() machinev1alpha1.MachineV1alpha1Interface { + return c.machineV1alpha1 } -// Deprecated: Node retrieves the default version of NodeClient. +// Deprecated: Machine retrieves the default version of MachineClient. // Please explicitly pick a version. -func (c *Clientset) Node() nodev1alpha1.NodeV1alpha1Interface { - return c.nodeV1alpha1 +func (c *Clientset) Machine() machinev1alpha1.MachineV1alpha1Interface { + return c.machineV1alpha1 } // Discovery retrieves the DiscoveryClient @@ -49,7 +49,7 @@ func NewForConfig(c *rest.Config) (*Clientset, error) { } var cs Clientset var err error - cs.nodeV1alpha1, err = nodev1alpha1.NewForConfig(&configShallowCopy) + cs.machineV1alpha1, err = machinev1alpha1.NewForConfig(&configShallowCopy) if err != nil { return nil, err } @@ -66,7 +66,7 @@ func NewForConfig(c *rest.Config) (*Clientset, error) { // panics if there is an error in the config. func NewForConfigOrDie(c *rest.Config) *Clientset { var cs Clientset - cs.nodeV1alpha1 = nodev1alpha1.NewForConfigOrDie(c) + cs.machineV1alpha1 = machinev1alpha1.NewForConfigOrDie(c) cs.DiscoveryClient = discovery.NewDiscoveryClientForConfigOrDie(c) return &cs @@ -75,7 +75,7 @@ func NewForConfigOrDie(c *rest.Config) *Clientset { // New creates a new Clientset for the given RESTClient. func New(c rest.Interface) *Clientset { var cs Clientset - cs.nodeV1alpha1 = nodev1alpha1.New(c) + cs.machineV1alpha1 = machinev1alpha1.New(c) cs.DiscoveryClient = discovery.NewDiscoveryClient(c) return &cs diff --git a/pkg/client/clientset/fake/clientset_generated.go b/pkg/client/clientset/fake/clientset_generated.go index ab2ba826c..0a3eec0ff 100644 --- a/pkg/client/clientset/fake/clientset_generated.go +++ b/pkg/client/clientset/fake/clientset_generated.go @@ -2,8 +2,8 @@ package fake import ( clientset "github.com/gardener/node-controller-manager/pkg/client/clientset" - nodev1alpha1 "github.com/gardener/node-controller-manager/pkg/client/clientset/typed/node/v1alpha1" - fakenodev1alpha1 "github.com/gardener/node-controller-manager/pkg/client/clientset/typed/node/v1alpha1/fake" + machinev1alpha1 "github.com/gardener/node-controller-manager/pkg/client/clientset/typed/machine/v1alpha1" + fakemachinev1alpha1 "github.com/gardener/node-controller-manager/pkg/client/clientset/typed/machine/v1alpha1/fake" "k8s.io/apimachinery/pkg/runtime" "k8s.io/apimachinery/pkg/watch" "k8s.io/client-go/discovery" @@ -44,12 +44,12 @@ func (c *Clientset) Discovery() discovery.DiscoveryInterface { var _ clientset.Interface = &Clientset{} -// NodeV1alpha1 retrieves the NodeV1alpha1Client -func (c *Clientset) NodeV1alpha1() nodev1alpha1.NodeV1alpha1Interface { - return &fakenodev1alpha1.FakeNodeV1alpha1{Fake: &c.Fake} +// MachineV1alpha1 retrieves the MachineV1alpha1Client +func (c *Clientset) MachineV1alpha1() machinev1alpha1.MachineV1alpha1Interface { + return &fakemachinev1alpha1.FakeMachineV1alpha1{Fake: &c.Fake} } -// Node retrieves the NodeV1alpha1Client -func (c *Clientset) Node() nodev1alpha1.NodeV1alpha1Interface { - return &fakenodev1alpha1.FakeNodeV1alpha1{Fake: &c.Fake} +// Machine retrieves the MachineV1alpha1Client +func (c *Clientset) Machine() machinev1alpha1.MachineV1alpha1Interface { + return &fakemachinev1alpha1.FakeMachineV1alpha1{Fake: &c.Fake} } diff --git a/pkg/client/clientset/fake/register.go b/pkg/client/clientset/fake/register.go index 5d139e1c2..454906b4b 100644 --- a/pkg/client/clientset/fake/register.go +++ b/pkg/client/clientset/fake/register.go @@ -1,7 +1,7 @@ package fake import ( - nodev1alpha1 "github.com/gardener/node-controller-manager/pkg/apis/node/v1alpha1" + machinev1alpha1 "github.com/gardener/node-controller-manager/pkg/apis/machine/v1alpha1" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" runtime "k8s.io/apimachinery/pkg/runtime" schema "k8s.io/apimachinery/pkg/runtime/schema" @@ -32,6 +32,6 @@ func init() { // After this, RawExtensions in Kubernetes types will serialize kube-aggregator types // correctly. func AddToScheme(scheme *runtime.Scheme) { - nodev1alpha1.AddToScheme(scheme) + machinev1alpha1.AddToScheme(scheme) } diff --git a/pkg/client/clientset/scheme/register.go b/pkg/client/clientset/scheme/register.go index fc987f436..56467758e 100644 --- a/pkg/client/clientset/scheme/register.go +++ b/pkg/client/clientset/scheme/register.go @@ -1,7 +1,7 @@ package scheme import ( - nodev1alpha1 "github.com/gardener/node-controller-manager/pkg/apis/node/v1alpha1" + machinev1alpha1 "github.com/gardener/node-controller-manager/pkg/apis/machine/v1alpha1" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" runtime "k8s.io/apimachinery/pkg/runtime" schema "k8s.io/apimachinery/pkg/runtime/schema" @@ -32,6 +32,6 @@ func init() { // After this, RawExtensions in Kubernetes types will serialize kube-aggregator types // correctly. func AddToScheme(scheme *runtime.Scheme) { - nodev1alpha1.AddToScheme(scheme) + machinev1alpha1.AddToScheme(scheme) } diff --git a/pkg/client/clientset/typed/machine/v1alpha1/awsmachineclass.go b/pkg/client/clientset/typed/machine/v1alpha1/awsmachineclass.go new file mode 100644 index 000000000..b4b464a3a --- /dev/null +++ b/pkg/client/clientset/typed/machine/v1alpha1/awsmachineclass.go @@ -0,0 +1,129 @@ +package v1alpha1 + +import ( + v1alpha1 "github.com/gardener/node-controller-manager/pkg/apis/machine/v1alpha1" + scheme "github.com/gardener/node-controller-manager/pkg/client/clientset/scheme" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + types "k8s.io/apimachinery/pkg/types" + watch "k8s.io/apimachinery/pkg/watch" + rest "k8s.io/client-go/rest" +) + +// AWSMachineClassesGetter has a method to return a AWSMachineClassInterface. +// A group's client should implement this interface. +type AWSMachineClassesGetter interface { + AWSMachineClasses() AWSMachineClassInterface +} + +// AWSMachineClassInterface has methods to work with AWSMachineClass resources. +type AWSMachineClassInterface interface { + Create(*v1alpha1.AWSMachineClass) (*v1alpha1.AWSMachineClass, error) + Update(*v1alpha1.AWSMachineClass) (*v1alpha1.AWSMachineClass, error) + Delete(name string, options *v1.DeleteOptions) error + DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error + Get(name string, options v1.GetOptions) (*v1alpha1.AWSMachineClass, error) + List(opts v1.ListOptions) (*v1alpha1.AWSMachineClassList, error) + Watch(opts v1.ListOptions) (watch.Interface, error) + Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1alpha1.AWSMachineClass, err error) + AWSMachineClassExpansion +} + +// aWSMachineClasses implements AWSMachineClassInterface +type aWSMachineClasses struct { + client rest.Interface +} + +// newAWSMachineClasses returns a AWSMachineClasses +func newAWSMachineClasses(c *MachineV1alpha1Client) *aWSMachineClasses { + return &aWSMachineClasses{ + client: c.RESTClient(), + } +} + +// Get takes name of the aWSMachineClass, and returns the corresponding aWSMachineClass object, and an error if there is any. +func (c *aWSMachineClasses) Get(name string, options v1.GetOptions) (result *v1alpha1.AWSMachineClass, err error) { + result = &v1alpha1.AWSMachineClass{} + err = c.client.Get(). + Resource("awsmachineclasses"). + Name(name). + VersionedParams(&options, scheme.ParameterCodec). + Do(). + Into(result) + return +} + +// List takes label and field selectors, and returns the list of AWSMachineClasses that match those selectors. +func (c *aWSMachineClasses) List(opts v1.ListOptions) (result *v1alpha1.AWSMachineClassList, err error) { + result = &v1alpha1.AWSMachineClassList{} + err = c.client.Get(). + Resource("awsmachineclasses"). + VersionedParams(&opts, scheme.ParameterCodec). + Do(). + Into(result) + return +} + +// Watch returns a watch.Interface that watches the requested aWSMachineClasses. +func (c *aWSMachineClasses) Watch(opts v1.ListOptions) (watch.Interface, error) { + opts.Watch = true + return c.client.Get(). + Resource("awsmachineclasses"). + VersionedParams(&opts, scheme.ParameterCodec). + Watch() +} + +// Create takes the representation of a aWSMachineClass and creates it. Returns the server's representation of the aWSMachineClass, and an error, if there is any. +func (c *aWSMachineClasses) Create(aWSMachineClass *v1alpha1.AWSMachineClass) (result *v1alpha1.AWSMachineClass, err error) { + result = &v1alpha1.AWSMachineClass{} + err = c.client.Post(). + Resource("awsmachineclasses"). + Body(aWSMachineClass). + Do(). + Into(result) + return +} + +// Update takes the representation of a aWSMachineClass and updates it. Returns the server's representation of the aWSMachineClass, and an error, if there is any. +func (c *aWSMachineClasses) Update(aWSMachineClass *v1alpha1.AWSMachineClass) (result *v1alpha1.AWSMachineClass, err error) { + result = &v1alpha1.AWSMachineClass{} + err = c.client.Put(). + Resource("awsmachineclasses"). + Name(aWSMachineClass.Name). + Body(aWSMachineClass). + Do(). + Into(result) + return +} + +// Delete takes name of the aWSMachineClass and deletes it. Returns an error if one occurs. +func (c *aWSMachineClasses) Delete(name string, options *v1.DeleteOptions) error { + return c.client.Delete(). + Resource("awsmachineclasses"). + Name(name). + Body(options). + Do(). + Error() +} + +// DeleteCollection deletes a collection of objects. +func (c *aWSMachineClasses) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error { + return c.client.Delete(). + Resource("awsmachineclasses"). + VersionedParams(&listOptions, scheme.ParameterCodec). + Body(options). + Do(). + Error() +} + +// Patch applies the patch and returns the patched aWSMachineClass. +func (c *aWSMachineClasses) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1alpha1.AWSMachineClass, err error) { + result = &v1alpha1.AWSMachineClass{} + err = c.client.Patch(pt). + Resource("awsmachineclasses"). + SubResource(subresources...). + Name(name). + Body(data). + Do(). + Into(result) + return +} diff --git a/pkg/client/clientset/typed/node/v1alpha1/doc.go b/pkg/client/clientset/typed/machine/v1alpha1/doc.go similarity index 100% rename from pkg/client/clientset/typed/node/v1alpha1/doc.go rename to pkg/client/clientset/typed/machine/v1alpha1/doc.go diff --git a/pkg/client/clientset/typed/node/v1alpha1/fake/doc.go b/pkg/client/clientset/typed/machine/v1alpha1/fake/doc.go similarity index 100% rename from pkg/client/clientset/typed/node/v1alpha1/fake/doc.go rename to pkg/client/clientset/typed/machine/v1alpha1/fake/doc.go diff --git a/pkg/client/clientset/typed/machine/v1alpha1/fake/fake_awsmachineclass.go b/pkg/client/clientset/typed/machine/v1alpha1/fake/fake_awsmachineclass.go new file mode 100644 index 000000000..a3fdccb11 --- /dev/null +++ b/pkg/client/clientset/typed/machine/v1alpha1/fake/fake_awsmachineclass.go @@ -0,0 +1,102 @@ +package fake + +import ( + v1alpha1 "github.com/gardener/node-controller-manager/pkg/apis/machine/v1alpha1" + 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" +) + +// FakeAWSMachineClasses implements AWSMachineClassInterface +type FakeAWSMachineClasses struct { + Fake *FakeMachineV1alpha1 +} + +var awsmachineclassesResource = schema.GroupVersionResource{Group: "machine.sapcloud.io", Version: "v1alpha1", Resource: "awsmachineclasses"} + +var awsmachineclassesKind = schema.GroupVersionKind{Group: "machine.sapcloud.io", Version: "v1alpha1", Kind: "AWSMachineClass"} + +// Get takes name of the aWSMachineClass, and returns the corresponding aWSMachineClass object, and an error if there is any. +func (c *FakeAWSMachineClasses) Get(name string, options v1.GetOptions) (result *v1alpha1.AWSMachineClass, err error) { + obj, err := c.Fake. + Invokes(testing.NewRootGetAction(awsmachineclassesResource, name), &v1alpha1.AWSMachineClass{}) + if obj == nil { + return nil, err + } + return obj.(*v1alpha1.AWSMachineClass), err +} + +// List takes label and field selectors, and returns the list of AWSMachineClasses that match those selectors. +func (c *FakeAWSMachineClasses) List(opts v1.ListOptions) (result *v1alpha1.AWSMachineClassList, err error) { + obj, err := c.Fake. + Invokes(testing.NewRootListAction(awsmachineclassesResource, awsmachineclassesKind, opts), &v1alpha1.AWSMachineClassList{}) + if obj == nil { + return nil, err + } + + label, _, _ := testing.ExtractFromListOptions(opts) + if label == nil { + label = labels.Everything() + } + list := &v1alpha1.AWSMachineClassList{} + for _, item := range obj.(*v1alpha1.AWSMachineClassList).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 aWSMachineClasses. +func (c *FakeAWSMachineClasses) Watch(opts v1.ListOptions) (watch.Interface, error) { + return c.Fake. + InvokesWatch(testing.NewRootWatchAction(awsmachineclassesResource, opts)) +} + +// Create takes the representation of a aWSMachineClass and creates it. Returns the server's representation of the aWSMachineClass, and an error, if there is any. +func (c *FakeAWSMachineClasses) Create(aWSMachineClass *v1alpha1.AWSMachineClass) (result *v1alpha1.AWSMachineClass, err error) { + obj, err := c.Fake. + Invokes(testing.NewRootCreateAction(awsmachineclassesResource, aWSMachineClass), &v1alpha1.AWSMachineClass{}) + if obj == nil { + return nil, err + } + return obj.(*v1alpha1.AWSMachineClass), err +} + +// Update takes the representation of a aWSMachineClass and updates it. Returns the server's representation of the aWSMachineClass, and an error, if there is any. +func (c *FakeAWSMachineClasses) Update(aWSMachineClass *v1alpha1.AWSMachineClass) (result *v1alpha1.AWSMachineClass, err error) { + obj, err := c.Fake. + Invokes(testing.NewRootUpdateAction(awsmachineclassesResource, aWSMachineClass), &v1alpha1.AWSMachineClass{}) + if obj == nil { + return nil, err + } + return obj.(*v1alpha1.AWSMachineClass), err +} + +// Delete takes name of the aWSMachineClass and deletes it. Returns an error if one occurs. +func (c *FakeAWSMachineClasses) Delete(name string, options *v1.DeleteOptions) error { + _, err := c.Fake. + Invokes(testing.NewRootDeleteAction(awsmachineclassesResource, name), &v1alpha1.AWSMachineClass{}) + return err +} + +// DeleteCollection deletes a collection of objects. +func (c *FakeAWSMachineClasses) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error { + action := testing.NewRootDeleteCollectionAction(awsmachineclassesResource, listOptions) + + _, err := c.Fake.Invokes(action, &v1alpha1.AWSMachineClassList{}) + return err +} + +// Patch applies the patch and returns the patched aWSMachineClass. +func (c *FakeAWSMachineClasses) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1alpha1.AWSMachineClass, err error) { + obj, err := c.Fake. + Invokes(testing.NewRootPatchSubresourceAction(awsmachineclassesResource, name, data, subresources...), &v1alpha1.AWSMachineClass{}) + if obj == nil { + return nil, err + } + return obj.(*v1alpha1.AWSMachineClass), err +} diff --git a/pkg/client/clientset/typed/machine/v1alpha1/fake/fake_machine.go b/pkg/client/clientset/typed/machine/v1alpha1/fake/fake_machine.go new file mode 100644 index 000000000..018c2a875 --- /dev/null +++ b/pkg/client/clientset/typed/machine/v1alpha1/fake/fake_machine.go @@ -0,0 +1,102 @@ +package fake + +import ( + v1alpha1 "github.com/gardener/node-controller-manager/pkg/apis/machine/v1alpha1" + 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" +) + +// FakeMachines implements MachineInterface +type FakeMachines struct { + Fake *FakeMachineV1alpha1 +} + +var machinesResource = schema.GroupVersionResource{Group: "machine.sapcloud.io", Version: "v1alpha1", Resource: "machines"} + +var machinesKind = schema.GroupVersionKind{Group: "machine.sapcloud.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.NewRootGetAction(machinesResource, 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.NewRootListAction(machinesResource, machinesKind, opts), &v1alpha1.MachineList{}) + if obj == nil { + return nil, err + } + + label, _, _ := testing.ExtractFromListOptions(opts) + if label == nil { + label = labels.Everything() + } + list := &v1alpha1.MachineList{} + 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.NewRootWatchAction(machinesResource, 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.NewRootCreateAction(machinesResource, 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.NewRootUpdateAction(machinesResource, 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.NewRootDeleteAction(machinesResource, name), &v1alpha1.Machine{}) + return err +} + +// DeleteCollection deletes a collection of objects. +func (c *FakeMachines) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error { + action := testing.NewRootDeleteCollectionAction(machinesResource, 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.NewRootPatchSubresourceAction(machinesResource, name, data, subresources...), &v1alpha1.Machine{}) + if obj == nil { + return nil, err + } + return obj.(*v1alpha1.Machine), err +} diff --git a/pkg/client/clientset/typed/machine/v1alpha1/fake/fake_machine_client.go b/pkg/client/clientset/typed/machine/v1alpha1/fake/fake_machine_client.go new file mode 100644 index 000000000..fb9a3832f --- /dev/null +++ b/pkg/client/clientset/typed/machine/v1alpha1/fake/fake_machine_client.go @@ -0,0 +1,42 @@ +package fake + +import ( + v1alpha1 "github.com/gardener/node-controller-manager/pkg/client/clientset/typed/machine/v1alpha1" + rest "k8s.io/client-go/rest" + testing "k8s.io/client-go/testing" +) + +type FakeMachineV1alpha1 struct { + *testing.Fake +} + +func (c *FakeMachineV1alpha1) AWSMachineClasses() v1alpha1.AWSMachineClassInterface { + return &FakeAWSMachineClasses{c} +} + +func (c *FakeMachineV1alpha1) Machines() v1alpha1.MachineInterface { + return &FakeMachines{c} +} + +func (c *FakeMachineV1alpha1) MachineDeployments() v1alpha1.MachineDeploymentInterface { + return &FakeMachineDeployments{c} +} + +func (c *FakeMachineV1alpha1) MachineSets() v1alpha1.MachineSetInterface { + return &FakeMachineSets{c} +} + +func (c *FakeMachineV1alpha1) MachineTemplates(namespace string) v1alpha1.MachineTemplateInterface { + return &FakeMachineTemplates{c, namespace} +} + +func (c *FakeMachineV1alpha1) Scales(namespace string) v1alpha1.ScaleInterface { + return &FakeScales{c, namespace} +} + +// RESTClient returns a RESTClient that is used to communicate +// with API server by this client implementation. +func (c *FakeMachineV1alpha1) RESTClient() rest.Interface { + var ret *rest.RESTClient + return ret +} diff --git a/pkg/client/clientset/typed/machine/v1alpha1/fake/fake_machinedeployment.go b/pkg/client/clientset/typed/machine/v1alpha1/fake/fake_machinedeployment.go new file mode 100644 index 000000000..5f7e0e873 --- /dev/null +++ b/pkg/client/clientset/typed/machine/v1alpha1/fake/fake_machinedeployment.go @@ -0,0 +1,133 @@ +package fake + +import ( + v1alpha1 "github.com/gardener/node-controller-manager/pkg/apis/machine/v1alpha1" + 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" +) + +// FakeMachineDeployments implements MachineDeploymentInterface +type FakeMachineDeployments struct { + Fake *FakeMachineV1alpha1 +} + +var machinedeploymentsResource = schema.GroupVersionResource{Group: "machine.sapcloud.io", Version: "v1alpha1", Resource: "machinedeployments"} + +var machinedeploymentsKind = schema.GroupVersionKind{Group: "machine.sapcloud.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.NewRootGetAction(machinedeploymentsResource, 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.NewRootListAction(machinedeploymentsResource, machinedeploymentsKind, opts), &v1alpha1.MachineDeploymentList{}) + if obj == nil { + return nil, err + } + + label, _, _ := testing.ExtractFromListOptions(opts) + if label == nil { + label = labels.Everything() + } + list := &v1alpha1.MachineDeploymentList{} + 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.NewRootWatchAction(machinedeploymentsResource, 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.NewRootCreateAction(machinedeploymentsResource, 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.NewRootUpdateAction(machinedeploymentsResource, 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.NewRootUpdateSubresourceAction(machinedeploymentsResource, "status", 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.NewRootDeleteAction(machinedeploymentsResource, name), &v1alpha1.MachineDeployment{}) + return err +} + +// DeleteCollection deletes a collection of objects. +func (c *FakeMachineDeployments) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error { + action := testing.NewRootDeleteCollectionAction(machinedeploymentsResource, 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.NewRootPatchSubresourceAction(machinedeploymentsResource, name, data, subresources...), &v1alpha1.MachineDeployment{}) + if obj == nil { + return nil, err + } + return obj.(*v1alpha1.MachineDeployment), err +} + +// GetScale takes name of the machineDeployment, and returns the corresponding scale object, and an error if there is any. +func (c *FakeMachineDeployments) GetScale(machineDeploymentName string, options v1.GetOptions) (result *v1alpha1.Scale, err error) { + obj, err := c.Fake. + Invokes(testing.NewRootGetAction(machinedeploymentsResource, machineDeploymentName), &v1alpha1.Scale{}) + if obj == nil { + return nil, err + } + return obj.(*v1alpha1.Scale), err +} + +// UpdateScale takes the representation of a scale and updates it. Returns the server's representation of the scale, and an error, if there is any. +func (c *FakeMachineDeployments) UpdateScale(machineDeploymentName string, scale *v1alpha1.Scale) (result *v1alpha1.Scale, err error) { + obj, err := c.Fake. + Invokes(testing.NewRootUpdateAction(machinedeploymentsResource, machineDeployment), &v1alpha1.MachineDeployment{}) + if obj == nil { + return nil, err + } + return obj.(*v1alpha1.Scale), err +} diff --git a/pkg/client/clientset/typed/machine/v1alpha1/fake/fake_machineset.go b/pkg/client/clientset/typed/machine/v1alpha1/fake/fake_machineset.go new file mode 100644 index 000000000..b6ab3288e --- /dev/null +++ b/pkg/client/clientset/typed/machine/v1alpha1/fake/fake_machineset.go @@ -0,0 +1,113 @@ +package fake + +import ( + v1alpha1 "github.com/gardener/node-controller-manager/pkg/apis/machine/v1alpha1" + 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" +) + +// FakeMachineSets implements MachineSetInterface +type FakeMachineSets struct { + Fake *FakeMachineV1alpha1 +} + +var machinesetsResource = schema.GroupVersionResource{Group: "machine.sapcloud.io", Version: "v1alpha1", Resource: "machinesets"} + +var machinesetsKind = schema.GroupVersionKind{Group: "machine.sapcloud.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.NewRootGetAction(machinesetsResource, 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.NewRootListAction(machinesetsResource, machinesetsKind, opts), &v1alpha1.MachineSetList{}) + if obj == nil { + return nil, err + } + + label, _, _ := testing.ExtractFromListOptions(opts) + if label == nil { + label = labels.Everything() + } + list := &v1alpha1.MachineSetList{} + 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.NewRootWatchAction(machinesetsResource, 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.NewRootCreateAction(machinesetsResource, 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.NewRootUpdateAction(machinesetsResource, 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.NewRootUpdateSubresourceAction(machinesetsResource, "status", 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.NewRootDeleteAction(machinesetsResource, name), &v1alpha1.MachineSet{}) + return err +} + +// DeleteCollection deletes a collection of objects. +func (c *FakeMachineSets) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error { + action := testing.NewRootDeleteCollectionAction(machinesetsResource, 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.NewRootPatchSubresourceAction(machinesetsResource, name, data, subresources...), &v1alpha1.MachineSet{}) + if obj == nil { + return nil, err + } + return obj.(*v1alpha1.MachineSet), err +} diff --git a/pkg/client/clientset/typed/machine/v1alpha1/fake/fake_machinetemplate.go b/pkg/client/clientset/typed/machine/v1alpha1/fake/fake_machinetemplate.go new file mode 100644 index 000000000..9fe726b3c --- /dev/null +++ b/pkg/client/clientset/typed/machine/v1alpha1/fake/fake_machinetemplate.go @@ -0,0 +1,110 @@ +package fake + +import ( + v1alpha1 "github.com/gardener/node-controller-manager/pkg/apis/machine/v1alpha1" + 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" +) + +// FakeMachineTemplates implements MachineTemplateInterface +type FakeMachineTemplates struct { + Fake *FakeMachineV1alpha1 + ns string +} + +var machinetemplatesResource = schema.GroupVersionResource{Group: "machine.sapcloud.io", Version: "v1alpha1", Resource: "machinetemplates"} + +var machinetemplatesKind = schema.GroupVersionKind{Group: "machine.sapcloud.io", Version: "v1alpha1", Kind: "MachineTemplate"} + +// Get takes name of the machineTemplate, and returns the corresponding machineTemplate object, and an error if there is any. +func (c *FakeMachineTemplates) Get(name string, options v1.GetOptions) (result *v1alpha1.MachineTemplate, err error) { + obj, err := c.Fake. + Invokes(testing.NewGetAction(machinetemplatesResource, c.ns, name), &v1alpha1.MachineTemplate{}) + + if obj == nil { + return nil, err + } + return obj.(*v1alpha1.MachineTemplate), err +} + +// List takes label and field selectors, and returns the list of MachineTemplates that match those selectors. +func (c *FakeMachineTemplates) List(opts v1.ListOptions) (result *v1alpha1.MachineTemplateList, err error) { + obj, err := c.Fake. + Invokes(testing.NewListAction(machinetemplatesResource, machinetemplatesKind, c.ns, opts), &v1alpha1.MachineTemplateList{}) + + if obj == nil { + return nil, err + } + + label, _, _ := testing.ExtractFromListOptions(opts) + if label == nil { + label = labels.Everything() + } + list := &v1alpha1.MachineTemplateList{} + for _, item := range obj.(*v1alpha1.MachineTemplateList).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 machineTemplates. +func (c *FakeMachineTemplates) Watch(opts v1.ListOptions) (watch.Interface, error) { + return c.Fake. + InvokesWatch(testing.NewWatchAction(machinetemplatesResource, c.ns, opts)) + +} + +// Create takes the representation of a machineTemplate and creates it. Returns the server's representation of the machineTemplate, and an error, if there is any. +func (c *FakeMachineTemplates) Create(machineTemplate *v1alpha1.MachineTemplate) (result *v1alpha1.MachineTemplate, err error) { + obj, err := c.Fake. + Invokes(testing.NewCreateAction(machinetemplatesResource, c.ns, machineTemplate), &v1alpha1.MachineTemplate{}) + + if obj == nil { + return nil, err + } + return obj.(*v1alpha1.MachineTemplate), err +} + +// Update takes the representation of a machineTemplate and updates it. Returns the server's representation of the machineTemplate, and an error, if there is any. +func (c *FakeMachineTemplates) Update(machineTemplate *v1alpha1.MachineTemplate) (result *v1alpha1.MachineTemplate, err error) { + obj, err := c.Fake. + Invokes(testing.NewUpdateAction(machinetemplatesResource, c.ns, machineTemplate), &v1alpha1.MachineTemplate{}) + + if obj == nil { + return nil, err + } + return obj.(*v1alpha1.MachineTemplate), err +} + +// Delete takes name of the machineTemplate and deletes it. Returns an error if one occurs. +func (c *FakeMachineTemplates) Delete(name string, options *v1.DeleteOptions) error { + _, err := c.Fake. + Invokes(testing.NewDeleteAction(machinetemplatesResource, c.ns, name), &v1alpha1.MachineTemplate{}) + + return err +} + +// DeleteCollection deletes a collection of objects. +func (c *FakeMachineTemplates) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error { + action := testing.NewDeleteCollectionAction(machinetemplatesResource, c.ns, listOptions) + + _, err := c.Fake.Invokes(action, &v1alpha1.MachineTemplateList{}) + return err +} + +// Patch applies the patch and returns the patched machineTemplate. +func (c *FakeMachineTemplates) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1alpha1.MachineTemplate, err error) { + obj, err := c.Fake. + Invokes(testing.NewPatchSubresourceAction(machinetemplatesResource, c.ns, name, data, subresources...), &v1alpha1.MachineTemplate{}) + + if obj == nil { + return nil, err + } + return obj.(*v1alpha1.MachineTemplate), err +} diff --git a/pkg/client/clientset/typed/node/v1alpha1/fake/fake_scale.go b/pkg/client/clientset/typed/machine/v1alpha1/fake/fake_scale.go similarity index 77% rename from pkg/client/clientset/typed/node/v1alpha1/fake/fake_scale.go rename to pkg/client/clientset/typed/machine/v1alpha1/fake/fake_scale.go index b6a7e18ab..40b5c4a35 100644 --- a/pkg/client/clientset/typed/node/v1alpha1/fake/fake_scale.go +++ b/pkg/client/clientset/typed/machine/v1alpha1/fake/fake_scale.go @@ -2,6 +2,6 @@ package fake // FakeScales implements ScaleInterface type FakeScales struct { - Fake *FakeNodeV1alpha1 + Fake *FakeMachineV1alpha1 ns string } diff --git a/pkg/client/clientset/typed/machine/v1alpha1/generated_expansion.go b/pkg/client/clientset/typed/machine/v1alpha1/generated_expansion.go new file mode 100644 index 000000000..05c716f08 --- /dev/null +++ b/pkg/client/clientset/typed/machine/v1alpha1/generated_expansion.go @@ -0,0 +1,13 @@ +package v1alpha1 + +type AWSMachineClassExpansion interface{} + +type MachineExpansion interface{} + +type MachineDeploymentExpansion interface{} + +type MachineSetExpansion interface{} + +type MachineTemplateExpansion interface{} + +type ScaleExpansion interface{} diff --git a/pkg/client/clientset/typed/machine/v1alpha1/machine.go b/pkg/client/clientset/typed/machine/v1alpha1/machine.go new file mode 100644 index 000000000..d208d3fe6 --- /dev/null +++ b/pkg/client/clientset/typed/machine/v1alpha1/machine.go @@ -0,0 +1,129 @@ +package v1alpha1 + +import ( + v1alpha1 "github.com/gardener/node-controller-manager/pkg/apis/machine/v1alpha1" + scheme "github.com/gardener/node-controller-manager/pkg/client/clientset/scheme" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + types "k8s.io/apimachinery/pkg/types" + watch "k8s.io/apimachinery/pkg/watch" + rest "k8s.io/client-go/rest" +) + +// MachinesGetter has a method to return a MachineInterface. +// A group's client should implement this interface. +type MachinesGetter interface { + Machines() MachineInterface +} + +// MachineInterface has methods to work with Machine resources. +type MachineInterface interface { + Create(*v1alpha1.Machine) (*v1alpha1.Machine, error) + Update(*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 +} + +// newMachines returns a Machines +func newMachines(c *MachineV1alpha1Client) *machines { + return &machines{ + client: c.RESTClient(), + } +} + +// 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(). + 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(). + 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(). + 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(). + 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(). + Resource("machines"). + Name(machine.Name). + 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(). + 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(). + 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). + Resource("machines"). + SubResource(subresources...). + Name(name). + Body(data). + Do(). + Into(result) + return +} diff --git a/pkg/client/clientset/typed/machine/v1alpha1/machine_client.go b/pkg/client/clientset/typed/machine/v1alpha1/machine_client.go new file mode 100644 index 000000000..62b41287a --- /dev/null +++ b/pkg/client/clientset/typed/machine/v1alpha1/machine_client.go @@ -0,0 +1,97 @@ +package v1alpha1 + +import ( + v1alpha1 "github.com/gardener/node-controller-manager/pkg/apis/machine/v1alpha1" + "github.com/gardener/node-controller-manager/pkg/client/clientset/scheme" + serializer "k8s.io/apimachinery/pkg/runtime/serializer" + rest "k8s.io/client-go/rest" +) + +type MachineV1alpha1Interface interface { + RESTClient() rest.Interface + AWSMachineClassesGetter + MachinesGetter + MachineDeploymentsGetter + MachineSetsGetter + MachineTemplatesGetter + ScalesGetter +} + +// MachineV1alpha1Client is used to interact with features provided by the machine.sapcloud.io group. +type MachineV1alpha1Client struct { + restClient rest.Interface +} + +func (c *MachineV1alpha1Client) AWSMachineClasses() AWSMachineClassInterface { + return newAWSMachineClasses(c) +} + +func (c *MachineV1alpha1Client) Machines() MachineInterface { + return newMachines(c) +} + +func (c *MachineV1alpha1Client) MachineDeployments() MachineDeploymentInterface { + return newMachineDeployments(c) +} + +func (c *MachineV1alpha1Client) MachineSets() MachineSetInterface { + return newMachineSets(c) +} + +func (c *MachineV1alpha1Client) MachineTemplates(namespace string) MachineTemplateInterface { + return newMachineTemplates(c, namespace) +} + +func (c *MachineV1alpha1Client) Scales(namespace string) ScaleInterface { + return newScales(c, namespace) +} + +// NewForConfig creates a new MachineV1alpha1Client for the given config. +func NewForConfig(c *rest.Config) (*MachineV1alpha1Client, error) { + config := *c + if err := setConfigDefaults(&config); err != nil { + return nil, err + } + client, err := rest.RESTClientFor(&config) + if err != nil { + return nil, err + } + return &MachineV1alpha1Client{client}, nil +} + +// NewForConfigOrDie creates a new MachineV1alpha1Client for the given config and +// panics if there is an error in the config. +func NewForConfigOrDie(c *rest.Config) *MachineV1alpha1Client { + client, err := NewForConfig(c) + if err != nil { + panic(err) + } + return client +} + +// New creates a new MachineV1alpha1Client for the given RESTClient. +func New(c rest.Interface) *MachineV1alpha1Client { + return &MachineV1alpha1Client{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 *MachineV1alpha1Client) RESTClient() rest.Interface { + if c == nil { + return nil + } + return c.restClient +} diff --git a/pkg/client/clientset/typed/machine/v1alpha1/machinedeployment.go b/pkg/client/clientset/typed/machine/v1alpha1/machinedeployment.go new file mode 100644 index 000000000..6ee2c1bda --- /dev/null +++ b/pkg/client/clientset/typed/machine/v1alpha1/machinedeployment.go @@ -0,0 +1,174 @@ +package v1alpha1 + +import ( + v1alpha1 "github.com/gardener/node-controller-manager/pkg/apis/machine/v1alpha1" + scheme "github.com/gardener/node-controller-manager/pkg/client/clientset/scheme" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + types "k8s.io/apimachinery/pkg/types" + watch "k8s.io/apimachinery/pkg/watch" + rest "k8s.io/client-go/rest" +) + +// MachineDeploymentsGetter has a method to return a MachineDeploymentInterface. +// A group's client should implement this interface. +type MachineDeploymentsGetter interface { + MachineDeployments() 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) + GetScale(machineDeploymentName string, options v1.GetOptions) (*v1alpha1.Scale, error) + UpdateScale(machineDeploymentName string, scale *v1alpha1.Scale) (*v1alpha1.Scale, error) + + MachineDeploymentExpansion +} + +// machineDeployments implements MachineDeploymentInterface +type machineDeployments struct { + client rest.Interface +} + +// newMachineDeployments returns a MachineDeployments +func newMachineDeployments(c *MachineV1alpha1Client) *machineDeployments { + return &machineDeployments{ + client: c.RESTClient(), + } +} + +// 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(). + 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(). + 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(). + 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(). + 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(). + 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(). + 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(). + 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(). + 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). + Resource("machinedeployments"). + SubResource(subresources...). + Name(name). + Body(data). + Do(). + Into(result) + return +} + +// GetScale takes name of the machineDeployment, and returns the corresponding v1alpha1.Scale object, and an error if there is any. +func (c *machineDeployments) GetScale(machineDeploymentName string, options v1.GetOptions) (result *v1alpha1.Scale, err error) { + result = &v1alpha1.Scale{} + err = c.client.Get(). + Resource("machinedeployments"). + Name(machineDeploymentName). + SubResource("scale"). + VersionedParams(&options, scheme.ParameterCodec). + Do(). + Into(result) + return +} + +// UpdateScale takes the top resource name and the representation of a scale and updates it. Returns the server's representation of the scale, and an error, if there is any. +func (c *machineDeployments) UpdateScale(machineDeploymentName string, scale *v1alpha1.Scale) (result *v1alpha1.Scale, err error) { + result = &v1alpha1.Scale{} + err = c.client.Put(). + Resource("machinedeployments"). + Name(machineDeploymentName). + SubResource("scale"). + Body(scale). + Do(). + Into(result) + return +} diff --git a/pkg/client/clientset/typed/machine/v1alpha1/machineset.go b/pkg/client/clientset/typed/machine/v1alpha1/machineset.go new file mode 100644 index 000000000..1816b05bb --- /dev/null +++ b/pkg/client/clientset/typed/machine/v1alpha1/machineset.go @@ -0,0 +1,145 @@ +package v1alpha1 + +import ( + v1alpha1 "github.com/gardener/node-controller-manager/pkg/apis/machine/v1alpha1" + scheme "github.com/gardener/node-controller-manager/pkg/client/clientset/scheme" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + types "k8s.io/apimachinery/pkg/types" + watch "k8s.io/apimachinery/pkg/watch" + rest "k8s.io/client-go/rest" +) + +// MachineSetsGetter has a method to return a MachineSetInterface. +// A group's client should implement this interface. +type MachineSetsGetter interface { + MachineSets() 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 +} + +// newMachineSets returns a MachineSets +func newMachineSets(c *MachineV1alpha1Client) *machineSets { + return &machineSets{ + client: c.RESTClient(), + } +} + +// 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(). + 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(). + 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(). + 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(). + 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(). + 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(). + 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(). + 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(). + 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). + Resource("machinesets"). + SubResource(subresources...). + Name(name). + Body(data). + Do(). + Into(result) + return +} diff --git a/pkg/client/clientset/typed/machine/v1alpha1/machinetemplate.go b/pkg/client/clientset/typed/machine/v1alpha1/machinetemplate.go new file mode 100644 index 000000000..dd225bbd5 --- /dev/null +++ b/pkg/client/clientset/typed/machine/v1alpha1/machinetemplate.go @@ -0,0 +1,139 @@ +package v1alpha1 + +import ( + v1alpha1 "github.com/gardener/node-controller-manager/pkg/apis/machine/v1alpha1" + scheme "github.com/gardener/node-controller-manager/pkg/client/clientset/scheme" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + types "k8s.io/apimachinery/pkg/types" + watch "k8s.io/apimachinery/pkg/watch" + rest "k8s.io/client-go/rest" +) + +// MachineTemplatesGetter has a method to return a MachineTemplateInterface. +// A group's client should implement this interface. +type MachineTemplatesGetter interface { + MachineTemplates(namespace string) MachineTemplateInterface +} + +// MachineTemplateInterface has methods to work with MachineTemplate resources. +type MachineTemplateInterface interface { + Create(*v1alpha1.MachineTemplate) (*v1alpha1.MachineTemplate, error) + Update(*v1alpha1.MachineTemplate) (*v1alpha1.MachineTemplate, error) + Delete(name string, options *v1.DeleteOptions) error + DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error + Get(name string, options v1.GetOptions) (*v1alpha1.MachineTemplate, error) + List(opts v1.ListOptions) (*v1alpha1.MachineTemplateList, error) + Watch(opts v1.ListOptions) (watch.Interface, error) + Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1alpha1.MachineTemplate, err error) + MachineTemplateExpansion +} + +// machineTemplates implements MachineTemplateInterface +type machineTemplates struct { + client rest.Interface + ns string +} + +// newMachineTemplates returns a MachineTemplates +func newMachineTemplates(c *MachineV1alpha1Client, namespace string) *machineTemplates { + return &machineTemplates{ + client: c.RESTClient(), + ns: namespace, + } +} + +// Get takes name of the machineTemplate, and returns the corresponding machineTemplate object, and an error if there is any. +func (c *machineTemplates) Get(name string, options v1.GetOptions) (result *v1alpha1.MachineTemplate, err error) { + result = &v1alpha1.MachineTemplate{} + err = c.client.Get(). + Namespace(c.ns). + Resource("machinetemplates"). + Name(name). + VersionedParams(&options, scheme.ParameterCodec). + Do(). + Into(result) + return +} + +// List takes label and field selectors, and returns the list of MachineTemplates that match those selectors. +func (c *machineTemplates) List(opts v1.ListOptions) (result *v1alpha1.MachineTemplateList, err error) { + result = &v1alpha1.MachineTemplateList{} + err = c.client.Get(). + Namespace(c.ns). + Resource("machinetemplates"). + VersionedParams(&opts, scheme.ParameterCodec). + Do(). + Into(result) + return +} + +// Watch returns a watch.Interface that watches the requested machineTemplates. +func (c *machineTemplates) Watch(opts v1.ListOptions) (watch.Interface, error) { + opts.Watch = true + return c.client.Get(). + Namespace(c.ns). + Resource("machinetemplates"). + VersionedParams(&opts, scheme.ParameterCodec). + Watch() +} + +// Create takes the representation of a machineTemplate and creates it. Returns the server's representation of the machineTemplate, and an error, if there is any. +func (c *machineTemplates) Create(machineTemplate *v1alpha1.MachineTemplate) (result *v1alpha1.MachineTemplate, err error) { + result = &v1alpha1.MachineTemplate{} + err = c.client.Post(). + Namespace(c.ns). + Resource("machinetemplates"). + Body(machineTemplate). + Do(). + Into(result) + return +} + +// Update takes the representation of a machineTemplate and updates it. Returns the server's representation of the machineTemplate, and an error, if there is any. +func (c *machineTemplates) Update(machineTemplate *v1alpha1.MachineTemplate) (result *v1alpha1.MachineTemplate, err error) { + result = &v1alpha1.MachineTemplate{} + err = c.client.Put(). + Namespace(c.ns). + Resource("machinetemplates"). + Name(machineTemplate.Name). + Body(machineTemplate). + Do(). + Into(result) + return +} + +// Delete takes name of the machineTemplate and deletes it. Returns an error if one occurs. +func (c *machineTemplates) Delete(name string, options *v1.DeleteOptions) error { + return c.client.Delete(). + Namespace(c.ns). + Resource("machinetemplates"). + Name(name). + Body(options). + Do(). + Error() +} + +// DeleteCollection deletes a collection of objects. +func (c *machineTemplates) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error { + return c.client.Delete(). + Namespace(c.ns). + Resource("machinetemplates"). + VersionedParams(&listOptions, scheme.ParameterCodec). + Body(options). + Do(). + Error() +} + +// Patch applies the patch and returns the patched machineTemplate. +func (c *machineTemplates) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1alpha1.MachineTemplate, err error) { + result = &v1alpha1.MachineTemplate{} + err = c.client.Patch(pt). + Namespace(c.ns). + Resource("machinetemplates"). + SubResource(subresources...). + Name(name). + Body(data). + Do(). + Into(result) + return +} diff --git a/pkg/client/clientset/typed/node/v1alpha1/scale.go b/pkg/client/clientset/typed/machine/v1alpha1/scale.go similarity index 88% rename from pkg/client/clientset/typed/node/v1alpha1/scale.go rename to pkg/client/clientset/typed/machine/v1alpha1/scale.go index 7d54d24ff..c5ed24ae0 100644 --- a/pkg/client/clientset/typed/node/v1alpha1/scale.go +++ b/pkg/client/clientset/typed/machine/v1alpha1/scale.go @@ -22,7 +22,7 @@ type scales struct { } // newScales returns a Scales -func newScales(c *NodeV1alpha1Client, namespace string) *scales { +func newScales(c *MachineV1alpha1Client, namespace string) *scales { return &scales{ client: c.RESTClient(), ns: namespace, diff --git a/pkg/client/clientset/typed/node/v1alpha1/awsinstanceclass.go b/pkg/client/clientset/typed/node/v1alpha1/awsinstanceclass.go deleted file mode 100644 index f8525c577..000000000 --- a/pkg/client/clientset/typed/node/v1alpha1/awsinstanceclass.go +++ /dev/null @@ -1,129 +0,0 @@ -package v1alpha1 - -import ( - v1alpha1 "github.com/gardener/node-controller-manager/pkg/apis/node/v1alpha1" - scheme "github.com/gardener/node-controller-manager/pkg/client/clientset/scheme" - v1 "k8s.io/apimachinery/pkg/apis/meta/v1" - types "k8s.io/apimachinery/pkg/types" - watch "k8s.io/apimachinery/pkg/watch" - rest "k8s.io/client-go/rest" -) - -// AWSInstanceClassesGetter has a method to return a AWSInstanceClassInterface. -// A group's client should implement this interface. -type AWSInstanceClassesGetter interface { - AWSInstanceClasses() AWSInstanceClassInterface -} - -// AWSInstanceClassInterface has methods to work with AWSInstanceClass resources. -type AWSInstanceClassInterface interface { - Create(*v1alpha1.AWSInstanceClass) (*v1alpha1.AWSInstanceClass, error) - Update(*v1alpha1.AWSInstanceClass) (*v1alpha1.AWSInstanceClass, error) - Delete(name string, options *v1.DeleteOptions) error - DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error - Get(name string, options v1.GetOptions) (*v1alpha1.AWSInstanceClass, error) - List(opts v1.ListOptions) (*v1alpha1.AWSInstanceClassList, error) - Watch(opts v1.ListOptions) (watch.Interface, error) - Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1alpha1.AWSInstanceClass, err error) - AWSInstanceClassExpansion -} - -// aWSInstanceClasses implements AWSInstanceClassInterface -type aWSInstanceClasses struct { - client rest.Interface -} - -// newAWSInstanceClasses returns a AWSInstanceClasses -func newAWSInstanceClasses(c *NodeV1alpha1Client) *aWSInstanceClasses { - return &aWSInstanceClasses{ - client: c.RESTClient(), - } -} - -// Get takes name of the aWSInstanceClass, and returns the corresponding aWSInstanceClass object, and an error if there is any. -func (c *aWSInstanceClasses) Get(name string, options v1.GetOptions) (result *v1alpha1.AWSInstanceClass, err error) { - result = &v1alpha1.AWSInstanceClass{} - err = c.client.Get(). - Resource("awsinstanceclasses"). - Name(name). - VersionedParams(&options, scheme.ParameterCodec). - Do(). - Into(result) - return -} - -// List takes label and field selectors, and returns the list of AWSInstanceClasses that match those selectors. -func (c *aWSInstanceClasses) List(opts v1.ListOptions) (result *v1alpha1.AWSInstanceClassList, err error) { - result = &v1alpha1.AWSInstanceClassList{} - err = c.client.Get(). - Resource("awsinstanceclasses"). - VersionedParams(&opts, scheme.ParameterCodec). - Do(). - Into(result) - return -} - -// Watch returns a watch.Interface that watches the requested aWSInstanceClasses. -func (c *aWSInstanceClasses) Watch(opts v1.ListOptions) (watch.Interface, error) { - opts.Watch = true - return c.client.Get(). - Resource("awsinstanceclasses"). - VersionedParams(&opts, scheme.ParameterCodec). - Watch() -} - -// Create takes the representation of a aWSInstanceClass and creates it. Returns the server's representation of the aWSInstanceClass, and an error, if there is any. -func (c *aWSInstanceClasses) Create(aWSInstanceClass *v1alpha1.AWSInstanceClass) (result *v1alpha1.AWSInstanceClass, err error) { - result = &v1alpha1.AWSInstanceClass{} - err = c.client.Post(). - Resource("awsinstanceclasses"). - Body(aWSInstanceClass). - Do(). - Into(result) - return -} - -// Update takes the representation of a aWSInstanceClass and updates it. Returns the server's representation of the aWSInstanceClass, and an error, if there is any. -func (c *aWSInstanceClasses) Update(aWSInstanceClass *v1alpha1.AWSInstanceClass) (result *v1alpha1.AWSInstanceClass, err error) { - result = &v1alpha1.AWSInstanceClass{} - err = c.client.Put(). - Resource("awsinstanceclasses"). - Name(aWSInstanceClass.Name). - Body(aWSInstanceClass). - Do(). - Into(result) - return -} - -// Delete takes name of the aWSInstanceClass and deletes it. Returns an error if one occurs. -func (c *aWSInstanceClasses) Delete(name string, options *v1.DeleteOptions) error { - return c.client.Delete(). - Resource("awsinstanceclasses"). - Name(name). - Body(options). - Do(). - Error() -} - -// DeleteCollection deletes a collection of objects. -func (c *aWSInstanceClasses) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error { - return c.client.Delete(). - Resource("awsinstanceclasses"). - VersionedParams(&listOptions, scheme.ParameterCodec). - Body(options). - Do(). - Error() -} - -// Patch applies the patch and returns the patched aWSInstanceClass. -func (c *aWSInstanceClasses) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1alpha1.AWSInstanceClass, err error) { - result = &v1alpha1.AWSInstanceClass{} - err = c.client.Patch(pt). - Resource("awsinstanceclasses"). - SubResource(subresources...). - Name(name). - Body(data). - Do(). - Into(result) - return -} diff --git a/pkg/client/clientset/typed/node/v1alpha1/fake/fake_awsinstanceclass.go b/pkg/client/clientset/typed/node/v1alpha1/fake/fake_awsinstanceclass.go deleted file mode 100644 index d3d50fc02..000000000 --- a/pkg/client/clientset/typed/node/v1alpha1/fake/fake_awsinstanceclass.go +++ /dev/null @@ -1,102 +0,0 @@ -package fake - -import ( - v1alpha1 "github.com/gardener/node-controller-manager/pkg/apis/node/v1alpha1" - 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" -) - -// FakeAWSInstanceClasses implements AWSInstanceClassInterface -type FakeAWSInstanceClasses struct { - Fake *FakeNodeV1alpha1 -} - -var awsinstanceclassesResource = schema.GroupVersionResource{Group: "node.sapcloud.io", Version: "v1alpha1", Resource: "awsinstanceclasses"} - -var awsinstanceclassesKind = schema.GroupVersionKind{Group: "node.sapcloud.io", Version: "v1alpha1", Kind: "AWSInstanceClass"} - -// Get takes name of the aWSInstanceClass, and returns the corresponding aWSInstanceClass object, and an error if there is any. -func (c *FakeAWSInstanceClasses) Get(name string, options v1.GetOptions) (result *v1alpha1.AWSInstanceClass, err error) { - obj, err := c.Fake. - Invokes(testing.NewRootGetAction(awsinstanceclassesResource, name), &v1alpha1.AWSInstanceClass{}) - if obj == nil { - return nil, err - } - return obj.(*v1alpha1.AWSInstanceClass), err -} - -// List takes label and field selectors, and returns the list of AWSInstanceClasses that match those selectors. -func (c *FakeAWSInstanceClasses) List(opts v1.ListOptions) (result *v1alpha1.AWSInstanceClassList, err error) { - obj, err := c.Fake. - Invokes(testing.NewRootListAction(awsinstanceclassesResource, awsinstanceclassesKind, opts), &v1alpha1.AWSInstanceClassList{}) - if obj == nil { - return nil, err - } - - label, _, _ := testing.ExtractFromListOptions(opts) - if label == nil { - label = labels.Everything() - } - list := &v1alpha1.AWSInstanceClassList{} - for _, item := range obj.(*v1alpha1.AWSInstanceClassList).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 aWSInstanceClasses. -func (c *FakeAWSInstanceClasses) Watch(opts v1.ListOptions) (watch.Interface, error) { - return c.Fake. - InvokesWatch(testing.NewRootWatchAction(awsinstanceclassesResource, opts)) -} - -// Create takes the representation of a aWSInstanceClass and creates it. Returns the server's representation of the aWSInstanceClass, and an error, if there is any. -func (c *FakeAWSInstanceClasses) Create(aWSInstanceClass *v1alpha1.AWSInstanceClass) (result *v1alpha1.AWSInstanceClass, err error) { - obj, err := c.Fake. - Invokes(testing.NewRootCreateAction(awsinstanceclassesResource, aWSInstanceClass), &v1alpha1.AWSInstanceClass{}) - if obj == nil { - return nil, err - } - return obj.(*v1alpha1.AWSInstanceClass), err -} - -// Update takes the representation of a aWSInstanceClass and updates it. Returns the server's representation of the aWSInstanceClass, and an error, if there is any. -func (c *FakeAWSInstanceClasses) Update(aWSInstanceClass *v1alpha1.AWSInstanceClass) (result *v1alpha1.AWSInstanceClass, err error) { - obj, err := c.Fake. - Invokes(testing.NewRootUpdateAction(awsinstanceclassesResource, aWSInstanceClass), &v1alpha1.AWSInstanceClass{}) - if obj == nil { - return nil, err - } - return obj.(*v1alpha1.AWSInstanceClass), err -} - -// Delete takes name of the aWSInstanceClass and deletes it. Returns an error if one occurs. -func (c *FakeAWSInstanceClasses) Delete(name string, options *v1.DeleteOptions) error { - _, err := c.Fake. - Invokes(testing.NewRootDeleteAction(awsinstanceclassesResource, name), &v1alpha1.AWSInstanceClass{}) - return err -} - -// DeleteCollection deletes a collection of objects. -func (c *FakeAWSInstanceClasses) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error { - action := testing.NewRootDeleteCollectionAction(awsinstanceclassesResource, listOptions) - - _, err := c.Fake.Invokes(action, &v1alpha1.AWSInstanceClassList{}) - return err -} - -// Patch applies the patch and returns the patched aWSInstanceClass. -func (c *FakeAWSInstanceClasses) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1alpha1.AWSInstanceClass, err error) { - obj, err := c.Fake. - Invokes(testing.NewRootPatchSubresourceAction(awsinstanceclassesResource, name, data, subresources...), &v1alpha1.AWSInstanceClass{}) - if obj == nil { - return nil, err - } - return obj.(*v1alpha1.AWSInstanceClass), err -} diff --git a/pkg/client/clientset/typed/node/v1alpha1/fake/fake_instance.go b/pkg/client/clientset/typed/node/v1alpha1/fake/fake_instance.go deleted file mode 100644 index 19f1a236f..000000000 --- a/pkg/client/clientset/typed/node/v1alpha1/fake/fake_instance.go +++ /dev/null @@ -1,102 +0,0 @@ -package fake - -import ( - v1alpha1 "github.com/gardener/node-controller-manager/pkg/apis/node/v1alpha1" - 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" -) - -// FakeInstances implements InstanceInterface -type FakeInstances struct { - Fake *FakeNodeV1alpha1 -} - -var instancesResource = schema.GroupVersionResource{Group: "node.sapcloud.io", Version: "v1alpha1", Resource: "instances"} - -var instancesKind = schema.GroupVersionKind{Group: "node.sapcloud.io", Version: "v1alpha1", Kind: "Instance"} - -// Get takes name of the instance, and returns the corresponding instance object, and an error if there is any. -func (c *FakeInstances) Get(name string, options v1.GetOptions) (result *v1alpha1.Instance, err error) { - obj, err := c.Fake. - Invokes(testing.NewRootGetAction(instancesResource, name), &v1alpha1.Instance{}) - if obj == nil { - return nil, err - } - return obj.(*v1alpha1.Instance), err -} - -// List takes label and field selectors, and returns the list of Instances that match those selectors. -func (c *FakeInstances) List(opts v1.ListOptions) (result *v1alpha1.InstanceList, err error) { - obj, err := c.Fake. - Invokes(testing.NewRootListAction(instancesResource, instancesKind, opts), &v1alpha1.InstanceList{}) - if obj == nil { - return nil, err - } - - label, _, _ := testing.ExtractFromListOptions(opts) - if label == nil { - label = labels.Everything() - } - list := &v1alpha1.InstanceList{} - for _, item := range obj.(*v1alpha1.InstanceList).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 instances. -func (c *FakeInstances) Watch(opts v1.ListOptions) (watch.Interface, error) { - return c.Fake. - InvokesWatch(testing.NewRootWatchAction(instancesResource, opts)) -} - -// Create takes the representation of a instance and creates it. Returns the server's representation of the instance, and an error, if there is any. -func (c *FakeInstances) Create(instance *v1alpha1.Instance) (result *v1alpha1.Instance, err error) { - obj, err := c.Fake. - Invokes(testing.NewRootCreateAction(instancesResource, instance), &v1alpha1.Instance{}) - if obj == nil { - return nil, err - } - return obj.(*v1alpha1.Instance), err -} - -// Update takes the representation of a instance and updates it. Returns the server's representation of the instance, and an error, if there is any. -func (c *FakeInstances) Update(instance *v1alpha1.Instance) (result *v1alpha1.Instance, err error) { - obj, err := c.Fake. - Invokes(testing.NewRootUpdateAction(instancesResource, instance), &v1alpha1.Instance{}) - if obj == nil { - return nil, err - } - return obj.(*v1alpha1.Instance), err -} - -// Delete takes name of the instance and deletes it. Returns an error if one occurs. -func (c *FakeInstances) Delete(name string, options *v1.DeleteOptions) error { - _, err := c.Fake. - Invokes(testing.NewRootDeleteAction(instancesResource, name), &v1alpha1.Instance{}) - return err -} - -// DeleteCollection deletes a collection of objects. -func (c *FakeInstances) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error { - action := testing.NewRootDeleteCollectionAction(instancesResource, listOptions) - - _, err := c.Fake.Invokes(action, &v1alpha1.InstanceList{}) - return err -} - -// Patch applies the patch and returns the patched instance. -func (c *FakeInstances) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1alpha1.Instance, err error) { - obj, err := c.Fake. - Invokes(testing.NewRootPatchSubresourceAction(instancesResource, name, data, subresources...), &v1alpha1.Instance{}) - if obj == nil { - return nil, err - } - return obj.(*v1alpha1.Instance), err -} diff --git a/pkg/client/clientset/typed/node/v1alpha1/fake/fake_instancedeployment.go b/pkg/client/clientset/typed/node/v1alpha1/fake/fake_instancedeployment.go deleted file mode 100644 index 10f6b2ade..000000000 --- a/pkg/client/clientset/typed/node/v1alpha1/fake/fake_instancedeployment.go +++ /dev/null @@ -1,133 +0,0 @@ -package fake - -import ( - v1alpha1 "github.com/gardener/node-controller-manager/pkg/apis/node/v1alpha1" - 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" -) - -// FakeInstanceDeployments implements InstanceDeploymentInterface -type FakeInstanceDeployments struct { - Fake *FakeNodeV1alpha1 -} - -var instancedeploymentsResource = schema.GroupVersionResource{Group: "node.sapcloud.io", Version: "v1alpha1", Resource: "instancedeployments"} - -var instancedeploymentsKind = schema.GroupVersionKind{Group: "node.sapcloud.io", Version: "v1alpha1", Kind: "InstanceDeployment"} - -// Get takes name of the instanceDeployment, and returns the corresponding instanceDeployment object, and an error if there is any. -func (c *FakeInstanceDeployments) Get(name string, options v1.GetOptions) (result *v1alpha1.InstanceDeployment, err error) { - obj, err := c.Fake. - Invokes(testing.NewRootGetAction(instancedeploymentsResource, name), &v1alpha1.InstanceDeployment{}) - if obj == nil { - return nil, err - } - return obj.(*v1alpha1.InstanceDeployment), err -} - -// List takes label and field selectors, and returns the list of InstanceDeployments that match those selectors. -func (c *FakeInstanceDeployments) List(opts v1.ListOptions) (result *v1alpha1.InstanceDeploymentList, err error) { - obj, err := c.Fake. - Invokes(testing.NewRootListAction(instancedeploymentsResource, instancedeploymentsKind, opts), &v1alpha1.InstanceDeploymentList{}) - if obj == nil { - return nil, err - } - - label, _, _ := testing.ExtractFromListOptions(opts) - if label == nil { - label = labels.Everything() - } - list := &v1alpha1.InstanceDeploymentList{} - for _, item := range obj.(*v1alpha1.InstanceDeploymentList).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 instanceDeployments. -func (c *FakeInstanceDeployments) Watch(opts v1.ListOptions) (watch.Interface, error) { - return c.Fake. - InvokesWatch(testing.NewRootWatchAction(instancedeploymentsResource, opts)) -} - -// Create takes the representation of a instanceDeployment and creates it. Returns the server's representation of the instanceDeployment, and an error, if there is any. -func (c *FakeInstanceDeployments) Create(instanceDeployment *v1alpha1.InstanceDeployment) (result *v1alpha1.InstanceDeployment, err error) { - obj, err := c.Fake. - Invokes(testing.NewRootCreateAction(instancedeploymentsResource, instanceDeployment), &v1alpha1.InstanceDeployment{}) - if obj == nil { - return nil, err - } - return obj.(*v1alpha1.InstanceDeployment), err -} - -// Update takes the representation of a instanceDeployment and updates it. Returns the server's representation of the instanceDeployment, and an error, if there is any. -func (c *FakeInstanceDeployments) Update(instanceDeployment *v1alpha1.InstanceDeployment) (result *v1alpha1.InstanceDeployment, err error) { - obj, err := c.Fake. - Invokes(testing.NewRootUpdateAction(instancedeploymentsResource, instanceDeployment), &v1alpha1.InstanceDeployment{}) - if obj == nil { - return nil, err - } - return obj.(*v1alpha1.InstanceDeployment), 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 *FakeInstanceDeployments) UpdateStatus(instanceDeployment *v1alpha1.InstanceDeployment) (*v1alpha1.InstanceDeployment, error) { - obj, err := c.Fake. - Invokes(testing.NewRootUpdateSubresourceAction(instancedeploymentsResource, "status", instanceDeployment), &v1alpha1.InstanceDeployment{}) - if obj == nil { - return nil, err - } - return obj.(*v1alpha1.InstanceDeployment), err -} - -// Delete takes name of the instanceDeployment and deletes it. Returns an error if one occurs. -func (c *FakeInstanceDeployments) Delete(name string, options *v1.DeleteOptions) error { - _, err := c.Fake. - Invokes(testing.NewRootDeleteAction(instancedeploymentsResource, name), &v1alpha1.InstanceDeployment{}) - return err -} - -// DeleteCollection deletes a collection of objects. -func (c *FakeInstanceDeployments) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error { - action := testing.NewRootDeleteCollectionAction(instancedeploymentsResource, listOptions) - - _, err := c.Fake.Invokes(action, &v1alpha1.InstanceDeploymentList{}) - return err -} - -// Patch applies the patch and returns the patched instanceDeployment. -func (c *FakeInstanceDeployments) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1alpha1.InstanceDeployment, err error) { - obj, err := c.Fake. - Invokes(testing.NewRootPatchSubresourceAction(instancedeploymentsResource, name, data, subresources...), &v1alpha1.InstanceDeployment{}) - if obj == nil { - return nil, err - } - return obj.(*v1alpha1.InstanceDeployment), err -} - -// GetScale takes name of the instanceDeployment, and returns the corresponding scale object, and an error if there is any. -func (c *FakeInstanceDeployments) GetScale(instanceDeploymentName string, options v1.GetOptions) (result *v1alpha1.Scale, err error) { - obj, err := c.Fake. - Invokes(testing.NewRootGetAction(instancedeploymentsResource, instanceDeploymentName), &v1alpha1.Scale{}) - if obj == nil { - return nil, err - } - return obj.(*v1alpha1.Scale), err -} - -// UpdateScale takes the representation of a scale and updates it. Returns the server's representation of the scale, and an error, if there is any. -func (c *FakeInstanceDeployments) UpdateScale(instanceDeploymentName string, scale *v1alpha1.Scale) (result *v1alpha1.Scale, err error) { - obj, err := c.Fake. - Invokes(testing.NewRootUpdateAction(instancedeploymentsResource, instanceDeployment), &v1alpha1.InstanceDeployment{}) - if obj == nil { - return nil, err - } - return obj.(*v1alpha1.Scale), err -} diff --git a/pkg/client/clientset/typed/node/v1alpha1/fake/fake_instanceset.go b/pkg/client/clientset/typed/node/v1alpha1/fake/fake_instanceset.go deleted file mode 100644 index 5b9ea1f36..000000000 --- a/pkg/client/clientset/typed/node/v1alpha1/fake/fake_instanceset.go +++ /dev/null @@ -1,113 +0,0 @@ -package fake - -import ( - v1alpha1 "github.com/gardener/node-controller-manager/pkg/apis/node/v1alpha1" - 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" -) - -// FakeInstanceSets implements InstanceSetInterface -type FakeInstanceSets struct { - Fake *FakeNodeV1alpha1 -} - -var instancesetsResource = schema.GroupVersionResource{Group: "node.sapcloud.io", Version: "v1alpha1", Resource: "instancesets"} - -var instancesetsKind = schema.GroupVersionKind{Group: "node.sapcloud.io", Version: "v1alpha1", Kind: "InstanceSet"} - -// Get takes name of the instanceSet, and returns the corresponding instanceSet object, and an error if there is any. -func (c *FakeInstanceSets) Get(name string, options v1.GetOptions) (result *v1alpha1.InstanceSet, err error) { - obj, err := c.Fake. - Invokes(testing.NewRootGetAction(instancesetsResource, name), &v1alpha1.InstanceSet{}) - if obj == nil { - return nil, err - } - return obj.(*v1alpha1.InstanceSet), err -} - -// List takes label and field selectors, and returns the list of InstanceSets that match those selectors. -func (c *FakeInstanceSets) List(opts v1.ListOptions) (result *v1alpha1.InstanceSetList, err error) { - obj, err := c.Fake. - Invokes(testing.NewRootListAction(instancesetsResource, instancesetsKind, opts), &v1alpha1.InstanceSetList{}) - if obj == nil { - return nil, err - } - - label, _, _ := testing.ExtractFromListOptions(opts) - if label == nil { - label = labels.Everything() - } - list := &v1alpha1.InstanceSetList{} - for _, item := range obj.(*v1alpha1.InstanceSetList).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 instanceSets. -func (c *FakeInstanceSets) Watch(opts v1.ListOptions) (watch.Interface, error) { - return c.Fake. - InvokesWatch(testing.NewRootWatchAction(instancesetsResource, opts)) -} - -// Create takes the representation of a instanceSet and creates it. Returns the server's representation of the instanceSet, and an error, if there is any. -func (c *FakeInstanceSets) Create(instanceSet *v1alpha1.InstanceSet) (result *v1alpha1.InstanceSet, err error) { - obj, err := c.Fake. - Invokes(testing.NewRootCreateAction(instancesetsResource, instanceSet), &v1alpha1.InstanceSet{}) - if obj == nil { - return nil, err - } - return obj.(*v1alpha1.InstanceSet), err -} - -// Update takes the representation of a instanceSet and updates it. Returns the server's representation of the instanceSet, and an error, if there is any. -func (c *FakeInstanceSets) Update(instanceSet *v1alpha1.InstanceSet) (result *v1alpha1.InstanceSet, err error) { - obj, err := c.Fake. - Invokes(testing.NewRootUpdateAction(instancesetsResource, instanceSet), &v1alpha1.InstanceSet{}) - if obj == nil { - return nil, err - } - return obj.(*v1alpha1.InstanceSet), 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 *FakeInstanceSets) UpdateStatus(instanceSet *v1alpha1.InstanceSet) (*v1alpha1.InstanceSet, error) { - obj, err := c.Fake. - Invokes(testing.NewRootUpdateSubresourceAction(instancesetsResource, "status", instanceSet), &v1alpha1.InstanceSet{}) - if obj == nil { - return nil, err - } - return obj.(*v1alpha1.InstanceSet), err -} - -// Delete takes name of the instanceSet and deletes it. Returns an error if one occurs. -func (c *FakeInstanceSets) Delete(name string, options *v1.DeleteOptions) error { - _, err := c.Fake. - Invokes(testing.NewRootDeleteAction(instancesetsResource, name), &v1alpha1.InstanceSet{}) - return err -} - -// DeleteCollection deletes a collection of objects. -func (c *FakeInstanceSets) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error { - action := testing.NewRootDeleteCollectionAction(instancesetsResource, listOptions) - - _, err := c.Fake.Invokes(action, &v1alpha1.InstanceSetList{}) - return err -} - -// Patch applies the patch and returns the patched instanceSet. -func (c *FakeInstanceSets) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1alpha1.InstanceSet, err error) { - obj, err := c.Fake. - Invokes(testing.NewRootPatchSubresourceAction(instancesetsResource, name, data, subresources...), &v1alpha1.InstanceSet{}) - if obj == nil { - return nil, err - } - return obj.(*v1alpha1.InstanceSet), err -} diff --git a/pkg/client/clientset/typed/node/v1alpha1/fake/fake_instancetemplate.go b/pkg/client/clientset/typed/node/v1alpha1/fake/fake_instancetemplate.go deleted file mode 100644 index a2e5b9779..000000000 --- a/pkg/client/clientset/typed/node/v1alpha1/fake/fake_instancetemplate.go +++ /dev/null @@ -1,110 +0,0 @@ -package fake - -import ( - v1alpha1 "github.com/gardener/node-controller-manager/pkg/apis/node/v1alpha1" - 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" -) - -// FakeInstanceTemplates implements InstanceTemplateInterface -type FakeInstanceTemplates struct { - Fake *FakeNodeV1alpha1 - ns string -} - -var instancetemplatesResource = schema.GroupVersionResource{Group: "node.sapcloud.io", Version: "v1alpha1", Resource: "instancetemplates"} - -var instancetemplatesKind = schema.GroupVersionKind{Group: "node.sapcloud.io", Version: "v1alpha1", Kind: "InstanceTemplate"} - -// Get takes name of the instanceTemplate, and returns the corresponding instanceTemplate object, and an error if there is any. -func (c *FakeInstanceTemplates) Get(name string, options v1.GetOptions) (result *v1alpha1.InstanceTemplate, err error) { - obj, err := c.Fake. - Invokes(testing.NewGetAction(instancetemplatesResource, c.ns, name), &v1alpha1.InstanceTemplate{}) - - if obj == nil { - return nil, err - } - return obj.(*v1alpha1.InstanceTemplate), err -} - -// List takes label and field selectors, and returns the list of InstanceTemplates that match those selectors. -func (c *FakeInstanceTemplates) List(opts v1.ListOptions) (result *v1alpha1.InstanceTemplateList, err error) { - obj, err := c.Fake. - Invokes(testing.NewListAction(instancetemplatesResource, instancetemplatesKind, c.ns, opts), &v1alpha1.InstanceTemplateList{}) - - if obj == nil { - return nil, err - } - - label, _, _ := testing.ExtractFromListOptions(opts) - if label == nil { - label = labels.Everything() - } - list := &v1alpha1.InstanceTemplateList{} - for _, item := range obj.(*v1alpha1.InstanceTemplateList).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 instanceTemplates. -func (c *FakeInstanceTemplates) Watch(opts v1.ListOptions) (watch.Interface, error) { - return c.Fake. - InvokesWatch(testing.NewWatchAction(instancetemplatesResource, c.ns, opts)) - -} - -// Create takes the representation of a instanceTemplate and creates it. Returns the server's representation of the instanceTemplate, and an error, if there is any. -func (c *FakeInstanceTemplates) Create(instanceTemplate *v1alpha1.InstanceTemplate) (result *v1alpha1.InstanceTemplate, err error) { - obj, err := c.Fake. - Invokes(testing.NewCreateAction(instancetemplatesResource, c.ns, instanceTemplate), &v1alpha1.InstanceTemplate{}) - - if obj == nil { - return nil, err - } - return obj.(*v1alpha1.InstanceTemplate), err -} - -// Update takes the representation of a instanceTemplate and updates it. Returns the server's representation of the instanceTemplate, and an error, if there is any. -func (c *FakeInstanceTemplates) Update(instanceTemplate *v1alpha1.InstanceTemplate) (result *v1alpha1.InstanceTemplate, err error) { - obj, err := c.Fake. - Invokes(testing.NewUpdateAction(instancetemplatesResource, c.ns, instanceTemplate), &v1alpha1.InstanceTemplate{}) - - if obj == nil { - return nil, err - } - return obj.(*v1alpha1.InstanceTemplate), err -} - -// Delete takes name of the instanceTemplate and deletes it. Returns an error if one occurs. -func (c *FakeInstanceTemplates) Delete(name string, options *v1.DeleteOptions) error { - _, err := c.Fake. - Invokes(testing.NewDeleteAction(instancetemplatesResource, c.ns, name), &v1alpha1.InstanceTemplate{}) - - return err -} - -// DeleteCollection deletes a collection of objects. -func (c *FakeInstanceTemplates) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error { - action := testing.NewDeleteCollectionAction(instancetemplatesResource, c.ns, listOptions) - - _, err := c.Fake.Invokes(action, &v1alpha1.InstanceTemplateList{}) - return err -} - -// Patch applies the patch and returns the patched instanceTemplate. -func (c *FakeInstanceTemplates) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1alpha1.InstanceTemplate, err error) { - obj, err := c.Fake. - Invokes(testing.NewPatchSubresourceAction(instancetemplatesResource, c.ns, name, data, subresources...), &v1alpha1.InstanceTemplate{}) - - if obj == nil { - return nil, err - } - return obj.(*v1alpha1.InstanceTemplate), err -} diff --git a/pkg/client/clientset/typed/node/v1alpha1/fake/fake_node_client.go b/pkg/client/clientset/typed/node/v1alpha1/fake/fake_node_client.go deleted file mode 100644 index 339fe5117..000000000 --- a/pkg/client/clientset/typed/node/v1alpha1/fake/fake_node_client.go +++ /dev/null @@ -1,42 +0,0 @@ -package fake - -import ( - v1alpha1 "github.com/gardener/node-controller-manager/pkg/client/clientset/typed/node/v1alpha1" - rest "k8s.io/client-go/rest" - testing "k8s.io/client-go/testing" -) - -type FakeNodeV1alpha1 struct { - *testing.Fake -} - -func (c *FakeNodeV1alpha1) AWSInstanceClasses() v1alpha1.AWSInstanceClassInterface { - return &FakeAWSInstanceClasses{c} -} - -func (c *FakeNodeV1alpha1) Instances() v1alpha1.InstanceInterface { - return &FakeInstances{c} -} - -func (c *FakeNodeV1alpha1) InstanceDeployments() v1alpha1.InstanceDeploymentInterface { - return &FakeInstanceDeployments{c} -} - -func (c *FakeNodeV1alpha1) InstanceSets() v1alpha1.InstanceSetInterface { - return &FakeInstanceSets{c} -} - -func (c *FakeNodeV1alpha1) InstanceTemplates(namespace string) v1alpha1.InstanceTemplateInterface { - return &FakeInstanceTemplates{c, namespace} -} - -func (c *FakeNodeV1alpha1) Scales(namespace string) v1alpha1.ScaleInterface { - return &FakeScales{c, namespace} -} - -// RESTClient returns a RESTClient that is used to communicate -// with API server by this client implementation. -func (c *FakeNodeV1alpha1) RESTClient() rest.Interface { - var ret *rest.RESTClient - return ret -} diff --git a/pkg/client/clientset/typed/node/v1alpha1/generated_expansion.go b/pkg/client/clientset/typed/node/v1alpha1/generated_expansion.go deleted file mode 100644 index 5abdad74f..000000000 --- a/pkg/client/clientset/typed/node/v1alpha1/generated_expansion.go +++ /dev/null @@ -1,13 +0,0 @@ -package v1alpha1 - -type AWSInstanceClassExpansion interface{} - -type InstanceExpansion interface{} - -type InstanceDeploymentExpansion interface{} - -type InstanceSetExpansion interface{} - -type InstanceTemplateExpansion interface{} - -type ScaleExpansion interface{} diff --git a/pkg/client/clientset/typed/node/v1alpha1/instance.go b/pkg/client/clientset/typed/node/v1alpha1/instance.go deleted file mode 100644 index 05d94f95d..000000000 --- a/pkg/client/clientset/typed/node/v1alpha1/instance.go +++ /dev/null @@ -1,129 +0,0 @@ -package v1alpha1 - -import ( - v1alpha1 "github.com/gardener/node-controller-manager/pkg/apis/node/v1alpha1" - scheme "github.com/gardener/node-controller-manager/pkg/client/clientset/scheme" - v1 "k8s.io/apimachinery/pkg/apis/meta/v1" - types "k8s.io/apimachinery/pkg/types" - watch "k8s.io/apimachinery/pkg/watch" - rest "k8s.io/client-go/rest" -) - -// InstancesGetter has a method to return a InstanceInterface. -// A group's client should implement this interface. -type InstancesGetter interface { - Instances() InstanceInterface -} - -// InstanceInterface has methods to work with Instance resources. -type InstanceInterface interface { - Create(*v1alpha1.Instance) (*v1alpha1.Instance, error) - Update(*v1alpha1.Instance) (*v1alpha1.Instance, error) - Delete(name string, options *v1.DeleteOptions) error - DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error - Get(name string, options v1.GetOptions) (*v1alpha1.Instance, error) - List(opts v1.ListOptions) (*v1alpha1.InstanceList, error) - Watch(opts v1.ListOptions) (watch.Interface, error) - Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1alpha1.Instance, err error) - InstanceExpansion -} - -// instances implements InstanceInterface -type instances struct { - client rest.Interface -} - -// newInstances returns a Instances -func newInstances(c *NodeV1alpha1Client) *instances { - return &instances{ - client: c.RESTClient(), - } -} - -// Get takes name of the instance, and returns the corresponding instance object, and an error if there is any. -func (c *instances) Get(name string, options v1.GetOptions) (result *v1alpha1.Instance, err error) { - result = &v1alpha1.Instance{} - err = c.client.Get(). - Resource("instances"). - Name(name). - VersionedParams(&options, scheme.ParameterCodec). - Do(). - Into(result) - return -} - -// List takes label and field selectors, and returns the list of Instances that match those selectors. -func (c *instances) List(opts v1.ListOptions) (result *v1alpha1.InstanceList, err error) { - result = &v1alpha1.InstanceList{} - err = c.client.Get(). - Resource("instances"). - VersionedParams(&opts, scheme.ParameterCodec). - Do(). - Into(result) - return -} - -// Watch returns a watch.Interface that watches the requested instances. -func (c *instances) Watch(opts v1.ListOptions) (watch.Interface, error) { - opts.Watch = true - return c.client.Get(). - Resource("instances"). - VersionedParams(&opts, scheme.ParameterCodec). - Watch() -} - -// Create takes the representation of a instance and creates it. Returns the server's representation of the instance, and an error, if there is any. -func (c *instances) Create(instance *v1alpha1.Instance) (result *v1alpha1.Instance, err error) { - result = &v1alpha1.Instance{} - err = c.client.Post(). - Resource("instances"). - Body(instance). - Do(). - Into(result) - return -} - -// Update takes the representation of a instance and updates it. Returns the server's representation of the instance, and an error, if there is any. -func (c *instances) Update(instance *v1alpha1.Instance) (result *v1alpha1.Instance, err error) { - result = &v1alpha1.Instance{} - err = c.client.Put(). - Resource("instances"). - Name(instance.Name). - Body(instance). - Do(). - Into(result) - return -} - -// Delete takes name of the instance and deletes it. Returns an error if one occurs. -func (c *instances) Delete(name string, options *v1.DeleteOptions) error { - return c.client.Delete(). - Resource("instances"). - Name(name). - Body(options). - Do(). - Error() -} - -// DeleteCollection deletes a collection of objects. -func (c *instances) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error { - return c.client.Delete(). - Resource("instances"). - VersionedParams(&listOptions, scheme.ParameterCodec). - Body(options). - Do(). - Error() -} - -// Patch applies the patch and returns the patched instance. -func (c *instances) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1alpha1.Instance, err error) { - result = &v1alpha1.Instance{} - err = c.client.Patch(pt). - Resource("instances"). - SubResource(subresources...). - Name(name). - Body(data). - Do(). - Into(result) - return -} diff --git a/pkg/client/clientset/typed/node/v1alpha1/instancedeployment.go b/pkg/client/clientset/typed/node/v1alpha1/instancedeployment.go deleted file mode 100644 index 414e9283e..000000000 --- a/pkg/client/clientset/typed/node/v1alpha1/instancedeployment.go +++ /dev/null @@ -1,174 +0,0 @@ -package v1alpha1 - -import ( - v1alpha1 "github.com/gardener/node-controller-manager/pkg/apis/node/v1alpha1" - scheme "github.com/gardener/node-controller-manager/pkg/client/clientset/scheme" - v1 "k8s.io/apimachinery/pkg/apis/meta/v1" - types "k8s.io/apimachinery/pkg/types" - watch "k8s.io/apimachinery/pkg/watch" - rest "k8s.io/client-go/rest" -) - -// InstanceDeploymentsGetter has a method to return a InstanceDeploymentInterface. -// A group's client should implement this interface. -type InstanceDeploymentsGetter interface { - InstanceDeployments() InstanceDeploymentInterface -} - -// InstanceDeploymentInterface has methods to work with InstanceDeployment resources. -type InstanceDeploymentInterface interface { - Create(*v1alpha1.InstanceDeployment) (*v1alpha1.InstanceDeployment, error) - Update(*v1alpha1.InstanceDeployment) (*v1alpha1.InstanceDeployment, error) - UpdateStatus(*v1alpha1.InstanceDeployment) (*v1alpha1.InstanceDeployment, error) - Delete(name string, options *v1.DeleteOptions) error - DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error - Get(name string, options v1.GetOptions) (*v1alpha1.InstanceDeployment, error) - List(opts v1.ListOptions) (*v1alpha1.InstanceDeploymentList, error) - Watch(opts v1.ListOptions) (watch.Interface, error) - Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1alpha1.InstanceDeployment, err error) - GetScale(instanceDeploymentName string, options v1.GetOptions) (*v1alpha1.Scale, error) - UpdateScale(instanceDeploymentName string, scale *v1alpha1.Scale) (*v1alpha1.Scale, error) - - InstanceDeploymentExpansion -} - -// instanceDeployments implements InstanceDeploymentInterface -type instanceDeployments struct { - client rest.Interface -} - -// newInstanceDeployments returns a InstanceDeployments -func newInstanceDeployments(c *NodeV1alpha1Client) *instanceDeployments { - return &instanceDeployments{ - client: c.RESTClient(), - } -} - -// Get takes name of the instanceDeployment, and returns the corresponding instanceDeployment object, and an error if there is any. -func (c *instanceDeployments) Get(name string, options v1.GetOptions) (result *v1alpha1.InstanceDeployment, err error) { - result = &v1alpha1.InstanceDeployment{} - err = c.client.Get(). - Resource("instancedeployments"). - Name(name). - VersionedParams(&options, scheme.ParameterCodec). - Do(). - Into(result) - return -} - -// List takes label and field selectors, and returns the list of InstanceDeployments that match those selectors. -func (c *instanceDeployments) List(opts v1.ListOptions) (result *v1alpha1.InstanceDeploymentList, err error) { - result = &v1alpha1.InstanceDeploymentList{} - err = c.client.Get(). - Resource("instancedeployments"). - VersionedParams(&opts, scheme.ParameterCodec). - Do(). - Into(result) - return -} - -// Watch returns a watch.Interface that watches the requested instanceDeployments. -func (c *instanceDeployments) Watch(opts v1.ListOptions) (watch.Interface, error) { - opts.Watch = true - return c.client.Get(). - Resource("instancedeployments"). - VersionedParams(&opts, scheme.ParameterCodec). - Watch() -} - -// Create takes the representation of a instanceDeployment and creates it. Returns the server's representation of the instanceDeployment, and an error, if there is any. -func (c *instanceDeployments) Create(instanceDeployment *v1alpha1.InstanceDeployment) (result *v1alpha1.InstanceDeployment, err error) { - result = &v1alpha1.InstanceDeployment{} - err = c.client.Post(). - Resource("instancedeployments"). - Body(instanceDeployment). - Do(). - Into(result) - return -} - -// Update takes the representation of a instanceDeployment and updates it. Returns the server's representation of the instanceDeployment, and an error, if there is any. -func (c *instanceDeployments) Update(instanceDeployment *v1alpha1.InstanceDeployment) (result *v1alpha1.InstanceDeployment, err error) { - result = &v1alpha1.InstanceDeployment{} - err = c.client.Put(). - Resource("instancedeployments"). - Name(instanceDeployment.Name). - Body(instanceDeployment). - 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 *instanceDeployments) UpdateStatus(instanceDeployment *v1alpha1.InstanceDeployment) (result *v1alpha1.InstanceDeployment, err error) { - result = &v1alpha1.InstanceDeployment{} - err = c.client.Put(). - Resource("instancedeployments"). - Name(instanceDeployment.Name). - SubResource("status"). - Body(instanceDeployment). - Do(). - Into(result) - return -} - -// Delete takes name of the instanceDeployment and deletes it. Returns an error if one occurs. -func (c *instanceDeployments) Delete(name string, options *v1.DeleteOptions) error { - return c.client.Delete(). - Resource("instancedeployments"). - Name(name). - Body(options). - Do(). - Error() -} - -// DeleteCollection deletes a collection of objects. -func (c *instanceDeployments) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error { - return c.client.Delete(). - Resource("instancedeployments"). - VersionedParams(&listOptions, scheme.ParameterCodec). - Body(options). - Do(). - Error() -} - -// Patch applies the patch and returns the patched instanceDeployment. -func (c *instanceDeployments) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1alpha1.InstanceDeployment, err error) { - result = &v1alpha1.InstanceDeployment{} - err = c.client.Patch(pt). - Resource("instancedeployments"). - SubResource(subresources...). - Name(name). - Body(data). - Do(). - Into(result) - return -} - -// GetScale takes name of the instanceDeployment, and returns the corresponding v1alpha1.Scale object, and an error if there is any. -func (c *instanceDeployments) GetScale(instanceDeploymentName string, options v1.GetOptions) (result *v1alpha1.Scale, err error) { - result = &v1alpha1.Scale{} - err = c.client.Get(). - Resource("instancedeployments"). - Name(instanceDeploymentName). - SubResource("scale"). - VersionedParams(&options, scheme.ParameterCodec). - Do(). - Into(result) - return -} - -// UpdateScale takes the top resource name and the representation of a scale and updates it. Returns the server's representation of the scale, and an error, if there is any. -func (c *instanceDeployments) UpdateScale(instanceDeploymentName string, scale *v1alpha1.Scale) (result *v1alpha1.Scale, err error) { - result = &v1alpha1.Scale{} - err = c.client.Put(). - Resource("instancedeployments"). - Name(instanceDeploymentName). - SubResource("scale"). - Body(scale). - Do(). - Into(result) - return -} diff --git a/pkg/client/clientset/typed/node/v1alpha1/instanceset.go b/pkg/client/clientset/typed/node/v1alpha1/instanceset.go deleted file mode 100644 index 6a2383e84..000000000 --- a/pkg/client/clientset/typed/node/v1alpha1/instanceset.go +++ /dev/null @@ -1,145 +0,0 @@ -package v1alpha1 - -import ( - v1alpha1 "github.com/gardener/node-controller-manager/pkg/apis/node/v1alpha1" - scheme "github.com/gardener/node-controller-manager/pkg/client/clientset/scheme" - v1 "k8s.io/apimachinery/pkg/apis/meta/v1" - types "k8s.io/apimachinery/pkg/types" - watch "k8s.io/apimachinery/pkg/watch" - rest "k8s.io/client-go/rest" -) - -// InstanceSetsGetter has a method to return a InstanceSetInterface. -// A group's client should implement this interface. -type InstanceSetsGetter interface { - InstanceSets() InstanceSetInterface -} - -// InstanceSetInterface has methods to work with InstanceSet resources. -type InstanceSetInterface interface { - Create(*v1alpha1.InstanceSet) (*v1alpha1.InstanceSet, error) - Update(*v1alpha1.InstanceSet) (*v1alpha1.InstanceSet, error) - UpdateStatus(*v1alpha1.InstanceSet) (*v1alpha1.InstanceSet, error) - Delete(name string, options *v1.DeleteOptions) error - DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error - Get(name string, options v1.GetOptions) (*v1alpha1.InstanceSet, error) - List(opts v1.ListOptions) (*v1alpha1.InstanceSetList, error) - Watch(opts v1.ListOptions) (watch.Interface, error) - Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1alpha1.InstanceSet, err error) - InstanceSetExpansion -} - -// instanceSets implements InstanceSetInterface -type instanceSets struct { - client rest.Interface -} - -// newInstanceSets returns a InstanceSets -func newInstanceSets(c *NodeV1alpha1Client) *instanceSets { - return &instanceSets{ - client: c.RESTClient(), - } -} - -// Get takes name of the instanceSet, and returns the corresponding instanceSet object, and an error if there is any. -func (c *instanceSets) Get(name string, options v1.GetOptions) (result *v1alpha1.InstanceSet, err error) { - result = &v1alpha1.InstanceSet{} - err = c.client.Get(). - Resource("instancesets"). - Name(name). - VersionedParams(&options, scheme.ParameterCodec). - Do(). - Into(result) - return -} - -// List takes label and field selectors, and returns the list of InstanceSets that match those selectors. -func (c *instanceSets) List(opts v1.ListOptions) (result *v1alpha1.InstanceSetList, err error) { - result = &v1alpha1.InstanceSetList{} - err = c.client.Get(). - Resource("instancesets"). - VersionedParams(&opts, scheme.ParameterCodec). - Do(). - Into(result) - return -} - -// Watch returns a watch.Interface that watches the requested instanceSets. -func (c *instanceSets) Watch(opts v1.ListOptions) (watch.Interface, error) { - opts.Watch = true - return c.client.Get(). - Resource("instancesets"). - VersionedParams(&opts, scheme.ParameterCodec). - Watch() -} - -// Create takes the representation of a instanceSet and creates it. Returns the server's representation of the instanceSet, and an error, if there is any. -func (c *instanceSets) Create(instanceSet *v1alpha1.InstanceSet) (result *v1alpha1.InstanceSet, err error) { - result = &v1alpha1.InstanceSet{} - err = c.client.Post(). - Resource("instancesets"). - Body(instanceSet). - Do(). - Into(result) - return -} - -// Update takes the representation of a instanceSet and updates it. Returns the server's representation of the instanceSet, and an error, if there is any. -func (c *instanceSets) Update(instanceSet *v1alpha1.InstanceSet) (result *v1alpha1.InstanceSet, err error) { - result = &v1alpha1.InstanceSet{} - err = c.client.Put(). - Resource("instancesets"). - Name(instanceSet.Name). - Body(instanceSet). - 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 *instanceSets) UpdateStatus(instanceSet *v1alpha1.InstanceSet) (result *v1alpha1.InstanceSet, err error) { - result = &v1alpha1.InstanceSet{} - err = c.client.Put(). - Resource("instancesets"). - Name(instanceSet.Name). - SubResource("status"). - Body(instanceSet). - Do(). - Into(result) - return -} - -// Delete takes name of the instanceSet and deletes it. Returns an error if one occurs. -func (c *instanceSets) Delete(name string, options *v1.DeleteOptions) error { - return c.client.Delete(). - Resource("instancesets"). - Name(name). - Body(options). - Do(). - Error() -} - -// DeleteCollection deletes a collection of objects. -func (c *instanceSets) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error { - return c.client.Delete(). - Resource("instancesets"). - VersionedParams(&listOptions, scheme.ParameterCodec). - Body(options). - Do(). - Error() -} - -// Patch applies the patch and returns the patched instanceSet. -func (c *instanceSets) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1alpha1.InstanceSet, err error) { - result = &v1alpha1.InstanceSet{} - err = c.client.Patch(pt). - Resource("instancesets"). - SubResource(subresources...). - Name(name). - Body(data). - Do(). - Into(result) - return -} diff --git a/pkg/client/clientset/typed/node/v1alpha1/instancetemplate.go b/pkg/client/clientset/typed/node/v1alpha1/instancetemplate.go deleted file mode 100644 index d8b54e477..000000000 --- a/pkg/client/clientset/typed/node/v1alpha1/instancetemplate.go +++ /dev/null @@ -1,139 +0,0 @@ -package v1alpha1 - -import ( - v1alpha1 "github.com/gardener/node-controller-manager/pkg/apis/node/v1alpha1" - scheme "github.com/gardener/node-controller-manager/pkg/client/clientset/scheme" - v1 "k8s.io/apimachinery/pkg/apis/meta/v1" - types "k8s.io/apimachinery/pkg/types" - watch "k8s.io/apimachinery/pkg/watch" - rest "k8s.io/client-go/rest" -) - -// InstanceTemplatesGetter has a method to return a InstanceTemplateInterface. -// A group's client should implement this interface. -type InstanceTemplatesGetter interface { - InstanceTemplates(namespace string) InstanceTemplateInterface -} - -// InstanceTemplateInterface has methods to work with InstanceTemplate resources. -type InstanceTemplateInterface interface { - Create(*v1alpha1.InstanceTemplate) (*v1alpha1.InstanceTemplate, error) - Update(*v1alpha1.InstanceTemplate) (*v1alpha1.InstanceTemplate, error) - Delete(name string, options *v1.DeleteOptions) error - DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error - Get(name string, options v1.GetOptions) (*v1alpha1.InstanceTemplate, error) - List(opts v1.ListOptions) (*v1alpha1.InstanceTemplateList, error) - Watch(opts v1.ListOptions) (watch.Interface, error) - Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1alpha1.InstanceTemplate, err error) - InstanceTemplateExpansion -} - -// instanceTemplates implements InstanceTemplateInterface -type instanceTemplates struct { - client rest.Interface - ns string -} - -// newInstanceTemplates returns a InstanceTemplates -func newInstanceTemplates(c *NodeV1alpha1Client, namespace string) *instanceTemplates { - return &instanceTemplates{ - client: c.RESTClient(), - ns: namespace, - } -} - -// Get takes name of the instanceTemplate, and returns the corresponding instanceTemplate object, and an error if there is any. -func (c *instanceTemplates) Get(name string, options v1.GetOptions) (result *v1alpha1.InstanceTemplate, err error) { - result = &v1alpha1.InstanceTemplate{} - err = c.client.Get(). - Namespace(c.ns). - Resource("instancetemplates"). - Name(name). - VersionedParams(&options, scheme.ParameterCodec). - Do(). - Into(result) - return -} - -// List takes label and field selectors, and returns the list of InstanceTemplates that match those selectors. -func (c *instanceTemplates) List(opts v1.ListOptions) (result *v1alpha1.InstanceTemplateList, err error) { - result = &v1alpha1.InstanceTemplateList{} - err = c.client.Get(). - Namespace(c.ns). - Resource("instancetemplates"). - VersionedParams(&opts, scheme.ParameterCodec). - Do(). - Into(result) - return -} - -// Watch returns a watch.Interface that watches the requested instanceTemplates. -func (c *instanceTemplates) Watch(opts v1.ListOptions) (watch.Interface, error) { - opts.Watch = true - return c.client.Get(). - Namespace(c.ns). - Resource("instancetemplates"). - VersionedParams(&opts, scheme.ParameterCodec). - Watch() -} - -// Create takes the representation of a instanceTemplate and creates it. Returns the server's representation of the instanceTemplate, and an error, if there is any. -func (c *instanceTemplates) Create(instanceTemplate *v1alpha1.InstanceTemplate) (result *v1alpha1.InstanceTemplate, err error) { - result = &v1alpha1.InstanceTemplate{} - err = c.client.Post(). - Namespace(c.ns). - Resource("instancetemplates"). - Body(instanceTemplate). - Do(). - Into(result) - return -} - -// Update takes the representation of a instanceTemplate and updates it. Returns the server's representation of the instanceTemplate, and an error, if there is any. -func (c *instanceTemplates) Update(instanceTemplate *v1alpha1.InstanceTemplate) (result *v1alpha1.InstanceTemplate, err error) { - result = &v1alpha1.InstanceTemplate{} - err = c.client.Put(). - Namespace(c.ns). - Resource("instancetemplates"). - Name(instanceTemplate.Name). - Body(instanceTemplate). - Do(). - Into(result) - return -} - -// Delete takes name of the instanceTemplate and deletes it. Returns an error if one occurs. -func (c *instanceTemplates) Delete(name string, options *v1.DeleteOptions) error { - return c.client.Delete(). - Namespace(c.ns). - Resource("instancetemplates"). - Name(name). - Body(options). - Do(). - Error() -} - -// DeleteCollection deletes a collection of objects. -func (c *instanceTemplates) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error { - return c.client.Delete(). - Namespace(c.ns). - Resource("instancetemplates"). - VersionedParams(&listOptions, scheme.ParameterCodec). - Body(options). - Do(). - Error() -} - -// Patch applies the patch and returns the patched instanceTemplate. -func (c *instanceTemplates) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1alpha1.InstanceTemplate, err error) { - result = &v1alpha1.InstanceTemplate{} - err = c.client.Patch(pt). - Namespace(c.ns). - Resource("instancetemplates"). - SubResource(subresources...). - Name(name). - Body(data). - Do(). - Into(result) - return -} diff --git a/pkg/client/clientset/typed/node/v1alpha1/node_client.go b/pkg/client/clientset/typed/node/v1alpha1/node_client.go deleted file mode 100644 index 6f8ee87e0..000000000 --- a/pkg/client/clientset/typed/node/v1alpha1/node_client.go +++ /dev/null @@ -1,97 +0,0 @@ -package v1alpha1 - -import ( - v1alpha1 "github.com/gardener/node-controller-manager/pkg/apis/node/v1alpha1" - "github.com/gardener/node-controller-manager/pkg/client/clientset/scheme" - serializer "k8s.io/apimachinery/pkg/runtime/serializer" - rest "k8s.io/client-go/rest" -) - -type NodeV1alpha1Interface interface { - RESTClient() rest.Interface - AWSInstanceClassesGetter - InstancesGetter - InstanceDeploymentsGetter - InstanceSetsGetter - InstanceTemplatesGetter - ScalesGetter -} - -// NodeV1alpha1Client is used to interact with features provided by the node.sapcloud.io group. -type NodeV1alpha1Client struct { - restClient rest.Interface -} - -func (c *NodeV1alpha1Client) AWSInstanceClasses() AWSInstanceClassInterface { - return newAWSInstanceClasses(c) -} - -func (c *NodeV1alpha1Client) Instances() InstanceInterface { - return newInstances(c) -} - -func (c *NodeV1alpha1Client) InstanceDeployments() InstanceDeploymentInterface { - return newInstanceDeployments(c) -} - -func (c *NodeV1alpha1Client) InstanceSets() InstanceSetInterface { - return newInstanceSets(c) -} - -func (c *NodeV1alpha1Client) InstanceTemplates(namespace string) InstanceTemplateInterface { - return newInstanceTemplates(c, namespace) -} - -func (c *NodeV1alpha1Client) Scales(namespace string) ScaleInterface { - return newScales(c, namespace) -} - -// NewForConfig creates a new NodeV1alpha1Client for the given config. -func NewForConfig(c *rest.Config) (*NodeV1alpha1Client, error) { - config := *c - if err := setConfigDefaults(&config); err != nil { - return nil, err - } - client, err := rest.RESTClientFor(&config) - if err != nil { - return nil, err - } - return &NodeV1alpha1Client{client}, nil -} - -// NewForConfigOrDie creates a new NodeV1alpha1Client for the given config and -// panics if there is an error in the config. -func NewForConfigOrDie(c *rest.Config) *NodeV1alpha1Client { - client, err := NewForConfig(c) - if err != nil { - panic(err) - } - return client -} - -// New creates a new NodeV1alpha1Client for the given RESTClient. -func New(c rest.Interface) *NodeV1alpha1Client { - return &NodeV1alpha1Client{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 *NodeV1alpha1Client) RESTClient() rest.Interface { - if c == nil { - return nil - } - return c.restClient -} diff --git a/pkg/client/informers/externalversions/factory.go b/pkg/client/informers/externalversions/factory.go index 6a51a9608..3ac156c59 100644 --- a/pkg/client/informers/externalversions/factory.go +++ b/pkg/client/informers/externalversions/factory.go @@ -5,7 +5,7 @@ package externalversions import ( clientset "github.com/gardener/node-controller-manager/pkg/client/clientset" internalinterfaces "github.com/gardener/node-controller-manager/pkg/client/informers/externalversions/internalinterfaces" - node "github.com/gardener/node-controller-manager/pkg/client/informers/externalversions/node" + machine "github.com/gardener/node-controller-manager/pkg/client/informers/externalversions/machine" runtime "k8s.io/apimachinery/pkg/runtime" schema "k8s.io/apimachinery/pkg/runtime/schema" cache "k8s.io/client-go/tools/cache" @@ -94,9 +94,9 @@ type SharedInformerFactory interface { ForResource(resource schema.GroupVersionResource) (GenericInformer, error) WaitForCacheSync(stopCh <-chan struct{}) map[reflect.Type]bool - Node() node.Interface + Machine() machine.Interface } -func (f *sharedInformerFactory) Node() node.Interface { - return node.New(f) +func (f *sharedInformerFactory) Machine() machine.Interface { + return machine.New(f) } diff --git a/pkg/client/informers/externalversions/generic.go b/pkg/client/informers/externalversions/generic.go index 268082bdb..9d40d2e3a 100644 --- a/pkg/client/informers/externalversions/generic.go +++ b/pkg/client/informers/externalversions/generic.go @@ -4,7 +4,7 @@ package externalversions import ( "fmt" - v1alpha1 "github.com/gardener/node-controller-manager/pkg/apis/node/v1alpha1" + v1alpha1 "github.com/gardener/node-controller-manager/pkg/apis/machine/v1alpha1" schema "k8s.io/apimachinery/pkg/runtime/schema" cache "k8s.io/client-go/tools/cache" ) @@ -35,17 +35,17 @@ func (f *genericInformer) Lister() cache.GenericLister { // TODO extend this to unknown resources with a client pool func (f *sharedInformerFactory) ForResource(resource schema.GroupVersionResource) (GenericInformer, error) { switch resource { - // Group=Node, Version=V1alpha1 - case v1alpha1.SchemeGroupVersion.WithResource("awsinstanceclasses"): - return &genericInformer{resource: resource.GroupResource(), informer: f.Node().V1alpha1().AWSInstanceClasses().Informer()}, nil - case v1alpha1.SchemeGroupVersion.WithResource("instances"): - return &genericInformer{resource: resource.GroupResource(), informer: f.Node().V1alpha1().Instances().Informer()}, nil - case v1alpha1.SchemeGroupVersion.WithResource("instancedeployments"): - return &genericInformer{resource: resource.GroupResource(), informer: f.Node().V1alpha1().InstanceDeployments().Informer()}, nil - case v1alpha1.SchemeGroupVersion.WithResource("instancesets"): - return &genericInformer{resource: resource.GroupResource(), informer: f.Node().V1alpha1().InstanceSets().Informer()}, nil - case v1alpha1.SchemeGroupVersion.WithResource("instancetemplates"): - return &genericInformer{resource: resource.GroupResource(), informer: f.Node().V1alpha1().InstanceTemplates().Informer()}, nil + // Group=Machine, Version=V1alpha1 + case v1alpha1.SchemeGroupVersion.WithResource("awsmachineclasses"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Machine().V1alpha1().AWSMachineClasses().Informer()}, nil + case v1alpha1.SchemeGroupVersion.WithResource("machines"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Machine().V1alpha1().Machines().Informer()}, nil + case v1alpha1.SchemeGroupVersion.WithResource("machinedeployments"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Machine().V1alpha1().MachineDeployments().Informer()}, nil + case v1alpha1.SchemeGroupVersion.WithResource("machinesets"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Machine().V1alpha1().MachineSets().Informer()}, nil + case v1alpha1.SchemeGroupVersion.WithResource("machinetemplates"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Machine().V1alpha1().MachineTemplates().Informer()}, nil } diff --git a/pkg/client/informers/externalversions/node/interface.go b/pkg/client/informers/externalversions/machine/interface.go similarity index 92% rename from pkg/client/informers/externalversions/node/interface.go rename to pkg/client/informers/externalversions/machine/interface.go index c9f84b492..a9819df01 100644 --- a/pkg/client/informers/externalversions/node/interface.go +++ b/pkg/client/informers/externalversions/machine/interface.go @@ -1,10 +1,10 @@ // This file was automatically generated by informer-gen -package node +package machine import ( internalinterfaces "github.com/gardener/node-controller-manager/pkg/client/informers/externalversions/internalinterfaces" - v1alpha1 "github.com/gardener/node-controller-manager/pkg/client/informers/externalversions/node/v1alpha1" + v1alpha1 "github.com/gardener/node-controller-manager/pkg/client/informers/externalversions/machine/v1alpha1" ) // Interface provides access to each of this group's versions. diff --git a/pkg/client/informers/externalversions/machine/v1alpha1/awsmachineclass.go b/pkg/client/informers/externalversions/machine/v1alpha1/awsmachineclass.go new file mode 100644 index 000000000..85604dda8 --- /dev/null +++ b/pkg/client/informers/externalversions/machine/v1alpha1/awsmachineclass.go @@ -0,0 +1,57 @@ +// This file was automatically generated by informer-gen + +package v1alpha1 + +import ( + machine_v1alpha1 "github.com/gardener/node-controller-manager/pkg/apis/machine/v1alpha1" + clientset "github.com/gardener/node-controller-manager/pkg/client/clientset" + internalinterfaces "github.com/gardener/node-controller-manager/pkg/client/informers/externalversions/internalinterfaces" + v1alpha1 "github.com/gardener/node-controller-manager/pkg/client/listers/machine/v1alpha1" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + watch "k8s.io/apimachinery/pkg/watch" + cache "k8s.io/client-go/tools/cache" + time "time" +) + +// AWSMachineClassInformer provides access to a shared informer and lister for +// AWSMachineClasses. +type AWSMachineClassInformer interface { + Informer() cache.SharedIndexInformer + Lister() v1alpha1.AWSMachineClassLister +} + +type aWSMachineClassInformer struct { + factory internalinterfaces.SharedInformerFactory +} + +// NewAWSMachineClassInformer constructs a new informer for AWSMachineClass 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 NewAWSMachineClassInformer(client clientset.Interface, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return cache.NewSharedIndexInformer( + &cache.ListWatch{ + ListFunc: func(options v1.ListOptions) (runtime.Object, error) { + return client.MachineV1alpha1().AWSMachineClasses().List(options) + }, + WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { + return client.MachineV1alpha1().AWSMachineClasses().Watch(options) + }, + }, + &machine_v1alpha1.AWSMachineClass{}, + resyncPeriod, + indexers, + ) +} + +func defaultAWSMachineClassInformer(client clientset.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewAWSMachineClassInformer(client, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}) +} + +func (f *aWSMachineClassInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&machine_v1alpha1.AWSMachineClass{}, defaultAWSMachineClassInformer) +} + +func (f *aWSMachineClassInformer) Lister() v1alpha1.AWSMachineClassLister { + return v1alpha1.NewAWSMachineClassLister(f.Informer().GetIndexer()) +} diff --git a/pkg/client/informers/externalversions/machine/v1alpha1/interface.go b/pkg/client/informers/externalversions/machine/v1alpha1/interface.go new file mode 100644 index 000000000..42cc96510 --- /dev/null +++ b/pkg/client/informers/externalversions/machine/v1alpha1/interface.go @@ -0,0 +1,55 @@ +// This file was automatically generated by informer-gen + +package v1alpha1 + +import ( + internalinterfaces "github.com/gardener/node-controller-manager/pkg/client/informers/externalversions/internalinterfaces" +) + +// Interface provides access to all the informers in this group version. +type Interface interface { + // AWSMachineClasses returns a AWSMachineClassInformer. + AWSMachineClasses() AWSMachineClassInformer + // Machines returns a MachineInformer. + Machines() MachineInformer + // MachineDeployments returns a MachineDeploymentInformer. + MachineDeployments() MachineDeploymentInformer + // MachineSets returns a MachineSetInformer. + MachineSets() MachineSetInformer + // MachineTemplates returns a MachineTemplateInformer. + MachineTemplates() MachineTemplateInformer +} + +type version struct { + internalinterfaces.SharedInformerFactory +} + +// New returns a new Interface. +func New(f internalinterfaces.SharedInformerFactory) Interface { + return &version{f} +} + +// AWSMachineClasses returns a AWSMachineClassInformer. +func (v *version) AWSMachineClasses() AWSMachineClassInformer { + return &aWSMachineClassInformer{factory: v.SharedInformerFactory} +} + +// Machines returns a MachineInformer. +func (v *version) Machines() MachineInformer { + return &machineInformer{factory: v.SharedInformerFactory} +} + +// MachineDeployments returns a MachineDeploymentInformer. +func (v *version) MachineDeployments() MachineDeploymentInformer { + return &machineDeploymentInformer{factory: v.SharedInformerFactory} +} + +// MachineSets returns a MachineSetInformer. +func (v *version) MachineSets() MachineSetInformer { + return &machineSetInformer{factory: v.SharedInformerFactory} +} + +// MachineTemplates returns a MachineTemplateInformer. +func (v *version) MachineTemplates() MachineTemplateInformer { + return &machineTemplateInformer{factory: v.SharedInformerFactory} +} diff --git a/pkg/client/informers/externalversions/machine/v1alpha1/machine.go b/pkg/client/informers/externalversions/machine/v1alpha1/machine.go new file mode 100644 index 000000000..0f5025411 --- /dev/null +++ b/pkg/client/informers/externalversions/machine/v1alpha1/machine.go @@ -0,0 +1,57 @@ +// This file was automatically generated by informer-gen + +package v1alpha1 + +import ( + machine_v1alpha1 "github.com/gardener/node-controller-manager/pkg/apis/machine/v1alpha1" + clientset "github.com/gardener/node-controller-manager/pkg/client/clientset" + internalinterfaces "github.com/gardener/node-controller-manager/pkg/client/informers/externalversions/internalinterfaces" + v1alpha1 "github.com/gardener/node-controller-manager/pkg/client/listers/machine/v1alpha1" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + watch "k8s.io/apimachinery/pkg/watch" + cache "k8s.io/client-go/tools/cache" + time "time" +) + +// 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 +} + +// 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 clientset.Interface, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return cache.NewSharedIndexInformer( + &cache.ListWatch{ + ListFunc: func(options v1.ListOptions) (runtime.Object, error) { + return client.MachineV1alpha1().Machines().List(options) + }, + WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { + return client.MachineV1alpha1().Machines().Watch(options) + }, + }, + &machine_v1alpha1.Machine{}, + resyncPeriod, + indexers, + ) +} + +func defaultMachineInformer(client clientset.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewMachineInformer(client, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}) +} + +func (f *machineInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&machine_v1alpha1.Machine{}, defaultMachineInformer) +} + +func (f *machineInformer) Lister() v1alpha1.MachineLister { + return v1alpha1.NewMachineLister(f.Informer().GetIndexer()) +} diff --git a/pkg/client/informers/externalversions/machine/v1alpha1/machinedeployment.go b/pkg/client/informers/externalversions/machine/v1alpha1/machinedeployment.go new file mode 100644 index 000000000..0e0ae431e --- /dev/null +++ b/pkg/client/informers/externalversions/machine/v1alpha1/machinedeployment.go @@ -0,0 +1,57 @@ +// This file was automatically generated by informer-gen + +package v1alpha1 + +import ( + machine_v1alpha1 "github.com/gardener/node-controller-manager/pkg/apis/machine/v1alpha1" + clientset "github.com/gardener/node-controller-manager/pkg/client/clientset" + internalinterfaces "github.com/gardener/node-controller-manager/pkg/client/informers/externalversions/internalinterfaces" + v1alpha1 "github.com/gardener/node-controller-manager/pkg/client/listers/machine/v1alpha1" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + watch "k8s.io/apimachinery/pkg/watch" + cache "k8s.io/client-go/tools/cache" + time "time" +) + +// 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 +} + +// 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 clientset.Interface, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return cache.NewSharedIndexInformer( + &cache.ListWatch{ + ListFunc: func(options v1.ListOptions) (runtime.Object, error) { + return client.MachineV1alpha1().MachineDeployments().List(options) + }, + WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { + return client.MachineV1alpha1().MachineDeployments().Watch(options) + }, + }, + &machine_v1alpha1.MachineDeployment{}, + resyncPeriod, + indexers, + ) +} + +func defaultMachineDeploymentInformer(client clientset.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewMachineDeploymentInformer(client, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}) +} + +func (f *machineDeploymentInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&machine_v1alpha1.MachineDeployment{}, defaultMachineDeploymentInformer) +} + +func (f *machineDeploymentInformer) Lister() v1alpha1.MachineDeploymentLister { + return v1alpha1.NewMachineDeploymentLister(f.Informer().GetIndexer()) +} diff --git a/pkg/client/informers/externalversions/machine/v1alpha1/machineset.go b/pkg/client/informers/externalversions/machine/v1alpha1/machineset.go new file mode 100644 index 000000000..74c7e7806 --- /dev/null +++ b/pkg/client/informers/externalversions/machine/v1alpha1/machineset.go @@ -0,0 +1,57 @@ +// This file was automatically generated by informer-gen + +package v1alpha1 + +import ( + machine_v1alpha1 "github.com/gardener/node-controller-manager/pkg/apis/machine/v1alpha1" + clientset "github.com/gardener/node-controller-manager/pkg/client/clientset" + internalinterfaces "github.com/gardener/node-controller-manager/pkg/client/informers/externalversions/internalinterfaces" + v1alpha1 "github.com/gardener/node-controller-manager/pkg/client/listers/machine/v1alpha1" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + watch "k8s.io/apimachinery/pkg/watch" + cache "k8s.io/client-go/tools/cache" + time "time" +) + +// 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 +} + +// 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 clientset.Interface, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return cache.NewSharedIndexInformer( + &cache.ListWatch{ + ListFunc: func(options v1.ListOptions) (runtime.Object, error) { + return client.MachineV1alpha1().MachineSets().List(options) + }, + WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { + return client.MachineV1alpha1().MachineSets().Watch(options) + }, + }, + &machine_v1alpha1.MachineSet{}, + resyncPeriod, + indexers, + ) +} + +func defaultMachineSetInformer(client clientset.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewMachineSetInformer(client, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}) +} + +func (f *machineSetInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&machine_v1alpha1.MachineSet{}, defaultMachineSetInformer) +} + +func (f *machineSetInformer) Lister() v1alpha1.MachineSetLister { + return v1alpha1.NewMachineSetLister(f.Informer().GetIndexer()) +} diff --git a/pkg/client/informers/externalversions/machine/v1alpha1/machinetemplate.go b/pkg/client/informers/externalversions/machine/v1alpha1/machinetemplate.go new file mode 100644 index 000000000..c1a32559f --- /dev/null +++ b/pkg/client/informers/externalversions/machine/v1alpha1/machinetemplate.go @@ -0,0 +1,57 @@ +// This file was automatically generated by informer-gen + +package v1alpha1 + +import ( + machine_v1alpha1 "github.com/gardener/node-controller-manager/pkg/apis/machine/v1alpha1" + clientset "github.com/gardener/node-controller-manager/pkg/client/clientset" + internalinterfaces "github.com/gardener/node-controller-manager/pkg/client/informers/externalversions/internalinterfaces" + v1alpha1 "github.com/gardener/node-controller-manager/pkg/client/listers/machine/v1alpha1" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + watch "k8s.io/apimachinery/pkg/watch" + cache "k8s.io/client-go/tools/cache" + time "time" +) + +// MachineTemplateInformer provides access to a shared informer and lister for +// MachineTemplates. +type MachineTemplateInformer interface { + Informer() cache.SharedIndexInformer + Lister() v1alpha1.MachineTemplateLister +} + +type machineTemplateInformer struct { + factory internalinterfaces.SharedInformerFactory +} + +// NewMachineTemplateInformer constructs a new informer for MachineTemplate 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 NewMachineTemplateInformer(client clientset.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return cache.NewSharedIndexInformer( + &cache.ListWatch{ + ListFunc: func(options v1.ListOptions) (runtime.Object, error) { + return client.MachineV1alpha1().MachineTemplates(namespace).List(options) + }, + WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { + return client.MachineV1alpha1().MachineTemplates(namespace).Watch(options) + }, + }, + &machine_v1alpha1.MachineTemplate{}, + resyncPeriod, + indexers, + ) +} + +func defaultMachineTemplateInformer(client clientset.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewMachineTemplateInformer(client, v1.NamespaceAll, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}) +} + +func (f *machineTemplateInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&machine_v1alpha1.MachineTemplate{}, defaultMachineTemplateInformer) +} + +func (f *machineTemplateInformer) Lister() v1alpha1.MachineTemplateLister { + return v1alpha1.NewMachineTemplateLister(f.Informer().GetIndexer()) +} diff --git a/pkg/client/informers/externalversions/node/v1alpha1/awsinstanceclass.go b/pkg/client/informers/externalversions/node/v1alpha1/awsinstanceclass.go deleted file mode 100644 index 7f9dc9d60..000000000 --- a/pkg/client/informers/externalversions/node/v1alpha1/awsinstanceclass.go +++ /dev/null @@ -1,57 +0,0 @@ -// This file was automatically generated by informer-gen - -package v1alpha1 - -import ( - node_v1alpha1 "github.com/gardener/node-controller-manager/pkg/apis/node/v1alpha1" - clientset "github.com/gardener/node-controller-manager/pkg/client/clientset" - internalinterfaces "github.com/gardener/node-controller-manager/pkg/client/informers/externalversions/internalinterfaces" - v1alpha1 "github.com/gardener/node-controller-manager/pkg/client/listers/node/v1alpha1" - v1 "k8s.io/apimachinery/pkg/apis/meta/v1" - runtime "k8s.io/apimachinery/pkg/runtime" - watch "k8s.io/apimachinery/pkg/watch" - cache "k8s.io/client-go/tools/cache" - time "time" -) - -// AWSInstanceClassInformer provides access to a shared informer and lister for -// AWSInstanceClasses. -type AWSInstanceClassInformer interface { - Informer() cache.SharedIndexInformer - Lister() v1alpha1.AWSInstanceClassLister -} - -type aWSInstanceClassInformer struct { - factory internalinterfaces.SharedInformerFactory -} - -// NewAWSInstanceClassInformer constructs a new informer for AWSInstanceClass 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 NewAWSInstanceClassInformer(client clientset.Interface, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { - return cache.NewSharedIndexInformer( - &cache.ListWatch{ - ListFunc: func(options v1.ListOptions) (runtime.Object, error) { - return client.NodeV1alpha1().AWSInstanceClasses().List(options) - }, - WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { - return client.NodeV1alpha1().AWSInstanceClasses().Watch(options) - }, - }, - &node_v1alpha1.AWSInstanceClass{}, - resyncPeriod, - indexers, - ) -} - -func defaultAWSInstanceClassInformer(client clientset.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { - return NewAWSInstanceClassInformer(client, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}) -} - -func (f *aWSInstanceClassInformer) Informer() cache.SharedIndexInformer { - return f.factory.InformerFor(&node_v1alpha1.AWSInstanceClass{}, defaultAWSInstanceClassInformer) -} - -func (f *aWSInstanceClassInformer) Lister() v1alpha1.AWSInstanceClassLister { - return v1alpha1.NewAWSInstanceClassLister(f.Informer().GetIndexer()) -} diff --git a/pkg/client/informers/externalversions/node/v1alpha1/instance.go b/pkg/client/informers/externalversions/node/v1alpha1/instance.go deleted file mode 100644 index 50e3cc641..000000000 --- a/pkg/client/informers/externalversions/node/v1alpha1/instance.go +++ /dev/null @@ -1,57 +0,0 @@ -// This file was automatically generated by informer-gen - -package v1alpha1 - -import ( - node_v1alpha1 "github.com/gardener/node-controller-manager/pkg/apis/node/v1alpha1" - clientset "github.com/gardener/node-controller-manager/pkg/client/clientset" - internalinterfaces "github.com/gardener/node-controller-manager/pkg/client/informers/externalversions/internalinterfaces" - v1alpha1 "github.com/gardener/node-controller-manager/pkg/client/listers/node/v1alpha1" - v1 "k8s.io/apimachinery/pkg/apis/meta/v1" - runtime "k8s.io/apimachinery/pkg/runtime" - watch "k8s.io/apimachinery/pkg/watch" - cache "k8s.io/client-go/tools/cache" - time "time" -) - -// InstanceInformer provides access to a shared informer and lister for -// Instances. -type InstanceInformer interface { - Informer() cache.SharedIndexInformer - Lister() v1alpha1.InstanceLister -} - -type instanceInformer struct { - factory internalinterfaces.SharedInformerFactory -} - -// NewInstanceInformer constructs a new informer for Instance 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 NewInstanceInformer(client clientset.Interface, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { - return cache.NewSharedIndexInformer( - &cache.ListWatch{ - ListFunc: func(options v1.ListOptions) (runtime.Object, error) { - return client.NodeV1alpha1().Instances().List(options) - }, - WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { - return client.NodeV1alpha1().Instances().Watch(options) - }, - }, - &node_v1alpha1.Instance{}, - resyncPeriod, - indexers, - ) -} - -func defaultInstanceInformer(client clientset.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { - return NewInstanceInformer(client, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}) -} - -func (f *instanceInformer) Informer() cache.SharedIndexInformer { - return f.factory.InformerFor(&node_v1alpha1.Instance{}, defaultInstanceInformer) -} - -func (f *instanceInformer) Lister() v1alpha1.InstanceLister { - return v1alpha1.NewInstanceLister(f.Informer().GetIndexer()) -} diff --git a/pkg/client/informers/externalversions/node/v1alpha1/instancedeployment.go b/pkg/client/informers/externalversions/node/v1alpha1/instancedeployment.go deleted file mode 100644 index b4dcadbd5..000000000 --- a/pkg/client/informers/externalversions/node/v1alpha1/instancedeployment.go +++ /dev/null @@ -1,57 +0,0 @@ -// This file was automatically generated by informer-gen - -package v1alpha1 - -import ( - node_v1alpha1 "github.com/gardener/node-controller-manager/pkg/apis/node/v1alpha1" - clientset "github.com/gardener/node-controller-manager/pkg/client/clientset" - internalinterfaces "github.com/gardener/node-controller-manager/pkg/client/informers/externalversions/internalinterfaces" - v1alpha1 "github.com/gardener/node-controller-manager/pkg/client/listers/node/v1alpha1" - v1 "k8s.io/apimachinery/pkg/apis/meta/v1" - runtime "k8s.io/apimachinery/pkg/runtime" - watch "k8s.io/apimachinery/pkg/watch" - cache "k8s.io/client-go/tools/cache" - time "time" -) - -// InstanceDeploymentInformer provides access to a shared informer and lister for -// InstanceDeployments. -type InstanceDeploymentInformer interface { - Informer() cache.SharedIndexInformer - Lister() v1alpha1.InstanceDeploymentLister -} - -type instanceDeploymentInformer struct { - factory internalinterfaces.SharedInformerFactory -} - -// NewInstanceDeploymentInformer constructs a new informer for InstanceDeployment 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 NewInstanceDeploymentInformer(client clientset.Interface, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { - return cache.NewSharedIndexInformer( - &cache.ListWatch{ - ListFunc: func(options v1.ListOptions) (runtime.Object, error) { - return client.NodeV1alpha1().InstanceDeployments().List(options) - }, - WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { - return client.NodeV1alpha1().InstanceDeployments().Watch(options) - }, - }, - &node_v1alpha1.InstanceDeployment{}, - resyncPeriod, - indexers, - ) -} - -func defaultInstanceDeploymentInformer(client clientset.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { - return NewInstanceDeploymentInformer(client, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}) -} - -func (f *instanceDeploymentInformer) Informer() cache.SharedIndexInformer { - return f.factory.InformerFor(&node_v1alpha1.InstanceDeployment{}, defaultInstanceDeploymentInformer) -} - -func (f *instanceDeploymentInformer) Lister() v1alpha1.InstanceDeploymentLister { - return v1alpha1.NewInstanceDeploymentLister(f.Informer().GetIndexer()) -} diff --git a/pkg/client/informers/externalversions/node/v1alpha1/instanceset.go b/pkg/client/informers/externalversions/node/v1alpha1/instanceset.go deleted file mode 100644 index dc04832fa..000000000 --- a/pkg/client/informers/externalversions/node/v1alpha1/instanceset.go +++ /dev/null @@ -1,57 +0,0 @@ -// This file was automatically generated by informer-gen - -package v1alpha1 - -import ( - node_v1alpha1 "github.com/gardener/node-controller-manager/pkg/apis/node/v1alpha1" - clientset "github.com/gardener/node-controller-manager/pkg/client/clientset" - internalinterfaces "github.com/gardener/node-controller-manager/pkg/client/informers/externalversions/internalinterfaces" - v1alpha1 "github.com/gardener/node-controller-manager/pkg/client/listers/node/v1alpha1" - v1 "k8s.io/apimachinery/pkg/apis/meta/v1" - runtime "k8s.io/apimachinery/pkg/runtime" - watch "k8s.io/apimachinery/pkg/watch" - cache "k8s.io/client-go/tools/cache" - time "time" -) - -// InstanceSetInformer provides access to a shared informer and lister for -// InstanceSets. -type InstanceSetInformer interface { - Informer() cache.SharedIndexInformer - Lister() v1alpha1.InstanceSetLister -} - -type instanceSetInformer struct { - factory internalinterfaces.SharedInformerFactory -} - -// NewInstanceSetInformer constructs a new informer for InstanceSet 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 NewInstanceSetInformer(client clientset.Interface, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { - return cache.NewSharedIndexInformer( - &cache.ListWatch{ - ListFunc: func(options v1.ListOptions) (runtime.Object, error) { - return client.NodeV1alpha1().InstanceSets().List(options) - }, - WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { - return client.NodeV1alpha1().InstanceSets().Watch(options) - }, - }, - &node_v1alpha1.InstanceSet{}, - resyncPeriod, - indexers, - ) -} - -func defaultInstanceSetInformer(client clientset.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { - return NewInstanceSetInformer(client, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}) -} - -func (f *instanceSetInformer) Informer() cache.SharedIndexInformer { - return f.factory.InformerFor(&node_v1alpha1.InstanceSet{}, defaultInstanceSetInformer) -} - -func (f *instanceSetInformer) Lister() v1alpha1.InstanceSetLister { - return v1alpha1.NewInstanceSetLister(f.Informer().GetIndexer()) -} diff --git a/pkg/client/informers/externalversions/node/v1alpha1/instancetemplate.go b/pkg/client/informers/externalversions/node/v1alpha1/instancetemplate.go deleted file mode 100644 index 3caefe537..000000000 --- a/pkg/client/informers/externalversions/node/v1alpha1/instancetemplate.go +++ /dev/null @@ -1,57 +0,0 @@ -// This file was automatically generated by informer-gen - -package v1alpha1 - -import ( - node_v1alpha1 "github.com/gardener/node-controller-manager/pkg/apis/node/v1alpha1" - clientset "github.com/gardener/node-controller-manager/pkg/client/clientset" - internalinterfaces "github.com/gardener/node-controller-manager/pkg/client/informers/externalversions/internalinterfaces" - v1alpha1 "github.com/gardener/node-controller-manager/pkg/client/listers/node/v1alpha1" - v1 "k8s.io/apimachinery/pkg/apis/meta/v1" - runtime "k8s.io/apimachinery/pkg/runtime" - watch "k8s.io/apimachinery/pkg/watch" - cache "k8s.io/client-go/tools/cache" - time "time" -) - -// InstanceTemplateInformer provides access to a shared informer and lister for -// InstanceTemplates. -type InstanceTemplateInformer interface { - Informer() cache.SharedIndexInformer - Lister() v1alpha1.InstanceTemplateLister -} - -type instanceTemplateInformer struct { - factory internalinterfaces.SharedInformerFactory -} - -// NewInstanceTemplateInformer constructs a new informer for InstanceTemplate 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 NewInstanceTemplateInformer(client clientset.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { - return cache.NewSharedIndexInformer( - &cache.ListWatch{ - ListFunc: func(options v1.ListOptions) (runtime.Object, error) { - return client.NodeV1alpha1().InstanceTemplates(namespace).List(options) - }, - WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { - return client.NodeV1alpha1().InstanceTemplates(namespace).Watch(options) - }, - }, - &node_v1alpha1.InstanceTemplate{}, - resyncPeriod, - indexers, - ) -} - -func defaultInstanceTemplateInformer(client clientset.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { - return NewInstanceTemplateInformer(client, v1.NamespaceAll, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}) -} - -func (f *instanceTemplateInformer) Informer() cache.SharedIndexInformer { - return f.factory.InformerFor(&node_v1alpha1.InstanceTemplate{}, defaultInstanceTemplateInformer) -} - -func (f *instanceTemplateInformer) Lister() v1alpha1.InstanceTemplateLister { - return v1alpha1.NewInstanceTemplateLister(f.Informer().GetIndexer()) -} diff --git a/pkg/client/informers/externalversions/node/v1alpha1/interface.go b/pkg/client/informers/externalversions/node/v1alpha1/interface.go deleted file mode 100644 index 664a1a9f6..000000000 --- a/pkg/client/informers/externalversions/node/v1alpha1/interface.go +++ /dev/null @@ -1,55 +0,0 @@ -// This file was automatically generated by informer-gen - -package v1alpha1 - -import ( - internalinterfaces "github.com/gardener/node-controller-manager/pkg/client/informers/externalversions/internalinterfaces" -) - -// Interface provides access to all the informers in this group version. -type Interface interface { - // AWSInstanceClasses returns a AWSInstanceClassInformer. - AWSInstanceClasses() AWSInstanceClassInformer - // Instances returns a InstanceInformer. - Instances() InstanceInformer - // InstanceDeployments returns a InstanceDeploymentInformer. - InstanceDeployments() InstanceDeploymentInformer - // InstanceSets returns a InstanceSetInformer. - InstanceSets() InstanceSetInformer - // InstanceTemplates returns a InstanceTemplateInformer. - InstanceTemplates() InstanceTemplateInformer -} - -type version struct { - internalinterfaces.SharedInformerFactory -} - -// New returns a new Interface. -func New(f internalinterfaces.SharedInformerFactory) Interface { - return &version{f} -} - -// AWSInstanceClasses returns a AWSInstanceClassInformer. -func (v *version) AWSInstanceClasses() AWSInstanceClassInformer { - return &aWSInstanceClassInformer{factory: v.SharedInformerFactory} -} - -// Instances returns a InstanceInformer. -func (v *version) Instances() InstanceInformer { - return &instanceInformer{factory: v.SharedInformerFactory} -} - -// InstanceDeployments returns a InstanceDeploymentInformer. -func (v *version) InstanceDeployments() InstanceDeploymentInformer { - return &instanceDeploymentInformer{factory: v.SharedInformerFactory} -} - -// InstanceSets returns a InstanceSetInformer. -func (v *version) InstanceSets() InstanceSetInformer { - return &instanceSetInformer{factory: v.SharedInformerFactory} -} - -// InstanceTemplates returns a InstanceTemplateInformer. -func (v *version) InstanceTemplates() InstanceTemplateInformer { - return &instanceTemplateInformer{factory: v.SharedInformerFactory} -} diff --git a/pkg/client/informers/internalversion/factory.go b/pkg/client/informers/internalversion/factory.go index 346b2a625..35305ac5c 100644 --- a/pkg/client/informers/internalversion/factory.go +++ b/pkg/client/informers/internalversion/factory.go @@ -4,7 +4,7 @@ package internalversion import ( internalinterfaces "github.com/gardener/node-controller-manager/pkg/client/informers/internalversion/internalinterfaces" - node "github.com/gardener/node-controller-manager/pkg/client/informers/internalversion/node" + machine "github.com/gardener/node-controller-manager/pkg/client/informers/internalversion/machine" internalclientset "github.com/gardener/node-controller-manager/pkg/client/internalclientset" runtime "k8s.io/apimachinery/pkg/runtime" schema "k8s.io/apimachinery/pkg/runtime/schema" @@ -94,9 +94,9 @@ type SharedInformerFactory interface { ForResource(resource schema.GroupVersionResource) (GenericInformer, error) WaitForCacheSync(stopCh <-chan struct{}) map[reflect.Type]bool - Node() node.Interface + Machine() machine.Interface } -func (f *sharedInformerFactory) Node() node.Interface { - return node.New(f) +func (f *sharedInformerFactory) Machine() machine.Interface { + return machine.New(f) } diff --git a/pkg/client/informers/internalversion/generic.go b/pkg/client/informers/internalversion/generic.go index 6367a4c58..821d64581 100644 --- a/pkg/client/informers/internalversion/generic.go +++ b/pkg/client/informers/internalversion/generic.go @@ -4,7 +4,7 @@ package internalversion import ( "fmt" - node "github.com/gardener/node-controller-manager/pkg/apis/node" + machine "github.com/gardener/node-controller-manager/pkg/apis/machine" schema "k8s.io/apimachinery/pkg/runtime/schema" cache "k8s.io/client-go/tools/cache" ) @@ -35,17 +35,17 @@ func (f *genericInformer) Lister() cache.GenericLister { // TODO extend this to unknown resources with a client pool func (f *sharedInformerFactory) ForResource(resource schema.GroupVersionResource) (GenericInformer, error) { switch resource { - // Group=Node, Version=InternalVersion - case node.SchemeGroupVersion.WithResource("awsinstanceclasses"): - return &genericInformer{resource: resource.GroupResource(), informer: f.Node().InternalVersion().AWSInstanceClasses().Informer()}, nil - case node.SchemeGroupVersion.WithResource("instances"): - return &genericInformer{resource: resource.GroupResource(), informer: f.Node().InternalVersion().Instances().Informer()}, nil - case node.SchemeGroupVersion.WithResource("instancedeployments"): - return &genericInformer{resource: resource.GroupResource(), informer: f.Node().InternalVersion().InstanceDeployments().Informer()}, nil - case node.SchemeGroupVersion.WithResource("instancesets"): - return &genericInformer{resource: resource.GroupResource(), informer: f.Node().InternalVersion().InstanceSets().Informer()}, nil - case node.SchemeGroupVersion.WithResource("instancetemplates"): - return &genericInformer{resource: resource.GroupResource(), informer: f.Node().InternalVersion().InstanceTemplates().Informer()}, nil + // Group=Machine, Version=InternalVersion + case machine.SchemeGroupVersion.WithResource("awsmachineclasses"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Machine().InternalVersion().AWSMachineClasses().Informer()}, nil + case machine.SchemeGroupVersion.WithResource("machines"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Machine().InternalVersion().Machines().Informer()}, nil + case machine.SchemeGroupVersion.WithResource("machinedeployments"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Machine().InternalVersion().MachineDeployments().Informer()}, nil + case machine.SchemeGroupVersion.WithResource("machinesets"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Machine().InternalVersion().MachineSets().Informer()}, nil + case machine.SchemeGroupVersion.WithResource("machinetemplates"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Machine().InternalVersion().MachineTemplates().Informer()}, nil } diff --git a/pkg/client/informers/internalversion/node/interface.go b/pkg/client/informers/internalversion/machine/interface.go similarity index 91% rename from pkg/client/informers/internalversion/node/interface.go rename to pkg/client/informers/internalversion/machine/interface.go index d44fb6511..79ec3a9db 100644 --- a/pkg/client/informers/internalversion/node/interface.go +++ b/pkg/client/informers/internalversion/machine/interface.go @@ -1,10 +1,10 @@ // This file was automatically generated by informer-gen -package node +package machine import ( internalinterfaces "github.com/gardener/node-controller-manager/pkg/client/informers/internalversion/internalinterfaces" - internalversion "github.com/gardener/node-controller-manager/pkg/client/informers/internalversion/node/internalversion" + internalversion "github.com/gardener/node-controller-manager/pkg/client/informers/internalversion/machine/internalversion" ) // Interface provides access to each of this group's versions. diff --git a/pkg/client/informers/internalversion/machine/internalversion/awsmachineclass.go b/pkg/client/informers/internalversion/machine/internalversion/awsmachineclass.go new file mode 100644 index 000000000..cf8d85d0e --- /dev/null +++ b/pkg/client/informers/internalversion/machine/internalversion/awsmachineclass.go @@ -0,0 +1,57 @@ +// This file was automatically generated by informer-gen + +package internalversion + +import ( + machine "github.com/gardener/node-controller-manager/pkg/apis/machine" + internalinterfaces "github.com/gardener/node-controller-manager/pkg/client/informers/internalversion/internalinterfaces" + internalclientset "github.com/gardener/node-controller-manager/pkg/client/internalclientset" + internalversion "github.com/gardener/node-controller-manager/pkg/client/listers/machine/internalversion" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + watch "k8s.io/apimachinery/pkg/watch" + cache "k8s.io/client-go/tools/cache" + time "time" +) + +// AWSMachineClassInformer provides access to a shared informer and lister for +// AWSMachineClasses. +type AWSMachineClassInformer interface { + Informer() cache.SharedIndexInformer + Lister() internalversion.AWSMachineClassLister +} + +type aWSMachineClassInformer struct { + factory internalinterfaces.SharedInformerFactory +} + +// NewAWSMachineClassInformer constructs a new informer for AWSMachineClass 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 NewAWSMachineClassInformer(client internalclientset.Interface, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return cache.NewSharedIndexInformer( + &cache.ListWatch{ + ListFunc: func(options v1.ListOptions) (runtime.Object, error) { + return client.Machine().AWSMachineClasses().List(options) + }, + WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { + return client.Machine().AWSMachineClasses().Watch(options) + }, + }, + &machine.AWSMachineClass{}, + resyncPeriod, + indexers, + ) +} + +func defaultAWSMachineClassInformer(client internalclientset.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewAWSMachineClassInformer(client, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}) +} + +func (f *aWSMachineClassInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&machine.AWSMachineClass{}, defaultAWSMachineClassInformer) +} + +func (f *aWSMachineClassInformer) Lister() internalversion.AWSMachineClassLister { + return internalversion.NewAWSMachineClassLister(f.Informer().GetIndexer()) +} diff --git a/pkg/client/informers/internalversion/machine/internalversion/interface.go b/pkg/client/informers/internalversion/machine/internalversion/interface.go new file mode 100644 index 000000000..759640651 --- /dev/null +++ b/pkg/client/informers/internalversion/machine/internalversion/interface.go @@ -0,0 +1,55 @@ +// This file was automatically generated by informer-gen + +package internalversion + +import ( + internalinterfaces "github.com/gardener/node-controller-manager/pkg/client/informers/internalversion/internalinterfaces" +) + +// Interface provides access to all the informers in this group version. +type Interface interface { + // AWSMachineClasses returns a AWSMachineClassInformer. + AWSMachineClasses() AWSMachineClassInformer + // Machines returns a MachineInformer. + Machines() MachineInformer + // MachineDeployments returns a MachineDeploymentInformer. + MachineDeployments() MachineDeploymentInformer + // MachineSets returns a MachineSetInformer. + MachineSets() MachineSetInformer + // MachineTemplates returns a MachineTemplateInformer. + MachineTemplates() MachineTemplateInformer +} + +type version struct { + internalinterfaces.SharedInformerFactory +} + +// New returns a new Interface. +func New(f internalinterfaces.SharedInformerFactory) Interface { + return &version{f} +} + +// AWSMachineClasses returns a AWSMachineClassInformer. +func (v *version) AWSMachineClasses() AWSMachineClassInformer { + return &aWSMachineClassInformer{factory: v.SharedInformerFactory} +} + +// Machines returns a MachineInformer. +func (v *version) Machines() MachineInformer { + return &machineInformer{factory: v.SharedInformerFactory} +} + +// MachineDeployments returns a MachineDeploymentInformer. +func (v *version) MachineDeployments() MachineDeploymentInformer { + return &machineDeploymentInformer{factory: v.SharedInformerFactory} +} + +// MachineSets returns a MachineSetInformer. +func (v *version) MachineSets() MachineSetInformer { + return &machineSetInformer{factory: v.SharedInformerFactory} +} + +// MachineTemplates returns a MachineTemplateInformer. +func (v *version) MachineTemplates() MachineTemplateInformer { + return &machineTemplateInformer{factory: v.SharedInformerFactory} +} diff --git a/pkg/client/informers/internalversion/machine/internalversion/machine.go b/pkg/client/informers/internalversion/machine/internalversion/machine.go new file mode 100644 index 000000000..42cb973ba --- /dev/null +++ b/pkg/client/informers/internalversion/machine/internalversion/machine.go @@ -0,0 +1,57 @@ +// This file was automatically generated by informer-gen + +package internalversion + +import ( + machine "github.com/gardener/node-controller-manager/pkg/apis/machine" + internalinterfaces "github.com/gardener/node-controller-manager/pkg/client/informers/internalversion/internalinterfaces" + internalclientset "github.com/gardener/node-controller-manager/pkg/client/internalclientset" + internalversion "github.com/gardener/node-controller-manager/pkg/client/listers/machine/internalversion" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + watch "k8s.io/apimachinery/pkg/watch" + cache "k8s.io/client-go/tools/cache" + time "time" +) + +// MachineInformer provides access to a shared informer and lister for +// Machines. +type MachineInformer interface { + Informer() cache.SharedIndexInformer + Lister() internalversion.MachineLister +} + +type machineInformer struct { + factory internalinterfaces.SharedInformerFactory +} + +// 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 internalclientset.Interface, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return cache.NewSharedIndexInformer( + &cache.ListWatch{ + ListFunc: func(options v1.ListOptions) (runtime.Object, error) { + return client.Machine().Machines().List(options) + }, + WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { + return client.Machine().Machines().Watch(options) + }, + }, + &machine.Machine{}, + resyncPeriod, + indexers, + ) +} + +func defaultMachineInformer(client internalclientset.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewMachineInformer(client, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}) +} + +func (f *machineInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&machine.Machine{}, defaultMachineInformer) +} + +func (f *machineInformer) Lister() internalversion.MachineLister { + return internalversion.NewMachineLister(f.Informer().GetIndexer()) +} diff --git a/pkg/client/informers/internalversion/machine/internalversion/machinedeployment.go b/pkg/client/informers/internalversion/machine/internalversion/machinedeployment.go new file mode 100644 index 000000000..82adb98f6 --- /dev/null +++ b/pkg/client/informers/internalversion/machine/internalversion/machinedeployment.go @@ -0,0 +1,57 @@ +// This file was automatically generated by informer-gen + +package internalversion + +import ( + machine "github.com/gardener/node-controller-manager/pkg/apis/machine" + internalinterfaces "github.com/gardener/node-controller-manager/pkg/client/informers/internalversion/internalinterfaces" + internalclientset "github.com/gardener/node-controller-manager/pkg/client/internalclientset" + internalversion "github.com/gardener/node-controller-manager/pkg/client/listers/machine/internalversion" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + watch "k8s.io/apimachinery/pkg/watch" + cache "k8s.io/client-go/tools/cache" + time "time" +) + +// MachineDeploymentInformer provides access to a shared informer and lister for +// MachineDeployments. +type MachineDeploymentInformer interface { + Informer() cache.SharedIndexInformer + Lister() internalversion.MachineDeploymentLister +} + +type machineDeploymentInformer struct { + factory internalinterfaces.SharedInformerFactory +} + +// 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 internalclientset.Interface, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return cache.NewSharedIndexInformer( + &cache.ListWatch{ + ListFunc: func(options v1.ListOptions) (runtime.Object, error) { + return client.Machine().MachineDeployments().List(options) + }, + WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { + return client.Machine().MachineDeployments().Watch(options) + }, + }, + &machine.MachineDeployment{}, + resyncPeriod, + indexers, + ) +} + +func defaultMachineDeploymentInformer(client internalclientset.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewMachineDeploymentInformer(client, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}) +} + +func (f *machineDeploymentInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&machine.MachineDeployment{}, defaultMachineDeploymentInformer) +} + +func (f *machineDeploymentInformer) Lister() internalversion.MachineDeploymentLister { + return internalversion.NewMachineDeploymentLister(f.Informer().GetIndexer()) +} diff --git a/pkg/client/informers/internalversion/machine/internalversion/machineset.go b/pkg/client/informers/internalversion/machine/internalversion/machineset.go new file mode 100644 index 000000000..dc2e58f8c --- /dev/null +++ b/pkg/client/informers/internalversion/machine/internalversion/machineset.go @@ -0,0 +1,57 @@ +// This file was automatically generated by informer-gen + +package internalversion + +import ( + machine "github.com/gardener/node-controller-manager/pkg/apis/machine" + internalinterfaces "github.com/gardener/node-controller-manager/pkg/client/informers/internalversion/internalinterfaces" + internalclientset "github.com/gardener/node-controller-manager/pkg/client/internalclientset" + internalversion "github.com/gardener/node-controller-manager/pkg/client/listers/machine/internalversion" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + watch "k8s.io/apimachinery/pkg/watch" + cache "k8s.io/client-go/tools/cache" + time "time" +) + +// MachineSetInformer provides access to a shared informer and lister for +// MachineSets. +type MachineSetInformer interface { + Informer() cache.SharedIndexInformer + Lister() internalversion.MachineSetLister +} + +type machineSetInformer struct { + factory internalinterfaces.SharedInformerFactory +} + +// 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 internalclientset.Interface, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return cache.NewSharedIndexInformer( + &cache.ListWatch{ + ListFunc: func(options v1.ListOptions) (runtime.Object, error) { + return client.Machine().MachineSets().List(options) + }, + WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { + return client.Machine().MachineSets().Watch(options) + }, + }, + &machine.MachineSet{}, + resyncPeriod, + indexers, + ) +} + +func defaultMachineSetInformer(client internalclientset.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewMachineSetInformer(client, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}) +} + +func (f *machineSetInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&machine.MachineSet{}, defaultMachineSetInformer) +} + +func (f *machineSetInformer) Lister() internalversion.MachineSetLister { + return internalversion.NewMachineSetLister(f.Informer().GetIndexer()) +} diff --git a/pkg/client/informers/internalversion/machine/internalversion/machinetemplate.go b/pkg/client/informers/internalversion/machine/internalversion/machinetemplate.go new file mode 100644 index 000000000..70814237f --- /dev/null +++ b/pkg/client/informers/internalversion/machine/internalversion/machinetemplate.go @@ -0,0 +1,57 @@ +// This file was automatically generated by informer-gen + +package internalversion + +import ( + machine "github.com/gardener/node-controller-manager/pkg/apis/machine" + internalinterfaces "github.com/gardener/node-controller-manager/pkg/client/informers/internalversion/internalinterfaces" + internalclientset "github.com/gardener/node-controller-manager/pkg/client/internalclientset" + internalversion "github.com/gardener/node-controller-manager/pkg/client/listers/machine/internalversion" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + watch "k8s.io/apimachinery/pkg/watch" + cache "k8s.io/client-go/tools/cache" + time "time" +) + +// MachineTemplateInformer provides access to a shared informer and lister for +// MachineTemplates. +type MachineTemplateInformer interface { + Informer() cache.SharedIndexInformer + Lister() internalversion.MachineTemplateLister +} + +type machineTemplateInformer struct { + factory internalinterfaces.SharedInformerFactory +} + +// NewMachineTemplateInformer constructs a new informer for MachineTemplate 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 NewMachineTemplateInformer(client internalclientset.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return cache.NewSharedIndexInformer( + &cache.ListWatch{ + ListFunc: func(options v1.ListOptions) (runtime.Object, error) { + return client.Machine().MachineTemplates(namespace).List(options) + }, + WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { + return client.Machine().MachineTemplates(namespace).Watch(options) + }, + }, + &machine.MachineTemplate{}, + resyncPeriod, + indexers, + ) +} + +func defaultMachineTemplateInformer(client internalclientset.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewMachineTemplateInformer(client, v1.NamespaceAll, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}) +} + +func (f *machineTemplateInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&machine.MachineTemplate{}, defaultMachineTemplateInformer) +} + +func (f *machineTemplateInformer) Lister() internalversion.MachineTemplateLister { + return internalversion.NewMachineTemplateLister(f.Informer().GetIndexer()) +} diff --git a/pkg/client/informers/internalversion/node/internalversion/awsinstanceclass.go b/pkg/client/informers/internalversion/node/internalversion/awsinstanceclass.go deleted file mode 100644 index 5fdd99db2..000000000 --- a/pkg/client/informers/internalversion/node/internalversion/awsinstanceclass.go +++ /dev/null @@ -1,57 +0,0 @@ -// This file was automatically generated by informer-gen - -package internalversion - -import ( - node "github.com/gardener/node-controller-manager/pkg/apis/node" - internalinterfaces "github.com/gardener/node-controller-manager/pkg/client/informers/internalversion/internalinterfaces" - internalclientset "github.com/gardener/node-controller-manager/pkg/client/internalclientset" - internalversion "github.com/gardener/node-controller-manager/pkg/client/listers/node/internalversion" - v1 "k8s.io/apimachinery/pkg/apis/meta/v1" - runtime "k8s.io/apimachinery/pkg/runtime" - watch "k8s.io/apimachinery/pkg/watch" - cache "k8s.io/client-go/tools/cache" - time "time" -) - -// AWSInstanceClassInformer provides access to a shared informer and lister for -// AWSInstanceClasses. -type AWSInstanceClassInformer interface { - Informer() cache.SharedIndexInformer - Lister() internalversion.AWSInstanceClassLister -} - -type aWSInstanceClassInformer struct { - factory internalinterfaces.SharedInformerFactory -} - -// NewAWSInstanceClassInformer constructs a new informer for AWSInstanceClass 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 NewAWSInstanceClassInformer(client internalclientset.Interface, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { - return cache.NewSharedIndexInformer( - &cache.ListWatch{ - ListFunc: func(options v1.ListOptions) (runtime.Object, error) { - return client.Node().AWSInstanceClasses().List(options) - }, - WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { - return client.Node().AWSInstanceClasses().Watch(options) - }, - }, - &node.AWSInstanceClass{}, - resyncPeriod, - indexers, - ) -} - -func defaultAWSInstanceClassInformer(client internalclientset.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { - return NewAWSInstanceClassInformer(client, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}) -} - -func (f *aWSInstanceClassInformer) Informer() cache.SharedIndexInformer { - return f.factory.InformerFor(&node.AWSInstanceClass{}, defaultAWSInstanceClassInformer) -} - -func (f *aWSInstanceClassInformer) Lister() internalversion.AWSInstanceClassLister { - return internalversion.NewAWSInstanceClassLister(f.Informer().GetIndexer()) -} diff --git a/pkg/client/informers/internalversion/node/internalversion/instance.go b/pkg/client/informers/internalversion/node/internalversion/instance.go deleted file mode 100644 index f6bce25ea..000000000 --- a/pkg/client/informers/internalversion/node/internalversion/instance.go +++ /dev/null @@ -1,57 +0,0 @@ -// This file was automatically generated by informer-gen - -package internalversion - -import ( - node "github.com/gardener/node-controller-manager/pkg/apis/node" - internalinterfaces "github.com/gardener/node-controller-manager/pkg/client/informers/internalversion/internalinterfaces" - internalclientset "github.com/gardener/node-controller-manager/pkg/client/internalclientset" - internalversion "github.com/gardener/node-controller-manager/pkg/client/listers/node/internalversion" - v1 "k8s.io/apimachinery/pkg/apis/meta/v1" - runtime "k8s.io/apimachinery/pkg/runtime" - watch "k8s.io/apimachinery/pkg/watch" - cache "k8s.io/client-go/tools/cache" - time "time" -) - -// InstanceInformer provides access to a shared informer and lister for -// Instances. -type InstanceInformer interface { - Informer() cache.SharedIndexInformer - Lister() internalversion.InstanceLister -} - -type instanceInformer struct { - factory internalinterfaces.SharedInformerFactory -} - -// NewInstanceInformer constructs a new informer for Instance 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 NewInstanceInformer(client internalclientset.Interface, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { - return cache.NewSharedIndexInformer( - &cache.ListWatch{ - ListFunc: func(options v1.ListOptions) (runtime.Object, error) { - return client.Node().Instances().List(options) - }, - WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { - return client.Node().Instances().Watch(options) - }, - }, - &node.Instance{}, - resyncPeriod, - indexers, - ) -} - -func defaultInstanceInformer(client internalclientset.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { - return NewInstanceInformer(client, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}) -} - -func (f *instanceInformer) Informer() cache.SharedIndexInformer { - return f.factory.InformerFor(&node.Instance{}, defaultInstanceInformer) -} - -func (f *instanceInformer) Lister() internalversion.InstanceLister { - return internalversion.NewInstanceLister(f.Informer().GetIndexer()) -} diff --git a/pkg/client/informers/internalversion/node/internalversion/instancedeployment.go b/pkg/client/informers/internalversion/node/internalversion/instancedeployment.go deleted file mode 100644 index aab29b6ef..000000000 --- a/pkg/client/informers/internalversion/node/internalversion/instancedeployment.go +++ /dev/null @@ -1,57 +0,0 @@ -// This file was automatically generated by informer-gen - -package internalversion - -import ( - node "github.com/gardener/node-controller-manager/pkg/apis/node" - internalinterfaces "github.com/gardener/node-controller-manager/pkg/client/informers/internalversion/internalinterfaces" - internalclientset "github.com/gardener/node-controller-manager/pkg/client/internalclientset" - internalversion "github.com/gardener/node-controller-manager/pkg/client/listers/node/internalversion" - v1 "k8s.io/apimachinery/pkg/apis/meta/v1" - runtime "k8s.io/apimachinery/pkg/runtime" - watch "k8s.io/apimachinery/pkg/watch" - cache "k8s.io/client-go/tools/cache" - time "time" -) - -// InstanceDeploymentInformer provides access to a shared informer and lister for -// InstanceDeployments. -type InstanceDeploymentInformer interface { - Informer() cache.SharedIndexInformer - Lister() internalversion.InstanceDeploymentLister -} - -type instanceDeploymentInformer struct { - factory internalinterfaces.SharedInformerFactory -} - -// NewInstanceDeploymentInformer constructs a new informer for InstanceDeployment 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 NewInstanceDeploymentInformer(client internalclientset.Interface, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { - return cache.NewSharedIndexInformer( - &cache.ListWatch{ - ListFunc: func(options v1.ListOptions) (runtime.Object, error) { - return client.Node().InstanceDeployments().List(options) - }, - WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { - return client.Node().InstanceDeployments().Watch(options) - }, - }, - &node.InstanceDeployment{}, - resyncPeriod, - indexers, - ) -} - -func defaultInstanceDeploymentInformer(client internalclientset.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { - return NewInstanceDeploymentInformer(client, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}) -} - -func (f *instanceDeploymentInformer) Informer() cache.SharedIndexInformer { - return f.factory.InformerFor(&node.InstanceDeployment{}, defaultInstanceDeploymentInformer) -} - -func (f *instanceDeploymentInformer) Lister() internalversion.InstanceDeploymentLister { - return internalversion.NewInstanceDeploymentLister(f.Informer().GetIndexer()) -} diff --git a/pkg/client/informers/internalversion/node/internalversion/instanceset.go b/pkg/client/informers/internalversion/node/internalversion/instanceset.go deleted file mode 100644 index 954d03a3c..000000000 --- a/pkg/client/informers/internalversion/node/internalversion/instanceset.go +++ /dev/null @@ -1,57 +0,0 @@ -// This file was automatically generated by informer-gen - -package internalversion - -import ( - node "github.com/gardener/node-controller-manager/pkg/apis/node" - internalinterfaces "github.com/gardener/node-controller-manager/pkg/client/informers/internalversion/internalinterfaces" - internalclientset "github.com/gardener/node-controller-manager/pkg/client/internalclientset" - internalversion "github.com/gardener/node-controller-manager/pkg/client/listers/node/internalversion" - v1 "k8s.io/apimachinery/pkg/apis/meta/v1" - runtime "k8s.io/apimachinery/pkg/runtime" - watch "k8s.io/apimachinery/pkg/watch" - cache "k8s.io/client-go/tools/cache" - time "time" -) - -// InstanceSetInformer provides access to a shared informer and lister for -// InstanceSets. -type InstanceSetInformer interface { - Informer() cache.SharedIndexInformer - Lister() internalversion.InstanceSetLister -} - -type instanceSetInformer struct { - factory internalinterfaces.SharedInformerFactory -} - -// NewInstanceSetInformer constructs a new informer for InstanceSet 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 NewInstanceSetInformer(client internalclientset.Interface, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { - return cache.NewSharedIndexInformer( - &cache.ListWatch{ - ListFunc: func(options v1.ListOptions) (runtime.Object, error) { - return client.Node().InstanceSets().List(options) - }, - WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { - return client.Node().InstanceSets().Watch(options) - }, - }, - &node.InstanceSet{}, - resyncPeriod, - indexers, - ) -} - -func defaultInstanceSetInformer(client internalclientset.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { - return NewInstanceSetInformer(client, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}) -} - -func (f *instanceSetInformer) Informer() cache.SharedIndexInformer { - return f.factory.InformerFor(&node.InstanceSet{}, defaultInstanceSetInformer) -} - -func (f *instanceSetInformer) Lister() internalversion.InstanceSetLister { - return internalversion.NewInstanceSetLister(f.Informer().GetIndexer()) -} diff --git a/pkg/client/informers/internalversion/node/internalversion/instancetemplate.go b/pkg/client/informers/internalversion/node/internalversion/instancetemplate.go deleted file mode 100644 index 66e83e0c0..000000000 --- a/pkg/client/informers/internalversion/node/internalversion/instancetemplate.go +++ /dev/null @@ -1,57 +0,0 @@ -// This file was automatically generated by informer-gen - -package internalversion - -import ( - node "github.com/gardener/node-controller-manager/pkg/apis/node" - internalinterfaces "github.com/gardener/node-controller-manager/pkg/client/informers/internalversion/internalinterfaces" - internalclientset "github.com/gardener/node-controller-manager/pkg/client/internalclientset" - internalversion "github.com/gardener/node-controller-manager/pkg/client/listers/node/internalversion" - v1 "k8s.io/apimachinery/pkg/apis/meta/v1" - runtime "k8s.io/apimachinery/pkg/runtime" - watch "k8s.io/apimachinery/pkg/watch" - cache "k8s.io/client-go/tools/cache" - time "time" -) - -// InstanceTemplateInformer provides access to a shared informer and lister for -// InstanceTemplates. -type InstanceTemplateInformer interface { - Informer() cache.SharedIndexInformer - Lister() internalversion.InstanceTemplateLister -} - -type instanceTemplateInformer struct { - factory internalinterfaces.SharedInformerFactory -} - -// NewInstanceTemplateInformer constructs a new informer for InstanceTemplate 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 NewInstanceTemplateInformer(client internalclientset.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { - return cache.NewSharedIndexInformer( - &cache.ListWatch{ - ListFunc: func(options v1.ListOptions) (runtime.Object, error) { - return client.Node().InstanceTemplates(namespace).List(options) - }, - WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { - return client.Node().InstanceTemplates(namespace).Watch(options) - }, - }, - &node.InstanceTemplate{}, - resyncPeriod, - indexers, - ) -} - -func defaultInstanceTemplateInformer(client internalclientset.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { - return NewInstanceTemplateInformer(client, v1.NamespaceAll, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}) -} - -func (f *instanceTemplateInformer) Informer() cache.SharedIndexInformer { - return f.factory.InformerFor(&node.InstanceTemplate{}, defaultInstanceTemplateInformer) -} - -func (f *instanceTemplateInformer) Lister() internalversion.InstanceTemplateLister { - return internalversion.NewInstanceTemplateLister(f.Informer().GetIndexer()) -} diff --git a/pkg/client/informers/internalversion/node/internalversion/interface.go b/pkg/client/informers/internalversion/node/internalversion/interface.go deleted file mode 100644 index 587fa5d3c..000000000 --- a/pkg/client/informers/internalversion/node/internalversion/interface.go +++ /dev/null @@ -1,55 +0,0 @@ -// This file was automatically generated by informer-gen - -package internalversion - -import ( - internalinterfaces "github.com/gardener/node-controller-manager/pkg/client/informers/internalversion/internalinterfaces" -) - -// Interface provides access to all the informers in this group version. -type Interface interface { - // AWSInstanceClasses returns a AWSInstanceClassInformer. - AWSInstanceClasses() AWSInstanceClassInformer - // Instances returns a InstanceInformer. - Instances() InstanceInformer - // InstanceDeployments returns a InstanceDeploymentInformer. - InstanceDeployments() InstanceDeploymentInformer - // InstanceSets returns a InstanceSetInformer. - InstanceSets() InstanceSetInformer - // InstanceTemplates returns a InstanceTemplateInformer. - InstanceTemplates() InstanceTemplateInformer -} - -type version struct { - internalinterfaces.SharedInformerFactory -} - -// New returns a new Interface. -func New(f internalinterfaces.SharedInformerFactory) Interface { - return &version{f} -} - -// AWSInstanceClasses returns a AWSInstanceClassInformer. -func (v *version) AWSInstanceClasses() AWSInstanceClassInformer { - return &aWSInstanceClassInformer{factory: v.SharedInformerFactory} -} - -// Instances returns a InstanceInformer. -func (v *version) Instances() InstanceInformer { - return &instanceInformer{factory: v.SharedInformerFactory} -} - -// InstanceDeployments returns a InstanceDeploymentInformer. -func (v *version) InstanceDeployments() InstanceDeploymentInformer { - return &instanceDeploymentInformer{factory: v.SharedInformerFactory} -} - -// InstanceSets returns a InstanceSetInformer. -func (v *version) InstanceSets() InstanceSetInformer { - return &instanceSetInformer{factory: v.SharedInformerFactory} -} - -// InstanceTemplates returns a InstanceTemplateInformer. -func (v *version) InstanceTemplates() InstanceTemplateInformer { - return &instanceTemplateInformer{factory: v.SharedInformerFactory} -} diff --git a/pkg/client/internalclientset/clientset.go b/pkg/client/internalclientset/clientset.go index 3fba27795..2a51d3678 100644 --- a/pkg/client/internalclientset/clientset.go +++ b/pkg/client/internalclientset/clientset.go @@ -1,7 +1,7 @@ package internalclientset import ( - nodeinternalversion "github.com/gardener/node-controller-manager/pkg/client/internalclientset/typed/node/internalversion" + machineinternalversion "github.com/gardener/node-controller-manager/pkg/client/internalclientset/typed/machine/internalversion" glog "github.com/golang/glog" discovery "k8s.io/client-go/discovery" rest "k8s.io/client-go/rest" @@ -10,19 +10,19 @@ import ( type Interface interface { Discovery() discovery.DiscoveryInterface - Node() nodeinternalversion.NodeInterface + Machine() machineinternalversion.MachineInterface } // Clientset contains the clients for groups. Each group has exactly one // version included in a Clientset. type Clientset struct { *discovery.DiscoveryClient - node *nodeinternalversion.NodeClient + machine *machineinternalversion.MachineClient } -// Node retrieves the NodeClient -func (c *Clientset) Node() nodeinternalversion.NodeInterface { - return c.node +// Machine retrieves the MachineClient +func (c *Clientset) Machine() machineinternalversion.MachineInterface { + return c.machine } // Discovery retrieves the DiscoveryClient @@ -41,7 +41,7 @@ func NewForConfig(c *rest.Config) (*Clientset, error) { } var cs Clientset var err error - cs.node, err = nodeinternalversion.NewForConfig(&configShallowCopy) + cs.machine, err = machineinternalversion.NewForConfig(&configShallowCopy) if err != nil { return nil, err } @@ -58,7 +58,7 @@ func NewForConfig(c *rest.Config) (*Clientset, error) { // panics if there is an error in the config. func NewForConfigOrDie(c *rest.Config) *Clientset { var cs Clientset - cs.node = nodeinternalversion.NewForConfigOrDie(c) + cs.machine = machineinternalversion.NewForConfigOrDie(c) cs.DiscoveryClient = discovery.NewDiscoveryClientForConfigOrDie(c) return &cs @@ -67,7 +67,7 @@ func NewForConfigOrDie(c *rest.Config) *Clientset { // New creates a new Clientset for the given RESTClient. func New(c rest.Interface) *Clientset { var cs Clientset - cs.node = nodeinternalversion.New(c) + cs.machine = machineinternalversion.New(c) cs.DiscoveryClient = discovery.NewDiscoveryClient(c) return &cs diff --git a/pkg/client/internalclientset/fake/clientset_generated.go b/pkg/client/internalclientset/fake/clientset_generated.go index 8068deac1..0d39b58c5 100644 --- a/pkg/client/internalclientset/fake/clientset_generated.go +++ b/pkg/client/internalclientset/fake/clientset_generated.go @@ -2,8 +2,8 @@ package fake import ( clientset "github.com/gardener/node-controller-manager/pkg/client/internalclientset" - nodeinternalversion "github.com/gardener/node-controller-manager/pkg/client/internalclientset/typed/node/internalversion" - fakenodeinternalversion "github.com/gardener/node-controller-manager/pkg/client/internalclientset/typed/node/internalversion/fake" + machineinternalversion "github.com/gardener/node-controller-manager/pkg/client/internalclientset/typed/machine/internalversion" + fakemachineinternalversion "github.com/gardener/node-controller-manager/pkg/client/internalclientset/typed/machine/internalversion/fake" "k8s.io/apimachinery/pkg/runtime" "k8s.io/apimachinery/pkg/watch" "k8s.io/client-go/discovery" @@ -44,7 +44,7 @@ func (c *Clientset) Discovery() discovery.DiscoveryInterface { var _ clientset.Interface = &Clientset{} -// Node retrieves the NodeClient -func (c *Clientset) Node() nodeinternalversion.NodeInterface { - return &fakenodeinternalversion.FakeNode{Fake: &c.Fake} +// Machine retrieves the MachineClient +func (c *Clientset) Machine() machineinternalversion.MachineInterface { + return &fakemachineinternalversion.FakeMachine{Fake: &c.Fake} } diff --git a/pkg/client/internalclientset/fake/register.go b/pkg/client/internalclientset/fake/register.go index 766bda204..de67b812b 100644 --- a/pkg/client/internalclientset/fake/register.go +++ b/pkg/client/internalclientset/fake/register.go @@ -1,7 +1,7 @@ package fake import ( - nodeinternalversion "github.com/gardener/node-controller-manager/pkg/apis/node" + machineinternalversion "github.com/gardener/node-controller-manager/pkg/apis/machine" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" runtime "k8s.io/apimachinery/pkg/runtime" schema "k8s.io/apimachinery/pkg/runtime/schema" @@ -32,6 +32,6 @@ func init() { // After this, RawExtensions in Kubernetes types will serialize kube-aggregator types // correctly. func AddToScheme(scheme *runtime.Scheme) { - nodeinternalversion.AddToScheme(scheme) + machineinternalversion.AddToScheme(scheme) } diff --git a/pkg/client/internalclientset/scheme/register.go b/pkg/client/internalclientset/scheme/register.go index 8fd228f44..080c93136 100644 --- a/pkg/client/internalclientset/scheme/register.go +++ b/pkg/client/internalclientset/scheme/register.go @@ -1,7 +1,7 @@ package scheme import ( - node "github.com/gardener/node-controller-manager/pkg/apis/node/install" + machine "github.com/gardener/node-controller-manager/pkg/apis/machine/install" announced "k8s.io/apimachinery/pkg/apimachinery/announced" registered "k8s.io/apimachinery/pkg/apimachinery/registered" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" @@ -25,6 +25,6 @@ func init() { // Install registers the API group and adds types to a scheme func Install(groupFactoryRegistry announced.APIGroupFactoryRegistry, registry *registered.APIRegistrationManager, scheme *runtime.Scheme) { - node.Install(groupFactoryRegistry, registry, scheme) + machine.Install(groupFactoryRegistry, registry, scheme) } diff --git a/pkg/client/internalclientset/typed/machine/internalversion/awsmachineclass.go b/pkg/client/internalclientset/typed/machine/internalversion/awsmachineclass.go new file mode 100644 index 000000000..06184fb8b --- /dev/null +++ b/pkg/client/internalclientset/typed/machine/internalversion/awsmachineclass.go @@ -0,0 +1,129 @@ +package internalversion + +import ( + machine "github.com/gardener/node-controller-manager/pkg/apis/machine" + scheme "github.com/gardener/node-controller-manager/pkg/client/internalclientset/scheme" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + types "k8s.io/apimachinery/pkg/types" + watch "k8s.io/apimachinery/pkg/watch" + rest "k8s.io/client-go/rest" +) + +// AWSMachineClassesGetter has a method to return a AWSMachineClassInterface. +// A group's client should implement this interface. +type AWSMachineClassesGetter interface { + AWSMachineClasses() AWSMachineClassInterface +} + +// AWSMachineClassInterface has methods to work with AWSMachineClass resources. +type AWSMachineClassInterface interface { + Create(*machine.AWSMachineClass) (*machine.AWSMachineClass, error) + Update(*machine.AWSMachineClass) (*machine.AWSMachineClass, error) + Delete(name string, options *v1.DeleteOptions) error + DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error + Get(name string, options v1.GetOptions) (*machine.AWSMachineClass, error) + List(opts v1.ListOptions) (*machine.AWSMachineClassList, error) + Watch(opts v1.ListOptions) (watch.Interface, error) + Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *machine.AWSMachineClass, err error) + AWSMachineClassExpansion +} + +// aWSMachineClasses implements AWSMachineClassInterface +type aWSMachineClasses struct { + client rest.Interface +} + +// newAWSMachineClasses returns a AWSMachineClasses +func newAWSMachineClasses(c *MachineClient) *aWSMachineClasses { + return &aWSMachineClasses{ + client: c.RESTClient(), + } +} + +// Get takes name of the aWSMachineClass, and returns the corresponding aWSMachineClass object, and an error if there is any. +func (c *aWSMachineClasses) Get(name string, options v1.GetOptions) (result *machine.AWSMachineClass, err error) { + result = &machine.AWSMachineClass{} + err = c.client.Get(). + Resource("awsmachineclasses"). + Name(name). + VersionedParams(&options, scheme.ParameterCodec). + Do(). + Into(result) + return +} + +// List takes label and field selectors, and returns the list of AWSMachineClasses that match those selectors. +func (c *aWSMachineClasses) List(opts v1.ListOptions) (result *machine.AWSMachineClassList, err error) { + result = &machine.AWSMachineClassList{} + err = c.client.Get(). + Resource("awsmachineclasses"). + VersionedParams(&opts, scheme.ParameterCodec). + Do(). + Into(result) + return +} + +// Watch returns a watch.Interface that watches the requested aWSMachineClasses. +func (c *aWSMachineClasses) Watch(opts v1.ListOptions) (watch.Interface, error) { + opts.Watch = true + return c.client.Get(). + Resource("awsmachineclasses"). + VersionedParams(&opts, scheme.ParameterCodec). + Watch() +} + +// Create takes the representation of a aWSMachineClass and creates it. Returns the server's representation of the aWSMachineClass, and an error, if there is any. +func (c *aWSMachineClasses) Create(aWSMachineClass *machine.AWSMachineClass) (result *machine.AWSMachineClass, err error) { + result = &machine.AWSMachineClass{} + err = c.client.Post(). + Resource("awsmachineclasses"). + Body(aWSMachineClass). + Do(). + Into(result) + return +} + +// Update takes the representation of a aWSMachineClass and updates it. Returns the server's representation of the aWSMachineClass, and an error, if there is any. +func (c *aWSMachineClasses) Update(aWSMachineClass *machine.AWSMachineClass) (result *machine.AWSMachineClass, err error) { + result = &machine.AWSMachineClass{} + err = c.client.Put(). + Resource("awsmachineclasses"). + Name(aWSMachineClass.Name). + Body(aWSMachineClass). + Do(). + Into(result) + return +} + +// Delete takes name of the aWSMachineClass and deletes it. Returns an error if one occurs. +func (c *aWSMachineClasses) Delete(name string, options *v1.DeleteOptions) error { + return c.client.Delete(). + Resource("awsmachineclasses"). + Name(name). + Body(options). + Do(). + Error() +} + +// DeleteCollection deletes a collection of objects. +func (c *aWSMachineClasses) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error { + return c.client.Delete(). + Resource("awsmachineclasses"). + VersionedParams(&listOptions, scheme.ParameterCodec). + Body(options). + Do(). + Error() +} + +// Patch applies the patch and returns the patched aWSMachineClass. +func (c *aWSMachineClasses) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *machine.AWSMachineClass, err error) { + result = &machine.AWSMachineClass{} + err = c.client.Patch(pt). + Resource("awsmachineclasses"). + SubResource(subresources...). + Name(name). + Body(data). + Do(). + Into(result) + return +} diff --git a/pkg/client/internalclientset/typed/node/internalversion/doc.go b/pkg/client/internalclientset/typed/machine/internalversion/doc.go similarity index 100% rename from pkg/client/internalclientset/typed/node/internalversion/doc.go rename to pkg/client/internalclientset/typed/machine/internalversion/doc.go diff --git a/pkg/client/internalclientset/typed/node/internalversion/fake/doc.go b/pkg/client/internalclientset/typed/machine/internalversion/fake/doc.go similarity index 100% rename from pkg/client/internalclientset/typed/node/internalversion/fake/doc.go rename to pkg/client/internalclientset/typed/machine/internalversion/fake/doc.go diff --git a/pkg/client/internalclientset/typed/machine/internalversion/fake/fake_awsmachineclass.go b/pkg/client/internalclientset/typed/machine/internalversion/fake/fake_awsmachineclass.go new file mode 100644 index 000000000..b2f878132 --- /dev/null +++ b/pkg/client/internalclientset/typed/machine/internalversion/fake/fake_awsmachineclass.go @@ -0,0 +1,102 @@ +package fake + +import ( + machine "github.com/gardener/node-controller-manager/pkg/apis/machine" + 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" +) + +// FakeAWSMachineClasses implements AWSMachineClassInterface +type FakeAWSMachineClasses struct { + Fake *FakeMachine +} + +var awsmachineclassesResource = schema.GroupVersionResource{Group: "machine.sapcloud.io", Version: "", Resource: "awsmachineclasses"} + +var awsmachineclassesKind = schema.GroupVersionKind{Group: "machine.sapcloud.io", Version: "", Kind: "AWSMachineClass"} + +// Get takes name of the aWSMachineClass, and returns the corresponding aWSMachineClass object, and an error if there is any. +func (c *FakeAWSMachineClasses) Get(name string, options v1.GetOptions) (result *machine.AWSMachineClass, err error) { + obj, err := c.Fake. + Invokes(testing.NewRootGetAction(awsmachineclassesResource, name), &machine.AWSMachineClass{}) + if obj == nil { + return nil, err + } + return obj.(*machine.AWSMachineClass), err +} + +// List takes label and field selectors, and returns the list of AWSMachineClasses that match those selectors. +func (c *FakeAWSMachineClasses) List(opts v1.ListOptions) (result *machine.AWSMachineClassList, err error) { + obj, err := c.Fake. + Invokes(testing.NewRootListAction(awsmachineclassesResource, awsmachineclassesKind, opts), &machine.AWSMachineClassList{}) + if obj == nil { + return nil, err + } + + label, _, _ := testing.ExtractFromListOptions(opts) + if label == nil { + label = labels.Everything() + } + list := &machine.AWSMachineClassList{} + for _, item := range obj.(*machine.AWSMachineClassList).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 aWSMachineClasses. +func (c *FakeAWSMachineClasses) Watch(opts v1.ListOptions) (watch.Interface, error) { + return c.Fake. + InvokesWatch(testing.NewRootWatchAction(awsmachineclassesResource, opts)) +} + +// Create takes the representation of a aWSMachineClass and creates it. Returns the server's representation of the aWSMachineClass, and an error, if there is any. +func (c *FakeAWSMachineClasses) Create(aWSMachineClass *machine.AWSMachineClass) (result *machine.AWSMachineClass, err error) { + obj, err := c.Fake. + Invokes(testing.NewRootCreateAction(awsmachineclassesResource, aWSMachineClass), &machine.AWSMachineClass{}) + if obj == nil { + return nil, err + } + return obj.(*machine.AWSMachineClass), err +} + +// Update takes the representation of a aWSMachineClass and updates it. Returns the server's representation of the aWSMachineClass, and an error, if there is any. +func (c *FakeAWSMachineClasses) Update(aWSMachineClass *machine.AWSMachineClass) (result *machine.AWSMachineClass, err error) { + obj, err := c.Fake. + Invokes(testing.NewRootUpdateAction(awsmachineclassesResource, aWSMachineClass), &machine.AWSMachineClass{}) + if obj == nil { + return nil, err + } + return obj.(*machine.AWSMachineClass), err +} + +// Delete takes name of the aWSMachineClass and deletes it. Returns an error if one occurs. +func (c *FakeAWSMachineClasses) Delete(name string, options *v1.DeleteOptions) error { + _, err := c.Fake. + Invokes(testing.NewRootDeleteAction(awsmachineclassesResource, name), &machine.AWSMachineClass{}) + return err +} + +// DeleteCollection deletes a collection of objects. +func (c *FakeAWSMachineClasses) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error { + action := testing.NewRootDeleteCollectionAction(awsmachineclassesResource, listOptions) + + _, err := c.Fake.Invokes(action, &machine.AWSMachineClassList{}) + return err +} + +// Patch applies the patch and returns the patched aWSMachineClass. +func (c *FakeAWSMachineClasses) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *machine.AWSMachineClass, err error) { + obj, err := c.Fake. + Invokes(testing.NewRootPatchSubresourceAction(awsmachineclassesResource, name, data, subresources...), &machine.AWSMachineClass{}) + if obj == nil { + return nil, err + } + return obj.(*machine.AWSMachineClass), err +} diff --git a/pkg/client/internalclientset/typed/machine/internalversion/fake/fake_machine.go b/pkg/client/internalclientset/typed/machine/internalversion/fake/fake_machine.go new file mode 100644 index 000000000..970b1f4c8 --- /dev/null +++ b/pkg/client/internalclientset/typed/machine/internalversion/fake/fake_machine.go @@ -0,0 +1,102 @@ +package fake + +import ( + machine "github.com/gardener/node-controller-manager/pkg/apis/machine" + 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" +) + +// FakeMachines implements MachineInterface +type FakeMachines struct { + Fake *FakeMachine +} + +var machinesResource = schema.GroupVersionResource{Group: "machine.sapcloud.io", Version: "", Resource: "machines"} + +var machinesKind = schema.GroupVersionKind{Group: "machine.sapcloud.io", Version: "", 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 *machine.Machine, err error) { + obj, err := c.Fake. + Invokes(testing.NewRootGetAction(machinesResource, name), &machine.Machine{}) + if obj == nil { + return nil, err + } + return obj.(*machine.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 *machine.MachineList, err error) { + obj, err := c.Fake. + Invokes(testing.NewRootListAction(machinesResource, machinesKind, opts), &machine.MachineList{}) + if obj == nil { + return nil, err + } + + label, _, _ := testing.ExtractFromListOptions(opts) + if label == nil { + label = labels.Everything() + } + list := &machine.MachineList{} + for _, item := range obj.(*machine.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.NewRootWatchAction(machinesResource, 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 *machine.Machine) (result *machine.Machine, err error) { + obj, err := c.Fake. + Invokes(testing.NewRootCreateAction(machinesResource, machine), &machine.Machine{}) + if obj == nil { + return nil, err + } + return obj.(*machine.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 *machine.Machine) (result *machine.Machine, err error) { + obj, err := c.Fake. + Invokes(testing.NewRootUpdateAction(machinesResource, machine), &machine.Machine{}) + if obj == nil { + return nil, err + } + return obj.(*machine.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.NewRootDeleteAction(machinesResource, name), &machine.Machine{}) + return err +} + +// DeleteCollection deletes a collection of objects. +func (c *FakeMachines) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error { + action := testing.NewRootDeleteCollectionAction(machinesResource, listOptions) + + _, err := c.Fake.Invokes(action, &machine.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 *machine.Machine, err error) { + obj, err := c.Fake. + Invokes(testing.NewRootPatchSubresourceAction(machinesResource, name, data, subresources...), &machine.Machine{}) + if obj == nil { + return nil, err + } + return obj.(*machine.Machine), err +} diff --git a/pkg/client/internalclientset/typed/machine/internalversion/fake/fake_machine_client.go b/pkg/client/internalclientset/typed/machine/internalversion/fake/fake_machine_client.go new file mode 100644 index 000000000..8c6630c31 --- /dev/null +++ b/pkg/client/internalclientset/typed/machine/internalversion/fake/fake_machine_client.go @@ -0,0 +1,42 @@ +package fake + +import ( + internalversion "github.com/gardener/node-controller-manager/pkg/client/internalclientset/typed/machine/internalversion" + rest "k8s.io/client-go/rest" + testing "k8s.io/client-go/testing" +) + +type FakeMachine struct { + *testing.Fake +} + +func (c *FakeMachine) AWSMachineClasses() internalversion.AWSMachineClassInterface { + return &FakeAWSMachineClasses{c} +} + +func (c *FakeMachine) Machines() internalversion.MachineInterface { + return &FakeMachines{c} +} + +func (c *FakeMachine) MachineDeployments() internalversion.MachineDeploymentInterface { + return &FakeMachineDeployments{c} +} + +func (c *FakeMachine) MachineSets() internalversion.MachineSetInterface { + return &FakeMachineSets{c} +} + +func (c *FakeMachine) MachineTemplates(namespace string) internalversion.MachineTemplateInterface { + return &FakeMachineTemplates{c, namespace} +} + +func (c *FakeMachine) Scales(namespace string) internalversion.ScaleInterface { + return &FakeScales{c, namespace} +} + +// RESTClient returns a RESTClient that is used to communicate +// with API server by this client implementation. +func (c *FakeMachine) RESTClient() rest.Interface { + var ret *rest.RESTClient + return ret +} diff --git a/pkg/client/internalclientset/typed/machine/internalversion/fake/fake_machinedeployment.go b/pkg/client/internalclientset/typed/machine/internalversion/fake/fake_machinedeployment.go new file mode 100644 index 000000000..aa63b6bcd --- /dev/null +++ b/pkg/client/internalclientset/typed/machine/internalversion/fake/fake_machinedeployment.go @@ -0,0 +1,133 @@ +package fake + +import ( + machine "github.com/gardener/node-controller-manager/pkg/apis/machine" + 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" +) + +// FakeMachineDeployments implements MachineDeploymentInterface +type FakeMachineDeployments struct { + Fake *FakeMachine +} + +var machinedeploymentsResource = schema.GroupVersionResource{Group: "machine.sapcloud.io", Version: "", Resource: "machinedeployments"} + +var machinedeploymentsKind = schema.GroupVersionKind{Group: "machine.sapcloud.io", Version: "", 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 *machine.MachineDeployment, err error) { + obj, err := c.Fake. + Invokes(testing.NewRootGetAction(machinedeploymentsResource, name), &machine.MachineDeployment{}) + if obj == nil { + return nil, err + } + return obj.(*machine.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 *machine.MachineDeploymentList, err error) { + obj, err := c.Fake. + Invokes(testing.NewRootListAction(machinedeploymentsResource, machinedeploymentsKind, opts), &machine.MachineDeploymentList{}) + if obj == nil { + return nil, err + } + + label, _, _ := testing.ExtractFromListOptions(opts) + if label == nil { + label = labels.Everything() + } + list := &machine.MachineDeploymentList{} + for _, item := range obj.(*machine.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.NewRootWatchAction(machinedeploymentsResource, 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 *machine.MachineDeployment) (result *machine.MachineDeployment, err error) { + obj, err := c.Fake. + Invokes(testing.NewRootCreateAction(machinedeploymentsResource, machineDeployment), &machine.MachineDeployment{}) + if obj == nil { + return nil, err + } + return obj.(*machine.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 *machine.MachineDeployment) (result *machine.MachineDeployment, err error) { + obj, err := c.Fake. + Invokes(testing.NewRootUpdateAction(machinedeploymentsResource, machineDeployment), &machine.MachineDeployment{}) + if obj == nil { + return nil, err + } + return obj.(*machine.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 *machine.MachineDeployment) (*machine.MachineDeployment, error) { + obj, err := c.Fake. + Invokes(testing.NewRootUpdateSubresourceAction(machinedeploymentsResource, "status", machineDeployment), &machine.MachineDeployment{}) + if obj == nil { + return nil, err + } + return obj.(*machine.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.NewRootDeleteAction(machinedeploymentsResource, name), &machine.MachineDeployment{}) + return err +} + +// DeleteCollection deletes a collection of objects. +func (c *FakeMachineDeployments) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error { + action := testing.NewRootDeleteCollectionAction(machinedeploymentsResource, listOptions) + + _, err := c.Fake.Invokes(action, &machine.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 *machine.MachineDeployment, err error) { + obj, err := c.Fake. + Invokes(testing.NewRootPatchSubresourceAction(machinedeploymentsResource, name, data, subresources...), &machine.MachineDeployment{}) + if obj == nil { + return nil, err + } + return obj.(*machine.MachineDeployment), err +} + +// GetScale takes name of the machineDeployment, and returns the corresponding scale object, and an error if there is any. +func (c *FakeMachineDeployments) GetScale(machineDeploymentName string, options v1.GetOptions) (result *machine.Scale, err error) { + obj, err := c.Fake. + Invokes(testing.NewRootGetAction(machinedeploymentsResource, machineDeploymentName), &machine.Scale{}) + if obj == nil { + return nil, err + } + return obj.(*machine.Scale), err +} + +// UpdateScale takes the representation of a scale and updates it. Returns the server's representation of the scale, and an error, if there is any. +func (c *FakeMachineDeployments) UpdateScale(machineDeploymentName string, scale *machine.Scale) (result *machine.Scale, err error) { + obj, err := c.Fake. + Invokes(testing.NewRootUpdateAction(machinedeploymentsResource, machineDeployment), &machine.MachineDeployment{}) + if obj == nil { + return nil, err + } + return obj.(*machine.Scale), err +} diff --git a/pkg/client/internalclientset/typed/machine/internalversion/fake/fake_machineset.go b/pkg/client/internalclientset/typed/machine/internalversion/fake/fake_machineset.go new file mode 100644 index 000000000..bfe730c8d --- /dev/null +++ b/pkg/client/internalclientset/typed/machine/internalversion/fake/fake_machineset.go @@ -0,0 +1,113 @@ +package fake + +import ( + machine "github.com/gardener/node-controller-manager/pkg/apis/machine" + 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" +) + +// FakeMachineSets implements MachineSetInterface +type FakeMachineSets struct { + Fake *FakeMachine +} + +var machinesetsResource = schema.GroupVersionResource{Group: "machine.sapcloud.io", Version: "", Resource: "machinesets"} + +var machinesetsKind = schema.GroupVersionKind{Group: "machine.sapcloud.io", Version: "", 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 *machine.MachineSet, err error) { + obj, err := c.Fake. + Invokes(testing.NewRootGetAction(machinesetsResource, name), &machine.MachineSet{}) + if obj == nil { + return nil, err + } + return obj.(*machine.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 *machine.MachineSetList, err error) { + obj, err := c.Fake. + Invokes(testing.NewRootListAction(machinesetsResource, machinesetsKind, opts), &machine.MachineSetList{}) + if obj == nil { + return nil, err + } + + label, _, _ := testing.ExtractFromListOptions(opts) + if label == nil { + label = labels.Everything() + } + list := &machine.MachineSetList{} + for _, item := range obj.(*machine.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.NewRootWatchAction(machinesetsResource, 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 *machine.MachineSet) (result *machine.MachineSet, err error) { + obj, err := c.Fake. + Invokes(testing.NewRootCreateAction(machinesetsResource, machineSet), &machine.MachineSet{}) + if obj == nil { + return nil, err + } + return obj.(*machine.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 *machine.MachineSet) (result *machine.MachineSet, err error) { + obj, err := c.Fake. + Invokes(testing.NewRootUpdateAction(machinesetsResource, machineSet), &machine.MachineSet{}) + if obj == nil { + return nil, err + } + return obj.(*machine.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 *machine.MachineSet) (*machine.MachineSet, error) { + obj, err := c.Fake. + Invokes(testing.NewRootUpdateSubresourceAction(machinesetsResource, "status", machineSet), &machine.MachineSet{}) + if obj == nil { + return nil, err + } + return obj.(*machine.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.NewRootDeleteAction(machinesetsResource, name), &machine.MachineSet{}) + return err +} + +// DeleteCollection deletes a collection of objects. +func (c *FakeMachineSets) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error { + action := testing.NewRootDeleteCollectionAction(machinesetsResource, listOptions) + + _, err := c.Fake.Invokes(action, &machine.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 *machine.MachineSet, err error) { + obj, err := c.Fake. + Invokes(testing.NewRootPatchSubresourceAction(machinesetsResource, name, data, subresources...), &machine.MachineSet{}) + if obj == nil { + return nil, err + } + return obj.(*machine.MachineSet), err +} diff --git a/pkg/client/internalclientset/typed/machine/internalversion/fake/fake_machinetemplate.go b/pkg/client/internalclientset/typed/machine/internalversion/fake/fake_machinetemplate.go new file mode 100644 index 000000000..643aeff40 --- /dev/null +++ b/pkg/client/internalclientset/typed/machine/internalversion/fake/fake_machinetemplate.go @@ -0,0 +1,110 @@ +package fake + +import ( + machine "github.com/gardener/node-controller-manager/pkg/apis/machine" + 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" +) + +// FakeMachineTemplates implements MachineTemplateInterface +type FakeMachineTemplates struct { + Fake *FakeMachine + ns string +} + +var machinetemplatesResource = schema.GroupVersionResource{Group: "machine.sapcloud.io", Version: "", Resource: "machinetemplates"} + +var machinetemplatesKind = schema.GroupVersionKind{Group: "machine.sapcloud.io", Version: "", Kind: "MachineTemplate"} + +// Get takes name of the machineTemplate, and returns the corresponding machineTemplate object, and an error if there is any. +func (c *FakeMachineTemplates) Get(name string, options v1.GetOptions) (result *machine.MachineTemplate, err error) { + obj, err := c.Fake. + Invokes(testing.NewGetAction(machinetemplatesResource, c.ns, name), &machine.MachineTemplate{}) + + if obj == nil { + return nil, err + } + return obj.(*machine.MachineTemplate), err +} + +// List takes label and field selectors, and returns the list of MachineTemplates that match those selectors. +func (c *FakeMachineTemplates) List(opts v1.ListOptions) (result *machine.MachineTemplateList, err error) { + obj, err := c.Fake. + Invokes(testing.NewListAction(machinetemplatesResource, machinetemplatesKind, c.ns, opts), &machine.MachineTemplateList{}) + + if obj == nil { + return nil, err + } + + label, _, _ := testing.ExtractFromListOptions(opts) + if label == nil { + label = labels.Everything() + } + list := &machine.MachineTemplateList{} + for _, item := range obj.(*machine.MachineTemplateList).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 machineTemplates. +func (c *FakeMachineTemplates) Watch(opts v1.ListOptions) (watch.Interface, error) { + return c.Fake. + InvokesWatch(testing.NewWatchAction(machinetemplatesResource, c.ns, opts)) + +} + +// Create takes the representation of a machineTemplate and creates it. Returns the server's representation of the machineTemplate, and an error, if there is any. +func (c *FakeMachineTemplates) Create(machineTemplate *machine.MachineTemplate) (result *machine.MachineTemplate, err error) { + obj, err := c.Fake. + Invokes(testing.NewCreateAction(machinetemplatesResource, c.ns, machineTemplate), &machine.MachineTemplate{}) + + if obj == nil { + return nil, err + } + return obj.(*machine.MachineTemplate), err +} + +// Update takes the representation of a machineTemplate and updates it. Returns the server's representation of the machineTemplate, and an error, if there is any. +func (c *FakeMachineTemplates) Update(machineTemplate *machine.MachineTemplate) (result *machine.MachineTemplate, err error) { + obj, err := c.Fake. + Invokes(testing.NewUpdateAction(machinetemplatesResource, c.ns, machineTemplate), &machine.MachineTemplate{}) + + if obj == nil { + return nil, err + } + return obj.(*machine.MachineTemplate), err +} + +// Delete takes name of the machineTemplate and deletes it. Returns an error if one occurs. +func (c *FakeMachineTemplates) Delete(name string, options *v1.DeleteOptions) error { + _, err := c.Fake. + Invokes(testing.NewDeleteAction(machinetemplatesResource, c.ns, name), &machine.MachineTemplate{}) + + return err +} + +// DeleteCollection deletes a collection of objects. +func (c *FakeMachineTemplates) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error { + action := testing.NewDeleteCollectionAction(machinetemplatesResource, c.ns, listOptions) + + _, err := c.Fake.Invokes(action, &machine.MachineTemplateList{}) + return err +} + +// Patch applies the patch and returns the patched machineTemplate. +func (c *FakeMachineTemplates) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *machine.MachineTemplate, err error) { + obj, err := c.Fake. + Invokes(testing.NewPatchSubresourceAction(machinetemplatesResource, c.ns, name, data, subresources...), &machine.MachineTemplate{}) + + if obj == nil { + return nil, err + } + return obj.(*machine.MachineTemplate), err +} diff --git a/pkg/client/internalclientset/typed/node/internalversion/fake/fake_scale.go b/pkg/client/internalclientset/typed/machine/internalversion/fake/fake_scale.go similarity index 83% rename from pkg/client/internalclientset/typed/node/internalversion/fake/fake_scale.go rename to pkg/client/internalclientset/typed/machine/internalversion/fake/fake_scale.go index b8cd1563e..06ee73ef4 100644 --- a/pkg/client/internalclientset/typed/node/internalversion/fake/fake_scale.go +++ b/pkg/client/internalclientset/typed/machine/internalversion/fake/fake_scale.go @@ -2,6 +2,6 @@ package fake // FakeScales implements ScaleInterface type FakeScales struct { - Fake *FakeNode + Fake *FakeMachine ns string } diff --git a/pkg/client/internalclientset/typed/machine/internalversion/generated_expansion.go b/pkg/client/internalclientset/typed/machine/internalversion/generated_expansion.go new file mode 100644 index 000000000..1fb0411c5 --- /dev/null +++ b/pkg/client/internalclientset/typed/machine/internalversion/generated_expansion.go @@ -0,0 +1,13 @@ +package internalversion + +type AWSMachineClassExpansion interface{} + +type MachineExpansion interface{} + +type MachineDeploymentExpansion interface{} + +type MachineSetExpansion interface{} + +type MachineTemplateExpansion interface{} + +type ScaleExpansion interface{} diff --git a/pkg/client/internalclientset/typed/machine/internalversion/machine.go b/pkg/client/internalclientset/typed/machine/internalversion/machine.go new file mode 100644 index 000000000..541aecad4 --- /dev/null +++ b/pkg/client/internalclientset/typed/machine/internalversion/machine.go @@ -0,0 +1,129 @@ +package internalversion + +import ( + machine "github.com/gardener/node-controller-manager/pkg/apis/machine" + scheme "github.com/gardener/node-controller-manager/pkg/client/internalclientset/scheme" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + types "k8s.io/apimachinery/pkg/types" + watch "k8s.io/apimachinery/pkg/watch" + rest "k8s.io/client-go/rest" +) + +// MachinesGetter has a method to return a MachineInterface. +// A group's client should implement this interface. +type MachinesGetter interface { + Machines() MachineInterface +} + +// MachineInterface has methods to work with Machine resources. +type MachineInterface interface { + Create(*machine.Machine) (*machine.Machine, error) + Update(*machine.Machine) (*machine.Machine, error) + Delete(name string, options *v1.DeleteOptions) error + DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error + Get(name string, options v1.GetOptions) (*machine.Machine, error) + List(opts v1.ListOptions) (*machine.MachineList, error) + Watch(opts v1.ListOptions) (watch.Interface, error) + Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *machine.Machine, err error) + MachineExpansion +} + +// machines implements MachineInterface +type machines struct { + client rest.Interface +} + +// newMachines returns a Machines +func newMachines(c *MachineClient) *machines { + return &machines{ + client: c.RESTClient(), + } +} + +// 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 *machine.Machine, err error) { + result = &machine.Machine{} + err = c.client.Get(). + 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 *machine.MachineList, err error) { + result = &machine.MachineList{} + err = c.client.Get(). + 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(). + 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 *machine.Machine) (result *machine.Machine, err error) { + result = &machine.Machine{} + err = c.client.Post(). + 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 *machine.Machine) (result *machine.Machine, err error) { + result = &machine.Machine{} + err = c.client.Put(). + Resource("machines"). + Name(machine.Name). + 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(). + 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(). + 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 *machine.Machine, err error) { + result = &machine.Machine{} + err = c.client.Patch(pt). + Resource("machines"). + SubResource(subresources...). + Name(name). + Body(data). + Do(). + Into(result) + return +} diff --git a/pkg/client/internalclientset/typed/machine/internalversion/machine_client.go b/pkg/client/internalclientset/typed/machine/internalversion/machine_client.go new file mode 100644 index 000000000..a0eee8a30 --- /dev/null +++ b/pkg/client/internalclientset/typed/machine/internalversion/machine_client.go @@ -0,0 +1,108 @@ +package internalversion + +import ( + "github.com/gardener/node-controller-manager/pkg/client/internalclientset/scheme" + rest "k8s.io/client-go/rest" +) + +type MachineInterface interface { + RESTClient() rest.Interface + AWSMachineClassesGetter + MachinesGetter + MachineDeploymentsGetter + MachineSetsGetter + MachineTemplatesGetter + ScalesGetter +} + +// MachineClient is used to interact with features provided by the machine.sapcloud.io group. +type MachineClient struct { + restClient rest.Interface +} + +func (c *MachineClient) AWSMachineClasses() AWSMachineClassInterface { + return newAWSMachineClasses(c) +} + +func (c *MachineClient) Machines() MachineInterface { + return newMachines(c) +} + +func (c *MachineClient) MachineDeployments() MachineDeploymentInterface { + return newMachineDeployments(c) +} + +func (c *MachineClient) MachineSets() MachineSetInterface { + return newMachineSets(c) +} + +func (c *MachineClient) MachineTemplates(namespace string) MachineTemplateInterface { + return newMachineTemplates(c, namespace) +} + +func (c *MachineClient) Scales(namespace string) ScaleInterface { + return newScales(c, namespace) +} + +// NewForConfig creates a new MachineClient for the given config. +func NewForConfig(c *rest.Config) (*MachineClient, error) { + config := *c + if err := setConfigDefaults(&config); err != nil { + return nil, err + } + client, err := rest.RESTClientFor(&config) + if err != nil { + return nil, err + } + return &MachineClient{client}, nil +} + +// NewForConfigOrDie creates a new MachineClient for the given config and +// panics if there is an error in the config. +func NewForConfigOrDie(c *rest.Config) *MachineClient { + client, err := NewForConfig(c) + if err != nil { + panic(err) + } + return client +} + +// New creates a new MachineClient for the given RESTClient. +func New(c rest.Interface) *MachineClient { + return &MachineClient{c} +} + +func setConfigDefaults(config *rest.Config) error { + g, err := scheme.Registry.Group("machine.sapcloud.io") + if err != nil { + return err + } + + config.APIPath = "/apis" + if config.UserAgent == "" { + config.UserAgent = rest.DefaultKubernetesUserAgent() + } + if config.GroupVersion == nil || config.GroupVersion.Group != g.GroupVersion.Group { + gv := g.GroupVersion + config.GroupVersion = &gv + } + config.NegotiatedSerializer = scheme.Codecs + + if config.QPS == 0 { + config.QPS = 5 + } + if config.Burst == 0 { + config.Burst = 10 + } + + return nil +} + +// RESTClient returns a RESTClient that is used to communicate +// with API server by this client implementation. +func (c *MachineClient) RESTClient() rest.Interface { + if c == nil { + return nil + } + return c.restClient +} diff --git a/pkg/client/internalclientset/typed/machine/internalversion/machinedeployment.go b/pkg/client/internalclientset/typed/machine/internalversion/machinedeployment.go new file mode 100644 index 000000000..d3acb0c7a --- /dev/null +++ b/pkg/client/internalclientset/typed/machine/internalversion/machinedeployment.go @@ -0,0 +1,174 @@ +package internalversion + +import ( + machine "github.com/gardener/node-controller-manager/pkg/apis/machine" + scheme "github.com/gardener/node-controller-manager/pkg/client/internalclientset/scheme" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + types "k8s.io/apimachinery/pkg/types" + watch "k8s.io/apimachinery/pkg/watch" + rest "k8s.io/client-go/rest" +) + +// MachineDeploymentsGetter has a method to return a MachineDeploymentInterface. +// A group's client should implement this interface. +type MachineDeploymentsGetter interface { + MachineDeployments() MachineDeploymentInterface +} + +// MachineDeploymentInterface has methods to work with MachineDeployment resources. +type MachineDeploymentInterface interface { + Create(*machine.MachineDeployment) (*machine.MachineDeployment, error) + Update(*machine.MachineDeployment) (*machine.MachineDeployment, error) + UpdateStatus(*machine.MachineDeployment) (*machine.MachineDeployment, error) + Delete(name string, options *v1.DeleteOptions) error + DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error + Get(name string, options v1.GetOptions) (*machine.MachineDeployment, error) + List(opts v1.ListOptions) (*machine.MachineDeploymentList, error) + Watch(opts v1.ListOptions) (watch.Interface, error) + Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *machine.MachineDeployment, err error) + GetScale(machineDeploymentName string, options v1.GetOptions) (*machine.Scale, error) + UpdateScale(machineDeploymentName string, scale *machine.Scale) (*machine.Scale, error) + + MachineDeploymentExpansion +} + +// machineDeployments implements MachineDeploymentInterface +type machineDeployments struct { + client rest.Interface +} + +// newMachineDeployments returns a MachineDeployments +func newMachineDeployments(c *MachineClient) *machineDeployments { + return &machineDeployments{ + client: c.RESTClient(), + } +} + +// 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 *machine.MachineDeployment, err error) { + result = &machine.MachineDeployment{} + err = c.client.Get(). + 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 *machine.MachineDeploymentList, err error) { + result = &machine.MachineDeploymentList{} + err = c.client.Get(). + 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(). + 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 *machine.MachineDeployment) (result *machine.MachineDeployment, err error) { + result = &machine.MachineDeployment{} + err = c.client.Post(). + 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 *machine.MachineDeployment) (result *machine.MachineDeployment, err error) { + result = &machine.MachineDeployment{} + err = c.client.Put(). + 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 *machine.MachineDeployment) (result *machine.MachineDeployment, err error) { + result = &machine.MachineDeployment{} + err = c.client.Put(). + 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(). + 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(). + 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 *machine.MachineDeployment, err error) { + result = &machine.MachineDeployment{} + err = c.client.Patch(pt). + Resource("machinedeployments"). + SubResource(subresources...). + Name(name). + Body(data). + Do(). + Into(result) + return +} + +// GetScale takes name of the machineDeployment, and returns the corresponding machine.Scale object, and an error if there is any. +func (c *machineDeployments) GetScale(machineDeploymentName string, options v1.GetOptions) (result *machine.Scale, err error) { + result = &machine.Scale{} + err = c.client.Get(). + Resource("machinedeployments"). + Name(machineDeploymentName). + SubResource("scale"). + VersionedParams(&options, scheme.ParameterCodec). + Do(). + Into(result) + return +} + +// UpdateScale takes the top resource name and the representation of a scale and updates it. Returns the server's representation of the scale, and an error, if there is any. +func (c *machineDeployments) UpdateScale(machineDeploymentName string, scale *machine.Scale) (result *machine.Scale, err error) { + result = &machine.Scale{} + err = c.client.Put(). + Resource("machinedeployments"). + Name(machineDeploymentName). + SubResource("scale"). + Body(scale). + Do(). + Into(result) + return +} diff --git a/pkg/client/internalclientset/typed/machine/internalversion/machineset.go b/pkg/client/internalclientset/typed/machine/internalversion/machineset.go new file mode 100644 index 000000000..765f070ea --- /dev/null +++ b/pkg/client/internalclientset/typed/machine/internalversion/machineset.go @@ -0,0 +1,145 @@ +package internalversion + +import ( + machine "github.com/gardener/node-controller-manager/pkg/apis/machine" + scheme "github.com/gardener/node-controller-manager/pkg/client/internalclientset/scheme" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + types "k8s.io/apimachinery/pkg/types" + watch "k8s.io/apimachinery/pkg/watch" + rest "k8s.io/client-go/rest" +) + +// MachineSetsGetter has a method to return a MachineSetInterface. +// A group's client should implement this interface. +type MachineSetsGetter interface { + MachineSets() MachineSetInterface +} + +// MachineSetInterface has methods to work with MachineSet resources. +type MachineSetInterface interface { + Create(*machine.MachineSet) (*machine.MachineSet, error) + Update(*machine.MachineSet) (*machine.MachineSet, error) + UpdateStatus(*machine.MachineSet) (*machine.MachineSet, error) + Delete(name string, options *v1.DeleteOptions) error + DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error + Get(name string, options v1.GetOptions) (*machine.MachineSet, error) + List(opts v1.ListOptions) (*machine.MachineSetList, error) + Watch(opts v1.ListOptions) (watch.Interface, error) + Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *machine.MachineSet, err error) + MachineSetExpansion +} + +// machineSets implements MachineSetInterface +type machineSets struct { + client rest.Interface +} + +// newMachineSets returns a MachineSets +func newMachineSets(c *MachineClient) *machineSets { + return &machineSets{ + client: c.RESTClient(), + } +} + +// 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 *machine.MachineSet, err error) { + result = &machine.MachineSet{} + err = c.client.Get(). + 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 *machine.MachineSetList, err error) { + result = &machine.MachineSetList{} + err = c.client.Get(). + 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(). + 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 *machine.MachineSet) (result *machine.MachineSet, err error) { + result = &machine.MachineSet{} + err = c.client.Post(). + 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 *machine.MachineSet) (result *machine.MachineSet, err error) { + result = &machine.MachineSet{} + err = c.client.Put(). + 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 *machine.MachineSet) (result *machine.MachineSet, err error) { + result = &machine.MachineSet{} + err = c.client.Put(). + 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(). + 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(). + 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 *machine.MachineSet, err error) { + result = &machine.MachineSet{} + err = c.client.Patch(pt). + Resource("machinesets"). + SubResource(subresources...). + Name(name). + Body(data). + Do(). + Into(result) + return +} diff --git a/pkg/client/internalclientset/typed/machine/internalversion/machinetemplate.go b/pkg/client/internalclientset/typed/machine/internalversion/machinetemplate.go new file mode 100644 index 000000000..61f56995b --- /dev/null +++ b/pkg/client/internalclientset/typed/machine/internalversion/machinetemplate.go @@ -0,0 +1,139 @@ +package internalversion + +import ( + machine "github.com/gardener/node-controller-manager/pkg/apis/machine" + scheme "github.com/gardener/node-controller-manager/pkg/client/internalclientset/scheme" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + types "k8s.io/apimachinery/pkg/types" + watch "k8s.io/apimachinery/pkg/watch" + rest "k8s.io/client-go/rest" +) + +// MachineTemplatesGetter has a method to return a MachineTemplateInterface. +// A group's client should implement this interface. +type MachineTemplatesGetter interface { + MachineTemplates(namespace string) MachineTemplateInterface +} + +// MachineTemplateInterface has methods to work with MachineTemplate resources. +type MachineTemplateInterface interface { + Create(*machine.MachineTemplate) (*machine.MachineTemplate, error) + Update(*machine.MachineTemplate) (*machine.MachineTemplate, error) + Delete(name string, options *v1.DeleteOptions) error + DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error + Get(name string, options v1.GetOptions) (*machine.MachineTemplate, error) + List(opts v1.ListOptions) (*machine.MachineTemplateList, error) + Watch(opts v1.ListOptions) (watch.Interface, error) + Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *machine.MachineTemplate, err error) + MachineTemplateExpansion +} + +// machineTemplates implements MachineTemplateInterface +type machineTemplates struct { + client rest.Interface + ns string +} + +// newMachineTemplates returns a MachineTemplates +func newMachineTemplates(c *MachineClient, namespace string) *machineTemplates { + return &machineTemplates{ + client: c.RESTClient(), + ns: namespace, + } +} + +// Get takes name of the machineTemplate, and returns the corresponding machineTemplate object, and an error if there is any. +func (c *machineTemplates) Get(name string, options v1.GetOptions) (result *machine.MachineTemplate, err error) { + result = &machine.MachineTemplate{} + err = c.client.Get(). + Namespace(c.ns). + Resource("machinetemplates"). + Name(name). + VersionedParams(&options, scheme.ParameterCodec). + Do(). + Into(result) + return +} + +// List takes label and field selectors, and returns the list of MachineTemplates that match those selectors. +func (c *machineTemplates) List(opts v1.ListOptions) (result *machine.MachineTemplateList, err error) { + result = &machine.MachineTemplateList{} + err = c.client.Get(). + Namespace(c.ns). + Resource("machinetemplates"). + VersionedParams(&opts, scheme.ParameterCodec). + Do(). + Into(result) + return +} + +// Watch returns a watch.Interface that watches the requested machineTemplates. +func (c *machineTemplates) Watch(opts v1.ListOptions) (watch.Interface, error) { + opts.Watch = true + return c.client.Get(). + Namespace(c.ns). + Resource("machinetemplates"). + VersionedParams(&opts, scheme.ParameterCodec). + Watch() +} + +// Create takes the representation of a machineTemplate and creates it. Returns the server's representation of the machineTemplate, and an error, if there is any. +func (c *machineTemplates) Create(machineTemplate *machine.MachineTemplate) (result *machine.MachineTemplate, err error) { + result = &machine.MachineTemplate{} + err = c.client.Post(). + Namespace(c.ns). + Resource("machinetemplates"). + Body(machineTemplate). + Do(). + Into(result) + return +} + +// Update takes the representation of a machineTemplate and updates it. Returns the server's representation of the machineTemplate, and an error, if there is any. +func (c *machineTemplates) Update(machineTemplate *machine.MachineTemplate) (result *machine.MachineTemplate, err error) { + result = &machine.MachineTemplate{} + err = c.client.Put(). + Namespace(c.ns). + Resource("machinetemplates"). + Name(machineTemplate.Name). + Body(machineTemplate). + Do(). + Into(result) + return +} + +// Delete takes name of the machineTemplate and deletes it. Returns an error if one occurs. +func (c *machineTemplates) Delete(name string, options *v1.DeleteOptions) error { + return c.client.Delete(). + Namespace(c.ns). + Resource("machinetemplates"). + Name(name). + Body(options). + Do(). + Error() +} + +// DeleteCollection deletes a collection of objects. +func (c *machineTemplates) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error { + return c.client.Delete(). + Namespace(c.ns). + Resource("machinetemplates"). + VersionedParams(&listOptions, scheme.ParameterCodec). + Body(options). + Do(). + Error() +} + +// Patch applies the patch and returns the patched machineTemplate. +func (c *machineTemplates) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *machine.MachineTemplate, err error) { + result = &machine.MachineTemplate{} + err = c.client.Patch(pt). + Namespace(c.ns). + Resource("machinetemplates"). + SubResource(subresources...). + Name(name). + Body(data). + Do(). + Into(result) + return +} diff --git a/pkg/client/internalclientset/typed/node/internalversion/scale.go b/pkg/client/internalclientset/typed/machine/internalversion/scale.go similarity index 90% rename from pkg/client/internalclientset/typed/node/internalversion/scale.go rename to pkg/client/internalclientset/typed/machine/internalversion/scale.go index da096fd6c..54d4b928b 100644 --- a/pkg/client/internalclientset/typed/node/internalversion/scale.go +++ b/pkg/client/internalclientset/typed/machine/internalversion/scale.go @@ -22,7 +22,7 @@ type scales struct { } // newScales returns a Scales -func newScales(c *NodeClient, namespace string) *scales { +func newScales(c *MachineClient, namespace string) *scales { return &scales{ client: c.RESTClient(), ns: namespace, diff --git a/pkg/client/internalclientset/typed/node/internalversion/awsinstanceclass.go b/pkg/client/internalclientset/typed/node/internalversion/awsinstanceclass.go deleted file mode 100644 index d6198899d..000000000 --- a/pkg/client/internalclientset/typed/node/internalversion/awsinstanceclass.go +++ /dev/null @@ -1,129 +0,0 @@ -package internalversion - -import ( - node "github.com/gardener/node-controller-manager/pkg/apis/node" - scheme "github.com/gardener/node-controller-manager/pkg/client/internalclientset/scheme" - v1 "k8s.io/apimachinery/pkg/apis/meta/v1" - types "k8s.io/apimachinery/pkg/types" - watch "k8s.io/apimachinery/pkg/watch" - rest "k8s.io/client-go/rest" -) - -// AWSInstanceClassesGetter has a method to return a AWSInstanceClassInterface. -// A group's client should implement this interface. -type AWSInstanceClassesGetter interface { - AWSInstanceClasses() AWSInstanceClassInterface -} - -// AWSInstanceClassInterface has methods to work with AWSInstanceClass resources. -type AWSInstanceClassInterface interface { - Create(*node.AWSInstanceClass) (*node.AWSInstanceClass, error) - Update(*node.AWSInstanceClass) (*node.AWSInstanceClass, error) - Delete(name string, options *v1.DeleteOptions) error - DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error - Get(name string, options v1.GetOptions) (*node.AWSInstanceClass, error) - List(opts v1.ListOptions) (*node.AWSInstanceClassList, error) - Watch(opts v1.ListOptions) (watch.Interface, error) - Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *node.AWSInstanceClass, err error) - AWSInstanceClassExpansion -} - -// aWSInstanceClasses implements AWSInstanceClassInterface -type aWSInstanceClasses struct { - client rest.Interface -} - -// newAWSInstanceClasses returns a AWSInstanceClasses -func newAWSInstanceClasses(c *NodeClient) *aWSInstanceClasses { - return &aWSInstanceClasses{ - client: c.RESTClient(), - } -} - -// Get takes name of the aWSInstanceClass, and returns the corresponding aWSInstanceClass object, and an error if there is any. -func (c *aWSInstanceClasses) Get(name string, options v1.GetOptions) (result *node.AWSInstanceClass, err error) { - result = &node.AWSInstanceClass{} - err = c.client.Get(). - Resource("awsinstanceclasses"). - Name(name). - VersionedParams(&options, scheme.ParameterCodec). - Do(). - Into(result) - return -} - -// List takes label and field selectors, and returns the list of AWSInstanceClasses that match those selectors. -func (c *aWSInstanceClasses) List(opts v1.ListOptions) (result *node.AWSInstanceClassList, err error) { - result = &node.AWSInstanceClassList{} - err = c.client.Get(). - Resource("awsinstanceclasses"). - VersionedParams(&opts, scheme.ParameterCodec). - Do(). - Into(result) - return -} - -// Watch returns a watch.Interface that watches the requested aWSInstanceClasses. -func (c *aWSInstanceClasses) Watch(opts v1.ListOptions) (watch.Interface, error) { - opts.Watch = true - return c.client.Get(). - Resource("awsinstanceclasses"). - VersionedParams(&opts, scheme.ParameterCodec). - Watch() -} - -// Create takes the representation of a aWSInstanceClass and creates it. Returns the server's representation of the aWSInstanceClass, and an error, if there is any. -func (c *aWSInstanceClasses) Create(aWSInstanceClass *node.AWSInstanceClass) (result *node.AWSInstanceClass, err error) { - result = &node.AWSInstanceClass{} - err = c.client.Post(). - Resource("awsinstanceclasses"). - Body(aWSInstanceClass). - Do(). - Into(result) - return -} - -// Update takes the representation of a aWSInstanceClass and updates it. Returns the server's representation of the aWSInstanceClass, and an error, if there is any. -func (c *aWSInstanceClasses) Update(aWSInstanceClass *node.AWSInstanceClass) (result *node.AWSInstanceClass, err error) { - result = &node.AWSInstanceClass{} - err = c.client.Put(). - Resource("awsinstanceclasses"). - Name(aWSInstanceClass.Name). - Body(aWSInstanceClass). - Do(). - Into(result) - return -} - -// Delete takes name of the aWSInstanceClass and deletes it. Returns an error if one occurs. -func (c *aWSInstanceClasses) Delete(name string, options *v1.DeleteOptions) error { - return c.client.Delete(). - Resource("awsinstanceclasses"). - Name(name). - Body(options). - Do(). - Error() -} - -// DeleteCollection deletes a collection of objects. -func (c *aWSInstanceClasses) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error { - return c.client.Delete(). - Resource("awsinstanceclasses"). - VersionedParams(&listOptions, scheme.ParameterCodec). - Body(options). - Do(). - Error() -} - -// Patch applies the patch and returns the patched aWSInstanceClass. -func (c *aWSInstanceClasses) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *node.AWSInstanceClass, err error) { - result = &node.AWSInstanceClass{} - err = c.client.Patch(pt). - Resource("awsinstanceclasses"). - SubResource(subresources...). - Name(name). - Body(data). - Do(). - Into(result) - return -} diff --git a/pkg/client/internalclientset/typed/node/internalversion/fake/fake_awsinstanceclass.go b/pkg/client/internalclientset/typed/node/internalversion/fake/fake_awsinstanceclass.go deleted file mode 100644 index 2a55cc860..000000000 --- a/pkg/client/internalclientset/typed/node/internalversion/fake/fake_awsinstanceclass.go +++ /dev/null @@ -1,102 +0,0 @@ -package fake - -import ( - node "github.com/gardener/node-controller-manager/pkg/apis/node" - 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" -) - -// FakeAWSInstanceClasses implements AWSInstanceClassInterface -type FakeAWSInstanceClasses struct { - Fake *FakeNode -} - -var awsinstanceclassesResource = schema.GroupVersionResource{Group: "node.sapcloud.io", Version: "", Resource: "awsinstanceclasses"} - -var awsinstanceclassesKind = schema.GroupVersionKind{Group: "node.sapcloud.io", Version: "", Kind: "AWSInstanceClass"} - -// Get takes name of the aWSInstanceClass, and returns the corresponding aWSInstanceClass object, and an error if there is any. -func (c *FakeAWSInstanceClasses) Get(name string, options v1.GetOptions) (result *node.AWSInstanceClass, err error) { - obj, err := c.Fake. - Invokes(testing.NewRootGetAction(awsinstanceclassesResource, name), &node.AWSInstanceClass{}) - if obj == nil { - return nil, err - } - return obj.(*node.AWSInstanceClass), err -} - -// List takes label and field selectors, and returns the list of AWSInstanceClasses that match those selectors. -func (c *FakeAWSInstanceClasses) List(opts v1.ListOptions) (result *node.AWSInstanceClassList, err error) { - obj, err := c.Fake. - Invokes(testing.NewRootListAction(awsinstanceclassesResource, awsinstanceclassesKind, opts), &node.AWSInstanceClassList{}) - if obj == nil { - return nil, err - } - - label, _, _ := testing.ExtractFromListOptions(opts) - if label == nil { - label = labels.Everything() - } - list := &node.AWSInstanceClassList{} - for _, item := range obj.(*node.AWSInstanceClassList).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 aWSInstanceClasses. -func (c *FakeAWSInstanceClasses) Watch(opts v1.ListOptions) (watch.Interface, error) { - return c.Fake. - InvokesWatch(testing.NewRootWatchAction(awsinstanceclassesResource, opts)) -} - -// Create takes the representation of a aWSInstanceClass and creates it. Returns the server's representation of the aWSInstanceClass, and an error, if there is any. -func (c *FakeAWSInstanceClasses) Create(aWSInstanceClass *node.AWSInstanceClass) (result *node.AWSInstanceClass, err error) { - obj, err := c.Fake. - Invokes(testing.NewRootCreateAction(awsinstanceclassesResource, aWSInstanceClass), &node.AWSInstanceClass{}) - if obj == nil { - return nil, err - } - return obj.(*node.AWSInstanceClass), err -} - -// Update takes the representation of a aWSInstanceClass and updates it. Returns the server's representation of the aWSInstanceClass, and an error, if there is any. -func (c *FakeAWSInstanceClasses) Update(aWSInstanceClass *node.AWSInstanceClass) (result *node.AWSInstanceClass, err error) { - obj, err := c.Fake. - Invokes(testing.NewRootUpdateAction(awsinstanceclassesResource, aWSInstanceClass), &node.AWSInstanceClass{}) - if obj == nil { - return nil, err - } - return obj.(*node.AWSInstanceClass), err -} - -// Delete takes name of the aWSInstanceClass and deletes it. Returns an error if one occurs. -func (c *FakeAWSInstanceClasses) Delete(name string, options *v1.DeleteOptions) error { - _, err := c.Fake. - Invokes(testing.NewRootDeleteAction(awsinstanceclassesResource, name), &node.AWSInstanceClass{}) - return err -} - -// DeleteCollection deletes a collection of objects. -func (c *FakeAWSInstanceClasses) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error { - action := testing.NewRootDeleteCollectionAction(awsinstanceclassesResource, listOptions) - - _, err := c.Fake.Invokes(action, &node.AWSInstanceClassList{}) - return err -} - -// Patch applies the patch and returns the patched aWSInstanceClass. -func (c *FakeAWSInstanceClasses) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *node.AWSInstanceClass, err error) { - obj, err := c.Fake. - Invokes(testing.NewRootPatchSubresourceAction(awsinstanceclassesResource, name, data, subresources...), &node.AWSInstanceClass{}) - if obj == nil { - return nil, err - } - return obj.(*node.AWSInstanceClass), err -} diff --git a/pkg/client/internalclientset/typed/node/internalversion/fake/fake_instance.go b/pkg/client/internalclientset/typed/node/internalversion/fake/fake_instance.go deleted file mode 100644 index 7bfe7112b..000000000 --- a/pkg/client/internalclientset/typed/node/internalversion/fake/fake_instance.go +++ /dev/null @@ -1,102 +0,0 @@ -package fake - -import ( - node "github.com/gardener/node-controller-manager/pkg/apis/node" - 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" -) - -// FakeInstances implements InstanceInterface -type FakeInstances struct { - Fake *FakeNode -} - -var instancesResource = schema.GroupVersionResource{Group: "node.sapcloud.io", Version: "", Resource: "instances"} - -var instancesKind = schema.GroupVersionKind{Group: "node.sapcloud.io", Version: "", Kind: "Instance"} - -// Get takes name of the instance, and returns the corresponding instance object, and an error if there is any. -func (c *FakeInstances) Get(name string, options v1.GetOptions) (result *node.Instance, err error) { - obj, err := c.Fake. - Invokes(testing.NewRootGetAction(instancesResource, name), &node.Instance{}) - if obj == nil { - return nil, err - } - return obj.(*node.Instance), err -} - -// List takes label and field selectors, and returns the list of Instances that match those selectors. -func (c *FakeInstances) List(opts v1.ListOptions) (result *node.InstanceList, err error) { - obj, err := c.Fake. - Invokes(testing.NewRootListAction(instancesResource, instancesKind, opts), &node.InstanceList{}) - if obj == nil { - return nil, err - } - - label, _, _ := testing.ExtractFromListOptions(opts) - if label == nil { - label = labels.Everything() - } - list := &node.InstanceList{} - for _, item := range obj.(*node.InstanceList).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 instances. -func (c *FakeInstances) Watch(opts v1.ListOptions) (watch.Interface, error) { - return c.Fake. - InvokesWatch(testing.NewRootWatchAction(instancesResource, opts)) -} - -// Create takes the representation of a instance and creates it. Returns the server's representation of the instance, and an error, if there is any. -func (c *FakeInstances) Create(instance *node.Instance) (result *node.Instance, err error) { - obj, err := c.Fake. - Invokes(testing.NewRootCreateAction(instancesResource, instance), &node.Instance{}) - if obj == nil { - return nil, err - } - return obj.(*node.Instance), err -} - -// Update takes the representation of a instance and updates it. Returns the server's representation of the instance, and an error, if there is any. -func (c *FakeInstances) Update(instance *node.Instance) (result *node.Instance, err error) { - obj, err := c.Fake. - Invokes(testing.NewRootUpdateAction(instancesResource, instance), &node.Instance{}) - if obj == nil { - return nil, err - } - return obj.(*node.Instance), err -} - -// Delete takes name of the instance and deletes it. Returns an error if one occurs. -func (c *FakeInstances) Delete(name string, options *v1.DeleteOptions) error { - _, err := c.Fake. - Invokes(testing.NewRootDeleteAction(instancesResource, name), &node.Instance{}) - return err -} - -// DeleteCollection deletes a collection of objects. -func (c *FakeInstances) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error { - action := testing.NewRootDeleteCollectionAction(instancesResource, listOptions) - - _, err := c.Fake.Invokes(action, &node.InstanceList{}) - return err -} - -// Patch applies the patch and returns the patched instance. -func (c *FakeInstances) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *node.Instance, err error) { - obj, err := c.Fake. - Invokes(testing.NewRootPatchSubresourceAction(instancesResource, name, data, subresources...), &node.Instance{}) - if obj == nil { - return nil, err - } - return obj.(*node.Instance), err -} diff --git a/pkg/client/internalclientset/typed/node/internalversion/fake/fake_instancedeployment.go b/pkg/client/internalclientset/typed/node/internalversion/fake/fake_instancedeployment.go deleted file mode 100644 index c22f0961d..000000000 --- a/pkg/client/internalclientset/typed/node/internalversion/fake/fake_instancedeployment.go +++ /dev/null @@ -1,133 +0,0 @@ -package fake - -import ( - node "github.com/gardener/node-controller-manager/pkg/apis/node" - 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" -) - -// FakeInstanceDeployments implements InstanceDeploymentInterface -type FakeInstanceDeployments struct { - Fake *FakeNode -} - -var instancedeploymentsResource = schema.GroupVersionResource{Group: "node.sapcloud.io", Version: "", Resource: "instancedeployments"} - -var instancedeploymentsKind = schema.GroupVersionKind{Group: "node.sapcloud.io", Version: "", Kind: "InstanceDeployment"} - -// Get takes name of the instanceDeployment, and returns the corresponding instanceDeployment object, and an error if there is any. -func (c *FakeInstanceDeployments) Get(name string, options v1.GetOptions) (result *node.InstanceDeployment, err error) { - obj, err := c.Fake. - Invokes(testing.NewRootGetAction(instancedeploymentsResource, name), &node.InstanceDeployment{}) - if obj == nil { - return nil, err - } - return obj.(*node.InstanceDeployment), err -} - -// List takes label and field selectors, and returns the list of InstanceDeployments that match those selectors. -func (c *FakeInstanceDeployments) List(opts v1.ListOptions) (result *node.InstanceDeploymentList, err error) { - obj, err := c.Fake. - Invokes(testing.NewRootListAction(instancedeploymentsResource, instancedeploymentsKind, opts), &node.InstanceDeploymentList{}) - if obj == nil { - return nil, err - } - - label, _, _ := testing.ExtractFromListOptions(opts) - if label == nil { - label = labels.Everything() - } - list := &node.InstanceDeploymentList{} - for _, item := range obj.(*node.InstanceDeploymentList).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 instanceDeployments. -func (c *FakeInstanceDeployments) Watch(opts v1.ListOptions) (watch.Interface, error) { - return c.Fake. - InvokesWatch(testing.NewRootWatchAction(instancedeploymentsResource, opts)) -} - -// Create takes the representation of a instanceDeployment and creates it. Returns the server's representation of the instanceDeployment, and an error, if there is any. -func (c *FakeInstanceDeployments) Create(instanceDeployment *node.InstanceDeployment) (result *node.InstanceDeployment, err error) { - obj, err := c.Fake. - Invokes(testing.NewRootCreateAction(instancedeploymentsResource, instanceDeployment), &node.InstanceDeployment{}) - if obj == nil { - return nil, err - } - return obj.(*node.InstanceDeployment), err -} - -// Update takes the representation of a instanceDeployment and updates it. Returns the server's representation of the instanceDeployment, and an error, if there is any. -func (c *FakeInstanceDeployments) Update(instanceDeployment *node.InstanceDeployment) (result *node.InstanceDeployment, err error) { - obj, err := c.Fake. - Invokes(testing.NewRootUpdateAction(instancedeploymentsResource, instanceDeployment), &node.InstanceDeployment{}) - if obj == nil { - return nil, err - } - return obj.(*node.InstanceDeployment), 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 *FakeInstanceDeployments) UpdateStatus(instanceDeployment *node.InstanceDeployment) (*node.InstanceDeployment, error) { - obj, err := c.Fake. - Invokes(testing.NewRootUpdateSubresourceAction(instancedeploymentsResource, "status", instanceDeployment), &node.InstanceDeployment{}) - if obj == nil { - return nil, err - } - return obj.(*node.InstanceDeployment), err -} - -// Delete takes name of the instanceDeployment and deletes it. Returns an error if one occurs. -func (c *FakeInstanceDeployments) Delete(name string, options *v1.DeleteOptions) error { - _, err := c.Fake. - Invokes(testing.NewRootDeleteAction(instancedeploymentsResource, name), &node.InstanceDeployment{}) - return err -} - -// DeleteCollection deletes a collection of objects. -func (c *FakeInstanceDeployments) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error { - action := testing.NewRootDeleteCollectionAction(instancedeploymentsResource, listOptions) - - _, err := c.Fake.Invokes(action, &node.InstanceDeploymentList{}) - return err -} - -// Patch applies the patch and returns the patched instanceDeployment. -func (c *FakeInstanceDeployments) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *node.InstanceDeployment, err error) { - obj, err := c.Fake. - Invokes(testing.NewRootPatchSubresourceAction(instancedeploymentsResource, name, data, subresources...), &node.InstanceDeployment{}) - if obj == nil { - return nil, err - } - return obj.(*node.InstanceDeployment), err -} - -// GetScale takes name of the instanceDeployment, and returns the corresponding scale object, and an error if there is any. -func (c *FakeInstanceDeployments) GetScale(instanceDeploymentName string, options v1.GetOptions) (result *node.Scale, err error) { - obj, err := c.Fake. - Invokes(testing.NewRootGetAction(instancedeploymentsResource, instanceDeploymentName), &node.Scale{}) - if obj == nil { - return nil, err - } - return obj.(*node.Scale), err -} - -// UpdateScale takes the representation of a scale and updates it. Returns the server's representation of the scale, and an error, if there is any. -func (c *FakeInstanceDeployments) UpdateScale(instanceDeploymentName string, scale *node.Scale) (result *node.Scale, err error) { - obj, err := c.Fake. - Invokes(testing.NewRootUpdateAction(instancedeploymentsResource, instanceDeployment), &node.InstanceDeployment{}) - if obj == nil { - return nil, err - } - return obj.(*node.Scale), err -} diff --git a/pkg/client/internalclientset/typed/node/internalversion/fake/fake_instanceset.go b/pkg/client/internalclientset/typed/node/internalversion/fake/fake_instanceset.go deleted file mode 100644 index 370e30e32..000000000 --- a/pkg/client/internalclientset/typed/node/internalversion/fake/fake_instanceset.go +++ /dev/null @@ -1,113 +0,0 @@ -package fake - -import ( - node "github.com/gardener/node-controller-manager/pkg/apis/node" - 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" -) - -// FakeInstanceSets implements InstanceSetInterface -type FakeInstanceSets struct { - Fake *FakeNode -} - -var instancesetsResource = schema.GroupVersionResource{Group: "node.sapcloud.io", Version: "", Resource: "instancesets"} - -var instancesetsKind = schema.GroupVersionKind{Group: "node.sapcloud.io", Version: "", Kind: "InstanceSet"} - -// Get takes name of the instanceSet, and returns the corresponding instanceSet object, and an error if there is any. -func (c *FakeInstanceSets) Get(name string, options v1.GetOptions) (result *node.InstanceSet, err error) { - obj, err := c.Fake. - Invokes(testing.NewRootGetAction(instancesetsResource, name), &node.InstanceSet{}) - if obj == nil { - return nil, err - } - return obj.(*node.InstanceSet), err -} - -// List takes label and field selectors, and returns the list of InstanceSets that match those selectors. -func (c *FakeInstanceSets) List(opts v1.ListOptions) (result *node.InstanceSetList, err error) { - obj, err := c.Fake. - Invokes(testing.NewRootListAction(instancesetsResource, instancesetsKind, opts), &node.InstanceSetList{}) - if obj == nil { - return nil, err - } - - label, _, _ := testing.ExtractFromListOptions(opts) - if label == nil { - label = labels.Everything() - } - list := &node.InstanceSetList{} - for _, item := range obj.(*node.InstanceSetList).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 instanceSets. -func (c *FakeInstanceSets) Watch(opts v1.ListOptions) (watch.Interface, error) { - return c.Fake. - InvokesWatch(testing.NewRootWatchAction(instancesetsResource, opts)) -} - -// Create takes the representation of a instanceSet and creates it. Returns the server's representation of the instanceSet, and an error, if there is any. -func (c *FakeInstanceSets) Create(instanceSet *node.InstanceSet) (result *node.InstanceSet, err error) { - obj, err := c.Fake. - Invokes(testing.NewRootCreateAction(instancesetsResource, instanceSet), &node.InstanceSet{}) - if obj == nil { - return nil, err - } - return obj.(*node.InstanceSet), err -} - -// Update takes the representation of a instanceSet and updates it. Returns the server's representation of the instanceSet, and an error, if there is any. -func (c *FakeInstanceSets) Update(instanceSet *node.InstanceSet) (result *node.InstanceSet, err error) { - obj, err := c.Fake. - Invokes(testing.NewRootUpdateAction(instancesetsResource, instanceSet), &node.InstanceSet{}) - if obj == nil { - return nil, err - } - return obj.(*node.InstanceSet), 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 *FakeInstanceSets) UpdateStatus(instanceSet *node.InstanceSet) (*node.InstanceSet, error) { - obj, err := c.Fake. - Invokes(testing.NewRootUpdateSubresourceAction(instancesetsResource, "status", instanceSet), &node.InstanceSet{}) - if obj == nil { - return nil, err - } - return obj.(*node.InstanceSet), err -} - -// Delete takes name of the instanceSet and deletes it. Returns an error if one occurs. -func (c *FakeInstanceSets) Delete(name string, options *v1.DeleteOptions) error { - _, err := c.Fake. - Invokes(testing.NewRootDeleteAction(instancesetsResource, name), &node.InstanceSet{}) - return err -} - -// DeleteCollection deletes a collection of objects. -func (c *FakeInstanceSets) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error { - action := testing.NewRootDeleteCollectionAction(instancesetsResource, listOptions) - - _, err := c.Fake.Invokes(action, &node.InstanceSetList{}) - return err -} - -// Patch applies the patch and returns the patched instanceSet. -func (c *FakeInstanceSets) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *node.InstanceSet, err error) { - obj, err := c.Fake. - Invokes(testing.NewRootPatchSubresourceAction(instancesetsResource, name, data, subresources...), &node.InstanceSet{}) - if obj == nil { - return nil, err - } - return obj.(*node.InstanceSet), err -} diff --git a/pkg/client/internalclientset/typed/node/internalversion/fake/fake_instancetemplate.go b/pkg/client/internalclientset/typed/node/internalversion/fake/fake_instancetemplate.go deleted file mode 100644 index 0e7800d70..000000000 --- a/pkg/client/internalclientset/typed/node/internalversion/fake/fake_instancetemplate.go +++ /dev/null @@ -1,110 +0,0 @@ -package fake - -import ( - node "github.com/gardener/node-controller-manager/pkg/apis/node" - 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" -) - -// FakeInstanceTemplates implements InstanceTemplateInterface -type FakeInstanceTemplates struct { - Fake *FakeNode - ns string -} - -var instancetemplatesResource = schema.GroupVersionResource{Group: "node.sapcloud.io", Version: "", Resource: "instancetemplates"} - -var instancetemplatesKind = schema.GroupVersionKind{Group: "node.sapcloud.io", Version: "", Kind: "InstanceTemplate"} - -// Get takes name of the instanceTemplate, and returns the corresponding instanceTemplate object, and an error if there is any. -func (c *FakeInstanceTemplates) Get(name string, options v1.GetOptions) (result *node.InstanceTemplate, err error) { - obj, err := c.Fake. - Invokes(testing.NewGetAction(instancetemplatesResource, c.ns, name), &node.InstanceTemplate{}) - - if obj == nil { - return nil, err - } - return obj.(*node.InstanceTemplate), err -} - -// List takes label and field selectors, and returns the list of InstanceTemplates that match those selectors. -func (c *FakeInstanceTemplates) List(opts v1.ListOptions) (result *node.InstanceTemplateList, err error) { - obj, err := c.Fake. - Invokes(testing.NewListAction(instancetemplatesResource, instancetemplatesKind, c.ns, opts), &node.InstanceTemplateList{}) - - if obj == nil { - return nil, err - } - - label, _, _ := testing.ExtractFromListOptions(opts) - if label == nil { - label = labels.Everything() - } - list := &node.InstanceTemplateList{} - for _, item := range obj.(*node.InstanceTemplateList).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 instanceTemplates. -func (c *FakeInstanceTemplates) Watch(opts v1.ListOptions) (watch.Interface, error) { - return c.Fake. - InvokesWatch(testing.NewWatchAction(instancetemplatesResource, c.ns, opts)) - -} - -// Create takes the representation of a instanceTemplate and creates it. Returns the server's representation of the instanceTemplate, and an error, if there is any. -func (c *FakeInstanceTemplates) Create(instanceTemplate *node.InstanceTemplate) (result *node.InstanceTemplate, err error) { - obj, err := c.Fake. - Invokes(testing.NewCreateAction(instancetemplatesResource, c.ns, instanceTemplate), &node.InstanceTemplate{}) - - if obj == nil { - return nil, err - } - return obj.(*node.InstanceTemplate), err -} - -// Update takes the representation of a instanceTemplate and updates it. Returns the server's representation of the instanceTemplate, and an error, if there is any. -func (c *FakeInstanceTemplates) Update(instanceTemplate *node.InstanceTemplate) (result *node.InstanceTemplate, err error) { - obj, err := c.Fake. - Invokes(testing.NewUpdateAction(instancetemplatesResource, c.ns, instanceTemplate), &node.InstanceTemplate{}) - - if obj == nil { - return nil, err - } - return obj.(*node.InstanceTemplate), err -} - -// Delete takes name of the instanceTemplate and deletes it. Returns an error if one occurs. -func (c *FakeInstanceTemplates) Delete(name string, options *v1.DeleteOptions) error { - _, err := c.Fake. - Invokes(testing.NewDeleteAction(instancetemplatesResource, c.ns, name), &node.InstanceTemplate{}) - - return err -} - -// DeleteCollection deletes a collection of objects. -func (c *FakeInstanceTemplates) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error { - action := testing.NewDeleteCollectionAction(instancetemplatesResource, c.ns, listOptions) - - _, err := c.Fake.Invokes(action, &node.InstanceTemplateList{}) - return err -} - -// Patch applies the patch and returns the patched instanceTemplate. -func (c *FakeInstanceTemplates) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *node.InstanceTemplate, err error) { - obj, err := c.Fake. - Invokes(testing.NewPatchSubresourceAction(instancetemplatesResource, c.ns, name, data, subresources...), &node.InstanceTemplate{}) - - if obj == nil { - return nil, err - } - return obj.(*node.InstanceTemplate), err -} diff --git a/pkg/client/internalclientset/typed/node/internalversion/fake/fake_node_client.go b/pkg/client/internalclientset/typed/node/internalversion/fake/fake_node_client.go deleted file mode 100644 index 584ca1ff4..000000000 --- a/pkg/client/internalclientset/typed/node/internalversion/fake/fake_node_client.go +++ /dev/null @@ -1,42 +0,0 @@ -package fake - -import ( - internalversion "github.com/gardener/node-controller-manager/pkg/client/internalclientset/typed/node/internalversion" - rest "k8s.io/client-go/rest" - testing "k8s.io/client-go/testing" -) - -type FakeNode struct { - *testing.Fake -} - -func (c *FakeNode) AWSInstanceClasses() internalversion.AWSInstanceClassInterface { - return &FakeAWSInstanceClasses{c} -} - -func (c *FakeNode) Instances() internalversion.InstanceInterface { - return &FakeInstances{c} -} - -func (c *FakeNode) InstanceDeployments() internalversion.InstanceDeploymentInterface { - return &FakeInstanceDeployments{c} -} - -func (c *FakeNode) InstanceSets() internalversion.InstanceSetInterface { - return &FakeInstanceSets{c} -} - -func (c *FakeNode) InstanceTemplates(namespace string) internalversion.InstanceTemplateInterface { - return &FakeInstanceTemplates{c, namespace} -} - -func (c *FakeNode) Scales(namespace string) internalversion.ScaleInterface { - return &FakeScales{c, namespace} -} - -// RESTClient returns a RESTClient that is used to communicate -// with API server by this client implementation. -func (c *FakeNode) RESTClient() rest.Interface { - var ret *rest.RESTClient - return ret -} diff --git a/pkg/client/internalclientset/typed/node/internalversion/generated_expansion.go b/pkg/client/internalclientset/typed/node/internalversion/generated_expansion.go deleted file mode 100644 index b4e962a7e..000000000 --- a/pkg/client/internalclientset/typed/node/internalversion/generated_expansion.go +++ /dev/null @@ -1,13 +0,0 @@ -package internalversion - -type AWSInstanceClassExpansion interface{} - -type InstanceExpansion interface{} - -type InstanceDeploymentExpansion interface{} - -type InstanceSetExpansion interface{} - -type InstanceTemplateExpansion interface{} - -type ScaleExpansion interface{} diff --git a/pkg/client/internalclientset/typed/node/internalversion/instance.go b/pkg/client/internalclientset/typed/node/internalversion/instance.go deleted file mode 100644 index c41c2fc4d..000000000 --- a/pkg/client/internalclientset/typed/node/internalversion/instance.go +++ /dev/null @@ -1,129 +0,0 @@ -package internalversion - -import ( - node "github.com/gardener/node-controller-manager/pkg/apis/node" - scheme "github.com/gardener/node-controller-manager/pkg/client/internalclientset/scheme" - v1 "k8s.io/apimachinery/pkg/apis/meta/v1" - types "k8s.io/apimachinery/pkg/types" - watch "k8s.io/apimachinery/pkg/watch" - rest "k8s.io/client-go/rest" -) - -// InstancesGetter has a method to return a InstanceInterface. -// A group's client should implement this interface. -type InstancesGetter interface { - Instances() InstanceInterface -} - -// InstanceInterface has methods to work with Instance resources. -type InstanceInterface interface { - Create(*node.Instance) (*node.Instance, error) - Update(*node.Instance) (*node.Instance, error) - Delete(name string, options *v1.DeleteOptions) error - DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error - Get(name string, options v1.GetOptions) (*node.Instance, error) - List(opts v1.ListOptions) (*node.InstanceList, error) - Watch(opts v1.ListOptions) (watch.Interface, error) - Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *node.Instance, err error) - InstanceExpansion -} - -// instances implements InstanceInterface -type instances struct { - client rest.Interface -} - -// newInstances returns a Instances -func newInstances(c *NodeClient) *instances { - return &instances{ - client: c.RESTClient(), - } -} - -// Get takes name of the instance, and returns the corresponding instance object, and an error if there is any. -func (c *instances) Get(name string, options v1.GetOptions) (result *node.Instance, err error) { - result = &node.Instance{} - err = c.client.Get(). - Resource("instances"). - Name(name). - VersionedParams(&options, scheme.ParameterCodec). - Do(). - Into(result) - return -} - -// List takes label and field selectors, and returns the list of Instances that match those selectors. -func (c *instances) List(opts v1.ListOptions) (result *node.InstanceList, err error) { - result = &node.InstanceList{} - err = c.client.Get(). - Resource("instances"). - VersionedParams(&opts, scheme.ParameterCodec). - Do(). - Into(result) - return -} - -// Watch returns a watch.Interface that watches the requested instances. -func (c *instances) Watch(opts v1.ListOptions) (watch.Interface, error) { - opts.Watch = true - return c.client.Get(). - Resource("instances"). - VersionedParams(&opts, scheme.ParameterCodec). - Watch() -} - -// Create takes the representation of a instance and creates it. Returns the server's representation of the instance, and an error, if there is any. -func (c *instances) Create(instance *node.Instance) (result *node.Instance, err error) { - result = &node.Instance{} - err = c.client.Post(). - Resource("instances"). - Body(instance). - Do(). - Into(result) - return -} - -// Update takes the representation of a instance and updates it. Returns the server's representation of the instance, and an error, if there is any. -func (c *instances) Update(instance *node.Instance) (result *node.Instance, err error) { - result = &node.Instance{} - err = c.client.Put(). - Resource("instances"). - Name(instance.Name). - Body(instance). - Do(). - Into(result) - return -} - -// Delete takes name of the instance and deletes it. Returns an error if one occurs. -func (c *instances) Delete(name string, options *v1.DeleteOptions) error { - return c.client.Delete(). - Resource("instances"). - Name(name). - Body(options). - Do(). - Error() -} - -// DeleteCollection deletes a collection of objects. -func (c *instances) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error { - return c.client.Delete(). - Resource("instances"). - VersionedParams(&listOptions, scheme.ParameterCodec). - Body(options). - Do(). - Error() -} - -// Patch applies the patch and returns the patched instance. -func (c *instances) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *node.Instance, err error) { - result = &node.Instance{} - err = c.client.Patch(pt). - Resource("instances"). - SubResource(subresources...). - Name(name). - Body(data). - Do(). - Into(result) - return -} diff --git a/pkg/client/internalclientset/typed/node/internalversion/instancedeployment.go b/pkg/client/internalclientset/typed/node/internalversion/instancedeployment.go deleted file mode 100644 index a20c1b3ca..000000000 --- a/pkg/client/internalclientset/typed/node/internalversion/instancedeployment.go +++ /dev/null @@ -1,174 +0,0 @@ -package internalversion - -import ( - node "github.com/gardener/node-controller-manager/pkg/apis/node" - scheme "github.com/gardener/node-controller-manager/pkg/client/internalclientset/scheme" - v1 "k8s.io/apimachinery/pkg/apis/meta/v1" - types "k8s.io/apimachinery/pkg/types" - watch "k8s.io/apimachinery/pkg/watch" - rest "k8s.io/client-go/rest" -) - -// InstanceDeploymentsGetter has a method to return a InstanceDeploymentInterface. -// A group's client should implement this interface. -type InstanceDeploymentsGetter interface { - InstanceDeployments() InstanceDeploymentInterface -} - -// InstanceDeploymentInterface has methods to work with InstanceDeployment resources. -type InstanceDeploymentInterface interface { - Create(*node.InstanceDeployment) (*node.InstanceDeployment, error) - Update(*node.InstanceDeployment) (*node.InstanceDeployment, error) - UpdateStatus(*node.InstanceDeployment) (*node.InstanceDeployment, error) - Delete(name string, options *v1.DeleteOptions) error - DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error - Get(name string, options v1.GetOptions) (*node.InstanceDeployment, error) - List(opts v1.ListOptions) (*node.InstanceDeploymentList, error) - Watch(opts v1.ListOptions) (watch.Interface, error) - Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *node.InstanceDeployment, err error) - GetScale(instanceDeploymentName string, options v1.GetOptions) (*node.Scale, error) - UpdateScale(instanceDeploymentName string, scale *node.Scale) (*node.Scale, error) - - InstanceDeploymentExpansion -} - -// instanceDeployments implements InstanceDeploymentInterface -type instanceDeployments struct { - client rest.Interface -} - -// newInstanceDeployments returns a InstanceDeployments -func newInstanceDeployments(c *NodeClient) *instanceDeployments { - return &instanceDeployments{ - client: c.RESTClient(), - } -} - -// Get takes name of the instanceDeployment, and returns the corresponding instanceDeployment object, and an error if there is any. -func (c *instanceDeployments) Get(name string, options v1.GetOptions) (result *node.InstanceDeployment, err error) { - result = &node.InstanceDeployment{} - err = c.client.Get(). - Resource("instancedeployments"). - Name(name). - VersionedParams(&options, scheme.ParameterCodec). - Do(). - Into(result) - return -} - -// List takes label and field selectors, and returns the list of InstanceDeployments that match those selectors. -func (c *instanceDeployments) List(opts v1.ListOptions) (result *node.InstanceDeploymentList, err error) { - result = &node.InstanceDeploymentList{} - err = c.client.Get(). - Resource("instancedeployments"). - VersionedParams(&opts, scheme.ParameterCodec). - Do(). - Into(result) - return -} - -// Watch returns a watch.Interface that watches the requested instanceDeployments. -func (c *instanceDeployments) Watch(opts v1.ListOptions) (watch.Interface, error) { - opts.Watch = true - return c.client.Get(). - Resource("instancedeployments"). - VersionedParams(&opts, scheme.ParameterCodec). - Watch() -} - -// Create takes the representation of a instanceDeployment and creates it. Returns the server's representation of the instanceDeployment, and an error, if there is any. -func (c *instanceDeployments) Create(instanceDeployment *node.InstanceDeployment) (result *node.InstanceDeployment, err error) { - result = &node.InstanceDeployment{} - err = c.client.Post(). - Resource("instancedeployments"). - Body(instanceDeployment). - Do(). - Into(result) - return -} - -// Update takes the representation of a instanceDeployment and updates it. Returns the server's representation of the instanceDeployment, and an error, if there is any. -func (c *instanceDeployments) Update(instanceDeployment *node.InstanceDeployment) (result *node.InstanceDeployment, err error) { - result = &node.InstanceDeployment{} - err = c.client.Put(). - Resource("instancedeployments"). - Name(instanceDeployment.Name). - Body(instanceDeployment). - 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 *instanceDeployments) UpdateStatus(instanceDeployment *node.InstanceDeployment) (result *node.InstanceDeployment, err error) { - result = &node.InstanceDeployment{} - err = c.client.Put(). - Resource("instancedeployments"). - Name(instanceDeployment.Name). - SubResource("status"). - Body(instanceDeployment). - Do(). - Into(result) - return -} - -// Delete takes name of the instanceDeployment and deletes it. Returns an error if one occurs. -func (c *instanceDeployments) Delete(name string, options *v1.DeleteOptions) error { - return c.client.Delete(). - Resource("instancedeployments"). - Name(name). - Body(options). - Do(). - Error() -} - -// DeleteCollection deletes a collection of objects. -func (c *instanceDeployments) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error { - return c.client.Delete(). - Resource("instancedeployments"). - VersionedParams(&listOptions, scheme.ParameterCodec). - Body(options). - Do(). - Error() -} - -// Patch applies the patch and returns the patched instanceDeployment. -func (c *instanceDeployments) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *node.InstanceDeployment, err error) { - result = &node.InstanceDeployment{} - err = c.client.Patch(pt). - Resource("instancedeployments"). - SubResource(subresources...). - Name(name). - Body(data). - Do(). - Into(result) - return -} - -// GetScale takes name of the instanceDeployment, and returns the corresponding node.Scale object, and an error if there is any. -func (c *instanceDeployments) GetScale(instanceDeploymentName string, options v1.GetOptions) (result *node.Scale, err error) { - result = &node.Scale{} - err = c.client.Get(). - Resource("instancedeployments"). - Name(instanceDeploymentName). - SubResource("scale"). - VersionedParams(&options, scheme.ParameterCodec). - Do(). - Into(result) - return -} - -// UpdateScale takes the top resource name and the representation of a scale and updates it. Returns the server's representation of the scale, and an error, if there is any. -func (c *instanceDeployments) UpdateScale(instanceDeploymentName string, scale *node.Scale) (result *node.Scale, err error) { - result = &node.Scale{} - err = c.client.Put(). - Resource("instancedeployments"). - Name(instanceDeploymentName). - SubResource("scale"). - Body(scale). - Do(). - Into(result) - return -} diff --git a/pkg/client/internalclientset/typed/node/internalversion/instanceset.go b/pkg/client/internalclientset/typed/node/internalversion/instanceset.go deleted file mode 100644 index 74bcb6912..000000000 --- a/pkg/client/internalclientset/typed/node/internalversion/instanceset.go +++ /dev/null @@ -1,145 +0,0 @@ -package internalversion - -import ( - node "github.com/gardener/node-controller-manager/pkg/apis/node" - scheme "github.com/gardener/node-controller-manager/pkg/client/internalclientset/scheme" - v1 "k8s.io/apimachinery/pkg/apis/meta/v1" - types "k8s.io/apimachinery/pkg/types" - watch "k8s.io/apimachinery/pkg/watch" - rest "k8s.io/client-go/rest" -) - -// InstanceSetsGetter has a method to return a InstanceSetInterface. -// A group's client should implement this interface. -type InstanceSetsGetter interface { - InstanceSets() InstanceSetInterface -} - -// InstanceSetInterface has methods to work with InstanceSet resources. -type InstanceSetInterface interface { - Create(*node.InstanceSet) (*node.InstanceSet, error) - Update(*node.InstanceSet) (*node.InstanceSet, error) - UpdateStatus(*node.InstanceSet) (*node.InstanceSet, error) - Delete(name string, options *v1.DeleteOptions) error - DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error - Get(name string, options v1.GetOptions) (*node.InstanceSet, error) - List(opts v1.ListOptions) (*node.InstanceSetList, error) - Watch(opts v1.ListOptions) (watch.Interface, error) - Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *node.InstanceSet, err error) - InstanceSetExpansion -} - -// instanceSets implements InstanceSetInterface -type instanceSets struct { - client rest.Interface -} - -// newInstanceSets returns a InstanceSets -func newInstanceSets(c *NodeClient) *instanceSets { - return &instanceSets{ - client: c.RESTClient(), - } -} - -// Get takes name of the instanceSet, and returns the corresponding instanceSet object, and an error if there is any. -func (c *instanceSets) Get(name string, options v1.GetOptions) (result *node.InstanceSet, err error) { - result = &node.InstanceSet{} - err = c.client.Get(). - Resource("instancesets"). - Name(name). - VersionedParams(&options, scheme.ParameterCodec). - Do(). - Into(result) - return -} - -// List takes label and field selectors, and returns the list of InstanceSets that match those selectors. -func (c *instanceSets) List(opts v1.ListOptions) (result *node.InstanceSetList, err error) { - result = &node.InstanceSetList{} - err = c.client.Get(). - Resource("instancesets"). - VersionedParams(&opts, scheme.ParameterCodec). - Do(). - Into(result) - return -} - -// Watch returns a watch.Interface that watches the requested instanceSets. -func (c *instanceSets) Watch(opts v1.ListOptions) (watch.Interface, error) { - opts.Watch = true - return c.client.Get(). - Resource("instancesets"). - VersionedParams(&opts, scheme.ParameterCodec). - Watch() -} - -// Create takes the representation of a instanceSet and creates it. Returns the server's representation of the instanceSet, and an error, if there is any. -func (c *instanceSets) Create(instanceSet *node.InstanceSet) (result *node.InstanceSet, err error) { - result = &node.InstanceSet{} - err = c.client.Post(). - Resource("instancesets"). - Body(instanceSet). - Do(). - Into(result) - return -} - -// Update takes the representation of a instanceSet and updates it. Returns the server's representation of the instanceSet, and an error, if there is any. -func (c *instanceSets) Update(instanceSet *node.InstanceSet) (result *node.InstanceSet, err error) { - result = &node.InstanceSet{} - err = c.client.Put(). - Resource("instancesets"). - Name(instanceSet.Name). - Body(instanceSet). - 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 *instanceSets) UpdateStatus(instanceSet *node.InstanceSet) (result *node.InstanceSet, err error) { - result = &node.InstanceSet{} - err = c.client.Put(). - Resource("instancesets"). - Name(instanceSet.Name). - SubResource("status"). - Body(instanceSet). - Do(). - Into(result) - return -} - -// Delete takes name of the instanceSet and deletes it. Returns an error if one occurs. -func (c *instanceSets) Delete(name string, options *v1.DeleteOptions) error { - return c.client.Delete(). - Resource("instancesets"). - Name(name). - Body(options). - Do(). - Error() -} - -// DeleteCollection deletes a collection of objects. -func (c *instanceSets) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error { - return c.client.Delete(). - Resource("instancesets"). - VersionedParams(&listOptions, scheme.ParameterCodec). - Body(options). - Do(). - Error() -} - -// Patch applies the patch and returns the patched instanceSet. -func (c *instanceSets) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *node.InstanceSet, err error) { - result = &node.InstanceSet{} - err = c.client.Patch(pt). - Resource("instancesets"). - SubResource(subresources...). - Name(name). - Body(data). - Do(). - Into(result) - return -} diff --git a/pkg/client/internalclientset/typed/node/internalversion/instancetemplate.go b/pkg/client/internalclientset/typed/node/internalversion/instancetemplate.go deleted file mode 100644 index 6a03c232c..000000000 --- a/pkg/client/internalclientset/typed/node/internalversion/instancetemplate.go +++ /dev/null @@ -1,139 +0,0 @@ -package internalversion - -import ( - node "github.com/gardener/node-controller-manager/pkg/apis/node" - scheme "github.com/gardener/node-controller-manager/pkg/client/internalclientset/scheme" - v1 "k8s.io/apimachinery/pkg/apis/meta/v1" - types "k8s.io/apimachinery/pkg/types" - watch "k8s.io/apimachinery/pkg/watch" - rest "k8s.io/client-go/rest" -) - -// InstanceTemplatesGetter has a method to return a InstanceTemplateInterface. -// A group's client should implement this interface. -type InstanceTemplatesGetter interface { - InstanceTemplates(namespace string) InstanceTemplateInterface -} - -// InstanceTemplateInterface has methods to work with InstanceTemplate resources. -type InstanceTemplateInterface interface { - Create(*node.InstanceTemplate) (*node.InstanceTemplate, error) - Update(*node.InstanceTemplate) (*node.InstanceTemplate, error) - Delete(name string, options *v1.DeleteOptions) error - DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error - Get(name string, options v1.GetOptions) (*node.InstanceTemplate, error) - List(opts v1.ListOptions) (*node.InstanceTemplateList, error) - Watch(opts v1.ListOptions) (watch.Interface, error) - Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *node.InstanceTemplate, err error) - InstanceTemplateExpansion -} - -// instanceTemplates implements InstanceTemplateInterface -type instanceTemplates struct { - client rest.Interface - ns string -} - -// newInstanceTemplates returns a InstanceTemplates -func newInstanceTemplates(c *NodeClient, namespace string) *instanceTemplates { - return &instanceTemplates{ - client: c.RESTClient(), - ns: namespace, - } -} - -// Get takes name of the instanceTemplate, and returns the corresponding instanceTemplate object, and an error if there is any. -func (c *instanceTemplates) Get(name string, options v1.GetOptions) (result *node.InstanceTemplate, err error) { - result = &node.InstanceTemplate{} - err = c.client.Get(). - Namespace(c.ns). - Resource("instancetemplates"). - Name(name). - VersionedParams(&options, scheme.ParameterCodec). - Do(). - Into(result) - return -} - -// List takes label and field selectors, and returns the list of InstanceTemplates that match those selectors. -func (c *instanceTemplates) List(opts v1.ListOptions) (result *node.InstanceTemplateList, err error) { - result = &node.InstanceTemplateList{} - err = c.client.Get(). - Namespace(c.ns). - Resource("instancetemplates"). - VersionedParams(&opts, scheme.ParameterCodec). - Do(). - Into(result) - return -} - -// Watch returns a watch.Interface that watches the requested instanceTemplates. -func (c *instanceTemplates) Watch(opts v1.ListOptions) (watch.Interface, error) { - opts.Watch = true - return c.client.Get(). - Namespace(c.ns). - Resource("instancetemplates"). - VersionedParams(&opts, scheme.ParameterCodec). - Watch() -} - -// Create takes the representation of a instanceTemplate and creates it. Returns the server's representation of the instanceTemplate, and an error, if there is any. -func (c *instanceTemplates) Create(instanceTemplate *node.InstanceTemplate) (result *node.InstanceTemplate, err error) { - result = &node.InstanceTemplate{} - err = c.client.Post(). - Namespace(c.ns). - Resource("instancetemplates"). - Body(instanceTemplate). - Do(). - Into(result) - return -} - -// Update takes the representation of a instanceTemplate and updates it. Returns the server's representation of the instanceTemplate, and an error, if there is any. -func (c *instanceTemplates) Update(instanceTemplate *node.InstanceTemplate) (result *node.InstanceTemplate, err error) { - result = &node.InstanceTemplate{} - err = c.client.Put(). - Namespace(c.ns). - Resource("instancetemplates"). - Name(instanceTemplate.Name). - Body(instanceTemplate). - Do(). - Into(result) - return -} - -// Delete takes name of the instanceTemplate and deletes it. Returns an error if one occurs. -func (c *instanceTemplates) Delete(name string, options *v1.DeleteOptions) error { - return c.client.Delete(). - Namespace(c.ns). - Resource("instancetemplates"). - Name(name). - Body(options). - Do(). - Error() -} - -// DeleteCollection deletes a collection of objects. -func (c *instanceTemplates) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error { - return c.client.Delete(). - Namespace(c.ns). - Resource("instancetemplates"). - VersionedParams(&listOptions, scheme.ParameterCodec). - Body(options). - Do(). - Error() -} - -// Patch applies the patch and returns the patched instanceTemplate. -func (c *instanceTemplates) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *node.InstanceTemplate, err error) { - result = &node.InstanceTemplate{} - err = c.client.Patch(pt). - Namespace(c.ns). - Resource("instancetemplates"). - SubResource(subresources...). - Name(name). - Body(data). - Do(). - Into(result) - return -} diff --git a/pkg/client/internalclientset/typed/node/internalversion/node_client.go b/pkg/client/internalclientset/typed/node/internalversion/node_client.go deleted file mode 100644 index 436737413..000000000 --- a/pkg/client/internalclientset/typed/node/internalversion/node_client.go +++ /dev/null @@ -1,108 +0,0 @@ -package internalversion - -import ( - "github.com/gardener/node-controller-manager/pkg/client/internalclientset/scheme" - rest "k8s.io/client-go/rest" -) - -type NodeInterface interface { - RESTClient() rest.Interface - AWSInstanceClassesGetter - InstancesGetter - InstanceDeploymentsGetter - InstanceSetsGetter - InstanceTemplatesGetter - ScalesGetter -} - -// NodeClient is used to interact with features provided by the node.sapcloud.io group. -type NodeClient struct { - restClient rest.Interface -} - -func (c *NodeClient) AWSInstanceClasses() AWSInstanceClassInterface { - return newAWSInstanceClasses(c) -} - -func (c *NodeClient) Instances() InstanceInterface { - return newInstances(c) -} - -func (c *NodeClient) InstanceDeployments() InstanceDeploymentInterface { - return newInstanceDeployments(c) -} - -func (c *NodeClient) InstanceSets() InstanceSetInterface { - return newInstanceSets(c) -} - -func (c *NodeClient) InstanceTemplates(namespace string) InstanceTemplateInterface { - return newInstanceTemplates(c, namespace) -} - -func (c *NodeClient) Scales(namespace string) ScaleInterface { - return newScales(c, namespace) -} - -// NewForConfig creates a new NodeClient for the given config. -func NewForConfig(c *rest.Config) (*NodeClient, error) { - config := *c - if err := setConfigDefaults(&config); err != nil { - return nil, err - } - client, err := rest.RESTClientFor(&config) - if err != nil { - return nil, err - } - return &NodeClient{client}, nil -} - -// NewForConfigOrDie creates a new NodeClient for the given config and -// panics if there is an error in the config. -func NewForConfigOrDie(c *rest.Config) *NodeClient { - client, err := NewForConfig(c) - if err != nil { - panic(err) - } - return client -} - -// New creates a new NodeClient for the given RESTClient. -func New(c rest.Interface) *NodeClient { - return &NodeClient{c} -} - -func setConfigDefaults(config *rest.Config) error { - g, err := scheme.Registry.Group("node.sapcloud.io") - if err != nil { - return err - } - - config.APIPath = "/apis" - if config.UserAgent == "" { - config.UserAgent = rest.DefaultKubernetesUserAgent() - } - if config.GroupVersion == nil || config.GroupVersion.Group != g.GroupVersion.Group { - gv := g.GroupVersion - config.GroupVersion = &gv - } - config.NegotiatedSerializer = scheme.Codecs - - if config.QPS == 0 { - config.QPS = 5 - } - if config.Burst == 0 { - config.Burst = 10 - } - - return nil -} - -// RESTClient returns a RESTClient that is used to communicate -// with API server by this client implementation. -func (c *NodeClient) RESTClient() rest.Interface { - if c == nil { - return nil - } - return c.restClient -} diff --git a/pkg/client/listers/machine/internalversion/awsmachineclass.go b/pkg/client/listers/machine/internalversion/awsmachineclass.go new file mode 100644 index 000000000..c2803a09c --- /dev/null +++ b/pkg/client/listers/machine/internalversion/awsmachineclass.go @@ -0,0 +1,51 @@ +// This file was automatically generated by lister-gen + +package internalversion + +import ( + machine "github.com/gardener/node-controller-manager/pkg/apis/machine" + "k8s.io/apimachinery/pkg/api/errors" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/tools/cache" +) + +// AWSMachineClassLister helps list AWSMachineClasses. +type AWSMachineClassLister interface { + // List lists all AWSMachineClasses in the indexer. + List(selector labels.Selector) (ret []*machine.AWSMachineClass, err error) + // Get retrieves the AWSMachineClass from the index for a given name. + Get(name string) (*machine.AWSMachineClass, error) + AWSMachineClassListerExpansion +} + +// aWSMachineClassLister implements the AWSMachineClassLister interface. +type aWSMachineClassLister struct { + indexer cache.Indexer +} + +// NewAWSMachineClassLister returns a new AWSMachineClassLister. +func NewAWSMachineClassLister(indexer cache.Indexer) AWSMachineClassLister { + return &aWSMachineClassLister{indexer: indexer} +} + +// List lists all AWSMachineClasses in the indexer. +func (s *aWSMachineClassLister) List(selector labels.Selector) (ret []*machine.AWSMachineClass, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*machine.AWSMachineClass)) + }) + return ret, err +} + +// Get retrieves the AWSMachineClass from the index for a given name. +func (s *aWSMachineClassLister) Get(name string) (*machine.AWSMachineClass, error) { + key := &machine.AWSMachineClass{ObjectMeta: v1.ObjectMeta{Name: name}} + obj, exists, err := s.indexer.Get(key) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(machine.Resource("awsmachineclass"), name) + } + return obj.(*machine.AWSMachineClass), nil +} diff --git a/pkg/client/listers/machine/internalversion/expansion_generated.go b/pkg/client/listers/machine/internalversion/expansion_generated.go new file mode 100644 index 000000000..0fd452fad --- /dev/null +++ b/pkg/client/listers/machine/internalversion/expansion_generated.go @@ -0,0 +1,35 @@ +// This file was automatically generated by lister-gen + +package internalversion + +// AWSMachineClassListerExpansion allows custom methods to be added to +// AWSMachineClassLister. +type AWSMachineClassListerExpansion interface{} + +// MachineListerExpansion allows custom methods to be added to +// MachineLister. +type MachineListerExpansion interface{} + +// MachineDeploymentListerExpansion allows custom methods to be added to +// MachineDeploymentLister. +type MachineDeploymentListerExpansion interface{} + +// MachineSetListerExpansion allows custom methods to be added to +// MachineSetLister. +type MachineSetListerExpansion interface{} + +// MachineTemplateListerExpansion allows custom methods to be added to +// MachineTemplateLister. +type MachineTemplateListerExpansion interface{} + +// MachineTemplateNamespaceListerExpansion allows custom methods to be added to +// MachineTemplateNamespaceLister. +type MachineTemplateNamespaceListerExpansion interface{} + +// ScaleListerExpansion allows custom methods to be added to +// ScaleLister. +type ScaleListerExpansion interface{} + +// ScaleNamespaceListerExpansion allows custom methods to be added to +// ScaleNamespaceLister. +type ScaleNamespaceListerExpansion interface{} diff --git a/pkg/client/listers/machine/internalversion/machine.go b/pkg/client/listers/machine/internalversion/machine.go new file mode 100644 index 000000000..daf68ba15 --- /dev/null +++ b/pkg/client/listers/machine/internalversion/machine.go @@ -0,0 +1,51 @@ +// This file was automatically generated by lister-gen + +package internalversion + +import ( + machine "github.com/gardener/node-controller-manager/pkg/apis/machine" + "k8s.io/apimachinery/pkg/api/errors" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/tools/cache" +) + +// MachineLister helps list Machines. +type MachineLister interface { + // List lists all Machines in the indexer. + List(selector labels.Selector) (ret []*machine.Machine, err error) + // Get retrieves the Machine from the index for a given name. + Get(name string) (*machine.Machine, error) + 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 []*machine.Machine, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*machine.Machine)) + }) + return ret, err +} + +// Get retrieves the Machine from the index for a given name. +func (s *machineLister) Get(name string) (*machine.Machine, error) { + key := &machine.Machine{ObjectMeta: v1.ObjectMeta{Name: name}} + obj, exists, err := s.indexer.Get(key) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(machine.Resource("machine"), name) + } + return obj.(*machine.Machine), nil +} diff --git a/pkg/client/listers/machine/internalversion/machinedeployment.go b/pkg/client/listers/machine/internalversion/machinedeployment.go new file mode 100644 index 000000000..1fdaf52bd --- /dev/null +++ b/pkg/client/listers/machine/internalversion/machinedeployment.go @@ -0,0 +1,51 @@ +// This file was automatically generated by lister-gen + +package internalversion + +import ( + machine "github.com/gardener/node-controller-manager/pkg/apis/machine" + "k8s.io/apimachinery/pkg/api/errors" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/tools/cache" +) + +// MachineDeploymentLister helps list MachineDeployments. +type MachineDeploymentLister interface { + // List lists all MachineDeployments in the indexer. + List(selector labels.Selector) (ret []*machine.MachineDeployment, err error) + // Get retrieves the MachineDeployment from the index for a given name. + Get(name string) (*machine.MachineDeployment, error) + 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 []*machine.MachineDeployment, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*machine.MachineDeployment)) + }) + return ret, err +} + +// Get retrieves the MachineDeployment from the index for a given name. +func (s *machineDeploymentLister) Get(name string) (*machine.MachineDeployment, error) { + key := &machine.MachineDeployment{ObjectMeta: v1.ObjectMeta{Name: name}} + obj, exists, err := s.indexer.Get(key) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(machine.Resource("machinedeployment"), name) + } + return obj.(*machine.MachineDeployment), nil +} diff --git a/pkg/client/listers/machine/internalversion/machineset.go b/pkg/client/listers/machine/internalversion/machineset.go new file mode 100644 index 000000000..58bd8cf4c --- /dev/null +++ b/pkg/client/listers/machine/internalversion/machineset.go @@ -0,0 +1,51 @@ +// This file was automatically generated by lister-gen + +package internalversion + +import ( + machine "github.com/gardener/node-controller-manager/pkg/apis/machine" + "k8s.io/apimachinery/pkg/api/errors" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/tools/cache" +) + +// MachineSetLister helps list MachineSets. +type MachineSetLister interface { + // List lists all MachineSets in the indexer. + List(selector labels.Selector) (ret []*machine.MachineSet, err error) + // Get retrieves the MachineSet from the index for a given name. + Get(name string) (*machine.MachineSet, error) + 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 []*machine.MachineSet, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*machine.MachineSet)) + }) + return ret, err +} + +// Get retrieves the MachineSet from the index for a given name. +func (s *machineSetLister) Get(name string) (*machine.MachineSet, error) { + key := &machine.MachineSet{ObjectMeta: v1.ObjectMeta{Name: name}} + obj, exists, err := s.indexer.Get(key) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(machine.Resource("machineset"), name) + } + return obj.(*machine.MachineSet), nil +} diff --git a/pkg/client/listers/machine/internalversion/machinetemplate.go b/pkg/client/listers/machine/internalversion/machinetemplate.go new file mode 100644 index 000000000..80378892a --- /dev/null +++ b/pkg/client/listers/machine/internalversion/machinetemplate.go @@ -0,0 +1,78 @@ +// This file was automatically generated by lister-gen + +package internalversion + +import ( + machine "github.com/gardener/node-controller-manager/pkg/apis/machine" + "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/tools/cache" +) + +// MachineTemplateLister helps list MachineTemplates. +type MachineTemplateLister interface { + // List lists all MachineTemplates in the indexer. + List(selector labels.Selector) (ret []*machine.MachineTemplate, err error) + // MachineTemplates returns an object that can list and get MachineTemplates. + MachineTemplates(namespace string) MachineTemplateNamespaceLister + MachineTemplateListerExpansion +} + +// machineTemplateLister implements the MachineTemplateLister interface. +type machineTemplateLister struct { + indexer cache.Indexer +} + +// NewMachineTemplateLister returns a new MachineTemplateLister. +func NewMachineTemplateLister(indexer cache.Indexer) MachineTemplateLister { + return &machineTemplateLister{indexer: indexer} +} + +// List lists all MachineTemplates in the indexer. +func (s *machineTemplateLister) List(selector labels.Selector) (ret []*machine.MachineTemplate, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*machine.MachineTemplate)) + }) + return ret, err +} + +// MachineTemplates returns an object that can list and get MachineTemplates. +func (s *machineTemplateLister) MachineTemplates(namespace string) MachineTemplateNamespaceLister { + return machineTemplateNamespaceLister{indexer: s.indexer, namespace: namespace} +} + +// MachineTemplateNamespaceLister helps list and get MachineTemplates. +type MachineTemplateNamespaceLister interface { + // List lists all MachineTemplates in the indexer for a given namespace. + List(selector labels.Selector) (ret []*machine.MachineTemplate, err error) + // Get retrieves the MachineTemplate from the indexer for a given namespace and name. + Get(name string) (*machine.MachineTemplate, error) + MachineTemplateNamespaceListerExpansion +} + +// machineTemplateNamespaceLister implements the MachineTemplateNamespaceLister +// interface. +type machineTemplateNamespaceLister struct { + indexer cache.Indexer + namespace string +} + +// List lists all MachineTemplates in the indexer for a given namespace. +func (s machineTemplateNamespaceLister) List(selector labels.Selector) (ret []*machine.MachineTemplate, err error) { + err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { + ret = append(ret, m.(*machine.MachineTemplate)) + }) + return ret, err +} + +// Get retrieves the MachineTemplate from the indexer for a given namespace and name. +func (s machineTemplateNamespaceLister) Get(name string) (*machine.MachineTemplate, error) { + obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(machine.Resource("machinetemplate"), name) + } + return obj.(*machine.MachineTemplate), nil +} diff --git a/pkg/client/listers/node/internalversion/scale.go b/pkg/client/listers/machine/internalversion/scale.go similarity index 75% rename from pkg/client/listers/node/internalversion/scale.go rename to pkg/client/listers/machine/internalversion/scale.go index 8fa45df09..115f7e16b 100644 --- a/pkg/client/listers/node/internalversion/scale.go +++ b/pkg/client/listers/machine/internalversion/scale.go @@ -3,7 +3,7 @@ package internalversion import ( - node "github.com/gardener/node-controller-manager/pkg/apis/node" + machine "github.com/gardener/node-controller-manager/pkg/apis/machine" "k8s.io/apimachinery/pkg/api/errors" "k8s.io/apimachinery/pkg/labels" "k8s.io/client-go/tools/cache" @@ -12,7 +12,7 @@ import ( // ScaleLister helps list Scales. type ScaleLister interface { // List lists all Scales in the indexer. - List(selector labels.Selector) (ret []*node.Scale, err error) + List(selector labels.Selector) (ret []*machine.Scale, err error) // Scales returns an object that can list and get Scales. Scales(namespace string) ScaleNamespaceLister ScaleListerExpansion @@ -29,9 +29,9 @@ func NewScaleLister(indexer cache.Indexer) ScaleLister { } // List lists all Scales in the indexer. -func (s *scaleLister) List(selector labels.Selector) (ret []*node.Scale, err error) { +func (s *scaleLister) List(selector labels.Selector) (ret []*machine.Scale, err error) { err = cache.ListAll(s.indexer, selector, func(m interface{}) { - ret = append(ret, m.(*node.Scale)) + ret = append(ret, m.(*machine.Scale)) }) return ret, err } @@ -44,9 +44,9 @@ func (s *scaleLister) Scales(namespace string) ScaleNamespaceLister { // ScaleNamespaceLister helps list and get Scales. type ScaleNamespaceLister interface { // List lists all Scales in the indexer for a given namespace. - List(selector labels.Selector) (ret []*node.Scale, err error) + List(selector labels.Selector) (ret []*machine.Scale, err error) // Get retrieves the Scale from the indexer for a given namespace and name. - Get(name string) (*node.Scale, error) + Get(name string) (*machine.Scale, error) ScaleNamespaceListerExpansion } @@ -58,21 +58,21 @@ type scaleNamespaceLister struct { } // List lists all Scales in the indexer for a given namespace. -func (s scaleNamespaceLister) List(selector labels.Selector) (ret []*node.Scale, err error) { +func (s scaleNamespaceLister) List(selector labels.Selector) (ret []*machine.Scale, err error) { err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { - ret = append(ret, m.(*node.Scale)) + ret = append(ret, m.(*machine.Scale)) }) return ret, err } // Get retrieves the Scale from the indexer for a given namespace and name. -func (s scaleNamespaceLister) Get(name string) (*node.Scale, error) { +func (s scaleNamespaceLister) Get(name string) (*machine.Scale, error) { obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) if err != nil { return nil, err } if !exists { - return nil, errors.NewNotFound(node.Resource("scale"), name) + return nil, errors.NewNotFound(machine.Resource("scale"), name) } - return obj.(*node.Scale), nil + return obj.(*machine.Scale), nil } diff --git a/pkg/client/listers/machine/v1alpha1/awsmachineclass.go b/pkg/client/listers/machine/v1alpha1/awsmachineclass.go new file mode 100644 index 000000000..be3d8406c --- /dev/null +++ b/pkg/client/listers/machine/v1alpha1/awsmachineclass.go @@ -0,0 +1,51 @@ +// This file was automatically generated by lister-gen + +package v1alpha1 + +import ( + v1alpha1 "github.com/gardener/node-controller-manager/pkg/apis/machine/v1alpha1" + "k8s.io/apimachinery/pkg/api/errors" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/tools/cache" +) + +// AWSMachineClassLister helps list AWSMachineClasses. +type AWSMachineClassLister interface { + // List lists all AWSMachineClasses in the indexer. + List(selector labels.Selector) (ret []*v1alpha1.AWSMachineClass, err error) + // Get retrieves the AWSMachineClass from the index for a given name. + Get(name string) (*v1alpha1.AWSMachineClass, error) + AWSMachineClassListerExpansion +} + +// aWSMachineClassLister implements the AWSMachineClassLister interface. +type aWSMachineClassLister struct { + indexer cache.Indexer +} + +// NewAWSMachineClassLister returns a new AWSMachineClassLister. +func NewAWSMachineClassLister(indexer cache.Indexer) AWSMachineClassLister { + return &aWSMachineClassLister{indexer: indexer} +} + +// List lists all AWSMachineClasses in the indexer. +func (s *aWSMachineClassLister) List(selector labels.Selector) (ret []*v1alpha1.AWSMachineClass, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*v1alpha1.AWSMachineClass)) + }) + return ret, err +} + +// Get retrieves the AWSMachineClass from the index for a given name. +func (s *aWSMachineClassLister) Get(name string) (*v1alpha1.AWSMachineClass, error) { + key := &v1alpha1.AWSMachineClass{ObjectMeta: v1.ObjectMeta{Name: name}} + obj, exists, err := s.indexer.Get(key) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(v1alpha1.Resource("awsmachineclass"), name) + } + return obj.(*v1alpha1.AWSMachineClass), nil +} diff --git a/pkg/client/listers/machine/v1alpha1/expansion_generated.go b/pkg/client/listers/machine/v1alpha1/expansion_generated.go new file mode 100644 index 000000000..943070c99 --- /dev/null +++ b/pkg/client/listers/machine/v1alpha1/expansion_generated.go @@ -0,0 +1,35 @@ +// This file was automatically generated by lister-gen + +package v1alpha1 + +// AWSMachineClassListerExpansion allows custom methods to be added to +// AWSMachineClassLister. +type AWSMachineClassListerExpansion interface{} + +// MachineListerExpansion allows custom methods to be added to +// MachineLister. +type MachineListerExpansion interface{} + +// MachineDeploymentListerExpansion allows custom methods to be added to +// MachineDeploymentLister. +type MachineDeploymentListerExpansion interface{} + +// MachineSetListerExpansion allows custom methods to be added to +// MachineSetLister. +type MachineSetListerExpansion interface{} + +// MachineTemplateListerExpansion allows custom methods to be added to +// MachineTemplateLister. +type MachineTemplateListerExpansion interface{} + +// MachineTemplateNamespaceListerExpansion allows custom methods to be added to +// MachineTemplateNamespaceLister. +type MachineTemplateNamespaceListerExpansion interface{} + +// ScaleListerExpansion allows custom methods to be added to +// ScaleLister. +type ScaleListerExpansion interface{} + +// ScaleNamespaceListerExpansion allows custom methods to be added to +// ScaleNamespaceLister. +type ScaleNamespaceListerExpansion interface{} diff --git a/pkg/client/listers/machine/v1alpha1/machine.go b/pkg/client/listers/machine/v1alpha1/machine.go new file mode 100644 index 000000000..f477ad2ef --- /dev/null +++ b/pkg/client/listers/machine/v1alpha1/machine.go @@ -0,0 +1,51 @@ +// This file was automatically generated by lister-gen + +package v1alpha1 + +import ( + v1alpha1 "github.com/gardener/node-controller-manager/pkg/apis/machine/v1alpha1" + "k8s.io/apimachinery/pkg/api/errors" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/tools/cache" +) + +// MachineLister helps list Machines. +type MachineLister interface { + // List lists all Machines in the indexer. + List(selector labels.Selector) (ret []*v1alpha1.Machine, err error) + // Get retrieves the Machine from the index for a given name. + Get(name string) (*v1alpha1.Machine, error) + 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 +} + +// Get retrieves the Machine from the index for a given name. +func (s *machineLister) Get(name string) (*v1alpha1.Machine, error) { + key := &v1alpha1.Machine{ObjectMeta: v1.ObjectMeta{Name: name}} + obj, exists, err := s.indexer.Get(key) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(v1alpha1.Resource("machine"), name) + } + return obj.(*v1alpha1.Machine), nil +} diff --git a/pkg/client/listers/machine/v1alpha1/machinedeployment.go b/pkg/client/listers/machine/v1alpha1/machinedeployment.go new file mode 100644 index 000000000..9d0abeb50 --- /dev/null +++ b/pkg/client/listers/machine/v1alpha1/machinedeployment.go @@ -0,0 +1,51 @@ +// This file was automatically generated by lister-gen + +package v1alpha1 + +import ( + v1alpha1 "github.com/gardener/node-controller-manager/pkg/apis/machine/v1alpha1" + "k8s.io/apimachinery/pkg/api/errors" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/tools/cache" +) + +// MachineDeploymentLister helps list MachineDeployments. +type MachineDeploymentLister interface { + // List lists all MachineDeployments in the indexer. + List(selector labels.Selector) (ret []*v1alpha1.MachineDeployment, err error) + // Get retrieves the MachineDeployment from the index for a given name. + Get(name string) (*v1alpha1.MachineDeployment, error) + 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 +} + +// Get retrieves the MachineDeployment from the index for a given name. +func (s *machineDeploymentLister) Get(name string) (*v1alpha1.MachineDeployment, error) { + key := &v1alpha1.MachineDeployment{ObjectMeta: v1.ObjectMeta{Name: name}} + obj, exists, err := s.indexer.Get(key) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(v1alpha1.Resource("machinedeployment"), name) + } + return obj.(*v1alpha1.MachineDeployment), nil +} diff --git a/pkg/client/listers/machine/v1alpha1/machineset.go b/pkg/client/listers/machine/v1alpha1/machineset.go new file mode 100644 index 000000000..d43c5281d --- /dev/null +++ b/pkg/client/listers/machine/v1alpha1/machineset.go @@ -0,0 +1,51 @@ +// This file was automatically generated by lister-gen + +package v1alpha1 + +import ( + v1alpha1 "github.com/gardener/node-controller-manager/pkg/apis/machine/v1alpha1" + "k8s.io/apimachinery/pkg/api/errors" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/tools/cache" +) + +// MachineSetLister helps list MachineSets. +type MachineSetLister interface { + // List lists all MachineSets in the indexer. + List(selector labels.Selector) (ret []*v1alpha1.MachineSet, err error) + // Get retrieves the MachineSet from the index for a given name. + Get(name string) (*v1alpha1.MachineSet, error) + 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 +} + +// Get retrieves the MachineSet from the index for a given name. +func (s *machineSetLister) Get(name string) (*v1alpha1.MachineSet, error) { + key := &v1alpha1.MachineSet{ObjectMeta: v1.ObjectMeta{Name: name}} + obj, exists, err := s.indexer.Get(key) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(v1alpha1.Resource("machineset"), name) + } + return obj.(*v1alpha1.MachineSet), nil +} diff --git a/pkg/client/listers/machine/v1alpha1/machinetemplate.go b/pkg/client/listers/machine/v1alpha1/machinetemplate.go new file mode 100644 index 000000000..433f64fbf --- /dev/null +++ b/pkg/client/listers/machine/v1alpha1/machinetemplate.go @@ -0,0 +1,78 @@ +// This file was automatically generated by lister-gen + +package v1alpha1 + +import ( + v1alpha1 "github.com/gardener/node-controller-manager/pkg/apis/machine/v1alpha1" + "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/tools/cache" +) + +// MachineTemplateLister helps list MachineTemplates. +type MachineTemplateLister interface { + // List lists all MachineTemplates in the indexer. + List(selector labels.Selector) (ret []*v1alpha1.MachineTemplate, err error) + // MachineTemplates returns an object that can list and get MachineTemplates. + MachineTemplates(namespace string) MachineTemplateNamespaceLister + MachineTemplateListerExpansion +} + +// machineTemplateLister implements the MachineTemplateLister interface. +type machineTemplateLister struct { + indexer cache.Indexer +} + +// NewMachineTemplateLister returns a new MachineTemplateLister. +func NewMachineTemplateLister(indexer cache.Indexer) MachineTemplateLister { + return &machineTemplateLister{indexer: indexer} +} + +// List lists all MachineTemplates in the indexer. +func (s *machineTemplateLister) List(selector labels.Selector) (ret []*v1alpha1.MachineTemplate, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*v1alpha1.MachineTemplate)) + }) + return ret, err +} + +// MachineTemplates returns an object that can list and get MachineTemplates. +func (s *machineTemplateLister) MachineTemplates(namespace string) MachineTemplateNamespaceLister { + return machineTemplateNamespaceLister{indexer: s.indexer, namespace: namespace} +} + +// MachineTemplateNamespaceLister helps list and get MachineTemplates. +type MachineTemplateNamespaceLister interface { + // List lists all MachineTemplates in the indexer for a given namespace. + List(selector labels.Selector) (ret []*v1alpha1.MachineTemplate, err error) + // Get retrieves the MachineTemplate from the indexer for a given namespace and name. + Get(name string) (*v1alpha1.MachineTemplate, error) + MachineTemplateNamespaceListerExpansion +} + +// machineTemplateNamespaceLister implements the MachineTemplateNamespaceLister +// interface. +type machineTemplateNamespaceLister struct { + indexer cache.Indexer + namespace string +} + +// List lists all MachineTemplates in the indexer for a given namespace. +func (s machineTemplateNamespaceLister) List(selector labels.Selector) (ret []*v1alpha1.MachineTemplate, err error) { + err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { + ret = append(ret, m.(*v1alpha1.MachineTemplate)) + }) + return ret, err +} + +// Get retrieves the MachineTemplate from the indexer for a given namespace and name. +func (s machineTemplateNamespaceLister) Get(name string) (*v1alpha1.MachineTemplate, error) { + obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(v1alpha1.Resource("machinetemplate"), name) + } + return obj.(*v1alpha1.MachineTemplate), nil +} diff --git a/pkg/client/listers/node/v1alpha1/scale.go b/pkg/client/listers/machine/v1alpha1/scale.go similarity index 99% rename from pkg/client/listers/node/v1alpha1/scale.go rename to pkg/client/listers/machine/v1alpha1/scale.go index 76541cd47..d5c85b644 100644 --- a/pkg/client/listers/node/v1alpha1/scale.go +++ b/pkg/client/listers/machine/v1alpha1/scale.go @@ -3,7 +3,7 @@ package v1alpha1 import ( - v1alpha1 "github.com/gardener/node-controller-manager/pkg/apis/node/v1alpha1" + v1alpha1 "github.com/gardener/node-controller-manager/pkg/apis/machine/v1alpha1" "k8s.io/apimachinery/pkg/api/errors" "k8s.io/apimachinery/pkg/labels" "k8s.io/client-go/tools/cache" diff --git a/pkg/client/listers/node/internalversion/awsinstanceclass.go b/pkg/client/listers/node/internalversion/awsinstanceclass.go deleted file mode 100644 index f9bc04eac..000000000 --- a/pkg/client/listers/node/internalversion/awsinstanceclass.go +++ /dev/null @@ -1,51 +0,0 @@ -// This file was automatically generated by lister-gen - -package internalversion - -import ( - node "github.com/gardener/node-controller-manager/pkg/apis/node" - "k8s.io/apimachinery/pkg/api/errors" - v1 "k8s.io/apimachinery/pkg/apis/meta/v1" - "k8s.io/apimachinery/pkg/labels" - "k8s.io/client-go/tools/cache" -) - -// AWSInstanceClassLister helps list AWSInstanceClasses. -type AWSInstanceClassLister interface { - // List lists all AWSInstanceClasses in the indexer. - List(selector labels.Selector) (ret []*node.AWSInstanceClass, err error) - // Get retrieves the AWSInstanceClass from the index for a given name. - Get(name string) (*node.AWSInstanceClass, error) - AWSInstanceClassListerExpansion -} - -// aWSInstanceClassLister implements the AWSInstanceClassLister interface. -type aWSInstanceClassLister struct { - indexer cache.Indexer -} - -// NewAWSInstanceClassLister returns a new AWSInstanceClassLister. -func NewAWSInstanceClassLister(indexer cache.Indexer) AWSInstanceClassLister { - return &aWSInstanceClassLister{indexer: indexer} -} - -// List lists all AWSInstanceClasses in the indexer. -func (s *aWSInstanceClassLister) List(selector labels.Selector) (ret []*node.AWSInstanceClass, err error) { - err = cache.ListAll(s.indexer, selector, func(m interface{}) { - ret = append(ret, m.(*node.AWSInstanceClass)) - }) - return ret, err -} - -// Get retrieves the AWSInstanceClass from the index for a given name. -func (s *aWSInstanceClassLister) Get(name string) (*node.AWSInstanceClass, error) { - key := &node.AWSInstanceClass{ObjectMeta: v1.ObjectMeta{Name: name}} - obj, exists, err := s.indexer.Get(key) - if err != nil { - return nil, err - } - if !exists { - return nil, errors.NewNotFound(node.Resource("awsinstanceclass"), name) - } - return obj.(*node.AWSInstanceClass), nil -} diff --git a/pkg/client/listers/node/internalversion/expansion_generated.go b/pkg/client/listers/node/internalversion/expansion_generated.go deleted file mode 100644 index 01be3f98a..000000000 --- a/pkg/client/listers/node/internalversion/expansion_generated.go +++ /dev/null @@ -1,35 +0,0 @@ -// This file was automatically generated by lister-gen - -package internalversion - -// AWSInstanceClassListerExpansion allows custom methods to be added to -// AWSInstanceClassLister. -type AWSInstanceClassListerExpansion interface{} - -// InstanceListerExpansion allows custom methods to be added to -// InstanceLister. -type InstanceListerExpansion interface{} - -// InstanceDeploymentListerExpansion allows custom methods to be added to -// InstanceDeploymentLister. -type InstanceDeploymentListerExpansion interface{} - -// InstanceSetListerExpansion allows custom methods to be added to -// InstanceSetLister. -type InstanceSetListerExpansion interface{} - -// InstanceTemplateListerExpansion allows custom methods to be added to -// InstanceTemplateLister. -type InstanceTemplateListerExpansion interface{} - -// InstanceTemplateNamespaceListerExpansion allows custom methods to be added to -// InstanceTemplateNamespaceLister. -type InstanceTemplateNamespaceListerExpansion interface{} - -// ScaleListerExpansion allows custom methods to be added to -// ScaleLister. -type ScaleListerExpansion interface{} - -// ScaleNamespaceListerExpansion allows custom methods to be added to -// ScaleNamespaceLister. -type ScaleNamespaceListerExpansion interface{} diff --git a/pkg/client/listers/node/internalversion/instance.go b/pkg/client/listers/node/internalversion/instance.go deleted file mode 100644 index 553928fef..000000000 --- a/pkg/client/listers/node/internalversion/instance.go +++ /dev/null @@ -1,51 +0,0 @@ -// This file was automatically generated by lister-gen - -package internalversion - -import ( - node "github.com/gardener/node-controller-manager/pkg/apis/node" - "k8s.io/apimachinery/pkg/api/errors" - v1 "k8s.io/apimachinery/pkg/apis/meta/v1" - "k8s.io/apimachinery/pkg/labels" - "k8s.io/client-go/tools/cache" -) - -// InstanceLister helps list Instances. -type InstanceLister interface { - // List lists all Instances in the indexer. - List(selector labels.Selector) (ret []*node.Instance, err error) - // Get retrieves the Instance from the index for a given name. - Get(name string) (*node.Instance, error) - InstanceListerExpansion -} - -// instanceLister implements the InstanceLister interface. -type instanceLister struct { - indexer cache.Indexer -} - -// NewInstanceLister returns a new InstanceLister. -func NewInstanceLister(indexer cache.Indexer) InstanceLister { - return &instanceLister{indexer: indexer} -} - -// List lists all Instances in the indexer. -func (s *instanceLister) List(selector labels.Selector) (ret []*node.Instance, err error) { - err = cache.ListAll(s.indexer, selector, func(m interface{}) { - ret = append(ret, m.(*node.Instance)) - }) - return ret, err -} - -// Get retrieves the Instance from the index for a given name. -func (s *instanceLister) Get(name string) (*node.Instance, error) { - key := &node.Instance{ObjectMeta: v1.ObjectMeta{Name: name}} - obj, exists, err := s.indexer.Get(key) - if err != nil { - return nil, err - } - if !exists { - return nil, errors.NewNotFound(node.Resource("instance"), name) - } - return obj.(*node.Instance), nil -} diff --git a/pkg/client/listers/node/internalversion/instancedeployment.go b/pkg/client/listers/node/internalversion/instancedeployment.go deleted file mode 100644 index 42346a286..000000000 --- a/pkg/client/listers/node/internalversion/instancedeployment.go +++ /dev/null @@ -1,51 +0,0 @@ -// This file was automatically generated by lister-gen - -package internalversion - -import ( - node "github.com/gardener/node-controller-manager/pkg/apis/node" - "k8s.io/apimachinery/pkg/api/errors" - v1 "k8s.io/apimachinery/pkg/apis/meta/v1" - "k8s.io/apimachinery/pkg/labels" - "k8s.io/client-go/tools/cache" -) - -// InstanceDeploymentLister helps list InstanceDeployments. -type InstanceDeploymentLister interface { - // List lists all InstanceDeployments in the indexer. - List(selector labels.Selector) (ret []*node.InstanceDeployment, err error) - // Get retrieves the InstanceDeployment from the index for a given name. - Get(name string) (*node.InstanceDeployment, error) - InstanceDeploymentListerExpansion -} - -// instanceDeploymentLister implements the InstanceDeploymentLister interface. -type instanceDeploymentLister struct { - indexer cache.Indexer -} - -// NewInstanceDeploymentLister returns a new InstanceDeploymentLister. -func NewInstanceDeploymentLister(indexer cache.Indexer) InstanceDeploymentLister { - return &instanceDeploymentLister{indexer: indexer} -} - -// List lists all InstanceDeployments in the indexer. -func (s *instanceDeploymentLister) List(selector labels.Selector) (ret []*node.InstanceDeployment, err error) { - err = cache.ListAll(s.indexer, selector, func(m interface{}) { - ret = append(ret, m.(*node.InstanceDeployment)) - }) - return ret, err -} - -// Get retrieves the InstanceDeployment from the index for a given name. -func (s *instanceDeploymentLister) Get(name string) (*node.InstanceDeployment, error) { - key := &node.InstanceDeployment{ObjectMeta: v1.ObjectMeta{Name: name}} - obj, exists, err := s.indexer.Get(key) - if err != nil { - return nil, err - } - if !exists { - return nil, errors.NewNotFound(node.Resource("instancedeployment"), name) - } - return obj.(*node.InstanceDeployment), nil -} diff --git a/pkg/client/listers/node/internalversion/instanceset.go b/pkg/client/listers/node/internalversion/instanceset.go deleted file mode 100644 index 2bfa01e04..000000000 --- a/pkg/client/listers/node/internalversion/instanceset.go +++ /dev/null @@ -1,51 +0,0 @@ -// This file was automatically generated by lister-gen - -package internalversion - -import ( - node "github.com/gardener/node-controller-manager/pkg/apis/node" - "k8s.io/apimachinery/pkg/api/errors" - v1 "k8s.io/apimachinery/pkg/apis/meta/v1" - "k8s.io/apimachinery/pkg/labels" - "k8s.io/client-go/tools/cache" -) - -// InstanceSetLister helps list InstanceSets. -type InstanceSetLister interface { - // List lists all InstanceSets in the indexer. - List(selector labels.Selector) (ret []*node.InstanceSet, err error) - // Get retrieves the InstanceSet from the index for a given name. - Get(name string) (*node.InstanceSet, error) - InstanceSetListerExpansion -} - -// instanceSetLister implements the InstanceSetLister interface. -type instanceSetLister struct { - indexer cache.Indexer -} - -// NewInstanceSetLister returns a new InstanceSetLister. -func NewInstanceSetLister(indexer cache.Indexer) InstanceSetLister { - return &instanceSetLister{indexer: indexer} -} - -// List lists all InstanceSets in the indexer. -func (s *instanceSetLister) List(selector labels.Selector) (ret []*node.InstanceSet, err error) { - err = cache.ListAll(s.indexer, selector, func(m interface{}) { - ret = append(ret, m.(*node.InstanceSet)) - }) - return ret, err -} - -// Get retrieves the InstanceSet from the index for a given name. -func (s *instanceSetLister) Get(name string) (*node.InstanceSet, error) { - key := &node.InstanceSet{ObjectMeta: v1.ObjectMeta{Name: name}} - obj, exists, err := s.indexer.Get(key) - if err != nil { - return nil, err - } - if !exists { - return nil, errors.NewNotFound(node.Resource("instanceset"), name) - } - return obj.(*node.InstanceSet), nil -} diff --git a/pkg/client/listers/node/internalversion/instancetemplate.go b/pkg/client/listers/node/internalversion/instancetemplate.go deleted file mode 100644 index c8259bd3b..000000000 --- a/pkg/client/listers/node/internalversion/instancetemplate.go +++ /dev/null @@ -1,78 +0,0 @@ -// This file was automatically generated by lister-gen - -package internalversion - -import ( - node "github.com/gardener/node-controller-manager/pkg/apis/node" - "k8s.io/apimachinery/pkg/api/errors" - "k8s.io/apimachinery/pkg/labels" - "k8s.io/client-go/tools/cache" -) - -// InstanceTemplateLister helps list InstanceTemplates. -type InstanceTemplateLister interface { - // List lists all InstanceTemplates in the indexer. - List(selector labels.Selector) (ret []*node.InstanceTemplate, err error) - // InstanceTemplates returns an object that can list and get InstanceTemplates. - InstanceTemplates(namespace string) InstanceTemplateNamespaceLister - InstanceTemplateListerExpansion -} - -// instanceTemplateLister implements the InstanceTemplateLister interface. -type instanceTemplateLister struct { - indexer cache.Indexer -} - -// NewInstanceTemplateLister returns a new InstanceTemplateLister. -func NewInstanceTemplateLister(indexer cache.Indexer) InstanceTemplateLister { - return &instanceTemplateLister{indexer: indexer} -} - -// List lists all InstanceTemplates in the indexer. -func (s *instanceTemplateLister) List(selector labels.Selector) (ret []*node.InstanceTemplate, err error) { - err = cache.ListAll(s.indexer, selector, func(m interface{}) { - ret = append(ret, m.(*node.InstanceTemplate)) - }) - return ret, err -} - -// InstanceTemplates returns an object that can list and get InstanceTemplates. -func (s *instanceTemplateLister) InstanceTemplates(namespace string) InstanceTemplateNamespaceLister { - return instanceTemplateNamespaceLister{indexer: s.indexer, namespace: namespace} -} - -// InstanceTemplateNamespaceLister helps list and get InstanceTemplates. -type InstanceTemplateNamespaceLister interface { - // List lists all InstanceTemplates in the indexer for a given namespace. - List(selector labels.Selector) (ret []*node.InstanceTemplate, err error) - // Get retrieves the InstanceTemplate from the indexer for a given namespace and name. - Get(name string) (*node.InstanceTemplate, error) - InstanceTemplateNamespaceListerExpansion -} - -// instanceTemplateNamespaceLister implements the InstanceTemplateNamespaceLister -// interface. -type instanceTemplateNamespaceLister struct { - indexer cache.Indexer - namespace string -} - -// List lists all InstanceTemplates in the indexer for a given namespace. -func (s instanceTemplateNamespaceLister) List(selector labels.Selector) (ret []*node.InstanceTemplate, err error) { - err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { - ret = append(ret, m.(*node.InstanceTemplate)) - }) - return ret, err -} - -// Get retrieves the InstanceTemplate from the indexer for a given namespace and name. -func (s instanceTemplateNamespaceLister) Get(name string) (*node.InstanceTemplate, error) { - obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) - if err != nil { - return nil, err - } - if !exists { - return nil, errors.NewNotFound(node.Resource("instancetemplate"), name) - } - return obj.(*node.InstanceTemplate), nil -} diff --git a/pkg/client/listers/node/v1alpha1/awsinstanceclass.go b/pkg/client/listers/node/v1alpha1/awsinstanceclass.go deleted file mode 100644 index 48f825511..000000000 --- a/pkg/client/listers/node/v1alpha1/awsinstanceclass.go +++ /dev/null @@ -1,51 +0,0 @@ -// This file was automatically generated by lister-gen - -package v1alpha1 - -import ( - v1alpha1 "github.com/gardener/node-controller-manager/pkg/apis/node/v1alpha1" - "k8s.io/apimachinery/pkg/api/errors" - v1 "k8s.io/apimachinery/pkg/apis/meta/v1" - "k8s.io/apimachinery/pkg/labels" - "k8s.io/client-go/tools/cache" -) - -// AWSInstanceClassLister helps list AWSInstanceClasses. -type AWSInstanceClassLister interface { - // List lists all AWSInstanceClasses in the indexer. - List(selector labels.Selector) (ret []*v1alpha1.AWSInstanceClass, err error) - // Get retrieves the AWSInstanceClass from the index for a given name. - Get(name string) (*v1alpha1.AWSInstanceClass, error) - AWSInstanceClassListerExpansion -} - -// aWSInstanceClassLister implements the AWSInstanceClassLister interface. -type aWSInstanceClassLister struct { - indexer cache.Indexer -} - -// NewAWSInstanceClassLister returns a new AWSInstanceClassLister. -func NewAWSInstanceClassLister(indexer cache.Indexer) AWSInstanceClassLister { - return &aWSInstanceClassLister{indexer: indexer} -} - -// List lists all AWSInstanceClasses in the indexer. -func (s *aWSInstanceClassLister) List(selector labels.Selector) (ret []*v1alpha1.AWSInstanceClass, err error) { - err = cache.ListAll(s.indexer, selector, func(m interface{}) { - ret = append(ret, m.(*v1alpha1.AWSInstanceClass)) - }) - return ret, err -} - -// Get retrieves the AWSInstanceClass from the index for a given name. -func (s *aWSInstanceClassLister) Get(name string) (*v1alpha1.AWSInstanceClass, error) { - key := &v1alpha1.AWSInstanceClass{ObjectMeta: v1.ObjectMeta{Name: name}} - obj, exists, err := s.indexer.Get(key) - if err != nil { - return nil, err - } - if !exists { - return nil, errors.NewNotFound(v1alpha1.Resource("awsinstanceclass"), name) - } - return obj.(*v1alpha1.AWSInstanceClass), nil -} diff --git a/pkg/client/listers/node/v1alpha1/expansion_generated.go b/pkg/client/listers/node/v1alpha1/expansion_generated.go deleted file mode 100644 index eb3d65a6b..000000000 --- a/pkg/client/listers/node/v1alpha1/expansion_generated.go +++ /dev/null @@ -1,35 +0,0 @@ -// This file was automatically generated by lister-gen - -package v1alpha1 - -// AWSInstanceClassListerExpansion allows custom methods to be added to -// AWSInstanceClassLister. -type AWSInstanceClassListerExpansion interface{} - -// InstanceListerExpansion allows custom methods to be added to -// InstanceLister. -type InstanceListerExpansion interface{} - -// InstanceDeploymentListerExpansion allows custom methods to be added to -// InstanceDeploymentLister. -type InstanceDeploymentListerExpansion interface{} - -// InstanceSetListerExpansion allows custom methods to be added to -// InstanceSetLister. -type InstanceSetListerExpansion interface{} - -// InstanceTemplateListerExpansion allows custom methods to be added to -// InstanceTemplateLister. -type InstanceTemplateListerExpansion interface{} - -// InstanceTemplateNamespaceListerExpansion allows custom methods to be added to -// InstanceTemplateNamespaceLister. -type InstanceTemplateNamespaceListerExpansion interface{} - -// ScaleListerExpansion allows custom methods to be added to -// ScaleLister. -type ScaleListerExpansion interface{} - -// ScaleNamespaceListerExpansion allows custom methods to be added to -// ScaleNamespaceLister. -type ScaleNamespaceListerExpansion interface{} diff --git a/pkg/client/listers/node/v1alpha1/instance.go b/pkg/client/listers/node/v1alpha1/instance.go deleted file mode 100644 index 63c671b64..000000000 --- a/pkg/client/listers/node/v1alpha1/instance.go +++ /dev/null @@ -1,51 +0,0 @@ -// This file was automatically generated by lister-gen - -package v1alpha1 - -import ( - v1alpha1 "github.com/gardener/node-controller-manager/pkg/apis/node/v1alpha1" - "k8s.io/apimachinery/pkg/api/errors" - v1 "k8s.io/apimachinery/pkg/apis/meta/v1" - "k8s.io/apimachinery/pkg/labels" - "k8s.io/client-go/tools/cache" -) - -// InstanceLister helps list Instances. -type InstanceLister interface { - // List lists all Instances in the indexer. - List(selector labels.Selector) (ret []*v1alpha1.Instance, err error) - // Get retrieves the Instance from the index for a given name. - Get(name string) (*v1alpha1.Instance, error) - InstanceListerExpansion -} - -// instanceLister implements the InstanceLister interface. -type instanceLister struct { - indexer cache.Indexer -} - -// NewInstanceLister returns a new InstanceLister. -func NewInstanceLister(indexer cache.Indexer) InstanceLister { - return &instanceLister{indexer: indexer} -} - -// List lists all Instances in the indexer. -func (s *instanceLister) List(selector labels.Selector) (ret []*v1alpha1.Instance, err error) { - err = cache.ListAll(s.indexer, selector, func(m interface{}) { - ret = append(ret, m.(*v1alpha1.Instance)) - }) - return ret, err -} - -// Get retrieves the Instance from the index for a given name. -func (s *instanceLister) Get(name string) (*v1alpha1.Instance, error) { - key := &v1alpha1.Instance{ObjectMeta: v1.ObjectMeta{Name: name}} - obj, exists, err := s.indexer.Get(key) - if err != nil { - return nil, err - } - if !exists { - return nil, errors.NewNotFound(v1alpha1.Resource("instance"), name) - } - return obj.(*v1alpha1.Instance), nil -} diff --git a/pkg/client/listers/node/v1alpha1/instancedeployment.go b/pkg/client/listers/node/v1alpha1/instancedeployment.go deleted file mode 100644 index 65ec9d041..000000000 --- a/pkg/client/listers/node/v1alpha1/instancedeployment.go +++ /dev/null @@ -1,51 +0,0 @@ -// This file was automatically generated by lister-gen - -package v1alpha1 - -import ( - v1alpha1 "github.com/gardener/node-controller-manager/pkg/apis/node/v1alpha1" - "k8s.io/apimachinery/pkg/api/errors" - v1 "k8s.io/apimachinery/pkg/apis/meta/v1" - "k8s.io/apimachinery/pkg/labels" - "k8s.io/client-go/tools/cache" -) - -// InstanceDeploymentLister helps list InstanceDeployments. -type InstanceDeploymentLister interface { - // List lists all InstanceDeployments in the indexer. - List(selector labels.Selector) (ret []*v1alpha1.InstanceDeployment, err error) - // Get retrieves the InstanceDeployment from the index for a given name. - Get(name string) (*v1alpha1.InstanceDeployment, error) - InstanceDeploymentListerExpansion -} - -// instanceDeploymentLister implements the InstanceDeploymentLister interface. -type instanceDeploymentLister struct { - indexer cache.Indexer -} - -// NewInstanceDeploymentLister returns a new InstanceDeploymentLister. -func NewInstanceDeploymentLister(indexer cache.Indexer) InstanceDeploymentLister { - return &instanceDeploymentLister{indexer: indexer} -} - -// List lists all InstanceDeployments in the indexer. -func (s *instanceDeploymentLister) List(selector labels.Selector) (ret []*v1alpha1.InstanceDeployment, err error) { - err = cache.ListAll(s.indexer, selector, func(m interface{}) { - ret = append(ret, m.(*v1alpha1.InstanceDeployment)) - }) - return ret, err -} - -// Get retrieves the InstanceDeployment from the index for a given name. -func (s *instanceDeploymentLister) Get(name string) (*v1alpha1.InstanceDeployment, error) { - key := &v1alpha1.InstanceDeployment{ObjectMeta: v1.ObjectMeta{Name: name}} - obj, exists, err := s.indexer.Get(key) - if err != nil { - return nil, err - } - if !exists { - return nil, errors.NewNotFound(v1alpha1.Resource("instancedeployment"), name) - } - return obj.(*v1alpha1.InstanceDeployment), nil -} diff --git a/pkg/client/listers/node/v1alpha1/instanceset.go b/pkg/client/listers/node/v1alpha1/instanceset.go deleted file mode 100644 index 40b71e325..000000000 --- a/pkg/client/listers/node/v1alpha1/instanceset.go +++ /dev/null @@ -1,51 +0,0 @@ -// This file was automatically generated by lister-gen - -package v1alpha1 - -import ( - v1alpha1 "github.com/gardener/node-controller-manager/pkg/apis/node/v1alpha1" - "k8s.io/apimachinery/pkg/api/errors" - v1 "k8s.io/apimachinery/pkg/apis/meta/v1" - "k8s.io/apimachinery/pkg/labels" - "k8s.io/client-go/tools/cache" -) - -// InstanceSetLister helps list InstanceSets. -type InstanceSetLister interface { - // List lists all InstanceSets in the indexer. - List(selector labels.Selector) (ret []*v1alpha1.InstanceSet, err error) - // Get retrieves the InstanceSet from the index for a given name. - Get(name string) (*v1alpha1.InstanceSet, error) - InstanceSetListerExpansion -} - -// instanceSetLister implements the InstanceSetLister interface. -type instanceSetLister struct { - indexer cache.Indexer -} - -// NewInstanceSetLister returns a new InstanceSetLister. -func NewInstanceSetLister(indexer cache.Indexer) InstanceSetLister { - return &instanceSetLister{indexer: indexer} -} - -// List lists all InstanceSets in the indexer. -func (s *instanceSetLister) List(selector labels.Selector) (ret []*v1alpha1.InstanceSet, err error) { - err = cache.ListAll(s.indexer, selector, func(m interface{}) { - ret = append(ret, m.(*v1alpha1.InstanceSet)) - }) - return ret, err -} - -// Get retrieves the InstanceSet from the index for a given name. -func (s *instanceSetLister) Get(name string) (*v1alpha1.InstanceSet, error) { - key := &v1alpha1.InstanceSet{ObjectMeta: v1.ObjectMeta{Name: name}} - obj, exists, err := s.indexer.Get(key) - if err != nil { - return nil, err - } - if !exists { - return nil, errors.NewNotFound(v1alpha1.Resource("instanceset"), name) - } - return obj.(*v1alpha1.InstanceSet), nil -} diff --git a/pkg/client/listers/node/v1alpha1/instancetemplate.go b/pkg/client/listers/node/v1alpha1/instancetemplate.go deleted file mode 100644 index de8886ca2..000000000 --- a/pkg/client/listers/node/v1alpha1/instancetemplate.go +++ /dev/null @@ -1,78 +0,0 @@ -// This file was automatically generated by lister-gen - -package v1alpha1 - -import ( - v1alpha1 "github.com/gardener/node-controller-manager/pkg/apis/node/v1alpha1" - "k8s.io/apimachinery/pkg/api/errors" - "k8s.io/apimachinery/pkg/labels" - "k8s.io/client-go/tools/cache" -) - -// InstanceTemplateLister helps list InstanceTemplates. -type InstanceTemplateLister interface { - // List lists all InstanceTemplates in the indexer. - List(selector labels.Selector) (ret []*v1alpha1.InstanceTemplate, err error) - // InstanceTemplates returns an object that can list and get InstanceTemplates. - InstanceTemplates(namespace string) InstanceTemplateNamespaceLister - InstanceTemplateListerExpansion -} - -// instanceTemplateLister implements the InstanceTemplateLister interface. -type instanceTemplateLister struct { - indexer cache.Indexer -} - -// NewInstanceTemplateLister returns a new InstanceTemplateLister. -func NewInstanceTemplateLister(indexer cache.Indexer) InstanceTemplateLister { - return &instanceTemplateLister{indexer: indexer} -} - -// List lists all InstanceTemplates in the indexer. -func (s *instanceTemplateLister) List(selector labels.Selector) (ret []*v1alpha1.InstanceTemplate, err error) { - err = cache.ListAll(s.indexer, selector, func(m interface{}) { - ret = append(ret, m.(*v1alpha1.InstanceTemplate)) - }) - return ret, err -} - -// InstanceTemplates returns an object that can list and get InstanceTemplates. -func (s *instanceTemplateLister) InstanceTemplates(namespace string) InstanceTemplateNamespaceLister { - return instanceTemplateNamespaceLister{indexer: s.indexer, namespace: namespace} -} - -// InstanceTemplateNamespaceLister helps list and get InstanceTemplates. -type InstanceTemplateNamespaceLister interface { - // List lists all InstanceTemplates in the indexer for a given namespace. - List(selector labels.Selector) (ret []*v1alpha1.InstanceTemplate, err error) - // Get retrieves the InstanceTemplate from the indexer for a given namespace and name. - Get(name string) (*v1alpha1.InstanceTemplate, error) - InstanceTemplateNamespaceListerExpansion -} - -// instanceTemplateNamespaceLister implements the InstanceTemplateNamespaceLister -// interface. -type instanceTemplateNamespaceLister struct { - indexer cache.Indexer - namespace string -} - -// List lists all InstanceTemplates in the indexer for a given namespace. -func (s instanceTemplateNamespaceLister) List(selector labels.Selector) (ret []*v1alpha1.InstanceTemplate, err error) { - err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { - ret = append(ret, m.(*v1alpha1.InstanceTemplate)) - }) - return ret, err -} - -// Get retrieves the InstanceTemplate from the indexer for a given namespace and name. -func (s instanceTemplateNamespaceLister) Get(name string) (*v1alpha1.InstanceTemplate, error) { - obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) - if err != nil { - return nil, err - } - if !exists { - return nil, errors.NewNotFound(v1alpha1.Resource("instancetemplate"), name) - } - return obj.(*v1alpha1.InstanceTemplate), nil -} diff --git a/pkg/controller/controller.go b/pkg/controller/controller.go index 09a6e4da3..fa935c443 100644 --- a/pkg/controller/controller.go +++ b/pkg/controller/controller.go @@ -23,9 +23,9 @@ import ( "k8s.io/api/core/v1" v1core "k8s.io/client-go/kubernetes/typed/core/v1" - nodeclientset "github.com/gardener/node-controller-manager/pkg/client/clientset/typed/node/v1alpha1" - nodeinformers "github.com/gardener/node-controller-manager/pkg/client/informers/externalversions/node/v1alpha1" - nodelisters "github.com/gardener/node-controller-manager/pkg/client/listers/node/v1alpha1" + nodeclientset "github.com/gardener/node-controller-manager/pkg/client/clientset/typed/machine/v1alpha1" + nodeinformers "github.com/gardener/node-controller-manager/pkg/client/informers/externalversions/machine/v1alpha1" + nodelisters "github.com/gardener/node-controller-manager/pkg/client/listers/machine/v1alpha1" "github.com/golang/glog" "k8s.io/apimachinery/pkg/util/runtime" coreinformers "k8s.io/client-go/informers/core/v1" @@ -46,23 +46,21 @@ const ( pollingStartInterval = 1 * time.Second pollingMaxBackoffDuration = 1 * time.Hour - ClassAnnotation = "node.sapcloud.io/class" - - InstanceIDAnnotation = "node.sapcloud.io/id" - - DeleteFinalizerName = "node.sapcloud.io/operator" + ClassAnnotation = "machine.sapcloud.io/class" + MachineIDAnnotation = "machine.sapcloud.io/id" + DeleteFinalizerName = "machine.sapcloud.io/node-controller-manager" ) // NewController returns a new Node controller. func NewController( kubeClient kubernetes.Interface, - nodeClient nodeclientset.NodeV1alpha1Interface, + nodeClient nodeclientset.MachineV1alpha1Interface, secretInformer coreinformers.SecretInformer, nodeInformer coreinformers.NodeInformer, - awsInstanceClassInformer nodeinformers.AWSInstanceClassInformer, - instanceInformer nodeinformers.InstanceInformer, - instanceSetInformer nodeinformers.InstanceSetInformer, - instanceDeploymentInformer nodeinformers.InstanceDeploymentInformer, + awsMachineClassInformer nodeinformers.AWSMachineClassInformer, + machineInformer nodeinformers.MachineInformer, + machineSetInformer nodeinformers.MachineSetInformer, + machineDeploymentInformer nodeinformers.MachineDeploymentInformer, recorder record.EventRecorder, ) (Controller, error) { controller := &controller{ @@ -72,42 +70,42 @@ func NewController( expectations: NewUIDTrackingControllerExpectations(NewControllerExpectations()), secretQueue: workqueue.NewNamedRateLimitingQueue(workqueue.DefaultControllerRateLimiter(), "secret"), nodeQueue: workqueue.NewNamedRateLimitingQueue(workqueue.DefaultControllerRateLimiter(), "node"), - nodeToInstanceQueue: workqueue.NewNamedRateLimitingQueue(workqueue.DefaultControllerRateLimiter(), "nodeToInstance"), - awsInstanceClassQueue: workqueue.NewNamedRateLimitingQueue(workqueue.DefaultControllerRateLimiter(), "instanceclass"), - instanceQueue: workqueue.NewNamedRateLimitingQueue(workqueue.DefaultControllerRateLimiter(), "instance"), - instanceSetQueue: workqueue.NewNamedRateLimitingQueue(workqueue.DefaultControllerRateLimiter(), "instanceset"), - instanceDeploymentQueue: workqueue.NewNamedRateLimitingQueue(workqueue.DefaultControllerRateLimiter(), "instancedeployment"), + nodeToMachineQueue: workqueue.NewNamedRateLimitingQueue(workqueue.DefaultControllerRateLimiter(), "nodeToMachine"), + awsMachineClassQueue: workqueue.NewNamedRateLimitingQueue(workqueue.DefaultControllerRateLimiter(), "machineclass"), + machineQueue: workqueue.NewNamedRateLimitingQueue(workqueue.DefaultControllerRateLimiter(), "machine"), + machineSetQueue: workqueue.NewNamedRateLimitingQueue(workqueue.DefaultControllerRateLimiter(), "machineset"), + machineDeploymentQueue: workqueue.NewNamedRateLimitingQueue(workqueue.DefaultControllerRateLimiter(), "machinedeployment"), } eventBroadcaster := record.NewBroadcaster() eventBroadcaster.StartLogging(glog.Infof) eventBroadcaster.StartRecordingToSink(&v1core.EventSinkImpl{Interface: v1core.New(kubeClient.CoreV1().RESTClient()).Events("")}) - controller.instanceControl = RealInstanceControl { + controller.machineControl = RealMachineControl { NodeClient: nodeClient, - Recorder: eventBroadcaster.NewRecorder(nodescheme.Scheme, v1.EventSource{Component: "instanceset-controller"}), + Recorder: eventBroadcaster.NewRecorder(nodescheme.Scheme, v1.EventSource{Component: "machineset-controller"}), } - controller.instanceSetControl = RealISControl { + controller.machineSetControl = RealISControl { NodeClient: nodeClient, - Recorder: eventBroadcaster.NewRecorder(nodescheme.Scheme, v1.EventSource{Component: "instancedeployment-controller"}), + Recorder: eventBroadcaster.NewRecorder(nodescheme.Scheme, v1.EventSource{Component: "machinedeployment-controller"}), } // Controller listers controller.secretLister = secretInformer.Lister() - controller.awsInstanceClassLister = awsInstanceClassInformer.Lister() + controller.awsMachineClassLister = awsMachineClassInformer.Lister() controller.nodeLister = nodeInformer.Lister() - controller.instanceLister = instanceInformer.Lister() - controller.instanceSetLister = instanceSetInformer.Lister() - controller.instanceDeploymentLister = instanceDeploymentInformer.Lister() + controller.machineLister = machineInformer.Lister() + controller.machineSetLister = machineSetInformer.Lister() + controller.machineDeploymentLister = machineDeploymentInformer.Lister() // Controller syncs controller.secretSynced = secretInformer.Informer().HasSynced - controller.awsInstanceClassSynced = awsInstanceClassInformer.Informer().HasSynced + controller.awsMachineClassSynced = awsMachineClassInformer.Informer().HasSynced controller.nodeSynced = nodeInformer.Informer().HasSynced - controller.instanceSynced = instanceInformer.Informer().HasSynced - controller.instanceSetSynced = instanceSetInformer.Informer().HasSynced - controller.instanceDeploymentSynced = instanceDeploymentInformer.Informer().HasSynced + controller.machineSynced = machineInformer.Informer().HasSynced + controller.machineSetSynced = machineSetInformer.Informer().HasSynced + controller.machineDeploymentSynced = machineDeploymentInformer.Informer().HasSynced /* secretInformer.Informer().AddEventHandler(cache.ResourceEventHandlerFuncs{ @@ -116,10 +114,10 @@ func NewController( })*/ // Aws Controller Informers - awsInstanceClassInformer.Informer().AddEventHandler(cache.ResourceEventHandlerFuncs{ - AddFunc: controller.awsInstanceClassAdd, - UpdateFunc: controller.awsInstanceClassUpdate, - DeleteFunc: controller.awsInstanceClassDelete, + awsMachineClassInformer.Informer().AddEventHandler(cache.ResourceEventHandlerFuncs{ + AddFunc: controller.awsMachineClassAdd, + UpdateFunc: controller.awsMachineClassUpdate, + DeleteFunc: controller.awsMachineClassDelete, }) // Node Controller Informers @@ -136,47 +134,47 @@ func NewController( }, }) - // Instance Controller Informers + // Machine Controller Informers nodeInformer.Informer().AddEventHandler(cache.ResourceEventHandlerFuncs{ - AddFunc: controller.nodeToInstanceAdd, - UpdateFunc: controller.nodeToInstanceUpdate, - DeleteFunc: controller.nodeToInstanceDelete, + AddFunc: controller.nodeToMachineAdd, + UpdateFunc: controller.nodeToMachineUpdate, + DeleteFunc: controller.nodeToMachineDelete, }) - instanceInformer.Informer().AddEventHandler(cache.ResourceEventHandlerFuncs{ - AddFunc: controller.instanceAdd, - UpdateFunc: controller.instanceUpdate, - DeleteFunc: controller.instanceDelete, + machineInformer.Informer().AddEventHandler(cache.ResourceEventHandlerFuncs{ + AddFunc: controller.machineAdd, + UpdateFunc: controller.machineUpdate, + DeleteFunc: controller.machineDelete, }) - // InstanceSet Controller informers - instanceInformer.Informer().AddEventHandler(cache.ResourceEventHandlerFuncs{ - AddFunc: controller.addInstanceToInstanceSet, - UpdateFunc: controller.updateInstanceToInstanceSet, - DeleteFunc: controller.deleteInstanceToInstanceSet, + // MachineSet Controller informers + machineInformer.Informer().AddEventHandler(cache.ResourceEventHandlerFuncs{ + AddFunc: controller.addMachineToMachineSet, + UpdateFunc: controller.updateMachineToMachineSet, + DeleteFunc: controller.deleteMachineToMachineSet, }) - instanceSetInformer.Informer().AddEventHandler(cache.ResourceEventHandlerFuncs{ - AddFunc: controller.enqueueInstanceSet, - UpdateFunc: controller.instanceSetUpdate, - DeleteFunc: controller.enqueueInstanceSet, + machineSetInformer.Informer().AddEventHandler(cache.ResourceEventHandlerFuncs{ + AddFunc: controller.enqueueMachineSet, + UpdateFunc: controller.machineSetUpdate, + DeleteFunc: controller.enqueueMachineSet, }) - // InstanceDeployment Controller informers - instanceInformer.Informer().AddEventHandler(cache.ResourceEventHandlerFuncs{ - DeleteFunc: controller.deleteInstanceDeployment, + // MachineDeployment Controller informers + machineInformer.Informer().AddEventHandler(cache.ResourceEventHandlerFuncs{ + DeleteFunc: controller.deleteMachineDeployment, }) - instanceSetInformer.Informer().AddEventHandler(cache.ResourceEventHandlerFuncs{ - AddFunc: controller.addInstanceSetToDeployment, - UpdateFunc: controller.updateInstanceSetToDeployment, - DeleteFunc: controller.deleteInstanceSetToDeployment, + machineSetInformer.Informer().AddEventHandler(cache.ResourceEventHandlerFuncs{ + AddFunc: controller.addMachineSetToDeployment, + UpdateFunc: controller.updateMachineSetToDeployment, + DeleteFunc: controller.deleteMachineSetToDeployment, }) - instanceDeploymentInformer.Informer().AddEventHandler(cache.ResourceEventHandlerFuncs{ - AddFunc: controller.addInstanceDeployment, - UpdateFunc: controller.updateInstanceDeployment, - DeleteFunc: controller.deleteInstanceDeployment, + machineDeploymentInformer.Informer().AddEventHandler(cache.ResourceEventHandlerFuncs{ + AddFunc: controller.addMachineDeployment, + UpdateFunc: controller.updateMachineDeployment, + DeleteFunc: controller.deleteMachineDeployment, }) return controller, nil @@ -193,15 +191,15 @@ type Controller interface { // controller is a concrete Controller. type controller struct { kubeClient kubernetes.Interface - nodeClient nodeclientset.NodeV1alpha1Interface + nodeClient nodeclientset.MachineV1alpha1Interface // listers secretLister corelisters.SecretLister nodeLister corelisters.NodeLister - awsInstanceClassLister nodelisters.AWSInstanceClassLister - instanceLister nodelisters.InstanceLister - instanceSetLister nodelisters.InstanceSetLister - instanceDeploymentLister nodelisters.InstanceDeploymentLister + awsMachineClassLister nodelisters.AWSMachineClassLister + machineLister nodelisters.MachineLister + machineSetLister nodelisters.MachineSetLister + machineDeploymentLister nodelisters.MachineDeploymentLister recorder record.EventRecorder @@ -209,37 +207,37 @@ type controller struct { expectations *UIDTrackingControllerExpectations // Control Interfaces. - instanceControl InstanceControlInterface - instanceSetControl ISControlInterface + machineControl MachineControlInterface + machineSetControl ISControlInterface // queues secretQueue workqueue.RateLimitingInterface nodeQueue workqueue.RateLimitingInterface - nodeToInstanceQueue workqueue.RateLimitingInterface - awsInstanceClassQueue workqueue.RateLimitingInterface - instanceQueue workqueue.RateLimitingInterface - instanceSetQueue workqueue.RateLimitingInterface - instanceDeploymentQueue workqueue.RateLimitingInterface + nodeToMachineQueue workqueue.RateLimitingInterface + awsMachineClassQueue workqueue.RateLimitingInterface + machineQueue workqueue.RateLimitingInterface + machineSetQueue workqueue.RateLimitingInterface + machineDeploymentQueue workqueue.RateLimitingInterface // syncs secretSynced cache.InformerSynced nodeSynced cache.InformerSynced - awsInstanceClassSynced cache.InformerSynced - instanceSynced cache.InformerSynced - instanceSetSynced cache.InformerSynced - instanceDeploymentSynced cache.InformerSynced + awsMachineClassSynced cache.InformerSynced + machineSynced cache.InformerSynced + machineSetSynced cache.InformerSynced + machineDeploymentSynced cache.InformerSynced } func (c *controller) Run(workers int, stopCh <-chan struct{}) { defer runtimeutil.HandleCrash() defer c.nodeQueue.ShutDown() - defer c.awsInstanceClassQueue.ShutDown() - defer c.instanceQueue.ShutDown() - defer c.instanceSetQueue.ShutDown() - defer c.instanceDeploymentQueue.ShutDown() + defer c.awsMachineClassQueue.ShutDown() + defer c.machineQueue.ShutDown() + defer c.machineSetQueue.ShutDown() + defer c.machineDeploymentQueue.ShutDown() - if !cache.WaitForCacheSync(stopCh, c.secretSynced, c.nodeSynced, c.awsInstanceClassSynced, c.instanceSynced, c.instanceSetSynced, c.instanceDeploymentSynced) { + if !cache.WaitForCacheSync(stopCh, c.secretSynced, c.nodeSynced, c.awsMachineClassSynced, c.machineSynced, c.machineSetSynced, c.machineDeploymentSynced) { runtime.HandleError(fmt.Errorf("Timed out waiting for caches to sync")) return } @@ -248,16 +246,16 @@ func (c *controller) Run(workers int, stopCh <-chan struct{}) { var waitGroup sync.WaitGroup for i := 0; i < workers; i++ { - createWorker(c.awsInstanceClassQueue, "ClusterawsInstanceClass", maxRetries, true, c.reconcileClusterawsInstanceClassKey, stopCh, &waitGroup) + createWorker(c.awsMachineClassQueue, "ClusterawsMachineClass", maxRetries, true, c.reconcileClusterawsMachineClassKey, stopCh, &waitGroup) createWorker(c.nodeQueue, "ClusterNode", maxRetries, true, c.reconcileClusterNodeKey, stopCh, &waitGroup) - createWorker(c.instanceQueue, "ClusterInstance", maxRetries, true, c.reconcileClusterInstanceKey, stopCh, &waitGroup) - createWorker(c.nodeToInstanceQueue, "ClusterNodeToInstance", maxRetries, true, c.reconcileClusterNodeToInstanceKey, stopCh, &waitGroup) + createWorker(c.machineQueue, "ClusterMachine", maxRetries, true, c.reconcileClusterMachineKey, stopCh, &waitGroup) + createWorker(c.nodeToMachineQueue, "ClusterNodeToMachine", maxRetries, true, c.reconcileClusterNodeToMachineKey, stopCh, &waitGroup) - createWorker(c.instanceSetQueue, "ClusterInstanceSet", maxRetries, true, c.syncInstanceSet, stopCh, &waitGroup) + createWorker(c.machineSetQueue, "ClusterMachineSet", maxRetries, true, c.syncMachineSet, stopCh, &waitGroup) - createWorker(c.instanceDeploymentQueue, "ClusterInstanceDeployment", maxRetries, true, c.syncInstanceDeployment, stopCh, &waitGroup) + createWorker(c.machineDeploymentQueue, "ClusterMachineDeployment", maxRetries, true, c.syncMachineDeployment, stopCh, &waitGroup) } <-stopCh diff --git a/pkg/controller/controller_ref_manager.go b/pkg/controller/controller_ref_manager.go index 05bc2738f..ce3d56c9e 100644 --- a/pkg/controller/controller_ref_manager.go +++ b/pkg/controller/controller_ref_manager.go @@ -26,7 +26,7 @@ import ( "sync" "github.com/golang/glog" - "github.com/gardener/node-controller-manager/pkg/apis/node/v1alpha1" + "github.com/gardener/node-controller-manager/pkg/apis/machine/v1alpha1" "k8s.io/apimachinery/pkg/api/errors" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/labels" @@ -89,7 +89,7 @@ func (m *BaseControllerRefManager) ClaimObject(obj metav1.Object, match func(met return false, nil } if err := release(obj); err != nil { - // If the Instance no longer exists, ignore the error. + // If the Machine no longer exists, ignore the error. if errors.IsNotFound(err) { return false, nil } @@ -114,7 +114,7 @@ func (m *BaseControllerRefManager) ClaimObject(obj metav1.Object, match func(met // Selector matches. Try to adopt. if err := adopt(obj); err != nil { - // If the Instance no longer exists, ignore the error. + // If the Machine no longer exists, ignore the error. if errors.IsNotFound(err) { return false, nil } @@ -129,14 +129,14 @@ func (m *BaseControllerRefManager) ClaimObject(obj metav1.Object, match func(met -type InstanceControllerRefManager struct { +type MachineControllerRefManager struct { BaseControllerRefManager controllerKind schema.GroupVersionKind - instanceControl InstanceControlInterface + machineControl MachineControlInterface } -// NewInstanceControllerRefManager returns a InstanceControllerRefManager that exposes -// methods to manage the controllerRef of Instances. +// NewMachineControllerRefManager returns a MachineControllerRefManager that exposes +// methods to manage the controllerRef of Machines. // // The CanAdopt() function can be used to perform a potentially expensive check // (such as a live GET from the API server) prior to the first adoption. @@ -144,33 +144,33 @@ type InstanceControllerRefManager struct { // If CanAdopt() returns a non-nil error, all adoptions will fail. // // NOTE: Once CanAdopt() is called, it will not be called again by the same -// InstanceControllerRefManager instance. Create a new instance if it makes +// MachineControllerRefManager machine. Create a new machine if it makes // sense to check CanAdopt() again (e.g. in a different sync pass). -func NewInstanceControllerRefManager( - instanceControl InstanceControlInterface, +func NewMachineControllerRefManager( + machineControl MachineControlInterface, controller metav1.Object, selector labels.Selector, controllerKind schema.GroupVersionKind, canAdopt func() error, -) *InstanceControllerRefManager { - return &InstanceControllerRefManager{ +) *MachineControllerRefManager { + return &MachineControllerRefManager{ BaseControllerRefManager: BaseControllerRefManager{ Controller: controller, Selector: selector, CanAdoptFunc: canAdopt, }, controllerKind: controllerKind, - instanceControl: instanceControl, + machineControl: machineControl, } } -// ClaimInstances tries to take ownership of a list of Instances. +// ClaimMachines tries to take ownership of a list of Machines. // // It will reconcile the following: // * Adopt orphans if the selector matches. // * Release owned objects if the selector no longer matches. // -// Optional: If one or more filters are specified, a Instance will only be claimed if +// Optional: If one or more filters are specified, a Machine will only be claimed if // all filters return true. // // A non-nil error is returned if some form of reconciliation was attempted and @@ -178,19 +178,19 @@ func NewInstanceControllerRefManager( // is still needed. // // If the error is nil, either the reconciliation succeeded, or no -// reconciliation was necessary. The list of Instances that you now own is returned. -func (m *InstanceControllerRefManager) ClaimInstances(instances []*v1alpha1.Instance, filters ...func(*v1alpha1.Instance) bool) ([]*v1alpha1.Instance, error) { - var claimed []*v1alpha1.Instance +// reconciliation was necessary. The list of Machines that you now own is returned. +func (m *MachineControllerRefManager) ClaimMachines(machines []*v1alpha1.Machine, filters ...func(*v1alpha1.Machine) bool) ([]*v1alpha1.Machine, error) { + var claimed []*v1alpha1.Machine var errlist []error match := func(obj metav1.Object) bool { - instance := obj.(*v1alpha1.Instance) - // Check selector first so filters only run on potentially matching Instances. - if !m.Selector.Matches(labels.Set(instance.Labels)) { + machine := obj.(*v1alpha1.Machine) + // Check selector first so filters only run on potentially matching Machines. + if !m.Selector.Matches(labels.Set(machine.Labels)) { return false } for _, filter := range filters { - if !filter(instance) { + if !filter(machine) { return false } } @@ -198,67 +198,67 @@ func (m *InstanceControllerRefManager) ClaimInstances(instances []*v1alpha1.Inst } adopt := func(obj metav1.Object) error { - return m.AdoptInstance(obj.(*v1alpha1.Instance)) + return m.AdoptMachine(obj.(*v1alpha1.Machine)) } release := func(obj metav1.Object) error { - return m.ReleaseInstance(obj.(*v1alpha1.Instance)) + return m.ReleaseMachine(obj.(*v1alpha1.Machine)) } - for _, instance := range instances { - ok, err := m.ClaimObject(instance, match, adopt, release) + for _, machine := range machines { + ok, err := m.ClaimObject(machine, match, adopt, release) - //glog.Info(instance.Name, " OK:", ok, " ERR:", err) + //glog.Info(machine.Name, " OK:", ok, " ERR:", err) if err != nil { errlist = append(errlist, err) continue } if ok { - claimed = append(claimed, instance) + claimed = append(claimed, machine) } } return claimed, utilerrors.NewAggregate(errlist) } -// AdoptInstance sends a patch to take control of the Instance. It returns the error if +// AdoptMachine sends a patch to take control of the Machine. It returns the error if // the patching fails. -func (m *InstanceControllerRefManager) AdoptInstance(instance *v1alpha1.Instance) error { +func (m *MachineControllerRefManager) AdoptMachine(machine *v1alpha1.Machine) error { if err := m.CanAdopt(); err != nil { - return fmt.Errorf("can't adopt instance %v/%v (%v): %v", instance.Namespace, instance.Name, instance.UID, err) + return fmt.Errorf("can't adopt machine %v/%v (%v): %v", machine.Namespace, machine.Name, machine.UID, err) } // Note that ValidateOwnerReferences() will reject this patch if another // OwnerReference exists with controller=true. addControllerPatch := fmt.Sprintf( - `{"metadata":{"ownerReferences":[{"apiVersion":"node.sapcloud.io/v1alpha1","kind":"%s","name":"%s","uid":"%s","controller":true,"blockOwnerDeletion":true}],"uid":"%s"}}`, + `{"metadata":{"ownerReferences":[{"apiVersion":"machine.sapcloud.io/v1alpha1","kind":"%s","name":"%s","uid":"%s","controller":true,"blockOwnerDeletion":true}],"uid":"%s"}}`, m.controllerKind.Kind, - m.Controller.GetName(), m.Controller.GetUID(), instance.UID) - err := m.instanceControl.PatchInstance(instance.Name, []byte(addControllerPatch)) + m.Controller.GetName(), m.Controller.GetUID(), machine.UID) + err := m.machineControl.PatchMachine(machine.Name, []byte(addControllerPatch)) return err } -// ReleaseInstance sends a patch to free the Instance from the control of the controller. +// ReleaseMachine sends a patch to free the Machine from the control of the controller. // It returns the error if the patching fails. 404 and 422 errors are ignored. -func (m *InstanceControllerRefManager) ReleaseInstance(instance *v1alpha1.Instance) error { - glog.V(2).Infof("patching instance %s_%s to remove its controllerRef to %s/%s:%s", - instance.Namespace, instance.Name, m.controllerKind.GroupVersion(), m.controllerKind.Kind, m.Controller.GetName()) +func (m *MachineControllerRefManager) ReleaseMachine(machine *v1alpha1.Machine) error { + glog.V(2).Infof("patching machine %s_%s to remove its controllerRef to %s/%s:%s", + machine.Namespace, machine.Name, m.controllerKind.GroupVersion(), m.controllerKind.Kind, m.Controller.GetName()) deleteOwnerRefPatch := fmt.Sprintf( - `{"metadata":{"ownerReferences":[{"$patch":"delete", "apiVersion":"node.sapcloud.io/v1alpha1","kind":"%s","name":"%s","uid":"%s","controller":true,"blockOwnerDeletion":true}],"uid":"%s"}}`, + `{"metadata":{"ownerReferences":[{"$patch":"delete", "apiVersion":"machine.sapcloud.io/v1alpha1","kind":"%s","name":"%s","uid":"%s","controller":true,"blockOwnerDeletion":true}],"uid":"%s"}}`, m.controllerKind.Kind, - m.Controller.GetName(), m.Controller.GetUID(), instance.UID) + m.Controller.GetName(), m.Controller.GetUID(), machine.UID) - err := m.instanceControl.PatchInstance(instance.Name, []byte(deleteOwnerRefPatch)) + err := m.machineControl.PatchMachine(machine.Name, []byte(deleteOwnerRefPatch)) if err != nil { if errors.IsNotFound(err) { - // If the Instance no longer exists, ignore it. + // If the Machine no longer exists, ignore it. return nil } if errors.IsInvalid(err) { - // Invalid error will be returned in two cases: 1. the Instance - // has no owner reference, 2. the uid of the Instance doesn't - // match, which means the Instance is deleted and then recreated. + // Invalid error will be returned in two cases: 1. the Machine + // has no owner reference, 2. the uid of the Machine doesn't + // match, which means the Machine is deleted and then recreated. // In both cases, the error can be ignored. - // TODO: If the Instance has owner references, but none of them + // TODO: If the Machine has owner references, but none of them // has the owner.UID, server will silently ignore the patch. // Investigate why. return nil @@ -267,19 +267,19 @@ func (m *InstanceControllerRefManager) ReleaseInstance(instance *v1alpha1.Instan return err } -// InstanceSetControllerRefManager is used to manage controllerRef of InstanceSets. -// Three methods are defined on this object 1: Classify 2: AdoptInstanceSet and -// 3: ReleaseInstanceSet which are used to classify the InstanceSets into appropriate +// MachineSetControllerRefManager is used to manage controllerRef of MachineSets. +// Three methods are defined on this object 1: Classify 2: AdoptMachineSet and +// 3: ReleaseMachineSet which are used to classify the MachineSets into appropriate // categories and accordingly adopt or release them. See comments on these functions // for more details. -type InstanceSetControllerRefManager struct { +type MachineSetControllerRefManager struct { BaseControllerRefManager controllerKind schema.GroupVersionKind isControl ISControlInterface } -// NewInstanceSetControllerRefManager returns a InstanceSetControllerRefManager that exposes -// methods to manage the controllerRef of InstanceSets. +// NewMachineSetControllerRefManager returns a MachineSetControllerRefManager that exposes +// methods to manage the controllerRef of MachineSets. // // The CanAdopt() function can be used to perform a potentially expensive check // (such as a live GET from the API server) prior to the first adoption. @@ -287,16 +287,16 @@ type InstanceSetControllerRefManager struct { // If CanAdopt() returns a non-nil error, all adoptions will fail. // // NOTE: Once CanAdopt() is called, it will not be called again by the same -// InstanceSetControllerRefManager instance. Create a new instance if it +// MachineSetControllerRefManager machine. Create a new machine if it // makes sense to check CanAdopt() again (e.g. in a different sync pass). -func NewInstanceSetControllerRefManager( +func NewMachineSetControllerRefManager( isControl ISControlInterface, controller metav1.Object, selector labels.Selector, controllerKind schema.GroupVersionKind, canAdopt func() error, -) *InstanceSetControllerRefManager { - return &InstanceSetControllerRefManager{ +) *MachineSetControllerRefManager { + return &MachineSetControllerRefManager{ BaseControllerRefManager: BaseControllerRefManager{ Controller: controller, Selector: selector, @@ -307,7 +307,7 @@ func NewInstanceSetControllerRefManager( } } -// ClaimInstanceSets tries to take ownership of a list of InstanceSets. +// ClaimMachineSets tries to take ownership of a list of MachineSets. // // It will reconcile the following: // * Adopt orphans if the selector matches. @@ -318,23 +318,23 @@ func NewInstanceSetControllerRefManager( // is still needed. // // If the error is nil, either the reconciliation succeeded, or no -// reconciliation was necessary. The list of InstanceSets that you now own is +// reconciliation was necessary. The list of MachineSets that you now own is // returned. -func (m *InstanceSetControllerRefManager) ClaimInstanceSets(sets []*v1alpha1.InstanceSet) ([]*v1alpha1.InstanceSet, error) { - var claimed []*v1alpha1.InstanceSet +func (m *MachineSetControllerRefManager) ClaimMachineSets(sets []*v1alpha1.MachineSet) ([]*v1alpha1.MachineSet, error) { + var claimed []*v1alpha1.MachineSet var errlist []error match := func(obj metav1.Object) bool { - instanceSet := obj.(*v1alpha1.InstanceSet) - //return m.Selector.Matches(labels.Set(instanceSet.GetLabels())) - return m.Selector.Matches(labels.Set(instanceSet.Labels)) + machineSet := obj.(*v1alpha1.MachineSet) + //return m.Selector.Matches(labels.Set(machineSet.GetLabels())) + return m.Selector.Matches(labels.Set(machineSet.Labels)) } adopt := func(obj metav1.Object) error { - return m.AdoptInstanceSet(obj.(*v1alpha1.InstanceSet)) + return m.AdoptMachineSet(obj.(*v1alpha1.MachineSet)) } release := func(obj metav1.Object) error { - return m.ReleaseInstanceSet(obj.(*v1alpha1.InstanceSet)) + return m.ReleaseMachineSet(obj.(*v1alpha1.MachineSet)) } for _, is := range sets { @@ -350,41 +350,41 @@ func (m *InstanceSetControllerRefManager) ClaimInstanceSets(sets []*v1alpha1.Ins return claimed, utilerrors.NewAggregate(errlist) } -// AdoptInstanceSet sends a patch to take control of the InstanceSet. It returns +// AdoptMachineSet sends a patch to take control of the MachineSet. It returns // the error if the patching fails. -func (m *InstanceSetControllerRefManager) AdoptInstanceSet(is *v1alpha1.InstanceSet) error { +func (m *MachineSetControllerRefManager) AdoptMachineSet(is *v1alpha1.MachineSet) error { if err := m.CanAdopt(); err != nil { - return fmt.Errorf("can't adopt InstanceSet %v (%v): %v", is.Name, is.UID, err) + return fmt.Errorf("can't adopt MachineSet %v (%v): %v", is.Name, is.UID, err) } // Note that ValidateOwnerReferences() will reject this patch if another // OwnerReference exists with controller=true. addControllerPatch := fmt.Sprintf( - `{"metadata":{"ownerReferences":[{"apiVersion":"node.sapcloud.io/v1alpha1","kind":"%s","name":"%s","uid":"%s","controller":true,"blockOwnerDeletion":true}],"uid":"%s"}}`, + `{"metadata":{"ownerReferences":[{"apiVersion":"machine.sapcloud.io/v1alpha1","kind":"%s","name":"%s","uid":"%s","controller":true,"blockOwnerDeletion":true}],"uid":"%s"}}`, m.controllerKind.Kind, m.Controller.GetName(), m.Controller.GetUID(), is.UID) - return m.isControl.PatchInstanceSet(is.Namespace, is.Name, []byte(addControllerPatch)) + return m.isControl.PatchMachineSet(is.Namespace, is.Name, []byte(addControllerPatch)) } -// ReleaseInstanceSet sends a patch to free the InstanceSet from the control of the InstanceDeployment controller. +// ReleaseMachineSet sends a patch to free the MachineSet from the control of the MachineDeployment controller. // It returns the error if the patching fails. 404 and 422 errors are ignored. -func (m *InstanceSetControllerRefManager) ReleaseInstanceSet(instanceSet *v1alpha1.InstanceSet) error { - glog.V(2).Infof("patching InstanceSet %s_%s to remove its controllerRef to %s:%s", - instanceSet.Name, m.controllerKind.GroupVersion(), m.controllerKind.Kind, m.Controller.GetName()) - //deleteOwnerRefPatch := fmt.Sprintf(`{"metadata":{"ownerReferences":[{"$patch":"delete","uid":"%s"}],"uid":"%s"}}`, m.Controller.GetUID(), instanceSet.UID) +func (m *MachineSetControllerRefManager) ReleaseMachineSet(machineSet *v1alpha1.MachineSet) error { + glog.V(2).Infof("patching MachineSet %s_%s to remove its controllerRef to %s:%s", + machineSet.Name, m.controllerKind.GroupVersion(), m.controllerKind.Kind, m.Controller.GetName()) + //deleteOwnerRefPatch := fmt.Sprintf(`{"metadata":{"ownerReferences":[{"$patch":"delete","uid":"%s"}],"uid":"%s"}}`, m.Controller.GetUID(), machineSet.UID) deleteOwnerRefPatch := fmt.Sprintf( - `{"metadata":{"ownerReferences":[{"$patch":"delete", "apiVersion":"node.sapcloud.io/v1alpha1","kind":"%s","name":"%s","uid":"%s","controller":true,"blockOwnerDeletion":true}],"uid":"%s"}}`, + `{"metadata":{"ownerReferences":[{"$patch":"delete", "apiVersion":"machine.sapcloud.io/v1alpha1","kind":"%s","name":"%s","uid":"%s","controller":true,"blockOwnerDeletion":true}],"uid":"%s"}}`, m.controllerKind.Kind, - m.Controller.GetName(), m.Controller.GetUID(), instanceSet.UID) - err := m.isControl.PatchInstanceSet(instanceSet.Namespace, instanceSet.Name, []byte(deleteOwnerRefPatch)) + m.Controller.GetName(), m.Controller.GetUID(), machineSet.UID) + err := m.isControl.PatchMachineSet(machineSet.Namespace, machineSet.Name, []byte(deleteOwnerRefPatch)) if err != nil { if errors.IsNotFound(err) { - // If the InstanceSet no longer exists, ignore it. + // If the MachineSet no longer exists, ignore it. return nil } if errors.IsInvalid(err) { - // Invalid error will be returned in two cases: 1. the InstanceSet - // has no owner reference, 2. the uid of the InstanceSet doesn't - // match, which means the InstanceSet is deleted and then recreated. + // Invalid error will be returned in two cases: 1. the MachineSet + // has no owner reference, 2. the uid of the MachineSet doesn't + // match, which means the MachineSet is deleted and then recreated. // In both cases, the error can be ignored. return nil } diff --git a/pkg/controller/controller_utls.go b/pkg/controller/controller_utls.go index 137b62220..8c919aaec 100644 --- a/pkg/controller/controller_utls.go +++ b/pkg/controller/controller_utls.go @@ -30,8 +30,8 @@ import ( "sync/atomic" "time" - nodeclientset "github.com/gardener/node-controller-manager/pkg/client/clientset/typed/node/v1alpha1" - "github.com/gardener/node-controller-manager/pkg/apis/node/v1alpha1" + nodeclientset "github.com/gardener/node-controller-manager/pkg/client/clientset/typed/machine/v1alpha1" + "github.com/gardener/node-controller-manager/pkg/apis/machine/v1alpha1" nodescheme "github.com/gardener/node-controller-manager/pkg/client/clientset/scheme" "k8s.io/api/core/v1" "k8s.io/apimachinery/pkg/api/meta" @@ -59,18 +59,18 @@ import ( ) const ( - // If a watch drops a delete event for a instance, it'll take this long + // If a watch drops a delete event for a machine, it'll take this long // before a dormant controller waiting for those packets is woken up anyway. It is // specifically targeted at the case where some problem prevents an update // of expectations, without it the controller could stay asleep forever. This should // be set based on the expected latency of watch events. // // Currently a controller can service (create *and* observe the watch events for said - // creation) about 10 instances a second, so it takes about 1 min to service - // 500 instances. Just creation is limited to 20qps, and watching happens with ~10-30s - // latency/instance at the scale of 3000 instances over 100 nodes. + // creation) about 10 machines a second, so it takes about 1 min to service + // 500 machines. Just creation is limited to 20qps, and watching happens with ~10-30s + // latency/machine at the scale of 3000 machines over 100 nodes. ExpectationsTimeout = 5 * time.Minute - // When batching instance creates, SlowStartInitialBatchSize is the size of the + // When batching machine creates, SlowStartInitialBatchSize is the size of the // inital batch. The size of each successive batch is twice the size of // the previous batch. For example, for a value of 1, batch sizes would be // 1, 2, 4, 8, ... and for a value of 10, batch sizes would be @@ -79,7 +79,7 @@ const ( // the value lower will result in more API call round trip periods for // large batches. // - // Given a number of instances to start "N": + // Given a number of machines to start "N": // The number of doomed calls per sync once quota is exceeded is given by: // min(N,SlowStartInitialBatchSize) // The number of batches is given by: @@ -307,7 +307,7 @@ type UIDSet struct { key string } -// UIDTrackingControllerExpectations tracks the UID of the instances it deletes. +// UIDTrackingControllerExpectations tracks the UID of the machines it deletes. // This cache is needed over plain old expectations to safely handle graceful // deletion. The desired behavior is to treat an update that sets the // DeletionTimestamp on an object as a delete. To do so consistently, one needs @@ -359,7 +359,7 @@ func (u *UIDTrackingControllerExpectations) DeletionObserved(rcKey, deleteKey st uids := u.GetUIDs(rcKey) if uids != nil && uids.Has(deleteKey) { - glog.V(4).Infof("Controller %v received delete for instance %v", rcKey, deleteKey) + glog.V(4).Infof("Controller %v received delete for machine %v", rcKey, deleteKey) u.ControllerExpectationsInterface.DeletionObserved(rcKey) uids.Delete(deleteKey) } @@ -385,40 +385,40 @@ func NewUIDTrackingControllerExpectations(ce ControllerExpectationsInterface) *U return &UIDTrackingControllerExpectations{ControllerExpectationsInterface: ce, uidStore: cache.NewStore(UIDSetKeyFunc)} } -// Reasons for instance events +// Reasons for machine events const ( - // FailedCreateInstanceReason is added in an event and in a instance set condition - // when a instance for a instance set is failed to be created. - FailedCreateInstanceReason = "FailedCreate" - // SuccessfulCreateInstanceReason is added in an event when a instance for a instance set + // FailedCreateMachineReason is added in an event and in a machine set condition + // when a machine for a machine set is failed to be created. + FailedCreateMachineReason = "FailedCreate" + // SuccessfulCreateMachineReason is added in an event when a machine for a machine set // is successfully created. - SuccessfulCreateInstanceReason = "SuccessfulCreate" - // FailedDeleteInstanceReason is added in an event and in a instance set condition - // when a instance for a instance set is failed to be deleted. - FailedDeleteInstanceReason = "FailedDelete" - // SuccessfulDeleteinstanceReason is added in an event when a instance for a instance set + SuccessfulCreateMachineReason = "SuccessfulCreate" + // FailedDeleteMachineReason is added in an event and in a machine set condition + // when a machine for a machine set is failed to be deleted. + FailedDeleteMachineReason = "FailedDelete" + // SuccessfulDeletemachineReason is added in an event when a machine for a machine set // is successfully deleted. - SuccessfulDeleteInstanceReason = "SuccessfulDelete" + SuccessfulDeleteMachineReason = "SuccessfulDelete" ) // RSControlInterface is an interface that knows how to add or delete -// InstanceSets, as well as increment or decrement them. It is used +// MachineSets, as well as increment or decrement them. It is used // by the deployment controller to ease testing of actions that it takes. type ISControlInterface interface { - PatchInstanceSet(namespace, name string, data []byte) error + PatchMachineSet(namespace, name string, data []byte) error } // RealRSControl is the default implementation of RSControllerInterface. type RealISControl struct { - NodeClient nodeclientset.NodeV1alpha1Interface + NodeClient nodeclientset.MachineV1alpha1Interface Recorder record.EventRecorder } var _ ISControlInterface = &RealISControl{} -func (r RealISControl) PatchInstanceSet(namespace, name string, data []byte) error { - _, err := r.NodeClient.InstanceSets().Patch(name, types.MergePatchType, data) +func (r RealISControl) PatchMachineSet(namespace, name string, data []byte) error { + _, err := r.NodeClient.MachineSets().Patch(name, types.MergePatchType, data) return err } @@ -461,28 +461,28 @@ func validateControllerRef(controllerRef *metav1.OwnerReference) error { return nil } -//--- For Instances ---// -// RealinstanceControl is the default implementation of instanceControlInterface. -type RealInstanceControl struct { - NodeClient nodeclientset.NodeV1alpha1Interface +//--- For Machines ---// +// RealmachineControl is the default implementation of machineControlInterface. +type RealMachineControl struct { + NodeClient nodeclientset.MachineV1alpha1Interface Recorder record.EventRecorder } -var _ InstanceControlInterface = &RealInstanceControl{} +var _ MachineControlInterface = &RealMachineControl{} -type InstanceControlInterface interface { - // Createinstances creates new instances according to the spec. - CreateInstances(template *v1alpha1.InstanceTemplateSpec, object runtime.Object) error - // CreateinstancesWithControllerRef creates new instances according to the spec, and sets object as the instance's controller. - CreateInstancesWithControllerRef(template *v1alpha1.InstanceTemplateSpec, object runtime.Object, controllerRef *metav1.OwnerReference) error - // Deleteinstance deletes the instance identified by instanceID. - DeleteInstance(instanceID string, object runtime.Object) error - // Patchinstance patches the instance. - PatchInstance(name string, data []byte) error +type MachineControlInterface interface { + // Createmachines creates new machines according to the spec. + CreateMachines(template *v1alpha1.MachineTemplateSpec, object runtime.Object) error + // CreatemachinesWithControllerRef creates new machines according to the spec, and sets object as the machine's controller. + CreateMachinesWithControllerRef(template *v1alpha1.MachineTemplateSpec, object runtime.Object, controllerRef *metav1.OwnerReference) error + // Deletemachine deletes the machine identified by machineID. + DeleteMachine(machineID string, object runtime.Object) error + // Patchmachine patches the machine. + PatchMachine(name string, data []byte) error } -func getInstancesLabelSet(template *v1alpha1.InstanceTemplateSpec) labels.Set { +func getMachinesLabelSet(template *v1alpha1.MachineTemplateSpec) labels.Set { desiredLabels := make(labels.Set) for k, v := range template.Labels { desiredLabels[k] = v @@ -490,13 +490,13 @@ func getInstancesLabelSet(template *v1alpha1.InstanceTemplateSpec) labels.Set { return desiredLabels } -func getInstancesFinalizers(template *v1alpha1.InstanceTemplateSpec) []string { +func getMachinesFinalizers(template *v1alpha1.MachineTemplateSpec) []string { desiredFinalizers := make([]string, len(template.Finalizers)) copy(desiredFinalizers, template.Finalizers) return desiredFinalizers } -func getInstancesAnnotationSet(template *v1alpha1.InstanceTemplateSpec, object runtime.Object) (labels.Set, error) { +func getMachinesAnnotationSet(template *v1alpha1.MachineTemplateSpec, object runtime.Object) (labels.Set, error) { desiredAnnotations := make(labels.Set) for k, v := range template.Annotations { desiredAnnotations[k] = v @@ -521,8 +521,8 @@ func getInstancesAnnotationSet(template *v1alpha1.InstanceTemplateSpec, object r return desiredAnnotations, nil } -func getInstancesPrefix(controllerName string) string { - // use the dash (if the name isn't too long) to make the instance name a bit prettier +func getMachinesPrefix(controllerName string) string { + // use the dash (if the name isn't too long) to make the machine name a bit prettier prefix := fmt.Sprintf("%s-", controllerName) if len(validation.ValidatePodName(prefix, true)) != 0 { // #ToCheck prefix = controllerName @@ -530,20 +530,20 @@ func getInstancesPrefix(controllerName string) string { return prefix } -func (r RealInstanceControl) CreateInstancesWithControllerRef(template *v1alpha1.InstanceTemplateSpec, controllerObject runtime.Object, controllerRef *metav1.OwnerReference) error { +func (r RealMachineControl) CreateMachinesWithControllerRef(template *v1alpha1.MachineTemplateSpec, controllerObject runtime.Object, controllerRef *metav1.OwnerReference) error { if err := validateControllerRef(controllerRef); err != nil { return err } - return r.createInstances(template, controllerObject, controllerRef) + return r.createMachines(template, controllerObject, controllerRef) } -func GetInstanceFromTemplate(template *v1alpha1.InstanceTemplateSpec, parentObject runtime.Object, controllerRef *metav1.OwnerReference) (*v1alpha1.Instance, error) { +func GetMachineFromTemplate(template *v1alpha1.MachineTemplateSpec, parentObject runtime.Object, controllerRef *metav1.OwnerReference) (*v1alpha1.Machine, error) { //glog.Info("Template details \n", template.Spec.Class) - desiredLabels := getInstancesLabelSet(template) + desiredLabels := getMachinesLabelSet(template) //glog.Info(desiredLabels) - desiredFinalizers := getInstancesFinalizers(template) - desiredAnnotations, err := getInstancesAnnotationSet(template, parentObject) + desiredFinalizers := getMachinesFinalizers(template) + desiredAnnotations, err := getMachinesAnnotationSet(template, parentObject) if err != nil { return nil, err } @@ -551,49 +551,49 @@ func GetInstanceFromTemplate(template *v1alpha1.InstanceTemplateSpec, parentObje if err != nil { return nil, fmt.Errorf("parentObject does not have ObjectMeta, %v", err) } - prefix := getInstancesPrefix(accessor.GetName()) + prefix := getMachinesPrefix(accessor.GetName()) //glog.Info("2") - instance := &v1alpha1.Instance{ + machine := &v1alpha1.Machine{ ObjectMeta: metav1.ObjectMeta{ Labels: desiredLabels, Annotations: desiredAnnotations, GenerateName: prefix, Finalizers: desiredFinalizers, }, - Spec: v1alpha1.InstanceSpec{ + Spec: v1alpha1.MachineSpec{ Class: template.Spec.Class, }, } if controllerRef != nil { - instance.OwnerReferences = append(instance.OwnerReferences, *controllerRef) + machine.OwnerReferences = append(machine.OwnerReferences, *controllerRef) } - instance.Spec = *template.Spec.DeepCopy() + machine.Spec = *template.Spec.DeepCopy() //glog.Info("3") - return instance, nil + return machine, nil } -func (r RealInstanceControl) CreateInstances(template *v1alpha1.InstanceTemplateSpec, object runtime.Object) error { - return r.createInstances(template, object, nil) +func (r RealMachineControl) CreateMachines(template *v1alpha1.MachineTemplateSpec, object runtime.Object) error { + return r.createMachines(template, object, nil) } -func (r RealInstanceControl) createInstances(template *v1alpha1.InstanceTemplateSpec, object runtime.Object, controllerRef *metav1.OwnerReference) error { - instance, err := GetInstanceFromTemplate(template, object, controllerRef) +func (r RealMachineControl) createMachines(template *v1alpha1.MachineTemplateSpec, object runtime.Object, controllerRef *metav1.OwnerReference) error { + machine, err := GetMachineFromTemplate(template, object, controllerRef) if err != nil { return err } - //glog.Infof("1a %v", instance.Labels) + //glog.Infof("1a %v", machine.Labels) - if labels.Set(instance.Labels).AsSelectorPreValidated().Empty() { + if labels.Set(machine.Labels).AsSelectorPreValidated().Empty() { //glog.Infof("1b") - return fmt.Errorf("unable to create instances, no labels") + return fmt.Errorf("unable to create machines, no labels") } - //glog.Infof("2 : Printing Instance details : %+v", instance) + //glog.Infof("2 : Printing Machine details : %+v", machine) - if newInstance, err := r.NodeClient.Instances().Create(instance); err != nil { + if newMachine, err := r.NodeClient.Machines().Create(machine); err != nil { glog.Error(err) //glog.Infof("3") - r.Recorder.Eventf(object, v1.EventTypeWarning, FailedCreateInstanceReason, "Error creating: %v", err) + r.Recorder.Eventf(object, v1.EventTypeWarning, FailedCreateMachineReason, "Error creating: %v", err) return err } else { accessor, err := meta.Accessor(object) @@ -602,46 +602,46 @@ func (r RealInstanceControl) createInstances(template *v1alpha1.InstanceTemplate return nil } //glog.Infof("4") - glog.V(2).Infof("Controller %v created instance %v", accessor.GetName(), newInstance.Name) - r.Recorder.Eventf(object, v1.EventTypeNormal, SuccessfulCreateInstanceReason, "Created Instance: %v", newInstance.Name) + glog.V(2).Infof("Controller %v created machine %v", accessor.GetName(), newMachine.Name) + r.Recorder.Eventf(object, v1.EventTypeNormal, SuccessfulCreateMachineReason, "Created Machine: %v", newMachine.Name) } //glog.Infof("5") return nil } -func (r RealInstanceControl) PatchInstance(name string, data []byte) error { - _, err := r.NodeClient.Instances().Patch(name, types.MergePatchType, data) +func (r RealMachineControl) PatchMachine(name string, data []byte) error { + _, err := r.NodeClient.Machines().Patch(name, types.MergePatchType, data) return err } -func (r RealInstanceControl) DeleteInstance(instanceID string, object runtime.Object) error { +func (r RealMachineControl) DeleteMachine(machineID string, object runtime.Object) error { accessor, err := meta.Accessor(object) if err != nil { return fmt.Errorf("object does not have ObjectMeta, %v", err) } - glog.V(2).Infof("Controller %v deleting instance %v", accessor.GetName(), instanceID) + glog.V(2).Infof("Controller %v deleting machine %v", accessor.GetName(), machineID) - if err := r.NodeClient.Instances().Delete(instanceID, nil); err != nil { - r.Recorder.Eventf(object, v1.EventTypeWarning, FailedDeleteInstanceReason, "Error deleting: %v", err) - return fmt.Errorf("unable to delete instances: %v", err) + if err := r.NodeClient.Machines().Delete(machineID, nil); err != nil { + r.Recorder.Eventf(object, v1.EventTypeWarning, FailedDeleteMachineReason, "Error deleting: %v", err) + return fmt.Errorf("unable to delete machines: %v", err) } else { - r.Recorder.Eventf(object, v1.EventTypeNormal, SuccessfulDeleteInstanceReason, "Deleted instance: %v", instanceID) + r.Recorder.Eventf(object, v1.EventTypeNormal, SuccessfulDeleteMachineReason, "Deleted machine: %v", machineID) } return nil } // --- // -// Activeinstances type allows custom sorting of instances so a controller can pick the best ones to delete. -type ActiveInstances []*v1alpha1.Instance +// Activemachines type allows custom sorting of machines so a controller can pick the best ones to delete. +type ActiveMachines []*v1alpha1.Machine -func (s ActiveInstances) Len() int { return len(s) } -func (s ActiveInstances) Swap(i, j int) { s[i], s[j] = s[j], s[i] } +func (s ActiveMachines) Len() int { return len(s) } +func (s ActiveMachines) Swap(i, j int) { s[i], s[j] = s[j], s[i] } -func (s ActiveInstances) Less(i, j int) bool { +func (s ActiveMachines) Less(i, j int) bool { - m := map[v1alpha1.InstanceState]int{v1alpha1.InstanceStateFailed: 0, v1alpha1.InstanceStateProcessing: 1, v1alpha1.InstanceStateSuccessful: 2} + m := map[v1alpha1.MachineState]int{v1alpha1.MachineStateFailed: 0, v1alpha1.MachineStateProcessing: 1, v1alpha1.MachineStateSuccessful: 2} if m[s[i].Status.LastOperation.State] != m[s[j].Status.LastOperation.State] { return m[s[i].Status.LastOperation.State] < m[s[j].Status.LastOperation.State] } @@ -659,18 +659,18 @@ func afterOrZero(t1, t2 *metav1.Time) bool { return t1.After(t2.Time) } -func IsInstanceActive(p *v1alpha1.Instance) bool { - if p.Status.CurrentStatus.Phase == v1alpha1.InstanceFailed { +func IsMachineActive(p *v1alpha1.Machine) bool { + if p.Status.CurrentStatus.Phase == v1alpha1.MachineFailed { return false - } else if p.Status.CurrentStatus.Phase == v1alpha1.InstanceTerminating { + } else if p.Status.CurrentStatus.Phase == v1alpha1.MachineTerminating { return false } return true } -func IsInstanceFailed(p *v1alpha1.Instance) bool { - if p.Status.CurrentStatus.Phase == v1alpha1.InstanceFailed { +func IsMachineFailed(p *v1alpha1.Machine) bool { + if p.Status.CurrentStatus.Phase == v1alpha1.MachineFailed { return true } @@ -678,8 +678,8 @@ func IsInstanceFailed(p *v1alpha1.Instance) bool { } -func InstanceKey(instance *v1alpha1.Instance) string { //ToCheck : as instance-namespace does not matter - return fmt.Sprintf("%v/%v", instance.Name) +func MachineKey(machine *v1alpha1.Machine) string { //ToCheck : as machine-namespace does not matter + return fmt.Sprintf("%v/%v", machine.Name) } // ControllersByCreationTimestamp sorts a list of ReplicationControllers by creation timestamp, using their names as a tie breaker. @@ -694,58 +694,58 @@ func (o ControllersByCreationTimestamp) Less(i, j int) bool { return o[i].CreationTimestamp.Before(&o[j].CreationTimestamp) } -/****************** For InstanceSet **********************/ -// InstanceSetsByCreationTimestamp sorts a list of InstanceSet by creation timestamp, using their names as a tie breaker. -type InstanceSetsByCreationTimestamp []*v1alpha1.InstanceSet +/****************** For MachineSet **********************/ +// MachineSetsByCreationTimestamp sorts a list of MachineSet by creation timestamp, using their names as a tie breaker. +type MachineSetsByCreationTimestamp []*v1alpha1.MachineSet -func (o InstanceSetsByCreationTimestamp) Len() int { return int(len(o)) } -func (o InstanceSetsByCreationTimestamp) Swap(i, j int) { o[i], o[j] = o[j], o[i] } -func (o InstanceSetsByCreationTimestamp) Less(i, j int) bool { +func (o MachineSetsByCreationTimestamp) Len() int { return int(len(o)) } +func (o MachineSetsByCreationTimestamp) Swap(i, j int) { o[i], o[j] = o[j], o[i] } +func (o MachineSetsByCreationTimestamp) Less(i, j int) bool { if o[i].CreationTimestamp.Equal(&o[j].CreationTimestamp) { return o[i].Name < o[j].Name } return o[i].CreationTimestamp.Before(&o[j].CreationTimestamp) } -// InstanceSetsBySizeOlder sorts a list of InstanceSet by size in descending order, using their creation timestamp or name as a tie breaker. -// By using the creation timestamp, this sorts from old to new instance sets. -type InstanceSetsBySizeOlder []*v1alpha1.InstanceSet +// MachineSetsBySizeOlder sorts a list of MachineSet by size in descending order, using their creation timestamp or name as a tie breaker. +// By using the creation timestamp, this sorts from old to new machine sets. +type MachineSetsBySizeOlder []*v1alpha1.MachineSet -func (o InstanceSetsBySizeOlder) Len() int { return int(len(o)) } -func (o InstanceSetsBySizeOlder) Swap(i, j int) { o[i], o[j] = o[j], o[i] } -func (o InstanceSetsBySizeOlder) Less(i, j int) bool { +func (o MachineSetsBySizeOlder) Len() int { return int(len(o)) } +func (o MachineSetsBySizeOlder) Swap(i, j int) { o[i], o[j] = o[j], o[i] } +func (o MachineSetsBySizeOlder) Less(i, j int) bool { if (o[i].Spec.Replicas) == (o[j].Spec.Replicas) { - return InstanceSetsByCreationTimestamp(o).Less(int(i), int(j)) + return MachineSetsByCreationTimestamp(o).Less(int(i), int(j)) } return (o[i].Spec.Replicas) > (o[j].Spec.Replicas) } -// InstanceSetsBySizeNewer sorts a list of InstanceSet by size in descending order, using their creation timestamp or name as a tie breaker. -// By using the creation timestamp, this sorts from new to old instance sets. -type InstanceSetsBySizeNewer []*v1alpha1.InstanceSet +// MachineSetsBySizeNewer sorts a list of MachineSet by size in descending order, using their creation timestamp or name as a tie breaker. +// By using the creation timestamp, this sorts from new to old machine sets. +type MachineSetsBySizeNewer []*v1alpha1.MachineSet -func (o InstanceSetsBySizeNewer) Len() int { return int(len(o)) } -func (o InstanceSetsBySizeNewer) Swap(i, j int) { o[i], o[j] = o[j], o[i] } -func (o InstanceSetsBySizeNewer) Less(i, j int) bool { +func (o MachineSetsBySizeNewer) Len() int { return int(len(o)) } +func (o MachineSetsBySizeNewer) Swap(i, j int) { o[i], o[j] = o[j], o[i] } +func (o MachineSetsBySizeNewer) Less(i, j int) bool { if (o[i].Spec.Replicas) == (o[j].Spec.Replicas) { - return InstanceSetsByCreationTimestamp(o).Less(j, i) + return MachineSetsByCreationTimestamp(o).Less(j, i) } return (o[i].Spec.Replicas) > (o[j].Spec.Replicas) } -// FilterActiveInstanceSets returns instance sets that have (or at least ought to have) instances. -func FilterActiveInstanceSets(instanceSets []*v1alpha1.InstanceSet) []*v1alpha1.InstanceSet { - activeFilter := func(is *v1alpha1.InstanceSet) bool { +// FilterActiveMachineSets returns machine sets that have (or at least ought to have) machines. +func FilterActiveMachineSets(machineSets []*v1alpha1.MachineSet) []*v1alpha1.MachineSet { + activeFilter := func(is *v1alpha1.MachineSet) bool { return is != nil && (is.Spec.Replicas) > 0 } - return FilterInstanceSets(instanceSets, activeFilter) + return FilterMachineSets(machineSets, activeFilter) } -type filterIS func(is *v1alpha1.InstanceSet) bool +type filterIS func(is *v1alpha1.MachineSet) bool -// FilterInstanceSets returns instance sets that are filtered by filterFn (all returned ones should match filterFn). -func FilterInstanceSets(ISes []*v1alpha1.InstanceSet, filterFn filterIS) []*v1alpha1.InstanceSet { - var filtered []*v1alpha1.InstanceSet +// FilterMachineSets returns machine sets that are filtered by filterFn (all returned ones should match filterFn). +func FilterMachineSets(ISes []*v1alpha1.MachineSet, filterFn filterIS) []*v1alpha1.MachineSet { + var filtered []*v1alpha1.MachineSet for i := range ISes { if filterFn(ISes[i]) { filtered = append(filtered, ISes[i]) @@ -891,17 +891,17 @@ func WaitForCacheSync(controllerName string, stopCh <-chan struct{}, cacheSyncs return true } -// ComputeHash returns a hash value calculated from instance template and a collisionCount to avoid hash collision -func ComputeHash(template *v1alpha1.InstanceTemplateSpec, collisionCount *int32) uint32 { - instanceTemplateSpecHasher := fnv.New32a() - hashutil.DeepHashObject(instanceTemplateSpecHasher, *template) +// ComputeHash returns a hash value calculated from machine template and a collisionCount to avoid hash collision +func ComputeHash(template *v1alpha1.MachineTemplateSpec, collisionCount *int32) uint32 { + machineTemplateSpecHasher := fnv.New32a() + hashutil.DeepHashObject(machineTemplateSpecHasher, *template) // Add collisionCount in the hash if it exists. if collisionCount != nil { collisionCountBytes := make([]byte, 8) binary.LittleEndian.PutUint32(collisionCountBytes, uint32(*collisionCount)) - instanceTemplateSpecHasher.Write(collisionCountBytes) + machineTemplateSpecHasher.Write(collisionCountBytes) } - return instanceTemplateSpecHasher.Sum32() + return machineTemplateSpecHasher.Sum32() } diff --git a/pkg/controller/deployment_controller.go b/pkg/controller/deployment_controller.go index 4d5eef048..5eb21c863 100644 --- a/pkg/controller/deployment_controller.go +++ b/pkg/controller/deployment_controller.go @@ -41,54 +41,54 @@ import ( metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" utilruntime "k8s.io/apimachinery/pkg/util/runtime" - "github.com/gardener/node-controller-manager/pkg/apis/node/v1alpha1" - "github.com/gardener/node-controller-manager/pkg/apis/node" - "github.com/gardener/node-controller-manager/pkg/apis/node/validation" + "github.com/gardener/node-controller-manager/pkg/apis/machine/v1alpha1" + "github.com/gardener/node-controller-manager/pkg/apis/machine" + "github.com/gardener/node-controller-manager/pkg/apis/machine/validation" ) // controllerKind contains the schema.GroupVersionKind for this controller type. -var controllerKind = v1alpha1.SchemeGroupVersion.WithKind("InstanceDeployment") -var GroupVersionKind = "node.sapcloud.io/v1alpha1" +var controllerKind = v1alpha1.SchemeGroupVersion.WithKind("MachineDeployment") +var GroupVersionKind = "machine.sapcloud.io/v1alpha1" -func (dc *controller) addInstanceDeployment(obj interface{}) { - d := obj.(*v1alpha1.InstanceDeployment) - glog.V(3).Infof("Adding instance deployment %s", d.Name) - dc.enqueueInstanceDeployment(d) +func (dc *controller) addMachineDeployment(obj interface{}) { + d := obj.(*v1alpha1.MachineDeployment) + glog.V(3).Infof("Adding machine deployment %s", d.Name) + dc.enqueueMachineDeployment(d) } -func (dc *controller) updateInstanceDeployment(old, cur interface{}) { - oldD := old.(*v1alpha1.InstanceDeployment) - curD := cur.(*v1alpha1.InstanceDeployment) - glog.V(3).Infof("Updating instance deployment %s", oldD.Name) - dc.enqueueInstanceDeployment(curD) +func (dc *controller) updateMachineDeployment(old, cur interface{}) { + oldD := old.(*v1alpha1.MachineDeployment) + curD := cur.(*v1alpha1.MachineDeployment) + glog.V(3).Infof("Updating machine deployment %s", oldD.Name) + dc.enqueueMachineDeployment(curD) } -func (dc *controller) deleteInstanceDeployment(obj interface{}) { - d, ok := obj.(*v1alpha1.InstanceDeployment) +func (dc *controller) deleteMachineDeployment(obj interface{}) { + d, ok := obj.(*v1alpha1.MachineDeployment) if !ok { tombstone, ok := obj.(cache.DeletedFinalStateUnknown) if !ok { //utilruntime.HandleError(fmt.Errorf("Couldn't get object from tombstone %#v", obj)) return } - d, ok = tombstone.Obj.(*v1alpha1.InstanceDeployment) + d, ok = tombstone.Obj.(*v1alpha1.MachineDeployment) if !ok { - utilruntime.HandleError(fmt.Errorf("Tombstone contained object that is not a Instance Deployment %#v", obj)) + utilruntime.HandleError(fmt.Errorf("Tombstone contained object that is not a Machine Deployment %#v", obj)) return } } - glog.V(3).Infof("Deleting instance deployment %s", d.Name) - dc.enqueueInstanceDeployment(d) + glog.V(3).Infof("Deleting machine deployment %s", d.Name) + dc.enqueueMachineDeployment(d) } -// addInstanceSet enqueues the deployment that manages a InstanceSet when the InstanceSet is created. -func (dc *controller) addInstanceSetToDeployment(obj interface{}) { - is := obj.(*v1alpha1.InstanceSet) +// addMachineSet enqueues the deployment that manages a MachineSet when the MachineSet is created. +func (dc *controller) addMachineSetToDeployment(obj interface{}) { + is := obj.(*v1alpha1.MachineSet) if is.DeletionTimestamp != nil { // On a restart of the controller manager, it's possible for an object to // show up in a state that is already pending deletion. - dc.deleteInstanceSetToDeployment(is) + dc.deleteMachineSetToDeployment(is) return } @@ -98,53 +98,53 @@ func (dc *controller) addInstanceSetToDeployment(obj interface{}) { if d == nil { return } - glog.V(4).Infof("InstanceSet %s added.", is.Name) - dc.enqueueInstanceDeployment(d) + glog.V(4).Infof("MachineSet %s added.", is.Name) + dc.enqueueMachineDeployment(d) return } // Otherwise, it's an orphan. Get a list of all matching Deployments and sync // them to see if anyone wants to adopt it. - ds := dc.getInstanceDeploymentsForInstanceSet(is) + ds := dc.getMachineDeploymentsForMachineSet(is) if len(ds) == 0 { return } - glog.V(4).Infof("Orphan InstanceSet %s added.", is.Name) + glog.V(4).Infof("Orphan MachineSet %s added.", is.Name) for _, d := range ds { - dc.enqueueInstanceDeployment(d) + dc.enqueueMachineDeployment(d) } } -// getDeploymentsForInstanceSet returns a list of Deployments that potentially -// match a InstanceSet. -func (dc *controller) getInstanceDeploymentsForInstanceSet(is *v1alpha1.InstanceSet) []*v1alpha1.InstanceDeployment { - deployments, err := dc.GetInstanceDeploymentsForInstanceSet(is) +// getDeploymentsForMachineSet returns a list of Deployments that potentially +// match a MachineSet. +func (dc *controller) getMachineDeploymentsForMachineSet(is *v1alpha1.MachineSet) []*v1alpha1.MachineDeployment { + deployments, err := dc.GetMachineDeploymentsForMachineSet(is) if err != nil || len(deployments) == 0 { return nil } - // Because all InstanceSet's belonging to a deployment should have a unique label key, + // Because all MachineSet's belonging to a deployment should have a unique label key, // there should never be more than one deployment returned by the above method. // If that happens we should probably dynamically repair the situation by ultimately // trying to clean up one of the controllers, for now we just return the older one if len(deployments) > 1 { // ControllerRef will ensure we don't do anything crazy, but more than one // item in this list nevertheless constitutes user error. - glog.V(4).Infof("user error! more than one deployment is selecting instance set %s with labels: %#v, returning %s", + glog.V(4).Infof("user error! more than one deployment is selecting machine set %s with labels: %#v, returning %s", is.Name, is.Labels, deployments[0].Name) } return deployments } -// updateInstanceSet figures out what deployment(s) manage a InstanceSet when the InstanceSet -// is updated and wake them up. If the anything of the InstanceSets have changed, we need to -// awaken both the old and new deployments. old and cur must be *extensions.InstanceSet +// updateMachineSet figures out what deployment(s) manage a MachineSet when the MachineSet +// is updated and wake them up. If the anything of the MachineSets have changed, we need to +// awaken both the old and new deployments. old and cur must be *extensions.MachineSet // types. -func (dc *controller) updateInstanceSetToDeployment(old, cur interface{}) { - curIS := cur.(*v1alpha1.InstanceSet) - oldIS := old.(*v1alpha1.InstanceSet) +func (dc *controller) updateMachineSetToDeployment(old, cur interface{}) { + curIS := cur.(*v1alpha1.MachineSet) + oldIS := old.(*v1alpha1.MachineSet) if curIS.ResourceVersion == oldIS.ResourceVersion { - // Periodic resync will send update events for all known instance sets. - // Two different versions of the same instance set will always have different RVs. + // Periodic resync will send update events for all known machine sets. + // Two different versions of the same machine set will always have different RVs. return } @@ -154,7 +154,7 @@ func (dc *controller) updateInstanceSetToDeployment(old, cur interface{}) { if controllerRefChanged && oldControllerRef != nil { // The ControllerRef was changed. Sync the old controller, if any. if d := dc.resolveDeploymentControllerRef(oldIS.Namespace, oldControllerRef); d != nil { - dc.enqueueInstanceDeployment(d) + dc.enqueueMachineDeployment(d) } } @@ -164,8 +164,8 @@ func (dc *controller) updateInstanceSetToDeployment(old, cur interface{}) { if d == nil { return } - glog.V(4).Infof("InstanceSet %s updated.", curIS.Name) - dc.enqueueInstanceDeployment(d) + glog.V(4).Infof("MachineSet %s updated.", curIS.Name) + dc.enqueueMachineDeployment(d) return } @@ -173,26 +173,26 @@ func (dc *controller) updateInstanceSetToDeployment(old, cur interface{}) { // to see if anyone wants to adopt it now. labelChanged := !reflect.DeepEqual(curIS.Labels, oldIS.Labels) if labelChanged || controllerRefChanged { - ds := dc.getInstanceDeploymentsForInstanceSet(curIS) + ds := dc.getMachineDeploymentsForMachineSet(curIS) if len(ds) == 0 { return } - glog.V(4).Infof("Orphan InstanceSet %s updated.", curIS.Name) + glog.V(4).Infof("Orphan MachineSet %s updated.", curIS.Name) for _, d := range ds { - dc.enqueueInstanceDeployment(d) + dc.enqueueMachineDeployment(d) } } } -// deleteInstanceSet enqueues the deployment that manages a InstanceSet when -// the InstanceSet is deleted. obj could be an *extensions.InstanceSet, or +// deleteMachineSet enqueues the deployment that manages a MachineSet when +// the MachineSet is deleted. obj could be an *extensions.MachineSet, or // a DeletionFinalStateUnknown marker item. -func (dc *controller) deleteInstanceSetToDeployment(obj interface{}) { - is, ok := obj.(*v1alpha1.InstanceSet) +func (dc *controller) deleteMachineSetToDeployment(obj interface{}) { + is, ok := obj.(*v1alpha1.MachineSet) - // When a delete is dropped, the relist will notice a Instance in the store not + // When a delete is dropped, the relist will notice a Machine in the store not // in the list, leading to the insertion of a tombstone object which contains - // the deleted key/value. Note that this value might be stale. If the InstanceSet + // the deleted key/value. Note that this value might be stale. If the MachineSet // changed labels the new deployment will not be woken up till the periodic resync. if !ok { tombstone, ok := obj.(cache.DeletedFinalStateUnknown) @@ -200,9 +200,9 @@ func (dc *controller) deleteInstanceSetToDeployment(obj interface{}) { utilruntime.HandleError(fmt.Errorf("Couldn't get object from tombstone %#v", obj)) return } - is, ok = tombstone.Obj.(*v1alpha1.InstanceSet) + is, ok = tombstone.Obj.(*v1alpha1.MachineSet) if !ok { - utilruntime.HandleError(fmt.Errorf("Tombstone contained object that is not a InstanceSet %#v", obj)) + utilruntime.HandleError(fmt.Errorf("Tombstone contained object that is not a MachineSet %#v", obj)) return } } @@ -216,17 +216,17 @@ func (dc *controller) deleteInstanceSetToDeployment(obj interface{}) { if d == nil { return } - glog.V(4).Infof("InstanceSet %s deleted.", is.Name) - dc.enqueueInstanceDeployment(d) + glog.V(4).Infof("MachineSet %s deleted.", is.Name) + dc.enqueueMachineDeployment(d) } -// deleteInstance will enqueue a Recreate Deployment once all of its Instances have stopped running. -func (dc *controller) deleteInstanceToInstanceDeployment(obj interface{}) { - instance, ok := obj.(*v1alpha1.Instance) +// deleteMachine will enqueue a Recreate Deployment once all of its Machines have stopped running. +func (dc *controller) deleteMachineToMachineDeployment(obj interface{}) { + machine, ok := obj.(*v1alpha1.Machine) - // When a delete is dropped, the relist will notice a Instance in the store not + // When a delete is dropped, the relist will notice a Machine in the store not // in the list, leading to the insertion of a tombstone object which contains - // the deleted key/value. Note that this value might be stale. If the Instance + // the deleted key/value. Note that this value might be stale. If the Machine // changed labels the new deployment will not be woken up till the periodic resync. if !ok { tombstone, ok := obj.(cache.DeletedFinalStateUnknown) @@ -234,85 +234,85 @@ func (dc *controller) deleteInstanceToInstanceDeployment(obj interface{}) { utilruntime.HandleError(fmt.Errorf("Couldn't get object from tombstone %#v", obj)) return } - instance, ok = tombstone.Obj.(*v1alpha1.Instance) + machine, ok = tombstone.Obj.(*v1alpha1.Machine) if !ok { - utilruntime.HandleError(fmt.Errorf("Tombstone contained object that is not a instance %#v", obj)) + utilruntime.HandleError(fmt.Errorf("Tombstone contained object that is not a machine %#v", obj)) return } } - glog.V(4).Infof("Instance %s deleted.", instance.Name) - if d := dc.getInstanceDeploymentForInstance(instance); d != nil && d.Spec.Strategy.Type == v1alpha1.RecreateInstanceDeploymentStrategyType { - // Sync if this Deployment now has no more Instances. - isList, err := ListInstanceSets(d, IsListFromClient(dc.nodeClient)) + glog.V(4).Infof("Machine %s deleted.", machine.Name) + if d := dc.getMachineDeploymentForMachine(machine); d != nil && d.Spec.Strategy.Type == v1alpha1.RecreateMachineDeploymentStrategyType { + // Sync if this Deployment now has no more Machines. + isList, err := ListMachineSets(d, IsListFromClient(dc.nodeClient)) if err != nil { return } - instanceMap, err := dc.getInstanceMapForInstanceDeployment(d, isList) + machineMap, err := dc.getMachineMapForMachineDeployment(d, isList) if err != nil { return } - numInstances := 0 - for _, instanceList := range instanceMap { - numInstances += len(instanceList.Items) + numMachines := 0 + for _, machineList := range machineMap { + numMachines += len(machineList.Items) } - if numInstances == 0 { - dc.enqueueInstanceDeployment(d) + if numMachines == 0 { + dc.enqueueMachineDeployment(d) } } } -func (dc *controller) enqueueInstanceDeployment(deployment *v1alpha1.InstanceDeployment) { +func (dc *controller) enqueueMachineDeployment(deployment *v1alpha1.MachineDeployment) { key, err := KeyFunc(deployment) if err != nil { utilruntime.HandleError(fmt.Errorf("Couldn't get key for object %#v: %v", deployment, err)) return } - dc.instanceDeploymentQueue.Add(key) + dc.machineDeploymentQueue.Add(key) } -func (dc *controller) enqueueRateLimited(deployment *v1alpha1.InstanceDeployment) { +func (dc *controller) enqueueRateLimited(deployment *v1alpha1.MachineDeployment) { key, err := KeyFunc(deployment) if err != nil { utilruntime.HandleError(fmt.Errorf("Couldn't get key for object %#v: %v", deployment, err)) return } - dc.instanceDeploymentQueue.AddRateLimited(key) + dc.machineDeploymentQueue.AddRateLimited(key) } // enqueueAfter will enqueue a deployment after the provided amount of time. -func (dc *controller) enqueueAfter(deployment *v1alpha1.InstanceDeployment, after time.Duration) { +func (dc *controller) enqueueAfter(deployment *v1alpha1.MachineDeployment, after time.Duration) { key, err := KeyFunc(deployment) if err != nil { utilruntime.HandleError(fmt.Errorf("Couldn't get key for object %#v: %v", deployment, err)) return } - dc.instanceDeploymentQueue.AddAfter(key, after) + dc.machineDeploymentQueue.AddAfter(key, after) } -// getDeploymentForInstance returns the deployment managing the given Instance. -func (dc *controller) getInstanceDeploymentForInstance(instance *v1alpha1.Instance) *v1alpha1.InstanceDeployment { - // Find the owning instance set - var is *v1alpha1.InstanceSet +// getDeploymentForMachine returns the deployment managing the given Machine. +func (dc *controller) getMachineDeploymentForMachine(machine *v1alpha1.Machine) *v1alpha1.MachineDeployment { + // Find the owning machine set + var is *v1alpha1.MachineSet var err error - controllerRef := metav1.GetControllerOf(instance) + controllerRef := metav1.GetControllerOf(machine) if controllerRef == nil { - // No controller owns this Instance. + // No controller owns this Machine. return nil } - if controllerRef.Kind != "InstanceDeployment" { //TODO: Remove hardcoded string - // Not a Instance owned by a instance set. + if controllerRef.Kind != "MachineDeployment" { //TODO: Remove hardcoded string + // Not a Machine owned by a machine set. return nil } - is, err = dc.nodeClient.InstanceSets().Get(controllerRef.Name, metav1.GetOptions{}) + is, err = dc.nodeClient.MachineSets().Get(controllerRef.Name, metav1.GetOptions{}) if err != nil || is.UID != controllerRef.UID { - glog.V(4).Infof("Cannot get instanceset %q for instance %q: %v", controllerRef.Name, instance.Name, err) + glog.V(4).Infof("Cannot get machineset %q for machine %q: %v", controllerRef.Name, machine.Name, err) return nil } - // Now find the Deployment that owns that InstanceSet. + // Now find the Deployment that owns that MachineSet. controllerRef = metav1.GetControllerOf(is) if controllerRef == nil { return nil @@ -323,13 +323,13 @@ func (dc *controller) getInstanceDeploymentForInstance(instance *v1alpha1.Instan // resolveControllerRef returns the controller referenced by a ControllerRef, // or nil if the ControllerRef could not be resolved to a matching controller // of the correct Kind. -func (dc *controller) resolveDeploymentControllerRef(namespace string, controllerRef *metav1.OwnerReference) *v1alpha1.InstanceDeployment { +func (dc *controller) resolveDeploymentControllerRef(namespace string, controllerRef *metav1.OwnerReference) *v1alpha1.MachineDeployment { // We can't look up by UID, so look up by Name and then verify UID. // Don't even try to look up by Name if it's the wrong Kind. if controllerRef.Kind != controllerKind.Kind { return nil } - d, err := dc.nodeClient.InstanceDeployments().Get(controllerRef.Name, metav1.GetOptions{}) + d, err := dc.nodeClient.MachineDeployments().Get(controllerRef.Name, metav1.GetOptions{}) if err != nil { return nil } @@ -343,89 +343,89 @@ func (dc *controller) resolveDeploymentControllerRef(namespace string, controlle func (dc *controller) handleErr(err error, key interface{}) { if err == nil { - dc.instanceDeploymentQueue.Forget(key) + dc.machineDeploymentQueue.Forget(key) return } - if dc.instanceDeploymentQueue.NumRequeues(key) < maxRetries { + if dc.machineDeploymentQueue.NumRequeues(key) < maxRetries { glog.V(2).Infof("Error syncing deployment %v: %v", key, err) - dc.instanceDeploymentQueue.AddRateLimited(key) + dc.machineDeploymentQueue.AddRateLimited(key) return } utilruntime.HandleError(err) glog.V(2).Infof("Dropping deployment %q out of the queue: %v", key, err) - dc.instanceDeploymentQueue.Forget(key) + dc.machineDeploymentQueue.Forget(key) } -// getInstanceSetsForDeployment uses ControllerRefManager to reconcile +// getMachineSetsForDeployment uses ControllerRefManager to reconcile // ControllerRef by adopting and orphaning. -// It returns the list of InstanceSets that this Deployment should manage. -func (dc *controller) getInstanceSetsForInstanceDeployment(d *v1alpha1.InstanceDeployment) ([]*v1alpha1.InstanceSet, error) { - // List all InstanceSets to find those we own but that no longer match our - // selector. They will be orphaned by ClaimInstanceSets(). - isList, err := dc.instanceSetLister.List(labels.Everything()) +// It returns the list of MachineSets that this Deployment should manage. +func (dc *controller) getMachineSetsForMachineDeployment(d *v1alpha1.MachineDeployment) ([]*v1alpha1.MachineSet, error) { + // List all MachineSets to find those we own but that no longer match our + // selector. They will be orphaned by ClaimMachineSets(). + isList, err := dc.machineSetLister.List(labels.Everything()) if err != nil { return nil, err } deploymentSelector, err := metav1.LabelSelectorAsSelector(d.Spec.Selector) if err != nil { - return nil, fmt.Errorf("instance deployment %s has invalid label selector: %v", d.Name, err) + return nil, fmt.Errorf("machine deployment %s has invalid label selector: %v", d.Name, err) } // If any adoptions are attempted, we should first recheck for deletion with - // an uncached quorum read sometime after listing InstanceSets (see #42639). + // an uncached quorum read sometime after listing MachineSets (see #42639). canAdoptFunc := RecheckDeletionTimestamp(func() (metav1.Object, error) { - fresh, err := dc.nodeClient.InstanceDeployments().Get(d.Name, metav1.GetOptions{}) + fresh, err := dc.nodeClient.MachineDeployments().Get(d.Name, metav1.GetOptions{}) if err != nil { return nil, err } if fresh.UID != d.UID { - return nil, fmt.Errorf("original Instance Deployment %v is gone: got uid %v, wanted %v", d.Name, fresh.UID, d.UID) + return nil, fmt.Errorf("original Machine Deployment %v is gone: got uid %v, wanted %v", d.Name, fresh.UID, d.UID) } return fresh, nil }) - cm := NewInstanceSetControllerRefManager(dc.instanceSetControl, d, deploymentSelector, controllerKind, canAdoptFunc) - ISes, err := cm.ClaimInstanceSets(isList) + cm := NewMachineSetControllerRefManager(dc.machineSetControl, d, deploymentSelector, controllerKind, canAdoptFunc) + ISes, err := cm.ClaimMachineSets(isList) return ISes, err } -// getInstanceMapForDeployment returns the Instances managed by a Deployment. +// getMachineMapForDeployment returns the Machines managed by a Deployment. // -// It returns a map from InstanceSet UID to a list of Instances controlled by that RS, -// according to the Instance's ControllerRef. -func (dc *controller) getInstanceMapForInstanceDeployment(d *v1alpha1.InstanceDeployment, isList []*v1alpha1.InstanceSet) (map[types.UID]*v1alpha1.InstanceList, error) { - // Get all Instances that potentially belong to this Deployment. +// It returns a map from MachineSet UID to a list of Machines controlled by that RS, +// according to the Machine's ControllerRef. +func (dc *controller) getMachineMapForMachineDeployment(d *v1alpha1.MachineDeployment, isList []*v1alpha1.MachineSet) (map[types.UID]*v1alpha1.MachineList, error) { + // Get all Machines that potentially belong to this Deployment. selector, err := metav1.LabelSelectorAsSelector(d.Spec.Selector) if err != nil { return nil, err } - instances, err := dc.instanceLister.List(selector) + machines, err := dc.machineLister.List(selector) if err != nil { return nil, err } - // Group Instances by their controller (if it's in rsList). - instanceMap := make(map[types.UID]*v1alpha1.InstanceList, len(isList)) + // Group Machines by their controller (if it's in rsList). + machineMap := make(map[types.UID]*v1alpha1.MachineList, len(isList)) for _, is := range isList { - instanceMap[is.UID] = &v1alpha1.InstanceList{} + machineMap[is.UID] = &v1alpha1.MachineList{} } - for _, instance := range instances { - // Do not ignore inactive Instances because Recreate Deployments need to verify that no - // Instances from older versions are running before spinning up new Instances. - controllerRef := metav1.GetControllerOf(instance) + for _, machine := range machines { + // Do not ignore inactive Machines because Recreate Deployments need to verify that no + // Machines from older versions are running before spinning up new Machines. + controllerRef := metav1.GetControllerOf(machine) if controllerRef == nil { continue } // Only append if we care about this UID. - if instanceList, ok := instanceMap[controllerRef.UID]; ok { - instanceList.Items = append(instanceList.Items, *instance) + if machineList, ok := machineMap[controllerRef.UID]; ok { + machineList.Items = append(machineList.Items, *machine) } } - return instanceMap, nil + return machineMap, nil } // syncDeployment will sync the deployment with the given key. // This function is not meant to be invoked concurrently with the same key. -func (dc *controller) syncInstanceDeployment(key string) error { +func (dc *controller) syncMachineDeployment(key string) error { startTime := time.Now() glog.V(4).Infof("Started syncing deployment %q (%v)", key, startTime) defer func() { @@ -436,7 +436,7 @@ func (dc *controller) syncInstanceDeployment(key string) error { if err != nil { return err } - deployment, err := dc.nodeClient.InstanceDeployments().Get(name, metav1.GetOptions{}) + deployment, err := dc.nodeClient.MachineDeployments().Get(name, metav1.GetOptions{}) if errors.IsNotFound(err) { glog.V(2).Infof("Deployment %v has been deleted", key) return nil @@ -445,33 +445,33 @@ func (dc *controller) syncInstanceDeployment(key string) error { return err } - // Validate InstanceDeployment - internalInstanceDeployment := &node.InstanceDeployment{} - err = api.Scheme.Convert(deployment, internalInstanceDeployment, nil) + // Validate MachineDeployment + internalMachineDeployment := &machine.MachineDeployment{} + err = api.Scheme.Convert(deployment, internalMachineDeployment, nil) if err != nil { return err } - validationerr := validation.ValidateInstanceDeployment(internalInstanceDeployment) + validationerr := validation.ValidateMachineDeployment(internalMachineDeployment) if validationerr.ToAggregate() != nil && len(validationerr.ToAggregate().Errors()) > 0 { - glog.V(2).Infof("Validation of InstanceDeployment failled %s", validationerr.ToAggregate().Error()) + glog.V(2).Infof("Validation of MachineDeployment failled %s", validationerr.ToAggregate().Error()) return nil } - AWSInstanceClass, err := dc.awsInstanceClassLister.Get(deployment.Spec.Template.Spec.Class.Name) + AWSMachineClass, err := dc.awsMachineClassLister.Get(deployment.Spec.Template.Spec.Class.Name) if err != nil { - glog.V(2).Infof("AWSInstanceClass for InstanceSet %q not found %q. Skipping. %v", deployment.Name, deployment.Spec.Template.Spec.Class.Name, err) + glog.V(2).Infof("AWSMachineClass for MachineSet %q not found %q. Skipping. %v", deployment.Name, deployment.Spec.Template.Spec.Class.Name, err) return nil } - // Validate AWSInstanceClass - internalAWSInstanceClass := &node.AWSInstanceClass{} - err = api.Scheme.Convert(AWSInstanceClass, internalAWSInstanceClass, nil) + // Validate AWSMachineClass + internalAWSMachineClass := &machine.AWSMachineClass{} + err = api.Scheme.Convert(AWSMachineClass, internalAWSMachineClass, nil) if err != nil { return err } - validationerr = validation.ValidateAWSInstanceClass(internalAWSInstanceClass) + validationerr = validation.ValidateAWSMachineClass(internalAWSMachineClass) if validationerr.ToAggregate() != nil && len(validationerr.ToAggregate().Errors()) > 0 { - glog.V(2).Infof("Validation of AWSInstanceClass failled %s", validationerr.ToAggregate().Error()) + glog.V(2).Infof("Validation of AWSMachineClass failled %s", validationerr.ToAggregate().Error()) return nil } @@ -481,32 +481,32 @@ func (dc *controller) syncInstanceDeployment(key string) error { everything := metav1.LabelSelector{} if reflect.DeepEqual(d.Spec.Selector, &everything) { - dc.recorder.Eventf(d, v1.EventTypeWarning, "SelectingAll", "This deployment is selecting all instances. A non-empty selector is required.") + dc.recorder.Eventf(d, v1.EventTypeWarning, "SelectingAll", "This deployment is selecting all machines. A non-empty selector is required.") if d.Status.ObservedGeneration < d.Generation { d.Status.ObservedGeneration = d.Generation - dc.nodeClient.InstanceDeployments().Update(d) + dc.nodeClient.MachineDeployments().Update(d) } return nil } - // List InstanceSets owned by this Deployment, while reconciling ControllerRef + // List MachineSets owned by this Deployment, while reconciling ControllerRef // through adoption/orphaning. - isList, err := dc.getInstanceSetsForInstanceDeployment(d) + isList, err := dc.getMachineSetsForMachineDeployment(d) if err != nil { return err } - // List all Instances owned by this Deployment, grouped by their InstanceSet. - // Current uses of the InstanceMap are: + // List all Machines owned by this Deployment, grouped by their MachineSet. + // Current uses of the MachineMap are: // - // * check if a Instance is labeled correctly with the Instance-template-hash label. - // * check that no old Instances are running in the middle of Recreate Deployments. - instanceMap, err := dc.getInstanceMapForInstanceDeployment(d, isList) + // * check if a Machine is labeled correctly with the Machine-template-hash label. + // * check that no old Machines are running in the middle of Recreate Deployments. + machineMap, err := dc.getMachineMapForMachineDeployment(d, isList) if err != nil { return err } if d.DeletionTimestamp != nil { - return dc.syncStatusOnly(d, isList, instanceMap) + return dc.syncStatusOnly(d, isList, machineMap) } // Update deployment conditions with an Unknown condition when pausing/resuming @@ -517,30 +517,30 @@ func (dc *controller) syncInstanceDeployment(key string) error { } if d.Spec.Paused { - return dc.sync(d, isList, instanceMap) + return dc.sync(d, isList, machineMap) } - // rollback is not re-entrant in case the underlying instance sets are updated with a new - // revision so we should ensure that we won't proceed to update instance sets until we + // rollback is not re-entrant in case the underlying machine sets are updated with a new + // revision so we should ensure that we won't proceed to update machine sets until we // make sure that the deployment has cleaned up its rollback spec in subsequent enqueues. if d.Spec.RollbackTo != nil { - return dc.rollback(d, isList, instanceMap) + return dc.rollback(d, isList, machineMap) } - scalingEvent, err := dc.isScalingEvent(d, isList, instanceMap) + scalingEvent, err := dc.isScalingEvent(d, isList, machineMap) if err != nil { return err } if scalingEvent { - return dc.sync(d, isList, instanceMap) + return dc.sync(d, isList, machineMap) } switch d.Spec.Strategy.Type { - case v1alpha1.RecreateInstanceDeploymentStrategyType: - return dc.rolloutRecreate(d, isList, instanceMap) - case v1alpha1.RollingUpdateInstanceDeploymentStrategyType: - return dc.rolloutRolling(d, isList, instanceMap) + case v1alpha1.RecreateMachineDeploymentStrategyType: + return dc.rolloutRecreate(d, isList, machineMap) + case v1alpha1.RollingUpdateMachineDeploymentStrategyType: + return dc.rolloutRolling(d, isList, machineMap) } return fmt.Errorf("unexpected deployment strategy type: %s", d.Spec.Strategy.Type) -} \ No newline at end of file +} diff --git a/pkg/controller/deployment_instanceset_util.go b/pkg/controller/deployment_machineset_util.go similarity index 56% rename from pkg/controller/deployment_instanceset_util.go rename to pkg/controller/deployment_machineset_util.go index de685e3db..178756e05 100644 --- a/pkg/controller/deployment_instanceset_util.go +++ b/pkg/controller/deployment_machineset_util.go @@ -29,16 +29,16 @@ import ( metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/labels" - "github.com/gardener/node-controller-manager/pkg/apis/node/v1alpha1" - nodeclientset "github.com/gardener/node-controller-manager/pkg/client/clientset/typed/node/v1alpha1" + "github.com/gardener/node-controller-manager/pkg/apis/machine/v1alpha1" + nodeclientset "github.com/gardener/node-controller-manager/pkg/client/clientset/typed/machine/v1alpha1" ) -// updateInstanceSetStatus attempts to update the Status.Replicas of the given InstanceSet, with a single GET/PUT retry. -func updateInstanceSetStatus(nodeClient nodeclientset.NodeV1alpha1Interface, is *v1alpha1.InstanceSet, newStatus v1alpha1.InstanceSetStatus) (*v1alpha1.InstanceSet, error) { - // This is the steady state. It happens when the InstanceSet doesn't have any expectations, since +// updateMachineSetStatus attempts to update the Status.Replicas of the given MachineSet, with a single GET/PUT retry. +func updateMachineSetStatus(nodeClient nodeclientset.MachineV1alpha1Interface, is *v1alpha1.MachineSet, newStatus v1alpha1.MachineSetStatus) (*v1alpha1.MachineSet, error) { + // This is the steady state. It happens when the MachineSet doesn't have any expectations, since // we do a periodic relist every 30s. If the generations differ but the replicas are // the same, a caller might've resized to the same replica count. - c := nodeClient.InstanceSets() + c := nodeClient.MachineSets() if is.Status.Replicas == newStatus.Replicas && is.Status.FullyLabeledReplicas == newStatus.FullyLabeledReplicas && @@ -56,9 +56,9 @@ func updateInstanceSetStatus(nodeClient nodeclientset.NodeV1alpha1Interface, is newStatus.ObservedGeneration = is.Generation var getErr, updateErr error - var updatedIS *v1alpha1.InstanceSet + var updatedIS *v1alpha1.MachineSet for i, is := 0, is; ; i++ { - glog.V(4).Infof(fmt.Sprintf("Updating status for InstanceSet: %s/%s, ", is.Namespace, is.Name) + + glog.V(4).Infof(fmt.Sprintf("Updating status for MachineSet: %s/%s, ", is.Namespace, is.Name) + fmt.Sprintf("replicas %d->%d (need %d), ", is.Status.Replicas, newStatus.Replicas, is.Spec.Replicas) + fmt.Sprintf("fullyLabeledReplicas %d->%d, ", is.Status.FullyLabeledReplicas, newStatus.FullyLabeledReplicas) + fmt.Sprintf("readyReplicas %d->%d, ", is.Status.ReadyReplicas, newStatus.ReadyReplicas) + @@ -71,11 +71,11 @@ func updateInstanceSetStatus(nodeClient nodeclientset.NodeV1alpha1Interface, is if updateErr == nil { return updatedIS, nil } - // Stop retrying if we exceed statusUpdateRetries - the InstanceSet will be requeued with a rate limit. + // Stop retrying if we exceed statusUpdateRetries - the MachineSet will be requeued with a rate limit. if i >= statusUpdateRetries { break } - // Update the InstanceSet with the latest resource veision for the next poll + // Update the MachineSet with the latest resource veision for the next poll if is, getErr = c.Get(is.Name, metav1.GetOptions{}); getErr != nil { // If the GET fails we can't trust status.Replicas anymore. This error // is bound to be more interesting than the update failure. @@ -86,54 +86,54 @@ func updateInstanceSetStatus(nodeClient nodeclientset.NodeV1alpha1Interface, is return nil, updateErr } -func calculateInstanceSetStatus(is *v1alpha1.InstanceSet, filteredInstances []*v1alpha1.Instance, manageReplicasErr error) v1alpha1.InstanceSetStatus { +func calculateMachineSetStatus(is *v1alpha1.MachineSet, filteredMachines []*v1alpha1.Machine, manageReplicasErr error) v1alpha1.MachineSetStatus { newStatus := is.Status - // Count the number of instances that have labels matching the labels of the instance - // template of the instance set, the matching instances may have more - // labels than are in the template. Because the label of instanceTemplateSpec is - // a supeiset of the selector of the instance set, so the possible - // matching instances must be part of the filteredinstances. + // Count the number of machines that have labels matching the labels of the machine + // template of the machine set, the matching machines may have more + // labels than are in the template. Because the label of machineTemplateSpec is + // a supeiset of the selector of the machine set, so the possible + // matching machines must be part of the filteredmachines. fullyLabeledReplicasCount := 0 readyReplicasCount := 0 availableReplicasCount := 0 templateLabel := labels.Set(is.Spec.Template.Labels).AsSelectorPreValidated() - for _, instance := range filteredInstances { - if templateLabel.Matches(labels.Set(instance.Labels)) { + for _, machine := range filteredMachines { + if templateLabel.Matches(labels.Set(machine.Labels)) { fullyLabeledReplicasCount++ } - if isInstanceAvailable(instance) { + if isMachineAvailable(machine) { availableReplicasCount++ - if isInstanceReady(instance) { + if isMachineReady(machine) { readyReplicasCount++ } } } - failureCond := GetCondition(&is.Status, v1alpha1.InstanceSetReplicaFailure) + failureCond := GetCondition(&is.Status, v1alpha1.MachineSetReplicaFailure) if manageReplicasErr != nil && failureCond == nil { var reason string - if diff := len(filteredInstances) - int(is.Spec.Replicas); diff < 0 { + if diff := len(filteredMachines) - int(is.Spec.Replicas); diff < 0 { reason = "FailedCreate" } else if diff > 0 { reason = "FailedDelete" } - cond := NewInstanceSetCondition(v1alpha1.InstanceSetReplicaFailure, v1alpha1.ConditionTrue, reason, manageReplicasErr.Error()) + cond := NewMachineSetCondition(v1alpha1.MachineSetReplicaFailure, v1alpha1.ConditionTrue, reason, manageReplicasErr.Error()) SetCondition(&newStatus, cond) } else if manageReplicasErr == nil && failureCond != nil { - RemoveCondition(&newStatus, v1alpha1.InstanceSetReplicaFailure) + RemoveCondition(&newStatus, v1alpha1.MachineSetReplicaFailure) } - newStatus.Replicas = int32(len(filteredInstances)) + newStatus.Replicas = int32(len(filteredMachines)) newStatus.FullyLabeledReplicas = int32(fullyLabeledReplicasCount) newStatus.ReadyReplicas = int32(readyReplicasCount) newStatus.AvailableReplicas = int32(availableReplicasCount) return newStatus } -// NewInstanceSetCondition creates a new InstanceSet condition. -func NewInstanceSetCondition(condType v1alpha1.InstanceSetConditionType, status v1alpha1.ConditionStatus, reason, msg string) v1alpha1.InstanceSetCondition { - return v1alpha1.InstanceSetCondition{ +// NewMachineSetCondition creates a new MachineSet condition. +func NewMachineSetCondition(condType v1alpha1.MachineSetConditionType, status v1alpha1.ConditionStatus, reason, msg string) v1alpha1.MachineSetCondition { + return v1alpha1.MachineSetCondition{ Type: condType, Status: status, LastTransitionTime: metav1.Now(), @@ -142,8 +142,8 @@ func NewInstanceSetCondition(condType v1alpha1.InstanceSetConditionType, status } } -// GetCondition returns a InstanceSet condition with the provided type if it exists. -func GetCondition(status *v1alpha1.InstanceSetStatus, condition v1alpha1.InstanceSetConditionType) *v1alpha1.InstanceSetCondition { +// GetCondition returns a MachineSet condition with the provided type if it exists. +func GetCondition(status *v1alpha1.MachineSetStatus, condition v1alpha1.MachineSetConditionType) *v1alpha1.MachineSetCondition { for _, c := range status.Conditions { if c.Type == condition { return &c @@ -152,25 +152,25 @@ func GetCondition(status *v1alpha1.InstanceSetStatus, condition v1alpha1.Instanc return nil } -// SetCondition adds/replaces the given condition in the InstanceSet status. If the condition that we +// SetCondition adds/replaces the given condition in the MachineSet status. If the condition that we // are about to add already exists and has the same status and reason then we are not going to update. -func SetCondition(status *v1alpha1.InstanceSetStatus, condition v1alpha1.InstanceSetCondition) { +func SetCondition(status *v1alpha1.MachineSetStatus, condition v1alpha1.MachineSetCondition) { currentCond := GetCondition(status, condition.Type) if currentCond != nil && currentCond.Status == condition.Status && currentCond.Reason == condition.Reason { return } - newConditions := filterOutInstanceSetCondition(status.Conditions, condition.Type) + newConditions := filterOutMachineSetCondition(status.Conditions, condition.Type) status.Conditions = append(newConditions, condition) } -// RemoveCondition removes the condition with the provided type from the InstanceSet status. -func RemoveCondition(status *v1alpha1.InstanceSetStatus, condType v1alpha1.InstanceSetConditionType) { - status.Conditions = filterOutInstanceSetCondition(status.Conditions, condType) +// RemoveCondition removes the condition with the provided type from the MachineSet status. +func RemoveCondition(status *v1alpha1.MachineSetStatus, condType v1alpha1.MachineSetConditionType) { + status.Conditions = filterOutMachineSetCondition(status.Conditions, condType) } -// filterOutInstanceSetCondition returns a new slice of InstanceSet conditions without conditions with the provided type. -func filterOutInstanceSetCondition(conditions []v1alpha1.InstanceSetCondition, condType v1alpha1.InstanceSetConditionType) []v1alpha1.InstanceSetCondition { - var newConditions []v1alpha1.InstanceSetCondition +// filterOutMachineSetCondition returns a new slice of MachineSet conditions without conditions with the provided type. +func filterOutMachineSetCondition(conditions []v1alpha1.MachineSetCondition, condType v1alpha1.MachineSetConditionType) []v1alpha1.MachineSetCondition { + var newConditions []v1alpha1.MachineSetCondition for _, c := range conditions { if c.Type == condType { continue @@ -180,20 +180,20 @@ func filterOutInstanceSetCondition(conditions []v1alpha1.InstanceSetCondition, c return newConditions } -func isInstanceAvailable (instance *v1alpha1.Instance) bool { +func isMachineAvailable (machine *v1alpha1.Machine) bool { - if instance.Status.CurrentStatus.Phase == v1alpha1.InstanceAvailable || - instance.Status.CurrentStatus.Phase == v1alpha1.InstanceRunning { + if machine.Status.CurrentStatus.Phase == v1alpha1.MachineAvailable || + machine.Status.CurrentStatus.Phase == v1alpha1.MachineRunning { return true } return false } -func isInstanceReady (instance *v1alpha1.Instance) bool { +func isMachineReady (machine *v1alpha1.Machine) bool { // TODO add more conditions - if instance.Status.CurrentStatus.Phase == v1alpha1.InstanceRunning { + if machine.Status.CurrentStatus.Phase == v1alpha1.MachineRunning { return true } diff --git a/pkg/controller/deployment_progress.go b/pkg/controller/deployment_progress.go index 54b64cc67..d14f19db9 100644 --- a/pkg/controller/deployment_progress.go +++ b/pkg/controller/deployment_progress.go @@ -28,7 +28,7 @@ import ( "github.com/golang/glog" - "github.com/gardener/node-controller-manager/pkg/apis/node/v1alpha1" + "github.com/gardener/node-controller-manager/pkg/apis/machine/v1alpha1" ) @@ -36,41 +36,41 @@ import ( // cases this helper will run that cannot be prevented from the scaling detection, // for example a resync of the deployment after it was scaled up. In those cases, // we shouldn't try to estimate any progress. -func (dc *controller) syncRolloutStatus(allISs []*v1alpha1.InstanceSet, newIS *v1alpha1.InstanceSet, d *v1alpha1.InstanceDeployment) error { +func (dc *controller) syncRolloutStatus(allISs []*v1alpha1.MachineSet, newIS *v1alpha1.MachineSet, d *v1alpha1.MachineDeployment) error { newStatus := calculateDeploymentStatus(allISs, newIS, d) // If there is no progressDeadlineSeconds set, remove any Progressing condition. if d.Spec.ProgressDeadlineSeconds == nil { - RemoveInstanceDeploymentCondition(&newStatus, v1alpha1.InstanceDeploymentProgressing) + RemoveMachineDeploymentCondition(&newStatus, v1alpha1.MachineDeploymentProgressing) } - // If there is only one instance set that is active then that means we are not running + // If there is only one machine set that is active then that means we are not running // a new rollout and this is a resync where we don't need to estimate any progress. // In such a case, we should simply not estimate any progress for this deployment. - currentCond := GetInstanceDeploymentCondition(d.Status, v1alpha1.InstanceDeploymentProgressing) + currentCond := GetMachineDeploymentCondition(d.Status, v1alpha1.MachineDeploymentProgressing) isCompleteDeployment := newStatus.Replicas == newStatus.UpdatedReplicas && currentCond != nil && currentCond.Reason == NewISAvailableReason // Check for progress only if there is a progress deadline set and the latest rollout // hasn't completed yet. if d.Spec.ProgressDeadlineSeconds != nil && !isCompleteDeployment { switch { - case InstanceDeploymentComplete(d, &newStatus): - // Update the deployment conditions with a message for the new instance set that + case MachineDeploymentComplete(d, &newStatus): + // Update the deployment conditions with a message for the new machine set that // was successfully deployed. If the condition already exists, we ignore this update. - msg := fmt.Sprintf("Instance Deployment %q has successfully progressed.", d.Name) + msg := fmt.Sprintf("Machine Deployment %q has successfully progressed.", d.Name) if newIS != nil { - msg = fmt.Sprintf("InstanceSet %q has successfully progressed.", newIS.Name) + msg = fmt.Sprintf("MachineSet %q has successfully progressed.", newIS.Name) } - condition := NewInstanceDeploymentCondition(v1alpha1.InstanceDeploymentProgressing, v1alpha1.ConditionTrue, NewISAvailableReason, msg) - SetInstanceDeploymentCondition(&newStatus, *condition) + condition := NewMachineDeploymentCondition(v1alpha1.MachineDeploymentProgressing, v1alpha1.ConditionTrue, NewISAvailableReason, msg) + SetMachineDeploymentCondition(&newStatus, *condition) - case InstanceDeploymentProgressing(d, &newStatus): + case MachineDeploymentProgressing(d, &newStatus): // If there is any progress made, continue by not checking if the deployment failed. This // behavior emulates the rolling updater progressDeadline check. - msg := fmt.Sprintf("Instance Deployment %q is progressing.", d.Name) + msg := fmt.Sprintf("Machine Deployment %q is progressing.", d.Name) if newIS != nil { - msg = fmt.Sprintf("InstanceSet %q is progressing.", newIS.Name) + msg = fmt.Sprintf("MachineSet %q is progressing.", newIS.Name) } - condition := NewInstanceDeploymentCondition(v1alpha1.InstanceDeploymentProgressing, v1alpha1.ConditionTrue, InstanceSetUpdatedReason, msg) + condition := NewMachineDeploymentCondition(v1alpha1.MachineDeploymentProgressing, v1alpha1.ConditionTrue, MachineSetUpdatedReason, msg) // Update the current Progressing condition or add a new one if it doesn't exist. // If a Progressing condition with status=true already exists, we should update // everything but lastTransitionTime. SetDeploymentCondition already does that but @@ -82,58 +82,58 @@ func (dc *controller) syncRolloutStatus(allISs []*v1alpha1.InstanceSet, newIS *v if currentCond.Status == v1alpha1.ConditionTrue { condition.LastTransitionTime = currentCond.LastTransitionTime } - RemoveInstanceDeploymentCondition(&newStatus, v1alpha1.InstanceDeploymentProgressing) + RemoveMachineDeploymentCondition(&newStatus, v1alpha1.MachineDeploymentProgressing) } - SetInstanceDeploymentCondition(&newStatus, *condition) + SetMachineDeploymentCondition(&newStatus, *condition) - case InstanceDeploymentTimedOut(d, &newStatus): + case MachineDeploymentTimedOut(d, &newStatus): // Update the deployment with a timeout condition. If the condition already exists, // we ignore this update. - msg := fmt.Sprintf("Instance Deployment %q has timed out progressing.", d.Name) + msg := fmt.Sprintf("Machine Deployment %q has timed out progressing.", d.Name) if newIS != nil { - msg = fmt.Sprintf("InstanceSet %q has timed out progressing.", newIS.Name) + msg = fmt.Sprintf("MachineSet %q has timed out progressing.", newIS.Name) } - condition := NewInstanceDeploymentCondition(v1alpha1.InstanceDeploymentProgressing, v1alpha1.ConditionFalse, TimedOutReason, msg) - SetInstanceDeploymentCondition(&newStatus, *condition) + condition := NewMachineDeploymentCondition(v1alpha1.MachineDeploymentProgressing, v1alpha1.ConditionFalse, TimedOutReason, msg) + SetMachineDeploymentCondition(&newStatus, *condition) } } - // Move failure conditions of all instance sets in deployment conditions. For now, + // Move failure conditions of all machine sets in deployment conditions. For now, // only one failure condition is returned from getReplicaFailures. if replicaFailureCond := dc.getReplicaFailures(allISs, newIS); len(replicaFailureCond) > 0 { - // There will be only one ReplicaFailure condition on the instance set. - SetInstanceDeploymentCondition(&newStatus, replicaFailureCond[0]) + // There will be only one ReplicaFailure condition on the machine set. + SetMachineDeploymentCondition(&newStatus, replicaFailureCond[0]) } else { - RemoveInstanceDeploymentCondition(&newStatus, v1alpha1.InstanceDeploymentReplicaFailure) + RemoveMachineDeploymentCondition(&newStatus, v1alpha1.MachineDeploymentReplicaFailure) } // Do not update if there is nothing new to add. if reflect.DeepEqual(d.Status, newStatus) { // Requeue the deployment if required. - dc.requeueStuckInstanceDeployment(d, newStatus) + dc.requeueStuckMachineDeployment(d, newStatus) return nil } newDeployment := d newDeployment.Status = newStatus - _, err := dc.nodeClient.InstanceDeployments().Update(newDeployment) + _, err := dc.nodeClient.MachineDeployments().Update(newDeployment) return err } -// getReplicaFailures will convert replica failure conditions from instance sets +// getReplicaFailures will convert replica failure conditions from machine sets // to deployment conditions. -func (dc *controller) getReplicaFailures(allISs []*v1alpha1.InstanceSet, newIS *v1alpha1.InstanceSet) []v1alpha1.InstanceDeploymentCondition { - var conditions []v1alpha1.InstanceDeploymentCondition +func (dc *controller) getReplicaFailures(allISs []*v1alpha1.MachineSet, newIS *v1alpha1.MachineSet) []v1alpha1.MachineDeploymentCondition { + var conditions []v1alpha1.MachineDeploymentCondition if newIS != nil { for _, c := range newIS.Status.Conditions { - if c.Type != v1alpha1.InstanceSetReplicaFailure { + if c.Type != v1alpha1.MachineSetReplicaFailure { continue } - conditions = append(conditions, InstanceSetToInstanceDeploymentCondition(c)) + conditions = append(conditions, MachineSetToMachineDeploymentCondition(c)) } } - // Return failures for the new instance set over failures from old instance sets. + // Return failures for the new machine set over failures from old machine sets. if len(conditions) > 0 { return conditions } @@ -145,10 +145,10 @@ func (dc *controller) getReplicaFailures(allISs []*v1alpha1.InstanceSet, newIS * } for _, c := range is.Status.Conditions { - if c.Type != v1alpha1.InstanceSetReplicaFailure { + if c.Type != v1alpha1.MachineSetReplicaFailure { continue } - conditions = append(conditions, InstanceSetToInstanceDeploymentCondition(c)) + conditions = append(conditions, MachineSetToMachineDeploymentCondition(c)) } } return conditions @@ -160,14 +160,14 @@ func (dc *controller) getReplicaFailures(allISs []*v1alpha1.InstanceSet, newIS * // requeueStuckDeployment checks whether the provided deployment needs to be synced for a progress // check. It returns the time after the deployment will be requeued for the progress check, 0 if it // will be requeued now, or -1 if it does not need to be requeued. -func (dc *controller) requeueStuckInstanceDeployment(d *v1alpha1.InstanceDeployment, newStatus v1alpha1.InstanceDeploymentStatus) time.Duration { - currentCond := GetInstanceDeploymentCondition(d.Status, v1alpha1.InstanceDeploymentProgressing) +func (dc *controller) requeueStuckMachineDeployment(d *v1alpha1.MachineDeployment, newStatus v1alpha1.MachineDeploymentStatus) time.Duration { + currentCond := GetMachineDeploymentCondition(d.Status, v1alpha1.MachineDeploymentProgressing) // Can't estimate progress if there is no deadline in the spec or progressing condition in the current status. if d.Spec.ProgressDeadlineSeconds == nil || currentCond == nil { return time.Duration(-1) } // No need to estimate progress if the rollout is complete or already timed out. - if InstanceDeploymentComplete(d, &newStatus) || currentCond.Reason == TimedOutReason { + if MachineDeploymentComplete(d, &newStatus) || currentCond.Reason == TimedOutReason { return time.Duration(-1) } // If there is no sign of progress at this point then there is a high chance that the @@ -190,11 +190,11 @@ func (dc *controller) requeueStuckInstanceDeployment(d *v1alpha1.InstanceDeploym // Make it ratelimited so we stay on the safe side, eventually the Deployment should // transition either to a Complete or to a TimedOut condition. if after < time.Second { - glog.V(4).Infof("Queueing up instance deployment %q for a progress check now", d.Name) + glog.V(4).Infof("Queueing up machine deployment %q for a progress check now", d.Name) dc.enqueueRateLimited(d) return time.Duration(0) } - glog.V(4).Infof("Queueing up instance deployment %q for a progress check after %ds", d.Name, int(after.Seconds())) + glog.V(4).Infof("Queueing up machine deployment %q for a progress check after %ds", d.Name, int(after.Seconds())) // Add a second to avoid milliseconds skew in AddAfter. // See https://github.com/kubernetes/kubernetes/issues/39785#issuecomment-279959133 for more info. dc.enqueueAfter(d, after+time.Second) diff --git a/pkg/controller/deployment_recreate.go b/pkg/controller/deployment_recreate.go index f749e8fd1..5bdeedf12 100644 --- a/pkg/controller/deployment_recreate.go +++ b/pkg/controller/deployment_recreate.go @@ -22,22 +22,22 @@ Modifications Copyright 2017 The Gardener Authors. package controller import ( - "github.com/gardener/node-controller-manager/pkg/apis/node/v1alpha1" + "github.com/gardener/node-controller-manager/pkg/apis/machine/v1alpha1" "k8s.io/apimachinery/pkg/types" ) -// rolloutRecreate implements the logic for recreating a instance set. -func (dc *controller) rolloutRecreate(d *v1alpha1.InstanceDeployment, isList []*v1alpha1.InstanceSet, instanceMap map[types.UID]*v1alpha1.InstanceList) error { +// rolloutRecreate implements the logic for recreating a machine set. +func (dc *controller) rolloutRecreate(d *v1alpha1.MachineDeployment, isList []*v1alpha1.MachineSet, machineMap map[types.UID]*v1alpha1.MachineList) error { // Don't create a new RS if not already existed, so that we avoid scaling up before scaling down. - newIS, oldISs, err := dc.getAllInstanceSetsAndSyncRevision(d, isList, instanceMap, false) + newIS, oldISs, err := dc.getAllMachineSetsAndSyncRevision(d, isList, machineMap, false) if err != nil { return err } allISs := append(oldISs, newIS) - activeOldISs := FilterActiveInstanceSets(oldISs) + activeOldISs := FilterActiveMachineSets(oldISs) - // scale down old instance sets. - scaledDown, err := dc.scaleDownOldInstanceSetsForRecreate(activeOldISs, d) + // scale down old machine sets. + scaledDown, err := dc.scaleDownOldMachineSetsForRecreate(activeOldISs, d) if err != nil { return err } @@ -46,27 +46,27 @@ func (dc *controller) rolloutRecreate(d *v1alpha1.InstanceDeployment, isList []* return dc.syncRolloutStatus(allISs, newIS, d) } - // Do not process a deployment when it has old instances running. - if oldInstancesRunning(newIS, oldISs, instanceMap) { + // Do not process a deployment when it has old machines running. + if oldMachinesRunning(newIS, oldISs, machineMap) { return dc.syncRolloutStatus(allISs, newIS, d) } // If we need to create a new RS, create it now. if newIS == nil { - newIS, oldISs, err = dc.getAllInstanceSetsAndSyncRevision(d, isList, instanceMap, true) + newIS, oldISs, err = dc.getAllMachineSetsAndSyncRevision(d, isList, machineMap, true) if err != nil { return err } allISs = append(oldISs, newIS) } - // scale up new instance set. - if _, err := dc.scaleUpNewInstanceSetForRecreate(newIS, d); err != nil { + // scale up new machine set. + if _, err := dc.scaleUpNewMachineSetForRecreate(newIS, d); err != nil { return err } - if InstanceDeploymentComplete(d, &d.Status) { - if err := dc.cleanupInstanceDeployment(oldISs, d); err != nil { + if MachineDeploymentComplete(d, &d.Status) { + if err := dc.cleanupMachineDeployment(oldISs, d); err != nil { return err } } @@ -75,8 +75,8 @@ func (dc *controller) rolloutRecreate(d *v1alpha1.InstanceDeployment, isList []* return dc.syncRolloutStatus(allISs, newIS, d) } -// scaleDownOldInstanceSetsForRecreate scales down old instance sets when deployment strategy is "Recreate". -func (dc *controller) scaleDownOldInstanceSetsForRecreate(oldISs []*v1alpha1.InstanceSet, deployment *v1alpha1.InstanceDeployment) (bool, error) { +// scaleDownOldMachineSetsForRecreate scales down old machine sets when deployment strategy is "Recreate". +func (dc *controller) scaleDownOldMachineSetsForRecreate(oldISs []*v1alpha1.MachineSet, deployment *v1alpha1.MachineDeployment) (bool, error) { scaled := false for i := range oldISs { is := oldISs[i] @@ -84,7 +84,7 @@ func (dc *controller) scaleDownOldInstanceSetsForRecreate(oldISs []*v1alpha1.Ins if (is.Spec.Replicas) == 0 { continue } - scaledIS, updatedIS, err := dc.scaleInstanceSetAndRecordEvent(is, 0, deployment) + scaledIS, updatedIS, err := dc.scaleMachineSetAndRecordEvent(is, 0, deployment) if err != nil { return false, err } @@ -96,25 +96,25 @@ func (dc *controller) scaleDownOldInstanceSetsForRecreate(oldISs []*v1alpha1.Ins return scaled, nil } -// oldinstancesRunning returns whether there are old instances running or any of the old InstanceSets thinks that it runs instances. -func oldInstancesRunning(newIS *v1alpha1.InstanceSet, oldISs []*v1alpha1.InstanceSet, instanceMap map[types.UID]*v1alpha1.InstanceList) bool { - if oldInstances := GetActualReplicaCountForInstanceSets(oldISs); oldInstances > 0 { +// oldmachinesRunning returns whether there are old machines running or any of the old MachineSets thinks that it runs machines. +func oldMachinesRunning(newIS *v1alpha1.MachineSet, oldISs []*v1alpha1.MachineSet, machineMap map[types.UID]*v1alpha1.MachineList) bool { + if oldMachines := GetActualReplicaCountForMachineSets(oldISs); oldMachines > 0 { return true } - for isUID, instanceList := range instanceMap { - // If the instances belong to the new InstanceSet, ignore. + for isUID, machineList := range machineMap { + // If the machines belong to the new MachineSet, ignore. if newIS != nil && newIS.UID == isUID { continue } - if len(instanceList.Items) > 0 { + if len(machineList.Items) > 0 { return true } } return false } -// scaleUpNewInstanceSetForRecreate scales up new instance set when deployment strategy is "Recreate". -func (dc *controller) scaleUpNewInstanceSetForRecreate(newIS *v1alpha1.InstanceSet, deployment *v1alpha1.InstanceDeployment) (bool, error) { - scaled, _, err := dc.scaleInstanceSetAndRecordEvent(newIS, (deployment.Spec.Replicas), deployment) +// scaleUpNewMachineSetForRecreate scales up new machine set when deployment strategy is "Recreate". +func (dc *controller) scaleUpNewMachineSetForRecreate(newIS *v1alpha1.MachineSet, deployment *v1alpha1.MachineDeployment) (bool, error) { + scaled, _, err := dc.scaleMachineSetAndRecordEvent(newIS, (deployment.Spec.Replicas), deployment) return scaled, err } diff --git a/pkg/controller/deployment_rollback.go b/pkg/controller/deployment_rollback.go index 0773ca631..e00c27e3a 100644 --- a/pkg/controller/deployment_rollback.go +++ b/pkg/controller/deployment_rollback.go @@ -27,13 +27,13 @@ import ( "github.com/golang/glog" "k8s.io/api/core/v1" - "github.com/gardener/node-controller-manager/pkg/apis/node/v1alpha1" + "github.com/gardener/node-controller-manager/pkg/apis/machine/v1alpha1" "k8s.io/apimachinery/pkg/types" ) // rollback the deployment to the specified revision. In any case cleanup the rollback spec. -func (dc *controller) rollback(d *v1alpha1.InstanceDeployment, isList []*v1alpha1.InstanceSet, instanceMap map[types.UID]*v1alpha1.InstanceList) error { - newIS, allOldISs, err := dc.getAllInstanceSetsAndSyncRevision(d, isList, instanceMap, true) +func (dc *controller) rollback(d *v1alpha1.MachineDeployment, isList []*v1alpha1.MachineSet, machineMap map[types.UID]*v1alpha1.MachineList) error { + newIS, allOldISs, err := dc.getAllMachineSetsAndSyncRevision(d, isList, machineMap, true) if err != nil { return err } @@ -46,19 +46,19 @@ func (dc *controller) rollback(d *v1alpha1.InstanceDeployment, isList []*v1alpha // If we still can't find the last revision, gives up rollback dc.emitRollbackWarningEvent(d, RollbackRevisionNotFound, "Unable to find last revision.") // Gives up rollback - return dc.updateInstanceDeploymentAndClearRollbackTo(d) + return dc.updateMachineDeploymentAndClearRollbackTo(d) } } for _, is := range allISs { v, err := Revision(is) if err != nil { - glog.V(4).Infof("Unable to extract revision from deployment's instance set %q: %v", is.Name, err) + glog.V(4).Infof("Unable to extract revision from deployment's machine set %q: %v", is.Name, err) continue } if v == *toRevision { - glog.V(4).Infof("Found instance set %q with desired revision %d", is.Name, v) - // rollback by copying podTemplate.Spec from the instance set - // revision number will be incremented during the next getAllInstanceSetsAndSyncRevision call + glog.V(4).Infof("Found machine set %q with desired revision %d", is.Name, v) + // rollback by copying podTemplate.Spec from the machine set + // revision number will be incremented during the next getAllMachineSetsAndSyncRevision call // no-op if the spec matches current deployment's podTemplate.Spec performedRollback, err := dc.rollbackToTemplate(d, is) if performedRollback && err == nil { @@ -69,17 +69,17 @@ func (dc *controller) rollback(d *v1alpha1.InstanceDeployment, isList []*v1alpha } dc.emitRollbackWarningEvent(d, RollbackRevisionNotFound, "Unable to find the revision to rollback to.") // Gives up rollback - return dc.updateInstanceDeploymentAndClearRollbackTo(d) + return dc.updateMachineDeploymentAndClearRollbackTo(d) } -// rollbackToTemplate compares the templates of the provided deployment and instance set and -// updates the deployment with the instance set template in case they are different. It also +// rollbackToTemplate compares the templates of the provided deployment and machine set and +// updates the deployment with the machine set template in case they are different. It also // cleans up the rollback spec so subsequent requeues of the deployment won't end up in here. -func (dc *controller) rollbackToTemplate(d *v1alpha1.InstanceDeployment, is *v1alpha1.InstanceSet) (bool, error) { +func (dc *controller) rollbackToTemplate(d *v1alpha1.MachineDeployment, is *v1alpha1.MachineSet) (bool, error) { performedRollback := false if !EqualIgnoreHash(&d.Spec.Template, &is.Spec.Template) { glog.V(4).Infof("Rolling back deployment %q to template spec %+v", d.Name, is.Spec.Template.Spec) - SetFromInstanceSetTemplate(d, is.Spec.Template) + SetFromMachineSetTemplate(d, is.Spec.Template) // set RS (the old RS we'll rolling back to) annotations back to the deployment; // otherwise, the deployment's current annotations (should be the same as current new RS) will be copied to the RS after the rollback. // @@ -91,7 +91,7 @@ func (dc *controller) rollbackToTemplate(d *v1alpha1.InstanceDeployment, is *v1a // // If we don't copy the annotations back from RS to deployment on rollback, the Deployment will stay as {change-cause:edit}, // and new RS1 becomes {change-cause:edit} (copied from deployment after rollback), old RS2 {change-cause:edit}, which is not correct. - SetInstanceDeploymentAnnotationsTo(d, is) + SetMachineDeploymentAnnotationsTo(d, is) performedRollback = true } else { glog.V(4).Infof("Rolling back to a revision that contains the same template as current deployment %q, skipping rollback...", d.Name) @@ -99,23 +99,23 @@ func (dc *controller) rollbackToTemplate(d *v1alpha1.InstanceDeployment, is *v1a dc.emitRollbackWarningEvent(d, RollbackTemplateUnchanged, eventMsg) } - return performedRollback, dc.updateInstanceDeploymentAndClearRollbackTo(d) + return performedRollback, dc.updateMachineDeploymentAndClearRollbackTo(d) } -func (dc *controller) emitRollbackWarningEvent(d *v1alpha1.InstanceDeployment, reason, message string) { +func (dc *controller) emitRollbackWarningEvent(d *v1alpha1.MachineDeployment, reason, message string) { dc.recorder.Eventf(d, v1.EventTypeWarning, reason, message) } -func (dc *controller) emitRollbackNormalEvent(d *v1alpha1.InstanceDeployment, message string) { +func (dc *controller) emitRollbackNormalEvent(d *v1alpha1.MachineDeployment, message string) { dc.recorder.Eventf(d, v1.EventTypeNormal, RollbackDone, message) } // updateDeploymentAndClearRollbackTo sets .spec.rollbackTo to nil and update the input deployment // It is assumed that the caller will have updated the deployment template appropriately (in case // we want to rollback). -func (dc *controller) updateInstanceDeploymentAndClearRollbackTo(d *v1alpha1.InstanceDeployment) error { - glog.V(4).Infof("Cleans up rollbackTo of instance deployment %q", d.Name) +func (dc *controller) updateMachineDeploymentAndClearRollbackTo(d *v1alpha1.MachineDeployment) error { + glog.V(4).Infof("Cleans up rollbackTo of machine deployment %q", d.Name) d.Spec.RollbackTo = nil - _, err := dc.nodeClient.InstanceDeployments().Update(d) + _, err := dc.nodeClient.MachineDeployments().Update(d) return err } diff --git a/pkg/controller/deployment_rolling.go b/pkg/controller/deployment_rolling.go index cce521bcd..8fad55ad2 100644 --- a/pkg/controller/deployment_rolling.go +++ b/pkg/controller/deployment_rolling.go @@ -26,21 +26,21 @@ import ( "sort" "github.com/golang/glog" - "github.com/gardener/node-controller-manager/pkg/apis/node/v1alpha1" + "github.com/gardener/node-controller-manager/pkg/apis/machine/v1alpha1" "k8s.io/apimachinery/pkg/types" "k8s.io/client-go/util/integer" ) -// rolloutRolling implements the logic for rolling a new instance set. -func (dc *controller) rolloutRolling(d *v1alpha1.InstanceDeployment, isList []*v1alpha1.InstanceSet, instanceMap map[types.UID]*v1alpha1.InstanceList) error { - newIS, oldISs, err := dc.getAllInstanceSetsAndSyncRevision(d, isList, instanceMap, true) +// rolloutRolling implements the logic for rolling a new machine set. +func (dc *controller) rolloutRolling(d *v1alpha1.MachineDeployment, isList []*v1alpha1.MachineSet, machineMap map[types.UID]*v1alpha1.MachineList) error { + newIS, oldISs, err := dc.getAllMachineSetsAndSyncRevision(d, isList, machineMap, true) if err != nil { return err } allISs := append(oldISs, newIS) // Scale up, if we can. - scaledUp, err := dc.reconcileNewInstanceSet(allISs, newIS, d) + scaledUp, err := dc.reconcileNewMachineSet(allISs, newIS, d) if err != nil { return err } @@ -50,7 +50,7 @@ func (dc *controller) rolloutRolling(d *v1alpha1.InstanceDeployment, isList []*v } // Scale down, if we can. - scaledDown, err := dc.reconcileOldInstanceSets(allISs, FilterActiveInstanceSets(oldISs), newIS, d) + scaledDown, err := dc.reconcileOldMachineSets(allISs, FilterActiveMachineSets(oldISs), newIS, d) if err != nil { return err } @@ -59,8 +59,8 @@ func (dc *controller) rolloutRolling(d *v1alpha1.InstanceDeployment, isList []*v return dc.syncRolloutStatus(allISs, newIS, d) } - if InstanceDeploymentComplete(d, &d.Status) { - if err := dc.cleanupInstanceDeployment(oldISs, d); err != nil { + if MachineDeploymentComplete(d, &d.Status) { + if err := dc.cleanupMachineDeployment(oldISs, d); err != nil { return err } } @@ -69,43 +69,43 @@ func (dc *controller) rolloutRolling(d *v1alpha1.InstanceDeployment, isList []*v return dc.syncRolloutStatus(allISs, newIS, d) } -func (dc *controller) reconcileNewInstanceSet(allISs []*v1alpha1.InstanceSet, newIS *v1alpha1.InstanceSet, deployment *v1alpha1.InstanceDeployment) (bool, error) { +func (dc *controller) reconcileNewMachineSet(allISs []*v1alpha1.MachineSet, newIS *v1alpha1.MachineSet, deployment *v1alpha1.MachineDeployment) (bool, error) { if (newIS.Spec.Replicas) == (deployment.Spec.Replicas) { // Scaling not required. return false, nil } if (newIS.Spec.Replicas) > (deployment.Spec.Replicas) { // Scale down. - scaled, _, err := dc.scaleInstanceSetAndRecordEvent(newIS, (deployment.Spec.Replicas), deployment) + scaled, _, err := dc.scaleMachineSetAndRecordEvent(newIS, (deployment.Spec.Replicas), deployment) return scaled, err } newReplicasCount, err := NewISNewReplicas(deployment, allISs, newIS) if err != nil { return false, err } - scaled, _, err := dc.scaleInstanceSetAndRecordEvent(newIS, newReplicasCount, deployment) + scaled, _, err := dc.scaleMachineSetAndRecordEvent(newIS, newReplicasCount, deployment) return scaled, err } -func (dc *controller) reconcileOldInstanceSets(allISs []*v1alpha1.InstanceSet, oldISs []*v1alpha1.InstanceSet, newIS *v1alpha1.InstanceSet, deployment *v1alpha1.InstanceDeployment) (bool, error) { - oldInstancesCount := GetReplicaCountForInstanceSets(oldISs) - if oldInstancesCount == 0 { +func (dc *controller) reconcileOldMachineSets(allISs []*v1alpha1.MachineSet, oldISs []*v1alpha1.MachineSet, newIS *v1alpha1.MachineSet, deployment *v1alpha1.MachineDeployment) (bool, error) { + oldMachinesCount := GetReplicaCountForMachineSets(oldISs) + if oldMachinesCount == 0 { // Can't scale down further return false, nil } - allInstancesCount := GetReplicaCountForInstanceSets(allISs) - glog.V(4).Infof("New instance set %s has %d available instances.", newIS.Name, newIS.Status.AvailableReplicas) + allMachinesCount := GetReplicaCountForMachineSets(allISs) + glog.V(4).Infof("New machine set %s has %d available machines.", newIS.Name, newIS.Status.AvailableReplicas) maxUnavailable := MaxUnavailable(*deployment) // Check if we can scale down. We can scale down in the following 2 cases: - // * Some old instance sets have unhealthy replicas, we could safely scale down those unhealthy replicas since that won't further + // * Some old machine sets have unhealthy replicas, we could safely scale down those unhealthy replicas since that won't further // increase unavailability. - // * New instance set has scaled up and it's replicas becomes ready, then we can scale down old instance sets in a further step. + // * New machine set has scaled up and it's replicas becomes ready, then we can scale down old machine sets in a further step. // - // maxScaledDown := allinstancesCount - minAvailable - newReplicaSetinstancesUnavailable - // take into account not only maxUnavailable and any surge instances that have been created, but also unavailable instances from - // the newRS, so that the unavailable instances from the newRS would not make us scale down old instance sets in a further + // maxScaledDown := allmachinesCount - minAvailable - newReplicaSetmachinesUnavailable + // take into account not only maxUnavailable and any surge machines that have been created, but also unavailable machines from + // the newRS, so that the unavailable machines from the newRS would not make us scale down old machine sets in a further // step(that will increase unavailability). // // Concrete example: @@ -116,21 +116,21 @@ func (dc *controller) reconcileOldInstanceSets(allISs []*v1alpha1.InstanceSet, o // // case 1: // * Deployment is updated, newRS is created with 3 replicas, oldRS is scaled down to 8, and newRS is scaled up to 5. - // * The new instance set instances crashloop and never become available. - // * allinstancesCount is 13. minAvailable is 8. newRSinstancesUnavailable is 5. - // * A node fails and causes one of the oldRS instances to become unavailable. However, 13 - 8 - 5 = 0, so the oldRS won't be scaled down. + // * The new machine set machines crashloop and never become available. + // * allmachinesCount is 13. minAvailable is 8. newRSmachinesUnavailable is 5. + // * A node fails and causes one of the oldRS machines to become unavailable. However, 13 - 8 - 5 = 0, so the oldRS won't be scaled down. // * The user notices the crashloop and does kubectl rollout undo to rollback. - // * newRSinstancesUnavailable is 1, since we rolled back to the good instance set, so maxScaledDown = 13 - 8 - 1 = 4. 4 of the crashlooping instances will be scaled down. - // * The total number of instances will then be 9 and the newRS can be scaled up to 10. + // * newRSmachinesUnavailable is 1, since we rolled back to the good machine set, so maxScaledDown = 13 - 8 - 1 = 4. 4 of the crashlooping machines will be scaled down. + // * The total number of machines will then be 9 and the newRS can be scaled up to 10. // // case 2: - // Same example, but pushing a new instance template instead of rolling back (aka "roll over"): - // * The new instance set created must start with 0 replicas because allinstancesCount is already at 13. - // * However, newRSinstancesUnavailable would also be 0, so the 2 old instance sets could be scaled down by 5 (13 - 8 - 0), which would then - // allow the new instance set to be scaled up by 5. + // Same example, but pushing a new machine template instead of rolling back (aka "roll over"): + // * The new machine set created must start with 0 replicas because allmachinesCount is already at 13. + // * However, newRSmachinesUnavailable would also be 0, so the 2 old machine sets could be scaled down by 5 (13 - 8 - 0), which would then + // allow the new machine set to be scaled up by 5. minAvailable := (deployment.Spec.Replicas) - maxUnavailable - newISUnavailableInstanceCount := (newIS.Spec.Replicas) - newIS.Status.AvailableReplicas - maxScaledDown := allInstancesCount - minAvailable - newISUnavailableInstanceCount + newISUnavailableMachineCount := (newIS.Spec.Replicas) - newIS.Status.AvailableReplicas + maxScaledDown := allMachinesCount - minAvailable - newISUnavailableMachineCount if maxScaledDown <= 0 { return false, nil } @@ -143,9 +143,9 @@ func (dc *controller) reconcileOldInstanceSets(allISs []*v1alpha1.InstanceSet, o } glog.V(4).Infof("Cleaned up unhealthy replicas from old ISes by %d", cleanupCount) - // Scale down old instance sets, need check maxUnavailable to ensure we can scale down + // Scale down old machine sets, need check maxUnavailable to ensure we can scale down allISs = append(oldISs, newIS) - scaledDownCount, err := dc.scaleDownOldInstanceSetsForRollingUpdate(allISs, oldISs, deployment) + scaledDownCount, err := dc.scaleDownOldMachineSetsForRollingUpdate(allISs, oldISs, deployment) if err != nil { return false, nil } @@ -155,10 +155,10 @@ func (dc *controller) reconcileOldInstanceSets(allISs []*v1alpha1.InstanceSet, o return totalScaledDown > 0, nil } -// cleanupUnhealthyReplicas will scale down old instance sets with unhealthy replicas, so that all unhealthy replicas will be deleted. -func (dc *controller) cleanupUnhealthyReplicas(oldISs []*v1alpha1.InstanceSet, deployment *v1alpha1.InstanceDeployment, maxCleanupCount int32) ([]*v1alpha1.InstanceSet, int32, error) { - sort.Sort(InstanceSetsByCreationTimestamp(oldISs)) - // Safely scale down all old instance sets with unhealthy replicas. instance set will sort the instances in the order +// cleanupUnhealthyReplicas will scale down old machine sets with unhealthy replicas, so that all unhealthy replicas will be deleted. +func (dc *controller) cleanupUnhealthyReplicas(oldISs []*v1alpha1.MachineSet, deployment *v1alpha1.MachineDeployment, maxCleanupCount int32) ([]*v1alpha1.MachineSet, int32, error) { + sort.Sort(MachineSetsByCreationTimestamp(oldISs)) + // Safely scale down all old machine sets with unhealthy replicas. machine set will sort the machines in the order // such that not-ready < ready, unscheduled < scheduled, and pending < running. This ensures that unhealthy replicas will // been deleted first and won't increase unavailability. totalScaledDown := int32(0) @@ -167,10 +167,10 @@ func (dc *controller) cleanupUnhealthyReplicas(oldISs []*v1alpha1.InstanceSet, d break } if (targetIS.Spec.Replicas) == 0 { - // cannot scale down this instance set. + // cannot scale down this machine set. continue } - glog.V(4).Infof("Found %d available instance in old IS %s", targetIS.Status.AvailableReplicas, targetIS.Name) + glog.V(4).Infof("Found %d available machine in old IS %s", targetIS.Status.AvailableReplicas, targetIS.Name) if (targetIS.Spec.Replicas) == targetIS.Status.AvailableReplicas { // no unhealthy replicas found, no scaling required. continue @@ -181,7 +181,7 @@ func (dc *controller) cleanupUnhealthyReplicas(oldISs []*v1alpha1.InstanceSet, d if newReplicasCount > (targetIS.Spec.Replicas) { return nil, 0, fmt.Errorf("when cleaning up unhealthy replicas, got invalid request to scale down %s %d -> %d", targetIS.Name, (targetIS.Spec.Replicas), newReplicasCount) } - _, updatedOldIS, err := dc.scaleInstanceSetAndRecordEvent(targetIS, newReplicasCount, deployment) + _, updatedOldIS, err := dc.scaleMachineSetAndRecordEvent(targetIS, newReplicasCount, deployment) if err != nil { return nil, totalScaledDown, err } @@ -191,25 +191,25 @@ func (dc *controller) cleanupUnhealthyReplicas(oldISs []*v1alpha1.InstanceSet, d return oldISs, totalScaledDown, nil } -// scaleDownOldReplicaSetsForRollingUpdate scales down old instance sets when deployment strategy is "RollingUpdate". +// scaleDownOldReplicaSetsForRollingUpdate scales down old machine sets when deployment strategy is "RollingUpdate". // Need check maxUnavailable to ensure availability -func (dc *controller) scaleDownOldInstanceSetsForRollingUpdate(allISs []*v1alpha1.InstanceSet, oldISs []*v1alpha1.InstanceSet, deployment *v1alpha1.InstanceDeployment) (int32, error) { +func (dc *controller) scaleDownOldMachineSetsForRollingUpdate(allISs []*v1alpha1.MachineSet, oldISs []*v1alpha1.MachineSet, deployment *v1alpha1.MachineDeployment) (int32, error) { maxUnavailable := MaxUnavailable(*deployment) // Check if we can scale down. minAvailable := (deployment.Spec.Replicas) - maxUnavailable - // Find the number of available instances. - availableInstanceCount := GetAvailableReplicaCountForInstanceSets(allISs) - if availableInstanceCount <= minAvailable { + // Find the number of available machines. + availableMachineCount := GetAvailableReplicaCountForMachineSets(allISs) + if availableMachineCount <= minAvailable { // Cannot scale down. return 0, nil } - glog.V(4).Infof("Found %d available instances in deployment %s, scaling down old ISes", availableInstanceCount, deployment.Name) + glog.V(4).Infof("Found %d available machines in deployment %s, scaling down old ISes", availableMachineCount, deployment.Name) - sort.Sort(InstanceSetsByCreationTimestamp(oldISs)) + sort.Sort(MachineSetsByCreationTimestamp(oldISs)) totalScaledDown := int32(0) - totalScaleDownCount := availableInstanceCount - minAvailable + totalScaleDownCount := availableMachineCount - minAvailable for _, targetIS := range oldISs { if totalScaledDown >= totalScaleDownCount { // No further scaling required. @@ -225,7 +225,7 @@ func (dc *controller) scaleDownOldInstanceSetsForRollingUpdate(allISs []*v1alpha if newReplicasCount > (targetIS.Spec.Replicas) { return 0, fmt.Errorf("when scaling down old IS, got invalid request to scale down %s %d -> %d", targetIS.Name, (targetIS.Spec.Replicas), newReplicasCount) } - _, _, err := dc.scaleInstanceSetAndRecordEvent(targetIS, newReplicasCount, deployment) + _, _, err := dc.scaleMachineSetAndRecordEvent(targetIS, newReplicasCount, deployment) if err != nil { return totalScaledDown, err } diff --git a/pkg/controller/deployment_sync.go b/pkg/controller/deployment_sync.go index c9575d933..a39f91b4c 100644 --- a/pkg/controller/deployment_sync.go +++ b/pkg/controller/deployment_sync.go @@ -35,25 +35,25 @@ import ( utilerrors "k8s.io/apimachinery/pkg/util/errors" "k8s.io/apimachinery/pkg/util/rand" labelsutil "k8s.io/kubernetes/pkg/util/labels" - "github.com/gardener/node-controller-manager/pkg/apis/node/v1alpha1" + "github.com/gardener/node-controller-manager/pkg/apis/machine/v1alpha1" ) // syncStatusOnly only updates Deployments Status and doesn't take any mutating actions. -func (dc *controller) syncStatusOnly(d *v1alpha1.InstanceDeployment, isList []*v1alpha1.InstanceSet, instanceMap map[types.UID]*v1alpha1.InstanceList) error { - newIS, oldISs, err := dc.getAllInstanceSetsAndSyncRevision(d, isList, instanceMap, false) +func (dc *controller) syncStatusOnly(d *v1alpha1.MachineDeployment, isList []*v1alpha1.MachineSet, machineMap map[types.UID]*v1alpha1.MachineList) error { + newIS, oldISs, err := dc.getAllMachineSetsAndSyncRevision(d, isList, machineMap, false) if err != nil { return err } allISs := append(oldISs, newIS) - return dc.syncInstanceDeploymentStatus(allISs, newIS, d) + return dc.syncMachineDeploymentStatus(allISs, newIS, d) } // sync is responsible for reconciling deployments on scaling events or when they // are paused. -func (dc *controller) sync(d *v1alpha1.InstanceDeployment, isList []*v1alpha1.InstanceSet, instanceMap map[types.UID]*v1alpha1.InstanceList) error { - newIS, oldISs, err := dc.getAllInstanceSetsAndSyncRevision(d, isList, instanceMap, false) +func (dc *controller) sync(d *v1alpha1.MachineDeployment, isList []*v1alpha1.MachineSet, machineMap map[types.UID]*v1alpha1.MachineList) error { + newIS, oldISs, err := dc.getAllMachineSetsAndSyncRevision(d, isList, machineMap, false) if err != nil { return err } @@ -65,37 +65,37 @@ func (dc *controller) sync(d *v1alpha1.InstanceDeployment, isList []*v1alpha1.In // Clean up the deployment when it's paused and no rollback is in flight. if d.Spec.Paused && d.Spec.RollbackTo == nil { - if err := dc.cleanupInstanceDeployment(oldISs, d); err != nil { + if err := dc.cleanupMachineDeployment(oldISs, d); err != nil { return err } } allISs := append(oldISs, newIS) - return dc.syncInstanceDeploymentStatus(allISs, newIS, d) + return dc.syncMachineDeploymentStatus(allISs, newIS, d) } // checkPausedConditions checks if the given deployment is paused or not and adds an appropriate condition. // These conditions are needed so that we won't accidentally report lack of progress for resumed deployments // that were paused for longer than progressDeadlineSeconds. -func (dc *controller) checkPausedConditions(d *v1alpha1.InstanceDeployment) error { +func (dc *controller) checkPausedConditions(d *v1alpha1.MachineDeployment) error { if d.Spec.ProgressDeadlineSeconds == nil { return nil } - cond := GetInstanceDeploymentCondition(d.Status, v1alpha1.InstanceDeploymentProgressing) + cond := GetMachineDeploymentCondition(d.Status, v1alpha1.MachineDeploymentProgressing) if cond != nil && cond.Reason == TimedOutReason { // If we have reported lack of progress, do not overwrite it with a paused condition. return nil } - pausedCondExists := cond != nil && cond.Reason == PausedInstanceDeployReason + pausedCondExists := cond != nil && cond.Reason == PausedMachineDeployReason needsUpdate := false if d.Spec.Paused && !pausedCondExists { - condition := NewInstanceDeploymentCondition(v1alpha1.InstanceDeploymentProgressing, v1alpha1.ConditionUnknown, PausedInstanceDeployReason, "Deployment is paused") - SetInstanceDeploymentCondition(&d.Status, *condition) + condition := NewMachineDeploymentCondition(v1alpha1.MachineDeploymentProgressing, v1alpha1.ConditionUnknown, PausedMachineDeployReason, "Deployment is paused") + SetMachineDeploymentCondition(&d.Status, *condition) needsUpdate = true } else if !d.Spec.Paused && pausedCondExists { - condition := NewInstanceDeploymentCondition(v1alpha1.InstanceDeploymentProgressing, v1alpha1.ConditionUnknown, ResumedInstanceDeployReason, "Deployment is resumed") - SetInstanceDeploymentCondition(&d.Status, *condition) + condition := NewMachineDeploymentCondition(v1alpha1.MachineDeploymentProgressing, v1alpha1.ConditionUnknown, ResumedMachineDeployReason, "Deployment is resumed") + SetMachineDeploymentCondition(&d.Status, *condition) needsUpdate = true } @@ -104,32 +104,32 @@ func (dc *controller) checkPausedConditions(d *v1alpha1.InstanceDeployment) erro } var err error - d, err = dc.nodeClient.InstanceDeployments().Update(d) + d, err = dc.nodeClient.MachineDeployments().Update(d) return err } -// getAllReplicaSetsAndSyncRevision returns all the instance sets for the provided deployment (new and all old), with new RS's and deployment's revision updated. +// getAllReplicaSetsAndSyncRevision returns all the machine sets for the provided deployment (new and all old), with new RS's and deployment's revision updated. // // rsList should come from getReplicaSetsForDeployment(d). -// instanceMap should come from getinstanceMapForDeployment(d, rsList). +// machineMap should come from getmachineMapForDeployment(d, rsList). // // 1. Get all old RSes this deployment targets, and calculate the max revision number among them (maxOldV). -// 2. Get new RS this deployment targets (whose instance template matches deployment's), and update new RS's revision number to (maxOldV + 1), +// 2. Get new RS this deployment targets (whose machine template matches deployment's), and update new RS's revision number to (maxOldV + 1), // only if its revision number is smaller than (maxOldV + 1). If this step failed, we'll update it in the next deployment sync loop. // 3. Copy new RS's revision number to deployment (update deployment's revision). If this step failed, we'll update it in the next deployment sync loop. // // Note that currently the deployment controller is using caches to avoid querying the server for reads. -// This may lead to stale reads of instance sets, thus incorrect deployment status. -func (dc *controller) getAllInstanceSetsAndSyncRevision(d *v1alpha1.InstanceDeployment, isList []*v1alpha1.InstanceSet, instanceMap map[types.UID]*v1alpha1.InstanceList, createIfNotExisted bool) (*v1alpha1.InstanceSet, []*v1alpha1.InstanceSet, error) { - // List the deployment's RSes & instances and apply instance-template-hash info to deployment's adopted RSes/instances - isList, err := dc.isAndInstancesWithHashKeySynced(d, isList, instanceMap) +// This may lead to stale reads of machine sets, thus incorrect deployment status. +func (dc *controller) getAllMachineSetsAndSyncRevision(d *v1alpha1.MachineDeployment, isList []*v1alpha1.MachineSet, machineMap map[types.UID]*v1alpha1.MachineList, createIfNotExisted bool) (*v1alpha1.MachineSet, []*v1alpha1.MachineSet, error) { + // List the deployment's RSes & machines and apply machine-template-hash info to deployment's adopted RSes/machines + isList, err := dc.isAndMachinesWithHashKeySynced(d, isList, machineMap) if err != nil { - return nil, nil, fmt.Errorf("error labeling instance sets and instance with instance-template-hash: %v", err) + return nil, nil, fmt.Errorf("error labeling machine sets and machine with machine-template-hash: %v", err) } - _, allOldISs := FindOldInstanceSets(d, isList) + _, allOldISs := FindOldMachineSets(d, isList) - // Get new instance set with the updated revision number - newIS, err := dc.getNewInstanceSet(d, isList, allOldISs, createIfNotExisted) + // Get new machine set with the updated revision number + newIS, err := dc.getNewMachineSet(d, isList, allOldISs, createIfNotExisted) if err != nil { return nil, nil, err } @@ -137,18 +137,18 @@ func (dc *controller) getAllInstanceSetsAndSyncRevision(d *v1alpha1.InstanceDepl return newIS, allOldISs, nil } -// rsAndinstancesWithHashKeySynced returns the RSes and instances the given deployment -// targets, with instance-template-hash information synced. +// rsAndmachinesWithHashKeySynced returns the RSes and machines the given deployment +// targets, with machine-template-hash information synced. // // rsList should come from getReplicaSetsForDeployment(d). -// instanceMap should come from getinstanceMapForDeployment(d, rsList). -func (dc *controller) isAndInstancesWithHashKeySynced(d *v1alpha1.InstanceDeployment, isList []*v1alpha1.InstanceSet, instanceMap map[types.UID]*v1alpha1.InstanceList) ([]*v1alpha1.InstanceSet, error) { - var syncedISList []*v1alpha1.InstanceSet +// machineMap should come from getmachineMapForDeployment(d, rsList). +func (dc *controller) isAndMachinesWithHashKeySynced(d *v1alpha1.MachineDeployment, isList []*v1alpha1.MachineSet, machineMap map[types.UID]*v1alpha1.MachineList) ([]*v1alpha1.MachineSet, error) { + var syncedISList []*v1alpha1.MachineSet for _, is := range isList { - // Add instance-template-hash information if it's not in the RS. + // Add machine-template-hash information if it's not in the RS. // Otherwise, new RS produced by Deployment will overlap with pre-existing ones - // that aren't constrained by the instance-template-hash. - syncedIS, err := dc.addHashKeyToISAndInstances(is, instanceMap[is.UID], d.Status.CollisionCount) + // that aren't constrained by the machine-template-hash. + syncedIS, err := dc.addHashKeyToISAndMachines(is, machineMap[is.UID], d.Status.CollisionCount) if err != nil { return nil, err } @@ -157,123 +157,123 @@ func (dc *controller) isAndInstancesWithHashKeySynced(d *v1alpha1.InstanceDeploy return syncedISList, nil } -// addHashKeyToRSAndinstances adds instance-template-hash information to the given rs, if it's not already there, with the following steps: -// 1. Add hash label to the rs's instance template, and make sure the controller sees this update so that no orphaned instances will be created -// 2. Add hash label to all instances this rs owns, wait until replicaset controller reports rs.Status.FullyLabeledReplicas equal to the desired number of replicas +// addHashKeyToRSAndmachines adds machine-template-hash information to the given rs, if it's not already there, with the following steps: +// 1. Add hash label to the rs's machine template, and make sure the controller sees this update so that no orphaned machines will be created +// 2. Add hash label to all machines this rs owns, wait until replicaset controller reports rs.Status.FullyLabeledReplicas equal to the desired number of replicas // 3. Add hash label to the rs's label and selector -func (dc *controller) addHashKeyToISAndInstances(is *v1alpha1.InstanceSet, instanceList *v1alpha1.InstanceList, collisionCount *int32) (*v1alpha1.InstanceSet, error) { +func (dc *controller) addHashKeyToISAndMachines(is *v1alpha1.MachineSet, machineList *v1alpha1.MachineList, collisionCount *int32) (*v1alpha1.MachineSet, error) { // If the rs already has the new hash label in its selector, it's done syncing - if labelsutil.SelectorHasLabel(is.Spec.Selector, v1alpha1.DefaultInstanceDeploymentUniqueLabelKey) { + if labelsutil.SelectorHasLabel(is.Spec.Selector, v1alpha1.DefaultMachineDeploymentUniqueLabelKey) { return is, nil } - hash, err := GetInstanceSetHash(is, collisionCount) + hash, err := GetMachineSetHash(is, collisionCount) if err != nil { return nil, err } - // 1. Add hash template label to the rs. This ensures that any newly created instances will have the new label. - updatedIS, err := UpdateISWithRetries(dc.nodeClient.InstanceSets(), dc.instanceSetLister, is.Namespace, is.Name, - func(updated *v1alpha1.InstanceSet) error { - // Precondition: the RS doesn't contain the new hash in its instance template label. - if updated.Spec.Template.Labels[v1alpha1.DefaultInstanceDeploymentUniqueLabelKey] == hash { + // 1. Add hash template label to the rs. This ensures that any newly created machines will have the new label. + updatedIS, err := UpdateISWithRetries(dc.nodeClient.MachineSets(), dc.machineSetLister, is.Namespace, is.Name, + func(updated *v1alpha1.MachineSet) error { + // Precondition: the RS doesn't contain the new hash in its machine template label. + if updated.Spec.Template.Labels[v1alpha1.DefaultMachineDeploymentUniqueLabelKey] == hash { return utilerrors.ErrPreconditionViolated } - updated.Spec.Template.Labels = labelsutil.AddLabel(updated.Spec.Template.Labels, v1alpha1.DefaultInstanceDeploymentUniqueLabelKey, hash) + updated.Spec.Template.Labels = labelsutil.AddLabel(updated.Spec.Template.Labels, v1alpha1.DefaultMachineDeploymentUniqueLabelKey, hash) return nil }) if err != nil { - return nil, fmt.Errorf("error updating instance set %s instance template label with template hash: %v", is.Name, err) + return nil, fmt.Errorf("error updating machine set %s machine template label with template hash: %v", is.Name, err) } - // Make sure rs instance template is updated so that it won't create instances without the new label (orphaned instances). + // Make sure rs machine template is updated so that it won't create machines without the new label (orphaned machines). if updatedIS.Generation > updatedIS.Status.ObservedGeneration { // TODO: Revisit if we really need to wait here as opposed to returning and // potentially unblocking this worker (can wait up to 1min before timing out). - if err = WaitForInstanceSetUpdated(dc.instanceSetLister, updatedIS.Generation, updatedIS.Namespace, updatedIS.Name); err != nil { - return nil, fmt.Errorf("error waiting for instance set %s to be observed by controller: %v", updatedIS.Name, err) + if err = WaitForMachineSetUpdated(dc.machineSetLister, updatedIS.Generation, updatedIS.Namespace, updatedIS.Name); err != nil { + return nil, fmt.Errorf("error waiting for machine set %s to be observed by controller: %v", updatedIS.Name, err) } - glog.V(4).Infof("Observed the update of instance set %s's instance template with hash %s.", is.Name, hash) + glog.V(4).Infof("Observed the update of machine set %s's machine template with hash %s.", is.Name, hash) } - // 2. Update all instances managed by the rs to have the new hash label, so they will be correctly adopted. - if err := LabelInstancesWithHash(instanceList, dc.nodeClient, dc.instanceLister, is.Namespace, is.Name, hash); err != nil { - return nil, fmt.Errorf("error in adding template hash label %s to instances %+v: %s", hash, instanceList, err) + // 2. Update all machines managed by the rs to have the new hash label, so they will be correctly adopted. + if err := LabelMachinesWithHash(machineList, dc.nodeClient, dc.machineLister, is.Namespace, is.Name, hash); err != nil { + return nil, fmt.Errorf("error in adding template hash label %s to machines %+v: %s", hash, machineList, err) } - // We need to wait for the replicaset controller to observe the instances being - // labeled with instance template hash. Because previously we've called + // We need to wait for the replicaset controller to observe the machines being + // labeled with machine template hash. Because previously we've called // WaitForReplicaSetUpdated, the replicaset controller should have dropped // FullyLabeledReplicas to 0 already, we only need to wait it to increase // back to the number of replicas in the spec. // TODO: Revisit if we really need to wait here as opposed to returning and // potentially unblocking this worker (can wait up to 1min before timing out). - if err := WaitForInstancesHashPopulated(dc.instanceSetLister, updatedIS.Generation, updatedIS.Namespace, updatedIS.Name); err != nil { - return nil, fmt.Errorf("Instance set %s: error waiting for instanceset controller to observe instances being labeled with template hash: %v", updatedIS.Name, err) + if err := WaitForMachinesHashPopulated(dc.machineSetLister, updatedIS.Generation, updatedIS.Namespace, updatedIS.Name); err != nil { + return nil, fmt.Errorf("Machine set %s: error waiting for machineset controller to observe machines being labeled with template hash: %v", updatedIS.Name, err) } // 3. Update rs label and selector to include the new hash label - // Copy the old selector, so that we can scrub out any orphaned instances - updatedIS, err = UpdateISWithRetries(dc.nodeClient.InstanceSets(), dc.instanceSetLister, is.Namespace, is.Name, func(updated *v1alpha1.InstanceSet) error { + // Copy the old selector, so that we can scrub out any orphaned machines + updatedIS, err = UpdateISWithRetries(dc.nodeClient.MachineSets(), dc.machineSetLister, is.Namespace, is.Name, func(updated *v1alpha1.MachineSet) error { // Precondition: the RS doesn't contain the new hash in its label and selector. - if updated.Labels[v1alpha1.DefaultInstanceDeploymentUniqueLabelKey] == hash && updated.Spec.Selector.MatchLabels[v1alpha1.DefaultInstanceDeploymentUniqueLabelKey] == hash { + if updated.Labels[v1alpha1.DefaultMachineDeploymentUniqueLabelKey] == hash && updated.Spec.Selector.MatchLabels[v1alpha1.DefaultMachineDeploymentUniqueLabelKey] == hash { return utilerrors.ErrPreconditionViolated } - updated.Labels = labelsutil.AddLabel(updated.Labels, v1alpha1.DefaultInstanceDeploymentUniqueLabelKey, hash) - updated.Spec.Selector = labelsutil.AddLabelToSelector(updated.Spec.Selector, v1alpha1.DefaultInstanceDeploymentUniqueLabelKey, hash) + updated.Labels = labelsutil.AddLabel(updated.Labels, v1alpha1.DefaultMachineDeploymentUniqueLabelKey, hash) + updated.Spec.Selector = labelsutil.AddLabelToSelector(updated.Spec.Selector, v1alpha1.DefaultMachineDeploymentUniqueLabelKey, hash) return nil }) // If the RS isn't actually updated, that's okay, we'll retry in the // next sync loop since its selector isn't updated yet. if err != nil { - return nil, fmt.Errorf("error updating InstanceSet %s label and selector with template hash: %v", updatedIS.Name, err) + return nil, fmt.Errorf("error updating MachineSet %s label and selector with template hash: %v", updatedIS.Name, err) } - // TODO: look for orphaned instances and label them in the background somewhere else periodically + // TODO: look for orphaned machines and label them in the background somewhere else periodically return updatedIS, nil } -// Returns a instance set that matches the intent of the given deployment. Returns nil if the new instance set doesn't exist yet. -// 1. Get existing new RS (the RS that the given deployment targets, whose instance template is the same as deployment's). +// Returns a machine set that matches the intent of the given deployment. Returns nil if the new machine set doesn't exist yet. +// 1. Get existing new RS (the RS that the given deployment targets, whose machine template is the same as deployment's). // 2. If there's existing new RS, update its revision number if it's smaller than (maxOldRevision + 1), where maxOldRevision is the max revision number among all old RSes. // 3. If there's no existing new RS and createIfNotExisted is true, create one with appropriate revision number (maxOldRevision + 1) and replicas. -// Note that the instance-template-hash will be added to adopted RSes and instances. -func (dc *controller) getNewInstanceSet(d *v1alpha1.InstanceDeployment, isList, oldISs []*v1alpha1.InstanceSet, createIfNotExisted bool) (*v1alpha1.InstanceSet, error) { - existingNewIS := FindNewInstanceSet(d, isList) +// Note that the machine-template-hash will be added to adopted RSes and machines. +func (dc *controller) getNewMachineSet(d *v1alpha1.MachineDeployment, isList, oldISs []*v1alpha1.MachineSet, createIfNotExisted bool) (*v1alpha1.MachineSet, error) { + existingNewIS := FindNewMachineSet(d, isList) // Calculate the max revision number among all old RSes maxOldRevision := MaxRevision(oldISs) - // Calculate revision number for this new instance set + // Calculate revision number for this new machine set newRevision := strconv.FormatInt(maxOldRevision+1, 10) - // Latest instance set exists. We need to sync its annotations (includes copying all but + // Latest machine set exists. We need to sync its annotations (includes copying all but // annotationsToSkip from the parent deployment, and update revision, desiredReplicas, // and maxReplicas) and also update the revision annotation in the deployment with the // latest revision. if existingNewIS != nil { isCopy := existingNewIS.DeepCopy() - // Set existing new instance set's annotation - annotationsUpdated := SetNewInstanceSetAnnotations(d, isCopy, newRevision, true) + // Set existing new machine set's annotation + annotationsUpdated := SetNewMachineSetAnnotations(d, isCopy, newRevision, true) minReadySecondsNeedsUpdate := isCopy.Spec.MinReadySeconds != d.Spec.MinReadySeconds if annotationsUpdated || minReadySecondsNeedsUpdate { isCopy.Spec.MinReadySeconds = d.Spec.MinReadySeconds - return dc.nodeClient.InstanceSets().Update(isCopy) + return dc.nodeClient.MachineSets().Update(isCopy) } // Should use the revision in existingNewRS's annotation, since it set by before - needsUpdate := SetInstanceDeploymentRevision(d, isCopy.Annotations[RevisionAnnotation]) + needsUpdate := SetMachineDeploymentRevision(d, isCopy.Annotations[RevisionAnnotation]) // If no other Progressing condition has been recorded and we need to estimate the progress // of this deployment then it is likely that old users started caring about progress. In that - // case we need to take into account the first time we noticed their new instance set. - cond := GetInstanceDeploymentCondition(d.Status, v1alpha1.InstanceDeploymentProgressing) + // case we need to take into account the first time we noticed their new machine set. + cond := GetMachineDeploymentCondition(d.Status, v1alpha1.MachineDeploymentProgressing) if d.Spec.ProgressDeadlineSeconds != nil && cond == nil { - msg := fmt.Sprintf("Found new instance set %q", isCopy.Name) - condition := NewInstanceDeploymentCondition(v1alpha1.InstanceDeploymentProgressing, v1alpha1.ConditionTrue, FoundNewISReason, msg) - SetInstanceDeploymentCondition(&d.Status, *condition) + msg := fmt.Sprintf("Found new machine set %q", isCopy.Name) + condition := NewMachineDeploymentCondition(v1alpha1.MachineDeploymentProgressing, v1alpha1.ConditionTrue, FoundNewISReason, msg) + SetMachineDeploymentCondition(&d.Status, *condition) needsUpdate = true } if needsUpdate { var err error - if d, err = dc.nodeClient.InstanceDeployments().Update(d); err != nil { + if d, err = dc.nodeClient.MachineDeployments().Update(d); err != nil { return nil, err } } @@ -286,21 +286,21 @@ func (dc *controller) getNewInstanceSet(d *v1alpha1.InstanceDeployment, isList, // new ReplicaSet does not exist, create one. newISTemplate := *d.Spec.Template.DeepCopy() - instanceTemplateSpecHash := fmt.Sprintf("%d", ComputeHash(&newISTemplate, d.Status.CollisionCount)) - newISTemplate.Labels = labelsutil.CloneAndAddLabel(d.Spec.Template.Labels, v1alpha1.DefaultInstanceDeploymentUniqueLabelKey, instanceTemplateSpecHash) - // Add instanceTemplateHash label to selector. - newISSelector := labelsutil.CloneSelectorAndAddLabel(d.Spec.Selector, v1alpha1.DefaultInstanceDeploymentUniqueLabelKey, instanceTemplateSpecHash) + machineTemplateSpecHash := fmt.Sprintf("%d", ComputeHash(&newISTemplate, d.Status.CollisionCount)) + newISTemplate.Labels = labelsutil.CloneAndAddLabel(d.Spec.Template.Labels, v1alpha1.DefaultMachineDeploymentUniqueLabelKey, machineTemplateSpecHash) + // Add machineTemplateHash label to selector. + newISSelector := labelsutil.CloneSelectorAndAddLabel(d.Spec.Selector, v1alpha1.DefaultMachineDeploymentUniqueLabelKey, machineTemplateSpecHash) // Create new ReplicaSet - newIS := v1alpha1.InstanceSet{ + newIS := v1alpha1.MachineSet{ ObjectMeta: metav1.ObjectMeta{ // Make the name deterministic, to ensure idempotence - Name: d.Name + "-" + rand.SafeEncodeString(instanceTemplateSpecHash), + Name: d.Name + "-" + rand.SafeEncodeString(machineTemplateSpecHash), Namespace: d.Namespace, OwnerReferences: []metav1.OwnerReference{*metav1.NewControllerRef(d, controllerKind)}, Labels: newISTemplate.Labels, }, - Spec: v1alpha1.InstanceSetSpec{ + Spec: v1alpha1.MachineSetSpec{ Replicas: 0, MinReadySeconds: d.Spec.MinReadySeconds, Selector: newISSelector, @@ -314,22 +314,22 @@ func (dc *controller) getNewInstanceSet(d *v1alpha1.InstanceDeployment, isList, } (newIS.Spec.Replicas) = newReplicasCount - // Set new instance set's annotation - SetNewInstanceSetAnnotations(d, &newIS, newRevision, false) + // Set new machine set's annotation + SetNewMachineSetAnnotations(d, &newIS, newRevision, false) // Create the new ReplicaSet. If it already exists, then we need to check for possible // hash collisions. If there is any other error, we need to report it in the status of // the Deployment. alreadyExists := false - createdIS, err := dc.nodeClient.InstanceSets().Create(&newIS) + createdIS, err := dc.nodeClient.MachineSets().Create(&newIS) switch { // We may end up hitting this due to a slow cache or a fast resync of the Deployment. - // Fetch a copy of the ReplicaSet. If its instanceTemplateSpec is semantically deep equal - // with the instanceTemplateSpec of the Deployment, then that is our new ReplicaSet. Otherwise, + // Fetch a copy of the ReplicaSet. If its machineTemplateSpec is semantically deep equal + // with the machineTemplateSpec of the Deployment, then that is our new ReplicaSet. Otherwise, // this is a hash collision and we need to increment the collisionCount field in the // status of the Deployment and try the creation again. case errors.IsAlreadyExists(err): alreadyExists = true - is, isErr := dc.instanceSetLister.Get(newIS.Name) + is, isErr := dc.machineSetLister.Get(newIS.Name) if isErr != nil { return nil, isErr } @@ -345,9 +345,9 @@ func (dc *controller) getNewInstanceSet(d *v1alpha1.InstanceDeployment, isList, *d.Status.CollisionCount++ // Update the collisionCount for the Deployment and let it requeue by returning the original // error. - _, dErr := dc.nodeClient.InstanceDeployments().Update(d) + _, dErr := dc.nodeClient.MachineDeployments().Update(d) if dErr == nil { - glog.V(2).Infof("Found a hash collision for instance deployment %q - bumping collisionCount (%d->%d) to resolve it", d.Name, preCollisionCount, *d.Status.CollisionCount) + glog.V(2).Infof("Found a hash collision for machine deployment %q - bumping collisionCount (%d->%d) to resolve it", d.Name, preCollisionCount, *d.Status.CollisionCount) } return nil, err } @@ -355,68 +355,68 @@ func (dc *controller) getNewInstanceSet(d *v1alpha1.InstanceDeployment, isList, createdIS = is err = nil case err != nil: - msg := fmt.Sprintf("Failed to create new instance set %q: %v", newIS.Name, err) + msg := fmt.Sprintf("Failed to create new machine set %q: %v", newIS.Name, err) if d.Spec.ProgressDeadlineSeconds != nil { - cond := NewInstanceDeploymentCondition(v1alpha1.InstanceDeploymentProgressing, v1alpha1.ConditionFalse, FailedISCreateReason, msg) - SetInstanceDeploymentCondition(&d.Status, *cond) + cond := NewMachineDeploymentCondition(v1alpha1.MachineDeploymentProgressing, v1alpha1.ConditionFalse, FailedISCreateReason, msg) + SetMachineDeploymentCondition(&d.Status, *cond) // We don't really care about this error at this point, since we have a bigger issue to report. // TODO: Identify which errors are permanent and switch DeploymentIsFailed to take into account // these reasons as well. Related issue: https://github.com/kubernetes/kubernetes/issues/18568 - _, _ = dc.nodeClient.InstanceDeployments().Update(d) + _, _ = dc.nodeClient.MachineDeployments().Update(d) } dc.recorder.Eventf(d, v1.EventTypeWarning, FailedISCreateReason, msg) return nil, err } if !alreadyExists && newReplicasCount > 0 { - dc.recorder.Eventf(d, v1.EventTypeNormal, "ScalingInstanceSet", "Scaled up instance set %s to %d", createdIS.Name, newReplicasCount) + dc.recorder.Eventf(d, v1.EventTypeNormal, "ScalingMachineSet", "Scaled up machine set %s to %d", createdIS.Name, newReplicasCount) } - needsUpdate := SetInstanceDeploymentRevision(d, newRevision) + needsUpdate := SetMachineDeploymentRevision(d, newRevision) if !alreadyExists && d.Spec.ProgressDeadlineSeconds != nil { - msg := fmt.Sprintf("Created new instance set %q", createdIS.Name) - condition := NewInstanceDeploymentCondition(v1alpha1.InstanceDeploymentProgressing, v1alpha1.ConditionTrue, NewInstanceSetReason, msg) - SetInstanceDeploymentCondition(&d.Status, *condition) + msg := fmt.Sprintf("Created new machine set %q", createdIS.Name) + condition := NewMachineDeploymentCondition(v1alpha1.MachineDeploymentProgressing, v1alpha1.ConditionTrue, NewMachineSetReason, msg) + SetMachineDeploymentCondition(&d.Status, *condition) needsUpdate = true } if needsUpdate { - _, err = dc.nodeClient.InstanceDeployments().Update(d) + _, err = dc.nodeClient.MachineDeployments().Update(d) } return createdIS, err } // scale scales proportionally in order to mitigate risk. Otherwise, scaling up can increase the size -// of the new instance set and scaling down can decrease the sizes of the old ones, both of which would +// of the new machine set and scaling down can decrease the sizes of the old ones, both of which would // have the effect of hastening the rollout progress, which could produce a higher proportion of unavailable // replicas in the event of a problem with the rolled out template. Should run only on scaling events or // when a deployment is paused and not during the normal rollout process. -func (dc *controller) scale(deployment *v1alpha1.InstanceDeployment, newIS *v1alpha1.InstanceSet, oldISs []*v1alpha1.InstanceSet) error { - // If there is only one active instance set then we should scale that up to the full count of the - // deployment. If there is no active instance set, then we should scale up the newest instance set. +func (dc *controller) scale(deployment *v1alpha1.MachineDeployment, newIS *v1alpha1.MachineSet, oldISs []*v1alpha1.MachineSet) error { + // If there is only one active machine set then we should scale that up to the full count of the + // deployment. If there is no active machine set, then we should scale up the newest machine set. if activeOrLatest := FindActiveOrLatest(newIS, oldISs); activeOrLatest != nil { if (activeOrLatest.Spec.Replicas) == (deployment.Spec.Replicas) { return nil } - _, _, err := dc.scaleInstanceSetAndRecordEvent(activeOrLatest, (deployment.Spec.Replicas), deployment) + _, _, err := dc.scaleMachineSetAndRecordEvent(activeOrLatest, (deployment.Spec.Replicas), deployment) return err } - // If the new instance set is saturated, old instance sets should be fully scaled down. - // This case handles instance set adoption during a saturated new instance set. + // If the new machine set is saturated, old machine sets should be fully scaled down. + // This case handles machine set adoption during a saturated new machine set. if IsSaturated(deployment, newIS) { - for _, old := range FilterActiveInstanceSets(oldISs) { - if _, _, err := dc.scaleInstanceSetAndRecordEvent(old, 0, deployment); err != nil { + for _, old := range FilterActiveMachineSets(oldISs) { + if _, _, err := dc.scaleMachineSetAndRecordEvent(old, 0, deployment); err != nil { return err } } return nil } - // There are old instance sets with instances and the new instance set is not saturated. - // We need to proportionally scale all instance sets (new and old) in case of a + // There are old machine sets with machines and the new machine set is not saturated. + // We need to proportionally scale all machine sets (new and old) in case of a // rolling deployment. if IsRollingUpdate(deployment) { - allISs := FilterActiveInstanceSets(append(oldISs, newIS)) - allISsReplicas := GetReplicaCountForInstanceSets(allISs) + allISs := FilterActiveMachineSets(append(oldISs, newIS)) + allISsReplicas := GetReplicaCountForMachineSets(allISs) allowedSize := int32(0) if (deployment.Spec.Replicas) > 0 { @@ -425,26 +425,26 @@ func (dc *controller) scale(deployment *v1alpha1.InstanceDeployment, newIS *v1al // Number of additional replicas that can be either added or removed from the total // replicas count. These replicas should be distributed proportionally to the active - // instance sets. + // machine sets. deploymentReplicasToAdd := allowedSize - allISsReplicas // The additional replicas should be distributed proportionally amongst the active - // instance sets from the larger to the smaller in size instance set. Scaling direction - // drives what happens in case we are trying to scale instance sets of the same size. - // In such a case when scaling up, we should scale up newer instance sets first, and - // when scaling down, we should scale down older instance sets first. + // machine sets from the larger to the smaller in size machine set. Scaling direction + // drives what happens in case we are trying to scale machine sets of the same size. + // In such a case when scaling up, we should scale up newer machine sets first, and + // when scaling down, we should scale down older machine sets first. var scalingOperation string switch { case deploymentReplicasToAdd > 0: - sort.Sort(InstanceSetsBySizeNewer(allISs)) + sort.Sort(MachineSetsBySizeNewer(allISs)) scalingOperation = "up" case deploymentReplicasToAdd < 0: - sort.Sort(InstanceSetsBySizeOlder(allISs)) + sort.Sort(MachineSetsBySizeOlder(allISs)) scalingOperation = "down" } - // Iterate over all active instance sets and estimate proportions for each of them. + // Iterate over all active machine sets and estimate proportions for each of them. // The absolute value of deploymentReplicasAdded should never exceed the absolute // value of deploymentReplicasToAdd. deploymentReplicasAdded := int32(0) @@ -453,7 +453,7 @@ func (dc *controller) scale(deployment *v1alpha1.InstanceDeployment, newIS *v1al is := allISs[i] // Estimate proportions if we have replicas to add, otherwise simply populate - // nameToSize with the current sizes for each instance set. + // nameToSize with the current sizes for each machine set. if deploymentReplicasToAdd != 0 { proportion := GetProportion(is, *deployment, deploymentReplicasToAdd, deploymentReplicasAdded) @@ -464,11 +464,11 @@ func (dc *controller) scale(deployment *v1alpha1.InstanceDeployment, newIS *v1al } } - // Update all instance sets + // Update all machine sets for i := range allISs { is := allISs[i] - // Add/remove any leftovers to the largest instance set. + // Add/remove any leftovers to the largest machine set. if i == 0 && deploymentReplicasToAdd != 0 { leftover := deploymentReplicasToAdd - deploymentReplicasAdded nameToSize[is.Name] = nameToSize[is.Name] + leftover @@ -478,7 +478,7 @@ func (dc *controller) scale(deployment *v1alpha1.InstanceDeployment, newIS *v1al } // TODO: Use transactions when we have them. - if _, _, err := dc.scaleInstanceSet(is, nameToSize[is.Name], deployment, scalingOperation); err != nil { + if _, _, err := dc.scaleMachineSet(is, nameToSize[is.Name], deployment, scalingOperation); err != nil { // Return as soon as we fail, the deployment is requeued return err } @@ -487,7 +487,7 @@ func (dc *controller) scale(deployment *v1alpha1.InstanceDeployment, newIS *v1al return nil } -func (dc *controller) scaleInstanceSetAndRecordEvent(is *v1alpha1.InstanceSet, newScale int32, deployment *v1alpha1.InstanceDeployment) (bool, *v1alpha1.InstanceSet, error) { +func (dc *controller) scaleMachineSetAndRecordEvent(is *v1alpha1.MachineSet, newScale int32, deployment *v1alpha1.MachineDeployment) (bool, *v1alpha1.MachineSet, error) { // No need to scale if (is.Spec.Replicas) == newScale { return false, is, nil @@ -498,15 +498,15 @@ func (dc *controller) scaleInstanceSetAndRecordEvent(is *v1alpha1.InstanceSet, n } else { scalingOperation = "down" } - scaled, newIS, err := dc.scaleInstanceSet(is, newScale, deployment, scalingOperation) + scaled, newIS, err := dc.scaleMachineSet(is, newScale, deployment, scalingOperation) return scaled, newIS, err } -func (dc *controller) scaleInstanceSet(is *v1alpha1.InstanceSet, newScale int32, deployment *v1alpha1.InstanceDeployment, scalingOperation string) (bool, *v1alpha1.InstanceSet, error) { +func (dc *controller) scaleMachineSet(is *v1alpha1.MachineSet, newScale int32, deployment *v1alpha1.MachineDeployment, scalingOperation string) (bool, *v1alpha1.MachineSet, error) { isCopy := is.DeepCopy() sizeNeedsUpdate := (isCopy.Spec.Replicas) != newScale - // TODO: Do not mutate the instance set here, instead simply compare the annotation and if they mismatch + // TODO: Do not mutate the machine set here, instead simply compare the annotation and if they mismatch // call SetReplicasAnnotations inside the following if clause. Then we can also move the deep-copy from // above inside the if too. annotationsNeedUpdate := SetReplicasAnnotations(isCopy, (deployment.Spec.Replicas), (deployment.Spec.Replicas)+MaxSurge(*deployment)) @@ -515,45 +515,45 @@ func (dc *controller) scaleInstanceSet(is *v1alpha1.InstanceSet, newScale int32, var err error if sizeNeedsUpdate || annotationsNeedUpdate { isCopy.Spec.Replicas = newScale - is, err = dc.nodeClient.InstanceSets().Update(isCopy) + is, err = dc.nodeClient.MachineSets().Update(isCopy) if err == nil && sizeNeedsUpdate { scaled = true - dc.recorder.Eventf(deployment, v1.EventTypeNormal, "ScalingInstanceSet", "Scaled %s instance set %s to %d", scalingOperation, is.Name, newScale) + dc.recorder.Eventf(deployment, v1.EventTypeNormal, "ScalingMachineSet", "Scaled %s machine set %s to %d", scalingOperation, is.Name, newScale) } } return scaled, is, err } -// cleanupDeployment is responsible for cleaning up a deployment ie. retains all but the latest N old instance sets -// where N=d.Spec.RevisionHistoryLimit. Old instance sets are older versions of the instancetemplate of a deployment kept +// cleanupDeployment is responsible for cleaning up a deployment ie. retains all but the latest N old machine sets +// where N=d.Spec.RevisionHistoryLimit. Old machine sets are older versions of the machinetemplate of a deployment kept // around by default 1) for historical reasons and 2) for the ability to rollback a deployment. -func (dc *controller) cleanupInstanceDeployment(oldISs []*v1alpha1.InstanceSet, deployment *v1alpha1.InstanceDeployment) error { +func (dc *controller) cleanupMachineDeployment(oldISs []*v1alpha1.MachineSet, deployment *v1alpha1.MachineDeployment) error { if deployment.Spec.RevisionHistoryLimit == nil { return nil } - // Avoid deleting instance set with deletion timestamp set - aliveFilter := func(is *v1alpha1.InstanceSet) bool { + // Avoid deleting machine set with deletion timestamp set + aliveFilter := func(is *v1alpha1.MachineSet) bool { return is != nil && is.ObjectMeta.DeletionTimestamp == nil } - cleanableISes := FilterInstanceSets(oldISs, aliveFilter) + cleanableISes := FilterMachineSets(oldISs, aliveFilter) diff := int32(len(cleanableISes)) - *deployment.Spec.RevisionHistoryLimit if diff <= 0 { return nil } - sort.Sort(InstanceSetsByCreationTimestamp(cleanableISes)) - glog.V(4).Infof("Looking to cleanup old instance sets for deployment %q", deployment.Name) + sort.Sort(MachineSetsByCreationTimestamp(cleanableISes)) + glog.V(4).Infof("Looking to cleanup old machine sets for deployment %q", deployment.Name) for i := int32(0); i < diff; i++ { is := cleanableISes[i] - // Avoid delete instance set with non-zero replica counts + // Avoid delete machine set with non-zero replica counts if is.Status.Replicas != 0 || (is.Spec.Replicas) != 0 || is.Generation > is.Status.ObservedGeneration || is.DeletionTimestamp != nil { continue } - glog.V(4).Infof("Trying to cleanup instance set %q for deployment %q", is.Name, deployment.Name) - if err := dc.nodeClient.InstanceSets().Delete(is.Name, nil); err != nil && !errors.IsNotFound(err) { + glog.V(4).Infof("Trying to cleanup machine set %q for deployment %q", is.Name, deployment.Name) + if err := dc.nodeClient.MachineSets().Delete(is.Name, nil); err != nil && !errors.IsNotFound(err) { // Return error instead of aggregating and continuing DELETEs on the theory // that we may be overloading the api server. return err @@ -564,7 +564,7 @@ func (dc *controller) cleanupInstanceDeployment(oldISs []*v1alpha1.InstanceSet, } // syncDeploymentStatus checks if the status is up-to-date and sync it if necessary -func (dc *controller) syncInstanceDeploymentStatus(allISs []*v1alpha1.InstanceSet, newIS *v1alpha1.InstanceSet, d *v1alpha1.InstanceDeployment) error { +func (dc *controller) syncMachineDeploymentStatus(allISs []*v1alpha1.MachineSet, newIS *v1alpha1.MachineSet, d *v1alpha1.MachineDeployment) error { newStatus := calculateDeploymentStatus(allISs, newIS, d) if reflect.DeepEqual(d.Status, newStatus) { @@ -573,14 +573,14 @@ func (dc *controller) syncInstanceDeploymentStatus(allISs []*v1alpha1.InstanceSe newDeployment := d newDeployment.Status = newStatus - _, err := dc.nodeClient.InstanceDeployments().Update(newDeployment) + _, err := dc.nodeClient.MachineDeployments().Update(newDeployment) return err } -// calculateStatus calculates the latest status for the provided deployment by looking into the provided instance sets. -func calculateDeploymentStatus(allISs []*v1alpha1.InstanceSet, newIS *v1alpha1.InstanceSet, deployment *v1alpha1.InstanceDeployment) v1alpha1.InstanceDeploymentStatus { - availableReplicas := GetAvailableReplicaCountForInstanceSets(allISs) - totalReplicas := GetReplicaCountForInstanceSets(allISs) +// calculateStatus calculates the latest status for the provided deployment by looking into the provided machine sets. +func calculateDeploymentStatus(allISs []*v1alpha1.MachineSet, newIS *v1alpha1.MachineSet, deployment *v1alpha1.MachineDeployment) v1alpha1.MachineDeploymentStatus { + availableReplicas := GetAvailableReplicaCountForMachineSets(allISs) + totalReplicas := GetReplicaCountForMachineSets(allISs) unavailableReplicas := totalReplicas - availableReplicas // If unavailableReplicas is negative, then that means the Deployment has more available replicas running than // desired, e.g. whenever it scales down. In such a case we should simply default unavailableReplicas to zero. @@ -588,12 +588,12 @@ func calculateDeploymentStatus(allISs []*v1alpha1.InstanceSet, newIS *v1alpha1.I unavailableReplicas = 0 } - status := v1alpha1.InstanceDeploymentStatus{ + status := v1alpha1.MachineDeploymentStatus{ // TODO: Ensure that if we start retrying status updates, we won't pick up a new Generation value. ObservedGeneration: deployment.Generation, - Replicas: GetActualReplicaCountForInstanceSets(allISs), - UpdatedReplicas: GetActualReplicaCountForInstanceSets([]*v1alpha1.InstanceSet{newIS}), - ReadyReplicas: GetReadyReplicaCountForInstanceSets(allISs), + Replicas: GetActualReplicaCountForMachineSets(allISs), + UpdatedReplicas: GetActualReplicaCountForMachineSets([]*v1alpha1.MachineSet{newIS}), + ReadyReplicas: GetReadyReplicaCountForMachineSets(allISs), AvailableReplicas: availableReplicas, UnavailableReplicas: unavailableReplicas, CollisionCount: deployment.Status.CollisionCount, @@ -606,28 +606,28 @@ func calculateDeploymentStatus(allISs []*v1alpha1.InstanceSet, newIS *v1alpha1.I } if availableReplicas >= (deployment.Spec.Replicas)-MaxUnavailable(*deployment) { - minAvailability := NewInstanceDeploymentCondition(v1alpha1.InstanceDeploymentAvailable, v1alpha1.ConditionTrue, MinimumReplicasAvailable, "Deployment has minimum availability.") - SetInstanceDeploymentCondition(&status, *minAvailability) + minAvailability := NewMachineDeploymentCondition(v1alpha1.MachineDeploymentAvailable, v1alpha1.ConditionTrue, MinimumReplicasAvailable, "Deployment has minimum availability.") + SetMachineDeploymentCondition(&status, *minAvailability) } else { - noMinAvailability := NewInstanceDeploymentCondition(v1alpha1.InstanceDeploymentAvailable, v1alpha1.ConditionFalse, MinimumReplicasUnavailable, "Deployment does not have minimum availability.") - SetInstanceDeploymentCondition(&status, *noMinAvailability) + noMinAvailability := NewMachineDeploymentCondition(v1alpha1.MachineDeploymentAvailable, v1alpha1.ConditionFalse, MinimumReplicasUnavailable, "Deployment does not have minimum availability.") + SetMachineDeploymentCondition(&status, *noMinAvailability) } return status } // isScalingEvent checks whether the provided deployment has been updated with a scaling event -// by looking at the desired-replicas annotation in the active instance sets of the deployment. +// by looking at the desired-replicas annotation in the active machine sets of the deployment. // // rsList should come from getReplicaSetsForDeployment(d). -// instanceMap should come from getinstanceMapForDeployment(d, rsList). -func (dc *controller) isScalingEvent(d *v1alpha1.InstanceDeployment, isList []*v1alpha1.InstanceSet, instanceMap map[types.UID]*v1alpha1.InstanceList) (bool, error) { - newIS, oldISs, err := dc.getAllInstanceSetsAndSyncRevision(d, isList, instanceMap, false) +// machineMap should come from getmachineMapForDeployment(d, rsList). +func (dc *controller) isScalingEvent(d *v1alpha1.MachineDeployment, isList []*v1alpha1.MachineSet, machineMap map[types.UID]*v1alpha1.MachineList) (bool, error) { + newIS, oldISs, err := dc.getAllMachineSetsAndSyncRevision(d, isList, machineMap, false) if err != nil { return false, err } allISs := append(oldISs, newIS) - for _, is := range FilterActiveInstanceSets(allISs) { + for _, is := range FilterActiveMachineSets(allISs) { desired, ok := GetDesiredReplicasAnnotation(is) if !ok { continue diff --git a/pkg/controller/deployment_util.go b/pkg/controller/deployment_util.go index 373e14c47..2475397fc 100644 --- a/pkg/controller/deployment_util.go +++ b/pkg/controller/deployment_util.go @@ -42,38 +42,38 @@ import ( "k8s.io/apimachinery/pkg/util/wait" "k8s.io/client-go/util/integer" labelsutil "k8s.io/kubernetes/pkg/util/labels" - "github.com/gardener/node-controller-manager/pkg/apis/node/v1alpha1" - v1alpha1client "github.com/gardener/node-controller-manager/pkg/client/clientset/typed/node/v1alpha1" + "github.com/gardener/node-controller-manager/pkg/apis/machine/v1alpha1" + v1alpha1client "github.com/gardener/node-controller-manager/pkg/client/clientset/typed/machine/v1alpha1" - v1alpha1listers "github.com/gardener/node-controller-manager/pkg/client/listers/node/v1alpha1" + v1alpha1listers "github.com/gardener/node-controller-manager/pkg/client/listers/machine/v1alpha1" ) // DeploymentListerExpansion allows custom methods to be added to // DeploymentLister. -type InstanceDeploymentListerExpansion interface { - GetInstanceDeploymentsForInstanceSet(is *v1alpha1.InstanceSet) ([]*v1alpha1.InstanceDeployment, error) +type MachineDeploymentListerExpansion interface { + GetMachineDeploymentsForMachineSet(is *v1alpha1.MachineSet) ([]*v1alpha1.MachineDeployment, error) } // DeploymentNamespaceListerExpansion allows custom methods to be added to // DeploymentNamespaceLister. -type InstanceDeploymentNamespaceListerExpansion interface{} +type MachineDeploymentNamespaceListerExpansion interface{} -// GetDeploymentsForInstanceSet returns a list of Deployments that potentially -// match a InstanceSet. Only the one specified in the InstanceSet's ControllerRef +// GetDeploymentsForMachineSet returns a list of Deployments that potentially +// match a MachineSet. Only the one specified in the MachineSet's ControllerRef // will actually manage it. // Returns an error only if no matching Deployments are found. -func (c *controller) GetInstanceDeploymentsForInstanceSet(is *v1alpha1.InstanceSet) ([]*v1alpha1.InstanceDeployment, error) { +func (c *controller) GetMachineDeploymentsForMachineSet(is *v1alpha1.MachineSet) ([]*v1alpha1.MachineDeployment, error) { if len(is.Labels) == 0 { - return nil, fmt.Errorf("no deployments found for InstanceSet %v because it has no labels", is.Name) + return nil, fmt.Errorf("no deployments found for MachineSet %v because it has no labels", is.Name) } - // TODO: MODIFY THIS METHOD so that it checks for the instanceTemplateSpecHash label - dList, err := c.instanceDeploymentLister.List(labels.Everything()) + // TODO: MODIFY THIS METHOD so that it checks for the machineTemplateSpecHash label + dList, err := c.machineDeploymentLister.List(labels.Everything()) if err != nil { return nil, err } - var deployments []*v1alpha1.InstanceDeployment + var deployments []*v1alpha1.MachineDeployment for _, d := range dList { selector, err := metav1.LabelSelectorAsSelector(d.Spec.Selector) if err != nil { @@ -87,23 +87,23 @@ func (c *controller) GetInstanceDeploymentsForInstanceSet(is *v1alpha1.InstanceS } if len(deployments) == 0 { - return nil, fmt.Errorf("could not find deployments set for InstanceSet %s with labels: %v", is.Name, is.Labels) + return nil, fmt.Errorf("could not find deployments set for MachineSet %s with labels: %v", is.Name, is.Labels) } return deployments, nil } const ( - // RevisionAnnotation is the revision annotation of a deployment's instance sets which records its rollout sequence + // RevisionAnnotation is the revision annotation of a deployment's machine sets which records its rollout sequence RevisionAnnotation = "deployment.kubernetes.io/revision" - // RevisionHistoryAnnotation maintains the history of all old revisions that a instance set has served for a deployment. + // RevisionHistoryAnnotation maintains the history of all old revisions that a machine set has served for a deployment. RevisionHistoryAnnotation = "deployment.kubernetes.io/revision-history" // DesiredReplicasAnnotation is the desired replicas for a deployment recorded as an annotation - // in its instance sets. Helps in separating scaling events from the rollout process and for - // determining if the new instance set for a deployment is really saturated. + // in its machine sets. Helps in separating scaling events from the rollout process and for + // determining if the new machine set for a deployment is really saturated. DesiredReplicasAnnotation = "deployment.kubernetes.io/desired-replicas" // MaxReplicasAnnotation is the maximum replicas a deployment can have at a given point, which - // is deployment.spec.replicas + maxSurge. Used by the underlying instance sets to estimate their + // is deployment.spec.replicas + maxSurge. Used by the underlying machine sets to estimate their // proportions in case the deployment has surge replicas. MaxReplicasAnnotation = "deployment.kubernetes.io/max-replicas" @@ -117,28 +117,28 @@ const ( // // Progressing: // - // InstanceSetUpdatedReason is added in a deployment when one of its instance sets is updated as part + // MachineSetUpdatedReason is added in a deployment when one of its machine sets is updated as part // of the rollout process. - InstanceSetUpdatedReason = "InstanceSetUpdated" - // FailedRSCreateReason is added in a deployment when it cannot create a new instance set. - FailedISCreateReason = "InstanceSetCreateError" - // NewInstanceSetReason is added in a deployment when it creates a new instance set. - NewInstanceSetReason = "NewInstanceSetCreated" - // FoundNewRSReason is added in a deployment when it adopts an existing instance set. - FoundNewISReason = "FoundNewInstanceSet" - // NewRSAvailableReason is added in a deployment when its newest instance set is made available - // ie. the number of new instances that have passed readiness checks and run for at least minReadySeconds - // is at least the minimum available instances that need to run for the deployment. - NewISAvailableReason = "NewInstanceSetAvailable" - // TimedOutReason is added in a deployment when its newest instance set fails to show any progress + MachineSetUpdatedReason = "MachineSetUpdated" + // FailedRSCreateReason is added in a deployment when it cannot create a new machine set. + FailedISCreateReason = "MachineSetCreateError" + // NewMachineSetReason is added in a deployment when it creates a new machine set. + NewMachineSetReason = "NewMachineSetCreated" + // FoundNewRSReason is added in a deployment when it adopts an existing machine set. + FoundNewISReason = "FoundNewMachineSet" + // NewRSAvailableReason is added in a deployment when its newest machine set is made available + // ie. the number of new machines that have passed readiness checks and run for at least minReadySeconds + // is at least the minimum available machines that need to run for the deployment. + NewISAvailableReason = "NewMachineSetAvailable" + // TimedOutReason is added in a deployment when its newest machine set fails to show any progress // within the given deadline (progressDeadlineSeconds). TimedOutReason = "ProgressDeadlineExceeded" // PausedDeployReason is added in a deployment when it is paused. Lack of progress shouldn't be // estimated once a deployment is paused. - PausedInstanceDeployReason = "DeploymentPaused" + PausedMachineDeployReason = "DeploymentPaused" // ResumedDeployReason is added in a deployment when it is resumed. Useful for not failing accidentally // deployments that paused amidst a rollout and are bounded by a deadline. - ResumedInstanceDeployReason = "DeploymentResumed" + ResumedMachineDeployReason = "DeploymentResumed" // // Available: // @@ -149,9 +149,9 @@ const ( MinimumReplicasUnavailable = "MinimumReplicasUnavailable" ) -// NewInstanceDeploymentCondition creates a new deployment condition. -func NewInstanceDeploymentCondition(condType v1alpha1.InstanceDeploymentConditionType, status v1alpha1.ConditionStatus, reason, message string) *v1alpha1.InstanceDeploymentCondition { - return &v1alpha1.InstanceDeploymentCondition{ +// NewMachineDeploymentCondition creates a new deployment condition. +func NewMachineDeploymentCondition(condType v1alpha1.MachineDeploymentConditionType, status v1alpha1.ConditionStatus, reason, message string) *v1alpha1.MachineDeploymentCondition { + return &v1alpha1.MachineDeploymentCondition{ Type: condType, Status: status, LastUpdateTime: metav1.Now(), @@ -161,8 +161,8 @@ func NewInstanceDeploymentCondition(condType v1alpha1.InstanceDeploymentConditio } } -// GetInstanceDeploymentCondition returns the condition with the provided type. -func GetInstanceDeploymentCondition(status v1alpha1.InstanceDeploymentStatus, condType v1alpha1.InstanceDeploymentConditionType) *v1alpha1.InstanceDeploymentCondition { +// GetMachineDeploymentCondition returns the condition with the provided type. +func GetMachineDeploymentCondition(status v1alpha1.MachineDeploymentStatus, condType v1alpha1.MachineDeploymentConditionType) *v1alpha1.MachineDeploymentCondition { for i := range status.Conditions { c := status.Conditions[i] if c.Type == condType { @@ -173,9 +173,9 @@ func GetInstanceDeploymentCondition(status v1alpha1.InstanceDeploymentStatus, co } // TODO: remove the duplicate -// GetInstanceDeploymentConditionInternal returns the condition with the provided type. +// GetMachineDeploymentConditionInternal returns the condition with the provided type. // Avoiding Internal versions, use standard versions only. -func GetInstanceDeploymentConditionInternal(status v1alpha1.InstanceDeploymentStatus, condType v1alpha1.InstanceDeploymentConditionType) *v1alpha1.InstanceDeploymentCondition { +func GetMachineDeploymentConditionInternal(status v1alpha1.MachineDeploymentStatus, condType v1alpha1.MachineDeploymentConditionType) *v1alpha1.MachineDeploymentCondition { for i := range status.Conditions { c := status.Conditions[i] if c.Type == condType { @@ -185,10 +185,10 @@ func GetInstanceDeploymentConditionInternal(status v1alpha1.InstanceDeploymentSt return nil } -// SetInstanceDeploymentCondition updates the deployment to include the provided condition. If the condition that +// SetMachineDeploymentCondition updates the deployment to include the provided condition. If the condition that // we are about to add already exists and has the same status and reason then we are not going to update. -func SetInstanceDeploymentCondition(status *v1alpha1.InstanceDeploymentStatus, condition v1alpha1.InstanceDeploymentCondition) { - currentCond := GetInstanceDeploymentCondition(*status, condition.Type) +func SetMachineDeploymentCondition(status *v1alpha1.MachineDeploymentStatus, condition v1alpha1.MachineDeploymentCondition) { + currentCond := GetMachineDeploymentCondition(*status, condition.Type) if currentCond != nil && currentCond.Status == condition.Status && currentCond.Reason == condition.Reason { return } @@ -200,14 +200,14 @@ func SetInstanceDeploymentCondition(status *v1alpha1.InstanceDeploymentStatus, c status.Conditions = append(newConditions, condition) } -// RemoveInstanceDeploymentCondition removes the deployment condition with the provided type. -func RemoveInstanceDeploymentCondition(status *v1alpha1.InstanceDeploymentStatus, condType v1alpha1.InstanceDeploymentConditionType) { +// RemoveMachineDeploymentCondition removes the deployment condition with the provided type. +func RemoveMachineDeploymentCondition(status *v1alpha1.MachineDeploymentStatus, condType v1alpha1.MachineDeploymentConditionType) { status.Conditions = filterOutDeploymentCondition(status.Conditions, condType) } // filterOutDeploymentCondition returns a new slice of deployment conditions without conditions with the provided type. -func filterOutDeploymentCondition(conditions []v1alpha1.InstanceDeploymentCondition, condType v1alpha1.InstanceDeploymentConditionType) []v1alpha1.InstanceDeploymentCondition { - var newConditions []v1alpha1.InstanceDeploymentCondition +func filterOutDeploymentCondition(conditions []v1alpha1.MachineDeploymentCondition, condType v1alpha1.MachineDeploymentConditionType) []v1alpha1.MachineDeploymentCondition { + var newConditions []v1alpha1.MachineDeploymentCondition for _, c := range conditions { if c.Type == condType { continue @@ -217,11 +217,11 @@ func filterOutDeploymentCondition(conditions []v1alpha1.InstanceDeploymentCondit return newConditions } -// InstanceSetToInstanceDeploymentCondition converts a instance set condition into a deployment condition. -// Useful for promoting instance set failure conditions into deployments. -func InstanceSetToInstanceDeploymentCondition(cond v1alpha1.InstanceSetCondition) v1alpha1.InstanceDeploymentCondition { - return v1alpha1.InstanceDeploymentCondition{ - Type: v1alpha1.InstanceDeploymentConditionType(cond.Type), +// MachineSetToMachineDeploymentCondition converts a machine set condition into a deployment condition. +// Useful for promoting machine set failure conditions into deployments. +func MachineSetToMachineDeploymentCondition(cond v1alpha1.MachineSetCondition) v1alpha1.MachineDeploymentCondition { + return v1alpha1.MachineDeploymentCondition{ + Type: v1alpha1.MachineDeploymentConditionType(cond.Type), Status: cond.Status, LastTransitionTime: cond.LastTransitionTime, LastUpdateTime: cond.LastTransitionTime, @@ -231,7 +231,7 @@ func InstanceSetToInstanceDeploymentCondition(cond v1alpha1.InstanceSetCondition } // SetDeploymentRevision updates the revision for a deployment. -func SetInstanceDeploymentRevision(deployment *v1alpha1.InstanceDeployment, revision string) bool { +func SetMachineDeploymentRevision(deployment *v1alpha1.MachineDeployment, revision string) bool { updated := false if deployment.Annotations == nil { @@ -245,13 +245,13 @@ func SetInstanceDeploymentRevision(deployment *v1alpha1.InstanceDeployment, revi return updated } -// MaxRevision finds the highest revision in the instance sets -func MaxRevision(allISs []*v1alpha1.InstanceSet) int64 { +// MaxRevision finds the highest revision in the machine sets +func MaxRevision(allISs []*v1alpha1.MachineSet) int64 { max := int64(0) for _, is := range allISs { if v, err := Revision(is); err != nil { - // Skip the instance sets when it failed to parse their revision information - glog.V(4).Infof("Error: %v. Couldn't parse revision for instance set %#v, instance deployment controller will skip it when reconciling revisions.", err, is) + // Skip the machine sets when it failed to parse their revision information + glog.V(4).Infof("Error: %v. Couldn't parse revision for machine set %#v, machine deployment controller will skip it when reconciling revisions.", err, is) } else if v > max { max = v } @@ -259,13 +259,13 @@ func MaxRevision(allISs []*v1alpha1.InstanceSet) int64 { return max } -// LastRevision finds the second max revision number in all instance sets (the last revision) -func LastRevision(allISs []*v1alpha1.InstanceSet) int64 { +// LastRevision finds the second max revision number in all machine sets (the last revision) +func LastRevision(allISs []*v1alpha1.MachineSet) int64 { max, secMax := int64(0), int64(0) for _, is := range allISs { if v, err := Revision(is); err != nil { - // Skip the instance sets when it failed to parse their revision information - glog.V(4).Infof("Error: %v. Couldn't parse revision for instance set %#v, instance deployment controller will skip it when reconciling revisions.", err, is) + // Skip the machine sets when it failed to parse their revision information + glog.V(4).Infof("Error: %v. Couldn't parse revision for machine set %#v, machine deployment controller will skip it when reconciling revisions.", err, is) } else if v >= max { secMax = max max = v @@ -289,12 +289,12 @@ func Revision(obj runtime.Object) (int64, error) { return strconv.ParseInt(v, 10, 64) } -// SetNewInstanceSetAnnotations sets new instance set's annotations appropriately by updating its revision and -// copying required deployment annotations to it; it returns true if instance set's annotation is changed. -func SetNewInstanceSetAnnotations(deployment *v1alpha1.InstanceDeployment, newIS *v1alpha1.InstanceSet, newRevision string, exists bool) bool { +// SetNewMachineSetAnnotations sets new machine set's annotations appropriately by updating its revision and +// copying required deployment annotations to it; it returns true if machine set's annotation is changed. +func SetNewMachineSetAnnotations(deployment *v1alpha1.MachineDeployment, newIS *v1alpha1.MachineSet, newRevision string, exists bool) bool { // First, copy deployment's annotations (except for apply and revision annotations) - annotationChanged := copyInstanceDeploymentAnnotationsToInstanceSet(deployment, newIS) - // Then, update instance set's revision annotation + annotationChanged := copyMachineDeploymentAnnotationsToMachineSet(deployment, newIS) + // Then, update machine set's revision annotation if newIS.Annotations == nil { newIS.Annotations = make(map[string]string) } @@ -306,7 +306,7 @@ func SetNewInstanceSetAnnotations(deployment *v1alpha1.InstanceDeployment, newIS oldRevisionInt, err := strconv.ParseInt(oldRevision, 10, 64) if err != nil { if oldRevision != "" { - glog.Warningf("Updating instance set revision OldRevision not int %s", err) + glog.Warningf("Updating machine set revision OldRevision not int %s", err) return false } //If the RS annotation is empty then initialise it to 0 @@ -314,16 +314,16 @@ func SetNewInstanceSetAnnotations(deployment *v1alpha1.InstanceDeployment, newIS } newRevisionInt, err := strconv.ParseInt(newRevision, 10, 64) if err != nil { - glog.Warningf("Updating instance set revision NewRevision not int %s", err) + glog.Warningf("Updating machine set revision NewRevision not int %s", err) return false } if oldRevisionInt < newRevisionInt { newIS.Annotations[RevisionAnnotation] = newRevision annotationChanged = true - glog.V(4).Infof("Updating instance set %q revision to %s", newIS.Name, newRevision) + glog.V(4).Infof("Updating machine set %q revision to %s", newIS.Name, newRevision) } - // If a revision annotation already existed and this instance set was updated with a new revision - // then that means we are rolling back to this instance set. We need to preserve the old revisions + // If a revision annotation already existed and this machine set was updated with a new revision + // then that means we are rolling back to this machine set. We need to preserve the old revisions // for historical information. if ok && annotationChanged { revisionHistoryAnnotation := newIS.Annotations[RevisionHistoryAnnotation] @@ -335,7 +335,7 @@ func SetNewInstanceSetAnnotations(deployment *v1alpha1.InstanceDeployment, newIS newIS.Annotations[RevisionHistoryAnnotation] = strings.Join(oldRevisions, ",") } } - // If the new instance set is about to be created, we need to add replica annotations to it. + // If the new machine set is about to be created, we need to add replica annotations to it. if !exists && SetReplicasAnnotations(newIS, (deployment.Spec.Replicas), (deployment.Spec.Replicas)+MaxSurge(*deployment)) { annotationChanged = true } @@ -357,16 +357,16 @@ func skipCopyAnnotation(key string) bool { return annotationsToSkip[key] } -// copyDeploymentAnnotationsToInstanceSet copies deployment's annotations to instance set's annotations, -// and returns true if instance set's annotation is changed. +// copyDeploymentAnnotationsToMachineSet copies deployment's annotations to machine set's annotations, +// and returns true if machine set's annotation is changed. // Note that apply and revision annotations are not copied. -func copyInstanceDeploymentAnnotationsToInstanceSet(deployment *v1alpha1.InstanceDeployment, is *v1alpha1.InstanceSet) bool { +func copyMachineDeploymentAnnotationsToMachineSet(deployment *v1alpha1.MachineDeployment, is *v1alpha1.MachineSet) bool { isAnnotationsChanged := false if is.Annotations == nil { is.Annotations = make(map[string]string) } for k, v := range deployment.Annotations { - // newRS revision is updated automatically in getNewInstanceSet, and the deployment's revision number is then updated + // newRS revision is updated automatically in getNewMachineSet, and the deployment's revision number is then updated // by copying its newRS revision number. We should not copy deployment's revision to its newRS, since the update of // deployment revision number may fail (revision becomes stale) and the revision number in newRS is more reliable. if skipCopyAnnotation(k) || is.Annotations[k] == v { @@ -381,7 +381,7 @@ func copyInstanceDeploymentAnnotationsToInstanceSet(deployment *v1alpha1.Instanc // SetDeploymentAnnotationsTo sets deployment's annotations as given RS's annotations. // This action should be done if and only if the deployment is rolling back to this rs. // Note that apply and revision annotations are not changed. -func SetInstanceDeploymentAnnotationsTo(deployment *v1alpha1.InstanceDeployment, rollbackToIS *v1alpha1.InstanceSet) { +func SetMachineDeploymentAnnotationsTo(deployment *v1alpha1.MachineDeployment, rollbackToIS *v1alpha1.MachineSet) { deployment.Annotations = getSkippedAnnotations(deployment.Annotations) for k, v := range rollbackToIS.Annotations { if !skipCopyAnnotation(k) { @@ -400,19 +400,19 @@ func getSkippedAnnotations(annotations map[string]string) map[string]string { return skippedAnnotations } -// FindActiveOrLatest returns the only active or the latest instance set in case there is at most one active -// instance set. If there are more active instance sets, then we should proportionally scale them. -func FindActiveOrLatest(newIS *v1alpha1.InstanceSet, oldISs []*v1alpha1.InstanceSet) *v1alpha1.InstanceSet { +// FindActiveOrLatest returns the only active or the latest machine set in case there is at most one active +// machine set. If there are more active machine sets, then we should proportionally scale them. +func FindActiveOrLatest(newIS *v1alpha1.MachineSet, oldISs []*v1alpha1.MachineSet) *v1alpha1.MachineSet { if newIS == nil && len(oldISs) == 0 { return nil } - sort.Sort(sort.Reverse(InstanceSetsByCreationTimestamp(oldISs))) - allISs := FilterActiveInstanceSets(append(oldISs, newIS)) + sort.Sort(sort.Reverse(MachineSetsByCreationTimestamp(oldISs))) + allISs := FilterActiveMachineSets(append(oldISs, newIS)) switch len(allISs) { case 0: - // If there is no active instance set then we should return the newest. + // If there is no active machine set then we should return the newest. if newIS != nil { return newIS } @@ -425,29 +425,29 @@ func FindActiveOrLatest(newIS *v1alpha1.InstanceSet, oldISs []*v1alpha1.Instance } // GetDesiredReplicasAnnotation returns the number of desired replicas -func GetDesiredReplicasAnnotation(is *v1alpha1.InstanceSet) (int32, bool) { +func GetDesiredReplicasAnnotation(is *v1alpha1.MachineSet) (int32, bool) { return getIntFromAnnotation(is, DesiredReplicasAnnotation) } -func getMaxReplicasAnnotation(is *v1alpha1.InstanceSet) (int32, bool) { +func getMaxReplicasAnnotation(is *v1alpha1.MachineSet) (int32, bool) { return getIntFromAnnotation(is, MaxReplicasAnnotation) } -func getIntFromAnnotation(is *v1alpha1.InstanceSet, annotationKey string) (int32, bool) { +func getIntFromAnnotation(is *v1alpha1.MachineSet, annotationKey string) (int32, bool) { annotationValue, ok := is.Annotations[annotationKey] if !ok { return int32(0), false } intValue, err := strconv.Atoi(annotationValue) if err != nil { - glog.V(2).Infof("Cannot convert the value %q with annotation key %q for the instance set %q", annotationValue, annotationKey, is.Name) + glog.V(2).Infof("Cannot convert the value %q with annotation key %q for the machine set %q", annotationValue, annotationKey, is.Name) return int32(0), false } return int32(intValue), true } // SetReplicasAnnotations sets the desiredReplicas and maxReplicas into the annotations -func SetReplicasAnnotations(is *v1alpha1.InstanceSet, desiredReplicas, maxReplicas int32) bool { +func SetReplicasAnnotations(is *v1alpha1.MachineSet, desiredReplicas, maxReplicas int32) bool { updated := false if is.Annotations == nil { is.Annotations = make(map[string]string) @@ -465,8 +465,8 @@ func SetReplicasAnnotations(is *v1alpha1.InstanceSet, desiredReplicas, maxReplic return updated } -// MaxUnavailable returns the maximum unavailable instances a rolling deployment can take. -func MaxUnavailable(deployment v1alpha1.InstanceDeployment) int32 { +// MaxUnavailable returns the maximum unavailable machines a rolling deployment can take. +func MaxUnavailable(deployment v1alpha1.MachineDeployment) int32 { if !IsRollingUpdate(&deployment) || (deployment.Spec.Replicas) == 0 { return int32(0) } @@ -478,16 +478,16 @@ func MaxUnavailable(deployment v1alpha1.InstanceDeployment) int32 { return maxUnavailable } -// MinAvailable returns the minimum available instances of a given deployment -func MinAvailable(deployment *v1alpha1.InstanceDeployment) int32 { +// MinAvailable returns the minimum available machines of a given deployment +func MinAvailable(deployment *v1alpha1.MachineDeployment) int32 { if !IsRollingUpdate(deployment) { return int32(0) } return (deployment.Spec.Replicas) - MaxUnavailable(*deployment) } -// MaxSurge returns the maximum surge instances a rolling deployment can take. -func MaxSurge(deployment v1alpha1.InstanceDeployment) int32 { +// MaxSurge returns the maximum surge machines a rolling deployment can take. +func MaxSurge(deployment v1alpha1.MachineDeployment) int32 { if !IsRollingUpdate(&deployment) { return int32(0) } @@ -496,33 +496,33 @@ func MaxSurge(deployment v1alpha1.InstanceDeployment) int32 { return maxSurge } -// GetProportion will estimate the proportion for the provided instance set using 1. the current size -// of the parent deployment, 2. the replica count that needs be added on the instance sets of the -// deployment, and 3. the total replicas added in the instance sets of the deployment so far. -func GetProportion(is *v1alpha1.InstanceSet, d v1alpha1.InstanceDeployment, deploymentReplicasToAdd, deploymentReplicasAdded int32) int32 { +// GetProportion will estimate the proportion for the provided machine set using 1. the current size +// of the parent deployment, 2. the replica count that needs be added on the machine sets of the +// deployment, and 3. the total replicas added in the machine sets of the deployment so far. +func GetProportion(is *v1alpha1.MachineSet, d v1alpha1.MachineDeployment, deploymentReplicasToAdd, deploymentReplicasAdded int32) int32 { if is == nil || (is.Spec.Replicas) == 0 || deploymentReplicasToAdd == 0 || deploymentReplicasToAdd == deploymentReplicasAdded { return int32(0) } - isFraction := getInstanceSetFraction(*is, d) + isFraction := getMachineSetFraction(*is, d) allowed := deploymentReplicasToAdd - deploymentReplicasAdded if deploymentReplicasToAdd > 0 { - // Use the minimum between the instance set fraction and the maximum allowed replicas + // Use the minimum between the machine set fraction and the maximum allowed replicas // when scaling up. This way we ensure we will not scale up more than the allowed // replicas we can add. return integer.Int32Min(isFraction, allowed) } - // Use the maximum between the instance set fraction and the maximum allowed replicas + // Use the maximum between the machine set fraction and the maximum allowed replicas // when scaling down. This way we ensure we will not scale down more than the allowed // replicas we can remove. return integer.Int32Max(isFraction, allowed) } -// getInstanceSetFraction estimates the fraction of replicas a instance set can have in +// getMachineSetFraction estimates the fraction of replicas a machine set can have in // 1. a scaling event during a rollout or 2. when scaling a paused deployment. -func getInstanceSetFraction(is v1alpha1.InstanceSet, d v1alpha1.InstanceDeployment) int32 { - // If we are scaling down to zero then the fraction of this instance set is its whole size (negative) +func getMachineSetFraction(is v1alpha1.MachineSet, d v1alpha1.MachineDeployment) int32 { + // If we are scaling down to zero then the fraction of this machine set is its whole size (negative) if (d.Spec.Replicas) == int32(0) { return -(is.Spec.Replicas) } @@ -531,7 +531,7 @@ func getInstanceSetFraction(is v1alpha1.InstanceSet, d v1alpha1.InstanceDeployme annotatedReplicas, ok := getMaxReplicasAnnotation(&is) if !ok { // If we cannot find the annotation then fallback to the current deployment size. Note that this - // will not be an accurate proportion estimation in case other instance sets have different values + // will not be an accurate proportion estimation in case other machine sets have different values // which means that the deployment was scaled at some point but we at least will stay in limits // due to the min-max comparisons in getProportion. annotatedReplicas = d.Status.Replicas @@ -543,48 +543,48 @@ func getInstanceSetFraction(is v1alpha1.InstanceSet, d v1alpha1.InstanceDeployme return integer.RoundToInt32(newISsize) - (is.Spec.Replicas) } -// GetAllInstanceSets returns the old and new instance sets targeted by the given Deployment. It gets InstanceList and InstanceSetList from client interface. -// Note that the first set of old instance sets doesn't include the ones with no instances, and the second set of old instance sets include all old instance sets. -// The third returned value is the new instance set, and it may be nil if it doesn't exist yet. -func GetAllInstanceSets(deployment *v1alpha1.InstanceDeployment, c v1alpha1client.NodeV1alpha1Interface) ([]*v1alpha1.InstanceSet, []*v1alpha1.InstanceSet, *v1alpha1.InstanceSet, error) { - isList, err := ListInstanceSets(deployment, IsListFromClient(c)) +// GetAllMachineSets returns the old and new machine sets targeted by the given Deployment. It gets MachineList and MachineSetList from client interface. +// Note that the first set of old machine sets doesn't include the ones with no machines, and the second set of old machine sets include all old machine sets. +// The third returned value is the new machine set, and it may be nil if it doesn't exist yet. +func GetAllMachineSets(deployment *v1alpha1.MachineDeployment, c v1alpha1client.MachineV1alpha1Interface) ([]*v1alpha1.MachineSet, []*v1alpha1.MachineSet, *v1alpha1.MachineSet, error) { + isList, err := ListMachineSets(deployment, IsListFromClient(c)) if err != nil { return nil, nil, nil, err } - oldISes, allOldISes := FindOldInstanceSets(deployment, isList) - newIS := FindNewInstanceSet(deployment, isList) + oldISes, allOldISes := FindOldMachineSets(deployment, isList) + newIS := FindNewMachineSet(deployment, isList) return oldISes, allOldISes, newIS, nil } -// GetOldInstanceSets returns the old instance sets targeted by the given Deployment; get InstanceList and InstanceSetList from client interface. -// Note that the first set of old instance sets doesn't include the ones with no instances, and the second set of old instance sets include all old instance sets. -func GetOldInstanceSets(deployment *v1alpha1.InstanceDeployment, c v1alpha1client.NodeV1alpha1Interface) ([]*v1alpha1.InstanceSet, []*v1alpha1.InstanceSet, error) { - rsList, err := ListInstanceSets(deployment, IsListFromClient(c)) +// GetOldMachineSets returns the old machine sets targeted by the given Deployment; get MachineList and MachineSetList from client interface. +// Note that the first set of old machine sets doesn't include the ones with no machines, and the second set of old machine sets include all old machine sets. +func GetOldMachineSets(deployment *v1alpha1.MachineDeployment, c v1alpha1client.MachineV1alpha1Interface) ([]*v1alpha1.MachineSet, []*v1alpha1.MachineSet, error) { + rsList, err := ListMachineSets(deployment, IsListFromClient(c)) if err != nil { return nil, nil, err } - oldRSes, allOldRSes := FindOldInstanceSets(deployment, rsList) + oldRSes, allOldRSes := FindOldMachineSets(deployment, rsList) return oldRSes, allOldRSes, nil } -// GetNewInstanceSet returns a instance set that matches the intent of the given deployment; get InstanceSetList from client interface. -// Returns nil if the new instance set doesn't exist yet. -func GetNewInstanceSet(deployment *v1alpha1.InstanceDeployment, c v1alpha1client.NodeV1alpha1Interface) (*v1alpha1.InstanceSet, error) { - rsList, err := ListInstanceSets(deployment, IsListFromClient(c)) +// GetNewMachineSet returns a machine set that matches the intent of the given deployment; get MachineSetList from client interface. +// Returns nil if the new machine set doesn't exist yet. +func GetNewMachineSet(deployment *v1alpha1.MachineDeployment, c v1alpha1client.MachineV1alpha1Interface) (*v1alpha1.MachineSet, error) { + rsList, err := ListMachineSets(deployment, IsListFromClient(c)) if err != nil { return nil, err } - return FindNewInstanceSet(deployment, rsList), nil + return FindNewMachineSet(deployment, rsList), nil } // RsListFromClient returns an rsListFunc that wraps the given client. -func IsListFromClient(c v1alpha1client.NodeV1alpha1Interface) IsListFunc { - return func(namespace string, options metav1.ListOptions) ([]*v1alpha1.InstanceSet, error) { - isList, err := c.InstanceSets().List(options) +func IsListFromClient(c v1alpha1client.MachineV1alpha1Interface) IsListFunc { + return func(namespace string, options metav1.ListOptions) ([]*v1alpha1.MachineSet, error) { + isList, err := c.MachineSets().List(options) if err != nil { return nil, err } - var ret []*v1alpha1.InstanceSet + var ret []*v1alpha1.MachineSet for i := range isList.Items { ret = append(ret, &isList.Items[i]) } @@ -593,15 +593,15 @@ func IsListFromClient(c v1alpha1client.NodeV1alpha1Interface) IsListFunc { } // TODO: switch this to full namespacers -type IsListFunc func(string, metav1.ListOptions) ([]*v1alpha1.InstanceSet, error) -type instanceListFunc func(string, metav1.ListOptions) (*v1alpha1.InstanceList, error) +type IsListFunc func(string, metav1.ListOptions) ([]*v1alpha1.MachineSet, error) +type machineListFunc func(string, metav1.ListOptions) (*v1alpha1.MachineList, error) -// ListInstanceSets returns a slice of RSes the given deployment targets. +// ListMachineSets returns a slice of RSes the given deployment targets. // Note that this does NOT attempt to reconcile ControllerRef (adopt/orphan), // because only the controller itself should do that. // However, it does filter out anything whose ControllerRef doesn't match. -func ListInstanceSets(deployment *v1alpha1.InstanceDeployment, getISList IsListFunc) ([]*v1alpha1.InstanceSet, error) { - // TODO: Right now we list instance sets by their labels. We should list them by selector, i.e. the instance set's selector +func ListMachineSets(deployment *v1alpha1.MachineDeployment, getISList IsListFunc) ([]*v1alpha1.MachineSet, error) { + // TODO: Right now we list machine sets by their labels. We should list them by selector, i.e. the machine set's selector // should be a superset of the deployment's selector, see https://github.com/kubernetes/kubernetes/issues/19830. namespace := deployment.Namespace selector, err := metav1.LabelSelectorAsSelector(deployment.Spec.Selector) @@ -614,7 +614,7 @@ func ListInstanceSets(deployment *v1alpha1.InstanceDeployment, getISList IsListF return nil, err } // Only include those whose ControllerRef matches the Deployment. - owned := make([]*v1alpha1.InstanceSet, 0, len(all)) + owned := make([]*v1alpha1.MachineSet, 0, len(all)) for _, is := range all { if metav1.IsControlledBy(is, deployment) { owned = append(owned, is) @@ -623,9 +623,9 @@ func ListInstanceSets(deployment *v1alpha1.InstanceDeployment, getISList IsListF return owned, nil } -// ListInstanceSetsInternal is ListInstanceSets for v1alpha1. -// TODO: Remove the duplicate when call sites are updated to ListInstanceSets. -func ListInstanceSetsInternal(deployment *v1alpha1.InstanceDeployment, getISList func(string, metav1.ListOptions) ([]*v1alpha1.InstanceSet, error)) ([]*v1alpha1.InstanceSet, error) { +// ListMachineSetsInternal is ListMachineSets for v1alpha1. +// TODO: Remove the duplicate when call sites are updated to ListMachineSets. +func ListMachineSetsInternal(deployment *v1alpha1.MachineDeployment, getISList func(string, metav1.ListOptions) ([]*v1alpha1.MachineSet, error)) ([]*v1alpha1.MachineSet, error) { namespace := deployment.Namespace selector, err := metav1.LabelSelectorAsSelector(deployment.Spec.Selector) if err != nil { @@ -637,7 +637,7 @@ func ListInstanceSetsInternal(deployment *v1alpha1.InstanceDeployment, getISList return nil, err } // Only include those whose ControllerRef matches the Deployment. - filtered := make([]*v1alpha1.InstanceSet, 0, len(all)) + filtered := make([]*v1alpha1.MachineSet, 0, len(all)) for _, is := range all { if metav1.IsControlledBy(is, deployment) { filtered = append(filtered, is) @@ -647,39 +647,39 @@ func ListInstanceSetsInternal(deployment *v1alpha1.InstanceDeployment, getISList } -func ListInstances(deployment *v1alpha1.InstanceDeployment, isList []*v1alpha1.InstanceSet, getInstanceList instanceListFunc) (*v1alpha1.InstanceList, error) { +func ListMachines(deployment *v1alpha1.MachineDeployment, isList []*v1alpha1.MachineSet, getMachineList machineListFunc) (*v1alpha1.MachineList, error) { namespace := deployment.Namespace selector, err := metav1.LabelSelectorAsSelector(deployment.Spec.Selector) if err != nil { return nil, err } options := metav1.ListOptions{LabelSelector: selector.String()} - all, err := getInstanceList(namespace, options) + all, err := getMachineList(namespace, options) if err != nil { return all, err } - // Only include those whose ControllerRef points to a InstanceSet that is in + // Only include those whose ControllerRef points to a MachineSet that is in // turn owned by this Deployment. isMap := make(map[types.UID]bool, len(isList)) for _, is := range isList { isMap[is.UID] = true } - owned := &v1alpha1.InstanceList{Items: make([]v1alpha1.Instance, 0, len(all.Items))} + owned := &v1alpha1.MachineList{Items: make([]v1alpha1.Machine, 0, len(all.Items))} for i := range all.Items { - instance := &all.Items[i] - controllerRef := metav1.GetControllerOf(instance) + machine := &all.Items[i] + controllerRef := metav1.GetControllerOf(machine) if controllerRef != nil && isMap[controllerRef.UID] { - owned.Items = append(owned.Items, *instance) + owned.Items = append(owned.Items, *machine) } } return owned, nil } -// EqualIgnoreHash returns true if two given instanceTemplateSpec are equal, ignoring the diff in value of Labels[instance-template-hash] -// We ignore instance-template-hash because the hash result would be different upon instanceTemplateSpec API changes +// EqualIgnoreHash returns true if two given machineTemplateSpec are equal, ignoring the diff in value of Labels[machine-template-hash] +// We ignore machine-template-hash because the hash result would be different upon machineTemplateSpec API changes // (e.g. the addition of a new field will cause the hash code to change) -// Note that we assume input instanceTemplateSpecs contain non-empty labels -func EqualIgnoreHash(template1, template2 *v1alpha1.InstanceTemplateSpec) bool { +// Note that we assume input machineTemplateSpecs contain non-empty labels +func EqualIgnoreHash(template1, template2 *v1alpha1.MachineTemplateSpec) bool { t1Copy := template1.DeepCopy() t2Copy := template2.DeepCopy() // First, compare template.Labels (ignoring hash) @@ -689,7 +689,7 @@ func EqualIgnoreHash(template1, template2 *v1alpha1.InstanceTemplateSpec) bool { } // We make sure len(labels2) >= len(labels1) for k, v := range labels2 { - if labels1[k] != v && k != v1alpha1.DefaultInstanceDeploymentUniqueLabelKey { + if labels1[k] != v && k != v1alpha1.DefaultMachineDeploymentUniqueLabelKey { return false } } @@ -698,30 +698,30 @@ func EqualIgnoreHash(template1, template2 *v1alpha1.InstanceTemplateSpec) bool { return apiequality.Semantic.DeepEqual(t1Copy, t2Copy) } -// FindNewInstanceSet returns the new RS this given deployment targets (the one with the same instance template). -func FindNewInstanceSet(deployment *v1alpha1.InstanceDeployment, isList []*v1alpha1.InstanceSet) *v1alpha1.InstanceSet { - sort.Sort(InstanceSetsByCreationTimestamp(isList)) +// FindNewMachineSet returns the new RS this given deployment targets (the one with the same machine template). +func FindNewMachineSet(deployment *v1alpha1.MachineDeployment, isList []*v1alpha1.MachineSet) *v1alpha1.MachineSet { + sort.Sort(MachineSetsByCreationTimestamp(isList)) for i := range isList { if EqualIgnoreHash(&isList[i].Spec.Template, &deployment.Spec.Template) { // In rare cases, such as after cluster upgrades, Deployment may end up with - // having more than one new InstanceSets that have the same template as its template, + // having more than one new MachineSets that have the same template as its template, // see https://github.com/kubernetes/kubernetes/issues/40415 - // We deterministically choose the oldest new InstanceSet. + // We deterministically choose the oldest new MachineSet. return isList[i] } } - // new InstanceSet does not exist. + // new MachineSet does not exist. return nil } -// FindOldInstanceSets returns the old instance sets targeted by the given Deployment, with the given slice of RSes. -// Note that the first set of old instance sets doesn't include the ones with no instances, and the second set of old instance sets include all old instance sets. -func FindOldInstanceSets(deployment *v1alpha1.InstanceDeployment, isList []*v1alpha1.InstanceSet) ([]*v1alpha1.InstanceSet, []*v1alpha1.InstanceSet) { - var requiredISs []*v1alpha1.InstanceSet - var allISs []*v1alpha1.InstanceSet - newIS := FindNewInstanceSet(deployment, isList) +// FindOldMachineSets returns the old machine sets targeted by the given Deployment, with the given slice of RSes. +// Note that the first set of old machine sets doesn't include the ones with no machines, and the second set of old machine sets include all old machine sets. +func FindOldMachineSets(deployment *v1alpha1.MachineDeployment, isList []*v1alpha1.MachineSet) ([]*v1alpha1.MachineSet, []*v1alpha1.MachineSet) { + var requiredISs []*v1alpha1.MachineSet + var allISs []*v1alpha1.MachineSet + newIS := FindNewMachineSet(deployment, isList) for _, is := range isList { - // Filter out new instance set + // Filter out new machine set if newIS != nil && is.UID == newIS.UID { continue } @@ -733,8 +733,8 @@ func FindOldInstanceSets(deployment *v1alpha1.InstanceDeployment, isList []*v1al return requiredISs, allISs } -// WaitForInstanceSetUpdated polls the instance set until it is updated. -func WaitForInstanceSetUpdated(c v1alpha1listers.InstanceSetLister, desiredGeneration int64, namespace, name string) error { +// WaitForMachineSetUpdated polls the machine set until it is updated. +func WaitForMachineSetUpdated(c v1alpha1listers.MachineSetLister, desiredGeneration int64, namespace, name string) error { return wait.PollImmediate(1*time.Second, 1*time.Minute, func() (bool, error) { is, err := c.Get(name) if err != nil { @@ -744,8 +744,8 @@ func WaitForInstanceSetUpdated(c v1alpha1listers.InstanceSetLister, desiredGener }) } -// WaitForInstancesHashPopulated polls the instance set until updated and fully labeled. -func WaitForInstancesHashPopulated(c v1alpha1listers.InstanceSetLister, desiredGeneration int64, namespace, name string) error { +// WaitForMachinesHashPopulated polls the machine set until updated and fully labeled. +func WaitForMachinesHashPopulated(c v1alpha1listers.MachineSetLister, desiredGeneration int64, namespace, name string) error { return wait.PollImmediate(1*time.Second, 1*time.Minute, func() (bool, error) { is, err := c.Get(name) if err != nil { @@ -756,47 +756,47 @@ func WaitForInstancesHashPopulated(c v1alpha1listers.InstanceSetLister, desiredG }) } -// LabelInstancesWithHash labels all instances in the given instanceList with the new hash label. -func LabelInstancesWithHash(instanceList *v1alpha1.InstanceList, c v1alpha1client.NodeV1alpha1Interface , instanceLister v1alpha1listers.InstanceLister, namespace, name, hash string) error { - for _, instance := range instanceList.Items { - // Ignore inactive Instances. - if !IsInstanceActive(&instance) { +// LabelMachinesWithHash labels all machines in the given machineList with the new hash label. +func LabelMachinesWithHash(machineList *v1alpha1.MachineList, c v1alpha1client.MachineV1alpha1Interface , machineLister v1alpha1listers.MachineLister, namespace, name, hash string) error { + for _, machine := range machineList.Items { + // Ignore inactive Machines. + if !IsMachineActive(&machine) { continue } - // Only label the instance that doesn't already have the new hash - if instance.Labels[v1alpha1.DefaultInstanceDeploymentUniqueLabelKey] != hash { - _, err := UpdateInstanceWithRetries(c.Instances(), instanceLister, instance.Namespace, instance.Name, - func(instanceToUpdate *v1alpha1.Instance) error { - // Precondition: the instance doesn't contain the new hash in its label. - if instanceToUpdate.Labels[v1alpha1.DefaultInstanceDeploymentUniqueLabelKey] == hash { + // Only label the machine that doesn't already have the new hash + if machine.Labels[v1alpha1.DefaultMachineDeploymentUniqueLabelKey] != hash { + _, err := UpdateMachineWithRetries(c.Machines(), machineLister, machine.Namespace, machine.Name, + func(machineToUpdate *v1alpha1.Machine) error { + // Precondition: the machine doesn't contain the new hash in its label. + if machineToUpdate.Labels[v1alpha1.DefaultMachineDeploymentUniqueLabelKey] == hash { return errors.ErrPreconditionViolated } - instanceToUpdate.Labels = labelsutil.AddLabel(instanceToUpdate.Labels, v1alpha1.DefaultInstanceDeploymentUniqueLabelKey, hash) + machineToUpdate.Labels = labelsutil.AddLabel(machineToUpdate.Labels, v1alpha1.DefaultMachineDeploymentUniqueLabelKey, hash) return nil }) if err != nil { - return fmt.Errorf("error in adding template hash label %s to instance %q: %v", hash, instance.Name, err) + return fmt.Errorf("error in adding template hash label %s to machine %q: %v", hash, machine.Name, err) } - glog.V(4).Infof("Labeled instance %s/%s of InstanceSet %s/%s with hash %s.", instance.Namespace, instance.Name, namespace, name, hash) + glog.V(4).Infof("Labeled machine %s/%s of MachineSet %s/%s with hash %s.", machine.Namespace, machine.Name, namespace, name, hash) } } return nil } -// SetFromInstanceSetTemplate sets the desired InstanceTemplateSpec from a instance set template to the given deployment. -func SetFromInstanceSetTemplate(deployment *v1alpha1.InstanceDeployment, template v1alpha1.InstanceTemplateSpec) *v1alpha1.InstanceDeployment { +// SetFromMachineSetTemplate sets the desired MachineTemplateSpec from a machine set template to the given deployment. +func SetFromMachineSetTemplate(deployment *v1alpha1.MachineDeployment, template v1alpha1.MachineTemplateSpec) *v1alpha1.MachineDeployment { deployment.Spec.Template.ObjectMeta = template.ObjectMeta deployment.Spec.Template.Spec = template.Spec deployment.Spec.Template.ObjectMeta.Labels = labelsutil.CloneAndRemoveLabel( deployment.Spec.Template.ObjectMeta.Labels, - v1alpha1.DefaultInstanceDeploymentUniqueLabelKey) + v1alpha1.DefaultMachineDeploymentUniqueLabelKey) return deployment } -// GetReplicaCountForInstanceSets returns the sum of Replicas of the given instance sets. -func GetReplicaCountForInstanceSets(InstanceSets []*v1alpha1.InstanceSet) int32 { +// GetReplicaCountForMachineSets returns the sum of Replicas of the given machine sets. +func GetReplicaCountForMachineSets(MachineSets []*v1alpha1.MachineSet) int32 { totalReplicas := int32(0) - for _, is := range InstanceSets { + for _, is := range MachineSets { if is != nil { totalReplicas += (is.Spec.Replicas) } @@ -804,10 +804,10 @@ func GetReplicaCountForInstanceSets(InstanceSets []*v1alpha1.InstanceSet) int32 return totalReplicas } -// GetActualReplicaCountForInstanceSets returns the sum of actual replicas of the given instance sets. -func GetActualReplicaCountForInstanceSets(InstanceSets []*v1alpha1.InstanceSet) int32 { +// GetActualReplicaCountForMachineSets returns the sum of actual replicas of the given machine sets. +func GetActualReplicaCountForMachineSets(MachineSets []*v1alpha1.MachineSet) int32 { totalActualReplicas := int32(0) - for _, is := range InstanceSets { + for _, is := range MachineSets { if is != nil { totalActualReplicas += is.Status.Replicas } @@ -815,10 +815,10 @@ func GetActualReplicaCountForInstanceSets(InstanceSets []*v1alpha1.InstanceSet) return totalActualReplicas } -// GetReadyReplicaCountForInstanceSets returns the number of ready instances corresponding to the given instance sets. -func GetReadyReplicaCountForInstanceSets(InstanceSets []*v1alpha1.InstanceSet) int32 { +// GetReadyReplicaCountForMachineSets returns the number of ready machines corresponding to the given machine sets. +func GetReadyReplicaCountForMachineSets(MachineSets []*v1alpha1.MachineSet) int32 { totalReadyReplicas := int32(0) - for _, is := range InstanceSets { + for _, is := range MachineSets { if is != nil { totalReadyReplicas += is.Status.ReadyReplicas } @@ -826,10 +826,10 @@ func GetReadyReplicaCountForInstanceSets(InstanceSets []*v1alpha1.InstanceSet) i return totalReadyReplicas } -// GetAvailableReplicaCountForInstanceSets returns the number of available instances corresponding to the given instance sets. -func GetAvailableReplicaCountForInstanceSets(InstanceSets []*v1alpha1.InstanceSet) int32 { +// GetAvailableReplicaCountForMachineSets returns the number of available machines corresponding to the given machine sets. +func GetAvailableReplicaCountForMachineSets(MachineSets []*v1alpha1.MachineSet) int32 { totalAvailableReplicas := int32(0) - for _, is := range InstanceSets { + for _, is := range MachineSets { if is != nil { totalAvailableReplicas += is.Status.AvailableReplicas } @@ -838,13 +838,13 @@ func GetAvailableReplicaCountForInstanceSets(InstanceSets []*v1alpha1.InstanceSe } // IsRollingUpdate returns true if the strategy type is a rolling update. -func IsRollingUpdate(deployment *v1alpha1.InstanceDeployment) bool { - return deployment.Spec.Strategy.Type == v1alpha1.RollingUpdateInstanceDeploymentStrategyType +func IsRollingUpdate(deployment *v1alpha1.MachineDeployment) bool { + return deployment.Spec.Strategy.Type == v1alpha1.RollingUpdateMachineDeploymentStrategyType } // DeploymentComplete considers a deployment to be complete once all of its desired replicas -// are updated and available, and no old instances are running. -func InstanceDeploymentComplete(deployment *v1alpha1.InstanceDeployment, newStatus *v1alpha1.InstanceDeploymentStatus) bool { +// are updated and available, and no old machines are running. +func MachineDeploymentComplete(deployment *v1alpha1.MachineDeployment, newStatus *v1alpha1.MachineDeploymentStatus) bool { return newStatus.UpdatedReplicas == (deployment.Spec.Replicas) && newStatus.Replicas == (deployment.Spec.Replicas) && newStatus.AvailableReplicas == (deployment.Spec.Replicas) && @@ -853,9 +853,9 @@ func InstanceDeploymentComplete(deployment *v1alpha1.InstanceDeployment, newStat // DeploymentProgressing reports progress for a deployment. Progress is estimated by comparing the // current with the new status of the deployment that the controller is observing. More specifically, -// when new instances are scaled up or become ready or available, or old instances are scaled down, then we +// when new machines are scaled up or become ready or available, or old machines are scaled down, then we // consider the deployment is progressing. -func InstanceDeploymentProgressing(deployment *v1alpha1.InstanceDeployment, newStatus *v1alpha1.InstanceDeploymentStatus) bool { +func MachineDeploymentProgressing(deployment *v1alpha1.MachineDeployment, newStatus *v1alpha1.MachineDeploymentStatus) bool { oldStatus := deployment.Status // Old replicas that need to be scaled down @@ -874,7 +874,7 @@ var nowFn = func() time.Time { return time.Now() } // DeploymentTimedOut considers a deployment to have timed out once its condition that reports progress // is older than progressDeadlineSeconds or a Progressing condition with a TimedOutReason reason already // exists. -func InstanceDeploymentTimedOut(deployment *v1alpha1.InstanceDeployment, newStatus *v1alpha1.InstanceDeploymentStatus) bool { +func MachineDeploymentTimedOut(deployment *v1alpha1.MachineDeployment, newStatus *v1alpha1.MachineDeploymentStatus) bool { if deployment.Spec.ProgressDeadlineSeconds == nil { return false } @@ -882,7 +882,7 @@ func InstanceDeploymentTimedOut(deployment *v1alpha1.InstanceDeployment, newStat // Look for the Progressing condition. If it doesn't exist, we have no base to estimate progress. // If it's already set with a TimedOutReason reason, we have already timed out, no need to check // again. - condition := GetInstanceDeploymentCondition(*newStatus, v1alpha1.InstanceDeploymentProgressing) + condition := GetMachineDeploymentCondition(*newStatus, v1alpha1.MachineDeploymentProgressing) if condition == nil { return false } @@ -891,9 +891,9 @@ func InstanceDeploymentTimedOut(deployment *v1alpha1.InstanceDeployment, newStat // // * progressDeadlineSeconds is smaller than the difference between now and the time // the last rollout finished in the past. - // * the creation of a new InstanceSet triggers a resync of the Deployment prior to the + // * the creation of a new MachineSet triggers a resync of the Deployment prior to the // cached copy of the Deployment getting updated with the status.condition that indicates - // the creation of the new InstanceSet. + // the creation of the new MachineSet. // // The Deployment will be resynced and eventually its Progressing condition will catch // up with the state of the world. @@ -905,53 +905,53 @@ func InstanceDeploymentTimedOut(deployment *v1alpha1.InstanceDeployment, newStat } // Look at the difference in seconds between now and the last time we reported any - // progress or tried to create a instance set, or resumed a paused deployment and + // progress or tried to create a machine set, or resumed a paused deployment and // compare against progressDeadlineSeconds. from := condition.LastUpdateTime now := nowFn() delta := time.Duration(*deployment.Spec.ProgressDeadlineSeconds) * time.Second timedOut := from.Add(delta).Before(now) - glog.V(4).Infof("InstanceDeployment %q timed out (%t) [last progress check: %v - now: %v]", deployment.Name, timedOut, from, now) + glog.V(4).Infof("MachineDeployment %q timed out (%t) [last progress check: %v - now: %v]", deployment.Name, timedOut, from, now) return timedOut } // NewRSNewReplicas calculates the number of replicas a deployment's new RS should have. // When one of the followings is true, we're rolling out the deployment; otherwise, we're scaling it. // 1) The new RS is saturated: newRS's replicas == deployment's replicas -// 2) Max number of instances allowed is reached: deployment's replicas + maxSurge == all RSs' replicas -func NewISNewReplicas(deployment *v1alpha1.InstanceDeployment, allISs []*v1alpha1.InstanceSet, newIS *v1alpha1.InstanceSet) (int32, error) { +// 2) Max number of machines allowed is reached: deployment's replicas + maxSurge == all RSs' replicas +func NewISNewReplicas(deployment *v1alpha1.MachineDeployment, allISs []*v1alpha1.MachineSet, newIS *v1alpha1.MachineSet) (int32, error) { switch deployment.Spec.Strategy.Type { - case v1alpha1.RollingUpdateInstanceDeploymentStrategyType: + case v1alpha1.RollingUpdateMachineDeploymentStrategyType: // Check if we can scale up. maxSurge, err := intstrutil.GetValueFromIntOrPercent(deployment.Spec.Strategy.RollingUpdate.MaxSurge, int((deployment.Spec.Replicas)), true) if err != nil { return 0, err } - // Find the total number of instances - currentInstanceCount := GetReplicaCountForInstanceSets(allISs) - maxTotalInstances := (deployment.Spec.Replicas) + int32(maxSurge) - if currentInstanceCount >= maxTotalInstances { + // Find the total number of machines + currentMachineCount := GetReplicaCountForMachineSets(allISs) + maxTotalMachines := (deployment.Spec.Replicas) + int32(maxSurge) + if currentMachineCount >= maxTotalMachines { // Cannot scale up. return (newIS.Spec.Replicas), nil } // Scale up. - scaleUpCount := maxTotalInstances - currentInstanceCount + scaleUpCount := maxTotalMachines - currentMachineCount // Do not exceed the number of desired replicas. scaleUpCount = int32(integer.IntMin(int(scaleUpCount), int((deployment.Spec.Replicas)-(newIS.Spec.Replicas)))) return (newIS.Spec.Replicas) + scaleUpCount, nil - case v1alpha1.RecreateInstanceDeploymentStrategyType: + case v1alpha1.RecreateMachineDeploymentStrategyType: return (deployment.Spec.Replicas), nil default: - return 0, fmt.Errorf("instance deployment type %v isn't supported", deployment.Spec.Strategy.Type) + return 0, fmt.Errorf("machine deployment type %v isn't supported", deployment.Spec.Strategy.Type) } } -// IsSaturated checks if the new instance set is saturated by comparing its size with its deployment size. -// Both the deployment and the instance set have to believe this instance set can own all of the desired -// replicas in the deployment and the annotation helps in achieving that. All instances of the InstanceSet +// IsSaturated checks if the new machine set is saturated by comparing its size with its deployment size. +// Both the deployment and the machine set have to believe this machine set can own all of the desired +// replicas in the deployment and the annotation helps in achieving that. All machines of the MachineSet // need to be available. -func IsSaturated(deployment *v1alpha1.InstanceDeployment, is *v1alpha1.InstanceSet) bool { +func IsSaturated(deployment *v1alpha1.MachineDeployment, is *v1alpha1.MachineSet) bool { if is == nil { return false } @@ -967,7 +967,7 @@ func IsSaturated(deployment *v1alpha1.InstanceDeployment, is *v1alpha1.InstanceS // WaitForObservedDeployment polls for deployment to be updated so that deployment.Status.ObservedGeneration >= desiredGeneration. // Returns error if polling timesout. -func WaitForObservedInstanceDeployment(getDeploymentFunc func() (*v1alpha1.InstanceDeployment, error), desiredGeneration int64, interval, timeout time.Duration) error { +func WaitForObservedMachineDeployment(getDeploymentFunc func() (*v1alpha1.MachineDeployment, error), desiredGeneration int64, interval, timeout time.Duration) error { // TODO: This should take clientset.Interface when all code is updated to use clientset. Keeping it this way allows the function to be used by callers who have client.Interface. return wait.PollImmediate(interval, timeout, func() (bool, error) { deployment, err := getDeploymentFunc() @@ -981,7 +981,7 @@ func WaitForObservedInstanceDeployment(getDeploymentFunc func() (*v1alpha1.Insta // TODO: remove the duplicate // WaitForObservedInternalDeployment polls for deployment to be updated so that deployment.Status.ObservedGeneration >= desiredGeneration. // Returns error if polling timesout. -func WaitForObservedDeploymentInternal(getDeploymentFunc func() (*v1alpha1.InstanceDeployment, error), desiredGeneration int64, interval, timeout time.Duration) error { +func WaitForObservedDeploymentInternal(getDeploymentFunc func() (*v1alpha1.MachineDeployment, error), desiredGeneration int64, interval, timeout time.Duration) error { return wait.Poll(interval, timeout, func() (bool, error) { deployment, err := getDeploymentFunc() if err != nil { diff --git a/pkg/controller/hashtest.go b/pkg/controller/hashtest.go index c1ef3d42e..0a762e039 100644 --- a/pkg/controller/hashtest.go +++ b/pkg/controller/hashtest.go @@ -29,33 +29,33 @@ import ( "testing" hashutil "k8s.io/kubernetes/pkg/util/hash" - "github.com/gardener/node-controller-manager/pkg/apis/node/v1alpha1" + "github.com/gardener/node-controller-manager/pkg/apis/machine/v1alpha1" ) -var instanceSpec string = ` +var machineSpec string = ` { "metadata": { "name": "vm2", "labels": { - "instanceSet": "is2" + "machineSet": "is2" } }, "spec": { "class": { - "apiGroup": "node.sapcloud.io/v1alpha1", - "kind": "AWSInstanceClass", + "apiGroup": "machine.sapcloud.io/v1alpha1", + "kind": "AWSMachineClass", "name": "test-aws" } } } ` -func TestInstanceTemplateSpecHash(t *testing.T) { +func TestMachineTemplateSpecHash(t *testing.T) { seenHashes := make(map[uint32]int) for i := 0; i < 1000; i++ { - specJson := strings.Replace(instanceSpec, "@@VERSION@@", strconv.Itoa(i), 1) - spec := v1alpha1.InstanceTemplateSpec{} + specJson := strings.Replace(machineSpec, "@@VERSION@@", strconv.Itoa(i), 1) + spec := v1alpha1.MachineTemplateSpec{} json.Unmarshal([]byte(specJson), &spec) hash := ComputeHash(&spec, nil) if v, ok := seenHashes[hash]; ok { @@ -67,23 +67,23 @@ func TestInstanceTemplateSpecHash(t *testing.T) { } func BenchmarkAdler(b *testing.B) { - spec := v1alpha1.InstanceTemplateSpec{} - json.Unmarshal([]byte(instanceSpec), &spec) + spec := v1alpha1.MachineTemplateSpec{} + json.Unmarshal([]byte(machineSpec), &spec) for i := 0; i < b.N; i++ { - getInstanceTemplateSpecOldHash(spec) + getMachineTemplateSpecOldHash(spec) } } -func getInstanceTemplateSpecOldHash(template v1alpha1.InstanceTemplateSpec) uint32 { - instanceTemplateSpecHasher := adler32.New() - hashutil.DeepHashObject(instanceTemplateSpecHasher, template) - return instanceTemplateSpecHasher.Sum32() +func getMachineTemplateSpecOldHash(template v1alpha1.MachineTemplateSpec) uint32 { + machineTemplateSpecHasher := adler32.New() + hashutil.DeepHashObject(machineTemplateSpecHasher, template) + return machineTemplateSpecHasher.Sum32() } func BenchmarkFnv(b *testing.B) { - spec := v1alpha1.InstanceTemplateSpec{} - json.Unmarshal([]byte(instanceSpec), &spec) + spec := v1alpha1.MachineTemplateSpec{} + json.Unmarshal([]byte(machineSpec), &spec) for i := 0; i < b.N; i++ { ComputeHash(&spec, nil) diff --git a/pkg/controller/instance.go b/pkg/controller/instance.go deleted file mode 100644 index 778b04f6b..000000000 --- a/pkg/controller/instance.go +++ /dev/null @@ -1,650 +0,0 @@ -/* -Copyright 2017 The Gardener 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 controller - -import ( - "errors" - "time" - "strings" - - "github.com/golang/glog" - - "k8s.io/api/core/v1" - "k8s.io/kubernetes/pkg/api" - "k8s.io/apimachinery/pkg/labels" - "k8s.io/apimachinery/pkg/selection" - "k8s.io/apimachinery/pkg/util/sets" - "k8s.io/client-go/tools/cache" - - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - apierrors "k8s.io/apimachinery/pkg/api/errors" - - "github.com/gardener/node-controller-manager/pkg/apis/node/v1alpha1" - "github.com/gardener/node-controller-manager/pkg/driver" - "github.com/gardener/node-controller-manager/pkg/apis/node/validation" - "github.com/gardener/node-controller-manager/pkg/apis/node" -) - -/* - SECTION - Instance controller - Instance add, update, delete watches -*/ -func (c *controller) instanceAdd(obj interface{}) { - key, err := cache.DeletionHandlingMetaNamespaceKeyFunc(obj) - if err != nil { - glog.Errorf("Couldn't get key for object %+v: %v", obj, err) - return - } - c.instanceQueue.Add(key) -} - -func (c *controller) instanceUpdate(oldObj, newObj interface{}) { - c.instanceAdd(newObj) -} - -func (c *controller) instanceDelete(obj interface{}) { - c.instanceAdd(obj) -} - -func (c *controller) enqueueInstanceAfter(obj interface{}, after time.Duration) { - key, err := KeyFunc(obj) - if err != nil { - return - } - c.instanceQueue.AddAfter(key, after) -} - -func (c *controller) reconcileClusterInstanceKey(key string) error { - instance, err := c.instanceLister.Get(key) - if apierrors.IsNotFound(err) { - return nil - } - if err != nil { - glog.Error("ClusterInstance %q: Unable to retrieve object from store: %v", key, err) - return err - } - - return c.reconcileClusterInstance(instance) -} - -func (c *controller) reconcileClusterInstance(instance *v1alpha1.Instance) error { - - /* - glog.V(2).Info("Start Reconciling instance: ", instance.Name) - defer func() { - glog.V(2).Info("Stop Reconciling instance: ", instance.Name) - }()*/ - - if !shouldReconcileInstance(instance, time.Now()) { - return nil - } - - // Validate Instance - internalInstance := &node.Instance{} - err := api.Scheme.Convert(instance, internalInstance, nil) - if err != nil { - return err - } - validationerr := validation.ValidateInstance(internalInstance) - if validationerr.ToAggregate() != nil && len(validationerr.ToAggregate().Errors()) > 0 { - glog.V(2).Infof("Validation of Instance failled %s", validationerr.ToAggregate().Error()) - return nil - } - - AWSInstanceClass, err := c.awsInstanceClassLister.Get(instance.Spec.Class.Name) - if err != nil { - glog.V(2).Infof("AWSInstanceClass for Instance %q not found %q. Skipping. %v", instance.Name, instance.Spec.Class.Name, err) - return nil - } - // Do not modify the original objects in any way! - AWSInstanceClassCopy := AWSInstanceClass.DeepCopy() - //glog.Info(AWSInstanceClassCopy) - - // Validate AWSInstanceClass - internalAWSInstanceClass := &node.AWSInstanceClass{} - err = api.Scheme.Convert(AWSInstanceClass, internalAWSInstanceClass, nil) - if err != nil { - return err - } - validationerr = validation.ValidateAWSInstanceClass(internalAWSInstanceClass) - if validationerr.ToAggregate() != nil && len(validationerr.ToAggregate().Errors()) > 0 { - glog.V(2).Infof("Validation of AWSInstanceClass failled %s", validationerr.ToAggregate().Error()) - return nil - } - - // Get secretRef - secretRef, err := c.getSecret(AWSInstanceClass.Spec.SecretRef, AWSInstanceClass) - if err != nil || secretRef == nil { - return err - } - - splitProviderId := strings.Split(instance.Spec.ProviderID, "/") - instanceID := splitProviderId[len(splitProviderId) - 1] - driver := driver.NewDriver(instanceID, AWSInstanceClassCopy, secretRef, instance.Spec.Class.Kind) - actualID, err := driver.GetExisting() - if err != nil { - return err - } else if actualID == "fake" { - glog.Info("Fake") - return nil - } - - //glog.Info(actualID, instanceID) - - // Get the latest version of the instance so that we can avoid conflicts - instance, err = c.nodeClient.Instances().Get(instance.Name, metav1.GetOptions{}) - if err != nil { - return err - } - - if instance.DeletionTimestamp != nil { - // Deleting instance - err := c.deleteInstance(instance, driver) - if err != nil { - return err - } - - } else if instance.Status.CurrentStatus.TimeoutActive { - // Processing instance - c.checkInstanceTimeout(instance) - - } else { - // Processing of create or update event - //glog.V(2).Info("Processing Create/Update") - c.addInstanceFinalizers(instance) - - if actualID == "" { - // Creating instance - err := c.createInstance(instance, AWSInstanceClass.Spec.AvailabilityZone, driver) - if err != nil { - return err - } - - } else if actualID != instanceID { - // Updating instance - err := c.updateInstance(instance, AWSInstanceClass.Spec.AvailabilityZone, actualID) - if err != nil { - return err - } - } - - } - - return nil -} - -/* - SECTION - Instance controller - nodeToInstance -*/ -func (c *controller) nodeToInstanceAdd(obj interface{}) { - key, err := cache.DeletionHandlingMetaNamespaceKeyFunc(obj) - if err != nil { - glog.Errorf("Couldn't get key for object %+v: %v", obj, err) - return - } - c.nodeToInstanceQueue.Add(key) -} - -func (c *controller) nodeToInstanceUpdate(oldObj, newObj interface{}) { - c.nodeToInstanceAdd(newObj) -} - -func (c *controller) nodeToInstanceDelete(obj interface{}) { - c.nodeToInstanceAdd(obj) -} - -func (c *controller) reconcileClusterNodeToInstanceKey(key string) error { - node, err := c.nodeLister.Get(key) - if apierrors.IsNotFound(err) { - return nil - } - if err != nil { - glog.Error("ClusterNode %q: Unable to retrieve object from store: %v", key, err) - return err - } - - return c.reconcileClusterNodeToInstance(node) -} - -func (c *controller) reconcileClusterNodeToInstance(node *v1.Node) error { - instance, err := c.getInstanceFromNode(node.Name) - - if err != nil { - glog.Error("Couldn't fetch instance: ", err) - return err - } else if instance == nil { - return nil - } - - err = c.updateInstanceState(instance, node) - if err != nil { - return err - } - - return nil -} - -/* - SECTION - NodeToInstance operations -*/ - -func (c *controller) getInstanceFromNode(nodeName string) (*v1alpha1.Instance, error) { - - var list []string - list = append(list, nodeName) - - selector := labels.NewSelector() - req, _ := labels.NewRequirement("node", selection.Equals, list) - selector = selector.Add(*req) - instances, _ := c.instanceLister.List(selector) - - if len(instances) > 1 { - err := errors.New("Multiple instances matching node") - return nil, err - } else if len(instances) < 1 { - return nil, nil - } - - return instances[0], nil -} - -func (c *controller) updateInstanceState (instance *v1alpha1.Instance, node *v1.Node) error { - - instance = c.updateInstanceConditions(instance, node.Status.Conditions) - - if instance.Status.LastOperation.State != "Successful" { - - if instance.Status.LastOperation.Type == "Create" { - - if instance.Status.LastOperation.Description == "Creating instance on cloud provider" { - // Instance is ready but yet to join the cluster - lastOperation := v1alpha1.LastOperation { - Description: "Waiting for instance to join the cluster (Not Ready)", - State: "Processing", - Type: "Create", - LastUpdateTime: metav1.Now(), - } - currentStatus := v1alpha1.CurrentStatus { - Phase: v1alpha1.InstanceAvailable, - TimeoutActive: true, - LastUpdateTime: instance.Status.CurrentStatus.LastUpdateTime, - } - c.updateInstanceStatus(instance, lastOperation, currentStatus) - - } else if instance.Status.LastOperation.Description == "Waiting for instance to join the cluster (Not Ready)" && instance.Status.Conditions[3].Status == "True" { - // Instance is ready and has joined the cluster - lastOperation := v1alpha1.LastOperation { - Description: "Instance is now ready", - State: "Successful", - Type: "Create", - LastUpdateTime: metav1.Now(), - } - c.updateInstanceStatus(instance, lastOperation, instance.Status.CurrentStatus) - - } - - } - } - return nil -} - -/* - SECTION - Instance operations - Create, Update, Delete -*/ - -func (c *controller) createInstance (instance *v1alpha1.Instance, availabilityZone string, driver driver.Driver) error { - //glog.V(2).Infof("Creating instance %s", instance.Name) - - actualID, private_dns, err := driver.Create() - if err != nil { - - lastOperation := v1alpha1.LastOperation { - Description: "Cloud provider message - " + err.Error(), - State: "Failed", - Type: "Create", - LastUpdateTime: metav1.Now(), - } - currentStatus := v1alpha1.CurrentStatus { - Phase: v1alpha1.InstanceFailed, - TimeoutActive: false, - LastUpdateTime: metav1.Now(), - } - c.updateInstanceStatus(instance, lastOperation, currentStatus) - - return err - } - glog.V(2).Infof("Created instance: %s, AWS Instance-id: %s", instance.Name, actualID) - - for { - // Get the latest version of the instance so that we can avoid conflicts - instance, err := c.nodeClient.Instances().Get(instance.Name, metav1.GetOptions{}) - if err != nil { - return err - } - - lastOperation := v1alpha1.LastOperation { - Description: "Creating instance on cloud provider", - State: "Processing", - Type: "Create", - LastUpdateTime: metav1.Now(), - } - currentStatus := v1alpha1.CurrentStatus { - Phase: v1alpha1.InstancePending, - TimeoutActive: true, - LastUpdateTime: metav1.Now(), - } - - clone := instance.DeepCopy() - clone.Spec.ProviderID = "aws:///" + availabilityZone + "/" + actualID - if clone.Labels == nil { - clone.Labels = make(map[string]string) - } - clone.Labels["node"] = private_dns - clone.Status.Node = private_dns - clone.Status.LastOperation = lastOperation - clone.Status.CurrentStatus = currentStatus - - _, err = c.nodeClient.Instances().Update(clone) - if err == nil { - break - } - glog.Warning("Updated failed, retrying") - } - - return nil -} - - -func (c *controller) updateInstance (instance *v1alpha1.Instance, availabilityZone string, actualID string) error { - glog.V(2).Infof("Setting InstanceId of %s to %s", instance.Name, actualID) - - for { - instance, err := c.nodeClient.Instances().Get(instance.Name, metav1.GetOptions{}) - if err != nil { - return err - } - - clone := instance.DeepCopy() - clone.Spec.ProviderID = "aws:///" + availabilityZone + "/" + actualID - lastOperation := v1alpha1.LastOperation { - Description: "Updated provider ID", - State: "Successful", - Type: "Update", - LastUpdateTime: metav1.Now(), - } - clone.Status.LastOperation = lastOperation - - _, err = c.nodeClient.Instances().Update(clone) - if err == nil { - break - } - glog.Warning("Updated failed, retrying") - } - - return nil -} - -func (c *controller) deleteInstance (instance *v1alpha1.Instance, driver driver.Driver) error { - - if finalizers := sets.NewString(instance.Finalizers...); finalizers.Has(DeleteFinalizerName) { - - var err error - glog.V(2).Infof("Deleting Instance %s", instance.Name) - - // If instance was created on the cloud provider - instanceID, _ := driver.GetExisting() - - if instanceID == "" { - err = errors.New("No provider-ID found on instance") - } else { - err = driver.Delete() - } - - if err != nil { - // When instance deletion fails - glog.V(2).Infof("Deletion failed: %s", err) - - lastOperation := v1alpha1.LastOperation { - Description: "Cloud provider message - " + err.Error(), - State: "Failed", - Type: "Delete", - LastUpdateTime: metav1.Now(), - } - currentStatus := v1alpha1.CurrentStatus { - Phase: v1alpha1.InstanceFailed, - TimeoutActive: false, - LastUpdateTime: metav1.Now(), - } - c.updateInstanceStatus(instance, lastOperation, currentStatus) - - return err - } - c.deleteInstanceFinalizers(instance) - c.nodeClient.Instances().Delete(instance.Name, &metav1.DeleteOptions{}) - } - return nil -} - -/* - SECTION - Update instance object -*/ - -func (c *controller) updateInstanceStatus ( - instance *v1alpha1.Instance, - lastOperation v1alpha1.LastOperation, - currentStatus v1alpha1.CurrentStatus, -){ - // Get the latest version of the instance so that we can avoid conflicts - instance, err := c.nodeClient.Instances().Get(instance.Name, metav1.GetOptions{}) - if err != nil { - return - } - - clone := instance.DeepCopy() - clone.Status.LastOperation = lastOperation - clone.Status.CurrentStatus = currentStatus - - _, err = c.nodeClient.Instances().Update(clone) - if err != nil { - // Keep retrying until update goes through - glog.V(4).Info("Warning: Updated failed, retrying") - c.updateInstanceStatus(instance, lastOperation, currentStatus) - } -} - -func (c *controller) updateInstanceConditions (instance *v1alpha1.Instance, conditions []v1.NodeCondition) *v1alpha1.Instance { - // Get the latest version of the instance so that we can avoid conflicts - instance, err := c.nodeClient.Instances().Get(instance.Name, metav1.GetOptions{}) - if err != nil { - return instance - } - - clone := instance.DeepCopy() - clone.Status.Conditions = conditions - - if clone.Status.CurrentStatus.Phase == v1alpha1.InstanceFailed || - clone.Status.CurrentStatus.Phase == v1alpha1.InstanceTerminating { - // If instance is already in failed state, don't update - clone.Status.CurrentStatus = clone.Status.CurrentStatus - - } else if !c.isHealthy(clone) && clone.Status.CurrentStatus.Phase == v1alpha1.InstanceRunning { - currentStatus := v1alpha1.CurrentStatus { - Phase: v1alpha1.InstanceUnknown, - TimeoutActive: true, - LastUpdateTime: metav1.Now(), - } - clone.Status.CurrentStatus = currentStatus - } else if c.isHealthy(clone) && clone.Status.CurrentStatus.Phase != v1alpha1.InstanceRunning { - currentStatus := v1alpha1.CurrentStatus { - Phase: v1alpha1.InstanceRunning, - TimeoutActive: false, - LastUpdateTime: metav1.Now(), - } - clone.Status.CurrentStatus = currentStatus - } - - clone, err = c.nodeClient.Instances().Update(clone) - if err != nil { - // Keep retrying until update goes through - glog.V(4).Info("Warning: Updated failed, retrying") - c.updateInstanceConditions(instance, conditions) - return instance - } - - return clone -} - -func (c *controller) updateInstanceFinalizers(instance *v1alpha1.Instance, finalizers []string) { - // Get the latest version of the instance so that we can avoid conflicts - instance, err := c.nodeClient.Instances().Get(instance.Name, metav1.GetOptions{}) - if err != nil { - return - } - - clone := instance.DeepCopy() - clone.Finalizers = finalizers - _, err = c.nodeClient.Instances().Update(clone) - if err != nil { - // Keep retrying until update goes through - glog.V(4).Info("Warning: Updated failed, retrying") - c.updateInstanceFinalizers(instance, finalizers) - } -} - -/* - SECTION - Manipulate Finalizers -*/ - -func (c *controller) addInstanceFinalizers (instance *v1alpha1.Instance) { - clone := instance.DeepCopy() - - if finalizers := sets.NewString(clone.Finalizers...); !finalizers.Has(DeleteFinalizerName) { - finalizers.Insert(DeleteFinalizerName) - c.updateInstanceFinalizers(clone, finalizers.List()) - } -} - -func (c *controller) deleteInstanceFinalizers (instance *v1alpha1.Instance) { - clone := instance.DeepCopy() - - if finalizers := sets.NewString(clone.Finalizers...); finalizers.Has(DeleteFinalizerName) { - finalizers.Delete(DeleteFinalizerName) - c.updateInstanceFinalizers(clone, finalizers.List()) - } -} - -/* - SECTION - Helper Functions -*/ -func (c *controller) isHealthy (instance *v1alpha1.Instance) bool { - - //TODO: Change index numbers to status names - if instance.Status.Conditions[0].Status == "True" { - return false - } else if instance.Status.Conditions[1].Status == "True" { - return false - } else if instance.Status.Conditions[2].Status == "True" { - return false - } else if instance.Status.Conditions[3].Status != "True" { - return false - } - return true -} - -func (c *controller) getSecret(ref *v1.SecretReference, AWSInstanceClass *v1alpha1.AWSInstanceClass) (*v1.Secret, error) { - secretRef, err := c.secretLister.Secrets(ref.Namespace).Get(ref.Name) - if apierrors.IsNotFound(err) { - glog.V(2).Infof("No secret %q: found for AWSInstanceClass %q", ref, AWSInstanceClass.Name) - return nil, nil - } - if err != nil { - glog.Errorf("Unable get secret %q for AWSInstanceClass %q: %v", AWSInstanceClass.Name, ref, err) - return nil, err - } - return secretRef, err -} - -func (c *controller) checkInstanceTimeout (instance *v1alpha1.Instance) { - - if instance.Status.CurrentStatus.Phase != v1alpha1.InstanceRunning { - - timeOutDuration := 5 * time.Minute - sleepTime := 1 * time.Minute - - // Timeout value obtained by subtracting last operation with expected time out period - timeOut := metav1.Now().Add(-timeOutDuration).Sub(instance.Status.CurrentStatus.LastUpdateTime.Time) - - //glog.V(2).Info("TIMEOUT: ", instance.Name, " ", timeOut) - - if timeOut > 0 { - - currentStatus := v1alpha1.CurrentStatus { - Phase: v1alpha1.InstanceFailed, - TimeoutActive: false, - LastUpdateTime: metav1.Now(), - } - - if instance.Status.CurrentStatus.Phase == v1alpha1.InstancePending { - lastOperation := v1alpha1.LastOperation { - Description: instance.Status.LastOperation.Description, - State: "Failed", - Type: instance.Status.LastOperation.Type, - LastUpdateTime: metav1.Now(), - } - c.updateInstanceStatus(instance, lastOperation, currentStatus) - - } else { - c.updateInstanceStatus(instance, instance.Status.LastOperation, currentStatus) - - } - } else { - currentStatus := v1alpha1.CurrentStatus { - Phase: instance.Status.CurrentStatus.Phase, - TimeoutActive: true, - LastUpdateTime: instance.Status.CurrentStatus.LastUpdateTime, - } - c.updateInstanceStatus(instance, instance.Status.LastOperation, currentStatus) - - /* - time.Sleep(sleepTime) - instance, err := c.nodeClient.Instances().Get(instance.Name, metav1.GetOptions{}) - if err != nil { - return - } - c.reconcileClusterInstance(instance)*/ - - c.enqueueInstanceAfter(instance, sleepTime) - } - } -} - -func shouldReconcileInstance(instance *v1alpha1.Instance, now time.Time) bool { - if instance.DeletionTimestamp != nil { - return true - } - if instance.Spec.ProviderID == "" { - return true - } - // TODO add more cases where this will be false - - return true -} diff --git a/pkg/controller/instanceclass.go b/pkg/controller/instanceclass.go deleted file mode 100644 index d4d225ee8..000000000 --- a/pkg/controller/instanceclass.go +++ /dev/null @@ -1,120 +0,0 @@ -/* -Copyright 2017 The Gardener 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 controller - -import ( - "reflect" - - "k8s.io/kubernetes/pkg/api" - "k8s.io/client-go/tools/cache" - "k8s.io/apimachinery/pkg/api/errors" - "k8s.io/apimachinery/pkg/labels" - - "github.com/golang/glog" - - "github.com/gardener/node-controller-manager/pkg/apis/node/validation" - "github.com/gardener/node-controller-manager/pkg/apis/node/v1alpha1" - "github.com/gardener/node-controller-manager/pkg/apis/node" -) - -func (c *controller) awsInstanceClassAdd(obj interface{}) { - key, err := cache.DeletionHandlingMetaNamespaceKeyFunc(obj) - if err != nil { - glog.Errorf("Couldn't get key for object %+v: %v", obj, err) - return - } - c.awsInstanceClassQueue.Add(key) -} - -func (c *controller) awsInstanceClassUpdate(oldObj, newObj interface{}) { - old, ok := oldObj.(*v1alpha1.AWSInstanceClass) - if old == nil || !ok { - return - } - new, ok := oldObj.(*v1alpha1.AWSInstanceClass) - if new == nil || !ok { - return - } - if reflect.DeepEqual(old.Spec, new.Spec) { - return - } - - c.awsInstanceClassAdd(newObj) -} - -func (c *controller) awsInstanceClassDelete(obj interface{}) { - awsInstanceClass, ok := obj.(*v1alpha1.AWSInstanceClass) - if awsInstanceClass == nil || !ok { - return - } - - glog.V(2).Infof("Received delete event for awsInstanceClass %v; no further processing will occur", awsInstanceClass.Name) -} - -// reconcileawsInstanceClassKey reconciles a awsInstanceClass due to controller resync -// or an event on the awsInstanceClass. -func (c *controller) reconcileClusterawsInstanceClassKey(key string) error { - plan, err := c.awsInstanceClassLister.Get(key) - if errors.IsNotFound(err) { - glog.Infof("ClusterawsInstanceClass %q: Not doing work because it has been deleted", key) - return nil - } - if err != nil { - glog.Infof("ClusterawsInstanceClass %q: Unable to retrieve object from store: %v", key, err) - return err - } - - return c.reconcileClusterawsInstanceClass(plan) -} - -func (c *controller) reconcileClusterawsInstanceClass(awsInstanceClass *v1alpha1.AWSInstanceClass) error { - - internalAWSInstanceClass := &node.AWSInstanceClass{} - err := api.Scheme.Convert(awsInstanceClass, internalAWSInstanceClass, nil) - if err != nil { - return err - } - // TODO this should be put in own API server - validationerr := validation.ValidateAWSInstanceClass(internalAWSInstanceClass) - if validationerr.ToAggregate() != nil && len(validationerr.ToAggregate().Errors()) > 0 { - glog.V(2).Infof("Validation of awsInstanceClass failled %s", validationerr.ToAggregate().Error()) - return nil - } - - instances, err := c.resolveInstances(awsInstanceClass) - if err != nil { - return err - } - - for _, instance := range instances { - c.instanceQueue.Add(instance.Name) - } - return nil -} - -func (c *controller) resolveInstances(awsInstanceClass *v1alpha1.AWSInstanceClass) ([]*v1alpha1.Instance, error) { - instances, err := c.instanceLister.List(labels.Everything()) - if err != nil { - return nil, err - } - var filtered []*v1alpha1.Instance - for _, instance := range instances { - if instance.Spec.Class.Name == awsInstanceClass.Name { - filtered = append(filtered, instance) - } - } - return filtered, nil -} diff --git a/pkg/controller/machine.go b/pkg/controller/machine.go new file mode 100644 index 000000000..b9e652856 --- /dev/null +++ b/pkg/controller/machine.go @@ -0,0 +1,652 @@ +/* +Copyright 2017 The Gardener 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 controller + +import ( + "errors" + "time" + "strings" + + "github.com/golang/glog" + + "k8s.io/api/core/v1" + "k8s.io/kubernetes/pkg/api" + "k8s.io/apimachinery/pkg/labels" + "k8s.io/apimachinery/pkg/selection" + "k8s.io/apimachinery/pkg/util/sets" + "k8s.io/client-go/tools/cache" + + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + apierrors "k8s.io/apimachinery/pkg/api/errors" + + "github.com/gardener/node-controller-manager/pkg/driver" + machineapi "github.com/gardener/node-controller-manager/pkg/apis/machine" + "github.com/gardener/node-controller-manager/pkg/apis/machine/v1alpha1" + "github.com/gardener/node-controller-manager/pkg/apis/machine/validation" +) + +/* + SECTION + Machine controller - Machine add, update, delete watches +*/ +func (c *controller) machineAdd(obj interface{}) { + key, err := cache.DeletionHandlingMetaNamespaceKeyFunc(obj) + if err != nil { + glog.Errorf("Couldn't get key for object %+v: %v", obj, err) + return + } + c.machineQueue.Add(key) +} + +func (c *controller) machineUpdate(oldObj, newObj interface{}) { + c.machineAdd(newObj) +} + +func (c *controller) machineDelete(obj interface{}) { + c.machineAdd(obj) +} + +func (c *controller) enqueueMachineAfter(obj interface{}, after time.Duration) { + key, err := KeyFunc(obj) + if err != nil { + return + } + c.machineQueue.AddAfter(key, after) +} + +func (c *controller) reconcileClusterMachineKey(key string) error { + machine, err := c.machineLister.Get(key) + if apierrors.IsNotFound(err) { + return nil + } + if err != nil { + glog.Error("ClusterMachine %q: Unable to retrieve object from store: %v", key, err) + return err + } + + return c.reconcileClusterMachine(machine) +} + +func (c *controller) reconcileClusterMachine(machine *v1alpha1.Machine) error { + + /* + glog.V(2).Info("Start Reconciling machine: ", machine.Name) + defer func() { + glog.V(2).Info("Stop Reconciling machine: ", machine.Name) + }()*/ + + if !shouldReconcileMachine(machine, time.Now()) { + return nil + } + + // Validate Machine + internalMachine := &machineapi.Machine{} + err := api.Scheme.Convert(machine, internalMachine, nil) + if err != nil { + return err + } + validationerr := validation.ValidateMachine(internalMachine) + if validationerr.ToAggregate() != nil && len(validationerr.ToAggregate().Errors()) > 0 { + glog.V(2).Infof("Validation of Machine failled %s", validationerr.ToAggregate().Error()) + return nil + } + + AWSMachineClass, err := c.awsMachineClassLister.Get(machine.Spec.Class.Name) + if err != nil { + glog.V(2).Infof("AWSMachineClass for Machine %q not found %q. Skipping. %v", machine.Name, machine.Spec.Class.Name, err) + return nil + } + // Do not modify the original objects in any way! + AWSMachineClassCopy := AWSMachineClass.DeepCopy() + //glog.Info(AWSMachineClassCopy) + + // Validate AWSMachineClass + internalAWSMachineClass := &machineapi.AWSMachineClass{} + err = api.Scheme.Convert(AWSMachineClass, internalAWSMachineClass, nil) + if err != nil { + return err + } + validationerr = validation.ValidateAWSMachineClass(internalAWSMachineClass) + if validationerr.ToAggregate() != nil && len(validationerr.ToAggregate().Errors()) > 0 { + glog.V(2).Infof("Validation of AWSMachineClass failled %s", validationerr.ToAggregate().Error()) + return nil + } + + // Get secretRef + secretRef, err := c.getSecret(AWSMachineClass.Spec.SecretRef, AWSMachineClass) + if err != nil || secretRef == nil { + return err + } + + splitProviderId := strings.Split(machine.Spec.ProviderID, "/") + machineID := splitProviderId[len(splitProviderId) - 1] + driver := driver.NewDriver(machineID, AWSMachineClassCopy, secretRef, machine.Spec.Class.Kind) + actualID, err := driver.GetExisting() + if err != nil { + return err + } else if actualID == "fake" { + glog.Info("Fake") + return nil + } + + //glog.Info(actualID, machineID) + + // Get the latest version of the machine so that we can avoid conflicts + machine, err = c.nodeClient.Machines().Get(machine.Name, metav1.GetOptions{}) + if err != nil { + return err + } + + if machine.DeletionTimestamp != nil { + // Deleting machine + err := c.deleteMachine(machine, driver) + if err != nil { + return err + } + + } else if machine.Status.CurrentStatus.TimeoutActive { + // Processing machine + c.checkMachineTimeout(machine) + + } else { + // Processing of create or update event + //glog.V(2).Info("Processing Create/Update") + c.addMachineFinalizers(machine) + + if actualID == "" { + // Creating machine + err := c.createMachine(machine, AWSMachineClass.Spec.AvailabilityZone, driver) + if err != nil { + return err + } + + } else if actualID != machineID { + // Updating machine + err := c.updateMachine(machine, AWSMachineClass.Spec.AvailabilityZone, actualID) + if err != nil { + return err + } + } + + } + + return nil +} + +/* + SECTION + Machine controller - nodeToMachine +*/ +func (c *controller) nodeToMachineAdd(obj interface{}) { + key, err := cache.DeletionHandlingMetaNamespaceKeyFunc(obj) + if err != nil { + glog.Errorf("Couldn't get key for object %+v: %v", obj, err) + return + } + c.nodeToMachineQueue.Add(key) +} + +func (c *controller) nodeToMachineUpdate(oldObj, newObj interface{}) { + c.nodeToMachineAdd(newObj) +} + +func (c *controller) nodeToMachineDelete(obj interface{}) { + c.nodeToMachineAdd(obj) +} + +func (c *controller) reconcileClusterNodeToMachineKey(key string) error { + node, err := c.nodeLister.Get(key) + if apierrors.IsNotFound(err) { + return nil + } + if err != nil { + glog.Error("ClusterNode %q: Unable to retrieve object from store: %v", key, err) + return err + } + + return c.reconcileClusterNodeToMachine(node) +} + +func (c *controller) reconcileClusterNodeToMachine(node *v1.Node) error { + machine, err := c.getMachineFromNode(node.Name) + + if err != nil { + glog.Error("Couldn't fetch machine: ", err) + return err + } else if machine == nil { + return nil + } + + err = c.updateMachineState(machine, node) + if err != nil { + return err + } + + return nil +} + +/* + SECTION + NodeToMachine operations +*/ + +func (c *controller) getMachineFromNode(nodeName string) (*v1alpha1.Machine, error) { + + var list []string + list = append(list, nodeName) + + selector := labels.NewSelector() + req, _ := labels.NewRequirement("node", selection.Equals, list) + selector = selector.Add(*req) + machines, _ := c.machineLister.List(selector) + + if len(machines) > 1 { + err := errors.New("Multiple machines matching node") + return nil, err + } else if len(machines) < 1 { + return nil, nil + } + + return machines[0], nil +} + +func (c *controller) updateMachineState (machine *v1alpha1.Machine, node *v1.Node) error { + + machine = c.updateMachineConditions(machine, node.Status.Conditions) + + if machine.Status.LastOperation.State != "Successful" { + + if machine.Status.LastOperation.Type == "Create" { + + if machine.Status.LastOperation.Description == "Creating machine on cloud provider" { + // Machine is ready but yet to join the cluster + lastOperation := v1alpha1.LastOperation { + Description: "Waiting for machine to join the cluster (Not Ready)", + State: "Processing", + Type: "Create", + LastUpdateTime: metav1.Now(), + } + currentStatus := v1alpha1.CurrentStatus { + Phase: v1alpha1.MachineAvailable, + TimeoutActive: true, + LastUpdateTime: machine.Status.CurrentStatus.LastUpdateTime, + } + c.updateMachineStatus(machine, lastOperation, currentStatus) + + } else if machine.Status.LastOperation.Description == "Waiting for machine to join the cluster (Not Ready)" && len(machine.Status.Conditions)==4 && machine.Status.Conditions[3].Status == "True" { + // Machine is ready and has joined the cluster + lastOperation := v1alpha1.LastOperation { + Description: "Machine is now ready", + State: "Successful", + Type: "Create", + LastUpdateTime: metav1.Now(), + } + c.updateMachineStatus(machine, lastOperation, machine.Status.CurrentStatus) + + } + + } + } + return nil +} + +/* + SECTION + Machine operations - Create, Update, Delete +*/ + +func (c *controller) createMachine (machine *v1alpha1.Machine, availabilityZone string, driver driver.Driver) error { + //glog.V(2).Infof("Creating machine %s", machine.Name) + + actualID, private_dns, err := driver.Create() + if err != nil { + + lastOperation := v1alpha1.LastOperation { + Description: "Cloud provider message - " + err.Error(), + State: "Failed", + Type: "Create", + LastUpdateTime: metav1.Now(), + } + currentStatus := v1alpha1.CurrentStatus { + Phase: v1alpha1.MachineFailed, + TimeoutActive: false, + LastUpdateTime: metav1.Now(), + } + c.updateMachineStatus(machine, lastOperation, currentStatus) + + return err + } + glog.V(2).Infof("Created machine: %s, AWS Machine-id: %s", machine.Name, actualID) + + for { + // Get the latest version of the machine so that we can avoid conflicts + machine, err := c.nodeClient.Machines().Get(machine.Name, metav1.GetOptions{}) + if err != nil { + return err + } + + lastOperation := v1alpha1.LastOperation { + Description: "Creating machine on cloud provider", + State: "Processing", + Type: "Create", + LastUpdateTime: metav1.Now(), + } + currentStatus := v1alpha1.CurrentStatus { + Phase: v1alpha1.MachinePending, + TimeoutActive: true, + LastUpdateTime: metav1.Now(), + } + + clone := machine.DeepCopy() + clone.Spec.ProviderID = "aws:///" + availabilityZone + "/" + actualID + if clone.Labels == nil { + clone.Labels = make(map[string]string) + } + clone.Labels["node"] = private_dns + clone.Status.Node = private_dns + clone.Status.LastOperation = lastOperation + clone.Status.CurrentStatus = currentStatus + + _, err = c.nodeClient.Machines().Update(clone) + if err == nil { + break + } + glog.Warning("Updated failed, retrying") + } + + return nil +} + + +func (c *controller) updateMachine (machine *v1alpha1.Machine, availabilityZone string, actualID string) error { + glog.V(2).Infof("Setting MachineId of %s to %s", machine.Name, actualID) + + for { + machine, err := c.nodeClient.Machines().Get(machine.Name, metav1.GetOptions{}) + if err != nil { + return err + } + + clone := machine.DeepCopy() + clone.Spec.ProviderID = "aws:///" + availabilityZone + "/" + actualID + lastOperation := v1alpha1.LastOperation { + Description: "Updated provider ID", + State: "Successful", + Type: "Update", + LastUpdateTime: metav1.Now(), + } + clone.Status.LastOperation = lastOperation + + _, err = c.nodeClient.Machines().Update(clone) + if err == nil { + break + } + glog.Warning("Updated failed, retrying") + } + + return nil +} + +func (c *controller) deleteMachine (machine *v1alpha1.Machine, driver driver.Driver) error { + + if finalizers := sets.NewString(machine.Finalizers...); finalizers.Has(DeleteFinalizerName) { + + var err error + glog.V(2).Infof("Deleting Machine %s", machine.Name) + + // If machine was created on the cloud provider + machineID, _ := driver.GetExisting() + + if machineID == "" { + err = errors.New("No provider-ID found on machine") + } else { + err = driver.Delete() + } + + if err != nil { + // When machine deletion fails + glog.V(2).Infof("Deletion failed: %s", err) + + lastOperation := v1alpha1.LastOperation { + Description: "Cloud provider message - " + err.Error(), + State: "Failed", + Type: "Delete", + LastUpdateTime: metav1.Now(), + } + currentStatus := v1alpha1.CurrentStatus { + Phase: v1alpha1.MachineFailed, + TimeoutActive: false, + LastUpdateTime: metav1.Now(), + } + c.updateMachineStatus(machine, lastOperation, currentStatus) + + return err + } + c.deleteMachineFinalizers(machine) + c.nodeClient.Machines().Delete(machine.Name, &metav1.DeleteOptions{}) + } + return nil +} + +/* + SECTION + Update machine object +*/ + +func (c *controller) updateMachineStatus ( + machine *v1alpha1.Machine, + lastOperation v1alpha1.LastOperation, + currentStatus v1alpha1.CurrentStatus, +){ + // Get the latest version of the machine so that we can avoid conflicts + machine, err := c.nodeClient.Machines().Get(machine.Name, metav1.GetOptions{}) + if err != nil { + return + } + + clone := machine.DeepCopy() + clone.Status.LastOperation = lastOperation + clone.Status.CurrentStatus = currentStatus + + _, err = c.nodeClient.Machines().Update(clone) + if err != nil { + // Keep retrying until update goes through + glog.V(4).Info("Warning: Updated failed, retrying") + c.updateMachineStatus(machine, lastOperation, currentStatus) + } +} + +func (c *controller) updateMachineConditions (machine *v1alpha1.Machine, conditions []v1.NodeCondition) *v1alpha1.Machine { + // Get the latest version of the machine so that we can avoid conflicts + machine, err := c.nodeClient.Machines().Get(machine.Name, metav1.GetOptions{}) + if err != nil { + return machine + } + + clone := machine.DeepCopy() + clone.Status.Conditions = conditions + + if clone.Status.CurrentStatus.Phase == v1alpha1.MachineFailed || + clone.Status.CurrentStatus.Phase == v1alpha1.MachineTerminating { + // If machine is already in failed state, don't update + clone.Status.CurrentStatus = clone.Status.CurrentStatus + + } else if !c.isHealthy(clone) && clone.Status.CurrentStatus.Phase == v1alpha1.MachineRunning { + currentStatus := v1alpha1.CurrentStatus { + Phase: v1alpha1.MachineUnknown, + TimeoutActive: true, + LastUpdateTime: metav1.Now(), + } + clone.Status.CurrentStatus = currentStatus + } else if c.isHealthy(clone) && clone.Status.CurrentStatus.Phase != v1alpha1.MachineRunning { + currentStatus := v1alpha1.CurrentStatus { + Phase: v1alpha1.MachineRunning, + TimeoutActive: false, + LastUpdateTime: metav1.Now(), + } + clone.Status.CurrentStatus = currentStatus + } + + clone, err = c.nodeClient.Machines().Update(clone) + if err != nil { + // Keep retrying until update goes through + glog.V(2).Info("Warning: Updated failed, retrying") + c.updateMachineConditions(machine, conditions) + return machine + } + + return clone +} + +func (c *controller) updateMachineFinalizers(machine *v1alpha1.Machine, finalizers []string) { + // Get the latest version of the machine so that we can avoid conflicts + machine, err := c.nodeClient.Machines().Get(machine.Name, metav1.GetOptions{}) + if err != nil { + return + } + + clone := machine.DeepCopy() + clone.Finalizers = finalizers + _, err = c.nodeClient.Machines().Update(clone) + if err != nil { + // Keep retrying until update goes through + glog.V(4).Info("Warning: Updated failed, retrying") + c.updateMachineFinalizers(machine, finalizers) + } +} + +/* + SECTION + Manipulate Finalizers +*/ + +func (c *controller) addMachineFinalizers (machine *v1alpha1.Machine) { + clone := machine.DeepCopy() + + if finalizers := sets.NewString(clone.Finalizers...); !finalizers.Has(DeleteFinalizerName) { + finalizers.Insert(DeleteFinalizerName) + c.updateMachineFinalizers(clone, finalizers.List()) + } +} + +func (c *controller) deleteMachineFinalizers (machine *v1alpha1.Machine) { + clone := machine.DeepCopy() + + if finalizers := sets.NewString(clone.Finalizers...); finalizers.Has(DeleteFinalizerName) { + finalizers.Delete(DeleteFinalizerName) + c.updateMachineFinalizers(clone, finalizers.List()) + } +} + +/* + SECTION + Helper Functions +*/ +func (c *controller) isHealthy (machine *v1alpha1.Machine) bool { + + //TODO: Change index numbers to status names + if len(machine.Status.Conditions) == 0 { + return false + } else if machine.Status.Conditions[0].Status == "True" { + return false + } else if machine.Status.Conditions[1].Status == "True" { + return false + } else if machine.Status.Conditions[2].Status == "True" { + return false + } else if machine.Status.Conditions[3].Status != "True" { + return false + } + return true +} + +func (c *controller) getSecret(ref *v1.SecretReference, AWSMachineClass *v1alpha1.AWSMachineClass) (*v1.Secret, error) { + secretRef, err := c.secretLister.Secrets(ref.Namespace).Get(ref.Name) + if apierrors.IsNotFound(err) { + glog.V(2).Infof("No secret %q: found for AWSMachineClass %q", ref, AWSMachineClass.Name) + return nil, nil + } + if err != nil { + glog.Errorf("Unable get secret %q for AWSMachineClass %q: %v", AWSMachineClass.Name, ref, err) + return nil, err + } + return secretRef, err +} + +func (c *controller) checkMachineTimeout (machine *v1alpha1.Machine) { + + if machine.Status.CurrentStatus.Phase != v1alpha1.MachineRunning { + + timeOutDuration := 5 * time.Minute + sleepTime := 1 * time.Minute + + // Timeout value obtained by subtracting last operation with expected time out period + timeOut := metav1.Now().Add(-timeOutDuration).Sub(machine.Status.CurrentStatus.LastUpdateTime.Time) + + //glog.V(2).Info("TIMEOUT: ", machine.Name, " ", timeOut) + + if timeOut > 0 { + + currentStatus := v1alpha1.CurrentStatus { + Phase: v1alpha1.MachineFailed, + TimeoutActive: false, + LastUpdateTime: metav1.Now(), + } + + if machine.Status.CurrentStatus.Phase == v1alpha1.MachinePending { + lastOperation := v1alpha1.LastOperation { + Description: machine.Status.LastOperation.Description, + State: "Failed", + Type: machine.Status.LastOperation.Type, + LastUpdateTime: metav1.Now(), + } + c.updateMachineStatus(machine, lastOperation, currentStatus) + + } else { + c.updateMachineStatus(machine, machine.Status.LastOperation, currentStatus) + + } + } else { + currentStatus := v1alpha1.CurrentStatus { + Phase: machine.Status.CurrentStatus.Phase, + TimeoutActive: true, + LastUpdateTime: machine.Status.CurrentStatus.LastUpdateTime, + } + c.updateMachineStatus(machine, machine.Status.LastOperation, currentStatus) + + /* + time.Sleep(sleepTime) + machine, err := c.nodeClient.Machines().Get(machine.Name, metav1.GetOptions{}) + if err != nil { + return + } + c.reconcileClusterMachine(machine)*/ + + c.enqueueMachineAfter(machine, sleepTime) + } + } +} + +func shouldReconcileMachine(machine *v1alpha1.Machine, now time.Time) bool { + if machine.DeletionTimestamp != nil { + return true + } + if machine.Spec.ProviderID == "" { + return true + } + // TODO add more cases where this will be false + + return true +} diff --git a/pkg/controller/instance_util.go b/pkg/controller/machine_util.go similarity index 59% rename from pkg/controller/instance_util.go rename to pkg/controller/machine_util.go index 4b9f288ac..fb54a634e 100644 --- a/pkg/controller/instance_util.go +++ b/pkg/controller/machine_util.go @@ -26,41 +26,41 @@ import ( errorsutil "k8s.io/apimachinery/pkg/util/errors" "k8s.io/client-go/util/retry" - "github.com/gardener/node-controller-manager/pkg/apis/node/v1alpha1" - v1alpha1client "github.com/gardener/node-controller-manager/pkg/client/clientset/typed/node/v1alpha1" - v1alpha1listers "github.com/gardener/node-controller-manager/pkg/client/listers/node/v1alpha1" + "github.com/gardener/node-controller-manager/pkg/apis/machine/v1alpha1" + v1alpha1client "github.com/gardener/node-controller-manager/pkg/client/clientset/typed/machine/v1alpha1" + v1alpha1listers "github.com/gardener/node-controller-manager/pkg/client/listers/machine/v1alpha1" ) // TODO: use client library instead when it starts to support update retries // see https://github.com/kubernetes/kubernetes/issues/21479 -type updateInstanceFunc func(instance *v1alpha1.Instance) error +type updateMachineFunc func(machine *v1alpha1.Machine) error -// UpdateInstanceWithRetries updates a instance with given applyUpdate function. Note that instance not found error is ignored. -// The returned bool value can be used to tell if the instance is actually updated. -func UpdateInstanceWithRetries(instanceClient v1alpha1client.InstanceInterface, instanceLister v1alpha1listers.InstanceLister, namespace, name string, applyUpdate updateInstanceFunc) (*v1alpha1.Instance, error) { - var instance *v1alpha1.Instance +// UpdateMachineWithRetries updates a machine with given applyUpdate function. Note that machine not found error is ignored. +// The returned bool value can be used to tell if the machine is actually updated. +func UpdateMachineWithRetries(machineClient v1alpha1client.MachineInterface, machineLister v1alpha1listers.MachineLister, namespace, name string, applyUpdate updateMachineFunc) (*v1alpha1.Machine, error) { + var machine *v1alpha1.Machine retryErr := retry.RetryOnConflict(retry.DefaultBackoff, func() error { var err error - instance, err = instanceLister.Get(name) + machine, err = machineLister.Get(name) if err != nil { return err } - instance = instance.DeepCopy() + machine = machine.DeepCopy() // Apply the update, then attempt to push it to the apiserver. - if applyErr := applyUpdate(instance); applyErr != nil { + if applyErr := applyUpdate(machine); applyErr != nil { return applyErr } - instance, err = instanceClient.Update(instance) + machine, err = machineClient.Update(machine) return err }) - // Ignore the precondition violated error, this instance is already updated + // Ignore the precondition violated error, this machine is already updated // with the desired label. if retryErr == errorsutil.ErrPreconditionViolated { - glog.V(4).Infof("Instance %s precondition doesn't hold, skip updating it.", name) + glog.V(4).Infof("Machine %s precondition doesn't hold, skip updating it.", name) retryErr = nil } - return instance, retryErr + return machine, retryErr } diff --git a/pkg/controller/machineclass.go b/pkg/controller/machineclass.go new file mode 100644 index 000000000..865546dc2 --- /dev/null +++ b/pkg/controller/machineclass.go @@ -0,0 +1,120 @@ +/* +Copyright 2017 The Gardener 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 controller + +import ( + "reflect" + + "k8s.io/kubernetes/pkg/api" + "k8s.io/client-go/tools/cache" + "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/labels" + + "github.com/golang/glog" + + "github.com/gardener/node-controller-manager/pkg/apis/machine/validation" + "github.com/gardener/node-controller-manager/pkg/apis/machine/v1alpha1" + "github.com/gardener/node-controller-manager/pkg/apis/machine" +) + +func (c *controller) awsMachineClassAdd(obj interface{}) { + key, err := cache.DeletionHandlingMetaNamespaceKeyFunc(obj) + if err != nil { + glog.Errorf("Couldn't get key for object %+v: %v", obj, err) + return + } + c.awsMachineClassQueue.Add(key) +} + +func (c *controller) awsMachineClassUpdate(oldObj, newObj interface{}) { + old, ok := oldObj.(*v1alpha1.AWSMachineClass) + if old == nil || !ok { + return + } + new, ok := oldObj.(*v1alpha1.AWSMachineClass) + if new == nil || !ok { + return + } + if reflect.DeepEqual(old.Spec, new.Spec) { + return + } + + c.awsMachineClassAdd(newObj) +} + +func (c *controller) awsMachineClassDelete(obj interface{}) { + awsMachineClass, ok := obj.(*v1alpha1.AWSMachineClass) + if awsMachineClass == nil || !ok { + return + } + + glog.V(2).Infof("Received delete event for awsMachineClass %v; no further processing will occur", awsMachineClass.Name) +} + +// reconcileawsMachineClassKey reconciles a awsMachineClass due to controller resync +// or an event on the awsMachineClass. +func (c *controller) reconcileClusterawsMachineClassKey(key string) error { + plan, err := c.awsMachineClassLister.Get(key) + if errors.IsNotFound(err) { + glog.Infof("ClusterawsMachineClass %q: Not doing work because it has been deleted", key) + return nil + } + if err != nil { + glog.Infof("ClusterawsMachineClass %q: Unable to retrieve object from store: %v", key, err) + return err + } + + return c.reconcileClusterawsMachineClass(plan) +} + +func (c *controller) reconcileClusterawsMachineClass(awsMachineClass *v1alpha1.AWSMachineClass) error { + + internalAWSMachineClass := &machine.AWSMachineClass{} + err := api.Scheme.Convert(awsMachineClass, internalAWSMachineClass, nil) + if err != nil { + return err + } + // TODO this should be put in own API server + validationerr := validation.ValidateAWSMachineClass(internalAWSMachineClass) + if validationerr.ToAggregate() != nil && len(validationerr.ToAggregate().Errors()) > 0 { + glog.V(2).Infof("Validation of awsMachineClass failled %s", validationerr.ToAggregate().Error()) + return nil + } + + machines, err := c.resolveMachines(awsMachineClass) + if err != nil { + return err + } + + for _, machine := range machines { + c.machineQueue.Add(machine.Name) + } + return nil +} + +func (c *controller) resolveMachines(awsMachineClass *v1alpha1.AWSMachineClass) ([]*v1alpha1.Machine, error) { + machines, err := c.machineLister.List(labels.Everything()) + if err != nil { + return nil, err + } + var filtered []*v1alpha1.Machine + for _, machine := range machines { + if machine.Spec.Class.Name == awsMachineClass.Name { + filtered = append(filtered, machine) + } + } + return filtered, nil +} diff --git a/pkg/controller/instanceset.go b/pkg/controller/machineset.go similarity index 50% rename from pkg/controller/instanceset.go rename to pkg/controller/machineset.go index 930436251..2b19fd545 100644 --- a/pkg/controller/instanceset.go +++ b/pkg/controller/machineset.go @@ -39,44 +39,44 @@ import ( "github.com/golang/glog" - "github.com/gardener/node-controller-manager/pkg/apis/node" - "github.com/gardener/node-controller-manager/pkg/apis/node/validation" - "github.com/gardener/node-controller-manager/pkg/apis/node/v1alpha1" + "github.com/gardener/node-controller-manager/pkg/apis/machine" + "github.com/gardener/node-controller-manager/pkg/apis/machine/validation" + "github.com/gardener/node-controller-manager/pkg/apis/machine/v1alpha1" ) const ( - // Realistic value of the burstReplica field for the instance set manager based off + // Realistic value of the burstReplica field for the machine set manager based off // performance requirements for kubernetes 1.0. BurstReplicas = 100 // The number of times we retry updating a ReplicaSet's status. statusUpdateRetries = 1 - // Kind for the instanceSet - instanceSetKind = "InstanceSet" + // Kind for the machineSet + machineSetKind = "MachineSet" ) -var controllerKindIS = v1alpha1.SchemeGroupVersion.WithKind("InstanceSet") +var controllerKindIS = v1alpha1.SchemeGroupVersion.WithKind("MachineSet") -// getInstanceInstanceSets returns the InstanceSets matching the given Instance. -func (c *controller) getInstanceInstanceSets(instance *v1alpha1.Instance) ([]*v1alpha1.InstanceSet, error) { +// getMachineMachineSets returns the MachineSets matching the given Machine. +func (c *controller) getMachineMachineSets(machine *v1alpha1.Machine) ([]*v1alpha1.MachineSet, error) { - if len(instance.Labels) == 0 { - err := errors.New("No InstanceSets found for instance because it has no labels") - glog.V(4).Info(err, ": ", instance.Name) + if len(machine.Labels) == 0 { + err := errors.New("No MachineSets found for machine because it has no labels") + glog.V(4).Info(err, ": ", machine.Name) return nil, err } - list, err := c.instanceSetLister.List(labels.Everything()) + list, err := c.machineSetLister.List(labels.Everything()) if err != nil { return nil, err } - var iss []*v1alpha1.InstanceSet + var iss []*v1alpha1.MachineSet for _, is := range list { - if is.Namespace != instance.Namespace { + if is.Namespace != machine.Namespace { continue } selector, err := metav1.LabelSelectorAsSelector(is.Spec.Selector) @@ -86,7 +86,7 @@ func (c *controller) getInstanceInstanceSets(instance *v1alpha1.Instance) ([]*v1 } // If a ReplicaSet with a nil or empty selector creeps in, it should match nothing, not everything. - if selector.Empty() || !selector.Matches(labels.Set(instance.Labels)) { + if selector.Empty() || !selector.Matches(labels.Set(machine.Labels)) { continue } iss = append(iss, is) @@ -94,8 +94,8 @@ func (c *controller) getInstanceInstanceSets(instance *v1alpha1.Instance) ([]*v1 } if len(iss) == 0 { - err := errors.New("No InstanceSets found for instance doesn't have matching labels") - glog.V(4).Info(err, ": ", instance.Name) + err := errors.New("No MachineSets found for machine doesn't have matching labels") + glog.V(4).Info(err, ": ", machine.Name) return nil, err } @@ -103,16 +103,16 @@ func (c *controller) getInstanceInstanceSets(instance *v1alpha1.Instance) ([]*v1 } -// resolveInstanceSetControllerRef returns the controller referenced by a ControllerRef, +// resolveMachineSetControllerRef returns the controller referenced by a ControllerRef, // or nil if the ControllerRef could not be resolved to a matching controller // of the correct Kind. -func (c *controller) resolveInstanceSetControllerRef(namespace string, controllerRef *metav1.OwnerReference) *v1alpha1.InstanceSet { +func (c *controller) resolveMachineSetControllerRef(namespace string, controllerRef *metav1.OwnerReference) *v1alpha1.MachineSet { // We can't look up by UID, so look up by Name and then verify UID. // Don't even try to look up by Name if it's the wrong Kind. - if controllerRef.Kind != instanceSetKind { //TOCheck + if controllerRef.Kind != machineSetKind { //TOCheck return nil } - is, err := c.instanceSetLister.Get(controllerRef.Name) + is, err := c.machineSetLister.Get(controllerRef.Name) if err != nil { return nil } @@ -124,43 +124,43 @@ func (c *controller) resolveInstanceSetControllerRef(namespace string, controlle return is } -// callback when InstanceSet is updated -func (c *controller) instanceSetUpdate(old, cur interface{}) { - oldIS := old.(*v1alpha1.InstanceSet) - curIS := cur.(*v1alpha1.InstanceSet) +// callback when MachineSet is updated +func (c *controller) machineSetUpdate(old, cur interface{}) { + oldIS := old.(*v1alpha1.MachineSet) + curIS := cur.(*v1alpha1.MachineSet) // You might imagine that we only really need to enqueue the - // instance set when Spec changes, but it is safer to sync any + // machine set when Spec changes, but it is safer to sync any // time this function is triggered. That way a full informer - // resync can requeue any instance set that don't yet have instances - // but whose last attempts at creating a instance have failed (since - // we don't block on creation of instances) instead of those - // instance sets stalling indefinitely. Enqueueing every time + // resync can requeue any machine set that don't yet have machines + // but whose last attempts at creating a machine have failed (since + // we don't block on creation of machines) instead of those + // machine sets stalling indefinitely. Enqueueing every time // does result in some spurious syncs (like when Status.Replica // is updated and the watch notification from it retriggers // this function), but in general extra resyncs shouldn't be // that bad as ReplicaSets that haven't met expectations yet won't // sync, and all the listing is done using local stores. if oldIS.Spec.Replicas != curIS.Spec.Replicas { - glog.V(4).Infof("%v %v updated. Desired instance count change: %d->%d", curIS.Name, oldIS.Spec.Replicas, curIS.Spec.Replicas) + glog.V(4).Infof("%v %v updated. Desired machine count change: %d->%d", curIS.Name, oldIS.Spec.Replicas, curIS.Spec.Replicas) } - c.enqueueInstanceSet(curIS) + c.enqueueMachineSet(curIS) } -// When a instance is created, enqueue the instance set that manages it and update its expectations. -func (c *controller) addInstanceToInstanceSet(obj interface{}) { - instance := obj.(*v1alpha1.Instance) +// When a machine is created, enqueue the machine set that manages it and update its expectations. +func (c *controller) addMachineToMachineSet(obj interface{}) { + machine := obj.(*v1alpha1.Machine) - if instance.DeletionTimestamp != nil { - // on a restart of the controller manager, it's possible a new instance shows up in a state that - // is already pending deletion. Prevent the instance from being a creation observation. - c.deleteInstanceToInstanceSet(instance) + if machine.DeletionTimestamp != nil { + // on a restart of the controller manager, it's possible a new machine shows up in a state that + // is already pending deletion. Prevent the machine from being a creation observation. + c.deleteMachineToMachineSet(machine) return } // If it has a ControllerRef, that's all that matters. - if controllerRef := metav1.GetControllerOf(instance); controllerRef != nil { - is := c.resolveInstanceSetControllerRef(instance.Namespace, controllerRef) + if controllerRef := metav1.GetControllerOf(machine); controllerRef != nil { + is := c.resolveMachineSetControllerRef(machine.Namespace, controllerRef) if is == nil { return } @@ -168,9 +168,9 @@ func (c *controller) addInstanceToInstanceSet(obj interface{}) { if err != nil { return } - glog.V(4).Infof("Instance %s created: %#v.", instance.Name, instance) + glog.V(4).Infof("Machine %s created: %#v.", machine.Name, machine) c.expectations.CreationObserved(isKey) - c.enqueueInstanceSet(is) + c.enqueueMachineSet(is) return } @@ -178,42 +178,42 @@ func (c *controller) addInstanceToInstanceSet(obj interface{}) { // them to see if anyone wants to adopt it. // DO NOT observe creation because no controller should be waiting for an // orphan. - iss, err := c.getInstanceInstanceSets(instance) + iss, err := c.getMachineMachineSets(machine) if err != nil{ return } else if len(iss) == 0 { return } - glog.V(4).Infof("Orphan Instance %s created: %#v.", instance.Name, instance) + glog.V(4).Infof("Orphan Machine %s created: %#v.", machine.Name, machine) for _, is := range iss { - c.enqueueInstanceSet(is) + c.enqueueMachineSet(is) } } -// When a instance is updated, figure out what instance set/s manage it and wake them -// up. If the labels of the instance have changed we need to awaken both the old -// and new instance set. old and cur must be *v1alpha1.Instance types. -func (c *controller) updateInstanceToInstanceSet(old, cur interface{}) { - curInst := cur.(*v1alpha1.Instance) - oldInst := old.(*v1alpha1.Instance) +// When a machine is updated, figure out what machine set/s manage it and wake them +// up. If the labels of the machine have changed we need to awaken both the old +// and new machine set. old and cur must be *v1alpha1.Machine types. +func (c *controller) updateMachineToMachineSet(old, cur interface{}) { + curInst := cur.(*v1alpha1.Machine) + oldInst := old.(*v1alpha1.Machine) if curInst.ResourceVersion == oldInst.ResourceVersion { - // Periodic resync will send update events for all known instances. - // Two different versions of the same instance will always have different RVs. + // Periodic resync will send update events for all known machines. + // Two different versions of the same machine will always have different RVs. return } labelChanged := !reflect.DeepEqual(curInst.Labels, oldInst.Labels) if curInst.DeletionTimestamp != nil { - // when a instance is deleted gracefully it's deletion timestamp is first modified to reflect a grace period, + // when a machine is deleted gracefully it's deletion timestamp is first modified to reflect a grace period, // and after such time has passed, the kubelet actually deletes it from the store. We receive an update // for modification of the deletion timestamp and expect an rs to create more replicas asap, not wait - // until the kubelet actually deletes the instance. This is different from the Phase of a instance changing, because + // until the kubelet actually deletes the machine. This is different from the Phase of a machine changing, because // an rs never initiates a phase change, and so is never asleep waiting for the same. - c.deleteInstanceToInstanceSet(curInst) + c.deleteMachineToMachineSet(curInst) if labelChanged { - // we don't need to check the oldInstance.DeletionTimestamp because DeletionTimestamp cannot be unset. - c.deleteInstanceToInstanceSet(oldInst) + // we don't need to check the oldMachine.DeletionTimestamp because DeletionTimestamp cannot be unset. + c.deleteMachineToMachineSet(oldInst) } return } @@ -224,47 +224,47 @@ func (c *controller) updateInstanceToInstanceSet(old, cur interface{}) { controllerRefChanged := !reflect.DeepEqual(curControllerRef, oldControllerRef) if controllerRefChanged && oldControllerRef != nil { // The ControllerRef was changed. Sync the old controller, if any. - if is := c.resolveInstanceSetControllerRef(oldInst.Namespace, oldControllerRef); is != nil { - c.enqueueInstanceSet(is) + if is := c.resolveMachineSetControllerRef(oldInst.Namespace, oldControllerRef); is != nil { + c.enqueueMachineSet(is) } } // If it has a ControllerRef, that's all that matters. if curControllerRef != nil { - is := c.resolveInstanceSetControllerRef(curInst.Namespace, curControllerRef) + is := c.resolveMachineSetControllerRef(curInst.Namespace, curControllerRef) if is == nil { return } - glog.V(4).Infof("Instance %s updated, objectMeta %+v -> %+v.", curInst.Name, oldInst.ObjectMeta, curInst.ObjectMeta) - c.enqueueInstanceSet(is) + glog.V(4).Infof("Machine %s updated, objectMeta %+v -> %+v.", curInst.Name, oldInst.ObjectMeta, curInst.ObjectMeta) + c.enqueueMachineSet(is) return } // Otherwise, it's an orphan. If anything changed, sync matching controllers // to see if anyone wants to adopt it now. if labelChanged || controllerRefChanged { - iss, err := c.getInstanceInstanceSets(curInst) + iss, err := c.getMachineMachineSets(curInst) if err != nil{ return } else if len(iss) == 0 { return } - glog.V(4).Infof("Orphan Instance %s updated, objectMeta %+v -> %+v.", curInst.Name, oldInst.ObjectMeta, curInst.ObjectMeta) + glog.V(4).Infof("Orphan Machine %s updated, objectMeta %+v -> %+v.", curInst.Name, oldInst.ObjectMeta, curInst.ObjectMeta) for _, is := range iss { - c.enqueueInstanceSet(is) + c.enqueueMachineSet(is) } } } -// When a instance is deleted, enqueue the instance set that manages the instance and update its expectations. -// obj could be an *v1alpha1.Instance, or a DeletionFinalStateUnknown marker item. -func (c *controller) deleteInstanceToInstanceSet(obj interface{}) { - instance, ok := obj.(*v1alpha1.Instance) +// When a machine is deleted, enqueue the machine set that manages the machine and update its expectations. +// obj could be an *v1alpha1.Machine, or a DeletionFinalStateUnknown marker item. +func (c *controller) deleteMachineToMachineSet(obj interface{}) { + machine, ok := obj.(*v1alpha1.Machine) - // When a delete is dropped, the relist will notice a instance in the store not + // When a delete is dropped, the relist will notice a machine in the store not // in the list, leading to the insertion of a tombstone object which contains - // the deleted key/value. Note that this value might be stale. If the instance + // the deleted key/value. Note that this value might be stale. If the machine // changed labels the new ReplicaSet will not be woken up till the periodic resync. if !ok { tombstone, ok := obj.(cache.DeletedFinalStateUnknown) @@ -272,19 +272,19 @@ func (c *controller) deleteInstanceToInstanceSet(obj interface{}) { utilruntime.HandleError(fmt.Errorf("couldn't get object from tombstone %+v", obj)) return } - instance, ok = tombstone.Obj.(*v1alpha1.Instance) + machine, ok = tombstone.Obj.(*v1alpha1.Machine) if !ok { - utilruntime.HandleError(fmt.Errorf("tombstone contained object that is not a instance %#v", obj)) + utilruntime.HandleError(fmt.Errorf("tombstone contained object that is not a machine %#v", obj)) return } } - controllerRef := metav1.GetControllerOf(instance) + controllerRef := metav1.GetControllerOf(machine) if controllerRef == nil { // No controller should care about orphans being deleted. return } - is := c.resolveInstanceSetControllerRef(instance.Namespace, controllerRef) + is := c.resolveMachineSetControllerRef(machine.Namespace, controllerRef) if is == nil { return } @@ -292,35 +292,35 @@ func (c *controller) deleteInstanceToInstanceSet(obj interface{}) { if err != nil { return } - glog.V(4).Infof("Instance %s/%s deleted through %v, timestamp %+v: %#v.", instance.Namespace, instance.Name, utilruntime.GetCaller(), instance.DeletionTimestamp, instance) - c.expectations.DeletionObserved(isKey, InstanceKey(instance)) - c.enqueueInstanceSet(is) + glog.V(4).Infof("Machine %s/%s deleted through %v, timestamp %+v: %#v.", machine.Namespace, machine.Name, utilruntime.GetCaller(), machine.DeletionTimestamp, machine) + c.expectations.DeletionObserved(isKey, MachineKey(machine)) + c.enqueueMachineSet(is) } // obj could be an *extensions.ReplicaSet, or a DeletionFinalStateUnknown marker item. -func (c *controller) enqueueInstanceSet(obj interface{}) { +func (c *controller) enqueueMachineSet(obj interface{}) { key, err := KeyFunc(obj) if err != nil { utilruntime.HandleError(fmt.Errorf("couldn't get key for object %+v: %v", obj, err)) return } - c.instanceSetQueue.Add(key) + c.machineSetQueue.Add(key) } // obj could be an *extensions.ReplicaSet, or a DeletionFinalStateUnknown marker item. -func (c *controller) enqueueInstanceSetAfter(obj interface{}, after time.Duration) { +func (c *controller) enqueueMachineSetAfter(obj interface{}, after time.Duration) { key, err := KeyFunc(obj) if err != nil { utilruntime.HandleError(fmt.Errorf("couldn't get key for object %+v: %v", obj, err)) return } - c.instanceSetQueue.AddAfter(key, after) + c.machineSetQueue.AddAfter(key, after) } // manageReplicas checks and updates replicas for the given ReplicaSet. -// Does NOT modify . -// It will requeue the instance set in case of an error while creating/deleting instances. -func (c *controller) manageReplicas(allInstances []*v1alpha1.Instance, is *v1alpha1.InstanceSet) error { +// Does NOT modify . +// It will requeue the machine set in case of an error while creating/deleting machines. +func (c *controller) manageReplicas(allMachines []*v1alpha1.Machine, is *v1alpha1.MachineSet) error { isKey, err := KeyFunc(is) if err != nil { @@ -328,22 +328,22 @@ func (c *controller) manageReplicas(allInstances []*v1alpha1.Instance, is *v1alp return nil } - var activeInstances, staleInstances []*v1alpha1.Instance - for _, instance := range allInstances { - if IsInstanceActive(instance) { - //glog.Info("Active instance: ", instance.Name) - activeInstances = append(activeInstances, instance) - } else if IsInstanceFailed(instance) { - staleInstances = append(staleInstances, instance) + var activeMachines, staleMachines []*v1alpha1.Machine + for _, machine := range allMachines { + if IsMachineActive(machine) { + //glog.Info("Active machine: ", machine.Name) + activeMachines = append(activeMachines, machine) + } else if IsMachineFailed(machine) { + staleMachines = append(staleMachines, machine) } } - if len(staleInstances) >= 1 { + if len(staleMachines) >= 1 { glog.V(2).Infof("Deleting stales") } - c.terminateInstances(staleInstances, is) + c.terminateMachines(staleMachines, is) - diff := len(activeInstances) - int((is.Spec.Replicas)) + diff := len(activeMachines) - int((is.Spec.Replicas)) if diff < 0 { //glog.Info("Start Create:", diff) diff *= -1 @@ -351,19 +351,19 @@ func (c *controller) manageReplicas(allInstances []*v1alpha1.Instance, is *v1alp diff = BurstReplicas } // TODO: Track UIDs of creates just like deletes. The problem currently - // is we'd need to wait on the result of a create to record the instance's + // is we'd need to wait on the result of a create to record the machine's // UID, which would require locking *across* the create, which will turn - // into a performance bottleneck. We should generate a UID for the instance + // into a performance bottleneck. We should generate a UID for the machine // beforehand and store it via ExpectCreations. c.expectations.ExpectCreations(isKey, diff) - glog.V(1).Infof("Too few replicas for InstanceSet %s, need %d, creating %d", is.Name, (is.Spec.Replicas), diff) - // Batch the instance creates. Batch sizes start at SlowStartInitialBatchSize + glog.V(1).Infof("Too few replicas for MachineSet %s, need %d, creating %d", is.Name, (is.Spec.Replicas), diff) + // Batch the machine creates. Batch sizes start at SlowStartInitialBatchSize // and double with each successful iteration in a kind of "slow start". - // This handles attempts to start large numbers of instances that would + // This handles attempts to start large numbers of machines that would // likely all fail with the same error. For example a project with a - // low quota that attempts to create a large number of instances will be - // prevented from spamming the API service with the instance create requests - // after one of its instances fails. Conveniently, this also prevents the + // low quota that attempts to create a large number of machines will be + // prevented from spamming the API service with the machine create requests + // after one of its machines fails. Conveniently, this also prevents the // event spam that those failures would generate. successfulCreations, err := slowStartBatch(diff, SlowStartInitialBatchSize, func() error { boolPtr := func(b bool) *bool { return &b } @@ -375,29 +375,29 @@ func (c *controller) manageReplicas(allInstances []*v1alpha1.Instance, is *v1alp BlockOwnerDeletion: boolPtr(true), Controller: boolPtr(true), } - //glog.Info("Printing InstanceSet details ... %v", &is) - err := c.instanceControl.CreateInstancesWithControllerRef(&is.Spec.Template, is, controllerRef) + //glog.Info("Printing MachineSet details ... %v", &is) + err := c.machineControl.CreateMachinesWithControllerRef(&is.Spec.Template, is, controllerRef) if err != nil && apierrors.IsTimeout(err) { - // Instance is created but its initialization has timed out. + // Machine is created but its initialization has timed out. // If the initialization is successful eventually, the // controller will observe the creation via the informer. - // If the initialization fails, or if the instance keeps + // If the initialization fails, or if the machine keeps // uninitialized for a long time, the informer will not // receive any update, and the controller will create a new - // instance when the expectation expires. + // machine when the expectation expires. return nil } return err }) //glog.Info("Stop Create:", diff) - // Any skipped instances that we never attempted to start shouldn't be expected. - // The skipped instances will be retried later. The next controller resync will + // Any skipped machines that we never attempted to start shouldn't be expected. + // The skipped machines will be retried later. The next controller resync will // retry the slow start process. - if skippedInstances := diff - successfulCreations; skippedInstances > 0 { - glog.V(2).Infof("Slow-start failure. Skipping creation of %d instances, decrementing expectations for %v %v/%v", skippedInstances, is.Kind, is.Namespace, is.Name) - for i := 0; i < skippedInstances; i++ { - // Decrement the expected number of creates because the informer won't observe this instance + if skippedMachines := diff - successfulCreations; skippedMachines > 0 { + glog.V(2).Infof("Slow-start failure. Skipping creation of %d machines, decrementing expectations for %v %v/%v", skippedMachines, is.Kind, is.Namespace, is.Name) + for i := 0; i < skippedMachines; i++ { + // Decrement the expected number of creates because the informer won't observe this machine c.expectations.CreationObserved(isKey) } } @@ -408,26 +408,26 @@ func (c *controller) manageReplicas(allInstances []*v1alpha1.Instance, is *v1alp } glog.V(2).Infof("Too many replicas for %v %s/%s, need %d, deleting %d", is.Kind, is.Namespace, is.Name, (is.Spec.Replicas), diff) - instancesToDelete := getInstancesToDelete(activeInstances, diff) + machinesToDelete := getMachinesToDelete(activeMachines, diff) - // Snapshot the UIDs (ns/name) of the instances we're expecting to see + // Snapshot the UIDs (ns/name) of the machines we're expecting to see // deleted, so we know to record their expectations exactly once either // when we see it as an update of the deletion timestamp, or as a delete. - // Note that if the labels on a instance/rs change in a way that the instance gets + // Note that if the labels on a machine/rs change in a way that the machine gets // orphaned, the rs will only wake up after the expectations have - // expired even if other instances are deleted. - c.expectations.ExpectDeletions(isKey, getInstanceKeys(instancesToDelete)) + // expired even if other machines are deleted. + c.expectations.ExpectDeletions(isKey, getMachineKeys(machinesToDelete)) - c.terminateInstances(instancesToDelete, is) + c.terminateMachines(machinesToDelete, is) } return nil } // syncReplicaSet will sync the ReplicaSet with the given key if it has had its expectations fulfilled, -// meaning it did not expect to see any more of its instances created or deleted. This function is not meant to be +// meaning it did not expect to see any more of its machines created or deleted. This function is not meant to be // invoked concurrently with the same key. -func (c *controller) syncInstanceSet(key string) error { +func (c *controller) syncMachineSet(key string) error { startTime := time.Now() defer func() { @@ -438,9 +438,9 @@ func (c *controller) syncInstanceSet(key string) error { if err != nil { return err } - is, err := c.instanceSetLister.Get(name) + is, err := c.machineSetLister.Get(name) //time.Sleep(10 * time.Second) - //glog.V(2).Infof("2.. Printing Key : %v , Printing InstanceSet First :: %+v", key, is) + //glog.V(2).Infof("2.. Printing Key : %v , Printing MachineSet First :: %+v", key, is) if apierrors.IsNotFound(err) { glog.V(4).Infof("%v has been deleted", key) c.expectations.DeleteExpectations(key) @@ -450,83 +450,83 @@ func (c *controller) syncInstanceSet(key string) error { return err } - // Validate InstanceSet - internalInstanceSet := &node.InstanceSet{} - err = api.Scheme.Convert(is, internalInstanceSet, nil) + // Validate MachineSet + internalMachineSet := &machine.MachineSet{} + err = api.Scheme.Convert(is, internalMachineSet, nil) if err != nil { return err } - validationerr := validation.ValidateInstanceSet(internalInstanceSet) + validationerr := validation.ValidateMachineSet(internalMachineSet) if validationerr.ToAggregate() != nil && len(validationerr.ToAggregate().Errors()) > 0 { - glog.V(2).Infof("Validation of InstanceSet failled %s", validationerr.ToAggregate().Error()) + glog.V(2).Infof("Validation of MachineSet failled %s", validationerr.ToAggregate().Error()) return nil } - AWSInstanceClass, err := c.awsInstanceClassLister.Get(is.Spec.Template.Spec.Class.Name) + AWSMachineClass, err := c.awsMachineClassLister.Get(is.Spec.Template.Spec.Class.Name) if err != nil { - glog.V(2).Infof("AWSInstanceClass for InstanceSet %q not found %q. Skipping. %v", is.Name, is.Spec.Template.Spec.Class.Name, err) + glog.V(2).Infof("AWSMachineClass for MachineSet %q not found %q. Skipping. %v", is.Name, is.Spec.Template.Spec.Class.Name, err) return nil } - // Validate AWSInstanceClass - internalAWSInstanceClass := &node.AWSInstanceClass{} - err = api.Scheme.Convert(AWSInstanceClass, internalAWSInstanceClass, nil) + // Validate AWSMachineClass + internalAWSMachineClass := &machine.AWSMachineClass{} + err = api.Scheme.Convert(AWSMachineClass, internalAWSMachineClass, nil) if err != nil { return err } - validationerr = validation.ValidateAWSInstanceClass(internalAWSInstanceClass) + validationerr = validation.ValidateAWSMachineClass(internalAWSMachineClass) if validationerr.ToAggregate() != nil && len(validationerr.ToAggregate().Errors()) > 0 { - glog.V(2).Infof("Validation of AWSInstanceClass failled %s", validationerr.ToAggregate().Error()) + glog.V(2).Infof("Validation of AWSMachineClass failled %s", validationerr.ToAggregate().Error()) return nil } // Manipulate finalizers if is.DeletionTimestamp == nil { - c.addInstanceSetFinalizers(is) + c.addMachineSetFinalizers(is) } else { - c.deleteInstanceSetFinalizers(is) + c.deleteMachineSetFinalizers(is) } selector, err := metav1.LabelSelectorAsSelector(is.Spec.Selector) if err != nil { - utilruntime.HandleError(fmt.Errorf("Error converting instance selector to selector: %v", err)) + utilruntime.HandleError(fmt.Errorf("Error converting machine selector to selector: %v", err)) return nil } - // list all instances to include the instances that don't match the rs`s selector + // list all machines to include the machines that don't match the rs`s selector // anymore but has the stale controller ref. // TODO: Do the List and Filter in a single pass, or use an index. - filteredInstances, err := c.instanceLister.List(labels.Everything()) + filteredMachines, err := c.machineLister.List(labels.Everything()) if err != nil { return err } - // NOTE: filteredInstances are pointing to objects from cache - if you need to + // NOTE: filteredMachines are pointing to objects from cache - if you need to // modify them, you need to copy it first. - filteredInstances, err = c.claimInstances(is, selector, filteredInstances) + filteredMachines, err = c.claimMachines(is, selector, filteredMachines) if err != nil { return err } isNeedsSync := c.expectations.SatisfiedExpectations(key) - glog.V(4).Infof("2 Filtered instances length: %v , InstanceSetNeedsSync: %v",len(filteredInstances), isNeedsSync) + glog.V(4).Infof("2 Filtered machines length: %v , MachineSetNeedsSync: %v",len(filteredMachines), isNeedsSync) var manageReplicasErr error if isNeedsSync && is.DeletionTimestamp == nil { - manageReplicasErr = c.manageReplicas(filteredInstances, is) + manageReplicasErr = c.manageReplicas(filteredMachines, is) } //glog.V(2).Infof("Print manageReplicasErr: %v ",manageReplicasErr) //Remove is = is.DeepCopy() - newStatus := calculateInstanceSetStatus(is, filteredInstances, manageReplicasErr) + newStatus := calculateMachineSetStatus(is, filteredMachines, manageReplicasErr) - // Always updates status as instances come up or die. - updatedIS, err := updateInstanceSetStatus(c.nodeClient, is, newStatus) + // Always updates status as machines come up or die. + updatedIS, err := updateMachineSetStatus(c.nodeClient, is, newStatus) if err != nil { - // Multiple things could lead to this update failing. Requeuing the instance set ensures + // Multiple things could lead to this update failing. Requeuing the machine set ensures // Returning an error causes a requeue without forcing a hotloop - glog.V(2).Infof("update instance failed with : %v ",err) //Remove + glog.V(2).Infof("update machine failed with : %v ",err) //Remove return err } @@ -534,16 +534,16 @@ func (c *controller) syncInstanceSet(key string) error { if manageReplicasErr == nil && updatedIS.Spec.MinReadySeconds > 0 && updatedIS.Status.ReadyReplicas == updatedIS.Spec.Replicas && updatedIS.Status.AvailableReplicas != updatedIS.Spec.Replicas { - c.enqueueInstanceSetAfter(updatedIS, time.Duration(updatedIS.Spec.MinReadySeconds)*time.Second) + c.enqueueMachineSetAfter(updatedIS, time.Duration(updatedIS.Spec.MinReadySeconds)*time.Second) } return manageReplicasErr } -func (c *controller) claimInstances(is *v1alpha1.InstanceSet, selector labels.Selector, filteredInstances []*v1alpha1.Instance) ([]*v1alpha1.Instance, error) { +func (c *controller) claimMachines(is *v1alpha1.MachineSet, selector labels.Selector, filteredMachines []*v1alpha1.Machine) ([]*v1alpha1.Machine, error) { // If any adoptions are attempted, we should first recheck for deletion with - // an uncached quorum read sometime after listing Instances (see #42639). + // an uncached quorum read sometime after listing Machines (see #42639). canAdoptFunc := RecheckDeletionTimestamp(func() (metav1.Object, error) { - fresh, err := c.nodeClient.InstanceSets().Get(is.Name, metav1.GetOptions{}) + fresh, err := c.nodeClient.MachineSets().Get(is.Name, metav1.GetOptions{}) if err != nil { return nil, err } @@ -552,8 +552,8 @@ func (c *controller) claimInstances(is *v1alpha1.InstanceSet, selector labels.Se } return fresh, nil }) - cm := NewInstanceControllerRefManager(c.instanceControl, is, selector, controllerKindIS, canAdoptFunc) - return cm.ClaimInstances(filteredInstances) + cm := NewMachineControllerRefManager(c.machineControl, is, selector, controllerKindIS, canAdoptFunc) + return cm.ClaimMachines(filteredMachines) } // slowStartBatch tries to call the provided function a total of 'count' times, @@ -593,66 +593,66 @@ func slowStartBatch(count int, initialBatchSize int, fn func() error) (int, erro return successes, nil } -func getInstancesToDelete(filteredInstances []*v1alpha1.Instance, diff int) []*v1alpha1.Instance { - // No need to sort instances if we are about to delete all of them. - // diff will always be <= len(filteredInstances), so not need to handle > case. - if diff < len(filteredInstances) { - // Sort the instances in the order such that not-ready < ready, unscheduled - // < scheduled, and pending < running. This ensures that we delete instances +func getMachinesToDelete(filteredMachines []*v1alpha1.Machine, diff int) []*v1alpha1.Machine { + // No need to sort machines if we are about to delete all of them. + // diff will always be <= len(filteredMachines), so not need to handle > case. + if diff < len(filteredMachines) { + // Sort the machines in the order such that not-ready < ready, unscheduled + // < scheduled, and pending < running. This ensures that we delete machines // in the earlier stages whenever possible. - sort.Sort(ActiveInstances(filteredInstances)) + sort.Sort(ActiveMachines(filteredMachines)) } - return filteredInstances[:diff] + return filteredMachines[:diff] } -func getInstanceKeys(instances []*v1alpha1.Instance) []string { - instanceKeys := make([]string, 0, len(instances)) - for _, instance := range instances { - instanceKeys = append(instanceKeys, InstanceKey(instance)) +func getMachineKeys(machines []*v1alpha1.Machine) []string { + machineKeys := make([]string, 0, len(machines)) + for _, machine := range machines { + machineKeys = append(machineKeys, MachineKey(machine)) } - return instanceKeys + return machineKeys } -func (c *controller) prepareInstanceForDeletion (targetInstance *v1alpha1.Instance, is *v1alpha1.InstanceSet, wg *sync.WaitGroup, errCh *chan error) { +func (c *controller) prepareMachineForDeletion (targetMachine *v1alpha1.Machine, is *v1alpha1.MachineSet, wg *sync.WaitGroup, errCh *chan error) { defer wg.Done() isKey, err := KeyFunc(is) if err != nil { utilruntime.HandleError(fmt.Errorf("Couldn't get key for %v %#v: %v", is.Kind, is, err)) return - } else if targetInstance.Status.CurrentStatus.Phase == "" { - // Instance is still not created properly + } else if targetMachine.Status.CurrentStatus.Phase == "" { + // Machine is still not created properly return } - // Force trigger deletion to reflect in instance status + // Force trigger deletion to reflect in machine status currentStatus := v1alpha1.CurrentStatus { - Phase: v1alpha1.InstanceTerminating, + Phase: v1alpha1.MachineTerminating, TimeoutActive: false, LastUpdateTime: metav1.Now(), } - c.updateInstanceStatus(targetInstance, targetInstance.Status.LastOperation, currentStatus) - glog.V(2).Info("Delete instance from instanceset:", targetInstance .Name) + c.updateMachineStatus(targetMachine, targetMachine.Status.LastOperation, currentStatus) + glog.V(2).Info("Delete machine from machineset:", targetMachine .Name) - if err := c.instanceControl.DeleteInstance(targetInstance.Name, is); err != nil { + if err := c.machineControl.DeleteMachine(targetMachine.Name, is); err != nil { // Decrement the expected number of deletes because the informer won't observe this deletion - instanceKey := InstanceKey(targetInstance) - glog.V(2).Infof("Failed to delete %v, decrementing expectations for %v %s/%s", instanceKey, is.Kind, is.Namespace, is.Name) - c.expectations.DeletionObserved(isKey, instanceKey) + machineKey := MachineKey(targetMachine) + glog.V(2).Infof("Failed to delete %v, decrementing expectations for %v %s/%s", machineKey, is.Kind, is.Namespace, is.Name) + c.expectations.DeletionObserved(isKey, machineKey) *errCh <- err } } -func (c *controller) terminateInstances (inactiveInstances []*v1alpha1.Instance, is *v1alpha1.InstanceSet) error { +func (c *controller) terminateMachines (inactiveMachines []*v1alpha1.Machine, is *v1alpha1.MachineSet) error { var wg sync.WaitGroup - numOfInactiveInstances := len(inactiveInstances) - errCh := make(chan error, numOfInactiveInstances) - wg.Add(numOfInactiveInstances) + numOfInactiveMachines := len(inactiveMachines) + errCh := make(chan error, numOfInactiveMachines) + wg.Add(numOfInactiveMachines) - for _, instance := range inactiveInstances { - go c.prepareInstanceForDeletion(instance, is, &wg, &errCh) + for _, machine := range inactiveMachines { + go c.prepareMachineForDeletion(machine, is, &wg, &errCh) } wg.Wait() @@ -673,37 +673,37 @@ func (c *controller) terminateInstances (inactiveInstances []*v1alpha1.Instance, Manipulate Finalizers */ -func (c *controller) addInstanceSetFinalizers (instanceSet *v1alpha1.InstanceSet) { - clone := instanceSet.DeepCopy() +func (c *controller) addMachineSetFinalizers (machineSet *v1alpha1.MachineSet) { + clone := machineSet.DeepCopy() if finalizers := sets.NewString(clone.Finalizers...); !finalizers.Has(DeleteFinalizerName) { finalizers.Insert(DeleteFinalizerName) - c.updateInstanceSetFinalizers(clone, finalizers.List()) + c.updateMachineSetFinalizers(clone, finalizers.List()) } } -func (c *controller) deleteInstanceSetFinalizers (instanceSet *v1alpha1.InstanceSet) { - clone := instanceSet.DeepCopy() +func (c *controller) deleteMachineSetFinalizers (machineSet *v1alpha1.MachineSet) { + clone := machineSet.DeepCopy() if finalizers := sets.NewString(clone.Finalizers...); finalizers.Has(DeleteFinalizerName) { finalizers.Delete(DeleteFinalizerName) - c.updateInstanceSetFinalizers(clone, finalizers.List()) + c.updateMachineSetFinalizers(clone, finalizers.List()) } } -func (c *controller) updateInstanceSetFinalizers(instanceSet *v1alpha1.InstanceSet, finalizers []string) { - // Get the latest version of the instanceSet so that we can avoid conflicts - instanceSet, err := c.nodeClient.InstanceSets().Get(instanceSet.Name, metav1.GetOptions{}) +func (c *controller) updateMachineSetFinalizers(machineSet *v1alpha1.MachineSet, finalizers []string) { + // Get the latest version of the machineSet so that we can avoid conflicts + machineSet, err := c.nodeClient.MachineSets().Get(machineSet.Name, metav1.GetOptions{}) if err != nil { return } - clone := instanceSet.DeepCopy() + clone := machineSet.DeepCopy() clone.Finalizers = finalizers - _, err = c.nodeClient.InstanceSets().Update(clone) + _, err = c.nodeClient.MachineSets().Update(clone) if err != nil { // Keep retrying until update goes through glog.Warning("Updated failed, retrying") - c.updateInstanceSetFinalizers(instanceSet, finalizers) + c.updateMachineSetFinalizers(machineSet, finalizers) } } \ No newline at end of file diff --git a/pkg/controller/instanceset_util.go b/pkg/controller/machineset_util.go similarity index 76% rename from pkg/controller/instanceset_util.go rename to pkg/controller/machineset_util.go index 316f562f9..50a0598da 100644 --- a/pkg/controller/instanceset_util.go +++ b/pkg/controller/machineset_util.go @@ -29,20 +29,20 @@ import ( "k8s.io/client-go/util/retry" labelsutil "k8s.io/kubernetes/pkg/util/labels" - "github.com/gardener/node-controller-manager/pkg/apis/node/v1alpha1" - v1alpha1client "github.com/gardener/node-controller-manager/pkg/client/clientset/typed/node/v1alpha1" - v1alpha1listers "github.com/gardener/node-controller-manager/pkg/client/listers/node/v1alpha1" + "github.com/gardener/node-controller-manager/pkg/apis/machine/v1alpha1" + v1alpha1client "github.com/gardener/node-controller-manager/pkg/client/clientset/typed/machine/v1alpha1" + v1alpha1listers "github.com/gardener/node-controller-manager/pkg/client/listers/machine/v1alpha1" ) // TODO: use client library instead when it starts to support update retries // see https://github.com/kubernetes/kubernetes/issues/21479 -type updateISFunc func(is *v1alpha1.InstanceSet) error +type updateISFunc func(is *v1alpha1.MachineSet) error // UpdateISWithRetries updates a RS with given applyUpdate function. Note that RS not found error is ignored. // The returned bool value can be used to tell if the RS is actually updated. -func UpdateISWithRetries(isClient v1alpha1client.InstanceSetInterface, isLister v1alpha1listers.InstanceSetLister, namespace, name string, applyUpdate updateISFunc) (*v1alpha1.InstanceSet, error) { - var is *v1alpha1.InstanceSet +func UpdateISWithRetries(isClient v1alpha1client.MachineSetInterface, isLister v1alpha1listers.MachineSetLister, namespace, name string, applyUpdate updateISFunc) (*v1alpha1.MachineSet, error) { + var is *v1alpha1.MachineSet retryErr := retry.RetryOnConflict(retry.DefaultBackoff, func() error { var err error @@ -61,7 +61,7 @@ func UpdateISWithRetries(isClient v1alpha1client.InstanceSetInterface, isLister // Ignore the precondition violated error, but the RS isn't updated. if retryErr == errorsutil.ErrPreconditionViolated { - glog.V(4).Infof("Instance set %s precondition doesn't hold, skip updating it.", name) + glog.V(4).Infof("Machine set %s precondition doesn't hold, skip updating it.", name) retryErr = nil } @@ -69,8 +69,8 @@ func UpdateISWithRetries(isClient v1alpha1client.InstanceSetInterface, isLister } // TODO : Redefine ? -func GetInstanceSetHash(is *v1alpha1.InstanceSet, uniquifier *int32) (string, error) { +func GetMachineSetHash(is *v1alpha1.MachineSet, uniquifier *int32) (string, error) { isTemplate := is.Spec.Template.DeepCopy() - isTemplate.Labels = labelsutil.CloneAndRemoveLabel(isTemplate.Labels, v1alpha1.DefaultInstanceDeploymentUniqueLabelKey) + isTemplate.Labels = labelsutil.CloneAndRemoveLabel(isTemplate.Labels, v1alpha1.DefaultMachineDeploymentUniqueLabelKey) return fmt.Sprintf("%d", ComputeHash(isTemplate, uniquifier)), nil } diff --git a/pkg/driver/driver.go b/pkg/driver/driver.go index c664e9175..7becad1f2 100644 --- a/pkg/driver/driver.go +++ b/pkg/driver/driver.go @@ -16,7 +16,7 @@ limitations under the License. package driver import ( - v1alpha1 "github.com/gardener/node-controller-manager/pkg/apis/node/v1alpha1" + v1alpha1 "github.com/gardener/node-controller-manager/pkg/apis/machine/v1alpha1" corev1 "k8s.io/api/core/v1" ) @@ -27,12 +27,12 @@ type Driver interface { GetExisting() (string, error) } -func NewDriver(instanceID string, class *v1alpha1.AWSInstanceClass, secretRef *corev1.Secret, classKind string) Driver { +func NewDriver(instanceID string, class *v1alpha1.AWSMachineClass, secretRef *corev1.Secret, classKind string) Driver { switch classKind { - case "AWSInstanceClass": + case "AWSMachineClass": return &AWSDriver{ - AWSInstanceClass: class, + AWSMachineClass: class, CloudConfig: secretRef, UserData: string(secretRef.Data["userData"]), InstanceId: instanceID, diff --git a/pkg/driver/driver_aws.go b/pkg/driver/driver_aws.go index bfea36c92..d47f48efc 100644 --- a/pkg/driver/driver_aws.go +++ b/pkg/driver/driver_aws.go @@ -20,19 +20,19 @@ import ( "errors" "encoding/base64" - v1alpha1 "github.com/gardener/node-controller-manager/pkg/apis/node/v1alpha1" - corev1 "k8s.io/api/core/v1" + v1alpha1 "github.com/gardener/node-controller-manager/pkg/apis/machine/v1alpha1" + corev1 "k8s.io/api/core/v1" "github.com/aws/aws-sdk-go/service/ec2" - "github.com/aws/aws-sdk-go/aws/session" - "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/aws/awserr" + "github.com/aws/aws-sdk-go/aws/session" + "github.com/aws/aws-sdk-go/aws" + "github.com/aws/aws-sdk-go/aws/awserr" "github.com/aws/aws-sdk-go/aws/credentials" "github.com/golang/glog" ) type AWSDriver struct { - AWSInstanceClass *v1alpha1.AWSInstanceClass + AWSMachineClass *v1alpha1.AWSMachineClass CloudConfig *corev1.Secret UserData string InstanceId string @@ -50,7 +50,7 @@ func (d *AWSDriver) createSVC() *ec2.EC2 { if accessKeyID != "" && secretAccessKey != "" { return ec2.New(session.New(&aws.Config{ - Region: aws.String(d.AWSInstanceClass.Spec.AvailabilityZone), + Region: aws.String(d.AWSMachineClass.Spec.AvailabilityZone), Credentials: credentials.NewStaticCredentialsFromCreds(credentials.Value{ AccessKeyID: accessKeyID, SecretAccessKey: secretAccessKey, @@ -59,7 +59,7 @@ func (d *AWSDriver) createSVC() *ec2.EC2 { } return ec2.New(session.New(&aws.Config{ - Region: aws.String(d.AWSInstanceClass.Spec.AvailabilityZone), + Region: aws.String(d.AWSMachineClass.Spec.AvailabilityZone), })) } @@ -70,7 +70,7 @@ func (d *AWSDriver) Create() (string, string, error) { UserDataEnc := base64.StdEncoding.EncodeToString([]byte(d.UserData)) var imageIds []*string - imageId := aws.String(d.AWSInstanceClass.Spec.AMI) + imageId := aws.String(d.AWSMachineClass.Spec.AMI) imageIds = append(imageIds, imageId) describeImagesRequest := ec2.DescribeImagesInput { @@ -83,8 +83,8 @@ func (d *AWSDriver) Create() (string, string, error) { var blkDeviceMappings []*ec2.BlockDeviceMapping deviceName := output.Images[0].RootDeviceName - volumeSize := d.AWSInstanceClass.Spec.BlockDevices[0].Ebs.VolumeSize - volumeType := d.AWSInstanceClass.Spec.BlockDevices[0].Ebs.VolumeType + volumeSize := d.AWSMachineClass.Spec.BlockDevices[0].Ebs.VolumeSize + volumeType := d.AWSMachineClass.Spec.BlockDevices[0].Ebs.VolumeType blkDeviceMapping := ec2.BlockDeviceMapping{ DeviceName: deviceName, Ebs: &ec2.EbsBlockDevice{ @@ -94,20 +94,20 @@ func (d *AWSDriver) Create() (string, string, error) { } blkDeviceMappings = append(blkDeviceMappings, &blkDeviceMapping) - // Specify the details of the instance that you want to create. + // Specify the details of the machine that you want to create. inputConfig := ec2.RunInstancesInput{ - // An Amazon Linux AMI ID for t2.micro instances in the us-west-2 region - ImageId: aws.String(d.AWSInstanceClass.Spec.AMI), - InstanceType: aws.String(d.AWSInstanceClass.Spec.InstanceType), + // An Amazon Linux AMI ID for t2.micro machines in the us-west-2 region + ImageId: aws.String(d.AWSMachineClass.Spec.AMI), + InstanceType: aws.String(d.AWSMachineClass.Spec.MachineType), MinCount: aws.Int64(1), MaxCount: aws.Int64(1), UserData: &UserDataEnc, - KeyName: aws.String(d.AWSInstanceClass.Spec.KeyName), - SubnetId: aws.String(d.AWSInstanceClass.Spec.NetworkInterfaces[0].SubnetID), + KeyName: aws.String(d.AWSMachineClass.Spec.KeyName), + SubnetId: aws.String(d.AWSMachineClass.Spec.NetworkInterfaces[0].SubnetID), IamInstanceProfile: &ec2.IamInstanceProfileSpecification{ - Name: &(d.AWSInstanceClass.Spec.IAM.Name), + Name: &(d.AWSMachineClass.Spec.IAM.Name), }, - SecurityGroupIds: []*string{aws.String(d.AWSInstanceClass.Spec.NetworkInterfaces[0].SecurityGroupID[0])}, + SecurityGroupIds: []*string{aws.String(d.AWSMachineClass.Spec.NetworkInterfaces[0].SecurityGroupID[0])}, BlockDeviceMappings: blkDeviceMappings, } @@ -116,9 +116,9 @@ func (d *AWSDriver) Create() (string, string, error) { return "Error", "Error", err } - // Add tags to the created instance + // Add tags to the created machine tagList := []*ec2.Tag{} - for idx, element := range d.AWSInstanceClass.Spec.Tags { + for idx, element := range d.AWSMachineClass.Spec.Tags { newTag := ec2.Tag{ Key: aws.String(idx), Value: aws.String(element), @@ -155,7 +155,7 @@ func (d *AWSDriver) Delete() error { input.DryRun = aws.Bool(false) output, err := svc.TerminateInstances(input) if err != nil { - glog.Errorf("Could not terminate instance: ", err) + glog.Errorf("Could not terminate machine: ", err) return err } @@ -166,16 +166,16 @@ func (d *AWSDriver) Delete() error { *vmState.CurrentState.Name == "terminated" { return nil } else { - err = errors.New("Instance already terminated") + err = errors.New("Machine already terminated") } } - glog.Errorf("Could not terminate instance: ", err) + glog.Errorf("Could not terminate machine: ", err) return err } // GetExisting TODO func (d *AWSDriver) GetExisting() (string, error) { - //var dumbo v1alpha1.InstancePhase + //var dumbo v1alpha1.MachinePhase return d.InstanceId, nil } diff --git a/pkg/driver/driver_fake.go b/pkg/driver/driver_fake.go index 68b68215b..ba570bbfd 100644 --- a/pkg/driver/driver_fake.go +++ b/pkg/driver/driver_fake.go @@ -19,7 +19,7 @@ package driver type FakeDriver struct { create func() (string, string, error) delete func() error - //existing func() (string, v1alpha1.InstancePhase, error) + //existing func() (string, v1alpha1.MachinePhase, error) existing func() (string, error) } diff --git a/pkg/openapi/openapi_generated.go b/pkg/openapi/openapi_generated.go index f325c1e2c..91cda8851 100644 --- a/pkg/openapi/openapi_generated.go +++ b/pkg/openapi/openapi_generated.go @@ -12,21 +12,21 @@ import ( func GetOpenAPIDefinitions(ref common.ReferenceCallback) map[string]common.OpenAPIDefinition { return map[string]common.OpenAPIDefinition{ - "github.com/gardener/node-controller-manager/pkg/apis/node/v1alpha1.AWSBlockDeviceMappingSpec": { + "github.com/gardener/node-controller-manager/pkg/apis/machine/v1alpha1.AWSBlockDeviceMappingSpec": { Schema: spec.Schema{ SchemaProps: spec.SchemaProps{ Properties: map[string]spec.Schema{ "deviceName": { SchemaProps: spec.SchemaProps{ - Description: "The device name exposed to the instance (for example, /dev/sdh or xvdh).", + Description: "The device name exposed to the machine (for example, /dev/sdh or xvdh).", Type: []string{"string"}, Format: "", }, }, "ebs": { SchemaProps: spec.SchemaProps{ - Description: "Parameters used to automatically set up EBS volumes when the instance is launched.", - Ref: ref("github.com/gardener/node-controller-manager/pkg/apis/node/v1alpha1.AWSEbsBlockDeviceSpec"), + Description: "Parameters used to automatically set up EBS volumes when the machine is launched.", + Ref: ref("github.com/gardener/node-controller-manager/pkg/apis/machine/v1alpha1.AWSEbsBlockDeviceSpec"), }, }, "noDevice": { @@ -38,7 +38,7 @@ func GetOpenAPIDefinitions(ref common.ReferenceCallback) map[string]common.OpenA }, "virtualName": { SchemaProps: spec.SchemaProps{ - Description: "The virtual device name (ephemeralN). Instance store volumes are numbered starting from 0. An instance type with 2 available instance store volumes can specify mappings for ephemeral0 and ephemeral1.The number of available instance store volumes depends on the instance type. After you connect to the instance, you must mount the volume.\n\nConstraints: For M3 instances, you must specify instance store volumes in the block device mapping for the instance. When you launch an M3 instance, we ignore any instance store volumes specified in the block device mapping for the AMI.", + Description: "The virtual device name (ephemeralN). Machine store volumes are numbered starting from 0. An machine type with 2 available machine store volumes can specify mappings for ephemeral0 and ephemeral1.The number of available machine store volumes depends on the machine type. After you connect to the machine, you must mount the volume.\n\nConstraints: For M3 machines, you must specify machine store volumes in the block device mapping for the machine. When you launch an M3 machine, we ignore any machine store volumes specified in the block device mapping for the AMI.", Type: []string{"string"}, Format: "", }, @@ -47,23 +47,23 @@ func GetOpenAPIDefinitions(ref common.ReferenceCallback) map[string]common.OpenA }, }, Dependencies: []string{ - "github.com/gardener/node-controller-manager/pkg/apis/node/v1alpha1.AWSEbsBlockDeviceSpec"}, + "github.com/gardener/node-controller-manager/pkg/apis/machine/v1alpha1.AWSEbsBlockDeviceSpec"}, }, - "github.com/gardener/node-controller-manager/pkg/apis/node/v1alpha1.AWSEbsBlockDeviceSpec": { + "github.com/gardener/node-controller-manager/pkg/apis/machine/v1alpha1.AWSEbsBlockDeviceSpec": { Schema: spec.Schema{ SchemaProps: spec.SchemaProps{ Description: "Describes a block device for an EBS volume. Please also see https://docs.aws.amazon.com/goto/WebAPI/ec2-2016-11-15/EbsBlockDevice", Properties: map[string]spec.Schema{ "deleteOnTermination": { SchemaProps: spec.SchemaProps{ - Description: "Indicates whether the EBS volume is deleted on instance termination.", + Description: "Indicates whether the EBS volume is deleted on machine termination.", Type: []string{"boolean"}, Format: "", }, }, "encrypted": { SchemaProps: spec.SchemaProps{ - Description: "Indicates whether the EBS volume is encrypted. Encrypted Amazon EBS volumes may only be attached to instances that support Amazon EBS encryption.", + Description: "Indicates whether the EBS volume is encrypted. Encrypted Amazon EBS volumes may only be attached to machines that support Amazon EBS encryption.", Type: []string{"boolean"}, Format: "", }, @@ -94,21 +94,21 @@ func GetOpenAPIDefinitions(ref common.ReferenceCallback) map[string]common.OpenA }, Dependencies: []string{}, }, - "github.com/gardener/node-controller-manager/pkg/apis/node/v1alpha1.AWSIAMProfileSpec": { + "github.com/gardener/node-controller-manager/pkg/apis/machine/v1alpha1.AWSIAMProfileSpec": { Schema: spec.Schema{ SchemaProps: spec.SchemaProps{ - Description: "Describes an IAM instance profile.", + Description: "Describes an IAM machine profile.", Properties: map[string]spec.Schema{ "arn": { SchemaProps: spec.SchemaProps{ - Description: "The Amazon Resource Name (ARN) of the instance profile.", + Description: "The Amazon Resource Name (ARN) of the machine profile.", Type: []string{"string"}, Format: "", }, }, "name": { SchemaProps: spec.SchemaProps{ - Description: "The name of the instance profile.", + Description: "The name of the machine profile.", Type: []string{"string"}, Format: "", }, @@ -118,10 +118,10 @@ func GetOpenAPIDefinitions(ref common.ReferenceCallback) map[string]common.OpenA }, Dependencies: []string{}, }, - "github.com/gardener/node-controller-manager/pkg/apis/node/v1alpha1.AWSInstanceClass": { + "github.com/gardener/node-controller-manager/pkg/apis/machine/v1alpha1.AWSMachineClass": { Schema: spec.Schema{ SchemaProps: spec.SchemaProps{ - Description: "AWSInstanceClass TODO", + Description: "AWSMachineClass TODO", Properties: map[string]spec.Schema{ "metadata": { SchemaProps: spec.SchemaProps{ @@ -144,19 +144,19 @@ func GetOpenAPIDefinitions(ref common.ReferenceCallback) map[string]common.OpenA }, "spec": { SchemaProps: spec.SchemaProps{ - Ref: ref("github.com/gardener/node-controller-manager/pkg/apis/node/v1alpha1.AWSInstanceClassSpec"), + Ref: ref("github.com/gardener/node-controller-manager/pkg/apis/machine/v1alpha1.AWSMachineClassSpec"), }, }, }, }, }, Dependencies: []string{ - "github.com/gardener/node-controller-manager/pkg/apis/node/v1alpha1.AWSInstanceClassSpec", "k8s.io/apimachinery/pkg/apis/meta/v1.ObjectMeta"}, + "github.com/gardener/node-controller-manager/pkg/apis/machine/v1alpha1.AWSMachineClassSpec", "k8s.io/apimachinery/pkg/apis/meta/v1.ObjectMeta"}, }, - "github.com/gardener/node-controller-manager/pkg/apis/node/v1alpha1.AWSInstanceClassList": { + "github.com/gardener/node-controller-manager/pkg/apis/machine/v1alpha1.AWSMachineClassList": { Schema: spec.Schema{ SchemaProps: spec.SchemaProps{ - Description: "AWSInstanceClassList is a collection of AWSInstanceClasses.", + Description: "AWSMachineClassList is a collection of AWSMachineClasses.", Properties: map[string]spec.Schema{ "kind": { SchemaProps: spec.SchemaProps{ @@ -183,7 +183,7 @@ func GetOpenAPIDefinitions(ref common.ReferenceCallback) map[string]common.OpenA Items: &spec.SchemaOrArray{ Schema: &spec.Schema{ SchemaProps: spec.SchemaProps{ - Ref: ref("github.com/gardener/node-controller-manager/pkg/apis/node/v1alpha1.AWSInstanceClass"), + Ref: ref("github.com/gardener/node-controller-manager/pkg/apis/machine/v1alpha1.AWSMachineClass"), }, }, }, @@ -194,12 +194,12 @@ func GetOpenAPIDefinitions(ref common.ReferenceCallback) map[string]common.OpenA }, }, Dependencies: []string{ - "github.com/gardener/node-controller-manager/pkg/apis/node/v1alpha1.AWSInstanceClass", "k8s.io/apimachinery/pkg/apis/meta/v1.ListMeta"}, + "github.com/gardener/node-controller-manager/pkg/apis/machine/v1alpha1.AWSMachineClass", "k8s.io/apimachinery/pkg/apis/meta/v1.ListMeta"}, }, - "github.com/gardener/node-controller-manager/pkg/apis/node/v1alpha1.AWSInstanceClassSpec": { + "github.com/gardener/node-controller-manager/pkg/apis/machine/v1alpha1.AWSMachineClassSpec": { Schema: spec.Schema{ SchemaProps: spec.SchemaProps{ - Description: "AWSInstanceClassSpec is the specification of a Shoot cluster.", + Description: "AWSMachineClassSpec is the specification of a Shoot cluster.", Properties: map[string]spec.Schema{ "ami": { SchemaProps: spec.SchemaProps{ @@ -219,7 +219,7 @@ func GetOpenAPIDefinitions(ref common.ReferenceCallback) map[string]common.OpenA Items: &spec.SchemaOrArray{ Schema: &spec.Schema{ SchemaProps: spec.SchemaProps{ - Ref: ref("github.com/gardener/node-controller-manager/pkg/apis/node/v1alpha1.AWSBlockDeviceMappingSpec"), + Ref: ref("github.com/gardener/node-controller-manager/pkg/apis/machine/v1alpha1.AWSBlockDeviceMappingSpec"), }, }, }, @@ -233,10 +233,10 @@ func GetOpenAPIDefinitions(ref common.ReferenceCallback) map[string]common.OpenA }, "iam": { SchemaProps: spec.SchemaProps{ - Ref: ref("github.com/gardener/node-controller-manager/pkg/apis/node/v1alpha1.AWSIAMProfileSpec"), + Ref: ref("github.com/gardener/node-controller-manager/pkg/apis/machine/v1alpha1.AWSIAMProfileSpec"), }, }, - "instanceType": { + "machineType": { SchemaProps: spec.SchemaProps{ Type: []string{"string"}, Format: "", @@ -260,7 +260,7 @@ func GetOpenAPIDefinitions(ref common.ReferenceCallback) map[string]common.OpenA Items: &spec.SchemaOrArray{ Schema: &spec.Schema{ SchemaProps: spec.SchemaProps{ - Ref: ref("github.com/gardener/node-controller-manager/pkg/apis/node/v1alpha1.AWSNetworkInterfaceSpec"), + Ref: ref("github.com/gardener/node-controller-manager/pkg/apis/machine/v1alpha1.AWSNetworkInterfaceSpec"), }, }, }, @@ -288,37 +288,37 @@ func GetOpenAPIDefinitions(ref common.ReferenceCallback) map[string]common.OpenA }, }, Dependencies: []string{ - "github.com/gardener/node-controller-manager/pkg/apis/node/v1alpha1.AWSBlockDeviceMappingSpec", "github.com/gardener/node-controller-manager/pkg/apis/node/v1alpha1.AWSIAMProfileSpec", "github.com/gardener/node-controller-manager/pkg/apis/node/v1alpha1.AWSNetworkInterfaceSpec", "k8s.io/api/core/v1.SecretReference"}, + "github.com/gardener/node-controller-manager/pkg/apis/machine/v1alpha1.AWSBlockDeviceMappingSpec", "github.com/gardener/node-controller-manager/pkg/apis/machine/v1alpha1.AWSIAMProfileSpec", "github.com/gardener/node-controller-manager/pkg/apis/machine/v1alpha1.AWSNetworkInterfaceSpec", "k8s.io/api/core/v1.SecretReference"}, }, - "github.com/gardener/node-controller-manager/pkg/apis/node/v1alpha1.AWSNetworkInterfaceSpec": { + "github.com/gardener/node-controller-manager/pkg/apis/machine/v1alpha1.AWSNetworkInterfaceSpec": { Schema: spec.Schema{ SchemaProps: spec.SchemaProps{ - Description: "Describes a network interface. Please also see https://docs.aws.amazon.com/goto/WebAPI/ec2-2016-11-15/InstanceAWSNetworkInterfaceSpecification", + Description: "Describes a network interface. Please also see https://docs.aws.amazon.com/goto/WebAPI/ec2-2016-11-15/MachineAWSNetworkInterfaceSpecification", Properties: map[string]spec.Schema{ "associatePublicIPAddress": { SchemaProps: spec.SchemaProps{ - Description: "Indicates whether to assign a public IPv4 address to an instance you launch in a VPC. The public IP address can only be assigned to a network interface for eth0, and can only be assigned to a new network interface, not an existing one. You cannot specify more than one network interface in the request. If launching into a default subnet, the default value is true.", + Description: "Indicates whether to assign a public IPv4 address to an machine you launch in a VPC. The public IP address can only be assigned to a network interface for eth0, and can only be assigned to a new network interface, not an existing one. You cannot specify more than one network interface in the request. If launching into a default subnet, the default value is true.", Type: []string{"boolean"}, Format: "", }, }, "deleteOnTermination": { SchemaProps: spec.SchemaProps{ - Description: "If set to true, the interface is deleted when the instance is terminated. You can specify true only if creating a new network interface when launching an instance.", + Description: "If set to true, the interface is deleted when the machine is terminated. You can specify true only if creating a new network interface when launching an machine.", Type: []string{"boolean"}, Format: "", }, }, "description": { SchemaProps: spec.SchemaProps{ - Description: "The description of the network interface. Applies only if creating a network interface when launching an instance.", + Description: "The description of the network interface. Applies only if creating a network interface when launching an machine.", Type: []string{"string"}, Format: "", }, }, "securityGroupID": { SchemaProps: spec.SchemaProps{ - Description: "The IDs of the security groups for the network interface. Applies only if creating a network interface when launching an instance.", + Description: "The IDs of the security groups for the network interface. Applies only if creating a network interface when launching an machine.", Type: []string{"array"}, Items: &spec.SchemaOrArray{ Schema: &spec.Schema{ @@ -332,7 +332,7 @@ func GetOpenAPIDefinitions(ref common.ReferenceCallback) map[string]common.OpenA }, "subnetID": { SchemaProps: spec.SchemaProps{ - Description: "The ID of the subnet associated with the network string. Applies only if creating a network interface when launching an instance.", + Description: "The ID of the subnet associated with the network string. Applies only if creating a network interface when launching an machine.", Type: []string{"string"}, Format: "", }, @@ -342,10 +342,10 @@ func GetOpenAPIDefinitions(ref common.ReferenceCallback) map[string]common.OpenA }, Dependencies: []string{}, }, - "github.com/gardener/node-controller-manager/pkg/apis/node/v1alpha1.ClassSpec": { + "github.com/gardener/node-controller-manager/pkg/apis/machine/v1alpha1.ClassSpec": { Schema: spec.Schema{ SchemaProps: spec.SchemaProps{ - Description: "ClassSpec is the class specification of instance", + Description: "ClassSpec is the class specification of machine", Properties: map[string]spec.Schema{ "apiGroup": { SchemaProps: spec.SchemaProps{ @@ -356,14 +356,14 @@ func GetOpenAPIDefinitions(ref common.ReferenceCallback) map[string]common.OpenA }, "kind": { SchemaProps: spec.SchemaProps{ - Description: "Kind for instance class", + Description: "Kind for machine class", Type: []string{"string"}, Format: "", }, }, "name": { SchemaProps: spec.SchemaProps{ - Description: "Name of instance class", + Description: "Name of machine class", Type: []string{"string"}, Format: "", }, @@ -373,7 +373,7 @@ func GetOpenAPIDefinitions(ref common.ReferenceCallback) map[string]common.OpenA }, Dependencies: []string{}, }, - "github.com/gardener/node-controller-manager/pkg/apis/node/v1alpha1.CurrentStatus": { + "github.com/gardener/node-controller-manager/pkg/apis/machine/v1alpha1.CurrentStatus": { Schema: spec.Schema{ SchemaProps: spec.SchemaProps{ Description: "type CurrentStatus", @@ -387,7 +387,7 @@ func GetOpenAPIDefinitions(ref common.ReferenceCallback) map[string]common.OpenA }, "timeoutActive": { SchemaProps: spec.SchemaProps{ - Description: "Name of instance class", + Description: "Name of machine class", Type: []string{"boolean"}, Format: "", }, @@ -404,10 +404,48 @@ func GetOpenAPIDefinitions(ref common.ReferenceCallback) map[string]common.OpenA Dependencies: []string{ "k8s.io/apimachinery/pkg/apis/meta/v1.Time"}, }, - "github.com/gardener/node-controller-manager/pkg/apis/node/v1alpha1.Instance": { + "github.com/gardener/node-controller-manager/pkg/apis/machine/v1alpha1.LastOperation": { Schema: spec.Schema{ SchemaProps: spec.SchemaProps{ - Description: "Instance TODO", + Description: "LastOperation", + Properties: map[string]spec.Schema{ + "description": { + SchemaProps: spec.SchemaProps{ + Description: "Description of the current operation", + Type: []string{"string"}, + Format: "", + }, + }, + "lastUpdateTime": { + SchemaProps: spec.SchemaProps{ + Description: "Last update time of current operation", + Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.Time"), + }, + }, + "state": { + SchemaProps: spec.SchemaProps{ + Description: "State of operation", + Type: []string{"string"}, + Format: "", + }, + }, + "type": { + SchemaProps: spec.SchemaProps{ + Description: "Type of operation", + Type: []string{"string"}, + Format: "", + }, + }, + }, + }, + }, + Dependencies: []string{ + "k8s.io/apimachinery/pkg/apis/meta/v1.Time"}, + }, + "github.com/gardener/node-controller-manager/pkg/apis/machine/v1alpha1.Machine": { + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "Machine TODO", Properties: map[string]spec.Schema{ "metadata": { SchemaProps: spec.SchemaProps{ @@ -430,21 +468,21 @@ func GetOpenAPIDefinitions(ref common.ReferenceCallback) map[string]common.OpenA }, "spec": { SchemaProps: spec.SchemaProps{ - Ref: ref("github.com/gardener/node-controller-manager/pkg/apis/node/v1alpha1.InstanceSpec"), + Ref: ref("github.com/gardener/node-controller-manager/pkg/apis/machine/v1alpha1.MachineSpec"), }, }, "status": { SchemaProps: spec.SchemaProps{ - Ref: ref("github.com/gardener/node-controller-manager/pkg/apis/node/v1alpha1.InstanceStatus"), + Ref: ref("github.com/gardener/node-controller-manager/pkg/apis/machine/v1alpha1.MachineStatus"), }, }, }, }, }, Dependencies: []string{ - "github.com/gardener/node-controller-manager/pkg/apis/node/v1alpha1.InstanceSpec", "github.com/gardener/node-controller-manager/pkg/apis/node/v1alpha1.InstanceStatus", "k8s.io/apimachinery/pkg/apis/meta/v1.ObjectMeta"}, + "github.com/gardener/node-controller-manager/pkg/apis/machine/v1alpha1.MachineSpec", "github.com/gardener/node-controller-manager/pkg/apis/machine/v1alpha1.MachineStatus", "k8s.io/apimachinery/pkg/apis/meta/v1.ObjectMeta"}, }, - "github.com/gardener/node-controller-manager/pkg/apis/node/v1alpha1.InstanceDeployment": { + "github.com/gardener/node-controller-manager/pkg/apis/machine/v1alpha1.MachineDeployment": { Schema: spec.Schema{ SchemaProps: spec.SchemaProps{ Description: "DEPRECATED - This group version of Deployment is deprecated by apps/v1beta2/Deployment. See the release notes for more information. Deployment enables declarative updates for Pods and ReplicaSets.", @@ -472,22 +510,22 @@ func GetOpenAPIDefinitions(ref common.ReferenceCallback) map[string]common.OpenA "spec": { SchemaProps: spec.SchemaProps{ Description: "Specification of the desired behavior of the Deployment.", - Ref: ref("github.com/gardener/node-controller-manager/pkg/apis/node/v1alpha1.InstanceDeploymentSpec"), + Ref: ref("github.com/gardener/node-controller-manager/pkg/apis/machine/v1alpha1.MachineDeploymentSpec"), }, }, "status": { SchemaProps: spec.SchemaProps{ Description: "Most recently observed status of the Deployment.", - Ref: ref("github.com/gardener/node-controller-manager/pkg/apis/node/v1alpha1.InstanceDeploymentStatus"), + Ref: ref("github.com/gardener/node-controller-manager/pkg/apis/machine/v1alpha1.MachineDeploymentStatus"), }, }, }, }, }, Dependencies: []string{ - "github.com/gardener/node-controller-manager/pkg/apis/node/v1alpha1.InstanceDeploymentSpec", "github.com/gardener/node-controller-manager/pkg/apis/node/v1alpha1.InstanceDeploymentStatus", "k8s.io/apimachinery/pkg/apis/meta/v1.ObjectMeta"}, + "github.com/gardener/node-controller-manager/pkg/apis/machine/v1alpha1.MachineDeploymentSpec", "github.com/gardener/node-controller-manager/pkg/apis/machine/v1alpha1.MachineDeploymentStatus", "k8s.io/apimachinery/pkg/apis/meta/v1.ObjectMeta"}, }, - "github.com/gardener/node-controller-manager/pkg/apis/node/v1alpha1.InstanceDeploymentCondition": { + "github.com/gardener/node-controller-manager/pkg/apis/machine/v1alpha1.MachineDeploymentCondition": { Schema: spec.Schema{ SchemaProps: spec.SchemaProps{ Description: "DeploymentCondition describes the state of a deployment at a certain point.", @@ -539,7 +577,7 @@ func GetOpenAPIDefinitions(ref common.ReferenceCallback) map[string]common.OpenA Dependencies: []string{ "k8s.io/apimachinery/pkg/apis/meta/v1.Time"}, }, - "github.com/gardener/node-controller-manager/pkg/apis/node/v1alpha1.InstanceDeploymentList": { + "github.com/gardener/node-controller-manager/pkg/apis/machine/v1alpha1.MachineDeploymentList": { Schema: spec.Schema{ SchemaProps: spec.SchemaProps{ Description: "DeploymentList is a list of Deployments.", @@ -571,7 +609,7 @@ func GetOpenAPIDefinitions(ref common.ReferenceCallback) map[string]common.OpenA Items: &spec.SchemaOrArray{ Schema: &spec.Schema{ SchemaProps: spec.SchemaProps{ - Ref: ref("github.com/gardener/node-controller-manager/pkg/apis/node/v1alpha1.InstanceDeployment"), + Ref: ref("github.com/gardener/node-controller-manager/pkg/apis/machine/v1alpha1.MachineDeployment"), }, }, }, @@ -582,9 +620,9 @@ func GetOpenAPIDefinitions(ref common.ReferenceCallback) map[string]common.OpenA }, }, Dependencies: []string{ - "github.com/gardener/node-controller-manager/pkg/apis/node/v1alpha1.InstanceDeployment", "k8s.io/apimachinery/pkg/apis/meta/v1.ListMeta"}, + "github.com/gardener/node-controller-manager/pkg/apis/machine/v1alpha1.MachineDeployment", "k8s.io/apimachinery/pkg/apis/meta/v1.ListMeta"}, }, - "github.com/gardener/node-controller-manager/pkg/apis/node/v1alpha1.InstanceDeploymentRollback": { + "github.com/gardener/node-controller-manager/pkg/apis/machine/v1alpha1.MachineDeploymentRollback": { Schema: spec.Schema{ SchemaProps: spec.SchemaProps{ Description: "DEPRECATED. DeploymentRollback stores the information required to rollback a deployment.", @@ -627,7 +665,7 @@ func GetOpenAPIDefinitions(ref common.ReferenceCallback) map[string]common.OpenA "rollbackTo": { SchemaProps: spec.SchemaProps{ Description: "The config of this deployment rollback.", - Ref: ref("github.com/gardener/node-controller-manager/pkg/apis/node/v1alpha1.RollbackConfig"), + Ref: ref("github.com/gardener/node-controller-manager/pkg/apis/machine/v1alpha1.RollbackConfig"), }, }, }, @@ -635,9 +673,9 @@ func GetOpenAPIDefinitions(ref common.ReferenceCallback) map[string]common.OpenA }, }, Dependencies: []string{ - "github.com/gardener/node-controller-manager/pkg/apis/node/v1alpha1.RollbackConfig"}, + "github.com/gardener/node-controller-manager/pkg/apis/machine/v1alpha1.RollbackConfig"}, }, - "github.com/gardener/node-controller-manager/pkg/apis/node/v1alpha1.InstanceDeploymentSpec": { + "github.com/gardener/node-controller-manager/pkg/apis/machine/v1alpha1.MachineDeploymentSpec": { Schema: spec.Schema{ SchemaProps: spec.SchemaProps{ Description: "DeploymentSpec is the specification of the desired behavior of the Deployment.", @@ -658,7 +696,7 @@ func GetOpenAPIDefinitions(ref common.ReferenceCallback) map[string]common.OpenA "template": { SchemaProps: spec.SchemaProps{ Description: "Template describes the pods that will be created.", - Ref: ref("github.com/gardener/node-controller-manager/pkg/apis/node/v1alpha1.InstanceTemplateSpec"), + Ref: ref("github.com/gardener/node-controller-manager/pkg/apis/machine/v1alpha1.MachineTemplateSpec"), }, }, "strategy": { @@ -669,7 +707,7 @@ func GetOpenAPIDefinitions(ref common.ReferenceCallback) map[string]common.OpenA }, SchemaProps: spec.SchemaProps{ Description: "The deployment strategy to use to replace existing pods with new ones.", - Ref: ref("github.com/gardener/node-controller-manager/pkg/apis/node/v1alpha1.InstanceDeploymentStrategy"), + Ref: ref("github.com/gardener/node-controller-manager/pkg/apis/machine/v1alpha1.MachineDeploymentStrategy"), }, }, "minReadySeconds": { @@ -696,7 +734,7 @@ func GetOpenAPIDefinitions(ref common.ReferenceCallback) map[string]common.OpenA "rollbackTo": { SchemaProps: spec.SchemaProps{ Description: "DEPRECATED. The config this deployment is rolling back to. Will be cleared after rollback is done.", - Ref: ref("github.com/gardener/node-controller-manager/pkg/apis/node/v1alpha1.RollbackConfig"), + Ref: ref("github.com/gardener/node-controller-manager/pkg/apis/machine/v1alpha1.RollbackConfig"), }, }, "progressDeadlineSeconds": { @@ -711,9 +749,9 @@ func GetOpenAPIDefinitions(ref common.ReferenceCallback) map[string]common.OpenA }, }, Dependencies: []string{ - "github.com/gardener/node-controller-manager/pkg/apis/node/v1alpha1.InstanceDeploymentStrategy", "github.com/gardener/node-controller-manager/pkg/apis/node/v1alpha1.InstanceTemplateSpec", "github.com/gardener/node-controller-manager/pkg/apis/node/v1alpha1.RollbackConfig", "k8s.io/apimachinery/pkg/apis/meta/v1.LabelSelector"}, + "github.com/gardener/node-controller-manager/pkg/apis/machine/v1alpha1.MachineDeploymentStrategy", "github.com/gardener/node-controller-manager/pkg/apis/machine/v1alpha1.MachineTemplateSpec", "github.com/gardener/node-controller-manager/pkg/apis/machine/v1alpha1.RollbackConfig", "k8s.io/apimachinery/pkg/apis/meta/v1.LabelSelector"}, }, - "github.com/gardener/node-controller-manager/pkg/apis/node/v1alpha1.InstanceDeploymentStatus": { + "github.com/gardener/node-controller-manager/pkg/apis/machine/v1alpha1.MachineDeploymentStatus": { Schema: spec.Schema{ SchemaProps: spec.SchemaProps{ Description: "DeploymentStatus is the most recently observed status of the Deployment.", @@ -773,7 +811,7 @@ func GetOpenAPIDefinitions(ref common.ReferenceCallback) map[string]common.OpenA Items: &spec.SchemaOrArray{ Schema: &spec.Schema{ SchemaProps: spec.SchemaProps{ - Ref: ref("github.com/gardener/node-controller-manager/pkg/apis/node/v1alpha1.InstanceDeploymentCondition"), + Ref: ref("github.com/gardener/node-controller-manager/pkg/apis/machine/v1alpha1.MachineDeploymentCondition"), }, }, }, @@ -790,9 +828,9 @@ func GetOpenAPIDefinitions(ref common.ReferenceCallback) map[string]common.OpenA }, }, Dependencies: []string{ - "github.com/gardener/node-controller-manager/pkg/apis/node/v1alpha1.InstanceDeploymentCondition"}, + "github.com/gardener/node-controller-manager/pkg/apis/machine/v1alpha1.MachineDeploymentCondition"}, }, - "github.com/gardener/node-controller-manager/pkg/apis/node/v1alpha1.InstanceDeploymentStrategy": { + "github.com/gardener/node-controller-manager/pkg/apis/machine/v1alpha1.MachineDeploymentStrategy": { Schema: spec.Schema{ SchemaProps: spec.SchemaProps{ Description: "DeploymentStrategy describes how to replace existing pods with new ones.", @@ -807,19 +845,19 @@ func GetOpenAPIDefinitions(ref common.ReferenceCallback) map[string]common.OpenA "rollingUpdate": { SchemaProps: spec.SchemaProps{ Description: "Rolling update config params. Present only if DeploymentStrategyType = RollingUpdate.", - Ref: ref("github.com/gardener/node-controller-manager/pkg/apis/node/v1alpha1.RollingUpdateInstanceDeployment"), + Ref: ref("github.com/gardener/node-controller-manager/pkg/apis/machine/v1alpha1.RollingUpdateMachineDeployment"), }, }, }, }, }, Dependencies: []string{ - "github.com/gardener/node-controller-manager/pkg/apis/node/v1alpha1.RollingUpdateInstanceDeployment"}, + "github.com/gardener/node-controller-manager/pkg/apis/machine/v1alpha1.RollingUpdateMachineDeployment"}, }, - "github.com/gardener/node-controller-manager/pkg/apis/node/v1alpha1.InstanceList": { + "github.com/gardener/node-controller-manager/pkg/apis/machine/v1alpha1.MachineList": { Schema: spec.Schema{ SchemaProps: spec.SchemaProps{ - Description: "InstanceList is a collection of Instances.", + Description: "MachineList is a collection of Machines.", Properties: map[string]spec.Schema{ "kind": { SchemaProps: spec.SchemaProps{ @@ -846,7 +884,7 @@ func GetOpenAPIDefinitions(ref common.ReferenceCallback) map[string]common.OpenA Items: &spec.SchemaOrArray{ Schema: &spec.Schema{ SchemaProps: spec.SchemaProps{ - Ref: ref("github.com/gardener/node-controller-manager/pkg/apis/node/v1alpha1.Instance"), + Ref: ref("github.com/gardener/node-controller-manager/pkg/apis/machine/v1alpha1.Machine"), }, }, }, @@ -857,12 +895,12 @@ func GetOpenAPIDefinitions(ref common.ReferenceCallback) map[string]common.OpenA }, }, Dependencies: []string{ - "github.com/gardener/node-controller-manager/pkg/apis/node/v1alpha1.Instance", "k8s.io/apimachinery/pkg/apis/meta/v1.ListMeta"}, + "github.com/gardener/node-controller-manager/pkg/apis/machine/v1alpha1.Machine", "k8s.io/apimachinery/pkg/apis/meta/v1.ListMeta"}, }, - "github.com/gardener/node-controller-manager/pkg/apis/node/v1alpha1.InstanceSet": { + "github.com/gardener/node-controller-manager/pkg/apis/machine/v1alpha1.MachineSet": { Schema: spec.Schema{ SchemaProps: spec.SchemaProps{ - Description: "InstanceSet TODO", + Description: "MachineSet TODO", Properties: map[string]spec.Schema{ "metadata": { SchemaProps: spec.SchemaProps{ @@ -885,28 +923,28 @@ func GetOpenAPIDefinitions(ref common.ReferenceCallback) map[string]common.OpenA }, "spec": { SchemaProps: spec.SchemaProps{ - Ref: ref("github.com/gardener/node-controller-manager/pkg/apis/node/v1alpha1.InstanceSetSpec"), + Ref: ref("github.com/gardener/node-controller-manager/pkg/apis/machine/v1alpha1.MachineSetSpec"), }, }, "status": { SchemaProps: spec.SchemaProps{ - Ref: ref("github.com/gardener/node-controller-manager/pkg/apis/node/v1alpha1.InstanceSetStatus"), + Ref: ref("github.com/gardener/node-controller-manager/pkg/apis/machine/v1alpha1.MachineSetStatus"), }, }, }, }, }, Dependencies: []string{ - "github.com/gardener/node-controller-manager/pkg/apis/node/v1alpha1.InstanceSetSpec", "github.com/gardener/node-controller-manager/pkg/apis/node/v1alpha1.InstanceSetStatus", "k8s.io/apimachinery/pkg/apis/meta/v1.ObjectMeta"}, + "github.com/gardener/node-controller-manager/pkg/apis/machine/v1alpha1.MachineSetSpec", "github.com/gardener/node-controller-manager/pkg/apis/machine/v1alpha1.MachineSetStatus", "k8s.io/apimachinery/pkg/apis/meta/v1.ObjectMeta"}, }, - "github.com/gardener/node-controller-manager/pkg/apis/node/v1alpha1.InstanceSetCondition": { + "github.com/gardener/node-controller-manager/pkg/apis/machine/v1alpha1.MachineSetCondition": { Schema: spec.Schema{ SchemaProps: spec.SchemaProps{ - Description: "ReplicaSetCondition describes the state of a instance set at a certain point.", + Description: "ReplicaSetCondition describes the state of a machine set at a certain point.", Properties: map[string]spec.Schema{ "type": { SchemaProps: spec.SchemaProps{ - Description: "Type of instance set condition.", + Description: "Type of machine set condition.", Type: []string{"string"}, Format: "", }, @@ -945,10 +983,10 @@ func GetOpenAPIDefinitions(ref common.ReferenceCallback) map[string]common.OpenA Dependencies: []string{ "k8s.io/apimachinery/pkg/apis/meta/v1.Time"}, }, - "github.com/gardener/node-controller-manager/pkg/apis/node/v1alpha1.InstanceSetList": { + "github.com/gardener/node-controller-manager/pkg/apis/machine/v1alpha1.MachineSetList": { Schema: spec.Schema{ SchemaProps: spec.SchemaProps{ - Description: "InstanceSetList is a collection of InstanceSet.", + Description: "MachineSetList is a collection of MachineSet.", Properties: map[string]spec.Schema{ "kind": { SchemaProps: spec.SchemaProps{ @@ -975,7 +1013,7 @@ func GetOpenAPIDefinitions(ref common.ReferenceCallback) map[string]common.OpenA Items: &spec.SchemaOrArray{ Schema: &spec.Schema{ SchemaProps: spec.SchemaProps{ - Ref: ref("github.com/gardener/node-controller-manager/pkg/apis/node/v1alpha1.InstanceSet"), + Ref: ref("github.com/gardener/node-controller-manager/pkg/apis/machine/v1alpha1.MachineSet"), }, }, }, @@ -986,59 +1024,59 @@ func GetOpenAPIDefinitions(ref common.ReferenceCallback) map[string]common.OpenA }, }, Dependencies: []string{ - "github.com/gardener/node-controller-manager/pkg/apis/node/v1alpha1.InstanceSet", "k8s.io/apimachinery/pkg/apis/meta/v1.ListMeta"}, + "github.com/gardener/node-controller-manager/pkg/apis/machine/v1alpha1.MachineSet", "k8s.io/apimachinery/pkg/apis/meta/v1.ListMeta"}, }, - "github.com/gardener/node-controller-manager/pkg/apis/node/v1alpha1.InstanceSetSpec": { + "github.com/gardener/node-controller-manager/pkg/apis/machine/v1alpha1.MachineSetSpec": { Schema: spec.Schema{ SchemaProps: spec.SchemaProps{ - Description: "InstanceSetSpec is the specification of a Shoot cluster.", + Description: "MachineSetSpec is the specification of a Shoot cluster.", Properties: map[string]spec.Schema{ "selector": { SchemaProps: spec.SchemaProps{ Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.LabelSelector"), }, }, - "instanceClass": { + "machineClass": { SchemaProps: spec.SchemaProps{ - Ref: ref("github.com/gardener/node-controller-manager/pkg/apis/node/v1alpha1.ClassSpec"), + Ref: ref("github.com/gardener/node-controller-manager/pkg/apis/machine/v1alpha1.ClassSpec"), }, }, "template": { SchemaProps: spec.SchemaProps{ - Ref: ref("github.com/gardener/node-controller-manager/pkg/apis/node/v1alpha1.InstanceTemplateSpec"), + Ref: ref("github.com/gardener/node-controller-manager/pkg/apis/machine/v1alpha1.MachineTemplateSpec"), }, }, }, }, }, Dependencies: []string{ - "github.com/gardener/node-controller-manager/pkg/apis/node/v1alpha1.ClassSpec", "github.com/gardener/node-controller-manager/pkg/apis/node/v1alpha1.InstanceTemplateSpec", "k8s.io/apimachinery/pkg/apis/meta/v1.LabelSelector"}, + "github.com/gardener/node-controller-manager/pkg/apis/machine/v1alpha1.ClassSpec", "github.com/gardener/node-controller-manager/pkg/apis/machine/v1alpha1.MachineTemplateSpec", "k8s.io/apimachinery/pkg/apis/meta/v1.LabelSelector"}, }, - "github.com/gardener/node-controller-manager/pkg/apis/node/v1alpha1.InstanceSetStatus": { + "github.com/gardener/node-controller-manager/pkg/apis/machine/v1alpha1.MachineSetStatus": { Schema: spec.Schema{ SchemaProps: spec.SchemaProps{ - Description: "InstanceSetStatus TODO", + Description: "MachineSetStatus TODO", Properties: map[string]spec.Schema{ "lastOperation": { SchemaProps: spec.SchemaProps{ - Description: "Conditions of this instance, same as node", - Ref: ref("github.com/gardener/node-controller-manager/pkg/apis/node/v1alpha1.LastOperation"), + Description: "Conditions of this machine, same as node", + Ref: ref("github.com/gardener/node-controller-manager/pkg/apis/machine/v1alpha1.LastOperation"), }, }, }, }, }, Dependencies: []string{ - "github.com/gardener/node-controller-manager/pkg/apis/node/v1alpha1.LastOperation"}, + "github.com/gardener/node-controller-manager/pkg/apis/machine/v1alpha1.LastOperation"}, }, - "github.com/gardener/node-controller-manager/pkg/apis/node/v1alpha1.InstanceSpec": { + "github.com/gardener/node-controller-manager/pkg/apis/machine/v1alpha1.MachineSpec": { Schema: spec.Schema{ SchemaProps: spec.SchemaProps{ - Description: "InstanceSpec is the specification of a Shoot cluster.", + Description: "MachineSpec is the specification of a Shoot cluster.", Properties: map[string]spec.Schema{ "class": { SchemaProps: spec.SchemaProps{ - Ref: ref("github.com/gardener/node-controller-manager/pkg/apis/node/v1alpha1.ClassSpec"), + Ref: ref("github.com/gardener/node-controller-manager/pkg/apis/machine/v1alpha1.ClassSpec"), }, }, "providerID": { @@ -1051,12 +1089,12 @@ func GetOpenAPIDefinitions(ref common.ReferenceCallback) map[string]common.OpenA }, }, Dependencies: []string{ - "github.com/gardener/node-controller-manager/pkg/apis/node/v1alpha1.ClassSpec"}, + "github.com/gardener/node-controller-manager/pkg/apis/machine/v1alpha1.ClassSpec"}, }, - "github.com/gardener/node-controller-manager/pkg/apis/node/v1alpha1.InstanceStatus": { + "github.com/gardener/node-controller-manager/pkg/apis/machine/v1alpha1.MachineStatus": { Schema: spec.Schema{ SchemaProps: spec.SchemaProps{ - Description: "InstanceStatus TODO", + Description: "MachineStatus TODO", Properties: map[string]spec.Schema{ "node": { SchemaProps: spec.SchemaProps{ @@ -1067,7 +1105,7 @@ func GetOpenAPIDefinitions(ref common.ReferenceCallback) map[string]common.OpenA }, "conditions": { SchemaProps: spec.SchemaProps{ - Description: "Conditions of this instance, same as node", + Description: "Conditions of this machine, same as node", Type: []string{"array"}, Items: &spec.SchemaOrArray{ Schema: &spec.Schema{ @@ -1081,22 +1119,22 @@ func GetOpenAPIDefinitions(ref common.ReferenceCallback) map[string]common.OpenA "lastOperation": { SchemaProps: spec.SchemaProps{ Description: "Last operation refers to the status of the last operation performed", - Ref: ref("github.com/gardener/node-controller-manager/pkg/apis/node/v1alpha1.LastOperation"), + Ref: ref("github.com/gardener/node-controller-manager/pkg/apis/machine/v1alpha1.LastOperation"), }, }, "currentStatus": { SchemaProps: spec.SchemaProps{ - Description: "Current status of the instance object", - Ref: ref("github.com/gardener/node-controller-manager/pkg/apis/node/v1alpha1.CurrentStatus"), + Description: "Current status of the machine object", + Ref: ref("github.com/gardener/node-controller-manager/pkg/apis/machine/v1alpha1.CurrentStatus"), }, }, }, }, }, Dependencies: []string{ - "github.com/gardener/node-controller-manager/pkg/apis/node/v1alpha1.CurrentStatus", "github.com/gardener/node-controller-manager/pkg/apis/node/v1alpha1.LastOperation", "k8s.io/api/core/v1.NodeCondition"}, + "github.com/gardener/node-controller-manager/pkg/apis/machine/v1alpha1.CurrentStatus", "github.com/gardener/node-controller-manager/pkg/apis/machine/v1alpha1.LastOperation", "k8s.io/api/core/v1.NodeCondition"}, }, - "github.com/gardener/node-controller-manager/pkg/apis/node/v1alpha1.InstanceTemplate": { + "github.com/gardener/node-controller-manager/pkg/apis/machine/v1alpha1.MachineTemplate": { Schema: spec.Schema{ SchemaProps: spec.SchemaProps{ Description: "PodTemplate describes a template for creating copies of a predefined pod.", @@ -1124,16 +1162,16 @@ func GetOpenAPIDefinitions(ref common.ReferenceCallback) map[string]common.OpenA "template": { SchemaProps: spec.SchemaProps{ Description: "Template defines the pods that will be created from this pod template. https://git.k8s.io/community/contributors/devel/api-conventions.md#spec-and-status", - Ref: ref("github.com/gardener/node-controller-manager/pkg/apis/node/v1alpha1.InstanceTemplateSpec"), + Ref: ref("github.com/gardener/node-controller-manager/pkg/apis/machine/v1alpha1.MachineTemplateSpec"), }, }, }, }, }, Dependencies: []string{ - "github.com/gardener/node-controller-manager/pkg/apis/node/v1alpha1.InstanceTemplateSpec", "k8s.io/apimachinery/pkg/apis/meta/v1.ObjectMeta"}, + "github.com/gardener/node-controller-manager/pkg/apis/machine/v1alpha1.MachineTemplateSpec", "k8s.io/apimachinery/pkg/apis/meta/v1.ObjectMeta"}, }, - "github.com/gardener/node-controller-manager/pkg/apis/node/v1alpha1.InstanceTemplateList": { + "github.com/gardener/node-controller-manager/pkg/apis/machine/v1alpha1.MachineTemplateList": { Schema: spec.Schema{ SchemaProps: spec.SchemaProps{ Description: "PodTemplateList is a list of PodTemplates.", @@ -1165,7 +1203,7 @@ func GetOpenAPIDefinitions(ref common.ReferenceCallback) map[string]common.OpenA Items: &spec.SchemaOrArray{ Schema: &spec.Schema{ SchemaProps: spec.SchemaProps{ - Ref: ref("github.com/gardener/node-controller-manager/pkg/apis/node/v1alpha1.InstanceTemplate"), + Ref: ref("github.com/gardener/node-controller-manager/pkg/apis/machine/v1alpha1.MachineTemplate"), }, }, }, @@ -1176,9 +1214,9 @@ func GetOpenAPIDefinitions(ref common.ReferenceCallback) map[string]common.OpenA }, }, Dependencies: []string{ - "github.com/gardener/node-controller-manager/pkg/apis/node/v1alpha1.InstanceTemplate", "k8s.io/apimachinery/pkg/apis/meta/v1.ListMeta"}, + "github.com/gardener/node-controller-manager/pkg/apis/machine/v1alpha1.MachineTemplate", "k8s.io/apimachinery/pkg/apis/meta/v1.ListMeta"}, }, - "github.com/gardener/node-controller-manager/pkg/apis/node/v1alpha1.InstanceTemplateSpec": { + "github.com/gardener/node-controller-manager/pkg/apis/machine/v1alpha1.MachineTemplateSpec": { Schema: spec.Schema{ SchemaProps: spec.SchemaProps{ Description: "PodTemplateSpec describes the data a pod should have when created from a template", @@ -1192,54 +1230,16 @@ func GetOpenAPIDefinitions(ref common.ReferenceCallback) map[string]common.OpenA "spec": { SchemaProps: spec.SchemaProps{ Description: "Specification of the desired behavior of the pod. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#spec-and-status", - Ref: ref("github.com/gardener/node-controller-manager/pkg/apis/node/v1alpha1.InstanceSpec"), + Ref: ref("github.com/gardener/node-controller-manager/pkg/apis/machine/v1alpha1.MachineSpec"), }, }, }, }, }, Dependencies: []string{ - "github.com/gardener/node-controller-manager/pkg/apis/node/v1alpha1.InstanceSpec", "k8s.io/apimachinery/pkg/apis/meta/v1.ObjectMeta"}, - }, - "github.com/gardener/node-controller-manager/pkg/apis/node/v1alpha1.LastOperation": { - Schema: spec.Schema{ - SchemaProps: spec.SchemaProps{ - Description: "LastOperation", - Properties: map[string]spec.Schema{ - "description": { - SchemaProps: spec.SchemaProps{ - Description: "Description of the current operation", - Type: []string{"string"}, - Format: "", - }, - }, - "lastUpdateTime": { - SchemaProps: spec.SchemaProps{ - Description: "Last update time of current operation", - Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.Time"), - }, - }, - "state": { - SchemaProps: spec.SchemaProps{ - Description: "State of operation", - Type: []string{"string"}, - Format: "", - }, - }, - "type": { - SchemaProps: spec.SchemaProps{ - Description: "Type of operation", - Type: []string{"string"}, - Format: "", - }, - }, - }, - }, - }, - Dependencies: []string{ - "k8s.io/apimachinery/pkg/apis/meta/v1.Time"}, + "github.com/gardener/node-controller-manager/pkg/apis/machine/v1alpha1.MachineSpec", "k8s.io/apimachinery/pkg/apis/meta/v1.ObjectMeta"}, }, - "github.com/gardener/node-controller-manager/pkg/apis/node/v1alpha1.RollbackConfig": { + "github.com/gardener/node-controller-manager/pkg/apis/machine/v1alpha1.RollbackConfig": { Schema: spec.Schema{ SchemaProps: spec.SchemaProps{ Description: "DEPRECATED.", @@ -1256,7 +1256,7 @@ func GetOpenAPIDefinitions(ref common.ReferenceCallback) map[string]common.OpenA }, Dependencies: []string{}, }, - "github.com/gardener/node-controller-manager/pkg/apis/node/v1alpha1.RollingUpdateInstanceDeployment": { + "github.com/gardener/node-controller-manager/pkg/apis/machine/v1alpha1.RollingUpdateMachineDeployment": { Schema: spec.Schema{ SchemaProps: spec.SchemaProps{ Description: "Spec to control the desired behavior of rolling update.", @@ -1279,7 +1279,7 @@ func GetOpenAPIDefinitions(ref common.ReferenceCallback) map[string]common.OpenA Dependencies: []string{ "k8s.io/apimachinery/pkg/util/intstr.IntOrString"}, }, - "github.com/gardener/node-controller-manager/pkg/apis/node/v1alpha1.Scale": { + "github.com/gardener/node-controller-manager/pkg/apis/machine/v1alpha1.Scale": { Schema: spec.Schema{ SchemaProps: spec.SchemaProps{ Description: "represents a scaling request for a resource.", @@ -1307,29 +1307,29 @@ func GetOpenAPIDefinitions(ref common.ReferenceCallback) map[string]common.OpenA "spec": { SchemaProps: spec.SchemaProps{ Description: "defines the behavior of the scale. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#spec-and-status.", - Ref: ref("github.com/gardener/node-controller-manager/pkg/apis/node/v1alpha1.ScaleSpec"), + Ref: ref("github.com/gardener/node-controller-manager/pkg/apis/machine/v1alpha1.ScaleSpec"), }, }, "status": { SchemaProps: spec.SchemaProps{ Description: "current status of the scale. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#spec-and-status. Read-only.", - Ref: ref("github.com/gardener/node-controller-manager/pkg/apis/node/v1alpha1.ScaleStatus"), + Ref: ref("github.com/gardener/node-controller-manager/pkg/apis/machine/v1alpha1.ScaleStatus"), }, }, }, }, }, Dependencies: []string{ - "github.com/gardener/node-controller-manager/pkg/apis/node/v1alpha1.ScaleSpec", "github.com/gardener/node-controller-manager/pkg/apis/node/v1alpha1.ScaleStatus", "k8s.io/apimachinery/pkg/apis/meta/v1.ObjectMeta"}, + "github.com/gardener/node-controller-manager/pkg/apis/machine/v1alpha1.ScaleSpec", "github.com/gardener/node-controller-manager/pkg/apis/machine/v1alpha1.ScaleStatus", "k8s.io/apimachinery/pkg/apis/meta/v1.ObjectMeta"}, }, - "github.com/gardener/node-controller-manager/pkg/apis/node/v1alpha1.ScaleSpec": { + "github.com/gardener/node-controller-manager/pkg/apis/machine/v1alpha1.ScaleSpec": { Schema: spec.Schema{ SchemaProps: spec.SchemaProps{ Description: "describes the attributes of a scale subresource", Properties: map[string]spec.Schema{ "replicas": { SchemaProps: spec.SchemaProps{ - Description: "desired number of instances for the scaled object.", + Description: "desired number of machines for the scaled object.", Type: []string{"integer"}, Format: "int32", }, @@ -1339,14 +1339,14 @@ func GetOpenAPIDefinitions(ref common.ReferenceCallback) map[string]common.OpenA }, Dependencies: []string{}, }, - "github.com/gardener/node-controller-manager/pkg/apis/node/v1alpha1.ScaleStatus": { + "github.com/gardener/node-controller-manager/pkg/apis/machine/v1alpha1.ScaleStatus": { Schema: spec.Schema{ SchemaProps: spec.SchemaProps{ Description: "represents the current status of a scale subresource.", Properties: map[string]spec.Schema{ "replicas": { SchemaProps: spec.SchemaProps{ - Description: "actual number of observed instances of the scaled object.", + Description: "actual number of observed machines of the scaled object.", Type: []string{"integer"}, Format: "int32", },