diff --git a/0001-Delete-annotated-machines-first-when-scaling-down.patch b/0001-Delete-annotated-machines-first-when-scaling-down.patch deleted file mode 100644 index 0342c3e65..000000000 --- a/0001-Delete-annotated-machines-first-when-scaling-down.patch +++ /dev/null @@ -1,33 +0,0 @@ -From 63c900811bf02ddaeea04fffe9cbf2e3471788d1 Mon Sep 17 00:00:00 2001 -From: Jan Chaloupka -Date: Fri, 21 Dec 2018 16:02:17 +0100 -Subject: [PATCH] Delete annotated machines first when scaling down - ---- - .../cluster-api/pkg/controller/machineset/delete_policy.go | 6 ++++++ - 1 file changed, 6 insertions(+) - -diff --git a/vendor/sigs.k8s.io/cluster-api/pkg/controller/machineset/delete_policy.go b/vendor/sigs.k8s.io/cluster-api/pkg/controller/machineset/delete_policy.go -index 2c2a101..9f5e519 100644 ---- a/vendor/sigs.k8s.io/cluster-api/pkg/controller/machineset/delete_policy.go -+++ b/vendor/sigs.k8s.io/cluster-api/pkg/controller/machineset/delete_policy.go -@@ -31,10 +31,16 @@ const ( - - type deletePriorityFunc func(machine *v1alpha1.Machine) deletePriority - -+// machineDeleteAnnotationKey annotates machines to be delete among first ones -+var machineDeleteAnnotationKey = "sigs.k8s.io/cluster-api-delete-machine" -+ - func simpleDeletePriority(machine *v1alpha1.Machine) deletePriority { - if machine.DeletionTimestamp != nil && !machine.DeletionTimestamp.IsZero() { - return mustDelete - } -+ if _, exists := machine.Annotations[machineDeleteAnnotationKey]; exists { -+ return mustDelete -+ } - if machine.Status.ErrorReason != nil || machine.Status.ErrorMessage != nil { - return betterDelete - } --- -2.7.5 - diff --git a/0001-Upstream-677-Init-klog-in-manager-properly.patch b/0001-Upstream-677-Init-klog-in-manager-properly.patch deleted file mode 100644 index 5d4bfcc6d..000000000 --- a/0001-Upstream-677-Init-klog-in-manager-properly.patch +++ /dev/null @@ -1,103 +0,0 @@ -From f8f05443cf2774f22484fda02a5edac4a1251713 Mon Sep 17 00:00:00 2001 -From: Jan Chaloupka -Date: Tue, 15 Jan 2019 10:28:40 +0100 -Subject: [PATCH 1/3] Upstream: 677: Init klog in manager properly - ---- - ...pstream-677-Init-klog-in-manager-properly.patch | 41 ++++++++++++++++++++++ - Makefile | 1 + - vendor/sigs.k8s.io/cluster-api/cmd/manager/main.go | 10 ++++++ - 3 files changed, 52 insertions(+) - create mode 100644 0001-Upstream-677-Init-klog-in-manager-properly.patch - -diff --git a/0001-Upstream-677-Init-klog-in-manager-properly.patch b/0001-Upstream-677-Init-klog-in-manager-properly.patch -new file mode 100644 -index 0000000..dca0f54 ---- /dev/null -+++ b/0001-Upstream-677-Init-klog-in-manager-properly.patch -@@ -0,0 +1,41 @@ -+From 6376c57e840a5ff57217ead3dd2633ee00c08d07 Mon Sep 17 00:00:00 2001 -+From: Jan Chaloupka -+Date: Tue, 15 Jan 2019 10:28:40 +0100 -+Subject: [PATCH] Upstream: 677: Init klog in manager properly -+ -+--- -+ vendor/sigs.k8s.io/cluster-api/cmd/manager/main.go | 10 ++++++++++ -+ 1 file changed, 10 insertions(+) -+ -+diff --git a/vendor/sigs.k8s.io/cluster-api/cmd/manager/main.go b/vendor/sigs.k8s.io/cluster-api/cmd/manager/main.go -+index 6c53802..6082803 100644 -+--- a/vendor/sigs.k8s.io/cluster-api/cmd/manager/main.go -++++ b/vendor/sigs.k8s.io/cluster-api/cmd/manager/main.go -+@@ -22,6 +22,7 @@ import ( -+ "flag" -+ -+ _ "k8s.io/client-go/plugin/pkg/client/auth/gcp" -++ "k8s.io/klog" -+ "sigs.k8s.io/cluster-api/pkg/apis" -+ "sigs.k8s.io/cluster-api/pkg/controller" -+ "sigs.k8s.io/controller-runtime/pkg/client/config" -+@@ -30,7 +31,16 @@ import ( -+ ) -+ -+ func main() { -++ klogFlags := flag.NewFlagSet("klog", flag.ExitOnError) -++ klog.InitFlags(klogFlags) -+ flag.Parse() -++ flag.VisitAll(func(f1 *flag.Flag) { -++ f2 := klogFlags.Lookup(f1.Name) -++ if f2 != nil { -++ value := f1.Value.String() -++ f2.Value.Set(value) -++ } -++ }) -+ -+ // Get a config to talk to the apiserver -+ cfg, err := config.GetConfig() -+-- -+2.7.5 -+ -diff --git a/Makefile b/Makefile -index 142c6ca..330c662 100644 ---- a/Makefile -+++ b/Makefile -@@ -47,6 +47,7 @@ vendor: - patch -p1 < 0001-Delete-annotated-machines-first-when-scaling-down.patch - patch -p1 < 0002-Sort-machines-before-syncing.patch - patch -p1 < 0001-Validate-machineset-before-reconciliation.patch -+ patch -p1 < 0001-Upstream-677-Init-klog-in-manager-properly.patch - - .PHONY: generate - generate: -diff --git a/vendor/sigs.k8s.io/cluster-api/cmd/manager/main.go b/vendor/sigs.k8s.io/cluster-api/cmd/manager/main.go -index 6c53802..6082803 100644 ---- a/vendor/sigs.k8s.io/cluster-api/cmd/manager/main.go -+++ b/vendor/sigs.k8s.io/cluster-api/cmd/manager/main.go -@@ -22,6 +22,7 @@ import ( - "flag" - - _ "k8s.io/client-go/plugin/pkg/client/auth/gcp" -+ "k8s.io/klog" - "sigs.k8s.io/cluster-api/pkg/apis" - "sigs.k8s.io/cluster-api/pkg/controller" - "sigs.k8s.io/controller-runtime/pkg/client/config" -@@ -30,7 +31,16 @@ import ( - ) - - func main() { -+ klogFlags := flag.NewFlagSet("klog", flag.ExitOnError) -+ klog.InitFlags(klogFlags) - flag.Parse() -+ flag.VisitAll(func(f1 *flag.Flag) { -+ f2 := klogFlags.Lookup(f1.Name) -+ if f2 != nil { -+ value := f1.Value.String() -+ f2.Value.Set(value) -+ } -+ }) - - // Get a config to talk to the apiserver - cfg, err := config.GetConfig() --- -2.7.5 - diff --git a/0001-Validate-machineset-before-reconciliation.patch b/0001-Validate-machineset-before-reconciliation.patch deleted file mode 100644 index 423967299..000000000 --- a/0001-Validate-machineset-before-reconciliation.patch +++ /dev/null @@ -1,30 +0,0 @@ -From 3200e454110d91955ab849c75db5ee60085c8991 Mon Sep 17 00:00:00 2001 -From: Jan Chaloupka -Date: Fri, 11 Jan 2019 12:31:06 +0100 -Subject: [PATCH] Validate machineset before reconciliation - ---- - .../cluster-api/pkg/controller/machineset/controller.go | 7 +++++++ - 1 file changed, 7 insertions(+) - -diff --git a/vendor/sigs.k8s.io/cluster-api/pkg/controller/machineset/controller.go b/vendor/sigs.k8s.io/cluster-api/pkg/controller/machineset/controller.go -index a1d3923..cb537bd 100644 ---- a/vendor/sigs.k8s.io/cluster-api/pkg/controller/machineset/controller.go -+++ b/vendor/sigs.k8s.io/cluster-api/pkg/controller/machineset/controller.go -@@ -150,6 +150,13 @@ func (r *ReconcileMachineSet) Reconcile(request reconcile.Request) (reconcile.Re - } - - klog.V(4).Infof("Reconcile machineset %v", machineSet.Name) -+ -+ if errList := machineSet.Validate(); len(errList) > 0 { -+ err := fmt.Errorf("%q machineset validation failed: %v", machineSet.Name, errList.ToAggregate().Error()) -+ klog.Error(err) -+ return reconcile.Result{}, err -+ } -+ - allMachines := &clusterv1alpha1.MachineList{} - - err = r.Client.List(context.Background(), client.InNamespace(machineSet.Namespace), allMachines) --- -2.7.5 - diff --git a/0001-use-Update-instead-of-Status.Update-as-CustomResourc.patch b/0001-use-Update-instead-of-Status.Update-as-CustomResourc.patch deleted file mode 100644 index bba1f929c..000000000 --- a/0001-use-Update-instead-of-Status.Update-as-CustomResourc.patch +++ /dev/null @@ -1,35 +0,0 @@ -From 16531c16bfa5030bb5f85d75f20353eeff46ba25 Mon Sep 17 00:00:00 2001 -From: Enxebre -Date: Fri, 19 Oct 2018 09:51:27 +0200 -Subject: [PATCH] use Update() instead of Status.Update() as - CustomResourceSubresources might not be enable - ---- - vendor/sigs.k8s.io/cluster-api/pkg/controller/node/node.go | 4 ++-- - 1 file changed, 2 insertions(+), 2 deletions(-) - -diff --git a/vendor/sigs.k8s.io/cluster-api/pkg/controller/node/node.go b/vendor/sigs.k8s.io/cluster-api/pkg/controller/node/node.go -index cb16730b..f1a4bff3 100644 ---- a/vendor/sigs.k8s.io/cluster-api/pkg/controller/node/node.go -+++ b/vendor/sigs.k8s.io/cluster-api/pkg/controller/node/node.go -@@ -75,7 +75,7 @@ func (c *ReconcileNode) link(node *corev1.Node) error { - t := metav1.Now() - machine.Status.LastUpdated = &t - machine.Status.NodeRef = objectRef(node) -- if err = c.Client.Status().Update(context.Background(), machine); err != nil { -+ if err = c.Client.Update(context.Background(), machine); err != nil { - glog.Errorf("Error updating machine to link to node: %v\n", err) - } else { - glog.Infof("Successfully linked machine %s to node %s\n", -@@ -121,7 +121,7 @@ func (c *ReconcileNode) unlink(node *corev1.Node) error { - t := metav1.Now() - machine.Status.LastUpdated = &t - machine.Status.NodeRef = nil -- if err = c.Client.Status().Update(context.Background(), machine); err != nil { -+ if err = c.Client.Update(context.Background(), machine); err != nil { - glog.Errorf("Error updating machine %s to unlink node %s: %v\n", - machine.ObjectMeta.Name, node.ObjectMeta.Name, err) - } else { --- -2.15.2 (Apple Git-101.1) - diff --git a/0002-Sort-machines-before-syncing.patch b/0002-Sort-machines-before-syncing.patch deleted file mode 100644 index 98658559e..000000000 --- a/0002-Sort-machines-before-syncing.patch +++ /dev/null @@ -1,51 +0,0 @@ -From ab07b60b23d26cc712a65d89abecf3ad495e2929 Mon Sep 17 00:00:00 2001 -From: Jan Chaloupka -Date: Sat, 20 Oct 2018 12:37:52 +0200 -Subject: [PATCH 2/2] Sort machines before syncing - ---- - .../cluster-api/pkg/controller/machineset/controller.go | 15 +++++++++++++-- - 1 file changed, 13 insertions(+), 2 deletions(-) - -diff --git a/vendor/sigs.k8s.io/cluster-api/pkg/controller/machineset/controller.go b/vendor/sigs.k8s.io/cluster-api/pkg/controller/machineset/controller.go -index 63a8051..ce303ca 100644 ---- a/vendor/sigs.k8s.io/cluster-api/pkg/controller/machineset/controller.go -+++ b/vendor/sigs.k8s.io/cluster-api/pkg/controller/machineset/controller.go -@@ -19,6 +19,7 @@ package machineset - import ( - "context" - "fmt" -+ "sort" - "strings" - "sync" - "time" -@@ -161,7 +162,8 @@ func (r *ReconcileMachineSet) Reconcile(request reconcile.Request) (reconcile.Re - } - - // Filter out irrelevant machines (deleting/mismatch labels) and claim orphaned machines. -- var filteredMachines []*clusterv1alpha1.Machine -+ var machineNames []string -+ machineSetMachines := make(map[string]*clusterv1alpha1.Machine) - for idx := range allMachines.Items { - machine := &allMachines.Items[idx] - if shouldExcludeMachine(machineSet, machine) { -@@ -174,7 +176,16 @@ func (r *ReconcileMachineSet) Reconcile(request reconcile.Request) (reconcile.Re - continue - } - } -- filteredMachines = append(filteredMachines, machine) -+ machineNames = append(machineNames, machine.Name) -+ machineSetMachines[machine.Name] = machine -+ } -+ -+ // sort the filteredMachines from the oldest to the youngest -+ sort.Strings(machineNames) -+ -+ var filteredMachines []*clusterv1alpha1.Machine -+ for _, machineName := range machineNames { -+ filteredMachines = append(filteredMachines, machineSetMachines[machineName]) - } - - syncErr := r.syncReplicas(machineSet, filteredMachines) --- -2.7.5 diff --git a/Dockerfile b/Dockerfile index 3d5099e35..41c98cf45 100644 --- a/Dockerfile +++ b/Dockerfile @@ -2,7 +2,7 @@ FROM registry.svc.ci.openshift.org/openshift/release:golang-1.10 AS builder WORKDIR /go/src/github.com/openshift/cluster-api-provider-libvirt COPY . . RUN go build -o machine-controller-manager ./cmd/manager -RUN go build -o manager ./vendor/sigs.k8s.io/cluster-api/cmd/manager +RUN go build -o manager ./vendor/github.com/openshift/cluster-api/cmd/manager FROM registry.svc.ci.openshift.org/openshift/origin-v4.0:base RUN INSTALL_PKGS=" \ diff --git a/Dockerfile.rhel7 b/Dockerfile.rhel7 index 6b1dd9557..71bf9b03f 100644 --- a/Dockerfile.rhel7 +++ b/Dockerfile.rhel7 @@ -2,7 +2,7 @@ FROM registry.svc.ci.openshift.org/ocp/builder:golang-1.10 AS builder WORKDIR /go/src/github.com/openshift/cluster-api-provider-libvirt COPY . . RUN go build -o machine-controller-manager ./cmd/manager -RUN go build -o manager ./vendor/sigs.k8s.io/cluster-api/cmd/manager +RUN go build -o manager ./vendor/github.com/openshift/cluster-api/cmd/manager FROM registry.svc.ci.openshift.org/ocp/4.0:base RUN INSTALL_PKGS=" \ diff --git a/Gopkg.lock b/Gopkg.lock index e07a5f827..0f63e7c8c 100644 --- a/Gopkg.lock +++ b/Gopkg.lock @@ -312,7 +312,29 @@ version = "v1.4.2" [[projects]] - digest = "1:8a5594cfb48c87f2e1d54ac443bc466c98e74484e4da43647f995836788a94ad" + digest = "1:c49c9300cc3bcc68bc1380ac1bad9ccc190f4f53c58dc208d805eda92c3b9279" + name = "github.com/openshift/cluster-api" + packages = [ + "pkg/apis", + "pkg/apis/cluster/common", + "pkg/apis/cluster/v1alpha1", + "pkg/apis/machine/common", + "pkg/apis/machine/v1beta1", + "pkg/client/clientset_generated/clientset", + "pkg/client/clientset_generated/clientset/scheme", + "pkg/client/clientset_generated/clientset/typed/cluster/v1alpha1", + "pkg/client/clientset_generated/clientset/typed/machine/v1beta1", + "pkg/client/clientset_generated/clientset/typed/machine/v1beta1/fake", + "pkg/controller/error", + "pkg/controller/machine", + "pkg/errors", + "pkg/util", + ] + pruneopts = "T" + revision = "91fca585a85b163ddfd119fd09c128c9feadddca" + +[[projects]] + digest = "1:b9b2d83cfe9f378dfc2cf7b224523d486c23135c3fe6af2e9d05644d84c25b1e" name = "github.com/openshift/cluster-api-actuator-pkg" packages = [ "pkg/e2e/framework", @@ -320,7 +342,7 @@ "pkg/types", ] pruneopts = "T" - revision = "6983d93876009e8c004dfe7868c1dece4a9d1137" + revision = "71b571e0ba46fae812da42733f926c1df654f666" [[projects]] digest = "1:e5d0bd87abc2781d14e274807a470acd180f0499f8bf5bb18606e9ec22ad9de9" @@ -836,26 +858,6 @@ pruneopts = "T" revision = "e494cc58111187acad93e64529228a2fc0153e39" -[[projects]] - branch = "master" - digest = "1:7dcbe4d792c3e524fd0e08722294b4553eefb2609a708a4470d1abcd87aa12a6" - name = "sigs.k8s.io/cluster-api" - packages = [ - "pkg/apis", - "pkg/apis/cluster/common", - "pkg/apis/cluster/v1alpha1", - "pkg/client/clientset_generated/clientset", - "pkg/client/clientset_generated/clientset/scheme", - "pkg/client/clientset_generated/clientset/typed/cluster/v1alpha1", - "pkg/client/clientset_generated/clientset/typed/cluster/v1alpha1/fake", - "pkg/controller/error", - "pkg/controller/machine", - "pkg/errors", - "pkg/util", - ] - pruneopts = "T" - revision = "cba244b06de7d29777036551e6b32817878d1fcd" - [[projects]] digest = "1:4c3be496e0e0977b54e265fea184b57e9928fed12a1a14687c04b5d42e044abc" name = "sigs.k8s.io/controller-runtime" @@ -942,6 +944,13 @@ "github.com/onsi/gomega", "github.com/openshift/cluster-api-actuator-pkg/pkg/e2e/framework", "github.com/openshift/cluster-api-actuator-pkg/pkg/manifests", + "github.com/openshift/cluster-api/pkg/apis", + "github.com/openshift/cluster-api/pkg/apis/machine/v1beta1", + "github.com/openshift/cluster-api/pkg/client/clientset_generated/clientset", + "github.com/openshift/cluster-api/pkg/client/clientset_generated/clientset/typed/machine/v1beta1", + "github.com/openshift/cluster-api/pkg/client/clientset_generated/clientset/typed/machine/v1beta1/fake", + "github.com/openshift/cluster-api/pkg/controller/machine", + "github.com/openshift/cluster-api/pkg/errors", "github.com/spf13/cobra", "github.com/spf13/pflag", "k8s.io/api/core/v1", @@ -966,13 +975,7 @@ "k8s.io/client-go/testing", "k8s.io/client-go/tools/record", "k8s.io/code-generator/cmd/deepcopy-gen", - "sigs.k8s.io/cluster-api/pkg/apis", - "sigs.k8s.io/cluster-api/pkg/apis/cluster/v1alpha1", - "sigs.k8s.io/cluster-api/pkg/client/clientset_generated/clientset", - "sigs.k8s.io/cluster-api/pkg/client/clientset_generated/clientset/typed/cluster/v1alpha1", - "sigs.k8s.io/cluster-api/pkg/client/clientset_generated/clientset/typed/cluster/v1alpha1/fake", - "sigs.k8s.io/cluster-api/pkg/controller/machine", - "sigs.k8s.io/cluster-api/pkg/errors", + "k8s.io/klog", "sigs.k8s.io/controller-runtime/pkg/client", "sigs.k8s.io/controller-runtime/pkg/client/config", "sigs.k8s.io/controller-runtime/pkg/controller", diff --git a/Gopkg.toml b/Gopkg.toml index 1d60d95c2..994f5129f 100644 --- a/Gopkg.toml +++ b/Gopkg.toml @@ -19,13 +19,13 @@ required = [ go-tests = true [[constraint]] - name = "sigs.k8s.io/cluster-api" - #revision = "0734939e05aeb64ab198e3feeee8b4e90ee5cbb2" - branch = "master" + name = "github.com/openshift/cluster-api" + # This is temporoary while we finish the pivot to OpenShift types. + revision = "91fca585a85b163ddfd119fd09c128c9feadddca" [[constraint]] name = "github.com/openshift/cluster-api-actuator-pkg" - revision = "6983d93876009e8c004dfe7868c1dece4a9d1137" + revision = "71b571e0ba46fae812da42733f926c1df654f666" [[constraint]] name = "github.com/davecgh/go-spew" diff --git a/Makefile b/Makefile index aafdc21d5..9fdffa75a 100644 --- a/Makefile +++ b/Makefile @@ -1,6 +1,10 @@ DBG ?= 0 VERSION ?= $(shell git describe --always --abbrev=7) MUTABLE_TAG ?= latest +PROJECT ?= cluster-api-provider-libvirt +ORG_PATH ?= github.com/openshift +REPO_PATH ?= $(ORG_PATH)/$(PROJECT) +CLUSTER_API ?= github.com/openshift/cluster-api IMAGE = origin-libvirt-machine-controllers ifeq ($(DBG),1) @@ -16,7 +20,7 @@ ifeq ($(NO_DOCKER), 1) IMAGE_BUILD_CMD = imagebuilder CGO_ENABLED = 1 else - DOCKER_CMD := docker run --rm -e CGO_ENABLED=1 -v "$(PWD)":/go/src/github.com/openshift/cluster-api-provider-libvirt:Z -w /go/src/github.com/openshift/cluster-api-provider-libvirt openshift/origin-release:golang-1.10 + DOCKER_CMD := docker run --rm -e CGO_ENABLED=1 -v "$(PWD):/go/src/$(REPO_PATH):Z" -w "/go/src/$(REPO_PATH)" openshift/origin-release:golang-1.10 IMAGE_BUILD_CMD = docker build endif @@ -33,17 +37,13 @@ depend-update: vendor: dep version || go get -u github.com/golang/dep/cmd/dep dep ensure -v - patch -p1 < 0001-Delete-annotated-machines-first-when-scaling-down.patch - patch -p1 < 0002-Sort-machines-before-syncing.patch - patch -p1 < 0001-Validate-machineset-before-reconciliation.patch - patch -p1 < 0001-Upstream-677-Init-klog-in-manager-properly.patch .PHONY: generate generate: gendeepcopy .PHONY: gendeepcopy gendeepcopy: - go build -o $$GOPATH/bin/deepcopy-gen github.com/openshift/cluster-api-provider-libvirt/vendor/k8s.io/code-generator/cmd/deepcopy-gen + go build -o $$GOPATH/bin/deepcopy-gen "$(REPO_PATH)/vendor/k8s.io/code-generator/cmd/deepcopy-gen" deepcopy-gen \ -i ./pkg/apis/libvirtproviderconfig,./pkg/apis/libvirtproviderconfig/v1alpha1 \ -O zz_generated.deepcopy \ @@ -51,13 +51,13 @@ gendeepcopy: .PHONY: build build: ## build binaries - $(DOCKER_CMD) go build $(GOGCFLAGS) -o bin/machine-controller github.com/openshift/cluster-api-provider-libvirt/cmd/manager - $(DOCKER_CMD) go build $(GOGCFLAGS) -o bin/manager github.com/openshift/cluster-api-provider-libvirt/vendor/sigs.k8s.io/cluster-api/cmd/manager - $(DOCKER_CMD) go test $(GOGCFLAGS) -c -o bin/machines.test github.com/openshift/cluster-api-provider-libvirt/test/machines + $(DOCKER_CMD) go build $(GOGCFLAGS) -o bin/machine-controller "$(REPO_PATH)/cmd/manager" + $(DOCKER_CMD) go build $(GOGCFLAGS) -o bin/manager "$(REPO_PATH)/vendor/$(CLUSTER_API)/cmd/manager" + $(DOCKER_CMD) go test $(GOGCFLAGS) -c -o bin/machines.test "$(REPO_PATH)/test/machines" .PHONY: libvirt-actuator libvirt-actuator: - $(DOCKER_CMD) go build $(GOGCFLAGS) -o bin/libvirt-actuator github.com/openshift/cluster-api-provider-libvirt/cmd/libvirt-actuator + $(DOCKER_CMD) go build $(GOGCFLAGS) -o bin/libvirt-actuator "$(REPO_PATH)/cmd/libvirt-actuator" .PHONY: images images: ## Create images @@ -75,13 +75,9 @@ check: fmt vet lint test ## Check your code test: # Run unit test $(DOCKER_CMD) go test -race -cover ./cmd/... ./cloud/... -.PHONY: integration -integration: deps-cgo ## Run integration test - $(DOCKER_CMD) go test -v sigs.k8s.io/cluster-api-provider-libvirt/test/integration - .PHONY: build-e2e build-e2e: - $(DOCKER_CMD) go test -c -o bin/machines.test github.com/openshift/cluster-api-provider-libvirt/test/machines + $(DOCKER_CMD) go test -c -o bin/machines.test "$(REPO_PATH)/test/machines" .PHONY: test-e2e test-e2e: images build-e2e e2e-provision ## Run end-to-end test diff --git a/cmd/libvirt-actuator/main.go b/cmd/libvirt-actuator/main.go index f059a37a3..63d7202c6 100644 --- a/cmd/libvirt-actuator/main.go +++ b/cmd/libvirt-actuator/main.go @@ -25,8 +25,8 @@ import ( apiv1 "k8s.io/api/core/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + machinev1 "github.com/openshift/cluster-api/pkg/apis/machine/v1beta1" "k8s.io/apimachinery/pkg/util/wait" - clusterv1 "sigs.k8s.io/cluster-api/pkg/apis/cluster/v1alpha1" "github.com/openshift/cluster-api-actuator-pkg/pkg/e2e/framework" "github.com/openshift/cluster-api-actuator-pkg/pkg/manifests" @@ -212,17 +212,17 @@ func bootstrapCommand() *cobra.Command { machinePrefix := cmd.Flag("environment-id").Value.String() - testCluster := &clusterv1.Cluster{ + testCluster := &machinev1.Cluster{ ObjectMeta: metav1.ObjectMeta{ Name: machinePrefix, Namespace: testNamespace.Name, }, - Spec: clusterv1.ClusterSpec{ - ClusterNetwork: clusterv1.ClusterNetworkingConfig{ - Services: clusterv1.NetworkRanges{ + Spec: machinev1.ClusterSpec{ + ClusterNetwork: machinev1.ClusterNetworkingConfig{ + Services: machinev1.NetworkRanges{ CIDRBlocks: []string{"10.0.0.1/24"}, }, - Pods: clusterv1.NetworkRanges{ + Pods: machinev1.NetworkRanges{ CIDRBlocks: []string{"10.0.0.1/24"}, }, ServiceDomain: "example.com", diff --git a/cmd/libvirt-actuator/utils/utils.go b/cmd/libvirt-actuator/utils/utils.go index 10338afa6..fae1d5cc4 100644 --- a/cmd/libvirt-actuator/utils/utils.go +++ b/cmd/libvirt-actuator/utils/utils.go @@ -13,13 +13,13 @@ import ( machineactuator "github.com/openshift/cluster-api-provider-libvirt/pkg/cloud/libvirt/actuators/machine" libvirtclient "github.com/openshift/cluster-api-provider-libvirt/pkg/cloud/libvirt/client" "github.com/openshift/cluster-api-provider-libvirt/test" + machinev1 "github.com/openshift/cluster-api/pkg/apis/machine/v1beta1" kubernetesfake "k8s.io/client-go/kubernetes/fake" "k8s.io/client-go/tools/record" - clusterv1 "sigs.k8s.io/cluster-api/pkg/apis/cluster/v1alpha1" ) -func ReadClusterResources(clusterLoc, machineLoc, userDataLoc string) (*clusterv1.Cluster, *clusterv1.Machine, *apiv1.Secret, error) { - machine := &clusterv1.Machine{} +func ReadClusterResources(clusterLoc, machineLoc, userDataLoc string) (*machinev1.Cluster, *machinev1.Machine, *apiv1.Secret, error) { + machine := &machinev1.Machine{} { bytes, err := ioutil.ReadFile(machineLoc) if err != nil { @@ -31,7 +31,7 @@ func ReadClusterResources(clusterLoc, machineLoc, userDataLoc string) (*clusterv } } - cluster := &clusterv1.Cluster{} + cluster := &machinev1.Cluster{} { bytes, err := ioutil.ReadFile(clusterLoc) if err != nil { @@ -59,7 +59,7 @@ func ReadClusterResources(clusterLoc, machineLoc, userDataLoc string) (*clusterv return cluster, machine, userDataSecret, nil } -func CreateActuator(machine *clusterv1.Machine, userData *apiv1.Secret) *machineactuator.Actuator { +func CreateActuator(machine *machinev1.Machine, userData *apiv1.Secret) *machineactuator.Actuator { objList := []runtime.Object{} if userData != nil { objList = append(objList, userData) diff --git a/cmd/manager/main.go b/cmd/manager/main.go index b0cfe3137..eeea46121 100644 --- a/cmd/manager/main.go +++ b/cmd/manager/main.go @@ -6,10 +6,10 @@ import ( machineactuator "github.com/openshift/cluster-api-provider-libvirt/pkg/cloud/libvirt/actuators/machine" libvirtclient "github.com/openshift/cluster-api-provider-libvirt/pkg/cloud/libvirt/client" "github.com/openshift/cluster-api-provider-libvirt/pkg/controller" + machineapis "github.com/openshift/cluster-api/pkg/apis" + "github.com/openshift/cluster-api/pkg/client/clientset_generated/clientset" "k8s.io/client-go/kubernetes" _ "k8s.io/client-go/plugin/pkg/client/auth/gcp" - clusterapis "sigs.k8s.io/cluster-api/pkg/apis" - "sigs.k8s.io/cluster-api/pkg/client/clientset_generated/clientset" "sigs.k8s.io/controller-runtime/pkg/client/config" "sigs.k8s.io/controller-runtime/pkg/manager" "sigs.k8s.io/controller-runtime/pkg/runtime/signals" @@ -51,7 +51,7 @@ func main() { glog.Fatal(err) } - if err := clusterapis.AddToScheme(mgr.GetScheme()); err != nil { + if err := machineapis.AddToScheme(mgr.GetScheme()); err != nil { glog.Fatal(err) } diff --git a/pkg/apis/libvirtproviderconfig/v1alpha1/register.go b/pkg/apis/libvirtproviderconfig/v1alpha1/register.go index 17cff9430..b0e4d149f 100644 --- a/pkg/apis/libvirtproviderconfig/v1alpha1/register.go +++ b/pkg/apis/libvirtproviderconfig/v1alpha1/register.go @@ -17,7 +17,7 @@ import ( "k8s.io/apimachinery/pkg/runtime/serializer" "sigs.k8s.io/controller-runtime/pkg/runtime/scheme" - clusterv1alpha1 "sigs.k8s.io/cluster-api/pkg/apis/cluster/v1alpha1" + machinev1 "github.com/openshift/cluster-api/pkg/apis/machine/v1beta1" ) var ( @@ -59,7 +59,7 @@ func NewCodec() (*LibvirtProviderConfigCodec, error) { } // DecodeFromProviderSpec decodes a serialised ProviderConfig into an object -func (codec *LibvirtProviderConfigCodec) DecodeFromProviderSpec(providerConfig clusterv1alpha1.ProviderSpec, out runtime.Object) error { +func (codec *LibvirtProviderConfigCodec) DecodeFromProviderSpec(providerConfig machinev1.ProviderSpec, out runtime.Object) error { if providerConfig.Value != nil { _, _, err := codec.decoder.Decode(providerConfig.Value.Raw, nil, out) if err != nil { @@ -70,12 +70,12 @@ func (codec *LibvirtProviderConfigCodec) DecodeFromProviderSpec(providerConfig c } // EncodeToProviderSpec encodes an object into a serialised ProviderConfig -func (codec *LibvirtProviderConfigCodec) EncodeToProviderSpec(in runtime.Object) (*clusterv1alpha1.ProviderSpec, error) { +func (codec *LibvirtProviderConfigCodec) EncodeToProviderSpec(in runtime.Object) (*machinev1.ProviderSpec, error) { var buf bytes.Buffer if err := codec.encoder.Encode(in, &buf); err != nil { return nil, fmt.Errorf("encoding failed: %v", err) } - return &clusterv1alpha1.ProviderSpec{ + return &machinev1.ProviderSpec{ Value: &runtime.RawExtension{Raw: buf.Bytes()}, }, nil } diff --git a/pkg/cloud/libvirt/actuators/machine/actuator.go b/pkg/cloud/libvirt/actuators/machine/actuator.go index 27029b8ee..853673dce 100644 --- a/pkg/cloud/libvirt/actuators/machine/actuator.go +++ b/pkg/cloud/libvirt/actuators/machine/actuator.go @@ -30,16 +30,16 @@ import ( "k8s.io/client-go/kubernetes" "k8s.io/client-go/tools/record" + machinev1 "github.com/openshift/cluster-api/pkg/apis/machine/v1beta1" + clusterclient "github.com/openshift/cluster-api/pkg/client/clientset_generated/clientset" + apierrors "github.com/openshift/cluster-api/pkg/errors" corev1 "k8s.io/api/core/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - clusterv1 "sigs.k8s.io/cluster-api/pkg/apis/cluster/v1alpha1" - clusterclient "sigs.k8s.io/cluster-api/pkg/client/clientset_generated/clientset" - apierrors "sigs.k8s.io/cluster-api/pkg/errors" ) type errorWrapper struct { - cluster *clusterv1.Cluster - machine *clusterv1.Machine + cluster *machinev1.Cluster + machine *machinev1.Machine } func (e *errorWrapper) Error(err error, message string) error { @@ -65,7 +65,7 @@ type Actuator struct { } type codec interface { - DecodeFromProviderSpec(clusterv1.ProviderSpec, runtime.Object) error + DecodeFromProviderSpec(machinev1.ProviderSpec, runtime.Object) error DecodeProviderStatus(*runtime.RawExtension, runtime.Object) error EncodeProviderStatus(runtime.Object) (*runtime.RawExtension, error) } @@ -99,7 +99,7 @@ const ( // Set corresponding event based on error. It also returns the original error // for convenience, so callers can do "return handleMachineError(...)". -func (a *Actuator) handleMachineError(machine *clusterv1.Machine, err *apierrors.MachineError, eventAction string) error { +func (a *Actuator) handleMachineError(machine *machinev1.Machine, err *apierrors.MachineError, eventAction string) error { if eventAction != noEventAction { a.eventRecorder.Eventf(machine, corev1.EventTypeWarning, "Failed"+eventAction, "%v", err.Reason) } @@ -109,7 +109,7 @@ func (a *Actuator) handleMachineError(machine *clusterv1.Machine, err *apierrors } // Create creates a machine and is invoked by the Machine Controller -func (a *Actuator) Create(context context.Context, cluster *clusterv1.Cluster, machine *clusterv1.Machine) error { +func (a *Actuator) Create(context context.Context, cluster *machinev1.Cluster, machine *machinev1.Machine) error { glog.Infof("Creating machine %q for cluster %q.", machine.Name, cluster.Name) errWrapper := errorWrapper{cluster: cluster, machine: machine} @@ -149,7 +149,7 @@ func (a *Actuator) Create(context context.Context, cluster *clusterv1.Cluster, m } // Delete deletes a machine and is invoked by the Machine Controller -func (a *Actuator) Delete(context context.Context, cluster *clusterv1.Cluster, machine *clusterv1.Machine) error { +func (a *Actuator) Delete(context context.Context, cluster *machinev1.Cluster, machine *machinev1.Machine) error { glog.Infof("Deleting machine %q for cluster %q.", machine.Name, cluster.Name) machineProviderConfig, err := ProviderConfigMachine(a.codec, &machine.Spec) @@ -176,7 +176,7 @@ func (a *Actuator) Delete(context context.Context, cluster *clusterv1.Cluster, m } // Update updates a machine and is invoked by the Machine Controller -func (a *Actuator) Update(context context.Context, cluster *clusterv1.Cluster, machine *clusterv1.Machine) error { +func (a *Actuator) Update(context context.Context, cluster *machinev1.Cluster, machine *machinev1.Machine) error { glog.Infof("Updating machine %v for cluster %v.", machine.Name, cluster.Name) errWrapper := errorWrapper{cluster: cluster, machine: machine} @@ -202,7 +202,7 @@ func (a *Actuator) Update(context context.Context, cluster *clusterv1.Cluster, m } // Exists test for the existance of a machine and is invoked by the Machine Controller -func (a *Actuator) Exists(context context.Context, cluster *clusterv1.Cluster, machine *clusterv1.Machine) (bool, error) { +func (a *Actuator) Exists(context context.Context, cluster *machinev1.Cluster, machine *machinev1.Machine) (bool, error) { glog.Infof("Checking if machine %v for cluster %v exists.", machine.Name, cluster.Name) errWrapper := errorWrapper{cluster: cluster, machine: machine} @@ -227,7 +227,7 @@ func ignitionVolumeName(volumeName string) string { // CreateVolumeAndMachine creates a volume and domain which consumes the former one. // Note: Upon success a pointer to the created domain is returned. It // is the caller's responsiblity to free this. -func (a *Actuator) createVolumeAndDomain(machine *clusterv1.Machine, machineProviderConfig *providerconfigv1.LibvirtMachineProviderConfig, client libvirtclient.Client) (*libvirt.Domain, error) { +func (a *Actuator) createVolumeAndDomain(machine *machinev1.Machine, machineProviderConfig *providerconfigv1.LibvirtMachineProviderConfig, client libvirtclient.Client) (*libvirt.Domain, error) { domainName := machine.Name // Create volume @@ -280,7 +280,7 @@ func (a *Actuator) createVolumeAndDomain(machine *clusterv1.Machine, machineProv } // deleteVolumeAndDomain deletes a domain and its referenced volume -func (a *Actuator) deleteVolumeAndDomain(machine *clusterv1.Machine, client libvirtclient.Client) error { +func (a *Actuator) deleteVolumeAndDomain(machine *machinev1.Machine, client libvirtclient.Client) error { if err := client.DeleteDomain(machine.Name); err != nil && err != libvirtclient.ErrDomainNotFound { return a.handleMachineError(machine, apierrors.DeleteMachine("error deleting %q domain %v", machine.Name, err), deleteEventAction) } @@ -307,7 +307,7 @@ func (a *Actuator) deleteVolumeAndDomain(machine *clusterv1.Machine, client libv // ProviderConfigMachine gets the machine provider config MachineSetSpec from the // specified cluster-api MachineSpec. -func ProviderConfigMachine(codec codec, ms *clusterv1.MachineSpec) (*providerconfigv1.LibvirtMachineProviderConfig, error) { +func ProviderConfigMachine(codec codec, ms *machinev1.MachineSpec) (*providerconfigv1.LibvirtMachineProviderConfig, error) { providerSpec := ms.ProviderSpec if providerSpec.Value == nil { return nil, fmt.Errorf("no Value in ProviderConfig") @@ -322,7 +322,7 @@ func ProviderConfigMachine(codec codec, ms *clusterv1.MachineSpec) (*providercon } // updateStatus updates a machine object's status. -func (a *Actuator) updateStatus(machine *clusterv1.Machine, dom *libvirt.Domain) error { +func (a *Actuator) updateStatus(machine *machinev1.Machine, dom *libvirt.Domain) error { glog.Infof("Updating status for %s", machine.Name) status, err := ProviderStatusFromMachine(a.codec, machine) @@ -352,7 +352,7 @@ func (a *Actuator) updateStatus(machine *clusterv1.Machine, dom *libvirt.Domain) } func (a *Actuator) applyMachineStatus( - machine *clusterv1.Machine, + machine *machinev1.Machine, status *providerconfigv1.LibvirtMachineProviderStatus, addrs []corev1.NodeAddress, ) error { @@ -378,7 +378,7 @@ func (a *Actuator) applyMachineStatus( now := metav1.Now() machineCopy.Status.LastUpdated = &now - _, err = a.clusterClient.ClusterV1alpha1(). + _, err = a.clusterClient.MachineV1beta1(). Machines(machineCopy.Namespace).UpdateStatus(machineCopy) return err } @@ -392,7 +392,7 @@ func EncodeProviderStatus(codec codec, status *providerconfigv1.LibvirtMachinePr // ProviderStatusFromMachine deserializes a libvirt provider status // from a machine object. -func ProviderStatusFromMachine(codec codec, machine *clusterv1.Machine) (*providerconfigv1.LibvirtMachineProviderStatus, error) { +func ProviderStatusFromMachine(codec codec, machine *machinev1.Machine) (*providerconfigv1.LibvirtMachineProviderStatus, error) { status := &providerconfigv1.LibvirtMachineProviderStatus{} var err error if machine.Status.ProviderStatus != nil { @@ -432,7 +432,7 @@ func UpdateProviderStatus(status *providerconfigv1.LibvirtMachineProviderStatus, // clientForMachine returns a libvirt client for the URI in the given // machine's provider config. -func (a *Actuator) clientForMachine(codec codec, machine *clusterv1.Machine) (libvirtclient.Client, error) { +func (a *Actuator) clientForMachine(codec codec, machine *machinev1.Machine) (libvirtclient.Client, error) { machineProviderConfig, err := ProviderConfigMachine(codec, &machine.Spec) if err != nil { return nil, a.handleMachineError(machine, apierrors.InvalidMachineConfiguration("error getting machineProviderConfig from spec: %v", err), createEventAction) diff --git a/pkg/cloud/libvirt/actuators/machine/actuator_test.go b/pkg/cloud/libvirt/actuators/machine/actuator_test.go index 731839085..8813a3f87 100644 --- a/pkg/cloud/libvirt/actuators/machine/actuator_test.go +++ b/pkg/cloud/libvirt/actuators/machine/actuator_test.go @@ -11,8 +11,8 @@ import ( libvirtclient "github.com/openshift/cluster-api-provider-libvirt/pkg/cloud/libvirt/client" mocklibvirt "github.com/openshift/cluster-api-provider-libvirt/pkg/cloud/libvirt/client/mock" fakeclusterclientset "github.com/openshift/cluster-api-provider-libvirt/test" + machinev1beta1 "github.com/openshift/cluster-api/pkg/apis/machine/v1beta1" kubernetesfake "k8s.io/client-go/kubernetes/fake" - clusterv1 "sigs.k8s.io/cluster-api/pkg/apis/cluster/v1alpha1" "k8s.io/client-go/kubernetes/scheme" "k8s.io/client-go/tools/record" @@ -20,7 +20,7 @@ import ( func init() { // Add types to scheme - clusterv1.AddToScheme(scheme.Scheme) + machinev1beta1.AddToScheme(scheme.Scheme) } const ( @@ -47,9 +47,9 @@ func TestMachineEvents(t *testing.T) { cases := []struct { name string - machine *clusterv1.Machine + machine *machinev1beta1.Machine error string - operation func(actuator *Actuator, cluster *clusterv1.Cluster, machine *clusterv1.Machine) + operation func(actuator *Actuator, cluster *machinev1beta1.Cluster, machine *machinev1beta1.Machine) event string createVolumeErr error deleteVolumeErr error @@ -63,7 +63,7 @@ func TestMachineEvents(t *testing.T) { { name: "Create machine event failed (invalid configuration)", machine: machineInvalidProviderConfig, - operation: func(actuator *Actuator, cluster *clusterv1.Cluster, machine *clusterv1.Machine) { + operation: func(actuator *Actuator, cluster *machinev1beta1.Cluster, machine *machinev1beta1.Machine) { actuator.Create(context.TODO(), cluster, machine) }, event: "Warning FailedCreate InvalidConfiguration", @@ -72,7 +72,7 @@ func TestMachineEvents(t *testing.T) { name: "Create machine event failed (error creating libvirt client)", machine: machine, error: libvirtClientError, - operation: func(actuator *Actuator, cluster *clusterv1.Cluster, machine *clusterv1.Machine) { + operation: func(actuator *Actuator, cluster *machinev1beta1.Cluster, machine *machinev1beta1.Machine) { actuator.Create(context.TODO(), cluster, machine) }, event: "Warning FailedCreate CreateError", @@ -81,7 +81,7 @@ func TestMachineEvents(t *testing.T) { name: "Create machine event failed (error creating volume)", machine: machine, createVolumeErr: fmt.Errorf("error"), - operation: func(actuator *Actuator, cluster *clusterv1.Cluster, machine *clusterv1.Machine) { + operation: func(actuator *Actuator, cluster *machinev1beta1.Cluster, machine *machinev1beta1.Machine) { actuator.Create(context.TODO(), cluster, machine) }, event: "Warning FailedCreate CreateError", @@ -90,7 +90,7 @@ func TestMachineEvents(t *testing.T) { name: "Create machine event failed (error creating domain)", machine: machine, createDomainErr: fmt.Errorf("error"), - operation: func(actuator *Actuator, cluster *clusterv1.Cluster, machine *clusterv1.Machine) { + operation: func(actuator *Actuator, cluster *machinev1beta1.Cluster, machine *machinev1beta1.Machine) { actuator.Create(context.TODO(), cluster, machine) }, event: "Warning FailedCreate CreateError", @@ -99,7 +99,7 @@ func TestMachineEvents(t *testing.T) { name: "Create machine event failed (error looking up domain)", machine: machine, lookupDomainErr: fmt.Errorf("error"), - operation: func(actuator *Actuator, cluster *clusterv1.Cluster, machine *clusterv1.Machine) { + operation: func(actuator *Actuator, cluster *machinev1beta1.Cluster, machine *machinev1beta1.Machine) { actuator.Create(context.TODO(), cluster, machine) }, event: "Warning FailedCreate CreateError", @@ -107,7 +107,7 @@ func TestMachineEvents(t *testing.T) { { name: "Create machine event succeed", machine: machine, - operation: func(actuator *Actuator, cluster *clusterv1.Cluster, machine *clusterv1.Machine) { + operation: func(actuator *Actuator, cluster *machinev1beta1.Cluster, machine *machinev1beta1.Machine) { actuator.Create(context.TODO(), cluster, machine) }, event: "Normal Created Created Machine libvirt-actuator-testing-machine", @@ -115,7 +115,7 @@ func TestMachineEvents(t *testing.T) { { name: "Delete machine event failed (invalid configuration)", machine: machineInvalidProviderConfig, - operation: func(actuator *Actuator, cluster *clusterv1.Cluster, machine *clusterv1.Machine) { + operation: func(actuator *Actuator, cluster *machinev1beta1.Cluster, machine *machinev1beta1.Machine) { actuator.Delete(context.TODO(), cluster, machine) }, event: "Warning FailedDelete InvalidConfiguration", @@ -124,7 +124,7 @@ func TestMachineEvents(t *testing.T) { name: "Delete machine event failed (error creating libvirt client)", machine: machine, error: libvirtClientError, - operation: func(actuator *Actuator, cluster *clusterv1.Cluster, machine *clusterv1.Machine) { + operation: func(actuator *Actuator, cluster *machinev1beta1.Cluster, machine *machinev1beta1.Machine) { actuator.Delete(context.TODO(), cluster, machine) }, event: "Warning FailedDelete DeleteError", @@ -133,7 +133,7 @@ func TestMachineEvents(t *testing.T) { name: "Delete machine event failed (error getting domain)", machine: machine, domainExistsErr: fmt.Errorf("error"), - operation: func(actuator *Actuator, cluster *clusterv1.Cluster, machine *clusterv1.Machine) { + operation: func(actuator *Actuator, cluster *machinev1beta1.Cluster, machine *machinev1beta1.Machine) { actuator.Delete(context.TODO(), cluster, machine) }, event: "Warning FailedDelete DeleteError", @@ -143,7 +143,7 @@ func TestMachineEvents(t *testing.T) { machine: machine, domainExists: true, deleteDomainErr: fmt.Errorf("error"), - operation: func(actuator *Actuator, cluster *clusterv1.Cluster, machine *clusterv1.Machine) { + operation: func(actuator *Actuator, cluster *machinev1beta1.Cluster, machine *machinev1beta1.Machine) { actuator.Delete(context.TODO(), cluster, machine) }, event: "Warning FailedDelete DeleteError", @@ -153,7 +153,7 @@ func TestMachineEvents(t *testing.T) { machine: machine, domainExists: true, deleteVolumeErr: fmt.Errorf("error"), - operation: func(actuator *Actuator, cluster *clusterv1.Cluster, machine *clusterv1.Machine) { + operation: func(actuator *Actuator, cluster *machinev1beta1.Cluster, machine *machinev1beta1.Machine) { actuator.Delete(context.TODO(), cluster, machine) }, event: "Warning FailedDelete DeleteError", @@ -162,7 +162,7 @@ func TestMachineEvents(t *testing.T) { name: "Delete machine event succeeds", machine: machine, domainExists: true, - operation: func(actuator *Actuator, cluster *clusterv1.Cluster, machine *clusterv1.Machine) { + operation: func(actuator *Actuator, cluster *machinev1beta1.Cluster, machine *machinev1beta1.Machine) { actuator.Delete(context.TODO(), cluster, machine) }, event: "Normal Deleted Deleted Machine libvirt-actuator-testing-machine", diff --git a/pkg/cloud/libvirt/actuators/machine/stubs.go b/pkg/cloud/libvirt/actuators/machine/stubs.go index 82929aeb3..75f0db778 100644 --- a/pkg/cloud/libvirt/actuators/machine/stubs.go +++ b/pkg/cloud/libvirt/actuators/machine/stubs.go @@ -6,7 +6,7 @@ import ( metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" providerconfigv1 "github.com/openshift/cluster-api-provider-libvirt/pkg/apis/libvirtproviderconfig/v1alpha1" - clusterv1 "sigs.k8s.io/cluster-api/pkg/apis/cluster/v1alpha1" + machinev1 "github.com/openshift/cluster-api/pkg/apis/machine/v1beta1" ) const ( @@ -34,7 +34,7 @@ func stubProviderConfig() *providerconfigv1.LibvirtMachineProviderConfig { } } -func stubMachine() (*clusterv1.Machine, error) { +func stubMachine() (*machinev1.Machine, error) { machinePc := stubProviderConfig() codec, err := providerconfigv1.NewCodec() @@ -46,7 +46,7 @@ func stubMachine() (*clusterv1.Machine, error) { return nil, fmt.Errorf("encodeToProviderConfig failed: %v", err) } - machine := &clusterv1.Machine{ + machine := &machinev1.Machine{ ObjectMeta: metav1.ObjectMeta{ Name: "libvirt-actuator-testing-machine", Namespace: defaultNamespace, @@ -57,7 +57,7 @@ func stubMachine() (*clusterv1.Machine, error) { }, }, - Spec: clusterv1.MachineSpec{ + Spec: machinev1.MachineSpec{ ProviderSpec: *config, }, } @@ -65,8 +65,8 @@ func stubMachine() (*clusterv1.Machine, error) { return machine, nil } -func stubCluster() *clusterv1.Cluster { - return &clusterv1.Cluster{ +func stubCluster() *machinev1.Cluster { + return &machinev1.Cluster{ ObjectMeta: metav1.ObjectMeta{ Name: clusterID, Namespace: defaultNamespace, diff --git a/pkg/controller/add_machine.go b/pkg/controller/add_machine.go index d24d479ae..7f6fbed8c 100644 --- a/pkg/controller/add_machine.go +++ b/pkg/controller/add_machine.go @@ -15,7 +15,7 @@ package controller import ( machineactuator "github.com/openshift/cluster-api-provider-libvirt/pkg/cloud/libvirt/actuators/machine" - "sigs.k8s.io/cluster-api/pkg/controller/machine" + "github.com/openshift/cluster-api/pkg/controller/machine" "sigs.k8s.io/controller-runtime/pkg/manager" ) diff --git a/test/clientset_generated.go b/test/clientset_generated.go index aaa8b32a3..9df486da5 100644 --- a/test/clientset_generated.go +++ b/test/clientset_generated.go @@ -19,14 +19,16 @@ limitations under the License. package test import ( + clientset "github.com/openshift/cluster-api/pkg/client/clientset_generated/clientset" + clusterv1alpha1 "github.com/openshift/cluster-api/pkg/client/clientset_generated/clientset/typed/cluster/v1alpha1" + fakeclusterv1alpha1 "github.com/openshift/cluster-api/pkg/client/clientset_generated/clientset/typed/cluster/v1alpha1/fake" + machinev1beta1 "github.com/openshift/cluster-api/pkg/client/clientset_generated/clientset/typed/machine/v1beta1" + fakemachinev1beta1 "github.com/openshift/cluster-api/pkg/client/clientset_generated/clientset/typed/machine/v1beta1/fake" "k8s.io/apimachinery/pkg/runtime" "k8s.io/apimachinery/pkg/watch" "k8s.io/client-go/discovery" fakediscovery "k8s.io/client-go/discovery/fake" "k8s.io/client-go/testing" - clientset "sigs.k8s.io/cluster-api/pkg/client/clientset_generated/clientset" - clusterv1alpha1 "sigs.k8s.io/cluster-api/pkg/client/clientset_generated/clientset/typed/cluster/v1alpha1" - fakeclusterv1alpha1 "sigs.k8s.io/cluster-api/pkg/client/clientset_generated/clientset/typed/cluster/v1alpha1/fake" ) // NewSimpleClientset returns a clientset that will respond with the provided objects. @@ -63,6 +65,16 @@ func (c *Clientset) Discovery() discovery.DiscoveryInterface { var _ clientset.Interface = &Clientset{} +// MachineV1beta1 retrieves the MachineV1beta1Client +func (c *Clientset) MachineV1beta1() machinev1beta1.MachineV1beta1Interface { + return &fakemachinev1beta1.FakeMachineV1beta1{Fake: c.Fake} +} + +// Machine retrieves the MachineV1beta1Client +func (c *Clientset) Machine() machinev1beta1.MachineV1beta1Interface { + return c.MachineV1beta1() +} + // ClusterV1alpha1 retrieves the ClusterV1alpha1Client func (c *Clientset) ClusterV1alpha1() clusterv1alpha1.ClusterV1alpha1Interface { return &fakeclusterv1alpha1.FakeClusterV1alpha1{Fake: c.Fake} @@ -70,5 +82,5 @@ func (c *Clientset) ClusterV1alpha1() clusterv1alpha1.ClusterV1alpha1Interface { // Cluster retrieves the ClusterV1alpha1Client func (c *Clientset) Cluster() clusterv1alpha1.ClusterV1alpha1Interface { - return &fakeclusterv1alpha1.FakeClusterV1alpha1{Fake: c.Fake} + return c.ClusterV1alpha1() } diff --git a/test/machines/libvirtclient.go b/test/machines/libvirtclient.go index 3914daa7e..4eb362db4 100644 --- a/test/machines/libvirtclient.go +++ b/test/machines/libvirtclient.go @@ -5,7 +5,7 @@ import ( "strings" libvirt "github.com/libvirt/libvirt-go" - clusterv1alpha1 "sigs.k8s.io/cluster-api/pkg/apis/cluster/v1alpha1" + machinev1 "github.com/openshift/cluster-api/pkg/apis/machine/v1beta1" ) type libvirtClient struct { @@ -23,7 +23,7 @@ func NewLibvirtClient(uri string) (*libvirtClient, error) { }, nil } -func (client *libvirtClient) GetRunningInstances(machine *clusterv1alpha1.Machine) ([]interface{}, error) { +func (client *libvirtClient) GetRunningInstances(machine *machinev1.Machine) ([]interface{}, error) { domain, err := client.getRunningDomain(machine.Name) if err != nil { return nil, err @@ -34,11 +34,11 @@ func (client *libvirtClient) GetRunningInstances(machine *clusterv1alpha1.Machin return []interface{}{domain}, nil } -func (client *libvirtClient) GetPublicDNSName(machine *clusterv1alpha1.Machine) (string, error) { +func (client *libvirtClient) GetPublicDNSName(machine *machinev1.Machine) (string, error) { return client.GetPrivateIP(machine) } -func (client *libvirtClient) GetPrivateIP(machine *clusterv1alpha1.Machine) (string, error) { +func (client *libvirtClient) GetPrivateIP(machine *machinev1.Machine) (string, error) { domain, err := client.getRunningDomain(machine.Name) if err != nil { return "", err diff --git a/test/machines/machines_test.go b/test/machines/machines_test.go index 5db6ac6e5..d530353b4 100644 --- a/test/machines/machines_test.go +++ b/test/machines/machines_test.go @@ -17,9 +17,9 @@ import ( "github.com/openshift/cluster-api-actuator-pkg/pkg/manifests" "github.com/openshift/cluster-api-provider-libvirt/test/utils" + machinev1beta1 "github.com/openshift/cluster-api/pkg/apis/machine/v1beta1" apiv1 "k8s.io/api/core/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - clusterv1alpha1 "sigs.k8s.io/cluster-api/pkg/apis/cluster/v1alpha1" ) const ( @@ -124,17 +124,17 @@ var _ = framework.SigKubeDescribe("Machines", func() { clusterID = "cluster-" + string(uuid.NewUUID()) } - cluster := &clusterv1alpha1.Cluster{ + cluster := &machinev1beta1.Cluster{ ObjectMeta: metav1.ObjectMeta{ Name: clusterID, Namespace: testNamespace.Name, }, - Spec: clusterv1alpha1.ClusterSpec{ - ClusterNetwork: clusterv1alpha1.ClusterNetworkingConfig{ - Services: clusterv1alpha1.NetworkRanges{ + Spec: machinev1beta1.ClusterSpec{ + ClusterNetwork: machinev1beta1.ClusterNetworkingConfig{ + Services: machinev1beta1.NetworkRanges{ CIDRBlocks: []string{"10.0.0.1/24"}, }, - Pods: clusterv1alpha1.NetworkRanges{ + Pods: machinev1beta1.NetworkRanges{ CIDRBlocks: []string{"10.0.0.1/24"}, }, ServiceDomain: "example.com", @@ -186,17 +186,17 @@ var _ = framework.SigKubeDescribe("Machines", func() { clusterID = "cluster-" + clusterUUID[:8] } - cluster := &clusterv1alpha1.Cluster{ + cluster := &machinev1beta1.Cluster{ ObjectMeta: metav1.ObjectMeta{ Name: clusterID, Namespace: testNamespace.Name, }, - Spec: clusterv1alpha1.ClusterSpec{ - ClusterNetwork: clusterv1alpha1.ClusterNetworkingConfig{ - Services: clusterv1alpha1.NetworkRanges{ + Spec: machinev1beta1.ClusterSpec{ + ClusterNetwork: machinev1beta1.ClusterNetworkingConfig{ + Services: machinev1beta1.NetworkRanges{ CIDRBlocks: []string{"10.0.0.1/24"}, }, - Pods: clusterv1alpha1.NetworkRanges{ + Pods: machinev1beta1.NetworkRanges{ CIDRBlocks: []string{"10.0.0.1/24"}, }, ServiceDomain: "example.com", @@ -311,7 +311,7 @@ var _ = framework.SigKubeDescribe("Machines", func() { } glog.V(2).Infof("Non-master nodes to check: %#v", nonMasterNodes) - machines, err := clusterFramework.CAPIClient.ClusterV1alpha1().Machines(workerMachineSet.Namespace).List(metav1.ListOptions{ + machines, err := clusterFramework.CAPIClient.MachineV1beta1().Machines(workerMachineSet.Namespace).List(metav1.ListOptions{ LabelSelector: labels.SelectorFromSet(workerMachineSet.Spec.Selector.MatchLabels).String(), }) Expect(err).NotTo(HaveOccurred()) diff --git a/test/register.go b/test/register.go index 626a7fc87..dc646a2e0 100644 --- a/test/register.go +++ b/test/register.go @@ -19,11 +19,11 @@ limitations under the License. package test import ( + machinev1 "github.com/openshift/cluster-api/pkg/apis/machine/v1beta1" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" runtime "k8s.io/apimachinery/pkg/runtime" schema "k8s.io/apimachinery/pkg/runtime/schema" serializer "k8s.io/apimachinery/pkg/runtime/serializer" - clusterv1alpha1 "sigs.k8s.io/cluster-api/pkg/apis/cluster/v1alpha1" ) var scheme = runtime.NewScheme() @@ -50,6 +50,6 @@ func init() { // After this, RawExtensions in Kubernetes types will serialize kube-aggregator types // correctly. func AddToScheme(scheme *runtime.Scheme) { - clusterv1alpha1.AddToScheme(scheme) + machinev1.AddToScheme(scheme) } diff --git a/test/utils/manifests.go b/test/utils/manifests.go index e04715dfd..99393c21d 100644 --- a/test/utils/manifests.go +++ b/test/utils/manifests.go @@ -4,10 +4,10 @@ import ( "fmt" providerconfigv1 "github.com/openshift/cluster-api-provider-libvirt/pkg/apis/libvirtproviderconfig/v1alpha1" - clusterv1alpha1 "sigs.k8s.io/cluster-api/pkg/apis/cluster/v1alpha1" + machinev1 "github.com/openshift/cluster-api/pkg/apis/machine/v1beta1" ) -func TestingMachineProviderSpec(uri, clusterID string) (clusterv1alpha1.ProviderSpec, error) { +func TestingMachineProviderSpec(uri, clusterID string) (machinev1.ProviderSpec, error) { machinePc := &providerconfigv1.LibvirtMachineProviderConfig{ DomainMemory: 2048, DomainVcpu: 1, @@ -26,16 +26,16 @@ func TestingMachineProviderSpec(uri, clusterID string) (clusterv1alpha1.Provider codec, err := providerconfigv1.NewCodec() if err != nil { - return clusterv1alpha1.ProviderSpec{}, fmt.Errorf("failed creating codec: %v", err) + return machinev1.ProviderSpec{}, fmt.Errorf("failed creating codec: %v", err) } config, err := codec.EncodeToProviderSpec(machinePc) if err != nil { - return clusterv1alpha1.ProviderSpec{}, fmt.Errorf("codec.EncodeToProviderSpec failed: %v", err) + return machinev1.ProviderSpec{}, fmt.Errorf("codec.EncodeToProviderSpec failed: %v", err) } return *config, nil } -func MasterMachineProviderSpec(masterUserDataSecret, libvirturi string) (clusterv1alpha1.ProviderSpec, error) { +func MasterMachineProviderSpec(masterUserDataSecret, libvirturi string) (machinev1.ProviderSpec, error) { machinePc := &providerconfigv1.LibvirtMachineProviderConfig{ DomainMemory: 2048, DomainVcpu: 2, @@ -55,15 +55,15 @@ func MasterMachineProviderSpec(masterUserDataSecret, libvirturi string) (cluster codec, err := providerconfigv1.NewCodec() if err != nil { - return clusterv1alpha1.ProviderSpec{}, fmt.Errorf("failed creating codec: %v", err) + return machinev1.ProviderSpec{}, fmt.Errorf("failed creating codec: %v", err) } config, err := codec.EncodeToProviderSpec(machinePc) if err != nil { - return clusterv1alpha1.ProviderSpec{}, fmt.Errorf("codec.EncodeToProviderSpec failed: %v", err) + return machinev1.ProviderSpec{}, fmt.Errorf("codec.EncodeToProviderSpec failed: %v", err) } return *config, nil } -func WorkerMachineProviderSpec(workerUserDataSecret, libvirturi string) (clusterv1alpha1.ProviderSpec, error) { +func WorkerMachineProviderSpec(workerUserDataSecret, libvirturi string) (machinev1.ProviderSpec, error) { return MasterMachineProviderSpec(workerUserDataSecret, libvirturi) } diff --git a/vendor/github.com/openshift/cluster-api-actuator-pkg/Gopkg.lock b/vendor/github.com/openshift/cluster-api-actuator-pkg/Gopkg.lock index f3721ab28..9545c354f 100644 --- a/vendor/github.com/openshift/cluster-api-actuator-pkg/Gopkg.lock +++ b/vendor/github.com/openshift/cluster-api-actuator-pkg/Gopkg.lock @@ -287,6 +287,22 @@ revision = "7615b9433f86a8bdf29709bf288bc4fd0636a369" version = "v1.4.2" +[[projects]] + digest = "1:49d7d6c861c157a8fa965983d85d2766fda04cf3a7fdf9c2b080564911238554" + name = "github.com/openshift/cluster-api" + packages = [ + "pkg/apis/cluster/common", + "pkg/apis/cluster/v1alpha1", + "pkg/apis/machine/common", + "pkg/apis/machine/v1beta1", + "pkg/client/clientset_generated/clientset", + "pkg/client/clientset_generated/clientset/scheme", + "pkg/client/clientset_generated/clientset/typed/cluster/v1alpha1", + "pkg/client/clientset_generated/clientset/typed/machine/v1beta1", + ] + pruneopts = "" + revision = "91fca585a85b163ddfd119fd09c128c9feadddca" + [[projects]] digest = "1:a5484d4fa43127138ae6e7b2299a6a52ae006c7f803d98d717f60abf3e97192e" name = "github.com/pborman/uuid" @@ -768,20 +784,6 @@ pruneopts = "" revision = "5d05df014ac640f14b5e777958248251c2ef5e86" -[[projects]] - branch = "master" - digest = "1:c3f06fd90052ca9c02f7288e32bbaaaa75241cbca3d551a646e912975eb956ec" - name = "sigs.k8s.io/cluster-api" - packages = [ - "pkg/apis/cluster/common", - "pkg/apis/cluster/v1alpha1", - "pkg/client/clientset_generated/clientset", - "pkg/client/clientset_generated/clientset/scheme", - "pkg/client/clientset_generated/clientset/typed/cluster/v1alpha1", - ] - pruneopts = "" - revision = "cba244b06de7d29777036551e6b32817878d1fcd" - [[projects]] digest = "1:6cad2468c5831529b860a01f09032f6ff38202bc4f76332ef7ad74a993e4aa5a" name = "sigs.k8s.io/controller-runtime" @@ -851,6 +853,8 @@ "github.com/golang/glog", "github.com/onsi/ginkgo", "github.com/onsi/gomega", + "github.com/openshift/cluster-api/pkg/apis/machine/v1beta1", + "github.com/openshift/cluster-api/pkg/client/clientset_generated/clientset", "golang.org/x/crypto/ssh", "k8s.io/api/apps/v1", "k8s.io/api/apps/v1beta2", @@ -868,8 +872,6 @@ "k8s.io/client-go/rest", "k8s.io/client-go/tools/clientcmd", "k8s.io/code-generator/cmd/deepcopy-gen", - "sigs.k8s.io/cluster-api/pkg/apis/cluster/v1alpha1", - "sigs.k8s.io/cluster-api/pkg/client/clientset_generated/clientset", "sigs.k8s.io/controller-runtime/pkg/client/config", "sigs.k8s.io/controller-runtime/pkg/controller", "sigs.k8s.io/controller-runtime/pkg/handler", diff --git a/vendor/github.com/openshift/cluster-api-actuator-pkg/Gopkg.toml b/vendor/github.com/openshift/cluster-api-actuator-pkg/Gopkg.toml index e95056b13..9ba9d8b5e 100644 --- a/vendor/github.com/openshift/cluster-api-actuator-pkg/Gopkg.toml +++ b/vendor/github.com/openshift/cluster-api-actuator-pkg/Gopkg.toml @@ -47,6 +47,6 @@ required = [ source = "https://github.com/fsnotify/fsnotify.git" [[constraint]] - name = "sigs.k8s.io/cluster-api" - branch = "master" + name = "github.com/openshift/cluster-api" + revision = "91fca585a85b163ddfd119fd09c128c9feadddca" diff --git a/vendor/github.com/openshift/cluster-api-actuator-pkg/pkg/e2e/framework/clusterapi.go b/vendor/github.com/openshift/cluster-api-actuator-pkg/pkg/e2e/framework/clusterapi.go index 6b02fde54..5e048feb7 100644 --- a/vendor/github.com/openshift/cluster-api-actuator-pkg/pkg/e2e/framework/clusterapi.go +++ b/vendor/github.com/openshift/cluster-api-actuator-pkg/pkg/e2e/framework/clusterapi.go @@ -73,7 +73,7 @@ func (f *Framework) DeployClusterAPIStack(clusterAPINamespace, actuatorPrivateKe f.By("Waiting until cluster objects can be listed") err = wait.Poll(PollInterval, PoolClusterAPIDeploymentTimeout, func() (bool, error) { // Any namespace will do just to that one can list cluster objects - _, err := f.CAPIClient.ClusterV1alpha1().Clusters("default").List(metav1.ListOptions{}) + _, err := f.CAPIClient.MachineV1beta1().Clusters("default").List(metav1.ListOptions{}) if err != nil { glog.V(2).Infof("unable to list clusters: %v", err) return false, nil diff --git a/vendor/github.com/openshift/cluster-api-actuator-pkg/pkg/e2e/framework/clusters.go b/vendor/github.com/openshift/cluster-api-actuator-pkg/pkg/e2e/framework/clusters.go index 5c54fd555..c5ae5c37c 100644 --- a/vendor/github.com/openshift/cluster-api-actuator-pkg/pkg/e2e/framework/clusters.go +++ b/vendor/github.com/openshift/cluster-api-actuator-pkg/pkg/e2e/framework/clusters.go @@ -5,15 +5,15 @@ import ( "github.com/golang/glog" + machinev1beta1 "github.com/openshift/cluster-api/pkg/apis/machine/v1beta1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/util/wait" - clusterv1alpha1 "sigs.k8s.io/cluster-api/pkg/apis/cluster/v1alpha1" ) -func (f *Framework) CreateClusterAndWait(cluster *clusterv1alpha1.Cluster) { +func (f *Framework) CreateClusterAndWait(cluster *machinev1beta1.Cluster) { f.By(fmt.Sprintf("Creating %q cluster", cluster.Name)) err := wait.Poll(PollInterval, PoolTimeout, func() (bool, error) { - _, err := f.CAPIClient.ClusterV1alpha1().Clusters(cluster.Namespace).Create(cluster) + _, err := f.CAPIClient.MachineV1beta1().Clusters(cluster.Namespace).Create(cluster) if err != nil { glog.V(2).Infof("error creating cluster: %v", err) return false, nil @@ -23,7 +23,7 @@ func (f *Framework) CreateClusterAndWait(cluster *clusterv1alpha1.Cluster) { f.ErrNotExpected(err) err = wait.Poll(PollInterval, PoolTimeout, func() (bool, error) { - _, err := f.CAPIClient.ClusterV1alpha1().Clusters(cluster.Namespace).Get(cluster.Name, metav1.GetOptions{}) + _, err := f.CAPIClient.MachineV1beta1().Clusters(cluster.Namespace).Get(cluster.Name, metav1.GetOptions{}) if err != nil { return false, nil } diff --git a/vendor/github.com/openshift/cluster-api-actuator-pkg/pkg/e2e/framework/framework.go b/vendor/github.com/openshift/cluster-api-actuator-pkg/pkg/e2e/framework/framework.go index 12476c8a9..1c7a0b9d0 100644 --- a/vendor/github.com/openshift/cluster-api-actuator-pkg/pkg/e2e/framework/framework.go +++ b/vendor/github.com/openshift/cluster-api-actuator-pkg/pkg/e2e/framework/framework.go @@ -16,9 +16,11 @@ import ( "k8s.io/apimachinery/pkg/util/wait" "k8s.io/client-go/kubernetes" "k8s.io/client-go/rest" + // apiregistrationclientset "k8s.io/kube-aggregator/pkg/client/clientset_generated/clientset" + + "github.com/openshift/cluster-api/pkg/client/clientset_generated/clientset" apiextensionsclientset "k8s.io/apiextensions-apiserver/pkg/client/clientset/clientset" - "sigs.k8s.io/cluster-api/pkg/client/clientset_generated/clientset" . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" diff --git a/vendor/github.com/openshift/cluster-api-actuator-pkg/pkg/e2e/framework/machines.go b/vendor/github.com/openshift/cluster-api-actuator-pkg/pkg/e2e/framework/machines.go index 3a24599e0..079ff97ff 100644 --- a/vendor/github.com/openshift/cluster-api-actuator-pkg/pkg/e2e/framework/machines.go +++ b/vendor/github.com/openshift/cluster-api-actuator-pkg/pkg/e2e/framework/machines.go @@ -8,24 +8,24 @@ import ( "github.com/golang/glog" "github.com/openshift/cluster-api-actuator-pkg/pkg/types" + machinev1beta1 "github.com/openshift/cluster-api/pkg/apis/machine/v1beta1" apiv1 "k8s.io/api/core/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/labels" "k8s.io/apimachinery/pkg/util/wait" "k8s.io/client-go/rest" "k8s.io/client-go/tools/clientcmd" - clusterv1alpha1 "sigs.k8s.io/cluster-api/pkg/apis/cluster/v1alpha1" ) -func (f *Framework) DeleteMachineAndWait(machine *clusterv1alpha1.Machine, client types.CloudProviderClient) { +func (f *Framework) DeleteMachineAndWait(machine *machinev1beta1.Machine, client types.CloudProviderClient) { f.By(fmt.Sprintf("Deleting %q machine", machine.Name)) - err := f.CAPIClient.ClusterV1alpha1().Machines(machine.Namespace).Delete(machine.Name, &metav1.DeleteOptions{}) + err := f.CAPIClient.MachineV1beta1().Machines(machine.Namespace).Delete(machine.Name, &metav1.DeleteOptions{}) f.IgnoreNotFoundErr(err) // Verify the testing machine has been destroyed f.By("Verify instance is terminated") err = wait.Poll(PollInterval, PoolTimeout, func() (bool, error) { - _, err := f.CAPIClient.ClusterV1alpha1().Machines(machine.Namespace).Get(machine.Name, metav1.GetOptions{}) + _, err := f.CAPIClient.MachineV1beta1().Machines(machine.Namespace).Get(machine.Name, metav1.GetOptions{}) if err == nil { glog.V(2).Info("Waiting for machine to be deleted") return false, nil @@ -55,11 +55,11 @@ func (f *Framework) DeleteMachineAndWait(machine *clusterv1alpha1.Machine, clien } } -func (f *Framework) waitForMachineToRun(machine *clusterv1alpha1.Machine, client types.CloudProviderClient) { +func (f *Framework) waitForMachineToRun(machine *machinev1beta1.Machine, client types.CloudProviderClient) { f.By(fmt.Sprintf("Waiting for %q machine", machine.Name)) // Verify machine has been deployed err := wait.Poll(PollInterval, TimeoutPoolMachineRunningInterval, func() (bool, error) { - if _, err := f.CAPIClient.ClusterV1alpha1().Machines(machine.Namespace).Get(machine.Name, metav1.GetOptions{}); err != nil { + if _, err := f.CAPIClient.MachineV1beta1().Machines(machine.Namespace).Get(machine.Name, metav1.GetOptions{}); err != nil { glog.V(2).Infof("Waiting for '%v/%v' machine to be created", machine.Namespace, machine.Name) return false, nil } @@ -88,7 +88,7 @@ func (f *Framework) waitForMachineToRun(machine *clusterv1alpha1.Machine, client f.ErrNotExpected(err) } -func (f *Framework) waitForMachineToTerminate(machine *clusterv1alpha1.Machine, client types.CloudProviderClient) error { +func (f *Framework) waitForMachineToTerminate(machine *machinev1beta1.Machine, client types.CloudProviderClient) error { f.By("Verify machine's underlying instance is not running") err := wait.Poll(PollInterval, PoolTimeout, func() (bool, error) { glog.V(2).Info("Waiting for instance to terminate") @@ -105,30 +105,30 @@ func (f *Framework) waitForMachineToTerminate(machine *clusterv1alpha1.Machine, }) // We need to allow to follow if err != nil { - glog.V(2).Info("unable to wait for instance(s) to terminate: %v", err) + glog.V(2).Infof("unable to wait for instance(s) to terminate: %v", err) return err } f.By(fmt.Sprintf("Waiting for %q machine object to be deleted", machine.Name)) // Verify machine has been deployed err = wait.Poll(PollInterval, TimeoutPoolMachineRunningInterval, func() (bool, error) { - if _, err := f.CAPIClient.ClusterV1alpha1().Machines(machine.Namespace).Get(machine.Name, metav1.GetOptions{}); err != nil { + if _, err := f.CAPIClient.MachineV1beta1().Machines(machine.Namespace).Get(machine.Name, metav1.GetOptions{}); err != nil { glog.V(2).Infof("err: %v", err) return true, nil } return false, nil }) if err != nil { - glog.V(2).Info("unable to wait for machine to get deleted: %v", err) + glog.V(2).Infof("unable to wait for machine to get deleted: %v", err) return err } return nil } -func (f *Framework) CreateMachineAndWait(machine *clusterv1alpha1.Machine, client types.CloudProviderClient) { +func (f *Framework) CreateMachineAndWait(machine *machinev1beta1.Machine, client types.CloudProviderClient) { f.By(fmt.Sprintf("Creating %q machine", machine.Name)) err := wait.Poll(PollInterval, PoolTimeout, func() (bool, error) { - _, err := f.CAPIClient.ClusterV1alpha1().Machines(machine.Namespace).Create(machine) + _, err := f.CAPIClient.MachineV1beta1().Machines(machine.Namespace).Create(machine) if err != nil { glog.V(2).Infof("can't create machine: %v", err) return false, nil @@ -140,10 +140,10 @@ func (f *Framework) CreateMachineAndWait(machine *clusterv1alpha1.Machine, clien f.waitForMachineToRun(machine, client) } -func (f *Framework) CreateMachineSetAndWait(machineset *clusterv1alpha1.MachineSet, client types.CloudProviderClient) { +func (f *Framework) CreateMachineSetAndWait(machineset *machinev1beta1.MachineSet, client types.CloudProviderClient) { f.By(fmt.Sprintf("Creating %q machineset", machineset.Name)) err := wait.Poll(PollInterval, PoolTimeout, func() (bool, error) { - _, err := f.CAPIClient.ClusterV1alpha1().MachineSets(machineset.Namespace).Create(machineset) + _, err := f.CAPIClient.MachineV1beta1().MachineSets(machineset.Namespace).Create(machineset) if err != nil { glog.V(2).Infof("can't create machineset: %v", err) return false, nil @@ -154,7 +154,7 @@ func (f *Framework) CreateMachineSetAndWait(machineset *clusterv1alpha1.MachineS // Verify machineset has been deployed err = wait.Poll(PollInterval, TimeoutPoolMachineRunningInterval, func() (bool, error) { - if _, err := f.CAPIClient.ClusterV1alpha1().MachineSets(machineset.Namespace).Get(machineset.Name, metav1.GetOptions{}); err != nil { + if _, err := f.CAPIClient.MachineV1beta1().MachineSets(machineset.Namespace).Get(machineset.Name, metav1.GetOptions{}); err != nil { glog.V(2).Infof("Waiting for machineset to be created: %v", err) return false, nil } @@ -163,7 +163,7 @@ func (f *Framework) CreateMachineSetAndWait(machineset *clusterv1alpha1.MachineS f.ErrNotExpected(err) f.By("Verify machineset's underlying instances is running") - machines, err := f.CAPIClient.ClusterV1alpha1().Machines(machineset.Namespace).List(metav1.ListOptions{ + machines, err := f.CAPIClient.MachineV1beta1().Machines(machineset.Namespace).List(metav1.ListOptions{ LabelSelector: labels.SelectorFromSet(machineset.Spec.Selector.MatchLabels).String(), }) f.ErrNotExpected(err) @@ -173,9 +173,9 @@ func (f *Framework) CreateMachineSetAndWait(machineset *clusterv1alpha1.MachineS } } -func (f *Framework) DeleteMachineSetAndWait(machineset *clusterv1alpha1.MachineSet, client types.CloudProviderClient) error { +func (f *Framework) DeleteMachineSetAndWait(machineset *machinev1beta1.MachineSet, client types.CloudProviderClient) error { f.By(fmt.Sprintf("Get all %q machineset's machines", machineset.Name)) - machines, err := f.CAPIClient.ClusterV1alpha1().Machines(machineset.Namespace).List(metav1.ListOptions{ + machines, err := f.CAPIClient.MachineV1beta1().Machines(machineset.Namespace).List(metav1.ListOptions{ LabelSelector: labels.SelectorFromSet(machineset.Spec.Selector.MatchLabels).String(), }) if err != nil { @@ -183,7 +183,7 @@ func (f *Framework) DeleteMachineSetAndWait(machineset *clusterv1alpha1.MachineS } f.By(fmt.Sprintf("Deleting %q machineset", machineset.Name)) - err = f.CAPIClient.ClusterV1alpha1().MachineSets(machineset.Namespace).Delete(machineset.Name, &metav1.DeleteOptions{}) + err = f.CAPIClient.MachineV1beta1().MachineSets(machineset.Namespace).Delete(machineset.Name, &metav1.DeleteOptions{}) if err != nil { return err } @@ -195,7 +195,7 @@ func (f *Framework) DeleteMachineSetAndWait(machineset *clusterv1alpha1.MachineS } err = wait.Poll(PollInterval, PoolTimeout, func() (bool, error) { - _, err := f.CAPIClient.ClusterV1alpha1().MachineSets(machineset.Namespace).Get(machineset.Name, metav1.GetOptions{}) + _, err := f.CAPIClient.MachineV1beta1().MachineSets(machineset.Namespace).Get(machineset.Name, metav1.GetOptions{}) if err != nil { if strings.Contains(err.Error(), "not found") { return true, nil @@ -264,7 +264,7 @@ func ReadKubeconfigFromServer(sshConfig *SSHConfig) (string, error) { return b.String(), nil } -func (f *Framework) GetMasterMachineRestConfig(masterMachine *clusterv1alpha1.Machine, client types.CloudProviderClient) (*rest.Config, error) { +func (f *Framework) GetMasterMachineRestConfig(masterMachine *machinev1beta1.Machine, client types.CloudProviderClient) (*rest.Config, error) { var masterPublicDNSName string err := wait.Poll(PollInterval, TimeoutPoolMachineRunningInterval, func() (bool, error) { var err error @@ -312,13 +312,13 @@ func (f *Framework) GetMasterMachineRestConfig(masterMachine *clusterv1alpha1.Ma } type machineToDelete struct { - machine *clusterv1alpha1.Machine + machine *machinev1beta1.Machine framework *Framework client types.CloudProviderClient } type machinesetToDelete struct { - machineset *clusterv1alpha1.MachineSet + machineset *machinev1beta1.MachineSet framework *Framework client types.CloudProviderClient } @@ -335,11 +335,11 @@ func InitMachinesToDelete() *MachinesToDelete { } } -func (m *MachinesToDelete) AddMachine(machine *clusterv1alpha1.Machine, framework *Framework, client types.CloudProviderClient) { +func (m *MachinesToDelete) AddMachine(machine *machinev1beta1.Machine, framework *Framework, client types.CloudProviderClient) { m.machines = append([]machineToDelete{{machine: machine, framework: framework, client: client}}, m.machines...) } -func (m *MachinesToDelete) AddMachineSet(machineset *clusterv1alpha1.MachineSet, framework *Framework, client types.CloudProviderClient) { +func (m *MachinesToDelete) AddMachineSet(machineset *machinev1beta1.MachineSet, framework *Framework, client types.CloudProviderClient) { m.machinesets = append([]machinesetToDelete{{machineset: machineset, framework: framework, client: client}}, m.machinesets...) } diff --git a/vendor/github.com/openshift/cluster-api-actuator-pkg/pkg/manifests/manifests.go b/vendor/github.com/openshift/cluster-api-actuator-pkg/pkg/manifests/manifests.go index 24297491b..954ed4bd7 100644 --- a/vendor/github.com/openshift/cluster-api-actuator-pkg/pkg/manifests/manifests.go +++ b/vendor/github.com/openshift/cluster-api-actuator-pkg/pkg/manifests/manifests.go @@ -11,9 +11,10 @@ import ( "k8s.io/apimachinery/pkg/api/resource" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/util/uuid" + // apiregistrationv1beta1 "k8s.io/kube-aggregator/pkg/apis/apiregistration/v1beta1" + machinev1beta1 "github.com/openshift/cluster-api/pkg/apis/machine/v1beta1" "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1beta1" - clusterv1alpha1 "sigs.k8s.io/cluster-api/pkg/apis/cluster/v1alpha1" ) func ClusterCRDManifest() *v1beta1.CustomResourceDefinition { @@ -23,14 +24,14 @@ func ClusterCRDManifest() *v1beta1.CustomResourceDefinition { APIVersion: "apiextensions.k8s.io/v1beta1", }, ObjectMeta: metav1.ObjectMeta{ - Name: "clusters.cluster.k8s.io", + Name: "clusters.machine.openshift.io", Labels: map[string]string{ "controller-tools.k8s.io": "1.0", }, }, Spec: v1beta1.CustomResourceDefinitionSpec{ - Group: "cluster.k8s.io", - Version: "v1alpha1", + Group: "machine.openshift.io", + Version: "v1beta1", Names: v1beta1.CustomResourceDefinitionNames{ Plural: "clusters", Kind: "Cluster", @@ -164,14 +165,14 @@ func MachineCRDManifest() *v1beta1.CustomResourceDefinition { APIVersion: "apiextensions.k8s.io/v1beta1", }, ObjectMeta: metav1.ObjectMeta{ - Name: "machines.cluster.k8s.io", + Name: "machines.machine.openshift.io", Labels: map[string]string{ "controller-tools.k8s.io": "1.0", }, }, Spec: v1beta1.CustomResourceDefinitionSpec{ - Group: "cluster.k8s.io", - Version: "v1alpha1", + Group: "machine.openshift.io", + Version: "v1beta1", Names: v1beta1.CustomResourceDefinitionNames{ Plural: "machines", Kind: "Machine", @@ -304,14 +305,14 @@ func MachineSetCRDManifest() *v1beta1.CustomResourceDefinition { APIVersion: "apiextensions.k8s.io/v1beta1", }, ObjectMeta: metav1.ObjectMeta{ - Name: "machinesets.cluster.k8s.io", + Name: "machinesets.machine.openshift.io", Labels: map[string]string{ "controller-tools.k8s.io": "1.0", }, }, Spec: v1beta1.CustomResourceDefinitionSpec{ - Group: "cluster.k8s.io", - Version: "v1alpha1", + Group: "machine.openshift.io", + Version: "v1beta1", Names: v1beta1.CustomResourceDefinitionNames{ Plural: "machinesets", Kind: "MachineSet", @@ -454,14 +455,14 @@ func MachineDeploymentCRDManifest() *v1beta1.CustomResourceDefinition { APIVersion: "apiextensions.k8s.io/v1beta1", }, ObjectMeta: metav1.ObjectMeta{ - Name: "machinedeployments.cluster.k8s.io", + Name: "machinedeployments.machine.openshift.io", Labels: map[string]string{ "controller-tools.k8s.io": "1.0", }, }, Spec: v1beta1.CustomResourceDefinitionSpec{ - Group: "cluster.k8s.io", - Version: "v1alpha1", + Group: "machine.openshift.io", + Version: "v1beta1", Names: v1beta1.CustomResourceDefinitionNames{ Plural: "machinedeployments", Kind: "MachineDeployment", @@ -644,7 +645,7 @@ func ClusterRoleManifest() *rbacv1.ClusterRole { "delete", }, APIGroups: []string{ - "cluster.k8s.io", + "machine.openshift.io", }, Resources: []string{ "clusters", @@ -902,9 +903,9 @@ func ClusterAPIControllersDeployment(clusterAPINamespace, machineControllerImage return deployment } -func TestingMachine(clusterID string, namespace string, providerSpec clusterv1alpha1.ProviderSpec) *clusterv1alpha1.Machine { +func TestingMachine(clusterID string, namespace string, providerSpec machinev1beta1.ProviderSpec) *machinev1beta1.Machine { randomUUID := string(uuid.NewUUID()) - machine := &clusterv1alpha1.Machine{ + machine := &machinev1beta1.Machine{ ObjectMeta: metav1.ObjectMeta{ Name: clusterID + "-machine-" + randomUUID[:6], Namespace: namespace, @@ -913,14 +914,14 @@ func TestingMachine(clusterID string, namespace string, providerSpec clusterv1al "sigs.k8s.io/cluster-api-cluster": clusterID, }, }, - Spec: clusterv1alpha1.MachineSpec{ + Spec: machinev1beta1.MachineSpec{ ObjectMeta: metav1.ObjectMeta{ Labels: map[string]string{ "node-role.kubernetes.io/compute": "", }, }, ProviderSpec: providerSpec, - Versions: clusterv1alpha1.MachineVersionInfo{ + Versions: machinev1beta1.MachineVersionInfo{ Kubelet: "1.10.1", ControlPlane: "1.10.1", }, @@ -930,9 +931,9 @@ func TestingMachine(clusterID string, namespace string, providerSpec clusterv1al return machine } -func MasterMachine(clusterID, namespace string, providerSpec clusterv1alpha1.ProviderSpec) *clusterv1alpha1.Machine { +func MasterMachine(clusterID, namespace string, providerSpec machinev1beta1.ProviderSpec) *machinev1beta1.Machine { randomUUID := string(uuid.NewUUID()) - machine := &clusterv1alpha1.Machine{ + machine := &machinev1beta1.Machine{ ObjectMeta: metav1.ObjectMeta{ Name: clusterID + "-master-machine-" + randomUUID[:6], Namespace: namespace, @@ -941,9 +942,9 @@ func MasterMachine(clusterID, namespace string, providerSpec clusterv1alpha1.Pro "sigs.k8s.io/cluster-api-cluster": clusterID, }, }, - Spec: clusterv1alpha1.MachineSpec{ + Spec: machinev1beta1.MachineSpec{ ProviderSpec: providerSpec, - Versions: clusterv1alpha1.MachineVersionInfo{ + Versions: machinev1beta1.MachineVersionInfo{ Kubelet: "1.10.1", ControlPlane: "1.10.1", }, @@ -1003,10 +1004,10 @@ func WorkerMachineUserDataSecret(secretName, namespace, masterIP string) (*apiv1 }, nil } -func WorkerMachineSet(clusterID, namespace string, providerSpec clusterv1alpha1.ProviderSpec) *clusterv1alpha1.MachineSet { +func WorkerMachineSet(clusterID, namespace string, providerSpec machinev1beta1.ProviderSpec) *machinev1beta1.MachineSet { var replicas int32 = 1 randomUUID := string(uuid.NewUUID()) - return &clusterv1alpha1.MachineSet{ + return &machinev1beta1.MachineSet{ ObjectMeta: metav1.ObjectMeta{ Name: clusterID + "-worker-machineset-" + randomUUID[:6], Namespace: namespace, @@ -1015,7 +1016,7 @@ func WorkerMachineSet(clusterID, namespace string, providerSpec clusterv1alpha1. "sigs.k8s.io/cluster-api-cluster": clusterID, }, }, - Spec: clusterv1alpha1.MachineSetSpec{ + Spec: machinev1beta1.MachineSetSpec{ Selector: metav1.LabelSelector{ MatchLabels: map[string]string{ "sigs.k8s.io/cluster-api-machineset": clusterID + "-worker-machineset-" + randomUUID[:6], @@ -1023,7 +1024,7 @@ func WorkerMachineSet(clusterID, namespace string, providerSpec clusterv1alpha1. }, }, Replicas: &replicas, - Template: clusterv1alpha1.MachineTemplateSpec{ + Template: machinev1beta1.MachineTemplateSpec{ ObjectMeta: metav1.ObjectMeta{ GenerateName: clusterID + "-worker-machine-" + randomUUID[:6] + "-", Labels: map[string]string{ @@ -1031,14 +1032,14 @@ func WorkerMachineSet(clusterID, namespace string, providerSpec clusterv1alpha1. "sigs.k8s.io/cluster-api-cluster": clusterID, }, }, - Spec: clusterv1alpha1.MachineSpec{ + Spec: machinev1beta1.MachineSpec{ ObjectMeta: metav1.ObjectMeta{ Labels: map[string]string{ "node-role.kubernetes.io/compute": "", }, }, ProviderSpec: providerSpec, - Versions: clusterv1alpha1.MachineVersionInfo{ + Versions: machinev1beta1.MachineVersionInfo{ Kubelet: "1.10.1", ControlPlane: "1.10.1", }, diff --git a/vendor/github.com/openshift/cluster-api-actuator-pkg/pkg/types/types.go b/vendor/github.com/openshift/cluster-api-actuator-pkg/pkg/types/types.go index b826b2f25..39458f219 100644 --- a/vendor/github.com/openshift/cluster-api-actuator-pkg/pkg/types/types.go +++ b/vendor/github.com/openshift/cluster-api-actuator-pkg/pkg/types/types.go @@ -1,13 +1,13 @@ package types -import clusterv1alpha1 "sigs.k8s.io/cluster-api/pkg/apis/cluster/v1alpha1" +import machinev1beta1 "github.com/openshift/cluster-api/pkg/apis/machine/v1beta1" // CloudProviderClient interface to generalize queries over various cloud providers type CloudProviderClient interface { // Get running instances (of a given cloud provider) managed by the machine object - GetRunningInstances(machine *clusterv1alpha1.Machine) ([]interface{}, error) + GetRunningInstances(machine *machinev1beta1.Machine) ([]interface{}, error) // Get running instance public DNS name - GetPublicDNSName(machine *clusterv1alpha1.Machine) (string, error) + GetPublicDNSName(machine *machinev1beta1.Machine) (string, error) // Get private IP - GetPrivateIP(machine *clusterv1alpha1.Machine) (string, error) + GetPrivateIP(machine *machinev1beta1.Machine) (string, error) } diff --git a/vendor/sigs.k8s.io/cluster-api/.github/ISSUE_TEMPLATE/bug_report.md b/vendor/github.com/openshift/cluster-api/.github/ISSUE_TEMPLATE/bug_report.md similarity index 100% rename from vendor/sigs.k8s.io/cluster-api/.github/ISSUE_TEMPLATE/bug_report.md rename to vendor/github.com/openshift/cluster-api/.github/ISSUE_TEMPLATE/bug_report.md diff --git a/vendor/sigs.k8s.io/cluster-api/.github/ISSUE_TEMPLATE/feature_request.md b/vendor/github.com/openshift/cluster-api/.github/ISSUE_TEMPLATE/feature_request.md similarity index 100% rename from vendor/sigs.k8s.io/cluster-api/.github/ISSUE_TEMPLATE/feature_request.md rename to vendor/github.com/openshift/cluster-api/.github/ISSUE_TEMPLATE/feature_request.md diff --git a/vendor/sigs.k8s.io/cluster-api/.github/PULL_REQUEST_TEMPLATE.md b/vendor/github.com/openshift/cluster-api/.github/PULL_REQUEST_TEMPLATE.md similarity index 100% rename from vendor/sigs.k8s.io/cluster-api/.github/PULL_REQUEST_TEMPLATE.md rename to vendor/github.com/openshift/cluster-api/.github/PULL_REQUEST_TEMPLATE.md diff --git a/vendor/sigs.k8s.io/cluster-api/.gitignore b/vendor/github.com/openshift/cluster-api/.gitignore similarity index 100% rename from vendor/sigs.k8s.io/cluster-api/.gitignore rename to vendor/github.com/openshift/cluster-api/.gitignore diff --git a/vendor/sigs.k8s.io/cluster-api/BUILD.bazel b/vendor/github.com/openshift/cluster-api/BUILD.bazel similarity index 67% rename from vendor/sigs.k8s.io/cluster-api/BUILD.bazel rename to vendor/github.com/openshift/cluster-api/BUILD.bazel index 8f39d36c9..6b4ea4e7f 100644 --- a/vendor/sigs.k8s.io/cluster-api/BUILD.bazel +++ b/vendor/github.com/openshift/cluster-api/BUILD.bazel @@ -1,6 +1,6 @@ load("@bazel_gazelle//:def.bzl", "gazelle") -# gazelle:prefix sigs.k8s.io/cluster-api +# gazelle:prefix github.com/openshift/cluster-api gazelle( name = "gazelle", external = "vendored", diff --git a/vendor/sigs.k8s.io/cluster-api/CONTRIBUTING.md b/vendor/github.com/openshift/cluster-api/CONTRIBUTING.md similarity index 91% rename from vendor/sigs.k8s.io/cluster-api/CONTRIBUTING.md rename to vendor/github.com/openshift/cluster-api/CONTRIBUTING.md index a635b9d7e..cc52280e0 100644 --- a/vendor/sigs.k8s.io/cluster-api/CONTRIBUTING.md +++ b/vendor/github.com/openshift/cluster-api/CONTRIBUTING.md @@ -17,7 +17,7 @@ If you're new to the project and want to help, but don't know where to start, we ## Contributing a Patch 1. If you haven't already done so, sign a Contributor License Agreement (see details above). -1. Fork the desired repo, develop and test your code changes. +1. Fork the desired repo, develop and test your code changes. 1. Submit a pull request. All changes must be code reviewed. Coding conventions and standards are explained in the official [developer docs](https://github.com/kubernetes/community/tree/master/contributors/devel). Expect reviewers to request that you avoid common [go style mistakes](https://github.com/golang/go/wiki/CodeReviewComments) in your PRs. @@ -41,7 +41,7 @@ The machine controller should be able to act on a subset of machines that form a ### Resources -* [Cluster Management API KEP](https://github.com/kubernetes/community/blob/master/keps/sig-cluster-lifecycle/0003-cluster-api.md) +* [Cluster Management API KEP](https://github.com/kubernetes/enhancements/blob/master/keps/sig-cluster-lifecycle/0003-cluster-api.md) * [Cluster type](https://github.com/kubernetes-sigs/cluster-api/blob/master/pkg/apis/cluster/v1alpha1/cluster_types.go#L40) * [Machine type](https://github.com/kubernetes-sigs/cluster-api/blob/master/pkg/apis/cluster/v1alpha1/machine_types.go#L42) @@ -54,7 +54,7 @@ To minimize code duplication and maximize flexibility, bootstrap clusters with a A new Machine can be created in a declarative way, specifying versions of various components such as the kubelet. It should also be able to specify provider-specific information such as OS image, instance type, disk configuration, etc., though this will not be portable. -When a cluster is first created with a cluster config file, there is no master node or api server. So the user will need to bootstrap a cluster. While the implementation details are specific to the provider, the following guidance should help you: +When a cluster is first created with a cluster config file, there is no control plane node or api server. So the user will need to bootstrap a cluster. While the implementation details are specific to the provider, the following guidance should help you: * Your tool should spin up the external apiserver and the machine controller. * POST the objects to the apiserver. @@ -63,23 +63,23 @@ When a cluster is first created with a cluster config file, there is no master n #### Configurable Machine Setup -While not mandatory, it is suggested for new providers to support configurable machine setups for creating new machines. +While not mandatory, it is suggested for new providers to support configurable machine setups for creating new machines. This is to allow flexibility in what startup scripts are used and what versions are supported instead of hardcoding startup scripts into the machine controller. You can find an example implementation for GCE [here](https://github.com/kubernetes-sigs/cluster-api-provider-gcp/blob/ee60efd89c4d0129a6d42b40d069c0b41d2c4987/cloud/google/machinesetup/config_types.go). ##### GCE Implementation For GCE, a [config map](https://github.com/kubernetes-sigs/cluster-api-provider-gcp/blob/c0ac09e86b6630bd65c277120883719e514cfdf5/clusterctl/examples/google/provider-components.yaml.template#L151) holds the list of valid machine setup configs, -and the yaml file is volume mounted into the machine controller using a ConfigMap named `machine-setup`. +and the yaml file is volume mounted into the machine controller using a ConfigMap named `machine-setup`. A [config type](https://github.com/kubernetes-sigs/cluster-api-provider-gcp/blob/ee60efd89c4d0129a6d42b40d069c0b41d2c4987/cloud/google/machinesetup/config_types.go#L70) defines a set of parameters that can be taken from the machine object being created, and maps those parameters to startup scripts and other relevant information. In GCE, the OS, machine roles, and version info are the parameters that map to a GCP image path and metadata (which contains the startup script). -When creating a new machine, there should be a check for whether the machine setup is supported. +When creating a new machine, there should be a check for whether the machine setup is supported. This is done by looking through the valid configs parsed out of the yaml for a config with matching parameters. If a match is found, then the machine can be created with the startup script found in the config. If no match is found, then the given machine configuration is not supported. -Getting the script onto the machine and running it on startup is a provider specific implementation detail. +Getting the script onto the machine and running it on startup is a provider specific implementation detail. More details can be found in the [design doc](https://docs.google.com/document/d/1OfykBDOXP_t6QEtiYBA-Ax7nSpqohFofyX-wOxrQrnw/edit?ts=5ae11208#heading=h.xgjl2srtytjt), but note that it is GCE specific. @@ -103,7 +103,7 @@ for machine in machines: The specific upgrade logic will be implement as part of the machine controller, and is specific to the provider. The user provided provider config will be in `machine.Spec.ProviderSpec`. -Discussion around in-place vs replace upgrades [is here](https://github.com/kubernetes/community/blob/master/keps/sig-cluster-lifecycle/0003-cluster-api.md#in-place-vs-replace). +Discussion around in-place vs replace upgrades [is here](https://github.com/kubernetes/enhancements/blob/master/keps/sig-cluster-lifecycle/0003-cluster-api.md#in-place-vs-replace). ## Support Channels diff --git a/vendor/sigs.k8s.io/cluster-api/Dockerfile b/vendor/github.com/openshift/cluster-api/Dockerfile similarity index 81% rename from vendor/sigs.k8s.io/cluster-api/Dockerfile rename to vendor/github.com/openshift/cluster-api/Dockerfile index 355579598..f0d00be9f 100644 --- a/vendor/sigs.k8s.io/cluster-api/Dockerfile +++ b/vendor/github.com/openshift/cluster-api/Dockerfile @@ -13,7 +13,7 @@ # limitations under the License. # Build the manager binary -FROM golang:1.10.3 as builder +FROM golang:1.11.5 as builder # Copy in the go src WORKDIR $GOPATH/src/sigs.k8s.io/cluster-api @@ -22,11 +22,10 @@ COPY cmd/ cmd/ COPY vendor/ vendor/ # Build -RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -a -o manager sigs.k8s.io/cluster-api/cmd/manager +RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -a -ldflags '-extldflags "-static"' -o manager sigs.k8s.io/cluster-api/cmd/manager # Copy the controller-manager into a thin image -# TODO: Build this on scratch -FROM debian:latest +FROM gcr.io/distroless/static:latest WORKDIR / COPY --from=builder /go/src/sigs.k8s.io/cluster-api/manager . ENTRYPOINT ["/manager"] diff --git a/vendor/sigs.k8s.io/cluster-api/Gopkg.lock b/vendor/github.com/openshift/cluster-api/Gopkg.lock similarity index 87% rename from vendor/sigs.k8s.io/cluster-api/Gopkg.lock rename to vendor/github.com/openshift/cluster-api/Gopkg.lock index 8df1de4f8..d4b85d190 100644 --- a/vendor/sigs.k8s.io/cluster-api/Gopkg.lock +++ b/vendor/github.com/openshift/cluster-api/Gopkg.lock @@ -9,6 +9,14 @@ revision = "97efc2c9ffd9fe8ef47f7f3203dc60bbca547374" version = "v0.28.0" +[[projects]] + branch = "master" + digest = "1:d6afaeed1502aa28e80a4ed0981d570ad91b2579193404256ce672ed0a609e0d" + name = "github.com/beorn7/perks" + packages = ["quantile"] + pruneopts = "UT" + revision = "3a771d992973f24aa725d07868b467d1ddfceafb" + [[projects]] digest = "1:ffe9824d294da03b391f44e1ae8281281b4afc1bdaa9588c9097785e3af10cec" name = "github.com/davecgh/go-spew" @@ -221,6 +229,14 @@ pruneopts = "UT" revision = "81af80346b1a01caae0cbc27fd3c1ba5b11e189f" +[[projects]] + digest = "1:ff5ebae34cfbf047d505ee150de27e60570e8c394b3b8fdbb720ff6ac71985fc" + name = "github.com/matttproud/golang_protobuf_extensions" + packages = ["pbutil"] + pruneopts = "UT" + revision = "c12348ce28de40eed0136aa2b644d0ee0650e56c" + version = "v1.0.1" + [[projects]] digest = "1:33422d238f147d247752996a26574ac48dcf472976eda7f5134015f06bf16563" name = "github.com/modern-go/concurrent" @@ -319,6 +335,59 @@ revision = "645ef00459ed84a119197bfb8d8205042c6df63d" version = "v0.8.0" +[[projects]] + digest = "1:93a746f1060a8acbcf69344862b2ceced80f854170e1caae089b2834c5fbf7f4" + name = "github.com/prometheus/client_golang" + packages = [ + "prometheus", + "prometheus/internal", + "prometheus/promhttp", + ] + pruneopts = "UT" + revision = "505eaef017263e299324067d40ca2c48f6a2cf50" + version = "v0.9.2" + +[[projects]] + branch = "master" + digest = "1:2d5cd61daa5565187e1d96bae64dbbc6080dacf741448e9629c64fd93203b0d4" + name = "github.com/prometheus/client_model" + packages = ["go"] + pruneopts = "UT" + revision = "5c3871d89910bfb32f5fcab2aa4b9ec68e65a99f" + +[[projects]] + branch = "master" + digest = "1:db712fde5d12d6cdbdf14b777f0c230f4ff5ab0be8e35b239fc319953ed577a4" + name = "github.com/prometheus/common" + packages = [ + "expfmt", + "internal/bitbucket.org/ww/goautoneg", + "model", + ] + pruneopts = "UT" + revision = "4724e9255275ce38f7179b2478abeae4e28c904f" + +[[projects]] + branch = "master" + digest = "1:d39e7c7677b161c2dd4c635a2ac196460608c7d8ba5337cc8cae5825a2681f8f" + name = "github.com/prometheus/procfs" + packages = [ + ".", + "internal/util", + "nfs", + "xfs", + ] + pruneopts = "UT" + revision = "1dc9a6cbc91aacc3e8b2d63db4d2e957a5394ac4" + +[[projects]] + digest = "1:d917313f309bda80d27274d53985bc65651f81a5b66b820749ac7f8ef061fd04" + name = "github.com/sergi/go-diff" + packages = ["diffmatchpatch"] + pruneopts = "UT" + revision = "1744e2970ca51c86172c8190fadad617561ed6e7" + version = "v1.0.0" + [[projects]] digest = "1:6a4a11ba764a56d2758899ec6f3848d24698d48442ebce85ee7a3f63284526cd" name = "github.com/spf13/afero" @@ -536,7 +605,7 @@ version = "v2.2.1" [[projects]] - digest = "1:728c0c37966b7a6c8980fab69a3d690cc0996e206804a55052318858d00f1e17" + digest = "1:26a67eb988225c6a0600c1af0b35e795ac4d23a9c40a7aa178fa2adc0670f1f7" name = "k8s.io/api" packages = [ "admission/v1beta1", @@ -551,10 +620,12 @@ "authorization/v1beta1", "autoscaling/v1", "autoscaling/v2beta1", + "autoscaling/v2beta2", "batch/v1", "batch/v1beta1", "batch/v2alpha1", "certificates/v1beta1", + "coordination/v1beta1", "core/v1", "events/v1beta1", "extensions/v1beta1", @@ -571,11 +642,11 @@ "storage/v1beta1", ] pruneopts = "UT" - revision = "2d6f90ab1293a1fb871cf149423ebb72aa7423aa" - version = "kubernetes-1.11.2" + revision = "b503174bad5991eb66f18247f52e41c3258f6348" + version = "kubernetes-1.12.3" [[projects]] - digest = "1:145647b653ff6a6882bbc2c4701ebcbce7be643007231d545560e4ce612ad5cb" + digest = "1:d9e9a6062217111c1b7c548a47bd67b2b518c8da05d124dbca74e246565c76a6" name = "k8s.io/apiextensions-apiserver" packages = [ "pkg/apis/apiextensions", @@ -585,11 +656,11 @@ "pkg/client/clientset/clientset/typed/apiextensions/v1beta1", ] pruneopts = "UT" - revision = "408db4a50408e2149acbd657bceb2480c13cb0a4" - version = "kubernetes-1.11.2" + revision = "0cd23ebeb6882bd1cdc2cb15fc7b2d72e8a86a5b" + version = "kubernetes-1.12.3" [[projects]] - digest = "1:6a8fca786f4e263fac02cb6cfe8f0decfee526aede3969d301e18fcef167cd38" + digest = "1:37113933623d6702a851b11c9a7534adb99961c1bf3cc8bd3b354402fd7243fe" name = "k8s.io/apimachinery" packages = [ "pkg/api/equality", @@ -623,6 +694,7 @@ "pkg/util/intstr", "pkg/util/json", "pkg/util/mergepatch", + "pkg/util/naming", "pkg/util/net", "pkg/util/rand", "pkg/util/runtime", @@ -639,8 +711,8 @@ "third_party/forked/golang/reflect", ] pruneopts = "UT" - revision = "103fd098999dc9c0c88536f5c9ad2e5da39373ae" - version = "kubernetes-1.11.2" + revision = "eddba98df674a16931d2d4ba75edc3a389bf633a" + version = "kubernetes-1.12.3" [[projects]] branch = "master" @@ -651,7 +723,7 @@ revision = "cf5eff4f5e8f6019796cb18c69918b9f2f09e6db" [[projects]] - digest = "1:2094148c7308a9ddab4ad3c355c343a55d8b6c265417cebe42e74a594916dd9d" + digest = "1:b2820d12e324fc54ce0a4f330719c6858a5dfafbe053f2cb48ff299aed4538d1" name = "k8s.io/client-go" packages = [ "discovery", @@ -670,10 +742,12 @@ "kubernetes/typed/authorization/v1beta1", "kubernetes/typed/autoscaling/v1", "kubernetes/typed/autoscaling/v2beta1", + "kubernetes/typed/autoscaling/v2beta2", "kubernetes/typed/batch/v1", "kubernetes/typed/batch/v1beta1", "kubernetes/typed/batch/v2alpha1", "kubernetes/typed/certificates/v1beta1", + "kubernetes/typed/coordination/v1beta1", "kubernetes/typed/core/v1", "kubernetes/typed/events/v1beta1", "kubernetes/typed/extensions/v1beta1", @@ -723,8 +797,8 @@ "util/workqueue", ] pruneopts = "UT" - revision = "1f13a808da65775f22cbf47862c4e5898d8f4ca1" - version = "kubernetes-1.11.2" + revision = "d082d5923d3cc0bfbb066ee5fbdea3d0ca79acf8" + version = "kubernetes-1.12.3" [[projects]] branch = "master" @@ -785,7 +859,7 @@ revision = "e3762e86a74c878ffed47484592986685639c2cd" [[projects]] - digest = "1:264a5cbd8f1975842b856e8a590e2c54eaffb087c8bfa130d338eb07c7325a87" + digest = "1:734453bd0e3edfe11b06da2473ee42041f9f59c230d482fee90d7f877aed88b3" name = "sigs.k8s.io/controller-runtime" packages = [ "pkg/cache", @@ -800,9 +874,11 @@ "pkg/event", "pkg/handler", "pkg/internal/controller", + "pkg/internal/controller/metrics", "pkg/internal/recorder", "pkg/leaderelection", "pkg/manager", + "pkg/metrics", "pkg/patch", "pkg/predicate", "pkg/reconcile", @@ -813,29 +889,37 @@ "pkg/runtime/signals", "pkg/source", "pkg/source/internal", + "pkg/webhook", "pkg/webhook/admission", "pkg/webhook/admission/types", + "pkg/webhook/internal/cert", + "pkg/webhook/internal/cert/generator", + "pkg/webhook/internal/cert/writer", + "pkg/webhook/internal/cert/writer/atomic", "pkg/webhook/types", ] pruneopts = "UT" - revision = "5fd1e9e9fac5261e9ad9d47c375afc014fc31d21" - version = "v0.1.7" + revision = "c63ebda0bf4be5f0a8abd4003e4ea546032545ba" + version = "v0.1.8" [[projects]] - digest = "1:41e7c89bdceb653e2235a7b5627d23af65fa22fb4dad368bf49eb2857e23bac2" + digest = "1:946a62b07e59b9abd1f475a5b5c8d590255c1d40627f386d34fd073d3de9ecb8" name = "sigs.k8s.io/controller-tools" packages = [ "cmd/controller-gen", "pkg/crd/generator", "pkg/crd/util", - "pkg/generate/rbac", "pkg/internal/codegen", "pkg/internal/codegen/parse", + "pkg/internal/general", + "pkg/rbac", "pkg/util", + "pkg/webhook", + "pkg/webhook/internal", ] pruneopts = "UT" - revision = "38b2f3f497ed6b8ea5d2844ecf00c28ac4b5c2c4" - version = "v0.1.6" + revision = "950a0e88e4effb864253b3c7504b326cc83b9d11" + version = "v0.1.8" [[projects]] branch = "master" @@ -862,6 +946,8 @@ input-imports = [ "github.com/davecgh/go-spew/spew", "github.com/emicklei/go-restful", + "github.com/pkg/errors", + "github.com/sergi/go-diff/diffmatchpatch", "github.com/spf13/cobra", "github.com/spf13/pflag", "golang.org/x/net/context", diff --git a/vendor/sigs.k8s.io/cluster-api/Gopkg.toml b/vendor/github.com/openshift/cluster-api/Gopkg.toml similarity index 100% rename from vendor/sigs.k8s.io/cluster-api/Gopkg.toml rename to vendor/github.com/openshift/cluster-api/Gopkg.toml diff --git a/vendor/sigs.k8s.io/cluster-api/LICENSE b/vendor/github.com/openshift/cluster-api/LICENSE similarity index 100% rename from vendor/sigs.k8s.io/cluster-api/LICENSE rename to vendor/github.com/openshift/cluster-api/LICENSE diff --git a/vendor/sigs.k8s.io/cluster-api/Makefile b/vendor/github.com/openshift/cluster-api/Makefile similarity index 67% rename from vendor/sigs.k8s.io/cluster-api/Makefile rename to vendor/github.com/openshift/cluster-api/Makefile index 7c9031d12..ee6575651 100644 --- a/vendor/sigs.k8s.io/cluster-api/Makefile +++ b/vendor/github.com/openshift/cluster-api/Makefile @@ -17,7 +17,7 @@ .DEFAULT_GOAL:=help -# Default timeout for starting/stopping the Kubebuilder test controlplane +# Default timeout for starting/stopping the Kubebuilder test control plane export KUBEBUILDER_CONTROLPLANE_START_TIMEOUT ?=60s export KUBEBUILDER_CONTROLPLANE_STOP_TIMEOUT ?=60s @@ -33,17 +33,23 @@ help: ## Display this help gazelle: ## Run Bazel Gazelle (which bazel && ./hack/update-bazel.sh) || true +.PHONY: dep-ensure +dep-ensure: ## Runs dep-ensure and rebuilds Bazel gazelle files. + find vendor -name 'BUILD.bazel' -delete + (which dep && dep ensure -v) || true + $(MAKE) gazelle + .PHONY: test -test: verify generate fmt vet manifests ## Run tests +test: gazelle verify generate fmt vet manifests ## Run tests go test -v -tags=integration ./pkg/... ./cmd/... .PHONY: manager manager: generate fmt vet ## Build manager binary - go build -o bin/manager sigs.k8s.io/cluster-api/cmd/manager + go build -o bin/manager github.com/openshift/cluster-api/cmd/manager .PHONY: clusterctl clusterctl: generate fmt vet ## Build clusterctl binary - go build -o bin/clusterctl sigs.k8s.io/cluster-api/cmd/clusterctl + go build -o bin/clusterctl github.com/openshift/cluster-api/cmd/clusterctl .PHONY: run run: generate fmt vet ## Run against the configured Kubernetes cluster in ~/.kube/config @@ -57,10 +63,8 @@ deploy: manifests ## Deploy controller in the configured Kubernetes cluster in ~ .PHONY: manifests manifests: ## Generate manifests e.g. CRD, RBAC etc. go run vendor/sigs.k8s.io/controller-tools/cmd/controller-gen/main.go all - @# Kubebuilder CRD generation can't handle intstr.IntOrString properly: - @# https://github.com/kubernetes-sigs/kubebuilder/issues/442 - sed -i -e 's/maxSurge:/maxSurge: {}/g' -e '/maxSurge:/{n;d};' config/crds/cluster_v1alpha1_machinedeployment.yaml - sed -i -e 's/maxUnavailable:/maxUnavailable: {}/g' -e '/maxUnavailable:/{n;d};' config/crds/cluster_v1alpha1_machinedeployment.yaml + go run vendor/sigs.k8s.io/controller-tools/cmd/controller-gen/main.go crd --domain openshift.io + git checkout config/crds/cluster_v1alpha1_* .PHONY: fmt fmt: ## Run go fmt against code @@ -71,23 +75,23 @@ vet: ## Run go vet against code go vet ./pkg/... ./cmd/... .PHONY: generate -generate: clientset gazelle ## Generate code +generate: clientset dep-ensure ## Generate code go generate ./pkg/... ./cmd/... .PHONY: clientset clientset: ## Generate a typed clientset rm -rf pkg/client cd ./vendor/k8s.io/code-generator/cmd && go install ./client-gen ./lister-gen ./informer-gen - $$GOPATH/bin/client-gen --clientset-name clientset --input-base sigs.k8s.io/cluster-api/pkg/apis \ - --input cluster/v1alpha1 --output-package sigs.k8s.io/cluster-api/pkg/client/clientset_generated \ + $$GOPATH/bin/client-gen --clientset-name clientset --input-base github.com/openshift/cluster-api/pkg/apis \ + --input cluster/v1alpha1,machine/v1beta1 --output-package github.com/openshift/cluster-api/pkg/client/clientset_generated \ --go-header-file=./hack/boilerplate.go.txt - $$GOPATH/bin/lister-gen --input-dirs sigs.k8s.io/cluster-api/pkg/apis/cluster/v1alpha1 \ - --output-package sigs.k8s.io/cluster-api/pkg/client/listers_generated \ + $$GOPATH/bin/lister-gen --input-dirs github.com/openshift/cluster-api/pkg/apis/cluster/v1alpha1,github.com/openshift/cluster-api/pkg/apis/machine/v1beta1 \ + --output-package github.com/openshift/cluster-api/pkg/client/listers_generated \ --go-header-file=./hack/boilerplate.go.txt - $$GOPATH/bin/informer-gen --input-dirs sigs.k8s.io/cluster-api/pkg/apis/cluster/v1alpha1 \ - --versioned-clientset-package sigs.k8s.io/cluster-api/pkg/client/clientset_generated/clientset \ - --listers-package sigs.k8s.io/cluster-api/pkg/client/listers_generated \ - --output-package sigs.k8s.io/cluster-api/pkg/client/informers_generated \ + $$GOPATH/bin/informer-gen --input-dirs github.com/openshift/cluster-api/pkg/apis/cluster/v1alpha1,github.com/openshift/cluster-api/pkg/apis/machine/v1beta1 \ + --versioned-clientset-package github.com/openshift/cluster-api/pkg/client/clientset_generated/clientset \ + --listers-package github.com/openshift/cluster-api/pkg/client/listers_generated \ + --output-package github.com/openshift/cluster-api/pkg/client/informers_generated \ --go-header-file=./hack/boilerplate.go.txt .PHONY: docker-build diff --git a/vendor/github.com/openshift/cluster-api/OWNERS b/vendor/github.com/openshift/cluster-api/OWNERS new file mode 100644 index 000000000..fae715a52 --- /dev/null +++ b/vendor/github.com/openshift/cluster-api/OWNERS @@ -0,0 +1,10 @@ +# See the OWNERS docs: https://git.k8s.io/community/contributors/guide/owners.md + +approvers: + - enxebre + - frobware + - ingvagabund + - bison + - paulfantom + - spangenberg + - vikaschoudhary16 diff --git a/vendor/sigs.k8s.io/cluster-api/OWNERS_ALIASES b/vendor/github.com/openshift/cluster-api/OWNERS_ALIASES similarity index 83% rename from vendor/sigs.k8s.io/cluster-api/OWNERS_ALIASES rename to vendor/github.com/openshift/cluster-api/OWNERS_ALIASES index 8e41951cf..d8f6e3cea 100644 --- a/vendor/sigs.k8s.io/cluster-api/OWNERS_ALIASES +++ b/vendor/github.com/openshift/cluster-api/OWNERS_ALIASES @@ -12,9 +12,7 @@ aliases: - luxas - roberthbailey cluster-api-maintainers: - - jessicaochen - - karan - - kris-nova + - justinsb - krousey - - mkjelland - roberthbailey + - vincepri diff --git a/vendor/sigs.k8s.io/cluster-api/PROJECT b/vendor/github.com/openshift/cluster-api/PROJECT similarity index 100% rename from vendor/sigs.k8s.io/cluster-api/PROJECT rename to vendor/github.com/openshift/cluster-api/PROJECT diff --git a/vendor/sigs.k8s.io/cluster-api/README.md b/vendor/github.com/openshift/cluster-api/README.md similarity index 83% rename from vendor/sigs.k8s.io/cluster-api/README.md rename to vendor/github.com/openshift/cluster-api/README.md index c2b54c22a..91b12dcb6 100644 --- a/vendor/sigs.k8s.io/cluster-api/README.md +++ b/vendor/github.com/openshift/cluster-api/README.md @@ -24,7 +24,7 @@ Google Group for access to documents and calendars. * Previous meetings: \[ [notes][notes] | [recordings][recordings] \] * Provider implementer office hours - * Weekly on Mondays @ 09:30 PT and Tuesdays @ 12:00 PT on [Zoom][zoomMeeting] + * Weekly on Tuesdays @ 12:00 PT ([Zoom][providerZoomMeetingTues]) and Wednesdays @ 15:00 CET ([Zoom][providerZoomMeetingWed]) * Previous meetings: \[ [notes][implementerNotes] \] * Chat with us on [Slack](http://slack.k8s.io/): #cluster-api @@ -37,7 +37,7 @@ are also sponsored by SIG-cluster-lifecycle: * AWS, https://github.com/kubernetes-sigs/cluster-api-provider-aws * AWS/Openshift, https://github.com/openshift/cluster-operator - * Azure, https://github.com/platform9/azure-provider + * Azure, https://github.com/kubernetes-sigs/cluster-api-provider-azure * Baidu Cloud, https://github.com/baidu/cluster-api-provider-baiducloud * DigitalOcean, https://github.com/kubernetes-sigs/cluster-api-provider-digitalocean * GCE, https://github.com/kubernetes-sigs/cluster-api-provider-gcp @@ -58,8 +58,10 @@ Following are the implementations managed by third-parties adopting the standard * `kubectl` is required, see [here](http://kubernetes.io/docs/user-guide/prereqs/). * `clusterctl` is a SIG-cluster-lifecycle sponsored tool to manage Cluster API clusters. See [here](cmd/clusterctl) -[cluster-api-kep]: https://github.com/kubernetes/community/blob/master/keps/sig-cluster-lifecycle/0003-cluster-api.md -[notes]: https://docs.google.com/document/d/16ils69KImmE94RlmzjWDrkmFZysgB2J4lGnYMRN89WM/edit +[cluster-api-kep]: https://github.com/kubernetes/enhancements/blob/master/keps/sig-cluster-lifecycle/0003-cluster-api.md +[notes]: https://docs.google.com/document/d/1Ys-DOR5UsgbMEeciuG0HOgDQc8kZsaWIWJeKJ1-UfbY/edit [recordings]: https://www.youtube.com/playlist?list=PL69nYSiGNLP29D0nYgAGWt1ZFqS9Z7lw4 -[zoomMeeting]: https://zoom.us/j/166836624 +[zoomMeeting]: https://zoom.us/j/861487554 [implementerNotes]: https://docs.google.com/document/d/1IZ2-AZhe4r3CYiJuttyciS7bGZTTx4iMppcA8_Pr3xE/edit +[providerZoomMeetingTues]: https://zoom.us/j/140808484 +[providerZoomMeetingWed]: https://zoom.us/j/424743530 diff --git a/vendor/sigs.k8s.io/cluster-api/SECURITY_CONTACTS b/vendor/github.com/openshift/cluster-api/SECURITY_CONTACTS similarity index 100% rename from vendor/sigs.k8s.io/cluster-api/SECURITY_CONTACTS rename to vendor/github.com/openshift/cluster-api/SECURITY_CONTACTS diff --git a/vendor/sigs.k8s.io/cluster-api/WORKSPACE b/vendor/github.com/openshift/cluster-api/WORKSPACE similarity index 85% rename from vendor/sigs.k8s.io/cluster-api/WORKSPACE rename to vendor/github.com/openshift/cluster-api/WORKSPACE index 27dbf6850..25a8fa008 100644 --- a/vendor/sigs.k8s.io/cluster-api/WORKSPACE +++ b/vendor/github.com/openshift/cluster-api/WORKSPACE @@ -2,8 +2,8 @@ load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") http_archive( name = "io_bazel_rules_go", - url = "https://github.com/bazelbuild/rules_go/releases/download/0.16.5/rules_go-0.16.5.tar.gz", - sha256 = "7be7dc01f1e0afdba6c8eb2b43d2fa01c743be1b9273ab1eaf6c233df078d705", + url = "https://github.com/bazelbuild/rules_go/releases/download/0.16.6/rules_go-0.16.6.tar.gz", + sha256 = "ade51a315fa17347e5c31201fdc55aa5ffb913377aa315dceb56ee9725e620ee", ) http_archive( @@ -17,7 +17,7 @@ load("@io_bazel_rules_go//go:def.bzl", "go_rules_dependencies", "go_register_too go_rules_dependencies() go_register_toolchains( - go_version = "1.11.4", + go_version = "1.11.5", ) load("@bazel_gazelle//:deps.bzl", "gazelle_dependencies", "go_repository") diff --git a/vendor/sigs.k8s.io/cluster-api/architecture.png b/vendor/github.com/openshift/cluster-api/architecture.png similarity index 100% rename from vendor/sigs.k8s.io/cluster-api/architecture.png rename to vendor/github.com/openshift/cluster-api/architecture.png diff --git a/vendor/sigs.k8s.io/cluster-api/cmd/clusterctl/BUILD.bazel b/vendor/github.com/openshift/cluster-api/cmd/clusterctl/BUILD.bazel similarity index 83% rename from vendor/sigs.k8s.io/cluster-api/cmd/clusterctl/BUILD.bazel rename to vendor/github.com/openshift/cluster-api/cmd/clusterctl/BUILD.bazel index 5344a11d3..c9b97ec55 100644 --- a/vendor/sigs.k8s.io/cluster-api/cmd/clusterctl/BUILD.bazel +++ b/vendor/github.com/openshift/cluster-api/cmd/clusterctl/BUILD.bazel @@ -3,7 +3,7 @@ load("@io_bazel_rules_go//go:def.bzl", "go_binary", "go_library") go_library( name = "go_default_library", srcs = ["main.go"], - importpath = "sigs.k8s.io/cluster-api/cmd/clusterctl", + importpath = "github.com/openshift/cluster-api/cmd/clusterctl", visibility = ["//visibility:private"], deps = ["//cmd/clusterctl/cmd:go_default_library"], ) diff --git a/vendor/sigs.k8s.io/cluster-api/cmd/clusterctl/CONTRIBUTING.md b/vendor/github.com/openshift/cluster-api/cmd/clusterctl/CONTRIBUTING.md similarity index 100% rename from vendor/sigs.k8s.io/cluster-api/cmd/clusterctl/CONTRIBUTING.md rename to vendor/github.com/openshift/cluster-api/cmd/clusterctl/CONTRIBUTING.md diff --git a/vendor/sigs.k8s.io/cluster-api/cmd/clusterctl/README.md b/vendor/github.com/openshift/cluster-api/cmd/clusterctl/README.md similarity index 100% rename from vendor/sigs.k8s.io/cluster-api/cmd/clusterctl/README.md rename to vendor/github.com/openshift/cluster-api/cmd/clusterctl/README.md diff --git a/vendor/sigs.k8s.io/cluster-api/cmd/clusterctl/clientcmd/BUILD.bazel b/vendor/github.com/openshift/cluster-api/cmd/clusterctl/clientcmd/BUILD.bazel similarity index 87% rename from vendor/sigs.k8s.io/cluster-api/cmd/clusterctl/clientcmd/BUILD.bazel rename to vendor/github.com/openshift/cluster-api/cmd/clusterctl/clientcmd/BUILD.bazel index 45af598ff..67d010e4c 100644 --- a/vendor/sigs.k8s.io/cluster-api/cmd/clusterctl/clientcmd/BUILD.bazel +++ b/vendor/github.com/openshift/cluster-api/cmd/clusterctl/clientcmd/BUILD.bazel @@ -3,7 +3,7 @@ load("@io_bazel_rules_go//go:def.bzl", "go_library") go_library( name = "go_default_library", srcs = ["configutil.go"], - importpath = "sigs.k8s.io/cluster-api/cmd/clusterctl/clientcmd", + importpath = "github.com/openshift/cluster-api/cmd/clusterctl/clientcmd", visibility = ["//visibility:public"], deps = [ "//pkg/client/clientset_generated/clientset:go_default_library", diff --git a/vendor/sigs.k8s.io/cluster-api/cmd/clusterctl/clientcmd/configutil.go b/vendor/github.com/openshift/cluster-api/cmd/clusterctl/clientcmd/configutil.go similarity index 98% rename from vendor/sigs.k8s.io/cluster-api/cmd/clusterctl/clientcmd/configutil.go rename to vendor/github.com/openshift/cluster-api/cmd/clusterctl/clientcmd/configutil.go index faef692ed..ecaec43c5 100644 --- a/vendor/sigs.k8s.io/cluster-api/cmd/clusterctl/clientcmd/configutil.go +++ b/vendor/github.com/openshift/cluster-api/cmd/clusterctl/clientcmd/configutil.go @@ -19,11 +19,11 @@ limitations under the License. package clientcmd import ( + "github.com/openshift/cluster-api/pkg/client/clientset_generated/clientset" "k8s.io/client-go/kubernetes" "k8s.io/client-go/rest" "k8s.io/client-go/tools/clientcmd" "k8s.io/client-go/tools/clientcmd/api" - "sigs.k8s.io/cluster-api/pkg/client/clientset_generated/clientset" ) // This is a convenience method to prevent the need of importing both this version of clientcmd and the client-go version diff --git a/vendor/sigs.k8s.io/cluster-api/cmd/clusterctl/clusterdeployer/BUILD.bazel b/vendor/github.com/openshift/cluster-api/cmd/clusterctl/clusterdeployer/BUILD.bazel similarity index 85% rename from vendor/sigs.k8s.io/cluster-api/cmd/clusterctl/clusterdeployer/BUILD.bazel rename to vendor/github.com/openshift/cluster-api/cmd/clusterctl/clusterdeployer/BUILD.bazel index 5686e5600..748a7badd 100644 --- a/vendor/sigs.k8s.io/cluster-api/cmd/clusterctl/clusterdeployer/BUILD.bazel +++ b/vendor/github.com/openshift/cluster-api/cmd/clusterctl/clusterdeployer/BUILD.bazel @@ -6,7 +6,7 @@ go_library( "clusterdeployer.go", "providercomponentsstorefactory.go", ], - importpath = "sigs.k8s.io/cluster-api/cmd/clusterctl/clusterdeployer", + importpath = "github.com/openshift/cluster-api/cmd/clusterctl/clusterdeployer", visibility = ["//visibility:public"], deps = [ "//cmd/clusterctl/clusterdeployer/bootstrap:go_default_library", @@ -15,6 +15,7 @@ go_library( "//cmd/clusterctl/providercomponents:go_default_library", "//pkg/apis/cluster/v1alpha1:go_default_library", "//pkg/util:go_default_library", + "//vendor/github.com/pkg/errors:go_default_library", "//vendor/k8s.io/client-go/kubernetes:go_default_library", "//vendor/k8s.io/klog:go_default_library", ], @@ -27,6 +28,7 @@ go_test( deps = [ "//cmd/clusterctl/clusterdeployer/clusterclient:go_default_library", "//pkg/apis/cluster/v1alpha1:go_default_library", + "//vendor/github.com/pkg/errors:go_default_library", "//vendor/k8s.io/api/core/v1:go_default_library", "//vendor/k8s.io/apimachinery/pkg/apis/meta/v1:go_default_library", "//vendor/k8s.io/client-go/kubernetes:go_default_library", diff --git a/vendor/github.com/openshift/cluster-api/cmd/clusterctl/clusterdeployer/bootstrap/BUILD.bazel b/vendor/github.com/openshift/cluster-api/cmd/clusterctl/clusterdeployer/bootstrap/BUILD.bazel new file mode 100644 index 000000000..15b8e688e --- /dev/null +++ b/vendor/github.com/openshift/cluster-api/cmd/clusterctl/clusterdeployer/bootstrap/BUILD.bazel @@ -0,0 +1,18 @@ +load("@io_bazel_rules_go//go:def.bzl", "go_library") + +go_library( + name = "go_default_library", + srcs = [ + "options.go", + "provisioner.go", + ], + importpath = "github.com/openshift/cluster-api/cmd/clusterctl/clusterdeployer/bootstrap", + visibility = ["//visibility:public"], + deps = [ + "//cmd/clusterctl/clusterdeployer/bootstrap/existing:go_default_library", + "//cmd/clusterctl/clusterdeployer/bootstrap/kind:go_default_library", + "//cmd/clusterctl/clusterdeployer/bootstrap/minikube:go_default_library", + "//vendor/github.com/pkg/errors:go_default_library", + "//vendor/github.com/spf13/pflag:go_default_library", + ], +) diff --git a/vendor/sigs.k8s.io/cluster-api/cmd/clusterctl/clusterdeployer/bootstrap/minikube/BUILD.bazel b/vendor/github.com/openshift/cluster-api/cmd/clusterctl/clusterdeployer/bootstrap/existing/BUILD.bazel similarity index 50% rename from vendor/sigs.k8s.io/cluster-api/cmd/clusterctl/clusterdeployer/bootstrap/minikube/BUILD.bazel rename to vendor/github.com/openshift/cluster-api/cmd/clusterctl/clusterdeployer/bootstrap/existing/BUILD.bazel index 0386d9ff2..dee8081ad 100644 --- a/vendor/sigs.k8s.io/cluster-api/cmd/clusterctl/clusterdeployer/bootstrap/minikube/BUILD.bazel +++ b/vendor/github.com/openshift/cluster-api/cmd/clusterctl/clusterdeployer/bootstrap/existing/BUILD.bazel @@ -2,14 +2,14 @@ load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test") go_library( name = "go_default_library", - srcs = ["minikube.go"], - importpath = "sigs.k8s.io/cluster-api/cmd/clusterctl/clusterdeployer/bootstrap/minikube", + srcs = ["cluster.go"], + importpath = "github.com/openshift/cluster-api/cmd/clusterctl/clusterdeployer/bootstrap/existing", visibility = ["//visibility:public"], - deps = ["//vendor/k8s.io/klog:go_default_library"], + deps = ["//vendor/github.com/pkg/errors:go_default_library"], ) go_test( name = "go_default_test", - srcs = ["minikube_test.go"], + srcs = ["cluster_test.go"], embed = [":go_default_library"], ) diff --git a/vendor/sigs.k8s.io/cluster-api/cmd/clusterctl/clusterdeployer/bootstrap/existing/existingcluster.go b/vendor/github.com/openshift/cluster-api/cmd/clusterctl/clusterdeployer/bootstrap/existing/cluster.go similarity index 76% rename from vendor/sigs.k8s.io/cluster-api/cmd/clusterctl/clusterdeployer/bootstrap/existing/existingcluster.go rename to vendor/github.com/openshift/cluster-api/cmd/clusterctl/clusterdeployer/bootstrap/existing/cluster.go index c5645cecd..5fe326413 100644 --- a/vendor/sigs.k8s.io/cluster-api/cmd/clusterctl/clusterdeployer/bootstrap/existing/existingcluster.go +++ b/vendor/github.com/openshift/cluster-api/cmd/clusterctl/clusterdeployer/bootstrap/existing/cluster.go @@ -17,43 +17,44 @@ limitations under the License. package existing import ( - "fmt" "io/ioutil" "os" + + "github.com/pkg/errors" ) // Represents an existing cluster being used for bootstrapping, should not be able to // actually delete or create, but can point to actual kubeconfig file. -type ExistingCluster struct { +type Cluster struct { kubeconfigPath string kubeconfigFile string } -// NewExistingCluster creates a new existing k8s bootstrap cluster object +// New creates a new existing k8s bootstrap cluster object // We should clean up any lingering resources when clusterctl is complete. // TODO https://github.com/kubernetes-sigs/cluster-api/issues/448 -func NewExistingCluster(kubeconfigPath string) (*ExistingCluster, error) { +func New(kubeconfigPath string) (*Cluster, error) { if _, err := os.Stat(kubeconfigPath); os.IsNotExist(err) { - return nil, fmt.Errorf("file at %s does not exist", kubeconfigPath) + return nil, errors.Errorf("file at %s does not exist", kubeconfigPath) } - return &ExistingCluster{kubeconfigPath: kubeconfigPath}, nil + return &Cluster{kubeconfigPath: kubeconfigPath}, nil } // Create implements clusterdeployer.ClusterProvisioner interface -func (e *ExistingCluster) Create() error { +func (e *Cluster) Create() error { // noop return nil } // Delete implements clusterdeployer.ClusterProvisioner interface -func (e *ExistingCluster) Delete() error { +func (e *Cluster) Delete() error { // noop return nil } // GetKubeconfig implements clusterdeployer.ClusterProvisioner interface -func (e *ExistingCluster) GetKubeconfig() (string, error) { +func (e *Cluster) GetKubeconfig() (string, error) { if e.kubeconfigFile == "" { b, err := ioutil.ReadFile(e.kubeconfigPath) diff --git a/vendor/github.com/openshift/cluster-api/cmd/clusterctl/clusterdeployer/bootstrap/kind/BUILD.bazel b/vendor/github.com/openshift/cluster-api/cmd/clusterctl/clusterdeployer/bootstrap/kind/BUILD.bazel new file mode 100644 index 000000000..fa2be53f4 --- /dev/null +++ b/vendor/github.com/openshift/cluster-api/cmd/clusterctl/clusterdeployer/bootstrap/kind/BUILD.bazel @@ -0,0 +1,19 @@ +load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test") + +go_library( + name = "go_default_library", + srcs = ["kind.go"], + importpath = "github.com/openshift/cluster-api/cmd/clusterctl/clusterdeployer/bootstrap/kind", + visibility = ["//visibility:public"], + deps = [ + "//vendor/github.com/pkg/errors:go_default_library", + "//vendor/k8s.io/klog:go_default_library", + ], +) + +go_test( + name = "go_default_test", + srcs = ["kind_test.go"], + embed = [":go_default_library"], + deps = ["//vendor/github.com/pkg/errors:go_default_library"], +) diff --git a/vendor/github.com/openshift/cluster-api/cmd/clusterctl/clusterdeployer/bootstrap/kind/kind.go b/vendor/github.com/openshift/cluster-api/cmd/clusterctl/clusterdeployer/bootstrap/kind/kind.go new file mode 100644 index 000000000..b256762d0 --- /dev/null +++ b/vendor/github.com/openshift/cluster-api/cmd/clusterctl/clusterdeployer/bootstrap/kind/kind.go @@ -0,0 +1,113 @@ +/* +Copyright 2019 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package kind + +import ( + "fmt" + "io/ioutil" + "os/exec" + "strings" + + "github.com/pkg/errors" + "k8s.io/klog" +) + +const ( + kubeconfigEnvVar = "KUBECONFIG" + kindClusterName = "clusterapi" +) + +type Kind struct { + options []string + // execFunc implemented as function variable for testing hooks + execFunc func(args ...string) (string, error) +} + +func New() *Kind { + return WithOptions([]string{}) +} + +func WithOptions(options []string) *Kind { + return &Kind{ + execFunc: execFunc, + options: append(options, fmt.Sprintf("name=%s", kindClusterName)), + } +} + +var execFunc = func(args ...string) (string, error) { + const executable = "kind" + klog.V(3).Infof("Running: %v %v", executable, args) + cmd := exec.Command(executable, args...) + cmdOut, err := cmd.CombinedOutput() + klog.V(2).Infof("Ran: %v %v Output: %v", executable, args, string(cmdOut)) + if err != nil { + err = errors.Wrapf(err, "error running command '%v %v'", executable, strings.Join(args, " ")) + } + return string(cmdOut), err +} + +func (k *Kind) Create() error { + args := []string{"create", "cluster"} + for _, opt := range k.options { + args = append(args, fmt.Sprintf("--%v", opt)) + } + + _, err := k.exec(args...) + return err +} + +func (k *Kind) Delete() error { + args := []string{"delete", "cluster"} + for _, opt := range k.options { + args = append(args, fmt.Sprintf("--%v", opt)) + } + + _, err := k.exec(args...) + return err +} + +func (k *Kind) GetKubeconfig() (string, error) { + path, err := k.getKubeConfigPath() + if err != nil { + return "", err + } + + b, err := ioutil.ReadFile(path) + if err != nil { + return "", err + } + + return string(b), nil +} + +func (k *Kind) getKubeConfigPath() (string, error) { + args := []string{"get", "kubeconfig-path"} + for _, opt := range k.options { + args = append(args, fmt.Sprintf("--%v", opt)) + } + + out, err := k.exec(args...) + if err != nil { + return "", err + } + + return strings.TrimSpace(out), nil +} + +func (k *Kind) exec(args ...string) (string, error) { + return k.execFunc(args...) +} diff --git a/vendor/github.com/openshift/cluster-api/cmd/clusterctl/clusterdeployer/bootstrap/minikube/BUILD.bazel b/vendor/github.com/openshift/cluster-api/cmd/clusterctl/clusterdeployer/bootstrap/minikube/BUILD.bazel new file mode 100644 index 000000000..4303d4a52 --- /dev/null +++ b/vendor/github.com/openshift/cluster-api/cmd/clusterctl/clusterdeployer/bootstrap/minikube/BUILD.bazel @@ -0,0 +1,19 @@ +load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test") + +go_library( + name = "go_default_library", + srcs = ["minikube.go"], + importpath = "github.com/openshift/cluster-api/cmd/clusterctl/clusterdeployer/bootstrap/minikube", + visibility = ["//visibility:public"], + deps = [ + "//vendor/github.com/pkg/errors:go_default_library", + "//vendor/k8s.io/klog:go_default_library", + ], +) + +go_test( + name = "go_default_test", + srcs = ["minikube_test.go"], + embed = [":go_default_library"], + deps = ["//vendor/github.com/pkg/errors:go_default_library"], +) diff --git a/vendor/sigs.k8s.io/cluster-api/cmd/clusterctl/clusterdeployer/bootstrap/minikube/minikube.go b/vendor/github.com/openshift/cluster-api/cmd/clusterctl/clusterdeployer/bootstrap/minikube/minikube.go similarity index 95% rename from vendor/sigs.k8s.io/cluster-api/cmd/clusterctl/clusterdeployer/bootstrap/minikube/minikube.go rename to vendor/github.com/openshift/cluster-api/cmd/clusterctl/clusterdeployer/bootstrap/minikube/minikube.go index 2c5a73f52..fceb4df31 100644 --- a/vendor/sigs.k8s.io/cluster-api/cmd/clusterctl/clusterdeployer/bootstrap/minikube/minikube.go +++ b/vendor/github.com/openshift/cluster-api/cmd/clusterctl/clusterdeployer/bootstrap/minikube/minikube.go @@ -23,6 +23,7 @@ import ( "os/exec" "strings" + "github.com/pkg/errors" "k8s.io/klog" ) @@ -61,7 +62,7 @@ var minikubeExec = func(env []string, args ...string) (string, error) { cmdOut, err := cmd.CombinedOutput() klog.V(2).Infof("Ran: %v %v Output: %v", executable, args, string(cmdOut)) if err != nil { - err = fmt.Errorf("error running command '%v %v': %v", executable, strings.Join(args, " "), err) + err = errors.Wrapf(err, "error running command '%v %v'", executable, strings.Join(args, " ")) } return string(cmdOut), err } diff --git a/vendor/github.com/openshift/cluster-api/cmd/clusterctl/clusterdeployer/bootstrap/options.go b/vendor/github.com/openshift/cluster-api/cmd/clusterctl/clusterdeployer/bootstrap/options.go new file mode 100644 index 000000000..c1444411d --- /dev/null +++ b/vendor/github.com/openshift/cluster-api/cmd/clusterctl/clusterdeployer/bootstrap/options.go @@ -0,0 +1,33 @@ +/* +Copyright 2019 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package bootstrap + +import "github.com/spf13/pflag" + +type Options struct { + Type string + Cleanup bool + ExtraFlags []string + KubeConfig string +} + +func (o *Options) AddFlags(fs *pflag.FlagSet) { + fs.StringVarP(&o.Type, "bootstrap-type", "", "none", "The cluster bootstrapper to use.") + fs.BoolVarP(&o.Cleanup, "bootstrap-cluster-cleanup", "", true, "Whether to cleanup the bootstrap cluster after bootstrap.") + fs.StringVarP(&o.KubeConfig, "bootstrap-cluster-kubeconfig", "e", "", "Sets the bootstrap cluster to be an existing Kubernetes cluster.") + fs.StringSliceVarP(&o.ExtraFlags, "bootstrap-flags", "", []string{}, "Command line flags to be passed to the chosen bootstrapper") +} diff --git a/vendor/github.com/openshift/cluster-api/cmd/clusterctl/clusterdeployer/bootstrap/provisioner.go b/vendor/github.com/openshift/cluster-api/cmd/clusterctl/clusterdeployer/bootstrap/provisioner.go new file mode 100644 index 000000000..183e550b8 --- /dev/null +++ b/vendor/github.com/openshift/cluster-api/cmd/clusterctl/clusterdeployer/bootstrap/provisioner.go @@ -0,0 +1,46 @@ +/* +Copyright 2018 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package bootstrap + +import ( + "github.com/openshift/cluster-api/cmd/clusterctl/clusterdeployer/bootstrap/existing" + "github.com/openshift/cluster-api/cmd/clusterctl/clusterdeployer/bootstrap/kind" + "github.com/openshift/cluster-api/cmd/clusterctl/clusterdeployer/bootstrap/minikube" + "github.com/pkg/errors" +) + +// Can provision a kubernetes cluster +type ClusterProvisioner interface { + Create() error + Delete() error + GetKubeconfig() (string, error) +} + +func Get(o Options) (ClusterProvisioner, error) { + switch o.Type { + case "kind": + return kind.WithOptions(o.ExtraFlags), nil + case "minikube": + return minikube.WithOptions(o.ExtraFlags), nil + default: + if o.KubeConfig != "" { + return existing.New(o.KubeConfig) + } + + return nil, errors.New("no bootstrap provisioner specified, you can specify `--bootstrap-cluster-kubeconfig` to use an existing Kubernetes cluster or `--bootstrap-type` to use a built-in ephemeral cluster.") + } +} diff --git a/vendor/sigs.k8s.io/cluster-api/cmd/clusterctl/clusterdeployer/clusterclient/BUILD.bazel b/vendor/github.com/openshift/cluster-api/cmd/clusterctl/clusterdeployer/clusterclient/BUILD.bazel similarity index 86% rename from vendor/sigs.k8s.io/cluster-api/cmd/clusterctl/clusterdeployer/clusterclient/BUILD.bazel rename to vendor/github.com/openshift/cluster-api/cmd/clusterctl/clusterdeployer/clusterclient/BUILD.bazel index 6a60489cc..e58d7c354 100644 --- a/vendor/sigs.k8s.io/cluster-api/cmd/clusterctl/clusterdeployer/clusterclient/BUILD.bazel +++ b/vendor/github.com/openshift/cluster-api/cmd/clusterctl/clusterdeployer/clusterclient/BUILD.bazel @@ -6,13 +6,14 @@ go_library( "clientfactory.go", "clusterclient.go", ], - importpath = "sigs.k8s.io/cluster-api/cmd/clusterctl/clusterdeployer/clusterclient", + importpath = "github.com/openshift/cluster-api/cmd/clusterctl/clusterdeployer/clusterclient", visibility = ["//visibility:public"], deps = [ "//cmd/clusterctl/clientcmd:go_default_library", "//pkg/apis/cluster/v1alpha1:go_default_library", "//pkg/client/clientset_generated/clientset:go_default_library", "//pkg/util:go_default_library", + "//vendor/github.com/pkg/errors:go_default_library", "//vendor/k8s.io/api/core/v1:go_default_library", "//vendor/k8s.io/apimachinery/pkg/api/errors:go_default_library", "//vendor/k8s.io/apimachinery/pkg/apis/meta/v1:go_default_library", diff --git a/vendor/sigs.k8s.io/cluster-api/cmd/clusterctl/clusterdeployer/clusterclient/clientfactory.go b/vendor/github.com/openshift/cluster-api/cmd/clusterctl/clusterdeployer/clusterclient/clientfactory.go similarity index 95% rename from vendor/sigs.k8s.io/cluster-api/cmd/clusterctl/clusterdeployer/clusterclient/clientfactory.go rename to vendor/github.com/openshift/cluster-api/cmd/clusterctl/clusterdeployer/clusterclient/clientfactory.go index 2cda63d10..b1e4e16d0 100644 --- a/vendor/sigs.k8s.io/cluster-api/cmd/clusterctl/clusterdeployer/clusterclient/clientfactory.go +++ b/vendor/github.com/openshift/cluster-api/cmd/clusterctl/clusterdeployer/clusterclient/clientfactory.go @@ -17,8 +17,8 @@ limitations under the License. package clusterclient import ( + "github.com/openshift/cluster-api/cmd/clusterctl/clientcmd" "k8s.io/client-go/kubernetes" - "sigs.k8s.io/cluster-api/cmd/clusterctl/clientcmd" ) // Factory can create cluster clients diff --git a/vendor/sigs.k8s.io/cluster-api/cmd/clusterctl/clusterdeployer/clusterclient/clusterclient.go b/vendor/github.com/openshift/cluster-api/cmd/clusterctl/clusterdeployer/clusterclient/clusterclient.go similarity index 89% rename from vendor/sigs.k8s.io/cluster-api/cmd/clusterctl/clusterdeployer/clusterclient/clusterclient.go rename to vendor/github.com/openshift/cluster-api/cmd/clusterctl/clusterdeployer/clusterclient/clusterclient.go index bac826825..b270a9051 100644 --- a/vendor/sigs.k8s.io/cluster-api/cmd/clusterctl/clusterdeployer/clusterclient/clusterclient.go +++ b/vendor/github.com/openshift/cluster-api/cmd/clusterctl/clusterdeployer/clusterclient/clusterclient.go @@ -17,7 +17,6 @@ limitations under the License. package clusterclient import ( - "fmt" "io/ioutil" "os" "os/exec" @@ -25,15 +24,15 @@ import ( "sync" "time" + "github.com/openshift/cluster-api/cmd/clusterctl/clientcmd" + clusterv1 "github.com/openshift/cluster-api/pkg/apis/cluster/v1alpha1" + "github.com/openshift/cluster-api/pkg/client/clientset_generated/clientset" + "github.com/openshift/cluster-api/pkg/util" + "github.com/pkg/errors" apiv1 "k8s.io/api/core/v1" apierrors "k8s.io/apimachinery/pkg/api/errors" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" tcmd "k8s.io/client-go/tools/clientcmd" - "sigs.k8s.io/cluster-api/cmd/clusterctl/clientcmd" - clusterv1 "sigs.k8s.io/cluster-api/pkg/apis/cluster/v1alpha1" - "sigs.k8s.io/cluster-api/pkg/client/clientset_generated/clientset" - "sigs.k8s.io/cluster-api/pkg/util" - "k8s.io/klog" ) @@ -110,7 +109,7 @@ func (c *client) removeKubeconfigFile() error { func (c *client) EnsureNamespace(namespaceName string) error { clientset, err := clientcmd.NewCoreClientSetForDefaultSearchPath(c.kubeconfigFile, clientcmd.NewConfigOverrides()) if err != nil { - return fmt.Errorf("error creating core clientset: %v", err) + return errors.Wrap(err, "error creating core clientset") } namespace := apiv1.Namespace{ @@ -131,7 +130,7 @@ func (c *client) DeleteNamespace(namespaceName string) error { } clientset, err := clientcmd.NewCoreClientSetForDefaultSearchPath(c.kubeconfigFile, clientcmd.NewConfigOverrides()) if err != nil { - return fmt.Errorf("error creating core clientset: %v", err) + return errors.Wrap(err, "error creating core clientset") } err = clientset.CoreV1().Namespaces().Delete(namespaceName, &metav1.DeleteOptions{}) @@ -198,7 +197,7 @@ func (c *client) GetClusterObjectsInNamespace(namespace string) ([]*clusterv1.Cl clusters := []*clusterv1.Cluster{} clusterlist, err := c.clientSet.ClusterV1alpha1().Clusters(namespace).List(metav1.ListOptions{}) if err != nil { - return nil, fmt.Errorf("error listing cluster objects in namespace %q: %v", namespace, err) + return nil, errors.Wrapf(err, "error listing cluster objects in namespace %q", namespace) } for i := 0; i < len(clusterlist.Items); i++ { @@ -210,7 +209,7 @@ func (c *client) GetClusterObjectsInNamespace(namespace string) ([]*clusterv1.Cl func (c *client) GetMachineDeploymentObjectsInNamespace(namespace string) ([]*clusterv1.MachineDeployment, error) { machineDeploymentList, err := c.clientSet.ClusterV1alpha1().MachineDeployments(namespace).List(metav1.ListOptions{}) if err != nil { - return nil, fmt.Errorf("error listing machine deployment objects in namespace %q: %v", namespace, err) + return nil, errors.Wrapf(err, "error listing machine deployment objects in namespace %q", namespace) } var machineDeployments []*clusterv1.MachineDeployment for i := 0; i < len(machineDeploymentList.Items); i++ { @@ -228,7 +227,7 @@ func (c *client) GetMachineDeploymentObjects() ([]*clusterv1.MachineDeployment, func (c *client) GetMachineSetObjectsInNamespace(namespace string) ([]*clusterv1.MachineSet, error) { machineSetList, err := c.clientSet.ClusterV1alpha1().MachineSets(namespace).List(metav1.ListOptions{}) if err != nil { - return nil, fmt.Errorf("error listing machine set objects in namespace %q: %v", namespace, err) + return nil, errors.Wrapf(err, "error listing machine set objects in namespace %q", namespace) } var machineSets []*clusterv1.MachineSet for i := 0; i < len(machineSetList.Items); i++ { @@ -247,7 +246,7 @@ func (c *client) GetMachineObjectsInNamespace(namespace string) ([]*clusterv1.Ma machines := []*clusterv1.Machine{} machineslist, err := c.clientSet.ClusterV1alpha1().Machines(namespace).List(metav1.ListOptions{}) if err != nil { - return nil, fmt.Errorf("error listing machine objects in namespace %q: %v", namespace, err) + return nil, errors.Wrapf(err, "error listing machine objects in namespace %q", namespace) } for i := 0; i < len(machineslist.Items); i++ { @@ -270,7 +269,7 @@ func (c *client) CreateClusterObject(cluster *clusterv1.Cluster) error { _, err := c.clientSet.ClusterV1alpha1().Clusters(namespace).Create(cluster) if err != nil { - return fmt.Errorf("error creating cluster in namespace %v: %v", namespace, err) + return errors.Wrapf(err, "error creating cluster in namespace %v", namespace) } return err } @@ -280,7 +279,7 @@ func (c *client) CreateMachineDeploymentObjects(deployments []*clusterv1.Machine // TODO: Run in parallel https://github.com/kubernetes-sigs/cluster-api/issues/258 _, err := c.clientSet.ClusterV1alpha1().MachineDeployments(namespace).Create(deploy) if err != nil { - return fmt.Errorf("error creating a machine deployment object in namespace %q: %v", namespace, err) + return errors.Wrapf(err, "error creating a machine deployment object in namespace %q", namespace) } } return nil @@ -291,7 +290,7 @@ func (c *client) CreateMachineSetObjects(machineSets []*clusterv1.MachineSet, na // TODO: Run in parallel https://github.com/kubernetes-sigs/cluster-api/issues/258 _, err := c.clientSet.ClusterV1alpha1().MachineSets(namespace).Create(ms) if err != nil { - return fmt.Errorf("error creating a machine set object in namespace %q: %v", namespace, err) + return errors.Wrapf(err, "error creating a machine set object in namespace %q", namespace) } } return nil @@ -313,7 +312,7 @@ func (c *client) CreateMachineObjects(machines []*clusterv1.Machine, namespace s createdMachine, err := c.clientSet.ClusterV1alpha1().Machines(namespace).Create(machine) if err != nil { errOnce.Do(func() { - gerr = fmt.Errorf("error creating a machine object in namespace %v: %v", namespace, err) + gerr = errors.Wrapf(err, "error creating a machine object in namespace %v", namespace) }) return } @@ -336,11 +335,11 @@ func (c *client) DeleteClusterObjects() error { func (c *client) DeleteClusterObjectsInNamespace(namespace string) error { err := c.clientSet.ClusterV1alpha1().Clusters(namespace).DeleteCollection(newDeleteOptions(), metav1.ListOptions{}) if err != nil { - return fmt.Errorf("error deleting cluster objects in namespace %q: %v", namespace, err) + return errors.Wrapf(err, "error deleting cluster objects in namespace %q", namespace) } err = c.waitForClusterDelete(namespace) if err != nil { - return fmt.Errorf("error waiting for cluster(s) deletion to complete in namespace %q: %v", namespace, err) + return errors.Wrapf(err, "error waiting for cluster(s) deletion to complete in namespace %q", namespace) } return nil } @@ -354,11 +353,11 @@ func (c *client) DeleteMachineDeploymentObjects() error { func (c *client) DeleteMachineDeploymentObjectsInNamespace(namespace string) error { err := c.clientSet.ClusterV1alpha1().MachineDeployments(namespace).DeleteCollection(newDeleteOptions(), metav1.ListOptions{}) if err != nil { - return fmt.Errorf("error deleting machine deployment objects in namespace %q: %v", namespace, err) + return errors.Wrapf(err, "error deleting machine deployment objects in namespace %q", namespace) } err = c.waitForMachineDeploymentsDelete(namespace) if err != nil { - return fmt.Errorf("error waiting for machine deployment(s) deletion to complete in namespace %q: %v", namespace, err) + return errors.Wrapf(err, "error waiting for machine deployment(s) deletion to complete in namespace %q", namespace) } return nil } @@ -372,11 +371,11 @@ func (c *client) DeleteMachineSetObjects() error { func (c *client) DeleteMachineSetObjectsInNamespace(namespace string) error { err := c.clientSet.ClusterV1alpha1().MachineSets(namespace).DeleteCollection(newDeleteOptions(), metav1.ListOptions{}) if err != nil { - return fmt.Errorf("error deleting machine set objects in namespace %q: %v", namespace, err) + return errors.Wrapf(err, "error deleting machine set objects in namespace %q", namespace) } err = c.waitForMachineSetsDelete(namespace) if err != nil { - return fmt.Errorf("error waiting for machine set(s) deletion to complete in namespace %q: %v", namespace, err) + return errors.Wrapf(err, "error waiting for machine set(s) deletion to complete in namespace %q", namespace) } return nil } @@ -390,11 +389,11 @@ func (c *client) DeleteMachineObjects() error { func (c *client) DeleteMachineObjectsInNamespace(namespace string) error { err := c.clientSet.ClusterV1alpha1().Machines(namespace).DeleteCollection(newDeleteOptions(), metav1.ListOptions{}) if err != nil { - return fmt.Errorf("error deleting machine objects in namespace %q: %v", namespace, err) + return errors.Wrapf(err, "error deleting machine objects in namespace %q", namespace) } err = c.waitForMachinesDelete(namespace) if err != nil { - return fmt.Errorf("error waiting for machine(s) deletion to complete in namespace %q: %v", namespace, err) + return errors.Wrapf(err, "error waiting for machine(s) deletion to complete in namespace %q", namespace) } return nil } @@ -407,14 +406,14 @@ func newDeleteOptions() *metav1.DeleteOptions { } // TODO: Test this function -func (c *client) UpdateClusterObjectEndpoint(masterIP, clusterName, namespace string) error { +func (c *client) UpdateClusterObjectEndpoint(controlPlaneIP, clusterName, namespace string) error { cluster, err := c.GetClusterObject(clusterName, namespace) if err != nil { return err } cluster.Status.APIEndpoints = append(cluster.Status.APIEndpoints, clusterv1.APIEndpoint{ - Host: masterIP, + Host: controlPlaneIP, Port: apiServerPort, }) _, err = c.clientSet.ClusterV1alpha1().Clusters(namespace).UpdateStatus(cluster) @@ -494,7 +493,7 @@ func (c *client) kubectlManifestCmd(commandName, manifest string) error { cmd.Stdin = strings.NewReader(manifest) out, err := cmd.CombinedOutput() if err != nil { - return fmt.Errorf("couldn't kubectl apply: %v, output: %s", err, string(out)) + return errors.Wrapf(err, "couldn't kubectl apply, output: %s", string(out)) } return nil } @@ -578,7 +577,7 @@ func waitForMachineReady(cs clientset.Interface, machine *clusterv1.Machine) err } // TODO: update once machine controllers have a way to indicate a machine has been provisoned. https://github.com/kubernetes-sigs/cluster-api/issues/253 - // Seeing a node cannot be purely relied upon because the provisioned master will not be registering with + // Seeing a node cannot be purely relied upon because the provisioned control plane will not be registering with // the stack that provisions it. ready := m.Status.NodeRef != nil || len(m.Annotations) > 0 return ready, nil diff --git a/vendor/sigs.k8s.io/cluster-api/cmd/clusterctl/clusterdeployer/clusterdeployer.go b/vendor/github.com/openshift/cluster-api/cmd/clusterctl/clusterdeployer/clusterdeployer.go similarity index 68% rename from vendor/sigs.k8s.io/cluster-api/cmd/clusterctl/clusterdeployer/clusterdeployer.go rename to vendor/github.com/openshift/cluster-api/cmd/clusterctl/clusterdeployer/clusterdeployer.go index b1c444f83..332215dc7 100644 --- a/vendor/sigs.k8s.io/cluster-api/cmd/clusterctl/clusterdeployer/clusterdeployer.go +++ b/vendor/github.com/openshift/cluster-api/cmd/clusterctl/clusterdeployer/clusterdeployer.go @@ -17,19 +17,19 @@ limitations under the License. package clusterdeployer import ( - "fmt" "io/ioutil" "os" "strings" "time" + "github.com/openshift/cluster-api/cmd/clusterctl/clusterdeployer/bootstrap" + "github.com/openshift/cluster-api/cmd/clusterctl/clusterdeployer/clusterclient" + "github.com/openshift/cluster-api/cmd/clusterctl/phases" + clusterv1 "github.com/openshift/cluster-api/pkg/apis/cluster/v1alpha1" + "github.com/openshift/cluster-api/pkg/util" + "github.com/pkg/errors" "k8s.io/client-go/kubernetes" "k8s.io/klog" - "sigs.k8s.io/cluster-api/cmd/clusterctl/clusterdeployer/bootstrap" - "sigs.k8s.io/cluster-api/cmd/clusterctl/clusterdeployer/clusterclient" - "sigs.k8s.io/cluster-api/cmd/clusterctl/phases" - clusterv1 "sigs.k8s.io/cluster-api/pkg/apis/cluster/v1alpha1" - "sigs.k8s.io/cluster-api/pkg/util" ) // Deprecated interface for Provider specific logic. Please do not extend or add. This interface should be removed @@ -38,7 +38,7 @@ type ProviderDeployer interface { // TODO: This requirement can be removed once after: https://github.com/kubernetes-sigs/cluster-api/issues/158 GetIP(cluster *clusterv1.Cluster, machine *clusterv1.Machine) (string, error) // TODO: This requirement can be removed after: https://github.com/kubernetes-sigs/cluster-api/issues/160 - GetKubeConfig(cluster *clusterv1.Cluster, master *clusterv1.Machine) (string, error) + GetKubeConfig(cluster *clusterv1.Cluster, controlPlaneMachine *clusterv1.Machine) (string, error) } type ProviderComponentsStore interface { @@ -80,81 +80,81 @@ const ( // Create the cluster from the provided cluster definition and machine list. func (d *ClusterDeployer) Create(cluster *clusterv1.Cluster, machines []*clusterv1.Machine, provider ProviderDeployer, kubeconfigOutput string, providerComponentsStoreFactory ProviderComponentsStoreFactory) error { - master, nodes, err := extractMasterMachine(machines) + controlPlaneMachine, nodes, err := extractControlPlaneMachine(machines) if err != nil { - return fmt.Errorf("unable to separate master machines from node machines: %v", err) + return errors.Wrap(err, "unable to separate control plane machines from node machines") } bootstrapClient, cleanupBootstrapCluster, err := phases.CreateBootstrapCluster(d.bootstrapProvisioner, d.cleanupBootstrapCluster, d.clientFactory) defer cleanupBootstrapCluster() if err != nil { - return fmt.Errorf("could not create bootstrap cluster: %v", err) + return errors.Wrap(err, "could not create bootstrap cluster") } defer closeClient(bootstrapClient, "bootstrap") klog.Info("Applying Cluster API stack to bootstrap cluster") if err := phases.ApplyClusterAPIComponents(bootstrapClient, d.providerComponents); err != nil { - return fmt.Errorf("unable to apply cluster api stack to bootstrap cluster: %v", err) + return errors.Wrap(err, "unable to apply cluster api stack to bootstrap cluster") } klog.Info("Provisioning target cluster via bootstrap cluster") if err := phases.ApplyCluster(bootstrapClient, cluster); err != nil { - return fmt.Errorf("unable to create cluster %q in bootstrap cluster: %v", cluster.Name, err) + return errors.Wrapf(err, "unable to create cluster %q in bootstrap cluster", cluster.Name) } if cluster.Namespace == "" { cluster.Namespace = bootstrapClient.GetContextNamespace() } - klog.Infof("Creating master %v in namespace %q", master.Name, cluster.Namespace) - if err := phases.ApplyMachines(bootstrapClient, cluster.Namespace, []*clusterv1.Machine{master}); err != nil { - return fmt.Errorf("unable to create master machine: %v", err) + klog.Infof("Creating control plane %v in namespace %q", controlPlaneMachine.Name, cluster.Namespace) + if err := phases.ApplyMachines(bootstrapClient, cluster.Namespace, []*clusterv1.Machine{controlPlaneMachine}); err != nil { + return errors.Wrap(err, "unable to create control plane machine") } - klog.Infof("Updating bootstrap cluster object for cluster %v in namespace %q with master (%s) endpoint", cluster.Name, cluster.Namespace, master.Name) + klog.Infof("Updating bootstrap cluster object for cluster %v in namespace %q with control plane endpoint running on %s", cluster.Name, cluster.Namespace, controlPlaneMachine.Name) if err := d.updateClusterEndpoint(bootstrapClient, provider, cluster.Name, cluster.Namespace); err != nil { - return fmt.Errorf("unable to update bootstrap cluster endpoint: %v", err) + return errors.Wrap(err, "unable to update bootstrap cluster endpoint") } klog.Info("Creating target cluster") targetClient, err := d.createTargetClusterClient(bootstrapClient, provider, kubeconfigOutput, cluster.Name, cluster.Namespace) if err != nil { - return fmt.Errorf("unable to create target cluster: %v", err) + return errors.Wrap(err, "unable to create target cluster") } defer closeClient(targetClient, "target") if d.addonComponents != "" { if err := phases.ApplyAddons(targetClient, d.addonComponents); err != nil { - return fmt.Errorf("unable to apply addons to target cluster: %v", err) + return errors.Wrap(err, "unable to apply addons to target cluster") } } klog.Info("Applying Cluster API stack to target cluster") if err := d.applyClusterAPIComponentsWithPivoting(targetClient, bootstrapClient, cluster.Namespace); err != nil { - return fmt.Errorf("unable to apply cluster api stack to target cluster: %v", err) + return errors.Wrap(err, "unable to apply cluster api stack to target cluster") } klog.Info("Saving provider components to the target cluster") err = d.saveProviderComponentsToCluster(providerComponentsStoreFactory, kubeconfigOutput) if err != nil { - return fmt.Errorf("unable to save provider components to target cluster: %v", err) + return errors.Wrap(err, "unable to save provider components to target cluster") } err = targetClient.EnsureNamespace(cluster.Namespace) if err != nil { - return fmt.Errorf("unable to ensure namespace %q in targetCluster: %v", cluster.Namespace, err) + return errors.Wrapf(err, "unable to ensure namespace %q in targetCluster", cluster.Namespace) } // For some reason, endpoint doesn't get updated in bootstrap cluster sometimes. So we // update the target cluster endpoint as well to be sure. - klog.Infof("Updating target cluster object with master (%s) endpoint", master.Name) + klog.Infof("Updating target cluster object with control plane endpoint running on %s", controlPlaneMachine.Name) if err := d.updateClusterEndpoint(targetClient, provider, cluster.Name, cluster.Namespace); err != nil { - return fmt.Errorf("unable to update target cluster endpoint: %v", err) + return errors.Wrap(err, "unable to update target cluster endpoint") } klog.Info("Creating node machines in target cluster.") if err := phases.ApplyMachines(targetClient, cluster.Namespace, nodes); err != nil { - return fmt.Errorf("unable to create node machines: %v", err) + return errors.Wrap(err, "unable to create node machines") } klog.Infof("Done provisioning cluster. You can now access your cluster with kubectl --kubeconfig %v", kubeconfigOutput) @@ -167,13 +167,13 @@ func (d *ClusterDeployer) Delete(targetClient clusterclient.Client, namespace st bootstrapClient, cleanupBootstrapCluster, err := phases.CreateBootstrapCluster(d.bootstrapProvisioner, d.cleanupBootstrapCluster, d.clientFactory) defer cleanupBootstrapCluster() if err != nil { - return fmt.Errorf("could not create bootstrap cluster: %v", err) + return errors.Wrap(err, "could not create bootstrap cluster") } defer closeClient(bootstrapClient, "bootstrap") klog.Info("Applying Cluster API stack to bootstrap cluster") if err := phases.ApplyClusterAPIComponents(bootstrapClient, d.providerComponents); err != nil { - return fmt.Errorf("unable to apply cluster api stack to bootstrap cluster: %v", err) + return errors.Wrap(err, "unable to apply cluster api stack to bootstrap cluster") } klog.Info("Deleting Cluster API Provider Components from target cluster") @@ -184,12 +184,12 @@ func (d *ClusterDeployer) Delete(targetClient clusterclient.Client, namespace st klog.Info("Copying objects from target cluster to bootstrap cluster") if err = pivotNamespace(targetClient, bootstrapClient, namespace); err != nil { - return fmt.Errorf("unable to copy objects from target to bootstrap cluster: %v", err) + return errors.Wrap(err, "unable to copy objects from target to bootstrap cluster") } klog.Info("Deleting objects from bootstrap cluster") if err = deleteObjectsInNamespace(bootstrapClient, namespace); err != nil { - return fmt.Errorf("unable to finish deleting objects in bootstrap cluster, resources may have been leaked: %v", err) + return errors.Wrap(err, "unable to finish deleting objects in bootstrap cluster, resources may have been leaked") } klog.Info("Deletion of cluster complete") @@ -198,15 +198,15 @@ func (d *ClusterDeployer) Delete(targetClient clusterclient.Client, namespace st } func (d *ClusterDeployer) createTargetClusterClient(bootstrapClient clusterclient.Client, provider ProviderDeployer, kubeconfigOutput string, clusterName, namespace string) (clusterclient.Client, error) { - cluster, master, _, err := getClusterAPIObject(bootstrapClient, clusterName, namespace) + cluster, controlPlane, _, err := getClusterAPIObject(bootstrapClient, clusterName, namespace) if err != nil { return nil, err } klog.V(1).Info("Getting target cluster kubeconfig.") - targetKubeconfig, err := waitForKubeconfigReady(provider, cluster, master) + targetKubeconfig, err := waitForKubeconfigReady(provider, cluster, controlPlane) if err != nil { - return nil, fmt.Errorf("unable to get target cluster kubeconfig: %v", err) + return nil, errors.Wrap(err, "unable to get target cluster kubeconfig") } if err = d.writeKubeconfig(targetKubeconfig, kubeconfigOutput); err != nil { @@ -215,7 +215,7 @@ func (d *ClusterDeployer) createTargetClusterClient(bootstrapClient clusterclien targetClient, err := d.clientFactory.NewClientFromKubeconfig(targetKubeconfig) if err != nil { - return nil, fmt.Errorf("unable to create target cluster client: %v", err) + return nil, errors.Wrap(err, "unable to create target cluster client") } return targetClient, nil @@ -225,17 +225,17 @@ func (d *ClusterDeployer) updateClusterEndpoint(client clusterclient.Client, pro // Update cluster endpoint. Needed till this logic moves into cluster controller. // TODO: https://github.com/kubernetes-sigs/cluster-api/issues/158 // Fetch fresh objects. - cluster, master, _, err := getClusterAPIObject(client, clusterName, namespace) + cluster, controlPlane, _, err := getClusterAPIObject(client, clusterName, namespace) if err != nil { return err } - masterIP, err := provider.GetIP(cluster, master) + clusterEndpoint, err := provider.GetIP(cluster, controlPlane) if err != nil { - return fmt.Errorf("unable to get master IP: %v", err) + return errors.Wrap(err, "unable to get cluster endpoint") } - err = client.UpdateClusterObjectEndpoint(masterIP, clusterName, namespace) + err = client.UpdateClusterObjectEndpoint(clusterEndpoint, clusterName, namespace) if err != nil { - return fmt.Errorf("unable to update cluster endpoint: %v", err) + return errors.Wrap(err, "unable to update cluster endpoint") } return nil } @@ -243,15 +243,15 @@ func (d *ClusterDeployer) updateClusterEndpoint(client clusterclient.Client, pro func (d *ClusterDeployer) saveProviderComponentsToCluster(factory ProviderComponentsStoreFactory, kubeconfigPath string) error { clientset, err := d.clientFactory.NewCoreClientsetFromKubeconfigFile(kubeconfigPath) if err != nil { - return fmt.Errorf("error creating core clientset: %v", err) + return errors.Wrap(err, "error creating core clientset") } pcStore, err := factory.NewFromCoreClientset(clientset) if err != nil { - return fmt.Errorf("unable to create provider components store: %v", err) + return errors.Wrap(err, "unable to create provider components store") } err = pcStore.Save(d.providerComponents) if err != nil { - return fmt.Errorf("error saving provider components: %v", err) + return errors.Wrap(err, "error saving provider components") } return nil } @@ -259,13 +259,13 @@ func (d *ClusterDeployer) saveProviderComponentsToCluster(factory ProviderCompon func (d *ClusterDeployer) applyClusterAPIComponentsWithPivoting(client, source clusterclient.Client, namespace string) error { klog.Info("Applying Cluster API Provider Components") if err := client.Apply(d.providerComponents); err != nil { - return fmt.Errorf("unable to apply cluster api controllers: %v", err) + return errors.Wrap(err, "unable to apply cluster api controllers") } klog.Info("Pivoting Cluster API objects from bootstrap to target cluster.") err := pivotNamespace(source, client, namespace) if err != nil { - return fmt.Errorf("unable to pivot cluster API objects: %v", err) + return errors.Wrap(err, "unable to pivot cluster API objects") } return nil @@ -298,11 +298,11 @@ func waitForKubeconfigReady(provider ProviderDeployer, cluster *clusterv1.Cluste func pivotNamespace(from, to clusterclient.Client, namespace string) error { if err := from.WaitForClusterV1alpha1Ready(); err != nil { - return fmt.Errorf("cluster v1alpha1 resource not ready on source cluster") + return errors.New("cluster v1alpha1 resource not ready on source cluster") } if err := to.WaitForClusterV1alpha1Ready(); err != nil { - return fmt.Errorf("cluster v1alpha1 resource not ready on target cluster") + return errors.New("cluster v1alpha1 resource not ready on target cluster") } clusters, err := from.GetClusterObjectsInNamespace(namespace) @@ -314,7 +314,7 @@ func pivotNamespace(from, to clusterclient.Client, namespace string) error { // New objects cannot have a specified resource version. Clear it out. cluster.SetResourceVersion("") if err = to.CreateClusterObject(cluster); err != nil { - return fmt.Errorf("error moving Cluster '%v': %v", cluster.GetName(), err) + return errors.Wrapf(err, "error moving Cluster %q", cluster.GetName()) } klog.Infof("Moved Cluster '%s'", cluster.GetName()) } @@ -327,7 +327,7 @@ func pivotNamespace(from, to clusterclient.Client, namespace string) error { // New objects cannot have a specified resource version. Clear it out. deployment.SetResourceVersion("") if err = to.CreateMachineDeploymentObjects([]*clusterv1.MachineDeployment{deployment}, namespace); err != nil { - return fmt.Errorf("error moving MachineDeployment '%v': %v", deployment.GetName(), err) + return errors.Wrapf(err, "error moving MachineDeployment %q", deployment.GetName()) } klog.Infof("Moved MachineDeployment %v", deployment.GetName()) } @@ -340,7 +340,7 @@ func pivotNamespace(from, to clusterclient.Client, namespace string) error { // New objects cannot have a specified resource version. Clear it out. machineSet.SetResourceVersion("") if err := to.CreateMachineSetObjects([]*clusterv1.MachineSet{machineSet}, namespace); err != nil { - return fmt.Errorf("error moving MachineSet '%v': %v", machineSet.GetName(), err) + return errors.Wrapf(err, "error moving MachineSet %q", machineSet.GetName()) } klog.Infof("Moved MachineSet %v", machineSet.GetName()) } @@ -354,7 +354,7 @@ func pivotNamespace(from, to clusterclient.Client, namespace string) error { // New objects cannot have a specified resource version. Clear it out. machine.SetResourceVersion("") if err = to.CreateMachineObjects([]*clusterv1.Machine{machine}, namespace); err != nil { - return fmt.Errorf("error moving Machine '%v': %v", machine.GetName(), err) + return errors.Wrapf(err, "error moving Machine %q", machine.GetName()) } klog.Infof("Moved Machine '%s'", machine.GetName()) } @@ -362,34 +362,34 @@ func pivotNamespace(from, to clusterclient.Client, namespace string) error { } func deleteObjectsInNamespace(client clusterclient.Client, namespace string) error { - var errors []string + var errorList []string klog.Infof("Deleting machine deployments in namespace %q", namespace) if err := client.DeleteMachineDeploymentObjectsInNamespace(namespace); err != nil { - err = fmt.Errorf("error deleting machine deployments: %v", err) - errors = append(errors, err.Error()) + err = errors.Wrap(err, "error deleting machine deployments") + errorList = append(errorList, err.Error()) } klog.Infof("Deleting machine sets in namespace %q", namespace) if err := client.DeleteMachineSetObjectsInNamespace(namespace); err != nil { - err = fmt.Errorf("error deleting machine sets: %v", err) - errors = append(errors, err.Error()) + err = errors.Wrap(err, "error deleting machine sets") + errorList = append(errorList, err.Error()) } klog.Infof("Deleting machines in namespace %q", namespace) if err := client.DeleteMachineObjectsInNamespace(namespace); err != nil { - err = fmt.Errorf("error deleting machines: %v", err) - errors = append(errors, err.Error()) + err = errors.Wrap(err, "error deleting machines") + errorList = append(errorList, err.Error()) } klog.Infof("Deleting clusters in namespace %q", namespace) if err := client.DeleteClusterObjectsInNamespace(namespace); err != nil { - err = fmt.Errorf("error deleting clusters: %v", err) - errors = append(errors, err.Error()) + err = errors.Wrap(err, "error deleting clusters") + errorList = append(errorList, err.Error()) } klog.Infof("Deleting namespace %q", namespace) if err := client.DeleteNamespace(namespace); err != nil { - err = fmt.Errorf("error deleting namespace: %v", err) - errors = append(errors, err.Error()) + err = errors.Wrap(err, "error deleting namespace") + errorList = append(errorList, err.Error()) } - if len(errors) > 0 { - return fmt.Errorf("error(s) encountered deleting objects from bootstrap cluster: [%v]", strings.Join(errors, ", ")) + if len(errorList) > 0 { + return errors.Errorf("error(s) encountered deleting objects from bootstrap cluster: [%v]", strings.Join(errorList, ", ")) } return nil } @@ -397,37 +397,37 @@ func deleteObjectsInNamespace(client clusterclient.Client, namespace string) err func getClusterAPIObject(client clusterclient.Client, clusterName, namespace string) (*clusterv1.Cluster, *clusterv1.Machine, []*clusterv1.Machine, error) { machines, err := client.GetMachineObjectsInNamespace(namespace) if err != nil { - return nil, nil, nil, fmt.Errorf("unable to fetch machines: %v", err) + return nil, nil, nil, errors.Wrap(err, "unable to fetch machines") } cluster, err := client.GetClusterObject(clusterName, namespace) if err != nil { - return nil, nil, nil, fmt.Errorf("unable to fetch cluster %v in namespace %v: %v", clusterName, namespace, err) + return nil, nil, nil, errors.Wrapf(err, "unable to fetch cluster %v in namespace %v", clusterName, namespace) } - master, nodes, err := extractMasterMachine(machines) + controlPlaneMachine, nodes, err := extractControlPlaneMachine(machines) if err != nil { - return nil, nil, nil, fmt.Errorf("unable to fetch master machine in cluster %v in namespace %v: %v", clusterName, namespace, err) + return nil, nil, nil, errors.Wrapf(err, "unable to fetch control plane machine in cluster %v in namespace %v", clusterName, namespace) } - return cluster, master, nodes, nil + return cluster, controlPlaneMachine, nodes, nil } -// extractMasterMachine separates the master (singular) from the incoming machines. -// This is currently done by looking at which machine specifies the control plane version -// (which implies that it is a master). This should be cleaned up in the future. -func extractMasterMachine(machines []*clusterv1.Machine) (*clusterv1.Machine, []*clusterv1.Machine, error) { +// extractControlPlaneMachine separates the machines running the control plane (singular) from the incoming machines. +// This is currently done by looking at which machine specifies the control plane version. +// TODO: Cleanup. +func extractControlPlaneMachine(machines []*clusterv1.Machine) (*clusterv1.Machine, []*clusterv1.Machine, error) { nodes := []*clusterv1.Machine{} - masters := []*clusterv1.Machine{} + controlPlaneMachines := []*clusterv1.Machine{} for _, machine := range machines { - if util.IsMaster(machine) { - masters = append(masters, machine) + if util.IsControlPlaneMachine(machine) { + controlPlaneMachines = append(controlPlaneMachines, machine) } else { nodes = append(nodes, machine) } } - if len(masters) != 1 { - return nil, nil, fmt.Errorf("expected one master, got: %v", len(masters)) + if len(controlPlaneMachines) != 1 { + return nil, nil, errors.Errorf("expected one control plane machine, got: %v", len(controlPlaneMachines)) } - return masters[0], nodes, nil + return controlPlaneMachines[0], nodes, nil } func closeClient(client clusterclient.Client, name string) { diff --git a/vendor/sigs.k8s.io/cluster-api/cmd/clusterctl/clusterdeployer/providercomponentsstorefactory.go b/vendor/github.com/openshift/cluster-api/cmd/clusterctl/clusterdeployer/providercomponentsstorefactory.go similarity index 92% rename from vendor/sigs.k8s.io/cluster-api/cmd/clusterctl/clusterdeployer/providercomponentsstorefactory.go rename to vendor/github.com/openshift/cluster-api/cmd/clusterctl/clusterdeployer/providercomponentsstorefactory.go index ca3bccb97..bd07586fa 100644 --- a/vendor/sigs.k8s.io/cluster-api/cmd/clusterctl/clusterdeployer/providercomponentsstorefactory.go +++ b/vendor/github.com/openshift/cluster-api/cmd/clusterctl/clusterdeployer/providercomponentsstorefactory.go @@ -17,8 +17,8 @@ limitations under the License. package clusterdeployer import ( + "github.com/openshift/cluster-api/cmd/clusterctl/providercomponents" "k8s.io/client-go/kubernetes" - "sigs.k8s.io/cluster-api/cmd/clusterctl/providercomponents" ) type factory struct { diff --git a/vendor/sigs.k8s.io/cluster-api/cmd/clusterctl/cmd/BUILD.bazel b/vendor/github.com/openshift/cluster-api/cmd/clusterctl/cmd/BUILD.bazel similarity index 89% rename from vendor/sigs.k8s.io/cluster-api/cmd/clusterctl/cmd/BUILD.bazel rename to vendor/github.com/openshift/cluster-api/cmd/clusterctl/cmd/BUILD.bazel index 946d098a9..4bae503b9 100644 --- a/vendor/sigs.k8s.io/cluster-api/cmd/clusterctl/cmd/BUILD.bazel +++ b/vendor/github.com/openshift/cluster-api/cmd/clusterctl/cmd/BUILD.bazel @@ -19,14 +19,12 @@ go_library( "validate.go", "validate_cluster.go", ], - importpath = "sigs.k8s.io/cluster-api/cmd/clusterctl/cmd", + importpath = "github.com/openshift/cluster-api/cmd/clusterctl/cmd", visibility = ["//visibility:public"], deps = [ "//cmd/clusterctl/clientcmd:go_default_library", "//cmd/clusterctl/clusterdeployer:go_default_library", "//cmd/clusterctl/clusterdeployer/bootstrap:go_default_library", - "//cmd/clusterctl/clusterdeployer/bootstrap/existing:go_default_library", - "//cmd/clusterctl/clusterdeployer/bootstrap/minikube:go_default_library", "//cmd/clusterctl/clusterdeployer/clusterclient:go_default_library", "//cmd/clusterctl/phases:go_default_library", "//cmd/clusterctl/providercomponents:go_default_library", @@ -34,6 +32,7 @@ go_library( "//pkg/apis:go_default_library", "//pkg/apis/cluster/common:go_default_library", "//pkg/util:go_default_library", + "//vendor/github.com/pkg/errors:go_default_library", "//vendor/github.com/spf13/cobra:go_default_library", "//vendor/github.com/spf13/pflag:go_default_library", "//vendor/k8s.io/api/core/v1:go_default_library", diff --git a/vendor/sigs.k8s.io/cluster-api/cmd/clusterctl/cmd/alpha.go b/vendor/github.com/openshift/cluster-api/cmd/clusterctl/cmd/alpha.go similarity index 100% rename from vendor/sigs.k8s.io/cluster-api/cmd/clusterctl/cmd/alpha.go rename to vendor/github.com/openshift/cluster-api/cmd/clusterctl/cmd/alpha.go diff --git a/vendor/sigs.k8s.io/cluster-api/cmd/clusterctl/cmd/alpha_phase_apply_addons.go b/vendor/github.com/openshift/cluster-api/cmd/clusterctl/cmd/alpha_phase_apply_addons.go similarity index 94% rename from vendor/sigs.k8s.io/cluster-api/cmd/clusterctl/cmd/alpha_phase_apply_addons.go rename to vendor/github.com/openshift/cluster-api/cmd/clusterctl/cmd/alpha_phase_apply_addons.go index d4f7f1ed2..1bae521d5 100644 --- a/vendor/sigs.k8s.io/cluster-api/cmd/clusterctl/cmd/alpha_phase_apply_addons.go +++ b/vendor/github.com/openshift/cluster-api/cmd/clusterctl/cmd/alpha_phase_apply_addons.go @@ -20,10 +20,10 @@ import ( "fmt" "io/ioutil" + "github.com/openshift/cluster-api/cmd/clusterctl/clusterdeployer/clusterclient" + "github.com/openshift/cluster-api/cmd/clusterctl/phases" "github.com/spf13/cobra" "k8s.io/klog" - "sigs.k8s.io/cluster-api/cmd/clusterctl/clusterdeployer/clusterclient" - "sigs.k8s.io/cluster-api/cmd/clusterctl/phases" ) type AlphaPhaseApplyAddonsOptions struct { diff --git a/vendor/sigs.k8s.io/cluster-api/cmd/clusterctl/cmd/alpha_phase_apply_cluster.go b/vendor/github.com/openshift/cluster-api/cmd/clusterctl/cmd/alpha_phase_apply_cluster.go similarity index 86% rename from vendor/sigs.k8s.io/cluster-api/cmd/clusterctl/cmd/alpha_phase_apply_cluster.go rename to vendor/github.com/openshift/cluster-api/cmd/clusterctl/cmd/alpha_phase_apply_cluster.go index 4197ffc8e..1189b2a0e 100644 --- a/vendor/sigs.k8s.io/cluster-api/cmd/clusterctl/cmd/alpha_phase_apply_cluster.go +++ b/vendor/github.com/openshift/cluster-api/cmd/clusterctl/cmd/alpha_phase_apply_cluster.go @@ -17,14 +17,14 @@ limitations under the License. package cmd import ( - "fmt" "io/ioutil" + "github.com/openshift/cluster-api/cmd/clusterctl/clusterdeployer/clusterclient" + "github.com/openshift/cluster-api/cmd/clusterctl/phases" + "github.com/openshift/cluster-api/pkg/util" + "github.com/pkg/errors" "github.com/spf13/cobra" "k8s.io/klog" - "sigs.k8s.io/cluster-api/cmd/clusterctl/clusterdeployer/clusterclient" - "sigs.k8s.io/cluster-api/cmd/clusterctl/phases" - "sigs.k8s.io/cluster-api/pkg/util" ) type AlphaPhaseApplyClusterOptions struct { @@ -67,11 +67,11 @@ func RunAlphaPhaseApplyCluster(paco *AlphaPhaseApplyClusterOptions) error { clientFactory := clusterclient.NewFactory() client, err := clientFactory.NewClientFromKubeconfig(string(kubeconfig)) if err != nil { - return fmt.Errorf("unable to create cluster client: %v", err) + return errors.Wrap(err, "unable to create cluster client") } if err := phases.ApplyCluster(client, cluster); err != nil { - return fmt.Errorf("unable to apply cluster: %v", err) + return errors.Wrap(err, "unable to apply cluster") } return nil diff --git a/vendor/sigs.k8s.io/cluster-api/cmd/clusterctl/cmd/alpha_phase_apply_cluster_api_components.go b/vendor/github.com/openshift/cluster-api/cmd/clusterctl/cmd/alpha_phase_apply_cluster_api_components.go similarity index 87% rename from vendor/sigs.k8s.io/cluster-api/cmd/clusterctl/cmd/alpha_phase_apply_cluster_api_components.go rename to vendor/github.com/openshift/cluster-api/cmd/clusterctl/cmd/alpha_phase_apply_cluster_api_components.go index 9bd767afd..d8f107ac5 100644 --- a/vendor/sigs.k8s.io/cluster-api/cmd/clusterctl/cmd/alpha_phase_apply_cluster_api_components.go +++ b/vendor/github.com/openshift/cluster-api/cmd/clusterctl/cmd/alpha_phase_apply_cluster_api_components.go @@ -17,13 +17,13 @@ limitations under the License. package cmd import ( - "fmt" "io/ioutil" + "github.com/openshift/cluster-api/cmd/clusterctl/clusterdeployer/clusterclient" + "github.com/openshift/cluster-api/cmd/clusterctl/phases" + "github.com/pkg/errors" "github.com/spf13/cobra" "k8s.io/klog" - "sigs.k8s.io/cluster-api/cmd/clusterctl/clusterdeployer/clusterclient" - "sigs.k8s.io/cluster-api/cmd/clusterctl/phases" ) type AlphaPhaseApplyClusterAPIComponentsOptions struct { @@ -60,13 +60,13 @@ func RunAlphaPhaseApplyClusterAPIComponents(pacaso *AlphaPhaseApplyClusterAPICom pc, err := ioutil.ReadFile(pacaso.ProviderComponents) if err != nil { - return fmt.Errorf("error loading provider components file '%v': %v", pacaso.ProviderComponents, err) + return errors.Wrapf(err, "error loading provider components file %q", pacaso.ProviderComponents) } clientFactory := clusterclient.NewFactory() client, err := clientFactory.NewClientFromKubeconfig(string(kubeconfig)) if err != nil { - return fmt.Errorf("unable to create cluster client: %v", err) + return errors.Wrap(err, "unable to create cluster client") } return phases.ApplyClusterAPIComponents(client, string(pc)) diff --git a/vendor/sigs.k8s.io/cluster-api/cmd/clusterctl/cmd/alpha_phase_apply_machines.go b/vendor/github.com/openshift/cluster-api/cmd/clusterctl/cmd/alpha_phase_apply_machines.go similarity index 87% rename from vendor/sigs.k8s.io/cluster-api/cmd/clusterctl/cmd/alpha_phase_apply_machines.go rename to vendor/github.com/openshift/cluster-api/cmd/clusterctl/cmd/alpha_phase_apply_machines.go index 4fd9d5d5c..b59704702 100644 --- a/vendor/sigs.k8s.io/cluster-api/cmd/clusterctl/cmd/alpha_phase_apply_machines.go +++ b/vendor/github.com/openshift/cluster-api/cmd/clusterctl/cmd/alpha_phase_apply_machines.go @@ -17,14 +17,14 @@ limitations under the License. package cmd import ( - "fmt" "io/ioutil" + "github.com/openshift/cluster-api/cmd/clusterctl/clusterdeployer/clusterclient" + "github.com/openshift/cluster-api/cmd/clusterctl/phases" + "github.com/openshift/cluster-api/pkg/util" + "github.com/pkg/errors" "github.com/spf13/cobra" "k8s.io/klog" - "sigs.k8s.io/cluster-api/cmd/clusterctl/clusterdeployer/clusterclient" - "sigs.k8s.io/cluster-api/cmd/clusterctl/phases" - "sigs.k8s.io/cluster-api/pkg/util" ) type AlphaPhaseApplyMachinesOptions struct { @@ -68,11 +68,11 @@ func RunAlphaPhaseApplyMachines(pamo *AlphaPhaseApplyMachinesOptions) error { clientFactory := clusterclient.NewFactory() client, err := clientFactory.NewClientFromKubeconfig(string(kubeconfig)) if err != nil { - return fmt.Errorf("unable to create cluster client: %v", err) + return errors.Wrap(err, "unable to create cluster client") } if err := phases.ApplyMachines(client, pamo.Namespace, machines); err != nil { - return fmt.Errorf("unable to apply machines: %v", err) + return errors.Wrap(err, "unable to apply machines") } return nil diff --git a/vendor/sigs.k8s.io/cluster-api/cmd/clusterctl/cmd/alpha_phase_create_bootstrap_cluster.go b/vendor/github.com/openshift/cluster-api/cmd/clusterctl/cmd/alpha_phase_create_bootstrap_cluster.go similarity index 64% rename from vendor/sigs.k8s.io/cluster-api/cmd/clusterctl/cmd/alpha_phase_create_bootstrap_cluster.go rename to vendor/github.com/openshift/cluster-api/cmd/clusterctl/cmd/alpha_phase_create_bootstrap_cluster.go index cd6346cde..a48ee2dde 100644 --- a/vendor/sigs.k8s.io/cluster-api/cmd/clusterctl/cmd/alpha_phase_create_bootstrap_cluster.go +++ b/vendor/github.com/openshift/cluster-api/cmd/clusterctl/cmd/alpha_phase_create_bootstrap_cluster.go @@ -17,18 +17,17 @@ limitations under the License. package cmd import ( - "fmt" + "github.com/openshift/cluster-api/cmd/clusterctl/clusterdeployer/bootstrap" + "github.com/openshift/cluster-api/cmd/clusterctl/clusterdeployer/clusterclient" + "github.com/openshift/cluster-api/cmd/clusterctl/phases" + "github.com/pkg/errors" "github.com/spf13/cobra" "k8s.io/klog" - "sigs.k8s.io/cluster-api/cmd/clusterctl/clusterdeployer/bootstrap/minikube" - "sigs.k8s.io/cluster-api/cmd/clusterctl/clusterdeployer/clusterclient" - "sigs.k8s.io/cluster-api/cmd/clusterctl/phases" ) type AlphaPhaseCreateBootstrapClusterOptions struct { - MiniKube []string - VmDriver string + Bootstrap bootstrap.Options KubeconfigOutput string } @@ -46,15 +45,14 @@ var alphaPhaseCreateBootstrapClusterCmd = &cobra.Command{ } func RunAlphaPhaseCreateBootstrapCluster(pcbco *AlphaPhaseCreateBootstrapClusterOptions) error { - if pcbco.VmDriver != "" { - pcbco.MiniKube = append(pcbco.MiniKube, fmt.Sprintf("vm-driver=%s", pcbco.VmDriver)) + bootstrapProvider, err := bootstrap.Get(pcbco.Bootstrap) + if err != nil { + return err } - bootstrapProvider := minikube.WithOptionsAndKubeConfigPath(pcbco.MiniKube, pcbco.KubeconfigOutput) - - _, _, err := phases.CreateBootstrapCluster(bootstrapProvider, false, clusterclient.NewFactory()) + _, _, err = phases.CreateBootstrapCluster(bootstrapProvider, false, clusterclient.NewFactory()) if err != nil { - return fmt.Errorf("failed to create bootstrap cluster: %v", err) + return errors.Wrap(err, "failed to create bootstrap cluster") } klog.Infof("Created bootstrap cluster, path to kubeconfig: %q", pcbco.KubeconfigOutput) @@ -63,9 +61,7 @@ func RunAlphaPhaseCreateBootstrapCluster(pcbco *AlphaPhaseCreateBootstrapCluster func init() { // Optional flags - alphaPhaseCreateBootstrapClusterCmd.Flags().StringSliceVarP(&pcbco.MiniKube, "minikube", "", []string{}, "Minikube options") - alphaPhaseCreateBootstrapClusterCmd.Flags().StringVarP(&pcbco.VmDriver, "vm-driver", "", "", "Which vm driver to use for minikube") alphaPhaseCreateBootstrapClusterCmd.Flags().StringVarP(&pcbco.KubeconfigOutput, "kubeconfig-out", "", "minikube.kubeconfig", "Where to output the kubeconfig for the bootstrap cluster") - + pcbco.Bootstrap.AddFlags(alphaPhasesCmd.Flags()) alphaPhasesCmd.AddCommand(alphaPhaseCreateBootstrapClusterCmd) } diff --git a/vendor/sigs.k8s.io/cluster-api/cmd/clusterctl/cmd/alpha_phases.go b/vendor/github.com/openshift/cluster-api/cmd/clusterctl/cmd/alpha_phases.go similarity index 100% rename from vendor/sigs.k8s.io/cluster-api/cmd/clusterctl/cmd/alpha_phases.go rename to vendor/github.com/openshift/cluster-api/cmd/clusterctl/cmd/alpha_phases.go diff --git a/vendor/sigs.k8s.io/cluster-api/cmd/clusterctl/cmd/create.go b/vendor/github.com/openshift/cluster-api/cmd/clusterctl/cmd/create.go similarity index 100% rename from vendor/sigs.k8s.io/cluster-api/cmd/clusterctl/cmd/create.go rename to vendor/github.com/openshift/cluster-api/cmd/clusterctl/cmd/create.go diff --git a/vendor/sigs.k8s.io/cluster-api/cmd/clusterctl/cmd/create_cluster.go b/vendor/github.com/openshift/cluster-api/cmd/clusterctl/cmd/create_cluster.go similarity index 57% rename from vendor/sigs.k8s.io/cluster-api/cmd/clusterctl/cmd/create_cluster.go rename to vendor/github.com/openshift/cluster-api/cmd/clusterctl/cmd/create_cluster.go index cecaa4a67..4cc86adb8 100644 --- a/vendor/sigs.k8s.io/cluster-api/cmd/clusterctl/cmd/create_cluster.go +++ b/vendor/github.com/openshift/cluster-api/cmd/clusterctl/cmd/create_cluster.go @@ -17,31 +17,26 @@ limitations under the License. package cmd import ( - "fmt" "io/ioutil" + "github.com/openshift/cluster-api/cmd/clusterctl/clusterdeployer" + "github.com/openshift/cluster-api/cmd/clusterctl/clusterdeployer/bootstrap" + "github.com/openshift/cluster-api/cmd/clusterctl/clusterdeployer/clusterclient" + clustercommon "github.com/openshift/cluster-api/pkg/apis/cluster/common" + "github.com/openshift/cluster-api/pkg/util" + "github.com/pkg/errors" "github.com/spf13/cobra" "k8s.io/klog" - "sigs.k8s.io/cluster-api/cmd/clusterctl/clusterdeployer" - "sigs.k8s.io/cluster-api/cmd/clusterctl/clusterdeployer/bootstrap" - "sigs.k8s.io/cluster-api/cmd/clusterctl/clusterdeployer/bootstrap/existing" - "sigs.k8s.io/cluster-api/cmd/clusterctl/clusterdeployer/bootstrap/minikube" - "sigs.k8s.io/cluster-api/cmd/clusterctl/clusterdeployer/clusterclient" - clustercommon "sigs.k8s.io/cluster-api/pkg/apis/cluster/common" - "sigs.k8s.io/cluster-api/pkg/util" ) type CreateOptions struct { - Cluster string - Machine string - ProviderComponents string - AddonComponents string - CleanupBootstrapCluster bool - MiniKube []string - VmDriver string - Provider string - KubeconfigOutput string - ExistingClusterKubeconfigPath string + Cluster string + Machine string + ProviderComponents string + AddonComponents string + Provider string + KubeconfigOutput string + BootstrapFlags bootstrap.Options } var co = &CreateOptions{} @@ -76,19 +71,9 @@ func RunCreate(co *CreateOptions) error { return err } - var bootstrapProvider bootstrap.ClusterProvisioner - if co.ExistingClusterKubeconfigPath != "" { - bootstrapProvider, err = existing.NewExistingCluster(co.ExistingClusterKubeconfigPath) - if err != nil { - return err - } - } else { - if co.VmDriver != "" { - co.MiniKube = append(co.MiniKube, fmt.Sprintf("vm-driver=%s", co.VmDriver)) - } - - bootstrapProvider = minikube.WithOptions(co.MiniKube) - + bootstrapProvider, err := bootstrap.Get(co.BootstrapFlags) + if err != nil { + return err } pd, err := getProvider(co.Provider) @@ -97,41 +82,44 @@ func RunCreate(co *CreateOptions) error { } pc, err := ioutil.ReadFile(co.ProviderComponents) if err != nil { - return fmt.Errorf("error loading provider components file '%v': %v", co.ProviderComponents, err) + return errors.Wrapf(err, "error loading provider components file %q", co.ProviderComponents) } var ac []byte if co.AddonComponents != "" { ac, err = ioutil.ReadFile(co.AddonComponents) if err != nil { - return fmt.Errorf("error loading addons file '%v': %v", co.AddonComponents, err) + return errors.Wrapf(err, "error loading addons file %q", co.AddonComponents) } } pcsFactory := clusterdeployer.NewProviderComponentsStoreFactory() + d := clusterdeployer.New( bootstrapProvider, clusterclient.NewFactory(), string(pc), string(ac), - co.CleanupBootstrapCluster) + co.BootstrapFlags.Cleanup) + return d.Create(c, m, pd, co.KubeconfigOutput, pcsFactory) } func init() { // Required flags - createClusterCmd.Flags().StringVarP(&co.Cluster, "cluster", "c", "", "A yaml file containing cluster object definition") - createClusterCmd.Flags().StringVarP(&co.Machine, "machines", "m", "", "A yaml file containing machine object definition(s)") - createClusterCmd.Flags().StringVarP(&co.ProviderComponents, "provider-components", "p", "", "A yaml file containing cluster api provider controllers and supporting objects") + createClusterCmd.Flags().StringVarP(&co.Cluster, "cluster", "c", "", "A yaml file containing cluster object definition. Required.") + createClusterCmd.MarkFlagRequired("cluster") + createClusterCmd.Flags().StringVarP(&co.Machine, "machines", "m", "", "A yaml file containing machine object definition(s). Required.") + createClusterCmd.MarkFlagRequired("machines") + createClusterCmd.Flags().StringVarP(&co.ProviderComponents, "provider-components", "p", "", "A yaml file containing cluster api provider controllers and supporting objects. Required.") + createClusterCmd.MarkFlagRequired("provider-components") // TODO: Remove as soon as code allows https://github.com/kubernetes-sigs/cluster-api/issues/157 - createClusterCmd.Flags().StringVarP(&co.Provider, "provider", "", "", "Which provider deployment logic to use (google/vsphere/azure)") + createClusterCmd.Flags().StringVarP(&co.Provider, "provider", "", "", "Which provider deployment logic to use (google/vsphere/azure). Required.") + createClusterCmd.MarkFlagRequired("provider") // Optional flags createClusterCmd.Flags().StringVarP(&co.AddonComponents, "addon-components", "a", "", "A yaml file containing cluster addons to apply to the internal cluster") - createClusterCmd.Flags().BoolVarP(&co.CleanupBootstrapCluster, "cleanup-bootstrap-cluster", "", true, "Whether to cleanup the bootstrap cluster after bootstrap") - createClusterCmd.Flags().StringSliceVarP(&co.MiniKube, "minikube", "", []string{}, "Minikube options") - createClusterCmd.Flags().StringVarP(&co.VmDriver, "vm-driver", "", "", "Which vm driver to use for minikube") createClusterCmd.Flags().StringVarP(&co.KubeconfigOutput, "kubeconfig-out", "", "kubeconfig", "Where to output the kubeconfig for the provisioned cluster") - createClusterCmd.Flags().StringVarP(&co.ExistingClusterKubeconfigPath, "existing-bootstrap-cluster-kubeconfig", "e", "", "Path to an existing cluster's kubeconfig for bootstrapping (intead of using minikube)") + co.BootstrapFlags.AddFlags(createClusterCmd.Flags()) createCmd.AddCommand(createClusterCmd) } @@ -142,7 +130,7 @@ func getProvider(name string) (clusterdeployer.ProviderDeployer, error) { } provider, ok := provisioner.(clusterdeployer.ProviderDeployer) if !ok { - return nil, fmt.Errorf("provider for %s does not implement ProviderDeployer interface", name) + return nil, errors.Errorf("provider for %s does not implement ProviderDeployer interface", name) } return provider, nil } diff --git a/vendor/sigs.k8s.io/cluster-api/cmd/clusterctl/cmd/delete.go b/vendor/github.com/openshift/cluster-api/cmd/clusterctl/cmd/delete.go similarity index 100% rename from vendor/sigs.k8s.io/cluster-api/cmd/clusterctl/cmd/delete.go rename to vendor/github.com/openshift/cluster-api/cmd/clusterctl/cmd/delete.go diff --git a/vendor/sigs.k8s.io/cluster-api/cmd/clusterctl/cmd/delete_cluster.go b/vendor/github.com/openshift/cluster-api/cmd/clusterctl/cmd/delete_cluster.go similarity index 59% rename from vendor/sigs.k8s.io/cluster-api/cmd/clusterctl/cmd/delete_cluster.go rename to vendor/github.com/openshift/cluster-api/cmd/clusterctl/cmd/delete_cluster.go index 2435713c6..d96bc2777 100644 --- a/vendor/sigs.k8s.io/cluster-api/cmd/clusterctl/cmd/delete_cluster.go +++ b/vendor/github.com/openshift/cluster-api/cmd/clusterctl/cmd/delete_cluster.go @@ -17,31 +17,24 @@ limitations under the License. package cmd import ( - "fmt" - - "k8s.io/api/core/v1" - tcmd "k8s.io/client-go/tools/clientcmd" - "sigs.k8s.io/cluster-api/cmd/clusterctl/clientcmd" - "sigs.k8s.io/cluster-api/cmd/clusterctl/clusterdeployer" - "sigs.k8s.io/cluster-api/cmd/clusterctl/clusterdeployer/bootstrap" - "sigs.k8s.io/cluster-api/cmd/clusterctl/clusterdeployer/bootstrap/existing" - "sigs.k8s.io/cluster-api/cmd/clusterctl/clusterdeployer/bootstrap/minikube" - "sigs.k8s.io/cluster-api/cmd/clusterctl/clusterdeployer/clusterclient" - "sigs.k8s.io/cluster-api/cmd/clusterctl/providercomponents" - + "github.com/openshift/cluster-api/cmd/clusterctl/clientcmd" + "github.com/openshift/cluster-api/cmd/clusterctl/clusterdeployer" + "github.com/openshift/cluster-api/cmd/clusterctl/clusterdeployer/bootstrap" + "github.com/openshift/cluster-api/cmd/clusterctl/clusterdeployer/clusterclient" + "github.com/openshift/cluster-api/cmd/clusterctl/providercomponents" + "github.com/pkg/errors" "github.com/spf13/cobra" + v1 "k8s.io/api/core/v1" + tcmd "k8s.io/client-go/tools/clientcmd" "k8s.io/klog" ) type DeleteOptions struct { - KubeconfigPath string - ProviderComponents string - ClusterNamespace string - CleanupBootstrapCluster bool - MiniKube []string - VmDriver string - ExistingClusterKubeconfigPath string - KubeconfigOverrides tcmd.ConfigOverrides + KubeconfigPath string + ProviderComponents string + ClusterNamespace string + KubeconfigOverrides tcmd.ConfigOverrides + BootstrapFlags bootstrap.Options } var do = &DeleteOptions{} @@ -70,12 +63,11 @@ func init() { // Optional flags deleteClusterCmd.Flags().StringVarP(&do.ClusterNamespace, "cluster-namespace", "", v1.NamespaceDefault, "Namespace where the cluster to be deleted resides") - deleteClusterCmd.Flags().BoolVarP(&do.CleanupBootstrapCluster, "cleanup-bootstrap-cluster", "", true, "Whether to cleanup the bootstrap cluster after bootstrap") - deleteClusterCmd.Flags().StringSliceVarP(&do.MiniKube, "minikube", "", []string{}, "Minikube options") - deleteClusterCmd.Flags().StringVarP(&do.VmDriver, "vm-driver", "", "", "Which vm driver to use for minikube") - deleteClusterCmd.Flags().StringVarP(&do.ExistingClusterKubeconfigPath, "existing-bootstrap-cluster-kubeconfig", "e", "", "Path to an existing cluster's kubeconfig for bootstrapping (intead of using minikube)") + // BindContextFlags will bind the flags cluster, namespace, and user tcmd.BindContextFlags(&do.KubeconfigOverrides.Context, deleteClusterCmd.Flags(), tcmd.RecommendedContextOverrideFlags("")) + + do.BootstrapFlags.AddFlags(deleteClusterCmd.Flags()) deleteCmd.AddCommand(deleteClusterCmd) } @@ -86,22 +78,13 @@ func RunDelete() error { } clusterClient, err := clusterclient.NewFromDefaultSearchPath(do.KubeconfigPath, do.KubeconfigOverrides) if err != nil { - return fmt.Errorf("error when creating cluster client: %v", err) + return errors.Wrap(err, "error when creating cluster client") } defer clusterClient.Close() - var bootstrapProvider bootstrap.ClusterProvisioner - if do.ExistingClusterKubeconfigPath != "" { - bootstrapProvider, err = existing.NewExistingCluster(do.ExistingClusterKubeconfigPath) - if err != nil { - return err - } - } else { - if do.VmDriver != "" { - do.MiniKube = append(do.MiniKube, fmt.Sprintf("vm-driver=%s", do.VmDriver)) - } - - bootstrapProvider = minikube.WithOptions(do.MiniKube) + bootstrapProvider, err := bootstrap.Get(do.BootstrapFlags) + if err != nil { + return err } deployer := clusterdeployer.New( @@ -109,14 +92,15 @@ func RunDelete() error { clusterclient.NewFactory(), providerComponents, "", - do.CleanupBootstrapCluster) + do.BootstrapFlags.Cleanup) + return deployer.Delete(clusterClient, do.ClusterNamespace) } func loadProviderComponents() (string, error) { coreClients, err := clientcmd.NewCoreClientSetForDefaultSearchPath(do.KubeconfigPath, do.KubeconfigOverrides) if err != nil { - return "", fmt.Errorf("error creating core clients: %v", err) + return "", errors.Wrap(err, "error creating core clients") } pcStore := providercomponents.Store{ ExplicitPath: do.ProviderComponents, @@ -124,7 +108,7 @@ func loadProviderComponents() (string, error) { } providerComponents, err := pcStore.Load() if err != nil { - return "", fmt.Errorf("error when loading provider components: %v", err) + return "", errors.Wrap(err, "error when loading provider components") } return providerComponents, nil } diff --git a/vendor/sigs.k8s.io/cluster-api/cmd/clusterctl/cmd/logutil.go b/vendor/github.com/openshift/cluster-api/cmd/clusterctl/cmd/logutil.go similarity index 100% rename from vendor/sigs.k8s.io/cluster-api/cmd/clusterctl/cmd/logutil.go rename to vendor/github.com/openshift/cluster-api/cmd/clusterctl/cmd/logutil.go diff --git a/vendor/sigs.k8s.io/cluster-api/cmd/clusterctl/cmd/root.go b/vendor/github.com/openshift/cluster-api/cmd/clusterctl/cmd/root.go similarity index 100% rename from vendor/sigs.k8s.io/cluster-api/cmd/clusterctl/cmd/root.go rename to vendor/github.com/openshift/cluster-api/cmd/clusterctl/cmd/root.go diff --git a/vendor/sigs.k8s.io/cluster-api/cmd/clusterctl/cmd/validate.go b/vendor/github.com/openshift/cluster-api/cmd/clusterctl/cmd/validate.go similarity index 100% rename from vendor/sigs.k8s.io/cluster-api/cmd/clusterctl/cmd/validate.go rename to vendor/github.com/openshift/cluster-api/cmd/clusterctl/cmd/validate.go diff --git a/vendor/sigs.k8s.io/cluster-api/cmd/clusterctl/cmd/validate_cluster.go b/vendor/github.com/openshift/cluster-api/cmd/clusterctl/cmd/validate_cluster.go similarity index 86% rename from vendor/sigs.k8s.io/cluster-api/cmd/clusterctl/cmd/validate_cluster.go rename to vendor/github.com/openshift/cluster-api/cmd/clusterctl/cmd/validate_cluster.go index 06839f72e..570769e15 100644 --- a/vendor/sigs.k8s.io/cluster-api/cmd/clusterctl/cmd/validate_cluster.go +++ b/vendor/github.com/openshift/cluster-api/cmd/clusterctl/cmd/validate_cluster.go @@ -19,15 +19,15 @@ package cmd import ( "fmt" "os" - "sigs.k8s.io/cluster-api/pkg/apis" - "sigs.k8s.io/controller-runtime/pkg/manager" + "github.com/openshift/cluster-api/cmd/clusterctl/validation" + "github.com/openshift/cluster-api/pkg/apis" + "github.com/pkg/errors" "github.com/spf13/cobra" - tcmd "k8s.io/client-go/tools/clientcmd" - "sigs.k8s.io/cluster-api/cmd/clusterctl/validation" "sigs.k8s.io/controller-runtime/pkg/client" "sigs.k8s.io/controller-runtime/pkg/client/config" + "sigs.k8s.io/controller-runtime/pkg/manager" ) type ValidateClusterOptions struct { @@ -58,20 +58,20 @@ func init() { func RunValidateCluster() error { cfg, err := config.GetConfig() if err != nil { - return fmt.Errorf("failed to create client configuration: %v", err) + return errors.Wrap(err, "failed to create client configuration") } mgr, err := manager.New(cfg, manager.Options{}) if err != nil { - return fmt.Errorf("failed to create manager: %v", err) + return errors.Wrap(err, "failed to create manager") } // Setup Scheme for all resources if err := apis.AddToScheme(mgr.GetScheme()); err != nil { - return fmt.Errorf("failed to add APIs to manager: %v", err) + return errors.Wrap(err, "failed to add APIs to manager") } c, err := client.New(mgr.GetConfig(), client.Options{Scheme: mgr.GetScheme(), Mapper: mgr.GetRESTMapper()}) if err != nil { - return fmt.Errorf("failed to create client: %v", err) + return errors.Wrap(err, "failed to create client") } if err = validation.ValidateClusterAPIObjects(os.Stdout, c, vco.KubeconfigOverrides.Context.Cluster, vco.KubeconfigOverrides.Context.Namespace); err != nil { return err diff --git a/vendor/sigs.k8s.io/cluster-api/cmd/clusterctl/main.go b/vendor/github.com/openshift/cluster-api/cmd/clusterctl/main.go similarity index 91% rename from vendor/sigs.k8s.io/cluster-api/cmd/clusterctl/main.go rename to vendor/github.com/openshift/cluster-api/cmd/clusterctl/main.go index fccad5e92..f875d46ff 100644 --- a/vendor/sigs.k8s.io/cluster-api/cmd/clusterctl/main.go +++ b/vendor/github.com/openshift/cluster-api/cmd/clusterctl/main.go @@ -16,7 +16,7 @@ limitations under the License. package main -import "sigs.k8s.io/cluster-api/cmd/clusterctl/cmd" +import "github.com/openshift/cluster-api/cmd/clusterctl/cmd" func main() { cmd.Execute() diff --git a/vendor/sigs.k8s.io/cluster-api/cmd/clusterctl/phases/BUILD.bazel b/vendor/github.com/openshift/cluster-api/cmd/clusterctl/phases/BUILD.bazel similarity index 81% rename from vendor/sigs.k8s.io/cluster-api/cmd/clusterctl/phases/BUILD.bazel rename to vendor/github.com/openshift/cluster-api/cmd/clusterctl/phases/BUILD.bazel index accc177fc..35d0e612f 100644 --- a/vendor/sigs.k8s.io/cluster-api/cmd/clusterctl/phases/BUILD.bazel +++ b/vendor/github.com/openshift/cluster-api/cmd/clusterctl/phases/BUILD.bazel @@ -9,12 +9,13 @@ go_library( "applymachines.go", "createbootstrapcluster.go", ], - importpath = "sigs.k8s.io/cluster-api/cmd/clusterctl/phases", + importpath = "github.com/openshift/cluster-api/cmd/clusterctl/phases", visibility = ["//visibility:public"], deps = [ "//cmd/clusterctl/clusterdeployer/bootstrap:go_default_library", "//cmd/clusterctl/clusterdeployer/clusterclient:go_default_library", "//pkg/apis/cluster/v1alpha1:go_default_library", + "//vendor/github.com/pkg/errors:go_default_library", "//vendor/k8s.io/klog:go_default_library", ], ) diff --git a/vendor/sigs.k8s.io/cluster-api/cmd/clusterctl/phases/applyaddons.go b/vendor/github.com/openshift/cluster-api/cmd/clusterctl/phases/applyaddons.go similarity index 90% rename from vendor/sigs.k8s.io/cluster-api/cmd/clusterctl/phases/applyaddons.go rename to vendor/github.com/openshift/cluster-api/cmd/clusterctl/phases/applyaddons.go index dec8422d2..5141f4966 100644 --- a/vendor/sigs.k8s.io/cluster-api/cmd/clusterctl/phases/applyaddons.go +++ b/vendor/github.com/openshift/cluster-api/cmd/clusterctl/phases/applyaddons.go @@ -17,8 +17,8 @@ limitations under the License. package phases import ( + "github.com/openshift/cluster-api/cmd/clusterctl/clusterdeployer/clusterclient" "k8s.io/klog" - "sigs.k8s.io/cluster-api/cmd/clusterctl/clusterdeployer/clusterclient" ) func ApplyAddons(client clusterclient.Client, addons string) error { diff --git a/vendor/sigs.k8s.io/cluster-api/cmd/clusterctl/phases/applycluster.go b/vendor/github.com/openshift/cluster-api/cmd/clusterctl/phases/applycluster.go similarity index 80% rename from vendor/sigs.k8s.io/cluster-api/cmd/clusterctl/phases/applycluster.go rename to vendor/github.com/openshift/cluster-api/cmd/clusterctl/phases/applycluster.go index 7c46a03ce..5a5dfd9a2 100644 --- a/vendor/sigs.k8s.io/cluster-api/cmd/clusterctl/phases/applycluster.go +++ b/vendor/github.com/openshift/cluster-api/cmd/clusterctl/phases/applycluster.go @@ -17,11 +17,10 @@ limitations under the License. package phases import ( - "fmt" - + "github.com/openshift/cluster-api/cmd/clusterctl/clusterdeployer/clusterclient" + clusterv1 "github.com/openshift/cluster-api/pkg/apis/cluster/v1alpha1" + "github.com/pkg/errors" "k8s.io/klog" - "sigs.k8s.io/cluster-api/cmd/clusterctl/clusterdeployer/clusterclient" - clusterv1 "sigs.k8s.io/cluster-api/pkg/apis/cluster/v1alpha1" ) func ApplyCluster(client clusterclient.Client, cluster *clusterv1.Cluster) error { @@ -31,7 +30,7 @@ func ApplyCluster(client clusterclient.Client, cluster *clusterv1.Cluster) error err := client.EnsureNamespace(cluster.Namespace) if err != nil { - return fmt.Errorf("unable to ensure namespace %q: %v", cluster.Namespace, err) + return errors.Wrapf(err, "unable to ensure namespace %q", cluster.Namespace) } klog.Infof("Creating cluster object %v in namespace %q", cluster.Name, cluster.Namespace) diff --git a/vendor/sigs.k8s.io/cluster-api/cmd/clusterctl/phases/applyclusterapicomponents.go b/vendor/github.com/openshift/cluster-api/cmd/clusterctl/phases/applyclusterapicomponents.go similarity index 83% rename from vendor/sigs.k8s.io/cluster-api/cmd/clusterctl/phases/applyclusterapicomponents.go rename to vendor/github.com/openshift/cluster-api/cmd/clusterctl/phases/applyclusterapicomponents.go index e5e0e01be..2e44dbbe1 100644 --- a/vendor/sigs.k8s.io/cluster-api/cmd/clusterctl/phases/applyclusterapicomponents.go +++ b/vendor/github.com/openshift/cluster-api/cmd/clusterctl/phases/applyclusterapicomponents.go @@ -17,16 +17,15 @@ limitations under the License. package phases import ( - "fmt" - + "github.com/openshift/cluster-api/cmd/clusterctl/clusterdeployer/clusterclient" + "github.com/pkg/errors" "k8s.io/klog" - "sigs.k8s.io/cluster-api/cmd/clusterctl/clusterdeployer/clusterclient" ) func ApplyClusterAPIComponents(client clusterclient.Client, providerComponents string) error { klog.Info("Applying Cluster API Provider Components") if err := client.Apply(providerComponents); err != nil { - return fmt.Errorf("unable to apply cluster api controllers: %v", err) + return errors.Wrap(err, "unable to apply cluster api controllers") } return client.WaitForClusterV1alpha1Ready() diff --git a/vendor/sigs.k8s.io/cluster-api/cmd/clusterctl/phases/applymachines.go b/vendor/github.com/openshift/cluster-api/cmd/clusterctl/phases/applymachines.go similarity index 80% rename from vendor/sigs.k8s.io/cluster-api/cmd/clusterctl/phases/applymachines.go rename to vendor/github.com/openshift/cluster-api/cmd/clusterctl/phases/applymachines.go index 232c8db78..de96972b2 100644 --- a/vendor/sigs.k8s.io/cluster-api/cmd/clusterctl/phases/applymachines.go +++ b/vendor/github.com/openshift/cluster-api/cmd/clusterctl/phases/applymachines.go @@ -17,11 +17,10 @@ limitations under the License. package phases import ( - "fmt" - + "github.com/openshift/cluster-api/cmd/clusterctl/clusterdeployer/clusterclient" + clusterv1 "github.com/openshift/cluster-api/pkg/apis/cluster/v1alpha1" + "github.com/pkg/errors" "k8s.io/klog" - "sigs.k8s.io/cluster-api/cmd/clusterctl/clusterdeployer/clusterclient" - clusterv1 "sigs.k8s.io/cluster-api/pkg/apis/cluster/v1alpha1" ) func ApplyMachines(client clusterclient.Client, namespace string, machines []*clusterv1.Machine) error { @@ -31,7 +30,7 @@ func ApplyMachines(client clusterclient.Client, namespace string, machines []*cl err := client.EnsureNamespace(namespace) if err != nil { - return fmt.Errorf("unable to ensure namespace %q: %v", namespace, err) + return errors.Wrapf(err, "unable to ensure namespace %q", namespace) } klog.Infof("Creating machines in namespace %q", namespace) diff --git a/vendor/sigs.k8s.io/cluster-api/cmd/clusterctl/phases/createbootstrapcluster.go b/vendor/github.com/openshift/cluster-api/cmd/clusterctl/phases/createbootstrapcluster.go similarity index 74% rename from vendor/sigs.k8s.io/cluster-api/cmd/clusterctl/phases/createbootstrapcluster.go rename to vendor/github.com/openshift/cluster-api/cmd/clusterctl/phases/createbootstrapcluster.go index 4a3fefa63..766da316c 100644 --- a/vendor/sigs.k8s.io/cluster-api/cmd/clusterctl/phases/createbootstrapcluster.go +++ b/vendor/github.com/openshift/cluster-api/cmd/clusterctl/phases/createbootstrapcluster.go @@ -17,11 +17,10 @@ limitations under the License. package phases import ( - "fmt" - + "github.com/openshift/cluster-api/cmd/clusterctl/clusterdeployer/bootstrap" + "github.com/openshift/cluster-api/cmd/clusterctl/clusterdeployer/clusterclient" + "github.com/pkg/errors" "k8s.io/klog" - "sigs.k8s.io/cluster-api/cmd/clusterctl/clusterdeployer/bootstrap" - "sigs.k8s.io/cluster-api/cmd/clusterctl/clusterdeployer/clusterclient" ) func CreateBootstrapCluster(provisioner bootstrap.ClusterProvisioner, cleanupBootstrapCluster bool, clientFactory clusterclient.Factory) (clusterclient.Client, func(), error) { @@ -29,7 +28,7 @@ func CreateBootstrapCluster(provisioner bootstrap.ClusterProvisioner, cleanupBoo cleanupFn := func() {} if err := provisioner.Create(); err != nil { - return nil, cleanupFn, fmt.Errorf("could not create bootstrap control plane: %v", err) + return nil, cleanupFn, errors.Wrap(err, "could not create bootstrap control plane") } if cleanupBootstrapCluster { @@ -41,11 +40,11 @@ func CreateBootstrapCluster(provisioner bootstrap.ClusterProvisioner, cleanupBoo bootstrapKubeconfig, err := provisioner.GetKubeconfig() if err != nil { - return nil, cleanupFn, fmt.Errorf("unable to get bootstrap cluster kubeconfig: %v", err) + return nil, cleanupFn, errors.Wrap(err, "unable to get bootstrap cluster kubeconfig") } bootstrapClient, err := clientFactory.NewClientFromKubeconfig(bootstrapKubeconfig) if err != nil { - return nil, cleanupFn, fmt.Errorf("unable to create bootstrap client: %v", err) + return nil, cleanupFn, errors.Wrap(err, "unable to create bootstrap client") } return bootstrapClient, cleanupFn, nil diff --git a/vendor/sigs.k8s.io/cluster-api/cmd/clusterctl/providercomponents/BUILD.bazel b/vendor/github.com/openshift/cluster-api/cmd/clusterctl/providercomponents/BUILD.bazel similarity index 84% rename from vendor/sigs.k8s.io/cluster-api/cmd/clusterctl/providercomponents/BUILD.bazel rename to vendor/github.com/openshift/cluster-api/cmd/clusterctl/providercomponents/BUILD.bazel index 6583bd1c4..5da8a70c4 100644 --- a/vendor/sigs.k8s.io/cluster-api/cmd/clusterctl/providercomponents/BUILD.bazel +++ b/vendor/github.com/openshift/cluster-api/cmd/clusterctl/providercomponents/BUILD.bazel @@ -3,9 +3,10 @@ load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test") go_library( name = "go_default_library", srcs = ["providercomponents.go"], - importpath = "sigs.k8s.io/cluster-api/cmd/clusterctl/providercomponents", + importpath = "github.com/openshift/cluster-api/cmd/clusterctl/providercomponents", visibility = ["//visibility:public"], deps = [ + "//vendor/github.com/pkg/errors:go_default_library", "//vendor/k8s.io/api/core/v1:go_default_library", "//vendor/k8s.io/apimachinery/pkg/api/errors:go_default_library", "//vendor/k8s.io/apimachinery/pkg/apis/meta/v1:go_default_library", @@ -20,6 +21,7 @@ go_test( embed = [":go_default_library"], deps = [ "//pkg/apis/cluster/v1alpha1:go_default_library", + "//vendor/github.com/pkg/errors:go_default_library", "//vendor/k8s.io/api/core/v1:go_default_library", "//vendor/k8s.io/apimachinery/pkg/api/errors:go_default_library", "//vendor/k8s.io/apimachinery/pkg/apis/meta/v1:go_default_library", diff --git a/vendor/sigs.k8s.io/cluster-api/cmd/clusterctl/providercomponents/providercomponents.go b/vendor/github.com/openshift/cluster-api/cmd/clusterctl/providercomponents/providercomponents.go similarity index 78% rename from vendor/sigs.k8s.io/cluster-api/cmd/clusterctl/providercomponents/providercomponents.go rename to vendor/github.com/openshift/cluster-api/cmd/clusterctl/providercomponents/providercomponents.go index 75e5044e3..0b28bf6e2 100644 --- a/vendor/sigs.k8s.io/cluster-api/cmd/clusterctl/providercomponents/providercomponents.go +++ b/vendor/github.com/openshift/cluster-api/cmd/clusterctl/providercomponents/providercomponents.go @@ -17,13 +17,14 @@ limitations under the License. package providercomponents import ( - "fmt" "io/ioutil" + + "github.com/pkg/errors" core "k8s.io/api/core/v1" - "k8s.io/apimachinery/pkg/api/errors" + apierrors "k8s.io/apimachinery/pkg/api/errors" meta "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/client-go/kubernetes" - "k8s.io/client-go/kubernetes/typed/core/v1" + v1 "k8s.io/client-go/kubernetes/typed/core/v1" ) const ( @@ -66,21 +67,21 @@ func (pc *Store) Load() (string, error) { func (pc *Store) loadFromFile() (string, error) { bytes, err := ioutil.ReadFile(pc.ExplicitPath) if err != nil { - return "", fmt.Errorf("error when loading provider components from '%v': %v", pc.ExplicitPath, err) + return "", errors.Wrapf(err, "error when loading provider components from %q", pc.ExplicitPath) } return string(bytes), nil } func (pc *Store) saveToConfigMap(providerComponents string) error { configMap, err := pc.ConfigMap.Get(configMapName, meta.GetOptions{}) - if errors.IsNotFound(err) { + if apierrors.IsNotFound(err) { configMap = &core.ConfigMap{ ObjectMeta: meta.ObjectMeta{ Name: configMapName, }, } } else if err != nil { - return fmt.Errorf("unable to get configmap '%v': %v", configMapName, err) + return errors.Wrapf(err, "unable to get configmap %q", configMapName) } if configMap.Data == nil { configMap.Data = make(map[string]string) @@ -89,12 +90,12 @@ func (pc *Store) saveToConfigMap(providerComponents string) error { if err == nil { _, err = pc.ConfigMap.Update(configMap) if err != nil { - return fmt.Errorf("error updating config map '%v': %v", configMapName, err) + return errors.Wrapf(err, "error updating config map %q", configMapName) } } else { _, err = pc.ConfigMap.Create(configMap) if err != nil { - return fmt.Errorf("error creating config map '%v': %v", configMapName, err) + return errors.Wrapf(err, "error creating config map %q", configMapName) } } return nil @@ -102,15 +103,15 @@ func (pc *Store) saveToConfigMap(providerComponents string) error { func (pc *Store) loadFromConfigMap() (string, error) { if pc.ConfigMap == nil { - return "", fmt.Errorf("unable to load config map: need a valid ConfigMapInterface") + return "", errors.New("unable to load config map: need a valid ConfigMapInterface") } configMap, err := pc.ConfigMap.Get(configMapName, meta.GetOptions{}) if err != nil { - return "", fmt.Errorf("error getting configmap named '%v': %v", configMapName, err) + return "", errors.Wrapf(err, "error getting configmap named %q", configMapName) } providerComponents, ok := configMap.Data[configMapProviderComponentsKey] if !ok { - return "", fmt.Errorf("configmap '%v' does not contain the provider components key '%v'", configMapName, configMapProviderComponentsKey) + return "", errors.Errorf("configmap %q does not contain the provider components key %q", configMapName, configMapProviderComponentsKey) } return providerComponents, nil } diff --git a/vendor/github.com/openshift/cluster-api/cmd/clusterctl/testdata/create-cluster-no-args-invalid-flag.golden b/vendor/github.com/openshift/cluster-api/cmd/clusterctl/testdata/create-cluster-no-args-invalid-flag.golden new file mode 100644 index 000000000..c52acce04 --- /dev/null +++ b/vendor/github.com/openshift/cluster-api/cmd/clusterctl/testdata/create-cluster-no-args-invalid-flag.golden @@ -0,0 +1,30 @@ +Error: unknown flag: --invalid-flag +Usage: + clusterctl create cluster [flags] + +Flags: + -a, --addon-components string A yaml file containing cluster addons to apply to the internal cluster + --bootstrap-cluster-cleanup Whether to cleanup the bootstrap cluster after bootstrap. (default true) + -e, --bootstrap-cluster-kubeconfig string Sets the bootstrap cluster to be an existing Kubernetes cluster. + --bootstrap-flags strings Command line flags to be passed to the chosen bootstrapper + --bootstrap-type string The cluster bootstrapper to use. (default "none") + -c, --cluster string A yaml file containing cluster object definition. Required. + -h, --help help for cluster + --kubeconfig-out string Where to output the kubeconfig for the provisioned cluster (default "kubeconfig") + -m, --machines string A yaml file containing machine object definition(s). Required. + --provider string Which provider deployment logic to use (google/vsphere/azure). Required. + -p, --provider-components string A yaml file containing cluster api provider controllers and supporting objects. Required. + +Global Flags: + --alsologtostderr log to standard error as well as files + --kubeconfig string Paths to a kubeconfig. Only required if out-of-cluster. + --log-flush-frequency duration Maximum number of seconds between log flushes (default 5s) + --log_backtrace_at traceLocation when logging hits line file:N, emit a stack trace (default :0) + --log_dir string If non-empty, write log files in this directory + --logtostderr log to standard error instead of files (default true) + --master string The address of the Kubernetes API server. Overrides any value in kubeconfig. Only required if out-of-cluster. + --stderrthreshold severity logs at or above this threshold go to stderr (default 2) + -v, --v Level log level for V logs + --vmodule moduleSpec comma-separated list of pattern=N settings for file-filtered logging + +unknown flag: --invalid-flag diff --git a/vendor/github.com/openshift/cluster-api/cmd/clusterctl/testdata/create-cluster-no-args.golden b/vendor/github.com/openshift/cluster-api/cmd/clusterctl/testdata/create-cluster-no-args.golden new file mode 100644 index 000000000..a9ec3422b --- /dev/null +++ b/vendor/github.com/openshift/cluster-api/cmd/clusterctl/testdata/create-cluster-no-args.golden @@ -0,0 +1,30 @@ +Error: required flag(s) "cluster", "machines", "provider", "provider-components" not set +Usage: + clusterctl create cluster [flags] + +Flags: + -a, --addon-components string A yaml file containing cluster addons to apply to the internal cluster + --bootstrap-cluster-cleanup Whether to cleanup the bootstrap cluster after bootstrap. (default true) + -e, --bootstrap-cluster-kubeconfig string Sets the bootstrap cluster to be an existing Kubernetes cluster. + --bootstrap-flags strings Command line flags to be passed to the chosen bootstrapper + --bootstrap-type string The cluster bootstrapper to use. (default "none") + -c, --cluster string A yaml file containing cluster object definition. Required. + -h, --help help for cluster + --kubeconfig-out string Where to output the kubeconfig for the provisioned cluster (default "kubeconfig") + -m, --machines string A yaml file containing machine object definition(s). Required. + --provider string Which provider deployment logic to use (google/vsphere/azure). Required. + -p, --provider-components string A yaml file containing cluster api provider controllers and supporting objects. Required. + +Global Flags: + --alsologtostderr log to standard error as well as files + --kubeconfig string Paths to a kubeconfig. Only required if out-of-cluster. + --log-flush-frequency duration Maximum number of seconds between log flushes (default 5s) + --log_backtrace_at traceLocation when logging hits line file:N, emit a stack trace (default :0) + --log_dir string If non-empty, write log files in this directory + --logtostderr log to standard error instead of files (default true) + --master string The address of the Kubernetes API server. Overrides any value in kubeconfig. Only required if out-of-cluster. + --stderrthreshold severity logs at or above this threshold go to stderr (default 2) + -v, --v Level log level for V logs + --vmodule moduleSpec comma-separated list of pattern=N settings for file-filtered logging + +required flag(s) "cluster", "machines", "provider", "provider-components" not set diff --git a/vendor/sigs.k8s.io/cluster-api/cmd/clusterctl/testdata/create-no-args-invalid-flag.golden b/vendor/github.com/openshift/cluster-api/cmd/clusterctl/testdata/create-no-args-invalid-flag.golden similarity index 100% rename from vendor/sigs.k8s.io/cluster-api/cmd/clusterctl/testdata/create-no-args-invalid-flag.golden rename to vendor/github.com/openshift/cluster-api/cmd/clusterctl/testdata/create-no-args-invalid-flag.golden diff --git a/vendor/sigs.k8s.io/cluster-api/cmd/clusterctl/testdata/create-no-args.golden b/vendor/github.com/openshift/cluster-api/cmd/clusterctl/testdata/create-no-args.golden similarity index 100% rename from vendor/sigs.k8s.io/cluster-api/cmd/clusterctl/testdata/create-no-args.golden rename to vendor/github.com/openshift/cluster-api/cmd/clusterctl/testdata/create-no-args.golden diff --git a/vendor/github.com/openshift/cluster-api/cmd/clusterctl/testdata/delete-cluster-no-args-invalid-flag.golden b/vendor/github.com/openshift/cluster-api/cmd/clusterctl/testdata/delete-cluster-no-args-invalid-flag.golden new file mode 100644 index 000000000..7b648f6ab --- /dev/null +++ b/vendor/github.com/openshift/cluster-api/cmd/clusterctl/testdata/delete-cluster-no-args-invalid-flag.golden @@ -0,0 +1,29 @@ +Error: unknown flag: --invalid-flag +Usage: + clusterctl delete cluster [flags] + +Flags: + --bootstrap-cluster-cleanup Whether to cleanup the bootstrap cluster after bootstrap. (default true) + -e, --bootstrap-cluster-kubeconfig string Sets the bootstrap cluster to be an existing Kubernetes cluster. + --bootstrap-flags strings Command line flags to be passed to the chosen bootstrapper + --bootstrap-type string The cluster bootstrapper to use. (default "none") + --cluster string The name of the kubeconfig cluster to use + --cluster-namespace string Namespace where the cluster to be deleted resides (default "default") + -h, --help help for cluster + -n, --namespace string If present, the namespace scope for this CLI request + -p, --provider-components string A yaml file containing cluster api provider controllers and supporting objects, if empty the value is loaded from the cluster's configuration store. + --user string The name of the kubeconfig user to use + +Global Flags: + --alsologtostderr log to standard error as well as files + --kubeconfig string Paths to a kubeconfig. Only required if out-of-cluster. + --log-flush-frequency duration Maximum number of seconds between log flushes (default 5s) + --log_backtrace_at traceLocation when logging hits line file:N, emit a stack trace (default :0) + --log_dir string If non-empty, write log files in this directory + --logtostderr log to standard error instead of files (default true) + --master string The address of the Kubernetes API server. Overrides any value in kubeconfig. Only required if out-of-cluster. + --stderrthreshold severity logs at or above this threshold go to stderr (default 2) + -v, --v Level log level for V logs + --vmodule moduleSpec comma-separated list of pattern=N settings for file-filtered logging + +unknown flag: --invalid-flag diff --git a/vendor/sigs.k8s.io/cluster-api/cmd/clusterctl/testdata/delete-cluster-no-args.golden b/vendor/github.com/openshift/cluster-api/cmd/clusterctl/testdata/delete-cluster-no-args.golden similarity index 50% rename from vendor/sigs.k8s.io/cluster-api/cmd/clusterctl/testdata/delete-cluster-no-args.golden rename to vendor/github.com/openshift/cluster-api/cmd/clusterctl/testdata/delete-cluster-no-args.golden index e672c5647..17f3f30bb 100644 --- a/vendor/sigs.k8s.io/cluster-api/cmd/clusterctl/testdata/delete-cluster-no-args.golden +++ b/vendor/github.com/openshift/cluster-api/cmd/clusterctl/testdata/delete-cluster-no-args.golden @@ -5,16 +5,16 @@ Usage: clusterctl delete cluster [flags] Flags: - --cleanup-bootstrap-cluster Whether to cleanup the bootstrap cluster after bootstrap (default true) - --cluster string The name of the kubeconfig cluster to use - --cluster-namespace string Namespace where the cluster to be deleted resides (default "default") - -e, --existing-bootstrap-cluster-kubeconfig string Path to an existing cluster's kubeconfig for bootstrapping (intead of using minikube) - -h, --help help for cluster - --minikube strings Minikube options - -n, --namespace string If present, the namespace scope for this CLI request - -p, --provider-components string A yaml file containing cluster api provider controllers and supporting objects, if empty the value is loaded from the cluster's configuration store. - --user string The name of the kubeconfig user to use - --vm-driver string Which vm driver to use for minikube + --bootstrap-cluster-cleanup Whether to cleanup the bootstrap cluster after bootstrap. (default true) + -e, --bootstrap-cluster-kubeconfig string Sets the bootstrap cluster to be an existing Kubernetes cluster. + --bootstrap-flags strings Command line flags to be passed to the chosen bootstrapper + --bootstrap-type string The cluster bootstrapper to use. (default "none") + --cluster string The name of the kubeconfig cluster to use + --cluster-namespace string Namespace where the cluster to be deleted resides (default "default") + -h, --help help for cluster + -n, --namespace string If present, the namespace scope for this CLI request + -p, --provider-components string A yaml file containing cluster api provider controllers and supporting objects, if empty the value is loaded from the cluster's configuration store. + --user string The name of the kubeconfig user to use Global Flags: --alsologtostderr log to standard error as well as files diff --git a/vendor/sigs.k8s.io/cluster-api/cmd/clusterctl/testdata/delete-no-args-invalid-flag.golden b/vendor/github.com/openshift/cluster-api/cmd/clusterctl/testdata/delete-no-args-invalid-flag.golden similarity index 100% rename from vendor/sigs.k8s.io/cluster-api/cmd/clusterctl/testdata/delete-no-args-invalid-flag.golden rename to vendor/github.com/openshift/cluster-api/cmd/clusterctl/testdata/delete-no-args-invalid-flag.golden diff --git a/vendor/sigs.k8s.io/cluster-api/cmd/clusterctl/testdata/delete-no-args.golden b/vendor/github.com/openshift/cluster-api/cmd/clusterctl/testdata/delete-no-args.golden similarity index 100% rename from vendor/sigs.k8s.io/cluster-api/cmd/clusterctl/testdata/delete-no-args.golden rename to vendor/github.com/openshift/cluster-api/cmd/clusterctl/testdata/delete-no-args.golden diff --git a/vendor/sigs.k8s.io/cluster-api/cmd/clusterctl/testdata/no-args-invalid-flag.golden b/vendor/github.com/openshift/cluster-api/cmd/clusterctl/testdata/no-args-invalid-flag.golden similarity index 100% rename from vendor/sigs.k8s.io/cluster-api/cmd/clusterctl/testdata/no-args-invalid-flag.golden rename to vendor/github.com/openshift/cluster-api/cmd/clusterctl/testdata/no-args-invalid-flag.golden diff --git a/vendor/sigs.k8s.io/cluster-api/cmd/clusterctl/testdata/no-args.golden b/vendor/github.com/openshift/cluster-api/cmd/clusterctl/testdata/no-args.golden similarity index 100% rename from vendor/sigs.k8s.io/cluster-api/cmd/clusterctl/testdata/no-args.golden rename to vendor/github.com/openshift/cluster-api/cmd/clusterctl/testdata/no-args.golden diff --git a/vendor/sigs.k8s.io/cluster-api/cmd/clusterctl/testdata/validate-cluster-no-args-invalid-flag.golden b/vendor/github.com/openshift/cluster-api/cmd/clusterctl/testdata/validate-cluster-no-args-invalid-flag.golden similarity index 100% rename from vendor/sigs.k8s.io/cluster-api/cmd/clusterctl/testdata/validate-cluster-no-args-invalid-flag.golden rename to vendor/github.com/openshift/cluster-api/cmd/clusterctl/testdata/validate-cluster-no-args-invalid-flag.golden diff --git a/vendor/sigs.k8s.io/cluster-api/cmd/clusterctl/testdata/validate-no-args-invalid-flag.golden b/vendor/github.com/openshift/cluster-api/cmd/clusterctl/testdata/validate-no-args-invalid-flag.golden similarity index 100% rename from vendor/sigs.k8s.io/cluster-api/cmd/clusterctl/testdata/validate-no-args-invalid-flag.golden rename to vendor/github.com/openshift/cluster-api/cmd/clusterctl/testdata/validate-no-args-invalid-flag.golden diff --git a/vendor/sigs.k8s.io/cluster-api/cmd/clusterctl/testdata/validate-no-args.golden b/vendor/github.com/openshift/cluster-api/cmd/clusterctl/testdata/validate-no-args.golden similarity index 100% rename from vendor/sigs.k8s.io/cluster-api/cmd/clusterctl/testdata/validate-no-args.golden rename to vendor/github.com/openshift/cluster-api/cmd/clusterctl/testdata/validate-no-args.golden diff --git a/vendor/sigs.k8s.io/cluster-api/cmd/clusterctl/validation/BUILD.bazel b/vendor/github.com/openshift/cluster-api/cmd/clusterctl/validation/BUILD.bazel similarity index 92% rename from vendor/sigs.k8s.io/cluster-api/cmd/clusterctl/validation/BUILD.bazel rename to vendor/github.com/openshift/cluster-api/cmd/clusterctl/validation/BUILD.bazel index d5c9fb500..37fdb4f3d 100644 --- a/vendor/sigs.k8s.io/cluster-api/cmd/clusterctl/validation/BUILD.bazel +++ b/vendor/github.com/openshift/cluster-api/cmd/clusterctl/validation/BUILD.bazel @@ -3,13 +3,13 @@ load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test") go_library( name = "go_default_library", srcs = ["validate_cluster_api_objects.go"], - importpath = "sigs.k8s.io/cluster-api/cmd/clusterctl/validation", + importpath = "github.com/openshift/cluster-api/cmd/clusterctl/validation", visibility = ["//visibility:public"], deps = [ "//pkg/apis/cluster/common:go_default_library", "//pkg/apis/cluster/v1alpha1:go_default_library", "//pkg/controller/noderefutil:go_default_library", - "//vendor/golang.org/x/net/context:go_default_library", + "//vendor/github.com/pkg/errors:go_default_library", "//vendor/k8s.io/api/core/v1:go_default_library", "//vendor/k8s.io/apimachinery/pkg/types:go_default_library", "//vendor/sigs.k8s.io/controller-runtime/pkg/client:go_default_library", diff --git a/vendor/sigs.k8s.io/cluster-api/cmd/clusterctl/validation/testdata/fail-to-validate-cluster-object.golden b/vendor/github.com/openshift/cluster-api/cmd/clusterctl/validation/testdata/fail-to-validate-cluster-object.golden similarity index 100% rename from vendor/sigs.k8s.io/cluster-api/cmd/clusterctl/validation/testdata/fail-to-validate-cluster-object.golden rename to vendor/github.com/openshift/cluster-api/cmd/clusterctl/validation/testdata/fail-to-validate-cluster-object.golden diff --git a/vendor/sigs.k8s.io/cluster-api/cmd/clusterctl/validation/testdata/fail-to-validate-machine-objects-with-errors.golden b/vendor/github.com/openshift/cluster-api/cmd/clusterctl/validation/testdata/fail-to-validate-machine-objects-with-errors.golden similarity index 100% rename from vendor/sigs.k8s.io/cluster-api/cmd/clusterctl/validation/testdata/fail-to-validate-machine-objects-with-errors.golden rename to vendor/github.com/openshift/cluster-api/cmd/clusterctl/validation/testdata/fail-to-validate-machine-objects-with-errors.golden diff --git a/vendor/sigs.k8s.io/cluster-api/cmd/clusterctl/validation/testdata/fail-to-validate-machine-objects-with-noderef-errors.golden b/vendor/github.com/openshift/cluster-api/cmd/clusterctl/validation/testdata/fail-to-validate-machine-objects-with-noderef-errors.golden similarity index 68% rename from vendor/sigs.k8s.io/cluster-api/cmd/clusterctl/validation/testdata/fail-to-validate-machine-objects-with-noderef-errors.golden rename to vendor/github.com/openshift/cluster-api/cmd/clusterctl/validation/testdata/fail-to-validate-machine-objects-with-noderef-errors.golden index b1c314b6d..730fe227b 100644 --- a/vendor/sigs.k8s.io/cluster-api/cmd/clusterctl/validation/testdata/fail-to-validate-machine-objects-with-noderef-errors.golden +++ b/vendor/github.com/openshift/cluster-api/cmd/clusterctl/validation/testdata/fail-to-validate-machine-objects-with-noderef-errors.golden @@ -1,6 +1,6 @@ Validating Cluster API objects in namespace "validate-machine-objects-node-ref-errors" Checking cluster object "test-cluster"... PASS Checking machine object "test-machine1"... FAIL - The corresponding node "test-node-not-ready" is not ready. + the corresponding node "test-node-not-ready" is not ready Checking machine object "test-machine2"... FAIL - The corresponding node "test-node-not-exist" is not found: nodes "test-node-not-exist" not found + the corresponding node "test-node-not-exist" is not found: nodes "test-node-not-exist" not found diff --git a/vendor/sigs.k8s.io/cluster-api/cmd/clusterctl/validation/testdata/validate-cluster-api-object-output-pass.golden b/vendor/github.com/openshift/cluster-api/cmd/clusterctl/validation/testdata/validate-cluster-api-object-output-pass.golden similarity index 100% rename from vendor/sigs.k8s.io/cluster-api/cmd/clusterctl/validation/testdata/validate-cluster-api-object-output-pass.golden rename to vendor/github.com/openshift/cluster-api/cmd/clusterctl/validation/testdata/validate-cluster-api-object-output-pass.golden diff --git a/vendor/sigs.k8s.io/cluster-api/cmd/clusterctl/validation/validate_cluster_api_objects.go b/vendor/github.com/openshift/cluster-api/cmd/clusterctl/validation/validate_cluster_api_objects.go similarity index 78% rename from vendor/sigs.k8s.io/cluster-api/cmd/clusterctl/validation/validate_cluster_api_objects.go rename to vendor/github.com/openshift/cluster-api/cmd/clusterctl/validation/validate_cluster_api_objects.go index 3ccf41fc7..a93c75953 100644 --- a/vendor/sigs.k8s.io/cluster-api/cmd/clusterctl/validation/validate_cluster_api_objects.go +++ b/vendor/github.com/openshift/cluster-api/cmd/clusterctl/validation/validate_cluster_api_objects.go @@ -17,17 +17,17 @@ limitations under the License. package validation import ( + "context" "fmt" "io" - "golang.org/x/net/context" - + "github.com/openshift/cluster-api/pkg/apis/cluster/common" + "github.com/openshift/cluster-api/pkg/apis/cluster/v1alpha1" + clusterv1alpha1 "github.com/openshift/cluster-api/pkg/apis/cluster/v1alpha1" + "github.com/openshift/cluster-api/pkg/controller/noderefutil" + "github.com/pkg/errors" corev1 "k8s.io/api/core/v1" "k8s.io/apimachinery/pkg/types" - "sigs.k8s.io/cluster-api/pkg/apis/cluster/common" - "sigs.k8s.io/cluster-api/pkg/apis/cluster/v1alpha1" - clusterv1alpha1 "sigs.k8s.io/cluster-api/pkg/apis/cluster/v1alpha1" - "sigs.k8s.io/cluster-api/pkg/controller/noderefutil" "sigs.k8s.io/controller-runtime/pkg/client" ) @@ -44,7 +44,7 @@ func ValidateClusterAPIObjects(w io.Writer, c client.Client, clusterName string, machines := &clusterv1alpha1.MachineList{} if err := c.List(context.TODO(), client.InNamespace(namespace), machines); err != nil { - return fmt.Errorf("failed to get the machines from the apiserver in namespace %q: %v", namespace, err) + return errors.Wrapf(err, "failed to get the machines from the apiserver in namespace %q", namespace) } return validateMachineObjects(w, machines, c) @@ -59,13 +59,13 @@ func getClusterObject(c client.Client, clusterName string, namespace string) (*v clusters := &clusterv1alpha1.ClusterList{} if err := c.List(context.TODO(), &client.ListOptions{Namespace: namespace}, clusters); err != nil { - return nil, fmt.Errorf("failed to get the clusters from the apiserver in namespace %q: %v", namespace, err) + return nil, errors.Wrapf(err, "failed to get the clusters from the apiserver in namespace %q", namespace) } if numOfClusters := len(clusters.Items); numOfClusters == 0 { - return nil, fmt.Errorf("fail: No cluster exists in namespace %q.", namespace) + return nil, errors.Errorf("fail: No cluster exists in namespace %q", namespace) } else if numOfClusters > 1 { - return nil, fmt.Errorf("fail: There is more than one cluster in namespace %q. Please specify --cluster-name.", namespace) + return nil, errors.Errorf("fail: There is more than one cluster in namespace %q. Please specify --cluster-name", namespace) } return &clusters.Items[0], nil } @@ -75,7 +75,7 @@ func validateClusterObject(w io.Writer, cluster *v1alpha1.Cluster) error { if cluster.Status.ErrorReason != "" || cluster.Status.ErrorMessage != "" { fmt.Fprintf(w, "FAIL\n") fmt.Fprintf(w, "\t[%v]: %s\n", cluster.Status.ErrorReason, cluster.Status.ErrorMessage) - return fmt.Errorf("Cluster %q failed the validation.", cluster.Name) + return errors.Errorf("cluster %q failed the validation", cluster.Name) } fmt.Fprintf(w, "PASS\n") return nil @@ -89,7 +89,7 @@ func validateMachineObjects(w io.Writer, machines *v1alpha1.MachineList, client } } if !pass { - return fmt.Errorf("Machine objects failed the validation.") + return errors.Errorf("machine objects failed the validation") } return nil } @@ -126,10 +126,10 @@ func validateMachineObject(w io.Writer, machine v1alpha1.Machine, client client. func validateReferredNode(nodeName string, client client.Client) error { node := &corev1.Node{} if err := client.Get(context.TODO(), types.NamespacedName{Name: nodeName}, node); err != nil { - return fmt.Errorf("The corresponding node %q is not found: %v", nodeName, err) + return errors.Wrapf(err, "the corresponding node %q is not found", nodeName) } if !noderefutil.IsNodeReady(node) { - return fmt.Errorf("The corresponding node %q is not ready.", nodeName) + return errors.Errorf("the corresponding node %q is not ready", nodeName) } return nil } diff --git a/vendor/sigs.k8s.io/cluster-api/cmd/manager/BUILD.bazel b/vendor/github.com/openshift/cluster-api/cmd/manager/BUILD.bazel similarity index 86% rename from vendor/sigs.k8s.io/cluster-api/cmd/manager/BUILD.bazel rename to vendor/github.com/openshift/cluster-api/cmd/manager/BUILD.bazel index dbc53953f..f8784022b 100644 --- a/vendor/sigs.k8s.io/cluster-api/cmd/manager/BUILD.bazel +++ b/vendor/github.com/openshift/cluster-api/cmd/manager/BUILD.bazel @@ -3,12 +3,13 @@ load("@io_bazel_rules_go//go:def.bzl", "go_binary", "go_library") go_library( name = "go_default_library", srcs = ["main.go"], - importpath = "sigs.k8s.io/cluster-api/cmd/manager", + importpath = "github.com/openshift/cluster-api/cmd/manager", visibility = ["//visibility:private"], deps = [ "//pkg/apis:go_default_library", "//pkg/controller:go_default_library", "//vendor/k8s.io/client-go/plugin/pkg/client/auth/gcp:go_default_library", + "//vendor/k8s.io/klog:go_default_library", "//vendor/sigs.k8s.io/controller-runtime/pkg/client/config:go_default_library", "//vendor/sigs.k8s.io/controller-runtime/pkg/manager:go_default_library", "//vendor/sigs.k8s.io/controller-runtime/pkg/runtime/signals:go_default_library", diff --git a/vendor/sigs.k8s.io/cluster-api/cmd/manager/main.go b/vendor/github.com/openshift/cluster-api/cmd/manager/main.go similarity index 94% rename from vendor/sigs.k8s.io/cluster-api/cmd/manager/main.go rename to vendor/github.com/openshift/cluster-api/cmd/manager/main.go index 6082803af..9faed58fe 100644 --- a/vendor/sigs.k8s.io/cluster-api/cmd/manager/main.go +++ b/vendor/github.com/openshift/cluster-api/cmd/manager/main.go @@ -17,14 +17,13 @@ limitations under the License. package main import ( - "log" - "flag" + "log" + "github.com/openshift/cluster-api/pkg/apis" + "github.com/openshift/cluster-api/pkg/controller" _ "k8s.io/client-go/plugin/pkg/client/auth/gcp" "k8s.io/klog" - "sigs.k8s.io/cluster-api/pkg/apis" - "sigs.k8s.io/cluster-api/pkg/controller" "sigs.k8s.io/controller-runtime/pkg/client/config" "sigs.k8s.io/controller-runtime/pkg/manager" "sigs.k8s.io/controller-runtime/pkg/runtime/signals" diff --git a/vendor/sigs.k8s.io/cluster-api/code-of-conduct.md b/vendor/github.com/openshift/cluster-api/code-of-conduct.md similarity index 100% rename from vendor/sigs.k8s.io/cluster-api/code-of-conduct.md rename to vendor/github.com/openshift/cluster-api/code-of-conduct.md diff --git a/vendor/sigs.k8s.io/cluster-api/config/BUILD.bazel b/vendor/github.com/openshift/cluster-api/config/BUILD.bazel similarity index 100% rename from vendor/sigs.k8s.io/cluster-api/config/BUILD.bazel rename to vendor/github.com/openshift/cluster-api/config/BUILD.bazel diff --git a/vendor/github.com/openshift/cluster-api/config/crds/cluster_v1alpha1_cluster.yaml b/vendor/github.com/openshift/cluster-api/config/crds/cluster_v1alpha1_cluster.yaml new file mode 100644 index 000000000..28df23947 --- /dev/null +++ b/vendor/github.com/openshift/cluster-api/config/crds/cluster_v1alpha1_cluster.yaml @@ -0,0 +1,134 @@ +apiVersion: apiextensions.k8s.io/v1beta1 +kind: CustomResourceDefinition +metadata: + creationTimestamp: null + labels: + controller-tools.k8s.io: "1.0" + name: clusters.cluster.k8s.io +spec: + group: cluster.k8s.io + names: + kind: Cluster + plural: clusters + scope: Namespaced + subresources: + status: {} + validation: + openAPIV3Schema: + properties: + apiVersion: + description: 'APIVersion defines the versioned schema of this representation + of an object. Servers should convert recognized schemas to the latest + internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#resources' + type: string + kind: + description: 'Kind is a string value representing the REST resource this + object represents. Servers may infer this from the endpoint the client + submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#types-kinds' + type: string + metadata: + type: object + spec: + properties: + clusterNetwork: + description: Cluster network configuration + properties: + pods: + description: The network ranges from which Pod networks are allocated. + properties: + cidrBlocks: + items: + type: string + type: array + required: + - cidrBlocks + type: object + serviceDomain: + description: Domain name for services. + type: string + services: + description: The network ranges from which service VIPs are allocated. + properties: + cidrBlocks: + items: + type: string + type: array + required: + - cidrBlocks + type: object + required: + - services + - pods + - serviceDomain + type: object + providerSpec: + description: Provider-specific serialized configuration to use during + cluster creation. It is recommended that providers maintain their + own versioned API types that should be serialized/deserialized from + this field. + properties: + value: + description: Value is an inlined, serialized representation of the + resource configuration. It is recommended that providers maintain + their own versioned API types that should be serialized/deserialized + from this field, akin to component config. + type: object + valueFrom: + description: Source for the provider configuration. Cannot be used + if value is not empty. + properties: + machineClass: + description: The machine class from which the provider config + should be sourced. + properties: + provider: + description: Provider is the name of the cloud-provider + which MachineClass is intended for. + type: string + type: object + type: object + type: object + required: + - clusterNetwork + type: object + status: + properties: + apiEndpoints: + description: APIEndpoint represents the endpoint to communicate with + the IP. + items: + properties: + host: + description: The hostname on which the API server is serving. + type: string + port: + description: The port on which the API server is serving. + format: int64 + type: integer + required: + - host + - port + type: object + type: array + errorMessage: + description: If set, indicates that there is a problem reconciling the + state, and will be set to a descriptive error message. + type: string + errorReason: + description: If set, indicates that there is a problem reconciling the + state, and will be set to a token value suitable for programmatic + interpretation. + type: string + providerStatus: + description: Provider-specific status. It is recommended that providers + maintain their own versioned API types that should be serialized/deserialized + from this field. + type: object + type: object + version: v1alpha1 +status: + acceptedNames: + kind: "" + plural: "" + conditions: [] + storedVersions: [] diff --git a/vendor/github.com/openshift/cluster-api/config/crds/cluster_v1alpha1_machine.yaml b/vendor/github.com/openshift/cluster-api/config/crds/cluster_v1alpha1_machine.yaml new file mode 100644 index 000000000..f24e69f33 --- /dev/null +++ b/vendor/github.com/openshift/cluster-api/config/crds/cluster_v1alpha1_machine.yaml @@ -0,0 +1,218 @@ +apiVersion: apiextensions.k8s.io/v1beta1 +kind: CustomResourceDefinition +metadata: + creationTimestamp: null + labels: + controller-tools.k8s.io: "1.0" + name: machines.cluster.k8s.io +spec: + group: cluster.k8s.io + names: + kind: Machine + plural: machines + scope: Namespaced + subresources: + status: {} + validation: + openAPIV3Schema: + properties: + apiVersion: + description: 'APIVersion defines the versioned schema of this representation + of an object. Servers should convert recognized schemas to the latest + internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#resources' + type: string + kind: + description: 'Kind is a string value representing the REST resource this + object represents. Servers may infer this from the endpoint the client + submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#types-kinds' + type: string + metadata: + type: object + spec: + properties: + configSource: + description: ConfigSource is used to populate in the associated Node + for dynamic kubelet config. This field already exists in Node, so + any updates to it in the Machine spec will be automatically copied + to the linked NodeRef from the status. The rest of dynamic kubelet + config support should then work as-is. + type: object + metadata: + description: ObjectMeta will autopopulate the Node created. Use this + to indicate what labels, annotations, name prefix, etc., should be + used when creating the Node. + type: object + providerSpec: + description: ProviderSpec details Provider-specific configuration to + use during node creation. + properties: + value: + description: Value is an inlined, serialized representation of the + resource configuration. It is recommended that providers maintain + their own versioned API types that should be serialized/deserialized + from this field, akin to component config. + type: object + valueFrom: + description: Source for the provider configuration. Cannot be used + if value is not empty. + properties: + machineClass: + description: The machine class from which the provider config + should be sourced. + properties: + provider: + description: Provider is the name of the cloud-provider + which MachineClass is intended for. + type: string + type: object + type: object + type: object + taints: + description: Taints is the full, authoritative list of taints to apply + to the corresponding Node. This list will overwrite any modifications + made to the Node on an ongoing basis. + items: + type: object + type: array + versions: + description: Versions of key software to use. This field is optional + at cluster creation time, and omitting the field indicates that the + cluster installation tool should select defaults for the user. These + defaults may differ based on the cluster installer, but the tool should + populate the values it uses when persisting Machine objects. A Machine + spec missing this field at runtime is invalid. + properties: + controlPlane: + description: ControlPlane is the semantic version of the Kubernetes + control plane to run. This should only be populated when the machine + is a control plane. + type: string + kubelet: + description: Kubelet is the semantic version of kubelet to run + type: string + required: + - kubelet + type: object + required: + - providerSpec + type: object + status: + properties: + addresses: + description: Addresses is a list of addresses assigned to the machine. + Queried from cloud provider, if available. + items: + type: object + type: array + conditions: + description: 'Conditions lists the conditions synced from the node conditions + of the corresponding node-object. Machine-controller is responsible + for keeping conditions up-to-date. MachineSet controller will be taking + these conditions as a signal to decide if machine is healthy or needs + to be replaced. Refer: https://kubernetes.io/docs/concepts/architecture/nodes/#condition' + items: + type: object + type: array + errorMessage: + description: ErrorMessage will be set in the event that there is a terminal + problem reconciling the Machine and will contain a more verbose string + suitable for logging and human consumption. This field should not + be set for transitive errors that a controller faces that are expected + to be fixed automatically over time (like service outages), but instead + indicate that something is fundamentally wrong with the Machine's + spec or the configuration of the controller, and that manual intervention + is required. Examples of terminal errors would be invalid combinations + of settings in the spec, values that are unsupported by the controller, + or the responsible controller itself being critically misconfigured. Any + transient errors that occur during the reconciliation of Machines + can be added as events to the Machine object and/or logged in the + controller's output. + type: string + errorReason: + description: ErrorReason will be set in the event that there is a terminal + problem reconciling the Machine and will contain a succinct value + suitable for machine interpretation. This field should not be set + for transitive errors that a controller faces that are expected to + be fixed automatically over time (like service outages), but instead + indicate that something is fundamentally wrong with the Machine's + spec or the configuration of the controller, and that manual intervention + is required. Examples of terminal errors would be invalid combinations + of settings in the spec, values that are unsupported by the controller, + or the responsible controller itself being critically misconfigured. Any + transient errors that occur during the reconciliation of Machines + can be added as events to the Machine object and/or logged in the + controller's output. + type: string + lastOperation: + description: LastOperation describes the last-operation performed by + the machine-controller. This API should be useful as a history in + terms of the latest operation performed on the specific machine. It + should also convey the state of the latest-operation for example if + it is still on-going, failed or completed successfully. + properties: + description: + description: Description is the human-readable description of the + last operation. + type: string + lastUpdated: + description: LastUpdated is the timestamp at which LastOperation + API was last-updated. + format: date-time + type: string + state: + description: State is the current status of the last performed operation. + E.g. Processing, Failed, Successful etc + type: string + type: + description: Type is the type of operation which was last performed. + E.g. Create, Delete, Update etc + type: string + type: object + lastUpdated: + description: LastUpdated identifies when this status was last observed. + format: date-time + type: string + nodeRef: + description: NodeRef will point to the corresponding Node if it exists. + type: object + phase: + description: Phase represents the current phase of machine actuation. + E.g. Pending, Running, Terminating, Failed etc. + type: string + providerStatus: + description: ProviderStatus details a Provider-specific status. It is + recommended that providers maintain their own versioned API types + that should be serialized/deserialized from this field. + type: object + versions: + description: 'Versions specifies the current versions of software on + the corresponding Node (if it exists). This is provided for a few + reasons: 1) It is more convenient than checking the NodeRef, traversing + it to the Node, and finding the appropriate field in Node.Status.NodeInfo (which + uses different field names and formatting). 2) It removes some of + the dependency on the structure of the Node, so that if the structure + of Node.Status.NodeInfo changes, only machine controllers need + to be updated, rather than every client of the Machines API. 3) + There is no other simple way to check the control plane version. + A client would have to connect directly to the apiserver running + on the target node in order to find out its version.' + properties: + controlPlane: + description: ControlPlane is the semantic version of the Kubernetes + control plane to run. This should only be populated when the machine + is a control plane. + type: string + kubelet: + description: Kubelet is the semantic version of kubelet to run + type: string + required: + - kubelet + type: object + type: object + version: v1alpha1 +status: + acceptedNames: + kind: "" + plural: "" + conditions: [] + storedVersions: [] diff --git a/vendor/github.com/openshift/cluster-api/config/crds/cluster_v1alpha1_machineclass.yaml b/vendor/github.com/openshift/cluster-api/config/crds/cluster_v1alpha1_machineclass.yaml new file mode 100644 index 000000000..149b5ab36 --- /dev/null +++ b/vendor/github.com/openshift/cluster-api/config/crds/cluster_v1alpha1_machineclass.yaml @@ -0,0 +1,40 @@ +apiVersion: apiextensions.k8s.io/v1beta1 +kind: CustomResourceDefinition +metadata: + creationTimestamp: null + labels: + controller-tools.k8s.io: "1.0" + name: machineclasses.cluster.k8s.io +spec: + group: cluster.k8s.io + names: + kind: MachineClass + plural: machineclasses + scope: Namespaced + validation: + openAPIV3Schema: + properties: + apiVersion: + description: 'APIVersion defines the versioned schema of this representation + of an object. Servers should convert recognized schemas to the latest + internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#resources' + type: string + kind: + description: 'Kind is a string value representing the REST resource this + object represents. Servers may infer this from the endpoint the client + submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#types-kinds' + type: string + metadata: + type: object + providerSpec: + description: Provider-specific configuration to use during node creation. + type: object + required: + - providerSpec + version: v1alpha1 +status: + acceptedNames: + kind: "" + plural: "" + conditions: [] + storedVersions: [] diff --git a/vendor/github.com/openshift/cluster-api/config/crds/cluster_v1alpha1_machinedeployment.yaml b/vendor/github.com/openshift/cluster-api/config/crds/cluster_v1alpha1_machinedeployment.yaml new file mode 100644 index 000000000..40bbc3036 --- /dev/null +++ b/vendor/github.com/openshift/cluster-api/config/crds/cluster_v1alpha1_machinedeployment.yaml @@ -0,0 +1,241 @@ +apiVersion: apiextensions.k8s.io/v1beta1 +kind: CustomResourceDefinition +metadata: + creationTimestamp: null + labels: + controller-tools.k8s.io: "1.0" + name: machinedeployments.cluster.k8s.io +spec: + group: cluster.k8s.io + names: + kind: MachineDeployment + plural: machinedeployments + scope: Namespaced + subresources: + scale: + labelSelectorPath: .status.labelSelector + specReplicasPath: .spec.replicas + statusReplicasPath: .status.replicas + status: {} + validation: + openAPIV3Schema: + properties: + apiVersion: + description: 'APIVersion defines the versioned schema of this representation + of an object. Servers should convert recognized schemas to the latest + internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#resources' + type: string + kind: + description: 'Kind is a string value representing the REST resource this + object represents. Servers may infer this from the endpoint the client + submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#types-kinds' + type: string + metadata: + type: object + spec: + properties: + minReadySeconds: + description: Minimum number of seconds for which a newly created machine + should be ready. Defaults to 0 (machine will be considered available + as soon as it is ready) + format: int32 + type: integer + paused: + description: Indicates that the deployment is paused. + type: boolean + progressDeadlineSeconds: + description: The maximum time in seconds for a deployment to make progress + before it is considered to be failed. The deployment controller will + continue to process failed deployments and a condition with a ProgressDeadlineExceeded + reason will be surfaced in the deployment status. Note that progress + will not be estimated during the time a deployment is paused. Defaults + to 600s. + format: int32 + type: integer + replicas: + description: Number of desired machines. Defaults to 1. This is a pointer + to distinguish between explicit zero and not specified. + format: int32 + type: integer + revisionHistoryLimit: + description: The number of old MachineSets to retain to allow rollback. + This is a pointer to distinguish between explicit zero and not specified. + Defaults to 1. + format: int32 + type: integer + selector: + description: Label selector for machines. Existing MachineSets whose + machines are selected by this will be the ones affected by this deployment. + It must match the machine template's labels. + type: object + strategy: + description: The deployment strategy to use to replace existing machines + with new ones. + properties: + rollingUpdate: + description: Rolling update config params. Present only if MachineDeploymentStrategyType + = RollingUpdate. + properties: + maxSurge: + description: 'The maximum number of machines that can be scheduled + above the desired number of machines. Value can be an absolute + number (ex: 5) or a percentage of desired machines (ex: 10%). + This can not be 0 if MaxUnavailable is 0. Absolute number + is calculated from percentage by rounding up. Defaults to + 1. Example: when this is set to 30%, the new MachineSet can + be scaled up immediately when the rolling update starts, such + that the total number of old and new machines do not exceed + 130% of desired machines. Once old machines have been killed, + new MachineSet can be scaled up further, ensuring that total + number of machines running at any time during the update is + at most 130% of desired machines.' + oneOf: + - type: string + - type: integer + maxUnavailable: + description: 'The maximum number of machines that can be unavailable + during the update. Value can be an absolute number (ex: 5) + or a percentage of desired machines (ex: 10%). Absolute number + is calculated from percentage by rounding down. This can not + be 0 if MaxSurge is 0. Defaults to 0. Example: when this is + set to 30%, the old MachineSet can be scaled down to 70% of + desired machines immediately when the rolling update starts. + Once new machines are ready, old MachineSet can be scaled + down further, followed by scaling up the new MachineSet, ensuring + that the total number of machines available at all times during + the update is at least 70% of desired machines.' + oneOf: + - type: string + - type: integer + type: object + type: + description: Type of deployment. Currently the only supported strategy + is "RollingUpdate". Default is RollingUpdate. + type: string + type: object + template: + description: Template describes the machines that will be created. + properties: + metadata: + description: 'Standard object''s metadata. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#metadata' + type: object + spec: + description: 'Specification of the desired behavior of the machine. + More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#spec-and-status' + properties: + configSource: + description: ConfigSource is used to populate in the associated + Node for dynamic kubelet config. This field already exists + in Node, so any updates to it in the Machine spec will be + automatically copied to the linked NodeRef from the status. + The rest of dynamic kubelet config support should then work + as-is. + type: object + metadata: + description: ObjectMeta will autopopulate the Node created. + Use this to indicate what labels, annotations, name prefix, + etc., should be used when creating the Node. + type: object + providerSpec: + description: ProviderSpec details Provider-specific configuration + to use during node creation. + properties: + value: + description: Value is an inlined, serialized representation + of the resource configuration. It is recommended that + providers maintain their own versioned API types that + should be serialized/deserialized from this field, akin + to component config. + type: object + valueFrom: + description: Source for the provider configuration. Cannot + be used if value is not empty. + properties: + machineClass: + description: The machine class from which the provider + config should be sourced. + properties: + provider: + description: Provider is the name of the cloud-provider + which MachineClass is intended for. + type: string + type: object + type: object + type: object + taints: + description: Taints is the full, authoritative list of taints + to apply to the corresponding Node. This list will overwrite + any modifications made to the Node on an ongoing basis. + items: + type: object + type: array + versions: + description: Versions of key software to use. This field is + optional at cluster creation time, and omitting the field + indicates that the cluster installation tool should select + defaults for the user. These defaults may differ based on + the cluster installer, but the tool should populate the values + it uses when persisting Machine objects. A Machine spec missing + this field at runtime is invalid. + properties: + controlPlane: + description: ControlPlane is the semantic version of the + Kubernetes control plane to run. This should only be populated + when the machine is a control plane. + type: string + kubelet: + description: Kubelet is the semantic version of kubelet + to run + type: string + required: + - kubelet + type: object + required: + - providerSpec + type: object + type: object + required: + - selector + - template + type: object + status: + properties: + availableReplicas: + description: Total number of available machines (ready for at least + minReadySeconds) targeted by this deployment. + format: int32 + type: integer + observedGeneration: + description: The generation observed by the deployment controller. + format: int64 + type: integer + readyReplicas: + description: Total number of ready machines targeted by this deployment. + format: int32 + type: integer + replicas: + description: Total number of non-terminated machines targeted by this + deployment (their labels match the selector). + format: int32 + type: integer + unavailableReplicas: + description: Total number of unavailable machines targeted by this deployment. + This is the total number of machines that are still required for the + deployment to have 100% available capacity. They may either be machines + that are running but not yet available or machines that still have + not been created. + format: int32 + type: integer + updatedReplicas: + description: Total number of non-terminated machines targeted by this + deployment that have the desired template spec. + format: int32 + type: integer + type: object + version: v1alpha1 +status: + acceptedNames: + kind: "" + plural: "" + conditions: [] + storedVersions: [] diff --git a/vendor/github.com/openshift/cluster-api/config/crds/cluster_v1alpha1_machineset.yaml b/vendor/github.com/openshift/cluster-api/config/crds/cluster_v1alpha1_machineset.yaml new file mode 100644 index 000000000..4df91b3de --- /dev/null +++ b/vendor/github.com/openshift/cluster-api/config/crds/cluster_v1alpha1_machineset.yaml @@ -0,0 +1,194 @@ +apiVersion: apiextensions.k8s.io/v1beta1 +kind: CustomResourceDefinition +metadata: + creationTimestamp: null + labels: + controller-tools.k8s.io: "1.0" + name: machinesets.cluster.k8s.io +spec: + group: cluster.k8s.io + names: + kind: MachineSet + plural: machinesets + scope: Namespaced + subresources: + scale: + labelSelectorPath: .status.labelSelector + specReplicasPath: .spec.replicas + statusReplicasPath: .status.replicas + status: {} + validation: + openAPIV3Schema: + properties: + apiVersion: + description: 'APIVersion defines the versioned schema of this representation + of an object. Servers should convert recognized schemas to the latest + internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#resources' + type: string + kind: + description: 'Kind is a string value representing the REST resource this + object represents. Servers may infer this from the endpoint the client + submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#types-kinds' + type: string + metadata: + type: object + spec: + properties: + minReadySeconds: + description: MinReadySeconds is the minimum number of seconds for which + a newly created machine should be ready. Defaults to 0 (machine will + be considered available as soon as it is ready) + format: int32 + type: integer + replicas: + description: Replicas is the number of desired replicas. This is a pointer + to distinguish between explicit zero and unspecified. Defaults to + 1. + format: int32 + type: integer + selector: + description: 'Selector is a label query over machines that should match + the replica count. Label keys and values that must match in order + to be controlled by this MachineSet. It must match the machine template''s + labels. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/labels/#label-selectors' + type: object + template: + description: Template is the object that describes the machine that + will be created if insufficient replicas are detected. + properties: + metadata: + description: 'Standard object''s metadata. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#metadata' + type: object + spec: + description: 'Specification of the desired behavior of the machine. + More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#spec-and-status' + properties: + configSource: + description: ConfigSource is used to populate in the associated + Node for dynamic kubelet config. This field already exists + in Node, so any updates to it in the Machine spec will be + automatically copied to the linked NodeRef from the status. + The rest of dynamic kubelet config support should then work + as-is. + type: object + metadata: + description: ObjectMeta will autopopulate the Node created. + Use this to indicate what labels, annotations, name prefix, + etc., should be used when creating the Node. + type: object + providerSpec: + description: ProviderSpec details Provider-specific configuration + to use during node creation. + properties: + value: + description: Value is an inlined, serialized representation + of the resource configuration. It is recommended that + providers maintain their own versioned API types that + should be serialized/deserialized from this field, akin + to component config. + type: object + valueFrom: + description: Source for the provider configuration. Cannot + be used if value is not empty. + properties: + machineClass: + description: The machine class from which the provider + config should be sourced. + properties: + provider: + description: Provider is the name of the cloud-provider + which MachineClass is intended for. + type: string + type: object + type: object + type: object + taints: + description: Taints is the full, authoritative list of taints + to apply to the corresponding Node. This list will overwrite + any modifications made to the Node on an ongoing basis. + items: + type: object + type: array + versions: + description: Versions of key software to use. This field is + optional at cluster creation time, and omitting the field + indicates that the cluster installation tool should select + defaults for the user. These defaults may differ based on + the cluster installer, but the tool should populate the values + it uses when persisting Machine objects. A Machine spec missing + this field at runtime is invalid. + properties: + controlPlane: + description: ControlPlane is the semantic version of the + Kubernetes control plane to run. This should only be populated + when the machine is a control plane. + type: string + kubelet: + description: Kubelet is the semantic version of kubelet + to run + type: string + required: + - kubelet + type: object + required: + - providerSpec + type: object + type: object + required: + - selector + type: object + status: + properties: + availableReplicas: + description: The number of available replicas (ready for at least minReadySeconds) + for this MachineSet. + format: int32 + type: integer + errorMessage: + type: string + errorReason: + description: In the event that there is a terminal problem reconciling + the replicas, both ErrorReason and ErrorMessage will be set. ErrorReason + will be populated with a succinct value suitable for machine interpretation, + while ErrorMessage will contain a more verbose string suitable for + logging and human consumption. These fields should not be set for + transitive errors that a controller faces that are expected to be + fixed automatically over time (like service outages), but instead + indicate that something is fundamentally wrong with the MachineTemplate's + spec or the configuration of the machine controller, and that manual + intervention is required. Examples of terminal errors would be invalid + combinations of settings in the spec, values that are unsupported + by the machine controller, or the responsible machine controller itself + being critically misconfigured. Any transient errors that occur during + the reconciliation of Machines can be added as events to the MachineSet + object and/or logged in the controller's output. + type: string + fullyLabeledReplicas: + description: The number of replicas that have labels matching the labels + of the machine template of the MachineSet. + format: int32 + type: integer + observedGeneration: + description: ObservedGeneration reflects the generation of the most + recently observed MachineSet. + format: int64 + type: integer + readyReplicas: + description: The number of ready replicas for this MachineSet. A machine + is considered ready when the node has been created and is "Ready". + format: int32 + type: integer + replicas: + description: Replicas is the most recently observed number of replicas. + format: int32 + type: integer + required: + - replicas + type: object + version: v1alpha1 +status: + acceptedNames: + kind: "" + plural: "" + conditions: [] + storedVersions: [] diff --git a/vendor/github.com/openshift/cluster-api/config/crds/machine_v1beta1_cluster.yaml b/vendor/github.com/openshift/cluster-api/config/crds/machine_v1beta1_cluster.yaml new file mode 100644 index 000000000..253ebd0d3 --- /dev/null +++ b/vendor/github.com/openshift/cluster-api/config/crds/machine_v1beta1_cluster.yaml @@ -0,0 +1,134 @@ +apiVersion: apiextensions.k8s.io/v1beta1 +kind: CustomResourceDefinition +metadata: + creationTimestamp: null + labels: + controller-tools.k8s.io: "1.0" + name: clusters.machine.openshift.io +spec: + group: machine.openshift.io + names: + kind: Cluster + plural: clusters + scope: Namespaced + subresources: + status: {} + validation: + openAPIV3Schema: + properties: + apiVersion: + description: 'APIVersion defines the versioned schema of this representation + of an object. Servers should convert recognized schemas to the latest + internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#resources' + type: string + kind: + description: 'Kind is a string value representing the REST resource this + object represents. Servers may infer this from the endpoint the client + submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#types-kinds' + type: string + metadata: + type: object + spec: + properties: + clusterNetwork: + description: Cluster network configuration + properties: + pods: + description: The network ranges from which Pod networks are allocated. + properties: + cidrBlocks: + items: + type: string + type: array + required: + - cidrBlocks + type: object + serviceDomain: + description: Domain name for services. + type: string + services: + description: The network ranges from which service VIPs are allocated. + properties: + cidrBlocks: + items: + type: string + type: array + required: + - cidrBlocks + type: object + required: + - services + - pods + - serviceDomain + type: object + providerSpec: + description: Provider-specific serialized configuration to use during + cluster creation. It is recommended that providers maintain their + own versioned API types that should be serialized/deserialized from + this field. + properties: + value: + description: Value is an inlined, serialized representation of the + resource configuration. It is recommended that providers maintain + their own versioned API types that should be serialized/deserialized + from this field, akin to component config. + type: object + valueFrom: + description: Source for the provider configuration. Cannot be used + if value is not empty. + properties: + machineClass: + description: The machine class from which the provider config + should be sourced. + properties: + provider: + description: Provider is the name of the cloud-provider + which MachineClass is intended for. + type: string + type: object + type: object + type: object + required: + - clusterNetwork + type: object + status: + properties: + apiEndpoints: + description: APIEndpoint represents the endpoint to communicate with + the IP. + items: + properties: + host: + description: The hostname on which the API server is serving. + type: string + port: + description: The port on which the API server is serving. + format: int64 + type: integer + required: + - host + - port + type: object + type: array + errorMessage: + description: If set, indicates that there is a problem reconciling the + state, and will be set to a descriptive error message. + type: string + errorReason: + description: If set, indicates that there is a problem reconciling the + state, and will be set to a token value suitable for programmatic + interpretation. + type: string + providerStatus: + description: Provider-specific status. It is recommended that providers + maintain their own versioned API types that should be serialized/deserialized + from this field. + type: object + type: object + version: v1beta1 +status: + acceptedNames: + kind: "" + plural: "" + conditions: [] + storedVersions: [] diff --git a/vendor/github.com/openshift/cluster-api/config/crds/machine_v1beta1_machine.yaml b/vendor/github.com/openshift/cluster-api/config/crds/machine_v1beta1_machine.yaml new file mode 100644 index 000000000..b3282f6d0 --- /dev/null +++ b/vendor/github.com/openshift/cluster-api/config/crds/machine_v1beta1_machine.yaml @@ -0,0 +1,218 @@ +apiVersion: apiextensions.k8s.io/v1beta1 +kind: CustomResourceDefinition +metadata: + creationTimestamp: null + labels: + controller-tools.k8s.io: "1.0" + name: machines.machine.openshift.io +spec: + group: machine.openshift.io + names: + kind: Machine + plural: machines + scope: Namespaced + subresources: + status: {} + validation: + openAPIV3Schema: + properties: + apiVersion: + description: 'APIVersion defines the versioned schema of this representation + of an object. Servers should convert recognized schemas to the latest + internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#resources' + type: string + kind: + description: 'Kind is a string value representing the REST resource this + object represents. Servers may infer this from the endpoint the client + submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#types-kinds' + type: string + metadata: + type: object + spec: + properties: + configSource: + description: ConfigSource is used to populate in the associated Node + for dynamic kubelet config. This field already exists in Node, so + any updates to it in the Machine spec will be automatically copied + to the linked NodeRef from the status. The rest of dynamic kubelet + config support should then work as-is. + type: object + metadata: + description: ObjectMeta will autopopulate the Node created. Use this + to indicate what labels, annotations, name prefix, etc., should be + used when creating the Node. + type: object + providerSpec: + description: ProviderSpec details Provider-specific configuration to + use during node creation. + properties: + value: + description: Value is an inlined, serialized representation of the + resource configuration. It is recommended that providers maintain + their own versioned API types that should be serialized/deserialized + from this field, akin to component config. + type: object + valueFrom: + description: Source for the provider configuration. Cannot be used + if value is not empty. + properties: + machineClass: + description: The machine class from which the provider config + should be sourced. + properties: + provider: + description: Provider is the name of the cloud-provider + which MachineClass is intended for. + type: string + type: object + type: object + type: object + taints: + description: Taints is the full, authoritative list of taints to apply + to the corresponding Node. This list will overwrite any modifications + made to the Node on an ongoing basis. + items: + type: object + type: array + versions: + description: Versions of key software to use. This field is optional + at cluster creation time, and omitting the field indicates that the + cluster installation tool should select defaults for the user. These + defaults may differ based on the cluster installer, but the tool should + populate the values it uses when persisting Machine objects. A Machine + spec missing this field at runtime is invalid. + properties: + controlPlane: + description: ControlPlane is the semantic version of the Kubernetes + control plane to run. This should only be populated when the machine + is a control plane. + type: string + kubelet: + description: Kubelet is the semantic version of kubelet to run + type: string + required: + - kubelet + type: object + required: + - providerSpec + type: object + status: + properties: + addresses: + description: Addresses is a list of addresses assigned to the machine. + Queried from cloud provider, if available. + items: + type: object + type: array + conditions: + description: 'Conditions lists the conditions synced from the node conditions + of the corresponding node-object. Machine-controller is responsible + for keeping conditions up-to-date. MachineSet controller will be taking + these conditions as a signal to decide if machine is healthy or needs + to be replaced. Refer: https://kubernetes.io/docs/concepts/architecture/nodes/#condition' + items: + type: object + type: array + errorMessage: + description: ErrorMessage will be set in the event that there is a terminal + problem reconciling the Machine and will contain a more verbose string + suitable for logging and human consumption. This field should not + be set for transitive errors that a controller faces that are expected + to be fixed automatically over time (like service outages), but instead + indicate that something is fundamentally wrong with the Machine's + spec or the configuration of the controller, and that manual intervention + is required. Examples of terminal errors would be invalid combinations + of settings in the spec, values that are unsupported by the controller, + or the responsible controller itself being critically misconfigured. Any + transient errors that occur during the reconciliation of Machines + can be added as events to the Machine object and/or logged in the + controller's output. + type: string + errorReason: + description: ErrorReason will be set in the event that there is a terminal + problem reconciling the Machine and will contain a succinct value + suitable for machine interpretation. This field should not be set + for transitive errors that a controller faces that are expected to + be fixed automatically over time (like service outages), but instead + indicate that something is fundamentally wrong with the Machine's + spec or the configuration of the controller, and that manual intervention + is required. Examples of terminal errors would be invalid combinations + of settings in the spec, values that are unsupported by the controller, + or the responsible controller itself being critically misconfigured. Any + transient errors that occur during the reconciliation of Machines + can be added as events to the Machine object and/or logged in the + controller's output. + type: string + lastOperation: + description: LastOperation describes the last-operation performed by + the machine-controller. This API should be useful as a history in + terms of the latest operation performed on the specific machine. It + should also convey the state of the latest-operation for example if + it is still on-going, failed or completed successfully. + properties: + description: + description: Description is the human-readable description of the + last operation. + type: string + lastUpdated: + description: LastUpdated is the timestamp at which LastOperation + API was last-updated. + format: date-time + type: string + state: + description: State is the current status of the last performed operation. + E.g. Processing, Failed, Successful etc + type: string + type: + description: Type is the type of operation which was last performed. + E.g. Create, Delete, Update etc + type: string + type: object + lastUpdated: + description: LastUpdated identifies when this status was last observed. + format: date-time + type: string + nodeRef: + description: NodeRef will point to the corresponding Node if it exists. + type: object + phase: + description: Phase represents the current phase of machine actuation. + E.g. Pending, Running, Terminating, Failed etc. + type: string + providerStatus: + description: ProviderStatus details a Provider-specific status. It is + recommended that providers maintain their own versioned API types + that should be serialized/deserialized from this field. + type: object + versions: + description: 'Versions specifies the current versions of software on + the corresponding Node (if it exists). This is provided for a few + reasons: 1) It is more convenient than checking the NodeRef, traversing + it to the Node, and finding the appropriate field in Node.Status.NodeInfo (which + uses different field names and formatting). 2) It removes some of + the dependency on the structure of the Node, so that if the structure + of Node.Status.NodeInfo changes, only machine controllers need + to be updated, rather than every client of the Machines API. 3) + There is no other simple way to check the control plane version. + A client would have to connect directly to the apiserver running + on the target node in order to find out its version.' + properties: + controlPlane: + description: ControlPlane is the semantic version of the Kubernetes + control plane to run. This should only be populated when the machine + is a control plane. + type: string + kubelet: + description: Kubelet is the semantic version of kubelet to run + type: string + required: + - kubelet + type: object + type: object + version: v1beta1 +status: + acceptedNames: + kind: "" + plural: "" + conditions: [] + storedVersions: [] diff --git a/vendor/github.com/openshift/cluster-api/config/crds/machine_v1beta1_machineclass.yaml b/vendor/github.com/openshift/cluster-api/config/crds/machine_v1beta1_machineclass.yaml new file mode 100644 index 000000000..e7fd7972b --- /dev/null +++ b/vendor/github.com/openshift/cluster-api/config/crds/machine_v1beta1_machineclass.yaml @@ -0,0 +1,40 @@ +apiVersion: apiextensions.k8s.io/v1beta1 +kind: CustomResourceDefinition +metadata: + creationTimestamp: null + labels: + controller-tools.k8s.io: "1.0" + name: machineclasses.machine.openshift.io +spec: + group: machine.openshift.io + names: + kind: MachineClass + plural: machineclasses + scope: Namespaced + validation: + openAPIV3Schema: + properties: + apiVersion: + description: 'APIVersion defines the versioned schema of this representation + of an object. Servers should convert recognized schemas to the latest + internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#resources' + type: string + kind: + description: 'Kind is a string value representing the REST resource this + object represents. Servers may infer this from the endpoint the client + submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#types-kinds' + type: string + metadata: + type: object + providerSpec: + description: Provider-specific configuration to use during node creation. + type: object + required: + - providerSpec + version: v1beta1 +status: + acceptedNames: + kind: "" + plural: "" + conditions: [] + storedVersions: [] diff --git a/vendor/github.com/openshift/cluster-api/config/crds/machine_v1beta1_machinedeployment.yaml b/vendor/github.com/openshift/cluster-api/config/crds/machine_v1beta1_machinedeployment.yaml new file mode 100644 index 000000000..27832fc28 --- /dev/null +++ b/vendor/github.com/openshift/cluster-api/config/crds/machine_v1beta1_machinedeployment.yaml @@ -0,0 +1,241 @@ +apiVersion: apiextensions.k8s.io/v1beta1 +kind: CustomResourceDefinition +metadata: + creationTimestamp: null + labels: + controller-tools.k8s.io: "1.0" + name: machinedeployments.machine.openshift.io +spec: + group: machine.openshift.io + names: + kind: MachineDeployment + plural: machinedeployments + scope: Namespaced + subresources: + scale: + labelSelectorPath: .status.labelSelector + specReplicasPath: .spec.replicas + statusReplicasPath: .status.replicas + status: {} + validation: + openAPIV3Schema: + properties: + apiVersion: + description: 'APIVersion defines the versioned schema of this representation + of an object. Servers should convert recognized schemas to the latest + internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#resources' + type: string + kind: + description: 'Kind is a string value representing the REST resource this + object represents. Servers may infer this from the endpoint the client + submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#types-kinds' + type: string + metadata: + type: object + spec: + properties: + minReadySeconds: + description: Minimum number of seconds for which a newly created machine + should be ready. Defaults to 0 (machine will be considered available + as soon as it is ready) + format: int32 + type: integer + paused: + description: Indicates that the deployment is paused. + type: boolean + progressDeadlineSeconds: + description: The maximum time in seconds for a deployment to make progress + before it is considered to be failed. The deployment controller will + continue to process failed deployments and a condition with a ProgressDeadlineExceeded + reason will be surfaced in the deployment status. Note that progress + will not be estimated during the time a deployment is paused. Defaults + to 600s. + format: int32 + type: integer + replicas: + description: Number of desired machines. Defaults to 1. This is a pointer + to distinguish between explicit zero and not specified. + format: int32 + type: integer + revisionHistoryLimit: + description: The number of old MachineSets to retain to allow rollback. + This is a pointer to distinguish between explicit zero and not specified. + Defaults to 1. + format: int32 + type: integer + selector: + description: Label selector for machines. Existing MachineSets whose + machines are selected by this will be the ones affected by this deployment. + It must match the machine template's labels. + type: object + strategy: + description: The deployment strategy to use to replace existing machines + with new ones. + properties: + rollingUpdate: + description: Rolling update config params. Present only if MachineDeploymentStrategyType + = RollingUpdate. + properties: + maxSurge: + description: 'The maximum number of machines that can be scheduled + above the desired number of machines. Value can be an absolute + number (ex: 5) or a percentage of desired machines (ex: 10%). + This can not be 0 if MaxUnavailable is 0. Absolute number + is calculated from percentage by rounding up. Defaults to + 1. Example: when this is set to 30%, the new MachineSet can + be scaled up immediately when the rolling update starts, such + that the total number of old and new machines do not exceed + 130% of desired machines. Once old machines have been killed, + new MachineSet can be scaled up further, ensuring that total + number of machines running at any time during the update is + at most 130% of desired machines.' + oneOf: + - type: string + - type: integer + maxUnavailable: + description: 'The maximum number of machines that can be unavailable + during the update. Value can be an absolute number (ex: 5) + or a percentage of desired machines (ex: 10%). Absolute number + is calculated from percentage by rounding down. This can not + be 0 if MaxSurge is 0. Defaults to 0. Example: when this is + set to 30%, the old MachineSet can be scaled down to 70% of + desired machines immediately when the rolling update starts. + Once new machines are ready, old MachineSet can be scaled + down further, followed by scaling up the new MachineSet, ensuring + that the total number of machines available at all times during + the update is at least 70% of desired machines.' + oneOf: + - type: string + - type: integer + type: object + type: + description: Type of deployment. Currently the only supported strategy + is "RollingUpdate". Default is RollingUpdate. + type: string + type: object + template: + description: Template describes the machines that will be created. + properties: + metadata: + description: 'Standard object''s metadata. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#metadata' + type: object + spec: + description: 'Specification of the desired behavior of the machine. + More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#spec-and-status' + properties: + configSource: + description: ConfigSource is used to populate in the associated + Node for dynamic kubelet config. This field already exists + in Node, so any updates to it in the Machine spec will be + automatically copied to the linked NodeRef from the status. + The rest of dynamic kubelet config support should then work + as-is. + type: object + metadata: + description: ObjectMeta will autopopulate the Node created. + Use this to indicate what labels, annotations, name prefix, + etc., should be used when creating the Node. + type: object + providerSpec: + description: ProviderSpec details Provider-specific configuration + to use during node creation. + properties: + value: + description: Value is an inlined, serialized representation + of the resource configuration. It is recommended that + providers maintain their own versioned API types that + should be serialized/deserialized from this field, akin + to component config. + type: object + valueFrom: + description: Source for the provider configuration. Cannot + be used if value is not empty. + properties: + machineClass: + description: The machine class from which the provider + config should be sourced. + properties: + provider: + description: Provider is the name of the cloud-provider + which MachineClass is intended for. + type: string + type: object + type: object + type: object + taints: + description: Taints is the full, authoritative list of taints + to apply to the corresponding Node. This list will overwrite + any modifications made to the Node on an ongoing basis. + items: + type: object + type: array + versions: + description: Versions of key software to use. This field is + optional at cluster creation time, and omitting the field + indicates that the cluster installation tool should select + defaults for the user. These defaults may differ based on + the cluster installer, but the tool should populate the values + it uses when persisting Machine objects. A Machine spec missing + this field at runtime is invalid. + properties: + controlPlane: + description: ControlPlane is the semantic version of the + Kubernetes control plane to run. This should only be populated + when the machine is a control plane. + type: string + kubelet: + description: Kubelet is the semantic version of kubelet + to run + type: string + required: + - kubelet + type: object + required: + - providerSpec + type: object + type: object + required: + - selector + - template + type: object + status: + properties: + availableReplicas: + description: Total number of available machines (ready for at least + minReadySeconds) targeted by this deployment. + format: int32 + type: integer + observedGeneration: + description: The generation observed by the deployment controller. + format: int64 + type: integer + readyReplicas: + description: Total number of ready machines targeted by this deployment. + format: int32 + type: integer + replicas: + description: Total number of non-terminated machines targeted by this + deployment (their labels match the selector). + format: int32 + type: integer + unavailableReplicas: + description: Total number of unavailable machines targeted by this deployment. + This is the total number of machines that are still required for the + deployment to have 100% available capacity. They may either be machines + that are running but not yet available or machines that still have + not been created. + format: int32 + type: integer + updatedReplicas: + description: Total number of non-terminated machines targeted by this + deployment that have the desired template spec. + format: int32 + type: integer + type: object + version: v1beta1 +status: + acceptedNames: + kind: "" + plural: "" + conditions: [] + storedVersions: [] diff --git a/vendor/github.com/openshift/cluster-api/config/crds/machine_v1beta1_machineset.yaml b/vendor/github.com/openshift/cluster-api/config/crds/machine_v1beta1_machineset.yaml new file mode 100644 index 000000000..f7a1d9586 --- /dev/null +++ b/vendor/github.com/openshift/cluster-api/config/crds/machine_v1beta1_machineset.yaml @@ -0,0 +1,194 @@ +apiVersion: apiextensions.k8s.io/v1beta1 +kind: CustomResourceDefinition +metadata: + creationTimestamp: null + labels: + controller-tools.k8s.io: "1.0" + name: machinesets.machine.openshift.io +spec: + group: machine.openshift.io + names: + kind: MachineSet + plural: machinesets + scope: Namespaced + subresources: + scale: + labelSelectorPath: .status.labelSelector + specReplicasPath: .spec.replicas + statusReplicasPath: .status.replicas + status: {} + validation: + openAPIV3Schema: + properties: + apiVersion: + description: 'APIVersion defines the versioned schema of this representation + of an object. Servers should convert recognized schemas to the latest + internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#resources' + type: string + kind: + description: 'Kind is a string value representing the REST resource this + object represents. Servers may infer this from the endpoint the client + submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#types-kinds' + type: string + metadata: + type: object + spec: + properties: + minReadySeconds: + description: MinReadySeconds is the minimum number of seconds for which + a newly created machine should be ready. Defaults to 0 (machine will + be considered available as soon as it is ready) + format: int32 + type: integer + replicas: + description: Replicas is the number of desired replicas. This is a pointer + to distinguish between explicit zero and unspecified. Defaults to + 1. + format: int32 + type: integer + selector: + description: 'Selector is a label query over machines that should match + the replica count. Label keys and values that must match in order + to be controlled by this MachineSet. It must match the machine template''s + labels. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/labels/#label-selectors' + type: object + template: + description: Template is the object that describes the machine that + will be created if insufficient replicas are detected. + properties: + metadata: + description: 'Standard object''s metadata. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#metadata' + type: object + spec: + description: 'Specification of the desired behavior of the machine. + More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#spec-and-status' + properties: + configSource: + description: ConfigSource is used to populate in the associated + Node for dynamic kubelet config. This field already exists + in Node, so any updates to it in the Machine spec will be + automatically copied to the linked NodeRef from the status. + The rest of dynamic kubelet config support should then work + as-is. + type: object + metadata: + description: ObjectMeta will autopopulate the Node created. + Use this to indicate what labels, annotations, name prefix, + etc., should be used when creating the Node. + type: object + providerSpec: + description: ProviderSpec details Provider-specific configuration + to use during node creation. + properties: + value: + description: Value is an inlined, serialized representation + of the resource configuration. It is recommended that + providers maintain their own versioned API types that + should be serialized/deserialized from this field, akin + to component config. + type: object + valueFrom: + description: Source for the provider configuration. Cannot + be used if value is not empty. + properties: + machineClass: + description: The machine class from which the provider + config should be sourced. + properties: + provider: + description: Provider is the name of the cloud-provider + which MachineClass is intended for. + type: string + type: object + type: object + type: object + taints: + description: Taints is the full, authoritative list of taints + to apply to the corresponding Node. This list will overwrite + any modifications made to the Node on an ongoing basis. + items: + type: object + type: array + versions: + description: Versions of key software to use. This field is + optional at cluster creation time, and omitting the field + indicates that the cluster installation tool should select + defaults for the user. These defaults may differ based on + the cluster installer, but the tool should populate the values + it uses when persisting Machine objects. A Machine spec missing + this field at runtime is invalid. + properties: + controlPlane: + description: ControlPlane is the semantic version of the + Kubernetes control plane to run. This should only be populated + when the machine is a control plane. + type: string + kubelet: + description: Kubelet is the semantic version of kubelet + to run + type: string + required: + - kubelet + type: object + required: + - providerSpec + type: object + type: object + required: + - selector + type: object + status: + properties: + availableReplicas: + description: The number of available replicas (ready for at least minReadySeconds) + for this MachineSet. + format: int32 + type: integer + errorMessage: + type: string + errorReason: + description: In the event that there is a terminal problem reconciling + the replicas, both ErrorReason and ErrorMessage will be set. ErrorReason + will be populated with a succinct value suitable for machine interpretation, + while ErrorMessage will contain a more verbose string suitable for + logging and human consumption. These fields should not be set for + transitive errors that a controller faces that are expected to be + fixed automatically over time (like service outages), but instead + indicate that something is fundamentally wrong with the MachineTemplate's + spec or the configuration of the machine controller, and that manual + intervention is required. Examples of terminal errors would be invalid + combinations of settings in the spec, values that are unsupported + by the machine controller, or the responsible machine controller itself + being critically misconfigured. Any transient errors that occur during + the reconciliation of Machines can be added as events to the MachineSet + object and/or logged in the controller's output. + type: string + fullyLabeledReplicas: + description: The number of replicas that have labels matching the labels + of the machine template of the MachineSet. + format: int32 + type: integer + observedGeneration: + description: ObservedGeneration reflects the generation of the most + recently observed MachineSet. + format: int64 + type: integer + readyReplicas: + description: The number of ready replicas for this MachineSet. A machine + is considered ready when the node has been created and is "Ready". + format: int32 + type: integer + replicas: + description: Replicas is the most recently observed number of replicas. + format: int32 + type: integer + required: + - replicas + type: object + version: v1beta1 +status: + acceptedNames: + kind: "" + plural: "" + conditions: [] + storedVersions: [] diff --git a/vendor/sigs.k8s.io/cluster-api/config/default/kustomization.yaml b/vendor/github.com/openshift/cluster-api/config/default/kustomization.yaml similarity index 78% rename from vendor/sigs.k8s.io/cluster-api/config/default/kustomization.yaml rename to vendor/github.com/openshift/cluster-api/config/default/kustomization.yaml index 2e1e38c32..f4236b3ce 100644 --- a/vendor/sigs.k8s.io/cluster-api/config/default/kustomization.yaml +++ b/vendor/github.com/openshift/cluster-api/config/default/kustomization.yaml @@ -18,11 +18,11 @@ namePrefix: cluster-api- # YAML string, with resources separated by document # markers ("---"). resources: -- ../crds/cluster_v1alpha1_cluster.yaml -- ../crds/cluster_v1alpha1_machine.yaml -- ../crds/cluster_v1alpha1_machineclass.yaml -- ../crds/cluster_v1alpha1_machinedeployment.yaml -- ../crds/cluster_v1alpha1_machineset.yaml +- ../crds/machine_v1beta1_cluster.yaml +- ../crds/machine_v1beta1_machine.yaml +- ../crds/machine_v1beta1_machineclass.yaml +- ../crds/machine_v1beta1_machinedeployment.yaml +- ../crds/machine_v1beta1_machineset.yaml - ../rbac/rbac_role.yaml - ../rbac/rbac_role_binding.yaml - ../manager/manager.yaml diff --git a/vendor/sigs.k8s.io/cluster-api/config/default/manager_image_patch.yaml b/vendor/github.com/openshift/cluster-api/config/default/manager_image_patch.yaml similarity index 100% rename from vendor/sigs.k8s.io/cluster-api/config/default/manager_image_patch.yaml rename to vendor/github.com/openshift/cluster-api/config/default/manager_image_patch.yaml diff --git a/vendor/github.com/openshift/cluster-api/config/default/manager_image_patch.yaml-e b/vendor/github.com/openshift/cluster-api/config/default/manager_image_patch.yaml-e new file mode 100644 index 000000000..3996ddede --- /dev/null +++ b/vendor/github.com/openshift/cluster-api/config/default/manager_image_patch.yaml-e @@ -0,0 +1,11 @@ +apiVersion: apps/v1 +kind: StatefulSet +metadata: + name: controller-manager + namespace: system +spec: + template: + spec: + containers: + - image: gcr.io/k8s-cluster-api/cluster-api-controller:latest + name: manager diff --git a/vendor/sigs.k8s.io/cluster-api/config/manager/manager.yaml b/vendor/github.com/openshift/cluster-api/config/manager/manager.yaml similarity index 100% rename from vendor/sigs.k8s.io/cluster-api/config/manager/manager.yaml rename to vendor/github.com/openshift/cluster-api/config/manager/manager.yaml diff --git a/vendor/sigs.k8s.io/cluster-api/config/rbac/rbac_role.yaml b/vendor/github.com/openshift/cluster-api/config/rbac/rbac_role.yaml similarity index 86% rename from vendor/sigs.k8s.io/cluster-api/config/rbac/rbac_role.yaml rename to vendor/github.com/openshift/cluster-api/config/rbac/rbac_role.yaml index 96d379664..716ae1690 100644 --- a/vendor/sigs.k8s.io/cluster-api/config/rbac/rbac_role.yaml +++ b/vendor/github.com/openshift/cluster-api/config/rbac/rbac_role.yaml @@ -5,7 +5,7 @@ metadata: name: manager-role rules: - apiGroups: - - cluster.k8s.io + - machine.openshift.io resources: - clusters verbs: @@ -17,7 +17,7 @@ rules: - patch - delete - apiGroups: - - cluster.k8s.io + - machine.openshift.io resources: - machines verbs: @@ -29,7 +29,7 @@ rules: - patch - delete - apiGroups: - - cluster.k8s.io + - machine.openshift.io resources: - machinedeployments verbs: @@ -41,7 +41,7 @@ rules: - patch - delete - apiGroups: - - cluster.k8s.io + - machine.openshift.io resources: - machinesets verbs: @@ -53,7 +53,7 @@ rules: - patch - delete - apiGroups: - - cluster.k8s.io + - machine.openshift.io resources: - machines verbs: @@ -77,7 +77,7 @@ rules: - patch - delete - apiGroups: - - cluster.k8s.io + - machine.openshift.io resources: - machines verbs: diff --git a/vendor/sigs.k8s.io/cluster-api/config/rbac/rbac_role_binding.yaml b/vendor/github.com/openshift/cluster-api/config/rbac/rbac_role_binding.yaml similarity index 100% rename from vendor/sigs.k8s.io/cluster-api/config/rbac/rbac_role_binding.yaml rename to vendor/github.com/openshift/cluster-api/config/rbac/rbac_role_binding.yaml diff --git a/vendor/sigs.k8s.io/cluster-api/config/samples/cluster_v1alpha1_cluster.yaml b/vendor/github.com/openshift/cluster-api/config/samples/cluster_v1alpha1_cluster.yaml similarity index 100% rename from vendor/sigs.k8s.io/cluster-api/config/samples/cluster_v1alpha1_cluster.yaml rename to vendor/github.com/openshift/cluster-api/config/samples/cluster_v1alpha1_cluster.yaml diff --git a/vendor/sigs.k8s.io/cluster-api/config/samples/cluster_v1alpha1_machine.yaml b/vendor/github.com/openshift/cluster-api/config/samples/cluster_v1alpha1_machine.yaml similarity index 100% rename from vendor/sigs.k8s.io/cluster-api/config/samples/cluster_v1alpha1_machine.yaml rename to vendor/github.com/openshift/cluster-api/config/samples/cluster_v1alpha1_machine.yaml diff --git a/vendor/sigs.k8s.io/cluster-api/config/samples/cluster_v1alpha1_machinedeployment.yaml b/vendor/github.com/openshift/cluster-api/config/samples/cluster_v1alpha1_machinedeployment.yaml similarity index 100% rename from vendor/sigs.k8s.io/cluster-api/config/samples/cluster_v1alpha1_machinedeployment.yaml rename to vendor/github.com/openshift/cluster-api/config/samples/cluster_v1alpha1_machinedeployment.yaml diff --git a/vendor/sigs.k8s.io/cluster-api/config/samples/cluster_v1alpha1_machineset.yaml b/vendor/github.com/openshift/cluster-api/config/samples/cluster_v1alpha1_machineset.yaml similarity index 100% rename from vendor/sigs.k8s.io/cluster-api/config/samples/cluster_v1alpha1_machineset.yaml rename to vendor/github.com/openshift/cluster-api/config/samples/cluster_v1alpha1_machineset.yaml diff --git a/vendor/sigs.k8s.io/cluster-api/docs/book/Dockerfile b/vendor/github.com/openshift/cluster-api/docs/book/Dockerfile similarity index 100% rename from vendor/sigs.k8s.io/cluster-api/docs/book/Dockerfile rename to vendor/github.com/openshift/cluster-api/docs/book/Dockerfile diff --git a/vendor/sigs.k8s.io/cluster-api/docs/book/GLOSSARY.md b/vendor/github.com/openshift/cluster-api/docs/book/GLOSSARY.md similarity index 100% rename from vendor/sigs.k8s.io/cluster-api/docs/book/GLOSSARY.md rename to vendor/github.com/openshift/cluster-api/docs/book/GLOSSARY.md diff --git a/vendor/sigs.k8s.io/cluster-api/docs/book/README.md b/vendor/github.com/openshift/cluster-api/docs/book/README.md similarity index 83% rename from vendor/sigs.k8s.io/cluster-api/docs/book/README.md rename to vendor/github.com/openshift/cluster-api/docs/book/README.md index 8df0a0e62..3e09655e3 100644 --- a/vendor/sigs.k8s.io/cluster-api/docs/book/README.md +++ b/vendor/github.com/openshift/cluster-api/docs/book/README.md @@ -29,8 +29,8 @@ Including the ability to: - Develop new Cluster and Machine controllers. - Develop automation on top of MachineSets and MachineDeployments as well as other Cluster API resources. For example, - - Cloud agnostic Upgrade and Repair tools. - - Cluster Autoscalars. + - Cloud agnostic upgrade and repair tools. + - Cluster autoscalers. - Etc. ## Who else will this book be for in the future? @@ -51,20 +51,20 @@ through Kubernetes native abstractions. Including the ability to: -- Create reproducable Kubernetes clusters. +- Create reproducible Kubernetes clusters. - Create hybrid cloud environments which optimize for cost, performance, and reliability. ## Resources -GitBook: [book.cluster-api.sigs.k8s.io](http://book.cluster-api.sigs.k8s.io) -GitHub Repo: [kubernetes-sigs/cluster-api](https://github.com/kubernetes-sigs/cluster-api) -Slack channel: [#cluster-api](http://slack.k8s.io/#cluster-api) -Google Group: [kubernetes-sig-cluster-lifecycle@googlegroups.com](https://groups.google.com/forum/#!forum/kubernetes-sig-cluster-lifecycle) +- GitBook: [kubernetes-sigs.github.io/cluster-api](https://kubernetes-sigs.github.io/cluster-api) +- GitHub Repo: [kubernetes-sigs/cluster-api](https://github.com/kubernetes-sigs/cluster-api) +- Slack channel: [#cluster-api](http://slack.k8s.io/#cluster-api) +- Google Group: [kubernetes-sig-cluster-lifecycle@googlegroups.com](https://groups.google.com/forum/#!forum/kubernetes-sig-cluster-lifecycle) ## Navigating this book -This section describes how to use the navigation elements of this book +This section describes how to use the navigation elements of this book. ##### Code Navigation diff --git a/vendor/sigs.k8s.io/cluster-api/docs/book/RELEASE b/vendor/github.com/openshift/cluster-api/docs/book/RELEASE similarity index 100% rename from vendor/sigs.k8s.io/cluster-api/docs/book/RELEASE rename to vendor/github.com/openshift/cluster-api/docs/book/RELEASE diff --git a/vendor/sigs.k8s.io/cluster-api/docs/book/SUMMARY.md b/vendor/github.com/openshift/cluster-api/docs/book/SUMMARY.md similarity index 100% rename from vendor/sigs.k8s.io/cluster-api/docs/book/SUMMARY.md rename to vendor/github.com/openshift/cluster-api/docs/book/SUMMARY.md diff --git a/vendor/sigs.k8s.io/cluster-api/docs/book/appendices/keps/0003-cluster-api.md b/vendor/github.com/openshift/cluster-api/docs/book/appendices/keps/0003-cluster-api.md similarity index 100% rename from vendor/sigs.k8s.io/cluster-api/docs/book/appendices/keps/0003-cluster-api.md rename to vendor/github.com/openshift/cluster-api/docs/book/appendices/keps/0003-cluster-api.md diff --git a/vendor/sigs.k8s.io/cluster-api/docs/book/book.json b/vendor/github.com/openshift/cluster-api/docs/book/book.json similarity index 100% rename from vendor/sigs.k8s.io/cluster-api/docs/book/book.json rename to vendor/github.com/openshift/cluster-api/docs/book/book.json diff --git a/vendor/sigs.k8s.io/cluster-api/docs/book/common_code/architecture.md b/vendor/github.com/openshift/cluster-api/docs/book/common_code/architecture.md similarity index 94% rename from vendor/sigs.k8s.io/cluster-api/docs/book/common_code/architecture.md rename to vendor/github.com/openshift/cluster-api/docs/book/common_code/architecture.md index fd2104e53..83070feca 100644 --- a/vendor/sigs.k8s.io/cluster-api/docs/book/common_code/architecture.md +++ b/vendor/github.com/openshift/cluster-api/docs/book/common_code/architecture.md @@ -4,8 +4,8 @@ It may be useful to read at least the following chapters of the Kubebuilder book in order to better understand this section. -- [What is a Resource](https://github.com/kubernetes-sigs/kubebuilder.git/docs/book/basics/what_is_a_resource.md) -- [What is a Controller](https://github.com/kubernetes-sigs/kubebuilder.git/docs/book/basics/what_is_a_controller.md) +- [What is a Resource](https://github.com/kubernetes-sigs/kubebuilder/blob/master/docs/book/basics/what_is_a_resource.md) +- [What is a Controller](https://github.com/kubernetes-sigs/kubebuilder/blob/master/docs/book/basics/what_is_a_controller.md) {% endpanel %} {% panel style="warning", title="Architecture Diagram" %} diff --git a/vendor/sigs.k8s.io/cluster-api/docs/book/common_code/architecture.png b/vendor/github.com/openshift/cluster-api/docs/book/common_code/architecture.png similarity index 100% rename from vendor/sigs.k8s.io/cluster-api/docs/book/common_code/architecture.png rename to vendor/github.com/openshift/cluster-api/docs/book/common_code/architecture.png diff --git a/vendor/sigs.k8s.io/cluster-api/docs/book/common_code/cluster_controller.md b/vendor/github.com/openshift/cluster-api/docs/book/common_code/cluster_controller.md similarity index 93% rename from vendor/sigs.k8s.io/cluster-api/docs/book/common_code/cluster_controller.md rename to vendor/github.com/openshift/cluster-api/docs/book/common_code/cluster_controller.md index 4df76df26..e24bfd82e 100644 --- a/vendor/sigs.k8s.io/cluster-api/docs/book/common_code/cluster_controller.md +++ b/vendor/github.com/openshift/cluster-api/docs/book/common_code/cluster_controller.md @@ -16,11 +16,11 @@ defaults or by Controllers such as autoscalers. controllers. `Status` is not the source of truth for any information, but instead aggregates and publishes observed state. -`TypeMeta` contains metadata about the API itself - such as Group, Version, +`TypeMeta` contains metadata about the API itself - such as Group, Version, Kind. `ObjectMeta` contains metadata about the specific object instance, for example, -it's name, namespace, labels, and annotations, etc. `ObjectMeta` contains data +it's name, namespace, labels, and annotations, etc. `ObjectMeta` contains data common to most objects. {% sample lang="go" %} @@ -46,21 +46,21 @@ them to evolve independently of it. {% method %} ## ClusterStatus -Like `ProviderSpec`, `ProviderStatus` is recommended to be a serialized API +Like `ProviderSpec`, `ProviderStatus` is recommended to be a serialized API object in a format owned by that provider. Some providers use the `APIEndpoint` field to determine when one or more -masters have been provisioned. This may be necessary before worker nodes +control plane machines have been provisioned. This may be necessary before worker nodes can be provisioned. For example, `cluster-api-provider-gcp` does [this]( https://github.com/kubernetes-sigs/cluster-api-provider-gcp/blob/f3145d8810a5c7fc434ddb5577699b4deb1b5fa6/pkg/cloud/google/metadata.go#L43): ```go if len(cluster.Status.APIEndpoints) == 0 { - return nil, fmt.Errorf("master endpoint not found in apiEndpoints for cluster %v", cluster) + return nil, fmt.Errorf("control plane endpoint not found in apiEndpoints for cluster %v", cluster) } ``` -**TODO**: Provide examples of how `ErrorReason` and `ErrorMessage` are +**TODO**: Provide examples of how `ErrorReason` and `ErrorMessage` are used in practice. {% sample lang="go" %} @@ -72,10 +72,10 @@ used in practice. All methods should be idempotent. -`Reconcile()` will be called whenever there is a change to the `Cluster` +`Reconcile()` will be called whenever there is a change to the `Cluster` `Spec`, or after every resync period. -If a `Cluster` resource is deleted, the controller will call the actuator's +If a `Cluster` resource is deleted, the controller will call the actuator's `Delete()` method until it succeeds, or the [finalizer]( https://kubernetes.io/docs/tasks/access-kubernetes-api/custom-resources/custom-resource-definitions/#finalizers) is removed (see below). diff --git a/vendor/sigs.k8s.io/cluster-api/docs/book/common_code/machine_controller.md b/vendor/github.com/openshift/cluster-api/docs/book/common_code/machine_controller.md similarity index 93% rename from vendor/sigs.k8s.io/cluster-api/docs/book/common_code/machine_controller.md rename to vendor/github.com/openshift/cluster-api/docs/book/common_code/machine_controller.md index 521b98549..7d6e8e2d8 100644 --- a/vendor/sigs.k8s.io/cluster-api/docs/book/common_code/machine_controller.md +++ b/vendor/github.com/openshift/cluster-api/docs/book/common_code/machine_controller.md @@ -1,12 +1,12 @@ # Machine Controller -A `Machine` is the declarative spec for a `Node`, as represented in Kubernetes -core. If a new Machine object is created, a provider-specific controller will +A `Machine` is the declarative spec for a `Node`, as represented in Kubernetes +core. If a new Machine object is created, a provider-specific controller will handle provisioning and installing a new host to register as a new `Node` matching the Machine spec. If the `Machine`s spec is updated, a provider- -specific controller is responsible for updating the Node in-place or replacing -the host with a new one matching the updated spec. If a `Machine` object is +specific controller is responsible for updating the Node in-place or replacing +the host with a new one matching the updated spec. If a `Machine` object is deleted, the corresponding `Node` should have its external resources released by the provider-specific controller, and should be deleted as well. @@ -20,14 +20,14 @@ of the `Spec` is defined by users, unspecified parts may be filled in with defaults or by Controllers such as autoscalers. `Status` contains only observed cluster state and is only written by -controllers. `Status` is not the source of truth for any information, but +controllers. `Status` is not the source of truth for any information, but instead aggregates and publishes observed state. -`TypeMeta` contains metadata about the API itself - such as Group, Version, -Kind. +`TypeMeta` contains metadata about the API itself - such as Group, Version, +Kind. `ObjectMeta` contains metadata about the specific object instance, for -example, it's name, namespace, labels, and annotations, etc. `ObjectMeta` +example, it's name, namespace, labels, and annotations, etc. `ObjectMeta` contains data common to most objects. {% sample lang="go" %} @@ -37,11 +37,11 @@ contains data common to most objects. {% method %} ## MachineSpec -The `ProviderSpec` is recommended to be a serialized API object in a format +The `ProviderSpec` is recommended to be a serialized API object in a format owned by that provider. This will allow the configuration to be strongly typed, versioned, and have as much nested depth as appropriate. These provider-specific API definitions are meant to live outside of the Machine API, which will allow -them to evolve independently of it. Attributes like instance type, which +them to evolve independently of it. Attributes like instance type, which network to use, and the OS image all belong in the `ProviderSpec`. Some providers and tooling depend on an annotation to be set on the `Machine` @@ -49,8 +49,8 @@ to determine if provisioning has completed. For example, the `clusterctl` command does this [here](https://github.com/kubernetes-sigs/cluster-api/blob/a30de81123009a5f91ade870008c1a35f7ce4b35/cmd/clusterctl/clusterdeployer/clusterclient/clusterclient.go#L555): ```go // TODO: update once machine controllers have a way to indicate a machine has been provisoned. https://github.com/kubernetes-sigs/cluster-api/issues/253 - // Seeing a node cannot be purely relied upon because the provisioned master will not be registering with - // the stack that provisions it. + // Seeing a node cannot be purely relied upon because the machine running the control plane + // will not be registering with the stack that provisions it. ready := m.Status.NodeRef != nil || len(m.Annotations) > 0 return ready, nil ``` @@ -62,16 +62,16 @@ command does this [here](https://github.com/kubernetes-sigs/cluster-api/blob/a30 {% method %} ## MachineStatus -Like `ProviderSpec`, `ProviderStatus` is recommended to be a serialized API +Like `ProviderSpec`, `ProviderStatus` is recommended to be a serialized API object in a format owned by that provider. -Note that `NodeRef` may not be set. This can happen if the `Machine` and +Note that `NodeRef` may not be set. This can happen if the `Machine` and corresponding `Node` are not within the same cluster. Two reasons this might be the case are: -- During bootstraping the master `Machine` will initially not be in the same +- During bootstrapping, the control plane `Machine` will initially not be in the same cluster which is being created. -- Some providers distinguish between _manager_ and _managed_ clusters. For +- Some providers distinguish between _manager_ and _managed_ clusters. For these providers a `Machine` and it's corresponding `Node` may never be within the same cluster. **TODO**: There are open issues to address this. @@ -125,7 +125,7 @@ method. {% panel style="warning", title="Machines depend on Clusters" %} The Machine actuator methods expect both a `Cluster` and a `Machine` to be passed in. While there is not a strong link between `Cluster`s and `Machine`s, -the machine controller will determine which cluster to pass by looking for a +the machine controller will determine which cluster to pass by looking for a `Cluster` in the same namespace as the `Machine` There are two consequences of this: @@ -138,7 +138,7 @@ There are two consequences of this: --- -[^1] One reason a `Machine` may not be deleted is if it corresponds to the +[^1] One reason a `Machine` may not be deleted is if it corresponds to the node running the Machine controller. [machine_types_source]: https://github.com/kubernetes-sigs/cluster-api/blob/master/pkg/apis/cluster/v1alpha1/machine_types.go diff --git a/vendor/sigs.k8s.io/cluster-api/docs/book/common_code/machinedeployment_controller.md b/vendor/github.com/openshift/cluster-api/docs/book/common_code/machinedeployment_controller.md similarity index 100% rename from vendor/sigs.k8s.io/cluster-api/docs/book/common_code/machinedeployment_controller.md rename to vendor/github.com/openshift/cluster-api/docs/book/common_code/machinedeployment_controller.md diff --git a/vendor/sigs.k8s.io/cluster-api/docs/book/common_code/machineset_controller.md b/vendor/github.com/openshift/cluster-api/docs/book/common_code/machineset_controller.md similarity index 90% rename from vendor/sigs.k8s.io/cluster-api/docs/book/common_code/machineset_controller.md rename to vendor/github.com/openshift/cluster-api/docs/book/common_code/machineset_controller.md index 656e37d99..c4ca6014d 100644 --- a/vendor/sigs.k8s.io/cluster-api/docs/book/common_code/machineset_controller.md +++ b/vendor/github.com/openshift/cluster-api/docs/book/common_code/machineset_controller.md @@ -23,7 +23,7 @@ which implement their intent by modifying provider-specific `Cluster` and ## MachineSetTemplateSpec {% sample lang="go" %} -[import:'MachineSetSpec'](../../../pkg/apis/cluster/v1alpha1/machineset_types.go) +[import:'MachineSetTemplateSpec'](../../../pkg/apis/cluster/v1alpha1/machineset_types.go) {% endmethod %} {% method %} diff --git a/vendor/sigs.k8s.io/cluster-api/docs/book/common_code/repository_layout.md b/vendor/github.com/openshift/cluster-api/docs/book/common_code/repository_layout.md similarity index 100% rename from vendor/sigs.k8s.io/cluster-api/docs/book/common_code/repository_layout.md rename to vendor/github.com/openshift/cluster-api/docs/book/common_code/repository_layout.md diff --git a/vendor/sigs.k8s.io/cluster-api/docs/book/getting_started/existing_providers.md b/vendor/github.com/openshift/cluster-api/docs/book/getting_started/existing_providers.md similarity index 100% rename from vendor/sigs.k8s.io/cluster-api/docs/book/getting_started/existing_providers.md rename to vendor/github.com/openshift/cluster-api/docs/book/getting_started/existing_providers.md diff --git a/vendor/sigs.k8s.io/cluster-api/docs/book/package-lock.json b/vendor/github.com/openshift/cluster-api/docs/book/package-lock.json similarity index 100% rename from vendor/sigs.k8s.io/cluster-api/docs/book/package-lock.json rename to vendor/github.com/openshift/cluster-api/docs/book/package-lock.json diff --git a/vendor/sigs.k8s.io/cluster-api/docs/book/provider_implementations/building_running_and_testing.md b/vendor/github.com/openshift/cluster-api/docs/book/provider_implementations/building_running_and_testing.md similarity index 95% rename from vendor/sigs.k8s.io/cluster-api/docs/book/provider_implementations/building_running_and_testing.md rename to vendor/github.com/openshift/cluster-api/docs/book/provider_implementations/building_running_and_testing.md index e6ea35399..6ccb13b91 100644 --- a/vendor/sigs.k8s.io/cluster-api/docs/book/provider_implementations/building_running_and_testing.md +++ b/vendor/github.com/openshift/cluster-api/docs/book/provider_implementations/building_running_and_testing.md @@ -52,7 +52,7 @@ make deploy **TODO**: Should deploy a sample `Cluster` and `Machine` resource to verify controllers are reconciling properly. This is troublesome however since before -the actuator stubs are filled in, all we will see is messages to the effect of +the actuator stubs are filled in, all we will see are messages to the effect of "TODO: Not yet implemented"..." ```bash diff --git a/vendor/sigs.k8s.io/cluster-api/docs/book/provider_implementations/create_actuators.md b/vendor/github.com/openshift/cluster-api/docs/book/provider_implementations/create_actuators.md similarity index 93% rename from vendor/sigs.k8s.io/cluster-api/docs/book/provider_implementations/create_actuators.md rename to vendor/github.com/openshift/cluster-api/docs/book/provider_implementations/create_actuators.md index 54b1b7535..9e88e32c3 100644 --- a/vendor/sigs.k8s.io/cluster-api/docs/book/provider_implementations/create_actuators.md +++ b/vendor/github.com/openshift/cluster-api/docs/book/provider_implementations/create_actuators.md @@ -103,7 +103,7 @@ const ( ) // Actuator is responsible for performing machine reconciliation -type Actuator struct { +type Actuator struct { machinesGetter client.MachinesGetter } @@ -137,7 +137,7 @@ func (a *Actuator) Update(ctx context.Context, cluster *clusterv1.Cluster, machi return fmt.Errorf("TODO: Not yet implemented") } -// Exists test for the existance of a machine and is invoked by the Machine Controller +// Exists tests for the existence of a machine and is invoked by the Machine Controller func (a *Actuator) Exists(ctx context.Context, cluster *clusterv1.Cluster, machine *clusterv1.Machine) (bool, error) { log.Printf("Checking if machine %v for cluster %v exists.", machine.Name, cluster.Name) return false, fmt.Errorf("TODO: Not yet implemented") @@ -153,9 +153,9 @@ func (a *Actuator) GetIP(cluster *clusterv1.Cluster, machine *clusterv1.Machine) return "", fmt.Errorf("TODO: Not yet implemented") } -// GetKubeConfig gets a kubeconfig from the master. -func (a *Actuator) GetKubeConfig(cluster *clusterv1.Cluster, master *clusterv1.Machine) (string, error) { - log.Printf("Getting IP of machine %v for cluster %v.", master.Name, cluster.Name) +// GetKubeConfig gets a kubeconfig from the running control plane. +func (a *Actuator) GetKubeConfig(cluster *clusterv1.Cluster, controlPlaneMachine *clusterv1.Machine) (string, error) { + log.Printf("Getting IP of machine %v for cluster %v.", controlPlaneMachine.Name, cluster.Name) return "", fmt.Errorf("TODO: Not yet implemented") } ``` diff --git a/vendor/sigs.k8s.io/cluster-api/docs/book/provider_implementations/generate_crds.md b/vendor/github.com/openshift/cluster-api/docs/book/provider_implementations/generate_crds.md similarity index 100% rename from vendor/sigs.k8s.io/cluster-api/docs/book/provider_implementations/generate_crds.md rename to vendor/github.com/openshift/cluster-api/docs/book/provider_implementations/generate_crds.md diff --git a/vendor/sigs.k8s.io/cluster-api/docs/book/provider_implementations/naming.md b/vendor/github.com/openshift/cluster-api/docs/book/provider_implementations/naming.md similarity index 100% rename from vendor/sigs.k8s.io/cluster-api/docs/book/provider_implementations/naming.md rename to vendor/github.com/openshift/cluster-api/docs/book/provider_implementations/naming.md diff --git a/vendor/sigs.k8s.io/cluster-api/docs/book/provider_implementations/overview.md b/vendor/github.com/openshift/cluster-api/docs/book/provider_implementations/overview.md similarity index 100% rename from vendor/sigs.k8s.io/cluster-api/docs/book/provider_implementations/overview.md rename to vendor/github.com/openshift/cluster-api/docs/book/provider_implementations/overview.md diff --git a/vendor/sigs.k8s.io/cluster-api/docs/book/provider_implementations/register_controllers.md b/vendor/github.com/openshift/cluster-api/docs/book/provider_implementations/register_controllers.md similarity index 100% rename from vendor/sigs.k8s.io/cluster-api/docs/book/provider_implementations/register_controllers.md rename to vendor/github.com/openshift/cluster-api/docs/book/provider_implementations/register_controllers.md diff --git a/vendor/sigs.k8s.io/cluster-api/docs/book/provider_implementations/register_schemes.md b/vendor/github.com/openshift/cluster-api/docs/book/provider_implementations/register_schemes.md similarity index 100% rename from vendor/sigs.k8s.io/cluster-api/docs/book/provider_implementations/register_schemes.md rename to vendor/github.com/openshift/cluster-api/docs/book/provider_implementations/register_schemes.md diff --git a/vendor/sigs.k8s.io/cluster-api/docs/examples/cluster/cluster.yaml b/vendor/github.com/openshift/cluster-api/docs/examples/cluster/cluster.yaml similarity index 100% rename from vendor/sigs.k8s.io/cluster-api/docs/examples/cluster/cluster.yaml rename to vendor/github.com/openshift/cluster-api/docs/examples/cluster/cluster.yaml diff --git a/vendor/sigs.k8s.io/cluster-api/docs/examples/machine/machine.yaml b/vendor/github.com/openshift/cluster-api/docs/examples/machine/machine.yaml similarity index 100% rename from vendor/sigs.k8s.io/cluster-api/docs/examples/machine/machine.yaml rename to vendor/github.com/openshift/cluster-api/docs/examples/machine/machine.yaml diff --git a/vendor/sigs.k8s.io/cluster-api/docs/examples/machinedeployment/machinedeployment.yaml b/vendor/github.com/openshift/cluster-api/docs/examples/machinedeployment/machinedeployment.yaml similarity index 100% rename from vendor/sigs.k8s.io/cluster-api/docs/examples/machinedeployment/machinedeployment.yaml rename to vendor/github.com/openshift/cluster-api/docs/examples/machinedeployment/machinedeployment.yaml diff --git a/vendor/sigs.k8s.io/cluster-api/docs/examples/machineset/machineset.yaml b/vendor/github.com/openshift/cluster-api/docs/examples/machineset/machineset.yaml similarity index 100% rename from vendor/sigs.k8s.io/cluster-api/docs/examples/machineset/machineset.yaml rename to vendor/github.com/openshift/cluster-api/docs/examples/machineset/machineset.yaml diff --git a/vendor/sigs.k8s.io/cluster-api/docs/proposals/machine-api-proposal.md b/vendor/github.com/openshift/cluster-api/docs/proposals/machine-api-proposal.md similarity index 100% rename from vendor/sigs.k8s.io/cluster-api/docs/proposals/machine-api-proposal.md rename to vendor/github.com/openshift/cluster-api/docs/proposals/machine-api-proposal.md diff --git a/vendor/sigs.k8s.io/cluster-api/hack/boilerplate.go.txt b/vendor/github.com/openshift/cluster-api/hack/boilerplate.go.txt similarity index 100% rename from vendor/sigs.k8s.io/cluster-api/hack/boilerplate.go.txt rename to vendor/github.com/openshift/cluster-api/hack/boilerplate.go.txt diff --git a/vendor/sigs.k8s.io/cluster-api/hack/boilerplate/boilerplate.Dockerfile.txt b/vendor/github.com/openshift/cluster-api/hack/boilerplate/boilerplate.Dockerfile.txt similarity index 100% rename from vendor/sigs.k8s.io/cluster-api/hack/boilerplate/boilerplate.Dockerfile.txt rename to vendor/github.com/openshift/cluster-api/hack/boilerplate/boilerplate.Dockerfile.txt diff --git a/vendor/sigs.k8s.io/cluster-api/hack/boilerplate/boilerplate.Makefile.txt b/vendor/github.com/openshift/cluster-api/hack/boilerplate/boilerplate.Makefile.txt similarity index 100% rename from vendor/sigs.k8s.io/cluster-api/hack/boilerplate/boilerplate.Makefile.txt rename to vendor/github.com/openshift/cluster-api/hack/boilerplate/boilerplate.Makefile.txt diff --git a/vendor/sigs.k8s.io/cluster-api/hack/boilerplate/boilerplate.bzl.txt b/vendor/github.com/openshift/cluster-api/hack/boilerplate/boilerplate.bzl.txt similarity index 100% rename from vendor/sigs.k8s.io/cluster-api/hack/boilerplate/boilerplate.bzl.txt rename to vendor/github.com/openshift/cluster-api/hack/boilerplate/boilerplate.bzl.txt diff --git a/vendor/sigs.k8s.io/cluster-api/hack/boilerplate/boilerplate.go.txt b/vendor/github.com/openshift/cluster-api/hack/boilerplate/boilerplate.go.txt similarity index 100% rename from vendor/sigs.k8s.io/cluster-api/hack/boilerplate/boilerplate.go.txt rename to vendor/github.com/openshift/cluster-api/hack/boilerplate/boilerplate.go.txt diff --git a/vendor/sigs.k8s.io/cluster-api/hack/boilerplate/boilerplate.py.txt b/vendor/github.com/openshift/cluster-api/hack/boilerplate/boilerplate.py.txt similarity index 100% rename from vendor/sigs.k8s.io/cluster-api/hack/boilerplate/boilerplate.py.txt rename to vendor/github.com/openshift/cluster-api/hack/boilerplate/boilerplate.py.txt diff --git a/vendor/sigs.k8s.io/cluster-api/hack/boilerplate/boilerplate.sh.txt b/vendor/github.com/openshift/cluster-api/hack/boilerplate/boilerplate.sh.txt similarity index 100% rename from vendor/sigs.k8s.io/cluster-api/hack/boilerplate/boilerplate.sh.txt rename to vendor/github.com/openshift/cluster-api/hack/boilerplate/boilerplate.sh.txt diff --git a/vendor/sigs.k8s.io/cluster-api/hack/update-bazel.sh b/vendor/github.com/openshift/cluster-api/hack/update-bazel.sh similarity index 100% rename from vendor/sigs.k8s.io/cluster-api/hack/update-bazel.sh rename to vendor/github.com/openshift/cluster-api/hack/update-bazel.sh diff --git a/vendor/sigs.k8s.io/cluster-api/hack/verify-bazel.sh b/vendor/github.com/openshift/cluster-api/hack/verify-bazel.sh similarity index 100% rename from vendor/sigs.k8s.io/cluster-api/hack/verify-bazel.sh rename to vendor/github.com/openshift/cluster-api/hack/verify-bazel.sh diff --git a/vendor/sigs.k8s.io/cluster-api/hack/verify_boilerplate.py b/vendor/github.com/openshift/cluster-api/hack/verify_boilerplate.py similarity index 98% rename from vendor/sigs.k8s.io/cluster-api/hack/verify_boilerplate.py rename to vendor/github.com/openshift/cluster-api/hack/verify_boilerplate.py index 6ac800a88..22490fa89 100755 --- a/vendor/sigs.k8s.io/cluster-api/hack/verify_boilerplate.py +++ b/vendor/github.com/openshift/cluster-api/hack/verify_boilerplate.py @@ -157,7 +157,7 @@ def get_regexs(): # Search for "YEAR" which exists in the boilerplate, but shouldn't in the real thing regexs["year"] = re.compile('YEAR') # dates can be 2014, 2015, 2016, 2017 or 2018, company holder names can be anything - regexs["date"] = re.compile('(2014|2015|2016|2017|2018)') + regexs["date"] = re.compile('(2014|2015|2016|2017|2018|2019)') # strip // +build \n\n build constraints regexs["go_build_constraints"] = re.compile(r"^(// \+build.*\n)+\n", re.MULTILINE) # strip #!.* from shell/python scripts diff --git a/vendor/sigs.k8s.io/cluster-api/hack/verify_clientset.sh b/vendor/github.com/openshift/cluster-api/hack/verify_clientset.sh similarity index 100% rename from vendor/sigs.k8s.io/cluster-api/hack/verify_clientset.sh rename to vendor/github.com/openshift/cluster-api/hack/verify_clientset.sh diff --git a/vendor/sigs.k8s.io/cluster-api/pkg/apis/BUILD.bazel b/vendor/github.com/openshift/cluster-api/pkg/apis/BUILD.bazel similarity index 69% rename from vendor/sigs.k8s.io/cluster-api/pkg/apis/BUILD.bazel rename to vendor/github.com/openshift/cluster-api/pkg/apis/BUILD.bazel index 5fb1263e9..05e6c8def 100644 --- a/vendor/sigs.k8s.io/cluster-api/pkg/apis/BUILD.bazel +++ b/vendor/github.com/openshift/cluster-api/pkg/apis/BUILD.bazel @@ -4,12 +4,14 @@ go_library( name = "go_default_library", srcs = [ "addtoscheme_cluster_v1alpha1.go", + "addtoscheme_machine_v1beta1.go", "apis.go", ], - importpath = "sigs.k8s.io/cluster-api/pkg/apis", + importpath = "github.com/openshift/cluster-api/pkg/apis", visibility = ["//visibility:public"], deps = [ "//pkg/apis/cluster/v1alpha1:go_default_library", + "//pkg/apis/machine/v1beta1:go_default_library", "//vendor/k8s.io/apimachinery/pkg/runtime:go_default_library", ], ) diff --git a/vendor/sigs.k8s.io/cluster-api/pkg/apis/addtoscheme_cluster_v1alpha1.go b/vendor/github.com/openshift/cluster-api/pkg/apis/addtoscheme_cluster_v1alpha1.go similarity index 92% rename from vendor/sigs.k8s.io/cluster-api/pkg/apis/addtoscheme_cluster_v1alpha1.go rename to vendor/github.com/openshift/cluster-api/pkg/apis/addtoscheme_cluster_v1alpha1.go index 5c1ec47ea..bc92fbcaf 100644 --- a/vendor/sigs.k8s.io/cluster-api/pkg/apis/addtoscheme_cluster_v1alpha1.go +++ b/vendor/github.com/openshift/cluster-api/pkg/apis/addtoscheme_cluster_v1alpha1.go @@ -17,7 +17,7 @@ limitations under the License. package apis import ( - "sigs.k8s.io/cluster-api/pkg/apis/cluster/v1alpha1" + "github.com/openshift/cluster-api/pkg/apis/cluster/v1alpha1" ) func init() { diff --git a/vendor/github.com/openshift/cluster-api/pkg/apis/addtoscheme_machine_v1beta1.go b/vendor/github.com/openshift/cluster-api/pkg/apis/addtoscheme_machine_v1beta1.go new file mode 100644 index 000000000..45f12f062 --- /dev/null +++ b/vendor/github.com/openshift/cluster-api/pkg/apis/addtoscheme_machine_v1beta1.go @@ -0,0 +1,26 @@ +/* +Copyright 2018 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package apis + +import ( + "github.com/openshift/cluster-api/pkg/apis/machine/v1beta1" +) + +func init() { + // Register the types with the Scheme so the components can map objects to GroupVersionKinds and back + AddToSchemes = append(AddToSchemes, v1beta1.SchemeBuilder.AddToScheme) +} diff --git a/vendor/sigs.k8s.io/cluster-api/pkg/apis/apis.go b/vendor/github.com/openshift/cluster-api/pkg/apis/apis.go similarity index 100% rename from vendor/sigs.k8s.io/cluster-api/pkg/apis/apis.go rename to vendor/github.com/openshift/cluster-api/pkg/apis/apis.go diff --git a/vendor/sigs.k8s.io/cluster-api/pkg/apis/cluster/BUILD.bazel b/vendor/github.com/openshift/cluster-api/pkg/apis/cluster/BUILD.bazel similarity index 70% rename from vendor/sigs.k8s.io/cluster-api/pkg/apis/cluster/BUILD.bazel rename to vendor/github.com/openshift/cluster-api/pkg/apis/cluster/BUILD.bazel index f8a8882a7..f58dcf0c0 100644 --- a/vendor/sigs.k8s.io/cluster-api/pkg/apis/cluster/BUILD.bazel +++ b/vendor/github.com/openshift/cluster-api/pkg/apis/cluster/BUILD.bazel @@ -3,6 +3,6 @@ load("@io_bazel_rules_go//go:def.bzl", "go_library") go_library( name = "go_default_library", srcs = ["group.go"], - importpath = "sigs.k8s.io/cluster-api/pkg/apis/cluster", + importpath = "github.com/openshift/cluster-api/pkg/apis/cluster", visibility = ["//visibility:public"], ) diff --git a/vendor/github.com/openshift/cluster-api/pkg/apis/cluster/common/BUILD.bazel b/vendor/github.com/openshift/cluster-api/pkg/apis/cluster/common/BUILD.bazel new file mode 100644 index 000000000..ac9e600f3 --- /dev/null +++ b/vendor/github.com/openshift/cluster-api/pkg/apis/cluster/common/BUILD.bazel @@ -0,0 +1,15 @@ +load("@io_bazel_rules_go//go:def.bzl", "go_library") + +go_library( + name = "go_default_library", + srcs = [ + "consts.go", + "plugins.go", + ], + importpath = "github.com/openshift/cluster-api/pkg/apis/cluster/common", + visibility = ["//visibility:public"], + deps = [ + "//vendor/github.com/pkg/errors:go_default_library", + "//vendor/k8s.io/klog:go_default_library", + ], +) diff --git a/vendor/sigs.k8s.io/cluster-api/pkg/apis/cluster/common/consts.go b/vendor/github.com/openshift/cluster-api/pkg/apis/cluster/common/consts.go similarity index 91% rename from vendor/sigs.k8s.io/cluster-api/pkg/apis/cluster/common/consts.go rename to vendor/github.com/openshift/cluster-api/pkg/apis/cluster/common/consts.go index 81fed067f..287480250 100644 --- a/vendor/sigs.k8s.io/cluster-api/pkg/apis/cluster/common/consts.go +++ b/vendor/github.com/openshift/cluster-api/pkg/apis/cluster/common/consts.go @@ -58,6 +58,15 @@ const ( // // Example: cannot resolve EC2 IP address. DeleteMachineError MachineStatusError = "DeleteError" + + // This error indicates that the machine did not join the cluster + // as a new node within the expected timeframe after instance + // creation at the provider succeeded + // + // Example use case: A controller that deletes Machines which do + // not result in a Node joining the cluster within a given timeout + // and that are managed by a MachineSet + JoinClusterTimeoutMachineError = "JoinClusterTimeoutError" ) type ClusterStatusError string diff --git a/vendor/sigs.k8s.io/cluster-api/pkg/apis/cluster/common/plugins.go b/vendor/github.com/openshift/cluster-api/pkg/apis/cluster/common/plugins.go similarity index 93% rename from vendor/sigs.k8s.io/cluster-api/pkg/apis/cluster/common/plugins.go rename to vendor/github.com/openshift/cluster-api/pkg/apis/cluster/common/plugins.go index 276cbe9be..8c2083d88 100644 --- a/vendor/sigs.k8s.io/cluster-api/pkg/apis/cluster/common/plugins.go +++ b/vendor/github.com/openshift/cluster-api/pkg/apis/cluster/common/plugins.go @@ -17,9 +17,9 @@ limitations under the License. package common import ( - "fmt" "sync" + "github.com/pkg/errors" "k8s.io/klog" ) @@ -45,7 +45,7 @@ func ClusterProvisioner(name string) (interface{}, error) { defer providersMutex.Unlock() provisioner, found := providers[name] if !found { - return nil, fmt.Errorf("unable to find provisioner for %s", name) + return nil, errors.Errorf("unable to find provisioner for %s", name) } return provisioner, nil } diff --git a/vendor/sigs.k8s.io/cluster-api/pkg/apis/cluster/group.go b/vendor/github.com/openshift/cluster-api/pkg/apis/cluster/group.go similarity index 100% rename from vendor/sigs.k8s.io/cluster-api/pkg/apis/cluster/group.go rename to vendor/github.com/openshift/cluster-api/pkg/apis/cluster/group.go diff --git a/vendor/sigs.k8s.io/cluster-api/pkg/apis/cluster/v1alpha1/BUILD.bazel b/vendor/github.com/openshift/cluster-api/pkg/apis/cluster/v1alpha1/BUILD.bazel similarity index 96% rename from vendor/sigs.k8s.io/cluster-api/pkg/apis/cluster/v1alpha1/BUILD.bazel rename to vendor/github.com/openshift/cluster-api/pkg/apis/cluster/v1alpha1/BUILD.bazel index 074fbc10c..1e5c0f983 100644 --- a/vendor/sigs.k8s.io/cluster-api/pkg/apis/cluster/v1alpha1/BUILD.bazel +++ b/vendor/github.com/openshift/cluster-api/pkg/apis/cluster/v1alpha1/BUILD.bazel @@ -14,7 +14,7 @@ go_library( "register.go", "zz_generated.deepcopy.go", ], - importpath = "sigs.k8s.io/cluster-api/pkg/apis/cluster/v1alpha1", + importpath = "github.com/openshift/cluster-api/pkg/apis/cluster/v1alpha1", visibility = ["//visibility:public"], deps = [ "//pkg/apis/cluster/common:go_default_library", diff --git a/vendor/sigs.k8s.io/cluster-api/pkg/apis/cluster/v1alpha1/cluster_types.go b/vendor/github.com/openshift/cluster-api/pkg/apis/cluster/v1alpha1/cluster_types.go similarity index 98% rename from vendor/sigs.k8s.io/cluster-api/pkg/apis/cluster/v1alpha1/cluster_types.go rename to vendor/github.com/openshift/cluster-api/pkg/apis/cluster/v1alpha1/cluster_types.go index c0cd29a46..dae8b49ce 100644 --- a/vendor/sigs.k8s.io/cluster-api/pkg/apis/cluster/v1alpha1/cluster_types.go +++ b/vendor/github.com/openshift/cluster-api/pkg/apis/cluster/v1alpha1/cluster_types.go @@ -20,8 +20,8 @@ import ( metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/runtime" + "github.com/openshift/cluster-api/pkg/apis/cluster/common" "k8s.io/apimachinery/pkg/util/validation/field" - "sigs.k8s.io/cluster-api/pkg/apis/cluster/common" ) const ClusterFinalizer = "cluster.cluster.k8s.io" diff --git a/vendor/sigs.k8s.io/cluster-api/pkg/apis/cluster/v1alpha1/common_types.go b/vendor/github.com/openshift/cluster-api/pkg/apis/cluster/v1alpha1/common_types.go similarity index 100% rename from vendor/sigs.k8s.io/cluster-api/pkg/apis/cluster/v1alpha1/common_types.go rename to vendor/github.com/openshift/cluster-api/pkg/apis/cluster/v1alpha1/common_types.go diff --git a/vendor/sigs.k8s.io/cluster-api/pkg/apis/cluster/v1alpha1/defaults.go b/vendor/github.com/openshift/cluster-api/pkg/apis/cluster/v1alpha1/defaults.go similarity index 97% rename from vendor/sigs.k8s.io/cluster-api/pkg/apis/cluster/v1alpha1/defaults.go rename to vendor/github.com/openshift/cluster-api/pkg/apis/cluster/v1alpha1/defaults.go index f9aeb4b43..a64e64ab3 100644 --- a/vendor/sigs.k8s.io/cluster-api/pkg/apis/cluster/v1alpha1/defaults.go +++ b/vendor/github.com/openshift/cluster-api/pkg/apis/cluster/v1alpha1/defaults.go @@ -17,9 +17,9 @@ limitations under the License. package v1alpha1 import ( + "github.com/openshift/cluster-api/pkg/apis/cluster/common" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/util/intstr" - "sigs.k8s.io/cluster-api/pkg/apis/cluster/common" ) // PopulateDefaultsMachineDeployment fills in default field values diff --git a/vendor/sigs.k8s.io/cluster-api/pkg/apis/cluster/v1alpha1/doc.go b/vendor/github.com/openshift/cluster-api/pkg/apis/cluster/v1alpha1/doc.go similarity index 100% rename from vendor/sigs.k8s.io/cluster-api/pkg/apis/cluster/v1alpha1/doc.go rename to vendor/github.com/openshift/cluster-api/pkg/apis/cluster/v1alpha1/doc.go diff --git a/vendor/sigs.k8s.io/cluster-api/pkg/apis/cluster/v1alpha1/machine_types.go b/vendor/github.com/openshift/cluster-api/pkg/apis/cluster/v1alpha1/machine_types.go similarity index 74% rename from vendor/sigs.k8s.io/cluster-api/pkg/apis/cluster/v1alpha1/machine_types.go rename to vendor/github.com/openshift/cluster-api/pkg/apis/cluster/v1alpha1/machine_types.go index 5a10bba39..6c6cc4a3c 100644 --- a/vendor/sigs.k8s.io/cluster-api/pkg/apis/cluster/v1alpha1/machine_types.go +++ b/vendor/github.com/openshift/cluster-api/pkg/apis/cluster/v1alpha1/machine_types.go @@ -21,7 +21,7 @@ import ( metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/runtime" - "sigs.k8s.io/cluster-api/pkg/apis/cluster/common" + "github.com/openshift/cluster-api/pkg/apis/cluster/common" ) // Finalizer is set on PrepareForCreate callback @@ -47,19 +47,19 @@ type Machine struct { /// [MachineSpec] // MachineSpec defines the desired state of Machine type MachineSpec struct { - // This ObjectMeta will autopopulate the Node created. Use this to + // ObjectMeta will autopopulate the Node created. Use this to // indicate what labels, annotations, name prefix, etc., should be used // when creating the Node. // +optional metav1.ObjectMeta `json:"metadata,omitempty"` - // The full, authoritative list of taints to apply to the corresponding + // Taints is the full, authoritative list of taints to apply to the corresponding // Node. This list will overwrite any modifications made to the Node on // an ongoing basis. // +optional Taints []corev1.Taint `json:"taints,omitempty"` - // Provider-specific configuration to use during node creation. + // ProviderSpec details Provider-specific configuration to use during node creation. // +optional ProviderSpec ProviderSpec `json:"providerSpec"` @@ -72,7 +72,7 @@ type MachineSpec struct { // +optional Versions MachineVersionInfo `json:"versions,omitempty"` - // To populate in the associated Node for dynamic kubelet config. This + // ConfigSource is used to populate in the associated Node for dynamic kubelet config. This // field already exists in Node, so any updates to it in the Machine // spec will be automatically copied to the linked NodeRef from the // status. The rest of dynamic kubelet config support should then work @@ -86,15 +86,15 @@ type MachineSpec struct { /// [MachineStatus] // MachineStatus defines the observed state of Machine type MachineStatus struct { - // If the corresponding Node exists, this will point to its object. + // NodeRef will point to the corresponding Node if it exists. // +optional NodeRef *corev1.ObjectReference `json:"nodeRef,omitempty"` - // When was this status last observed + // LastUpdated identifies when this status was last observed. // +optional LastUpdated *metav1.Time `json:"lastUpdated,omitempty"` - // The current versions of software on the corresponding Node (if it + // Versions specifies the current versions of software on the corresponding Node (if it // exists). This is provided for a few reasons: // // 1) It is more convenient than checking the NodeRef, traversing it to @@ -104,20 +104,18 @@ type MachineStatus struct { // so that if the structure of Node.Status.NodeInfo changes, only // machine controllers need to be updated, rather than every client // of the Machines API. - // 3) There is no other simple way to check the ControlPlane + // 3) There is no other simple way to check the control plane // version. A client would have to connect directly to the apiserver // running on the target node in order to find out its version. // +optional Versions *MachineVersionInfo `json:"versions,omitempty"` - // In the event that there is a terminal problem reconciling the - // Machine, both ErrorReason and ErrorMessage will be set. ErrorReason - // will be populated with a succinct value suitable for machine - // interpretation, while ErrorMessage will contain a more verbose - // string suitable for logging and human consumption. + // ErrorReason will be set in the event that there is a terminal problem + // reconciling the Machine and will contain a succinct value suitable + // for machine interpretation. // - // These fields should not be set for transitive errors that a - // controller faces that are expected to be fixed automatically over + // This field should not be set for transitive errors that a controller + // faces that are expected to be fixed automatically over // time (like service outages), but instead indicate that something is // fundamentally wrong with the Machine's spec or the configuration of // the controller, and that manual intervention is required. Examples @@ -130,10 +128,27 @@ type MachineStatus struct { // controller's output. // +optional ErrorReason *common.MachineStatusError `json:"errorReason,omitempty"` + + // ErrorMessage will be set in the event that there is a terminal problem + // reconciling the Machine and will contain a more verbose string suitable + // for logging and human consumption. + // + // This field should not be set for transitive errors that a controller + // faces that are expected to be fixed automatically over + // time (like service outages), but instead indicate that something is + // fundamentally wrong with the Machine's spec or the configuration of + // the controller, and that manual intervention is required. Examples + // of terminal errors would be invalid combinations of settings in the + // spec, values that are unsupported by the controller, or the + // responsible controller itself being critically misconfigured. + // + // Any transient errors that occur during the reconciliation of Machines + // can be added as events to the Machine object and/or logged in the + // controller's output. // +optional ErrorMessage *string `json:"errorMessage,omitempty"` - // Provider-specific status. + // ProviderStatus details a Provider-specific status. // It is recommended that providers maintain their // own versioned API types that should be // serialized/deserialized from this field. @@ -144,7 +159,7 @@ type MachineStatus struct { // +optional Addresses []corev1.NodeAddress `json:"addresses,omitempty"` - // List of conditions synced from the node conditions of the corresponding node-object. + // Conditions lists the conditions synced from the node conditions of the corresponding node-object. // Machine-controller is responsible for keeping conditions up-to-date. // MachineSet controller will be taking these conditions as a signal to decide if // machine is healthy or needs to be replaced. @@ -170,7 +185,7 @@ type LastOperation struct { // Description is the human-readable description of the last operation. Description *string `json:"description,omitempty"` - // LastUpdateTime is the timestamp at which LastOperation API was last-updated. + // LastUpdated is the timestamp at which LastOperation API was last-updated. LastUpdated *metav1.Time `json:"lastUpdated,omitempty"` // State is the current status of the last performed operation. @@ -186,12 +201,12 @@ type LastOperation struct { /// [MachineVersionInfo] type MachineVersionInfo struct { - // Semantic version of kubelet to run + // Kubelet is the semantic version of kubelet to run Kubelet string `json:"kubelet"` - // Semantic version of the Kubernetes control plane to + // ControlPlane is the semantic version of the Kubernetes control plane to // run. This should only be populated when the machine is a - // master. + // control plane. // +optional ControlPlane string `json:"controlPlane,omitempty"` } diff --git a/vendor/sigs.k8s.io/cluster-api/pkg/apis/cluster/v1alpha1/machineclass_types.go b/vendor/github.com/openshift/cluster-api/pkg/apis/cluster/v1alpha1/machineclass_types.go similarity index 100% rename from vendor/sigs.k8s.io/cluster-api/pkg/apis/cluster/v1alpha1/machineclass_types.go rename to vendor/github.com/openshift/cluster-api/pkg/apis/cluster/v1alpha1/machineclass_types.go diff --git a/vendor/sigs.k8s.io/cluster-api/pkg/apis/cluster/v1alpha1/machinedeployment_types.go b/vendor/github.com/openshift/cluster-api/pkg/apis/cluster/v1alpha1/machinedeployment_types.go similarity index 99% rename from vendor/sigs.k8s.io/cluster-api/pkg/apis/cluster/v1alpha1/machinedeployment_types.go rename to vendor/github.com/openshift/cluster-api/pkg/apis/cluster/v1alpha1/machinedeployment_types.go index 690d095ad..be0cc25ff 100644 --- a/vendor/sigs.k8s.io/cluster-api/pkg/apis/cluster/v1alpha1/machinedeployment_types.go +++ b/vendor/github.com/openshift/cluster-api/pkg/apis/cluster/v1alpha1/machinedeployment_types.go @@ -20,7 +20,7 @@ import ( metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/util/intstr" - "sigs.k8s.io/cluster-api/pkg/apis/cluster/common" + "github.com/openshift/cluster-api/pkg/apis/cluster/common" ) /// [MachineDeploymentSpec] diff --git a/vendor/sigs.k8s.io/cluster-api/pkg/apis/cluster/v1alpha1/machineset_types.go b/vendor/github.com/openshift/cluster-api/pkg/apis/cluster/v1alpha1/machineset_types.go similarity index 99% rename from vendor/sigs.k8s.io/cluster-api/pkg/apis/cluster/v1alpha1/machineset_types.go rename to vendor/github.com/openshift/cluster-api/pkg/apis/cluster/v1alpha1/machineset_types.go index 40c04286a..95644395a 100644 --- a/vendor/sigs.k8s.io/cluster-api/pkg/apis/cluster/v1alpha1/machineset_types.go +++ b/vendor/github.com/openshift/cluster-api/pkg/apis/cluster/v1alpha1/machineset_types.go @@ -22,9 +22,9 @@ import ( metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" metav1validation "k8s.io/apimachinery/pkg/apis/meta/v1/validation" + "github.com/openshift/cluster-api/pkg/apis/cluster/common" "k8s.io/apimachinery/pkg/labels" "k8s.io/apimachinery/pkg/util/validation/field" - "sigs.k8s.io/cluster-api/pkg/apis/cluster/common" ) // +genclient diff --git a/vendor/sigs.k8s.io/cluster-api/pkg/apis/cluster/v1alpha1/register.go b/vendor/github.com/openshift/cluster-api/pkg/apis/cluster/v1alpha1/register.go similarity index 100% rename from vendor/sigs.k8s.io/cluster-api/pkg/apis/cluster/v1alpha1/register.go rename to vendor/github.com/openshift/cluster-api/pkg/apis/cluster/v1alpha1/register.go diff --git a/vendor/github.com/openshift/cluster-api/pkg/apis/cluster/v1alpha1/testutil/BUILD.bazel b/vendor/github.com/openshift/cluster-api/pkg/apis/cluster/v1alpha1/testutil/BUILD.bazel new file mode 100644 index 000000000..d128bab6c --- /dev/null +++ b/vendor/github.com/openshift/cluster-api/pkg/apis/cluster/v1alpha1/testutil/BUILD.bazel @@ -0,0 +1,9 @@ +load("@io_bazel_rules_go//go:def.bzl", "go_library") + +go_library( + name = "go_default_library", + srcs = ["testutil.go"], + importpath = "github.com/openshift/cluster-api/pkg/apis/cluster/v1alpha1/testutil", + visibility = ["//visibility:public"], + deps = ["//pkg/apis/cluster/v1alpha1:go_default_library"], +) diff --git a/vendor/sigs.k8s.io/cluster-api/pkg/apis/cluster/v1alpha1/testutil/testutil.go b/vendor/github.com/openshift/cluster-api/pkg/apis/cluster/v1alpha1/testutil/testutil.go similarity index 93% rename from vendor/sigs.k8s.io/cluster-api/pkg/apis/cluster/v1alpha1/testutil/testutil.go rename to vendor/github.com/openshift/cluster-api/pkg/apis/cluster/v1alpha1/testutil/testutil.go index 2af50c96d..9bfeaed98 100644 --- a/vendor/sigs.k8s.io/cluster-api/pkg/apis/cluster/v1alpha1/testutil/testutil.go +++ b/vendor/github.com/openshift/cluster-api/pkg/apis/cluster/v1alpha1/testutil/testutil.go @@ -16,7 +16,7 @@ limitations under the License. package testutil -import "sigs.k8s.io/cluster-api/pkg/apis/cluster/v1alpha1" +import "github.com/openshift/cluster-api/pkg/apis/cluster/v1alpha1" // GetVanillaCluster return a bare minimum functional cluster resource object func GetVanillaCluster() v1alpha1.Cluster { diff --git a/vendor/sigs.k8s.io/cluster-api/pkg/apis/cluster/v1alpha1/zz_generated.deepcopy.go b/vendor/github.com/openshift/cluster-api/pkg/apis/cluster/v1alpha1/zz_generated.deepcopy.go similarity index 99% rename from vendor/sigs.k8s.io/cluster-api/pkg/apis/cluster/v1alpha1/zz_generated.deepcopy.go rename to vendor/github.com/openshift/cluster-api/pkg/apis/cluster/v1alpha1/zz_generated.deepcopy.go index 9b0a03520..fd8e1f63a 100644 --- a/vendor/sigs.k8s.io/cluster-api/pkg/apis/cluster/v1alpha1/zz_generated.deepcopy.go +++ b/vendor/github.com/openshift/cluster-api/pkg/apis/cluster/v1alpha1/zz_generated.deepcopy.go @@ -21,10 +21,10 @@ limitations under the License. package v1alpha1 import ( + common "github.com/openshift/cluster-api/pkg/apis/cluster/common" v1 "k8s.io/api/core/v1" runtime "k8s.io/apimachinery/pkg/runtime" intstr "k8s.io/apimachinery/pkg/util/intstr" - common "sigs.k8s.io/cluster-api/pkg/apis/cluster/common" ) // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. diff --git a/vendor/sigs.k8s.io/cluster-api/cmd/clusterctl/clusterdeployer/bootstrap/BUILD.bazel b/vendor/github.com/openshift/cluster-api/pkg/apis/machine/BUILD.bazel similarity index 55% rename from vendor/sigs.k8s.io/cluster-api/cmd/clusterctl/clusterdeployer/bootstrap/BUILD.bazel rename to vendor/github.com/openshift/cluster-api/pkg/apis/machine/BUILD.bazel index b5f66c2d0..c47e656b7 100644 --- a/vendor/sigs.k8s.io/cluster-api/cmd/clusterctl/clusterdeployer/bootstrap/BUILD.bazel +++ b/vendor/github.com/openshift/cluster-api/pkg/apis/machine/BUILD.bazel @@ -2,7 +2,7 @@ load("@io_bazel_rules_go//go:def.bzl", "go_library") go_library( name = "go_default_library", - srcs = ["provisioner.go"], - importpath = "sigs.k8s.io/cluster-api/cmd/clusterctl/clusterdeployer/bootstrap", + srcs = ["group.go"], + importpath = "github.com/openshift/cluster-api/pkg/apis/machine", visibility = ["//visibility:public"], ) diff --git a/vendor/github.com/openshift/cluster-api/pkg/apis/machine/common/BUILD.bazel b/vendor/github.com/openshift/cluster-api/pkg/apis/machine/common/BUILD.bazel new file mode 100644 index 000000000..311c852d4 --- /dev/null +++ b/vendor/github.com/openshift/cluster-api/pkg/apis/machine/common/BUILD.bazel @@ -0,0 +1,15 @@ +load("@io_bazel_rules_go//go:def.bzl", "go_library") + +go_library( + name = "go_default_library", + srcs = [ + "consts.go", + "plugins.go", + ], + importpath = "github.com/openshift/cluster-api/pkg/apis/machine/common", + visibility = ["//visibility:public"], + deps = [ + "//vendor/github.com/pkg/errors:go_default_library", + "//vendor/k8s.io/klog:go_default_library", + ], +) diff --git a/vendor/github.com/openshift/cluster-api/pkg/apis/machine/common/consts.go b/vendor/github.com/openshift/cluster-api/pkg/apis/machine/common/consts.go new file mode 100644 index 000000000..287480250 --- /dev/null +++ b/vendor/github.com/openshift/cluster-api/pkg/apis/machine/common/consts.go @@ -0,0 +1,114 @@ +/* +Copyright 2018 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package common + +// Constants aren't automatically generated for unversioned packages. +// Instead share the same constant for all versioned packages +type MachineStatusError string + +const ( + // Represents that the combination of configuration in the MachineSpec + // is not supported by this cluster. This is not a transient error, but + // indicates a state that must be fixed before progress can be made. + // + // Example: the ProviderSpec specifies an instance type that doesn't exist, + InvalidConfigurationMachineError MachineStatusError = "InvalidConfiguration" + + // This indicates that the MachineSpec has been updated in a way that + // is not supported for reconciliation on this cluster. The spec may be + // completely valid from a configuration standpoint, but the controller + // does not support changing the real world state to match the new + // spec. + // + // Example: the responsible controller is not capable of changing the + // container runtime from docker to rkt. + UnsupportedChangeMachineError MachineStatusError = "UnsupportedChange" + + // This generally refers to exceeding one's quota in a cloud provider, + // or running out of physical machines in an on-premise environment. + InsufficientResourcesMachineError MachineStatusError = "InsufficientResources" + + // There was an error while trying to create a Node to match this + // Machine. This may indicate a transient problem that will be fixed + // automatically with time, such as a service outage, or a terminal + // error during creation that doesn't match a more specific + // MachineStatusError value. + // + // Example: timeout trying to connect to GCE. + CreateMachineError MachineStatusError = "CreateError" + + // An error was encountered while trying to delete the Node that this + // Machine represents. This could be a transient or terminal error, but + // will only be observable if the provider's Machine controller has + // added a finalizer to the object to more gracefully handle deletions. + // + // Example: cannot resolve EC2 IP address. + DeleteMachineError MachineStatusError = "DeleteError" + + // This error indicates that the machine did not join the cluster + // as a new node within the expected timeframe after instance + // creation at the provider succeeded + // + // Example use case: A controller that deletes Machines which do + // not result in a Node joining the cluster within a given timeout + // and that are managed by a MachineSet + JoinClusterTimeoutMachineError = "JoinClusterTimeoutError" +) + +type ClusterStatusError string + +const ( + // InvalidConfigurationClusterError indicates that the cluster + // configuration is invalid. + InvalidConfigurationClusterError ClusterStatusError = "InvalidConfiguration" + + // UnsupportedChangeClusterError indicates that the cluster + // spec has been updated in an unsupported way. That cannot be + // reconciled. + UnsupportedChangeClusterError ClusterStatusError = "UnsupportedChange" + + // CreateClusterError indicates that an error was encountered + // when trying to create the cluster. + CreateClusterError ClusterStatusError = "CreateError" + + // UpdateClusterError indicates that an error was encountered + // when trying to update the cluster. + UpdateClusterError ClusterStatusError = "UpdateError" + + // DeleteClusterError indicates that an error was encountered + // when trying to delete the cluster. + DeleteClusterError ClusterStatusError = "DeleteError" +) + +type MachineSetStatusError string + +const ( + // Represents that the combination of configuration in the MachineTemplateSpec + // is not supported by this cluster. This is not a transient error, but + // indicates a state that must be fixed before progress can be made. + // + // Example: the ProviderSpec specifies an instance type that doesn't exist. + InvalidConfigurationMachineSetError MachineSetStatusError = "InvalidConfiguration" +) + +type MachineDeploymentStrategyType string + +const ( + // Replace the old MachineSet by new one using rolling update + // i.e. gradually scale down the old MachineSet and scale up the new one. + RollingUpdateMachineDeploymentStrategyType MachineDeploymentStrategyType = "RollingUpdate" +) diff --git a/vendor/github.com/openshift/cluster-api/pkg/apis/machine/common/plugins.go b/vendor/github.com/openshift/cluster-api/pkg/apis/machine/common/plugins.go new file mode 100644 index 000000000..8c2083d88 --- /dev/null +++ b/vendor/github.com/openshift/cluster-api/pkg/apis/machine/common/plugins.go @@ -0,0 +1,51 @@ +/* +Copyright 2018 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package common + +import ( + "sync" + + "github.com/pkg/errors" + "k8s.io/klog" +) + +var ( + providersMutex sync.Mutex + providers = make(map[string]interface{}) +) + +// RegisterClusterProvisioner registers a ClusterProvisioner by name. This +// is expected to happen during app startup. +func RegisterClusterProvisioner(name string, provisioner interface{}) { + providersMutex.Lock() + defer providersMutex.Unlock() + if _, found := providers[name]; found { + klog.Fatalf("Cluster provisioner %q was registered twice", name) + } + klog.V(1).Infof("Registered cluster provisioner %q", name) + providers[name] = provisioner +} + +func ClusterProvisioner(name string) (interface{}, error) { + providersMutex.Lock() + defer providersMutex.Unlock() + provisioner, found := providers[name] + if !found { + return nil, errors.Errorf("unable to find provisioner for %s", name) + } + return provisioner, nil +} diff --git a/vendor/github.com/openshift/cluster-api/pkg/apis/machine/group.go b/vendor/github.com/openshift/cluster-api/pkg/apis/machine/group.go new file mode 100644 index 000000000..6c4be57b0 --- /dev/null +++ b/vendor/github.com/openshift/cluster-api/pkg/apis/machine/group.go @@ -0,0 +1,18 @@ +/* +Copyright 2018 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Package machine contains machine API versions +package machine diff --git a/vendor/github.com/openshift/cluster-api/pkg/apis/machine/v1beta1/BUILD.bazel b/vendor/github.com/openshift/cluster-api/pkg/apis/machine/v1beta1/BUILD.bazel new file mode 100644 index 000000000..3fc6c32d0 --- /dev/null +++ b/vendor/github.com/openshift/cluster-api/pkg/apis/machine/v1beta1/BUILD.bazel @@ -0,0 +1,52 @@ +load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test") + +go_library( + name = "go_default_library", + srcs = [ + "cluster_types.go", + "common_types.go", + "defaults.go", + "doc.go", + "machine_types.go", + "machineclass_types.go", + "machinedeployment_types.go", + "machineset_types.go", + "register.go", + "zz_generated.deepcopy.go", + ], + importpath = "github.com/openshift/cluster-api/pkg/apis/machine/v1beta1", + visibility = ["//visibility:public"], + deps = [ + "//pkg/apis/machine/common:go_default_library", + "//vendor/k8s.io/api/core/v1:go_default_library", + "//vendor/k8s.io/apimachinery/pkg/apis/meta/v1:go_default_library", + "//vendor/k8s.io/apimachinery/pkg/apis/meta/v1/validation:go_default_library", + "//vendor/k8s.io/apimachinery/pkg/labels:go_default_library", + "//vendor/k8s.io/apimachinery/pkg/runtime:go_default_library", + "//vendor/k8s.io/apimachinery/pkg/runtime/schema:go_default_library", + "//vendor/k8s.io/apimachinery/pkg/util/intstr:go_default_library", + "//vendor/k8s.io/apimachinery/pkg/util/validation/field:go_default_library", + "//vendor/sigs.k8s.io/controller-runtime/pkg/runtime/scheme:go_default_library", + ], +) + +go_test( + name = "go_default_test", + srcs = [ + "cluster_types_test.go", + "machine_types_test.go", + "machinedeployment_types_test.go", + "machineset_types_test.go", + "v1alpha1_suite_test.go", + ], + embed = [":go_default_library"], + deps = [ + "//vendor/golang.org/x/net/context:go_default_library", + "//vendor/k8s.io/apimachinery/pkg/apis/meta/v1:go_default_library", + "//vendor/k8s.io/apimachinery/pkg/types:go_default_library", + "//vendor/k8s.io/client-go/kubernetes/scheme:go_default_library", + "//vendor/k8s.io/client-go/rest:go_default_library", + "//vendor/sigs.k8s.io/controller-runtime/pkg/client:go_default_library", + "//vendor/sigs.k8s.io/controller-runtime/pkg/envtest:go_default_library", + ], +) diff --git a/vendor/github.com/openshift/cluster-api/pkg/apis/machine/v1beta1/cluster_types.go b/vendor/github.com/openshift/cluster-api/pkg/apis/machine/v1beta1/cluster_types.go new file mode 100644 index 000000000..134a63abb --- /dev/null +++ b/vendor/github.com/openshift/cluster-api/pkg/apis/machine/v1beta1/cluster_types.go @@ -0,0 +1,165 @@ +/* +Copyright 2018 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package v1beta1 + +import ( + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/runtime" + + "github.com/openshift/cluster-api/pkg/apis/machine/common" + "k8s.io/apimachinery/pkg/util/validation/field" +) + +const ClusterFinalizer = "cluster.machine.openshift.io" + +// +genclient +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object + +/// [Cluster] +// Cluster is the Schema for the clusters API +// +k8s:openapi-gen=true +// +kubebuilder:subresource:status +type Cluster struct { + metav1.TypeMeta `json:",inline"` + metav1.ObjectMeta `json:"metadata,omitempty"` + + Spec ClusterSpec `json:"spec,omitempty"` + Status ClusterStatus `json:"status,omitempty"` +} + +/// [Cluster] + +/// [ClusterSpec] +// ClusterSpec defines the desired state of Cluster +type ClusterSpec struct { + // Cluster network configuration + ClusterNetwork ClusterNetworkingConfig `json:"clusterNetwork"` + + // Provider-specific serialized configuration to use during + // cluster creation. It is recommended that providers maintain + // their own versioned API types that should be + // serialized/deserialized from this field. + // +optional + ProviderSpec ProviderSpec `json:"providerSpec,omitempty"` +} + +/// [ClusterSpec] + +/// [ClusterNetworkingConfig] +// ClusterNetworkingConfig specifies the different networking +// parameters for a cluster. +type ClusterNetworkingConfig struct { + // The network ranges from which service VIPs are allocated. + Services NetworkRanges `json:"services"` + + // The network ranges from which Pod networks are allocated. + Pods NetworkRanges `json:"pods"` + + // Domain name for services. + ServiceDomain string `json:"serviceDomain"` +} + +/// [ClusterNetworkingConfig] + +/// [NetworkRanges] +// NetworkRanges represents ranges of network addresses. +type NetworkRanges struct { + CIDRBlocks []string `json:"cidrBlocks"` +} + +/// [NetworkRanges] + +/// [ClusterStatus] +// ClusterStatus defines the observed state of Cluster +type ClusterStatus struct { + // APIEndpoint represents the endpoint to communicate with the IP. + // +optional + APIEndpoints []APIEndpoint `json:"apiEndpoints,omitempty"` + + // NB: Eventually we will redefine ErrorReason as ClusterStatusError once the + // following issue is fixed. + // https://github.com/kubernetes-incubator/apiserver-builder/issues/176 + + // If set, indicates that there is a problem reconciling the + // state, and will be set to a token value suitable for + // programmatic interpretation. + // +optional + ErrorReason common.ClusterStatusError `json:"errorReason,omitempty"` + + // If set, indicates that there is a problem reconciling the + // state, and will be set to a descriptive error message. + // +optional + ErrorMessage string `json:"errorMessage,omitempty"` + + // Provider-specific status. + // It is recommended that providers maintain their + // own versioned API types that should be + // serialized/deserialized from this field. + // +optional + ProviderStatus *runtime.RawExtension `json:"providerStatus,omitempty"` +} + +/// [ClusterStatus] + +/// [APIEndpoint] +// APIEndpoint represents a reachable Kubernetes API endpoint. +type APIEndpoint struct { + // The hostname on which the API server is serving. + Host string `json:"host"` + + // The port on which the API server is serving. + Port int `json:"port"` +} + +/// [APIEndpoint] + +func (o *Cluster) Validate() field.ErrorList { + errors := field.ErrorList{} + // perform validation here and add to errors using field.Invalid + if o.Spec.ClusterNetwork.ServiceDomain == "" { + errors = append(errors, field.Invalid( + field.NewPath("Spec", "ClusterNetwork", "ServiceDomain"), + o.Spec.ClusterNetwork.ServiceDomain, + "invalid cluster configuration: missing Cluster.Spec.ClusterNetwork.ServiceDomain")) + } + if len(o.Spec.ClusterNetwork.Pods.CIDRBlocks) == 0 { + errors = append(errors, field.Invalid( + field.NewPath("Spec", "ClusterNetwork", "Pods"), + o.Spec.ClusterNetwork.Pods, + "invalid cluster configuration: missing Cluster.Spec.ClusterNetwork.Pods")) + } + if len(o.Spec.ClusterNetwork.Services.CIDRBlocks) == 0 { + errors = append(errors, field.Invalid( + field.NewPath("Spec", "ClusterNetwork", "Services"), + o.Spec.ClusterNetwork.Services, + "invalid cluster configuration: missing Cluster.Spec.ClusterNetwork.Services")) + } + return errors +} + +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object + +// ClusterList contains a list of Cluster +type ClusterList struct { + metav1.TypeMeta `json:",inline"` + metav1.ListMeta `json:"metadata,omitempty"` + Items []Cluster `json:"items"` +} + +func init() { + SchemeBuilder.Register(&Cluster{}, &ClusterList{}) +} diff --git a/vendor/github.com/openshift/cluster-api/pkg/apis/machine/v1beta1/common_types.go b/vendor/github.com/openshift/cluster-api/pkg/apis/machine/v1beta1/common_types.go new file mode 100644 index 000000000..788475410 --- /dev/null +++ b/vendor/github.com/openshift/cluster-api/pkg/apis/machine/v1beta1/common_types.go @@ -0,0 +1,58 @@ +/* +Copyright 2018 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package v1beta1 + +import ( + corev1 "k8s.io/api/core/v1" + runtime "k8s.io/apimachinery/pkg/runtime" +) + +// ProviderSpec defines the configuration to use during node creation. +type ProviderSpec struct { + + // No more than one of the following may be specified. + + // Value is an inlined, serialized representation of the resource + // configuration. It is recommended that providers maintain their own + // versioned API types that should be serialized/deserialized from this + // field, akin to component config. + // +optional + Value *runtime.RawExtension `json:"value,omitempty"` + + // Source for the provider configuration. Cannot be used if value is + // not empty. + // +optional + ValueFrom *ProviderSpecSource `json:"valueFrom,omitempty"` +} + +// ProviderSpecSource represents a source for the provider-specific +// resource configuration. +type ProviderSpecSource struct { + // The machine class from which the provider config should be sourced. + // +optional + MachineClass *MachineClassRef `json:"machineClass,omitempty"` +} + +// MachineClassRef is a reference to the MachineClass object. Controllers should find the right MachineClass using this reference. +type MachineClassRef struct { + // +optional + *corev1.ObjectReference `json:",inline"` + + // Provider is the name of the cloud-provider which MachineClass is intended for. + // +optional + Provider string `json:"provider,omitempty"` +} diff --git a/vendor/github.com/openshift/cluster-api/pkg/apis/machine/v1beta1/defaults.go b/vendor/github.com/openshift/cluster-api/pkg/apis/machine/v1beta1/defaults.go new file mode 100644 index 000000000..354cfa3f6 --- /dev/null +++ b/vendor/github.com/openshift/cluster-api/pkg/apis/machine/v1beta1/defaults.go @@ -0,0 +1,74 @@ +/* +Copyright 2018 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package v1beta1 + +import ( + "github.com/openshift/cluster-api/pkg/apis/machine/common" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/util/intstr" +) + +// PopulateDefaultsMachineDeployment fills in default field values +// Currently it is called after reading objects, but it could be called in an admission webhook also +func PopulateDefaultsMachineDeployment(d *MachineDeployment) { + if d.Spec.Replicas == nil { + d.Spec.Replicas = new(int32) + *d.Spec.Replicas = 1 + } + + if d.Spec.MinReadySeconds == nil { + d.Spec.MinReadySeconds = new(int32) + *d.Spec.MinReadySeconds = 0 + } + + if d.Spec.RevisionHistoryLimit == nil { + d.Spec.RevisionHistoryLimit = new(int32) + *d.Spec.RevisionHistoryLimit = 1 + } + + if d.Spec.ProgressDeadlineSeconds == nil { + d.Spec.ProgressDeadlineSeconds = new(int32) + *d.Spec.ProgressDeadlineSeconds = 600 + } + + if d.Spec.Strategy == nil { + d.Spec.Strategy = &MachineDeploymentStrategy{} + } + + if d.Spec.Strategy.Type == "" { + d.Spec.Strategy.Type = common.RollingUpdateMachineDeploymentStrategyType + } + + // Default RollingUpdate strategy only if strategy type is RollingUpdate. + if d.Spec.Strategy.Type == common.RollingUpdateMachineDeploymentStrategyType { + if d.Spec.Strategy.RollingUpdate == nil { + d.Spec.Strategy.RollingUpdate = &MachineRollingUpdateDeployment{} + } + if d.Spec.Strategy.RollingUpdate.MaxSurge == nil { + ios1 := intstr.FromInt(1) + d.Spec.Strategy.RollingUpdate.MaxSurge = &ios1 + } + if d.Spec.Strategy.RollingUpdate.MaxUnavailable == nil { + ios0 := intstr.FromInt(0) + d.Spec.Strategy.RollingUpdate.MaxUnavailable = &ios0 + } + } + + if len(d.Namespace) == 0 { + d.Namespace = metav1.NamespaceDefault + } +} diff --git a/vendor/github.com/openshift/cluster-api/pkg/apis/machine/v1beta1/doc.go b/vendor/github.com/openshift/cluster-api/pkg/apis/machine/v1beta1/doc.go new file mode 100644 index 000000000..ca985dc5b --- /dev/null +++ b/vendor/github.com/openshift/cluster-api/pkg/apis/machine/v1beta1/doc.go @@ -0,0 +1,23 @@ +/* +Copyright 2018 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Package v1beta1 contains API Schema definitions for the machine v1beta1 API group +// +k8s:openapi-gen=true +// +k8s:deepcopy-gen=package,register +// +k8s:conversion-gen=sigs.k8s.io/cluster-api/pkg/apis/machine +// +k8s:defaulter-gen=TypeMeta +// +groupName=machine.openshift.io +package v1beta1 diff --git a/vendor/github.com/openshift/cluster-api/pkg/apis/machine/v1beta1/machine_types.go b/vendor/github.com/openshift/cluster-api/pkg/apis/machine/v1beta1/machine_types.go new file mode 100644 index 000000000..657d7aeea --- /dev/null +++ b/vendor/github.com/openshift/cluster-api/pkg/apis/machine/v1beta1/machine_types.go @@ -0,0 +1,227 @@ +/* +Copyright 2018 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package v1beta1 + +import ( + corev1 "k8s.io/api/core/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/runtime" + + "github.com/openshift/cluster-api/pkg/apis/machine/common" +) + +// Finalizer is set on PrepareForCreate callback +const MachineFinalizer = "machine.machine.openshift.io" + +// +genclient +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object + +/// [Machine] +// Machine is the Schema for the machines API +// +k8s:openapi-gen=true +// +kubebuilder:subresource:status +type Machine struct { + metav1.TypeMeta `json:",inline"` + metav1.ObjectMeta `json:"metadata,omitempty"` + + Spec MachineSpec `json:"spec,omitempty"` + Status MachineStatus `json:"status,omitempty"` +} + +/// [Machine] + +/// [MachineSpec] +// MachineSpec defines the desired state of Machine +type MachineSpec struct { + // ObjectMeta will autopopulate the Node created. Use this to + // indicate what labels, annotations, name prefix, etc., should be used + // when creating the Node. + // +optional + metav1.ObjectMeta `json:"metadata,omitempty"` + + // Taints is the full, authoritative list of taints to apply to the corresponding + // Node. This list will overwrite any modifications made to the Node on + // an ongoing basis. + // +optional + Taints []corev1.Taint `json:"taints,omitempty"` + + // ProviderSpec details Provider-specific configuration to use during node creation. + // +optional + ProviderSpec ProviderSpec `json:"providerSpec"` + + // Versions of key software to use. This field is optional at cluster + // creation time, and omitting the field indicates that the cluster + // installation tool should select defaults for the user. These + // defaults may differ based on the cluster installer, but the tool + // should populate the values it uses when persisting Machine objects. + // A Machine spec missing this field at runtime is invalid. + // +optional + Versions MachineVersionInfo `json:"versions,omitempty"` + + // ConfigSource is used to populate in the associated Node for dynamic kubelet config. This + // field already exists in Node, so any updates to it in the Machine + // spec will be automatically copied to the linked NodeRef from the + // status. The rest of dynamic kubelet config support should then work + // as-is. + // +optional + ConfigSource *corev1.NodeConfigSource `json:"configSource,omitempty"` +} + +/// [MachineSpec] + +/// [MachineStatus] +// MachineStatus defines the observed state of Machine +type MachineStatus struct { + // NodeRef will point to the corresponding Node if it exists. + // +optional + NodeRef *corev1.ObjectReference `json:"nodeRef,omitempty"` + + // LastUpdated identifies when this status was last observed. + // +optional + LastUpdated *metav1.Time `json:"lastUpdated,omitempty"` + + // Versions specifies the current versions of software on the corresponding Node (if it + // exists). This is provided for a few reasons: + // + // 1) It is more convenient than checking the NodeRef, traversing it to + // the Node, and finding the appropriate field in Node.Status.NodeInfo + // (which uses different field names and formatting). + // 2) It removes some of the dependency on the structure of the Node, + // so that if the structure of Node.Status.NodeInfo changes, only + // machine controllers need to be updated, rather than every client + // of the Machines API. + // 3) There is no other simple way to check the control plane + // version. A client would have to connect directly to the apiserver + // running on the target node in order to find out its version. + // +optional + Versions *MachineVersionInfo `json:"versions,omitempty"` + + // ErrorReason will be set in the event that there is a terminal problem + // reconciling the Machine and will contain a succinct value suitable + // for machine interpretation. + // + // This field should not be set for transitive errors that a controller + // faces that are expected to be fixed automatically over + // time (like service outages), but instead indicate that something is + // fundamentally wrong with the Machine's spec or the configuration of + // the controller, and that manual intervention is required. Examples + // of terminal errors would be invalid combinations of settings in the + // spec, values that are unsupported by the controller, or the + // responsible controller itself being critically misconfigured. + // + // Any transient errors that occur during the reconciliation of Machines + // can be added as events to the Machine object and/or logged in the + // controller's output. + // +optional + ErrorReason *common.MachineStatusError `json:"errorReason,omitempty"` + + // ErrorMessage will be set in the event that there is a terminal problem + // reconciling the Machine and will contain a more verbose string suitable + // for logging and human consumption. + // + // This field should not be set for transitive errors that a controller + // faces that are expected to be fixed automatically over + // time (like service outages), but instead indicate that something is + // fundamentally wrong with the Machine's spec or the configuration of + // the controller, and that manual intervention is required. Examples + // of terminal errors would be invalid combinations of settings in the + // spec, values that are unsupported by the controller, or the + // responsible controller itself being critically misconfigured. + // + // Any transient errors that occur during the reconciliation of Machines + // can be added as events to the Machine object and/or logged in the + // controller's output. + // +optional + ErrorMessage *string `json:"errorMessage,omitempty"` + + // ProviderStatus details a Provider-specific status. + // It is recommended that providers maintain their + // own versioned API types that should be + // serialized/deserialized from this field. + // +optional + ProviderStatus *runtime.RawExtension `json:"providerStatus,omitempty"` + + // Addresses is a list of addresses assigned to the machine. Queried from cloud provider, if available. + // +optional + Addresses []corev1.NodeAddress `json:"addresses,omitempty"` + + // Conditions lists the conditions synced from the node conditions of the corresponding node-object. + // Machine-controller is responsible for keeping conditions up-to-date. + // MachineSet controller will be taking these conditions as a signal to decide if + // machine is healthy or needs to be replaced. + // Refer: https://kubernetes.io/docs/concepts/architecture/nodes/#condition + // +optional + Conditions []corev1.NodeCondition `json:"conditions,omitempty"` + + // LastOperation describes the last-operation performed by the machine-controller. + // This API should be useful as a history in terms of the latest operation performed on the + // specific machine. It should also convey the state of the latest-operation for example if + // it is still on-going, failed or completed successfully. + // +optional + LastOperation *LastOperation `json:"lastOperation,omitempty"` + + // Phase represents the current phase of machine actuation. + // E.g. Pending, Running, Terminating, Failed etc. + // +optional + Phase *string `json:"phase,omitempty"` +} + +// LastOperation represents the detail of the last performed operation on the MachineObject. +type LastOperation struct { + // Description is the human-readable description of the last operation. + Description *string `json:"description,omitempty"` + + // LastUpdated is the timestamp at which LastOperation API was last-updated. + LastUpdated *metav1.Time `json:"lastUpdated,omitempty"` + + // State is the current status of the last performed operation. + // E.g. Processing, Failed, Successful etc + State *string `json:"state,omitempty"` + + // Type is the type of operation which was last performed. + // E.g. Create, Delete, Update etc + Type *string `json:"type,omitempty"` +} + +/// [MachineStatus] + +/// [MachineVersionInfo] +type MachineVersionInfo struct { + // Kubelet is the semantic version of kubelet to run + Kubelet string `json:"kubelet"` + + // ControlPlane is the semantic version of the Kubernetes control plane to + // run. This should only be populated when the machine is a + // control plane. + // +optional + ControlPlane string `json:"controlPlane,omitempty"` +} + +/// [MachineVersionInfo] + +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object + +// MachineList contains a list of Machine +type MachineList struct { + metav1.TypeMeta `json:",inline"` + metav1.ListMeta `json:"metadata,omitempty"` + Items []Machine `json:"items"` +} + +func init() { + SchemeBuilder.Register(&Machine{}, &MachineList{}) +} diff --git a/vendor/github.com/openshift/cluster-api/pkg/apis/machine/v1beta1/machineclass_types.go b/vendor/github.com/openshift/cluster-api/pkg/apis/machine/v1beta1/machineclass_types.go new file mode 100644 index 000000000..85a1ea37d --- /dev/null +++ b/vendor/github.com/openshift/cluster-api/pkg/apis/machine/v1beta1/machineclass_types.go @@ -0,0 +1,78 @@ +/* +Copyright 2018 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package v1beta1 + +import ( + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/runtime" +) + +// +genclient +// +genclient:noStatus +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object + +/// [MachineClass] +// MachineClass can be used to templatize and re-use provider configuration +// across multiple Machines / MachineSets / MachineDeployments. +// +k8s:openapi-gen=true +// +resource:path=machineclasses +type MachineClass struct { + metav1.TypeMeta `json:",inline"` + // +optional + metav1.ObjectMeta `json:"metadata,omitempty"` + + // The total capacity available on this machine type (cpu/memory/disk). + // + // WARNING: It is up to the creator of the MachineClass to ensure that + // this field is consistent with the underlying machine that will + // be provisioned when this class is used, to inform higher level + // automation (e.g. the cluster autoscaler). + // TODO(hardikdr) Add allocatable field once requirements are clear from autoscaler-clusterapi // integration topic. + // Capacity corev1.ResourceList `json:"capacity"` + + // How much capacity is actually allocatable on this machine. + // Must be equal to or less than the capacity, and when less + // indicates the resources reserved for system overhead. + // + // WARNING: It is up to the creator of the MachineClass to ensure that + // this field is consistent with the underlying machine that will + // be provisioned when this class is used, to inform higher level + // automation (e.g. the cluster autoscaler). + // TODO(hardikdr) Add allocatable field once requirements are clear from autoscaler-clusterapi // integration topic. + // Allocatable corev1.ResourceList `json:"allocatable"` + + // Provider-specific configuration to use during node creation. + ProviderSpec runtime.RawExtension `json:"providerSpec"` + + // TODO: should this use an api.ObjectReference to a 'MachineTemplate' instead? + // A link to the MachineTemplate that will be used to create provider + // specific configuration for Machines of this class. + // MachineTemplate corev1.ObjectReference `json:machineTemplate` +} + +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object + +// MachineClassList contains a list of MachineClasses +type MachineClassList struct { + metav1.TypeMeta `json:",inline"` + metav1.ListMeta `json:"metadata,omitempty"` + Items []MachineClass `json:"items"` +} + +func init() { + SchemeBuilder.Register(&MachineClass{}, &MachineClassList{}) +} diff --git a/vendor/github.com/openshift/cluster-api/pkg/apis/machine/v1beta1/machinedeployment_types.go b/vendor/github.com/openshift/cluster-api/pkg/apis/machine/v1beta1/machinedeployment_types.go new file mode 100644 index 000000000..8e892ecc0 --- /dev/null +++ b/vendor/github.com/openshift/cluster-api/pkg/apis/machine/v1beta1/machinedeployment_types.go @@ -0,0 +1,194 @@ +/* +Copyright 2018 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package v1beta1 + +import ( + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/util/intstr" + + "github.com/openshift/cluster-api/pkg/apis/machine/common" +) + +/// [MachineDeploymentSpec] +// MachineDeploymentSpec defines the desired state of MachineDeployment +type MachineDeploymentSpec struct { + // Number of desired machines. Defaults to 1. + // This is a pointer to distinguish between explicit zero and not specified. + Replicas *int32 `json:"replicas,omitempty"` + + // Label selector for machines. Existing MachineSets whose machines are + // selected by this will be the ones affected by this deployment. + // It must match the machine template's labels. + Selector metav1.LabelSelector `json:"selector"` + + // Template describes the machines that will be created. + Template MachineTemplateSpec `json:"template"` + + // The deployment strategy to use to replace existing machines with + // new ones. + // +optional + Strategy *MachineDeploymentStrategy `json:"strategy,omitempty"` + + // Minimum number of seconds for which a newly created machine should + // be ready. + // Defaults to 0 (machine will be considered available as soon as it + // is ready) + // +optional + MinReadySeconds *int32 `json:"minReadySeconds,omitempty"` + + // The number of old MachineSets to retain to allow rollback. + // This is a pointer to distinguish between explicit zero and not specified. + // Defaults to 1. + // +optional + RevisionHistoryLimit *int32 `json:"revisionHistoryLimit,omitempty"` + + // Indicates that the deployment is paused. + // +optional + Paused bool `json:"paused,omitempty"` + + // The maximum time in seconds for a deployment to make progress before it + // is considered to be failed. The deployment controller will continue to + // process failed deployments and a condition with a ProgressDeadlineExceeded + // reason will be surfaced in the deployment status. Note that progress will + // not be estimated during the time a deployment is paused. Defaults to 600s. + ProgressDeadlineSeconds *int32 `json:"progressDeadlineSeconds,omitempty"` +} + +/// [MachineDeploymentSpec] + +/// [MachineDeploymentStrategy] +// MachineDeploymentStrategy describes how to replace existing machines +// with new ones. +type MachineDeploymentStrategy struct { + // Type of deployment. Currently the only supported strategy is + // "RollingUpdate". + // Default is RollingUpdate. + // +optional + Type common.MachineDeploymentStrategyType `json:"type,omitempty"` + + // Rolling update config params. Present only if + // MachineDeploymentStrategyType = RollingUpdate. + // +optional + RollingUpdate *MachineRollingUpdateDeployment `json:"rollingUpdate,omitempty"` +} + +/// [MachineDeploymentStrategy] + +/// [MachineRollingUpdateDeployment] +// Spec to control the desired behavior of rolling update. +type MachineRollingUpdateDeployment struct { + // The maximum number of machines that can be unavailable during the update. + // Value can be an absolute number (ex: 5) or a percentage of desired + // machines (ex: 10%). + // Absolute number is calculated from percentage by rounding down. + // This can not be 0 if MaxSurge is 0. + // Defaults to 0. + // Example: when this is set to 30%, the old MachineSet can be scaled + // down to 70% of desired machines immediately when the rolling update + // starts. Once new machines are ready, old MachineSet can be scaled + // down further, followed by scaling up the new MachineSet, ensuring + // that the total number of machines available at all times + // during the update is at least 70% of desired machines. + // +optional + MaxUnavailable *intstr.IntOrString `json:"maxUnavailable,omitempty" protobuf:"bytes,1,opt,name=maxUnavailable"` + + // The maximum number of machines that can be scheduled above the + // desired number of machines. + // Value can be an absolute number (ex: 5) or a percentage of + // desired machines (ex: 10%). + // This can not be 0 if MaxUnavailable is 0. + // Absolute number is calculated from percentage by rounding up. + // Defaults to 1. + // Example: when this is set to 30%, the new MachineSet can be scaled + // up immediately when the rolling update starts, such that the total + // number of old and new machines do not exceed 130% of desired + // machines. Once old machines have been killed, new MachineSet can + // be scaled up further, ensuring that total number of machines running + // at any time during the update is at most 130% of desired machines. + // +optional + MaxSurge *intstr.IntOrString `json:"maxSurge,omitempty" protobuf:"bytes,2,opt,name=maxSurge"` +} + +/// [MachineRollingUpdateDeployment] + +/// [MachineDeploymentStatus] +// MachineDeploymentStatus defines the observed state of MachineDeployment +type MachineDeploymentStatus struct { + // The generation observed by the deployment controller. + // +optional + ObservedGeneration int64 `json:"observedGeneration,omitempty" protobuf:"varint,1,opt,name=observedGeneration"` + + // Total number of non-terminated machines targeted by this deployment + // (their labels match the selector). + // +optional + Replicas int32 `json:"replicas,omitempty" protobuf:"varint,2,opt,name=replicas"` + + // Total number of non-terminated machines targeted by this deployment + // that have the desired template spec. + // +optional + UpdatedReplicas int32 `json:"updatedReplicas,omitempty" protobuf:"varint,3,opt,name=updatedReplicas"` + + // Total number of ready machines targeted by this deployment. + // +optional + ReadyReplicas int32 `json:"readyReplicas,omitempty" protobuf:"varint,7,opt,name=readyReplicas"` + + // Total number of available machines (ready for at least minReadySeconds) + // targeted by this deployment. + // +optional + AvailableReplicas int32 `json:"availableReplicas,omitempty" protobuf:"varint,4,opt,name=availableReplicas"` + + // Total number of unavailable machines targeted by this deployment. + // This is the total number of machines that are still required for + // the deployment to have 100% available capacity. They may either + // be machines that are running but not yet available or machines + // that still have not been created. + // +optional + UnavailableReplicas int32 `json:"unavailableReplicas,omitempty" protobuf:"varint,5,opt,name=unavailableReplicas"` +} + +/// [MachineDeploymentStatus] + +// +genclient +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object + +/// [MachineDeployment] +// MachineDeployment is the Schema for the machinedeployments API +// +k8s:openapi-gen=true +// +kubebuilder:subresource:status +// +kubebuilder:subresource:scale:specpath=.spec.replicas,statuspath=.status.replicas,selectorpath=.status.labelSelector +type MachineDeployment struct { + metav1.TypeMeta `json:",inline"` + metav1.ObjectMeta `json:"metadata,omitempty"` + + Spec MachineDeploymentSpec `json:"spec,omitempty"` + Status MachineDeploymentStatus `json:"status,omitempty"` +} + +/// [MachineDeployment] + +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object + +// MachineDeploymentList contains a list of MachineDeployment +type MachineDeploymentList struct { + metav1.TypeMeta `json:",inline"` + metav1.ListMeta `json:"metadata,omitempty"` + Items []MachineDeployment `json:"items"` +} + +func init() { + SchemeBuilder.Register(&MachineDeployment{}, &MachineDeploymentList{}) +} diff --git a/vendor/github.com/openshift/cluster-api/pkg/apis/machine/v1beta1/machineset_types.go b/vendor/github.com/openshift/cluster-api/pkg/apis/machine/v1beta1/machineset_types.go new file mode 100644 index 000000000..ee810bc94 --- /dev/null +++ b/vendor/github.com/openshift/cluster-api/pkg/apis/machine/v1beta1/machineset_types.go @@ -0,0 +1,187 @@ +/* +Copyright 2018 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package v1beta1 + +import ( + "log" + + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + metav1validation "k8s.io/apimachinery/pkg/apis/meta/v1/validation" + + "github.com/openshift/cluster-api/pkg/apis/machine/common" + "k8s.io/apimachinery/pkg/labels" + "k8s.io/apimachinery/pkg/util/validation/field" +) + +// +genclient +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object + +/// [MachineSet] +// MachineSet ensures that a specified number of machines replicas are running at any given time. +// +k8s:openapi-gen=true +// +kubebuilder:subresource:status +// +kubebuilder:subresource:scale:specpath=.spec.replicas,statuspath=.status.replicas,selectorpath=.status.labelSelector +type MachineSet struct { + metav1.TypeMeta `json:",inline"` + metav1.ObjectMeta `json:"metadata,omitempty"` + + Spec MachineSetSpec `json:"spec,omitempty"` + Status MachineSetStatus `json:"status,omitempty"` +} + +/// [MachineSet] + +/// [MachineSetSpec] +// MachineSetSpec defines the desired state of MachineSet +type MachineSetSpec struct { + // Replicas is the number of desired replicas. + // This is a pointer to distinguish between explicit zero and unspecified. + // Defaults to 1. + // +optional + Replicas *int32 `json:"replicas,omitempty"` + + // MinReadySeconds is the minimum number of seconds for which a newly created machine should be ready. + // Defaults to 0 (machine will be considered available as soon as it is ready) + // +optional + MinReadySeconds int32 `json:"minReadySeconds,omitempty"` + + // Selector is a label query over machines that should match the replica count. + // Label keys and values that must match in order to be controlled by this MachineSet. + // It must match the machine template's labels. + // More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/labels/#label-selectors + Selector metav1.LabelSelector `json:"selector"` + + // Template is the object that describes the machine that will be created if + // insufficient replicas are detected. + // +optional + Template MachineTemplateSpec `json:"template,omitempty"` +} + +/// [MachineSetSpec] // doxygen marker + +/// [MachineTemplateSpec] // doxygen marker +// MachineTemplateSpec describes the data needed to create a Machine from a template +type MachineTemplateSpec struct { + // Standard object's metadata. + // More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#metadata + // +optional + metav1.ObjectMeta `json:"metadata,omitempty"` + + // Specification of the desired behavior of the machine. + // More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#spec-and-status + // +optional + Spec MachineSpec `json:"spec,omitempty"` +} + +/// [MachineTemplateSpec] + +/// [MachineSetStatus] +// MachineSetStatus defines the observed state of MachineSet +type MachineSetStatus struct { + // Replicas is the most recently observed number of replicas. + Replicas int32 `json:"replicas"` + + // The number of replicas that have labels matching the labels of the machine template of the MachineSet. + // +optional + FullyLabeledReplicas int32 `json:"fullyLabeledReplicas,omitempty"` + + // The number of ready replicas for this MachineSet. A machine is considered ready when the node has been created and is "Ready". + // +optional + ReadyReplicas int32 `json:"readyReplicas,omitempty"` + + // The number of available replicas (ready for at least minReadySeconds) for this MachineSet. + // +optional + AvailableReplicas int32 `json:"availableReplicas,omitempty"` + + // ObservedGeneration reflects the generation of the most recently observed MachineSet. + // +optional + ObservedGeneration int64 `json:"observedGeneration,omitempty"` + + // In the event that there is a terminal problem reconciling the + // replicas, both ErrorReason and ErrorMessage will be set. ErrorReason + // will be populated with a succinct value suitable for machine + // interpretation, while ErrorMessage will contain a more verbose + // string suitable for logging and human consumption. + // + // These fields should not be set for transitive errors that a + // controller faces that are expected to be fixed automatically over + // time (like service outages), but instead indicate that something is + // fundamentally wrong with the MachineTemplate's spec or the configuration of + // the machine controller, and that manual intervention is required. Examples + // of terminal errors would be invalid combinations of settings in the + // spec, values that are unsupported by the machine controller, or the + // responsible machine controller itself being critically misconfigured. + // + // Any transient errors that occur during the reconciliation of Machines + // can be added as events to the MachineSet object and/or logged in the + // controller's output. + // +optional + ErrorReason *common.MachineSetStatusError `json:"errorReason,omitempty"` + // +optional + ErrorMessage *string `json:"errorMessage,omitempty"` +} + +/// [MachineSetStatus] + +func (machineSet *MachineSet) Validate() field.ErrorList { + errors := field.ErrorList{} + + // validate spec.selector and spec.template.labels + fldPath := field.NewPath("spec") + errors = append(errors, metav1validation.ValidateLabelSelector(&machineSet.Spec.Selector, fldPath.Child("selector"))...) + if len(machineSet.Spec.Selector.MatchLabels)+len(machineSet.Spec.Selector.MatchExpressions) == 0 { + errors = append(errors, field.Invalid(fldPath.Child("selector"), machineSet.Spec.Selector, "empty selector is not valid for MachineSet.")) + } + selector, err := metav1.LabelSelectorAsSelector(&machineSet.Spec.Selector) + if err != nil { + errors = append(errors, field.Invalid(fldPath.Child("selector"), machineSet.Spec.Selector, "invalid label selector.")) + } else { + labels := labels.Set(machineSet.Spec.Template.Labels) + if !selector.Matches(labels) { + errors = append(errors, field.Invalid(fldPath.Child("template", "metadata", "labels"), machineSet.Spec.Template.Labels, "`selector` does not match template `labels`")) + } + } + + return errors +} + +// DefaultingFunction sets default MachineSet field values +func (obj *MachineSet) Default() { + log.Printf("Defaulting fields for MachineSet %s\n", obj.Name) + + if obj.Spec.Replicas == nil { + obj.Spec.Replicas = new(int32) + *obj.Spec.Replicas = 1 + } + + if len(obj.Namespace) == 0 { + obj.Namespace = metav1.NamespaceDefault + } +} + +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object + +// MachineSetList contains a list of MachineSet +type MachineSetList struct { + metav1.TypeMeta `json:",inline"` + metav1.ListMeta `json:"metadata,omitempty"` + Items []MachineSet `json:"items"` +} + +func init() { + SchemeBuilder.Register(&MachineSet{}, &MachineSetList{}) +} diff --git a/vendor/github.com/openshift/cluster-api/pkg/apis/machine/v1beta1/register.go b/vendor/github.com/openshift/cluster-api/pkg/apis/machine/v1beta1/register.go new file mode 100644 index 000000000..5062825dc --- /dev/null +++ b/vendor/github.com/openshift/cluster-api/pkg/apis/machine/v1beta1/register.go @@ -0,0 +1,48 @@ +/* +Copyright 2018 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// NOTE: Boilerplate only. Ignore this file. + +// Package v1beta1 contains API Schema definitions for the machine v1beta1 API group +// +k8s:openapi-gen=true +// +k8s:deepcopy-gen=package,register +// +k8s:conversion-gen=sigs.k8s.io/cluster-api/pkg/apis/machine +// +k8s:defaulter-gen=TypeMeta +// +groupName=machine.openshift.io +package v1beta1 + +import ( + "k8s.io/apimachinery/pkg/runtime/schema" + "sigs.k8s.io/controller-runtime/pkg/runtime/scheme" +) + +var ( + // SchemeGroupVersion is group version used to register these objects + SchemeGroupVersion = schema.GroupVersion{Group: "machine.openshift.io", Version: "v1beta1"} + + // SchemeBuilder is used to add go types to the GroupVersionKind scheme + SchemeBuilder = &scheme.Builder{GroupVersion: SchemeGroupVersion} + + // Required by pkg/client/... + // TODO(pwittrock): Remove this after removing pkg/client/... + AddToScheme = SchemeBuilder.AddToScheme +) + +// Required by pkg/client/listers/... +// TODO(pwittrock): Remove this after removing pkg/client/... +func Resource(resource string) schema.GroupResource { + return SchemeGroupVersion.WithResource(resource).GroupResource() +} diff --git a/vendor/sigs.k8s.io/cluster-api/pkg/apis/cluster/v1alpha1/testutil/BUILD.bazel b/vendor/github.com/openshift/cluster-api/pkg/apis/machine/v1beta1/testutil/BUILD.bazel similarity index 72% rename from vendor/sigs.k8s.io/cluster-api/pkg/apis/cluster/v1alpha1/testutil/BUILD.bazel rename to vendor/github.com/openshift/cluster-api/pkg/apis/machine/v1beta1/testutil/BUILD.bazel index bcee50bdc..438085562 100644 --- a/vendor/sigs.k8s.io/cluster-api/pkg/apis/cluster/v1alpha1/testutil/BUILD.bazel +++ b/vendor/github.com/openshift/cluster-api/pkg/apis/machine/v1beta1/testutil/BUILD.bazel @@ -3,7 +3,7 @@ load("@io_bazel_rules_go//go:def.bzl", "go_library") go_library( name = "go_default_library", srcs = ["testutil.go"], - importpath = "sigs.k8s.io/cluster-api/pkg/apis/cluster/v1alpha1/testutil", + importpath = "github.com/openshift/cluster-api/pkg/apis/machine/v1beta1/testutil", visibility = ["//visibility:public"], deps = ["//pkg/apis/cluster/v1alpha1:go_default_library"], ) diff --git a/vendor/github.com/openshift/cluster-api/pkg/apis/machine/v1beta1/testutil/testutil.go b/vendor/github.com/openshift/cluster-api/pkg/apis/machine/v1beta1/testutil/testutil.go new file mode 100644 index 000000000..9bfeaed98 --- /dev/null +++ b/vendor/github.com/openshift/cluster-api/pkg/apis/machine/v1beta1/testutil/testutil.go @@ -0,0 +1,36 @@ +/* +Copyright 2018 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package testutil + +import "github.com/openshift/cluster-api/pkg/apis/cluster/v1alpha1" + +// GetVanillaCluster return a bare minimum functional cluster resource object +func GetVanillaCluster() v1alpha1.Cluster { + return v1alpha1.Cluster{ + Spec: v1alpha1.ClusterSpec{ + ClusterNetwork: v1alpha1.ClusterNetworkingConfig{ + Services: v1alpha1.NetworkRanges{ + CIDRBlocks: []string{"10.96.0.0/12"}, + }, + Pods: v1alpha1.NetworkRanges{ + CIDRBlocks: []string{"192.168.0.0/16"}, + }, + ServiceDomain: "cluster.local", + }, + }, + } +} diff --git a/vendor/github.com/openshift/cluster-api/pkg/apis/machine/v1beta1/zz_generated.deepcopy.go b/vendor/github.com/openshift/cluster-api/pkg/apis/machine/v1beta1/zz_generated.deepcopy.go new file mode 100644 index 000000000..ab6e3a587 --- /dev/null +++ b/vendor/github.com/openshift/cluster-api/pkg/apis/machine/v1beta1/zz_generated.deepcopy.go @@ -0,0 +1,821 @@ +// +build !ignore_autogenerated + +/* +Copyright 2018 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by main. DO NOT EDIT. + +package v1beta1 + +import ( + common "github.com/openshift/cluster-api/pkg/apis/machine/common" + v1 "k8s.io/api/core/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + intstr "k8s.io/apimachinery/pkg/util/intstr" +) + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *APIEndpoint) DeepCopyInto(out *APIEndpoint) { + *out = *in + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new APIEndpoint. +func (in *APIEndpoint) DeepCopy() *APIEndpoint { + if in == nil { + return nil + } + out := new(APIEndpoint) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *Cluster) DeepCopyInto(out *Cluster) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) + in.Spec.DeepCopyInto(&out.Spec) + in.Status.DeepCopyInto(&out.Status) + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Cluster. +func (in *Cluster) DeepCopy() *Cluster { + if in == nil { + return nil + } + out := new(Cluster) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *Cluster) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ClusterList) DeepCopyInto(out *ClusterList) { + *out = *in + out.TypeMeta = in.TypeMeta + out.ListMeta = in.ListMeta + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]Cluster, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ClusterList. +func (in *ClusterList) DeepCopy() *ClusterList { + if in == nil { + return nil + } + out := new(ClusterList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *ClusterList) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ClusterNetworkingConfig) DeepCopyInto(out *ClusterNetworkingConfig) { + *out = *in + in.Services.DeepCopyInto(&out.Services) + in.Pods.DeepCopyInto(&out.Pods) + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ClusterNetworkingConfig. +func (in *ClusterNetworkingConfig) DeepCopy() *ClusterNetworkingConfig { + if in == nil { + return nil + } + out := new(ClusterNetworkingConfig) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ClusterSpec) DeepCopyInto(out *ClusterSpec) { + *out = *in + in.ClusterNetwork.DeepCopyInto(&out.ClusterNetwork) + in.ProviderSpec.DeepCopyInto(&out.ProviderSpec) + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ClusterSpec. +func (in *ClusterSpec) DeepCopy() *ClusterSpec { + if in == nil { + return nil + } + out := new(ClusterSpec) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ClusterStatus) DeepCopyInto(out *ClusterStatus) { + *out = *in + if in.APIEndpoints != nil { + in, out := &in.APIEndpoints, &out.APIEndpoints + *out = make([]APIEndpoint, len(*in)) + copy(*out, *in) + } + if in.ProviderStatus != nil { + in, out := &in.ProviderStatus, &out.ProviderStatus + *out = new(runtime.RawExtension) + (*in).DeepCopyInto(*out) + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ClusterStatus. +func (in *ClusterStatus) DeepCopy() *ClusterStatus { + if in == nil { + return nil + } + out := new(ClusterStatus) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *LastOperation) DeepCopyInto(out *LastOperation) { + *out = *in + if in.Description != nil { + in, out := &in.Description, &out.Description + *out = new(string) + **out = **in + } + if in.LastUpdated != nil { + in, out := &in.LastUpdated, &out.LastUpdated + *out = (*in).DeepCopy() + } + if in.State != nil { + in, out := &in.State, &out.State + *out = new(string) + **out = **in + } + if in.Type != nil { + in, out := &in.Type, &out.Type + *out = new(string) + **out = **in + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new LastOperation. +func (in *LastOperation) DeepCopy() *LastOperation { + if in == nil { + return nil + } + out := new(LastOperation) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *Machine) DeepCopyInto(out *Machine) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) + in.Spec.DeepCopyInto(&out.Spec) + in.Status.DeepCopyInto(&out.Status) + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Machine. +func (in *Machine) DeepCopy() *Machine { + if in == nil { + return nil + } + out := new(Machine) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *Machine) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *MachineClass) DeepCopyInto(out *MachineClass) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) + in.ProviderSpec.DeepCopyInto(&out.ProviderSpec) + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new MachineClass. +func (in *MachineClass) DeepCopy() *MachineClass { + if in == nil { + return nil + } + out := new(MachineClass) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *MachineClass) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *MachineClassList) DeepCopyInto(out *MachineClassList) { + *out = *in + out.TypeMeta = in.TypeMeta + out.ListMeta = in.ListMeta + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]MachineClass, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new MachineClassList. +func (in *MachineClassList) DeepCopy() *MachineClassList { + if in == nil { + return nil + } + out := new(MachineClassList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *MachineClassList) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *MachineClassRef) DeepCopyInto(out *MachineClassRef) { + *out = *in + if in.ObjectReference != nil { + in, out := &in.ObjectReference, &out.ObjectReference + *out = new(v1.ObjectReference) + **out = **in + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new MachineClassRef. +func (in *MachineClassRef) DeepCopy() *MachineClassRef { + if in == nil { + return nil + } + out := new(MachineClassRef) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *MachineDeployment) DeepCopyInto(out *MachineDeployment) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) + in.Spec.DeepCopyInto(&out.Spec) + out.Status = in.Status + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new MachineDeployment. +func (in *MachineDeployment) DeepCopy() *MachineDeployment { + if in == nil { + return nil + } + out := new(MachineDeployment) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *MachineDeployment) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *MachineDeploymentList) DeepCopyInto(out *MachineDeploymentList) { + *out = *in + out.TypeMeta = in.TypeMeta + out.ListMeta = in.ListMeta + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]MachineDeployment, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new MachineDeploymentList. +func (in *MachineDeploymentList) DeepCopy() *MachineDeploymentList { + if in == nil { + return nil + } + out := new(MachineDeploymentList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *MachineDeploymentList) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *MachineDeploymentSpec) DeepCopyInto(out *MachineDeploymentSpec) { + *out = *in + if in.Replicas != nil { + in, out := &in.Replicas, &out.Replicas + *out = new(int32) + **out = **in + } + in.Selector.DeepCopyInto(&out.Selector) + in.Template.DeepCopyInto(&out.Template) + if in.Strategy != nil { + in, out := &in.Strategy, &out.Strategy + *out = new(MachineDeploymentStrategy) + (*in).DeepCopyInto(*out) + } + if in.MinReadySeconds != nil { + in, out := &in.MinReadySeconds, &out.MinReadySeconds + *out = new(int32) + **out = **in + } + if in.RevisionHistoryLimit != nil { + in, out := &in.RevisionHistoryLimit, &out.RevisionHistoryLimit + *out = new(int32) + **out = **in + } + if in.ProgressDeadlineSeconds != nil { + in, out := &in.ProgressDeadlineSeconds, &out.ProgressDeadlineSeconds + *out = new(int32) + **out = **in + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new MachineDeploymentSpec. +func (in *MachineDeploymentSpec) DeepCopy() *MachineDeploymentSpec { + if in == nil { + return nil + } + out := new(MachineDeploymentSpec) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *MachineDeploymentStatus) DeepCopyInto(out *MachineDeploymentStatus) { + *out = *in + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new MachineDeploymentStatus. +func (in *MachineDeploymentStatus) DeepCopy() *MachineDeploymentStatus { + if in == nil { + return nil + } + out := new(MachineDeploymentStatus) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *MachineDeploymentStrategy) DeepCopyInto(out *MachineDeploymentStrategy) { + *out = *in + if in.RollingUpdate != nil { + in, out := &in.RollingUpdate, &out.RollingUpdate + *out = new(MachineRollingUpdateDeployment) + (*in).DeepCopyInto(*out) + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new MachineDeploymentStrategy. +func (in *MachineDeploymentStrategy) DeepCopy() *MachineDeploymentStrategy { + if in == nil { + return nil + } + out := new(MachineDeploymentStrategy) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *MachineList) DeepCopyInto(out *MachineList) { + *out = *in + out.TypeMeta = in.TypeMeta + out.ListMeta = in.ListMeta + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]Machine, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new MachineList. +func (in *MachineList) DeepCopy() *MachineList { + if in == nil { + return nil + } + out := new(MachineList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *MachineList) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *MachineRollingUpdateDeployment) DeepCopyInto(out *MachineRollingUpdateDeployment) { + *out = *in + if in.MaxUnavailable != nil { + in, out := &in.MaxUnavailable, &out.MaxUnavailable + *out = new(intstr.IntOrString) + **out = **in + } + if in.MaxSurge != nil { + in, out := &in.MaxSurge, &out.MaxSurge + *out = new(intstr.IntOrString) + **out = **in + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new MachineRollingUpdateDeployment. +func (in *MachineRollingUpdateDeployment) DeepCopy() *MachineRollingUpdateDeployment { + if in == nil { + return nil + } + out := new(MachineRollingUpdateDeployment) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *MachineSet) DeepCopyInto(out *MachineSet) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) + in.Spec.DeepCopyInto(&out.Spec) + in.Status.DeepCopyInto(&out.Status) + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new MachineSet. +func (in *MachineSet) DeepCopy() *MachineSet { + if in == nil { + return nil + } + out := new(MachineSet) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *MachineSet) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *MachineSetList) DeepCopyInto(out *MachineSetList) { + *out = *in + out.TypeMeta = in.TypeMeta + out.ListMeta = in.ListMeta + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]MachineSet, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new MachineSetList. +func (in *MachineSetList) DeepCopy() *MachineSetList { + if in == nil { + return nil + } + out := new(MachineSetList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *MachineSetList) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *MachineSetSpec) DeepCopyInto(out *MachineSetSpec) { + *out = *in + if in.Replicas != nil { + in, out := &in.Replicas, &out.Replicas + *out = new(int32) + **out = **in + } + in.Selector.DeepCopyInto(&out.Selector) + in.Template.DeepCopyInto(&out.Template) + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new MachineSetSpec. +func (in *MachineSetSpec) DeepCopy() *MachineSetSpec { + if in == nil { + return nil + } + out := new(MachineSetSpec) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *MachineSetStatus) DeepCopyInto(out *MachineSetStatus) { + *out = *in + if in.ErrorReason != nil { + in, out := &in.ErrorReason, &out.ErrorReason + *out = new(common.MachineSetStatusError) + **out = **in + } + if in.ErrorMessage != nil { + in, out := &in.ErrorMessage, &out.ErrorMessage + *out = new(string) + **out = **in + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new MachineSetStatus. +func (in *MachineSetStatus) DeepCopy() *MachineSetStatus { + if in == nil { + return nil + } + out := new(MachineSetStatus) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *MachineSpec) DeepCopyInto(out *MachineSpec) { + *out = *in + in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) + if in.Taints != nil { + in, out := &in.Taints, &out.Taints + *out = make([]v1.Taint, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + in.ProviderSpec.DeepCopyInto(&out.ProviderSpec) + out.Versions = in.Versions + if in.ConfigSource != nil { + in, out := &in.ConfigSource, &out.ConfigSource + *out = new(v1.NodeConfigSource) + (*in).DeepCopyInto(*out) + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new MachineSpec. +func (in *MachineSpec) DeepCopy() *MachineSpec { + if in == nil { + return nil + } + out := new(MachineSpec) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *MachineStatus) DeepCopyInto(out *MachineStatus) { + *out = *in + if in.NodeRef != nil { + in, out := &in.NodeRef, &out.NodeRef + *out = new(v1.ObjectReference) + **out = **in + } + if in.LastUpdated != nil { + in, out := &in.LastUpdated, &out.LastUpdated + *out = (*in).DeepCopy() + } + if in.Versions != nil { + in, out := &in.Versions, &out.Versions + *out = new(MachineVersionInfo) + **out = **in + } + if in.ErrorReason != nil { + in, out := &in.ErrorReason, &out.ErrorReason + *out = new(common.MachineStatusError) + **out = **in + } + if in.ErrorMessage != nil { + in, out := &in.ErrorMessage, &out.ErrorMessage + *out = new(string) + **out = **in + } + if in.ProviderStatus != nil { + in, out := &in.ProviderStatus, &out.ProviderStatus + *out = new(runtime.RawExtension) + (*in).DeepCopyInto(*out) + } + if in.Addresses != nil { + in, out := &in.Addresses, &out.Addresses + *out = make([]v1.NodeAddress, len(*in)) + copy(*out, *in) + } + if in.Conditions != nil { + in, out := &in.Conditions, &out.Conditions + *out = make([]v1.NodeCondition, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + if in.LastOperation != nil { + in, out := &in.LastOperation, &out.LastOperation + *out = new(LastOperation) + (*in).DeepCopyInto(*out) + } + if in.Phase != nil { + in, out := &in.Phase, &out.Phase + *out = new(string) + **out = **in + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new MachineStatus. +func (in *MachineStatus) DeepCopy() *MachineStatus { + if in == nil { + return nil + } + out := new(MachineStatus) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *MachineTemplateSpec) DeepCopyInto(out *MachineTemplateSpec) { + *out = *in + in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) + in.Spec.DeepCopyInto(&out.Spec) + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new MachineTemplateSpec. +func (in *MachineTemplateSpec) DeepCopy() *MachineTemplateSpec { + if in == nil { + return nil + } + out := new(MachineTemplateSpec) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *MachineVersionInfo) DeepCopyInto(out *MachineVersionInfo) { + *out = *in + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new MachineVersionInfo. +func (in *MachineVersionInfo) DeepCopy() *MachineVersionInfo { + if in == nil { + return nil + } + out := new(MachineVersionInfo) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *NetworkRanges) DeepCopyInto(out *NetworkRanges) { + *out = *in + if in.CIDRBlocks != nil { + in, out := &in.CIDRBlocks, &out.CIDRBlocks + *out = make([]string, len(*in)) + copy(*out, *in) + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new NetworkRanges. +func (in *NetworkRanges) DeepCopy() *NetworkRanges { + if in == nil { + return nil + } + out := new(NetworkRanges) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ProviderSpec) DeepCopyInto(out *ProviderSpec) { + *out = *in + if in.Value != nil { + in, out := &in.Value, &out.Value + *out = new(runtime.RawExtension) + (*in).DeepCopyInto(*out) + } + if in.ValueFrom != nil { + in, out := &in.ValueFrom, &out.ValueFrom + *out = new(ProviderSpecSource) + (*in).DeepCopyInto(*out) + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ProviderSpec. +func (in *ProviderSpec) DeepCopy() *ProviderSpec { + if in == nil { + return nil + } + out := new(ProviderSpec) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ProviderSpecSource) DeepCopyInto(out *ProviderSpecSource) { + *out = *in + if in.MachineClass != nil { + in, out := &in.MachineClass, &out.MachineClass + *out = new(MachineClassRef) + (*in).DeepCopyInto(*out) + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ProviderSpecSource. +func (in *ProviderSpecSource) DeepCopy() *ProviderSpecSource { + if in == nil { + return nil + } + out := new(ProviderSpecSource) + in.DeepCopyInto(out) + return out +} diff --git a/vendor/sigs.k8s.io/cluster-api/pkg/cert/BUILD.bazel b/vendor/github.com/openshift/cluster-api/pkg/cert/BUILD.bazel similarity index 61% rename from vendor/sigs.k8s.io/cluster-api/pkg/cert/BUILD.bazel rename to vendor/github.com/openshift/cluster-api/pkg/cert/BUILD.bazel index 160388a91..6355114c1 100644 --- a/vendor/sigs.k8s.io/cluster-api/pkg/cert/BUILD.bazel +++ b/vendor/github.com/openshift/cluster-api/pkg/cert/BUILD.bazel @@ -3,9 +3,12 @@ load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test") go_library( name = "go_default_library", srcs = ["cert_authority.go"], - importpath = "sigs.k8s.io/cluster-api/pkg/cert", + importpath = "github.com/openshift/cluster-api/pkg/cert", visibility = ["//visibility:public"], - deps = ["//vendor/k8s.io/klog:go_default_library"], + deps = [ + "//vendor/github.com/pkg/errors:go_default_library", + "//vendor/k8s.io/klog:go_default_library", + ], ) go_test( diff --git a/vendor/sigs.k8s.io/cluster-api/pkg/cert/cert_authority.go b/vendor/github.com/openshift/cluster-api/pkg/cert/cert_authority.go similarity index 85% rename from vendor/sigs.k8s.io/cluster-api/pkg/cert/cert_authority.go rename to vendor/github.com/openshift/cluster-api/pkg/cert/cert_authority.go index 591602d9d..96e543866 100644 --- a/vendor/sigs.k8s.io/cluster-api/pkg/cert/cert_authority.go +++ b/vendor/github.com/openshift/cluster-api/pkg/cert/cert_authority.go @@ -17,11 +17,11 @@ limitations under the License. package cert import ( - "fmt" "io/ioutil" "os" "path/filepath" + "github.com/pkg/errors" "k8s.io/klog" ) @@ -45,11 +45,11 @@ func Load(caPath string) (*CertificateAuthority, error) { } certMaterial, err := ioutil.ReadFile(certPath) if err != nil { - return nil, fmt.Errorf("unable to read cert %v: %v", certPath, err) + return nil, errors.Wrapf(err, "unable to read cert %v", certPath) } keyMaterial, err := ioutil.ReadFile(keyPath) if err != nil { - return nil, fmt.Errorf("unable to read key %v: %v", keyPath, err) + return nil, errors.Wrapf(err, "unable to read key %v", keyPath) } ca := CertificateAuthority{ Certificate: certMaterial, @@ -77,14 +77,14 @@ func certPathToCertAndKeyPaths(caPath string) (string, string, error) { certPath = caPath[0:len(caPath)-len(ext)] + ".crt" keyPath = caPath default: - return "", "", fmt.Errorf("unable to use certificate authority, not directory, .crt, or .key file: %v", caPath) + return "", "", errors.Errorf("unable to use certificate authority, not directory, .crt, or .key file: %v", caPath) } } if _, err := os.Stat(certPath); err != nil { - return "", "", fmt.Errorf("unable to use certificate file: %v (%v)", certPath, err) + return "", "", errors.Wrapf(err, "unable to use certificate file: %v", certPath) } if _, err := os.Stat(keyPath); err != nil { - return "", "", fmt.Errorf("unable to use key file: %v (%v)", keyPath, err) + return "", "", errors.Wrapf(err, "unable to use key file: %v", keyPath) } return certPath, keyPath, err } diff --git a/vendor/sigs.k8s.io/cluster-api/pkg/client/clientset_generated/clientset/BUILD.bazel b/vendor/github.com/openshift/cluster-api/pkg/client/clientset_generated/clientset/BUILD.bazel similarity index 73% rename from vendor/sigs.k8s.io/cluster-api/pkg/client/clientset_generated/clientset/BUILD.bazel rename to vendor/github.com/openshift/cluster-api/pkg/client/clientset_generated/clientset/BUILD.bazel index 9665ba8d3..10e431495 100644 --- a/vendor/sigs.k8s.io/cluster-api/pkg/client/clientset_generated/clientset/BUILD.bazel +++ b/vendor/github.com/openshift/cluster-api/pkg/client/clientset_generated/clientset/BUILD.bazel @@ -6,10 +6,11 @@ go_library( "clientset.go", "doc.go", ], - importpath = "sigs.k8s.io/cluster-api/pkg/client/clientset_generated/clientset", + importpath = "github.com/openshift/cluster-api/pkg/client/clientset_generated/clientset", visibility = ["//visibility:public"], deps = [ "//pkg/client/clientset_generated/clientset/typed/cluster/v1alpha1:go_default_library", + "//pkg/client/clientset_generated/clientset/typed/machine/v1beta1:go_default_library", "//vendor/k8s.io/client-go/discovery:go_default_library", "//vendor/k8s.io/client-go/rest:go_default_library", "//vendor/k8s.io/client-go/util/flowcontrol:go_default_library", diff --git a/vendor/sigs.k8s.io/cluster-api/pkg/client/clientset_generated/clientset/clientset.go b/vendor/github.com/openshift/cluster-api/pkg/client/clientset_generated/clientset/clientset.go similarity index 74% rename from vendor/sigs.k8s.io/cluster-api/pkg/client/clientset_generated/clientset/clientset.go rename to vendor/github.com/openshift/cluster-api/pkg/client/clientset_generated/clientset/clientset.go index 1d5483d3f..1ea155745 100644 --- a/vendor/sigs.k8s.io/cluster-api/pkg/client/clientset_generated/clientset/clientset.go +++ b/vendor/github.com/openshift/cluster-api/pkg/client/clientset_generated/clientset/clientset.go @@ -19,10 +19,11 @@ limitations under the License. package clientset import ( + clusterv1alpha1 "github.com/openshift/cluster-api/pkg/client/clientset_generated/clientset/typed/cluster/v1alpha1" + machinev1beta1 "github.com/openshift/cluster-api/pkg/client/clientset_generated/clientset/typed/machine/v1beta1" discovery "k8s.io/client-go/discovery" rest "k8s.io/client-go/rest" flowcontrol "k8s.io/client-go/util/flowcontrol" - clusterv1alpha1 "sigs.k8s.io/cluster-api/pkg/client/clientset_generated/clientset/typed/cluster/v1alpha1" ) type Interface interface { @@ -30,6 +31,9 @@ type Interface interface { ClusterV1alpha1() clusterv1alpha1.ClusterV1alpha1Interface // Deprecated: please explicitly pick a version if possible. Cluster() clusterv1alpha1.ClusterV1alpha1Interface + MachineV1beta1() machinev1beta1.MachineV1beta1Interface + // Deprecated: please explicitly pick a version if possible. + Machine() machinev1beta1.MachineV1beta1Interface } // Clientset contains the clients for groups. Each group has exactly one @@ -37,6 +41,7 @@ type Interface interface { type Clientset struct { *discovery.DiscoveryClient clusterV1alpha1 *clusterv1alpha1.ClusterV1alpha1Client + machineV1beta1 *machinev1beta1.MachineV1beta1Client } // ClusterV1alpha1 retrieves the ClusterV1alpha1Client @@ -50,6 +55,17 @@ func (c *Clientset) Cluster() clusterv1alpha1.ClusterV1alpha1Interface { return c.clusterV1alpha1 } +// MachineV1beta1 retrieves the MachineV1beta1Client +func (c *Clientset) MachineV1beta1() machinev1beta1.MachineV1beta1Interface { + return c.machineV1beta1 +} + +// Deprecated: Machine retrieves the default version of MachineClient. +// Please explicitly pick a version. +func (c *Clientset) Machine() machinev1beta1.MachineV1beta1Interface { + return c.machineV1beta1 +} + // Discovery retrieves the DiscoveryClient func (c *Clientset) Discovery() discovery.DiscoveryInterface { if c == nil { @@ -70,6 +86,10 @@ func NewForConfig(c *rest.Config) (*Clientset, error) { if err != nil { return nil, err } + cs.machineV1beta1, err = machinev1beta1.NewForConfig(&configShallowCopy) + if err != nil { + return nil, err + } cs.DiscoveryClient, err = discovery.NewDiscoveryClientForConfig(&configShallowCopy) if err != nil { @@ -83,6 +103,7 @@ func NewForConfig(c *rest.Config) (*Clientset, error) { func NewForConfigOrDie(c *rest.Config) *Clientset { var cs Clientset cs.clusterV1alpha1 = clusterv1alpha1.NewForConfigOrDie(c) + cs.machineV1beta1 = machinev1beta1.NewForConfigOrDie(c) cs.DiscoveryClient = discovery.NewDiscoveryClientForConfigOrDie(c) return &cs @@ -92,6 +113,7 @@ func NewForConfigOrDie(c *rest.Config) *Clientset { func New(c rest.Interface) *Clientset { var cs Clientset cs.clusterV1alpha1 = clusterv1alpha1.New(c) + cs.machineV1beta1 = machinev1beta1.New(c) cs.DiscoveryClient = discovery.NewDiscoveryClient(c) return &cs diff --git a/vendor/sigs.k8s.io/cluster-api/pkg/client/clientset_generated/clientset/doc.go b/vendor/github.com/openshift/cluster-api/pkg/client/clientset_generated/clientset/doc.go similarity index 100% rename from vendor/sigs.k8s.io/cluster-api/pkg/client/clientset_generated/clientset/doc.go rename to vendor/github.com/openshift/cluster-api/pkg/client/clientset_generated/clientset/doc.go diff --git a/vendor/sigs.k8s.io/cluster-api/pkg/client/clientset_generated/clientset/fake/BUILD.bazel b/vendor/github.com/openshift/cluster-api/pkg/client/clientset_generated/clientset/fake/BUILD.bazel similarity index 77% rename from vendor/sigs.k8s.io/cluster-api/pkg/client/clientset_generated/clientset/fake/BUILD.bazel rename to vendor/github.com/openshift/cluster-api/pkg/client/clientset_generated/clientset/fake/BUILD.bazel index e3d124b8b..f28dda486 100644 --- a/vendor/sigs.k8s.io/cluster-api/pkg/client/clientset_generated/clientset/fake/BUILD.bazel +++ b/vendor/github.com/openshift/cluster-api/pkg/client/clientset_generated/clientset/fake/BUILD.bazel @@ -7,13 +7,16 @@ go_library( "doc.go", "register.go", ], - importpath = "sigs.k8s.io/cluster-api/pkg/client/clientset_generated/clientset/fake", + importpath = "github.com/openshift/cluster-api/pkg/client/clientset_generated/clientset/fake", visibility = ["//visibility:public"], deps = [ "//pkg/apis/cluster/v1alpha1:go_default_library", + "//pkg/apis/machine/v1beta1:go_default_library", "//pkg/client/clientset_generated/clientset:go_default_library", "//pkg/client/clientset_generated/clientset/typed/cluster/v1alpha1:go_default_library", "//pkg/client/clientset_generated/clientset/typed/cluster/v1alpha1/fake:go_default_library", + "//pkg/client/clientset_generated/clientset/typed/machine/v1beta1:go_default_library", + "//pkg/client/clientset_generated/clientset/typed/machine/v1beta1/fake:go_default_library", "//vendor/k8s.io/apimachinery/pkg/apis/meta/v1:go_default_library", "//vendor/k8s.io/apimachinery/pkg/runtime:go_default_library", "//vendor/k8s.io/apimachinery/pkg/runtime/schema:go_default_library", diff --git a/vendor/sigs.k8s.io/cluster-api/pkg/client/clientset_generated/clientset/fake/clientset_generated.go b/vendor/github.com/openshift/cluster-api/pkg/client/clientset_generated/clientset/fake/clientset_generated.go similarity index 73% rename from vendor/sigs.k8s.io/cluster-api/pkg/client/clientset_generated/clientset/fake/clientset_generated.go rename to vendor/github.com/openshift/cluster-api/pkg/client/clientset_generated/clientset/fake/clientset_generated.go index 5d9e34e78..dce09350d 100644 --- a/vendor/sigs.k8s.io/cluster-api/pkg/client/clientset_generated/clientset/fake/clientset_generated.go +++ b/vendor/github.com/openshift/cluster-api/pkg/client/clientset_generated/clientset/fake/clientset_generated.go @@ -19,14 +19,16 @@ limitations under the License. package fake import ( + clientset "github.com/openshift/cluster-api/pkg/client/clientset_generated/clientset" + clusterv1alpha1 "github.com/openshift/cluster-api/pkg/client/clientset_generated/clientset/typed/cluster/v1alpha1" + fakeclusterv1alpha1 "github.com/openshift/cluster-api/pkg/client/clientset_generated/clientset/typed/cluster/v1alpha1/fake" + machinev1beta1 "github.com/openshift/cluster-api/pkg/client/clientset_generated/clientset/typed/machine/v1beta1" + fakemachinev1beta1 "github.com/openshift/cluster-api/pkg/client/clientset_generated/clientset/typed/machine/v1beta1/fake" "k8s.io/apimachinery/pkg/runtime" "k8s.io/apimachinery/pkg/watch" "k8s.io/client-go/discovery" fakediscovery "k8s.io/client-go/discovery/fake" "k8s.io/client-go/testing" - clientset "sigs.k8s.io/cluster-api/pkg/client/clientset_generated/clientset" - clusterv1alpha1 "sigs.k8s.io/cluster-api/pkg/client/clientset_generated/clientset/typed/cluster/v1alpha1" - fakeclusterv1alpha1 "sigs.k8s.io/cluster-api/pkg/client/clientset_generated/clientset/typed/cluster/v1alpha1/fake" ) // NewSimpleClientset returns a clientset that will respond with the provided objects. @@ -80,3 +82,13 @@ func (c *Clientset) ClusterV1alpha1() clusterv1alpha1.ClusterV1alpha1Interface { func (c *Clientset) Cluster() clusterv1alpha1.ClusterV1alpha1Interface { return &fakeclusterv1alpha1.FakeClusterV1alpha1{Fake: &c.Fake} } + +// MachineV1beta1 retrieves the MachineV1beta1Client +func (c *Clientset) MachineV1beta1() machinev1beta1.MachineV1beta1Interface { + return &fakemachinev1beta1.FakeMachineV1beta1{Fake: &c.Fake} +} + +// Machine retrieves the MachineV1beta1Client +func (c *Clientset) Machine() machinev1beta1.MachineV1beta1Interface { + return &fakemachinev1beta1.FakeMachineV1beta1{Fake: &c.Fake} +} diff --git a/vendor/sigs.k8s.io/cluster-api/pkg/client/clientset_generated/clientset/fake/doc.go b/vendor/github.com/openshift/cluster-api/pkg/client/clientset_generated/clientset/fake/doc.go similarity index 100% rename from vendor/sigs.k8s.io/cluster-api/pkg/client/clientset_generated/clientset/fake/doc.go rename to vendor/github.com/openshift/cluster-api/pkg/client/clientset_generated/clientset/fake/doc.go diff --git a/vendor/sigs.k8s.io/cluster-api/pkg/client/clientset_generated/clientset/fake/register.go b/vendor/github.com/openshift/cluster-api/pkg/client/clientset_generated/clientset/fake/register.go similarity index 91% rename from vendor/sigs.k8s.io/cluster-api/pkg/client/clientset_generated/clientset/fake/register.go rename to vendor/github.com/openshift/cluster-api/pkg/client/clientset_generated/clientset/fake/register.go index 47efc4e89..c10e170c3 100644 --- a/vendor/sigs.k8s.io/cluster-api/pkg/client/clientset_generated/clientset/fake/register.go +++ b/vendor/github.com/openshift/cluster-api/pkg/client/clientset_generated/clientset/fake/register.go @@ -19,12 +19,13 @@ limitations under the License. package fake import ( + clusterv1alpha1 "github.com/openshift/cluster-api/pkg/apis/cluster/v1alpha1" + machinev1beta1 "github.com/openshift/cluster-api/pkg/apis/machine/v1beta1" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" runtime "k8s.io/apimachinery/pkg/runtime" schema "k8s.io/apimachinery/pkg/runtime/schema" serializer "k8s.io/apimachinery/pkg/runtime/serializer" utilruntime "k8s.io/apimachinery/pkg/util/runtime" - clusterv1alpha1 "sigs.k8s.io/cluster-api/pkg/apis/cluster/v1alpha1" ) var scheme = runtime.NewScheme() @@ -32,6 +33,7 @@ var codecs = serializer.NewCodecFactory(scheme) var parameterCodec = runtime.NewParameterCodec(scheme) var localSchemeBuilder = runtime.SchemeBuilder{ clusterv1alpha1.AddToScheme, + machinev1beta1.AddToScheme, } // AddToScheme adds all types of this clientset into the given scheme. This allows composition diff --git a/vendor/sigs.k8s.io/cluster-api/pkg/client/clientset_generated/clientset/scheme/BUILD.bazel b/vendor/github.com/openshift/cluster-api/pkg/client/clientset_generated/clientset/scheme/BUILD.bazel similarity index 80% rename from vendor/sigs.k8s.io/cluster-api/pkg/client/clientset_generated/clientset/scheme/BUILD.bazel rename to vendor/github.com/openshift/cluster-api/pkg/client/clientset_generated/clientset/scheme/BUILD.bazel index 967e9635f..44d177000 100644 --- a/vendor/sigs.k8s.io/cluster-api/pkg/client/clientset_generated/clientset/scheme/BUILD.bazel +++ b/vendor/github.com/openshift/cluster-api/pkg/client/clientset_generated/clientset/scheme/BUILD.bazel @@ -6,10 +6,11 @@ go_library( "doc.go", "register.go", ], - importpath = "sigs.k8s.io/cluster-api/pkg/client/clientset_generated/clientset/scheme", + importpath = "github.com/openshift/cluster-api/pkg/client/clientset_generated/clientset/scheme", visibility = ["//visibility:public"], deps = [ "//pkg/apis/cluster/v1alpha1:go_default_library", + "//pkg/apis/machine/v1beta1:go_default_library", "//vendor/k8s.io/apimachinery/pkg/apis/meta/v1:go_default_library", "//vendor/k8s.io/apimachinery/pkg/runtime:go_default_library", "//vendor/k8s.io/apimachinery/pkg/runtime/schema:go_default_library", diff --git a/vendor/sigs.k8s.io/cluster-api/pkg/client/clientset_generated/clientset/scheme/doc.go b/vendor/github.com/openshift/cluster-api/pkg/client/clientset_generated/clientset/scheme/doc.go similarity index 100% rename from vendor/sigs.k8s.io/cluster-api/pkg/client/clientset_generated/clientset/scheme/doc.go rename to vendor/github.com/openshift/cluster-api/pkg/client/clientset_generated/clientset/scheme/doc.go diff --git a/vendor/sigs.k8s.io/cluster-api/pkg/client/clientset_generated/clientset/scheme/register.go b/vendor/github.com/openshift/cluster-api/pkg/client/clientset_generated/clientset/scheme/register.go similarity index 91% rename from vendor/sigs.k8s.io/cluster-api/pkg/client/clientset_generated/clientset/scheme/register.go rename to vendor/github.com/openshift/cluster-api/pkg/client/clientset_generated/clientset/scheme/register.go index ecb609f77..afb084a63 100644 --- a/vendor/sigs.k8s.io/cluster-api/pkg/client/clientset_generated/clientset/scheme/register.go +++ b/vendor/github.com/openshift/cluster-api/pkg/client/clientset_generated/clientset/scheme/register.go @@ -19,12 +19,13 @@ limitations under the License. package scheme import ( + clusterv1alpha1 "github.com/openshift/cluster-api/pkg/apis/cluster/v1alpha1" + machinev1beta1 "github.com/openshift/cluster-api/pkg/apis/machine/v1beta1" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" runtime "k8s.io/apimachinery/pkg/runtime" schema "k8s.io/apimachinery/pkg/runtime/schema" serializer "k8s.io/apimachinery/pkg/runtime/serializer" utilruntime "k8s.io/apimachinery/pkg/util/runtime" - clusterv1alpha1 "sigs.k8s.io/cluster-api/pkg/apis/cluster/v1alpha1" ) var Scheme = runtime.NewScheme() @@ -32,6 +33,7 @@ var Codecs = serializer.NewCodecFactory(Scheme) var ParameterCodec = runtime.NewParameterCodec(Scheme) var localSchemeBuilder = runtime.SchemeBuilder{ clusterv1alpha1.AddToScheme, + machinev1beta1.AddToScheme, } // AddToScheme adds all types of this clientset into the given scheme. This allows composition diff --git a/vendor/sigs.k8s.io/cluster-api/pkg/client/clientset_generated/clientset/typed/cluster/v1alpha1/BUILD.bazel b/vendor/github.com/openshift/cluster-api/pkg/client/clientset_generated/clientset/typed/cluster/v1alpha1/BUILD.bazel similarity index 88% rename from vendor/sigs.k8s.io/cluster-api/pkg/client/clientset_generated/clientset/typed/cluster/v1alpha1/BUILD.bazel rename to vendor/github.com/openshift/cluster-api/pkg/client/clientset_generated/clientset/typed/cluster/v1alpha1/BUILD.bazel index d7034eae0..157ef970e 100644 --- a/vendor/sigs.k8s.io/cluster-api/pkg/client/clientset_generated/clientset/typed/cluster/v1alpha1/BUILD.bazel +++ b/vendor/github.com/openshift/cluster-api/pkg/client/clientset_generated/clientset/typed/cluster/v1alpha1/BUILD.bazel @@ -12,7 +12,7 @@ go_library( "machinedeployment.go", "machineset.go", ], - importpath = "sigs.k8s.io/cluster-api/pkg/client/clientset_generated/clientset/typed/cluster/v1alpha1", + importpath = "github.com/openshift/cluster-api/pkg/client/clientset_generated/clientset/typed/cluster/v1alpha1", visibility = ["//visibility:public"], deps = [ "//pkg/apis/cluster/v1alpha1:go_default_library", diff --git a/vendor/sigs.k8s.io/cluster-api/pkg/client/clientset_generated/clientset/typed/cluster/v1alpha1/cluster.go b/vendor/github.com/openshift/cluster-api/pkg/client/clientset_generated/clientset/typed/cluster/v1alpha1/cluster.go similarity index 97% rename from vendor/sigs.k8s.io/cluster-api/pkg/client/clientset_generated/clientset/typed/cluster/v1alpha1/cluster.go rename to vendor/github.com/openshift/cluster-api/pkg/client/clientset_generated/clientset/typed/cluster/v1alpha1/cluster.go index 531c48ba6..00b10e505 100644 --- a/vendor/sigs.k8s.io/cluster-api/pkg/client/clientset_generated/clientset/typed/cluster/v1alpha1/cluster.go +++ b/vendor/github.com/openshift/cluster-api/pkg/client/clientset_generated/clientset/typed/cluster/v1alpha1/cluster.go @@ -19,12 +19,12 @@ limitations under the License. package v1alpha1 import ( + v1alpha1 "github.com/openshift/cluster-api/pkg/apis/cluster/v1alpha1" + scheme "github.com/openshift/cluster-api/pkg/client/clientset_generated/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" - v1alpha1 "sigs.k8s.io/cluster-api/pkg/apis/cluster/v1alpha1" - scheme "sigs.k8s.io/cluster-api/pkg/client/clientset_generated/clientset/scheme" ) // ClustersGetter has a method to return a ClusterInterface. diff --git a/vendor/sigs.k8s.io/cluster-api/pkg/client/clientset_generated/clientset/typed/cluster/v1alpha1/cluster_client.go b/vendor/github.com/openshift/cluster-api/pkg/client/clientset_generated/clientset/typed/cluster/v1alpha1/cluster_client.go similarity index 95% rename from vendor/sigs.k8s.io/cluster-api/pkg/client/clientset_generated/clientset/typed/cluster/v1alpha1/cluster_client.go rename to vendor/github.com/openshift/cluster-api/pkg/client/clientset_generated/clientset/typed/cluster/v1alpha1/cluster_client.go index 85c29d2fb..f9081c350 100644 --- a/vendor/sigs.k8s.io/cluster-api/pkg/client/clientset_generated/clientset/typed/cluster/v1alpha1/cluster_client.go +++ b/vendor/github.com/openshift/cluster-api/pkg/client/clientset_generated/clientset/typed/cluster/v1alpha1/cluster_client.go @@ -19,10 +19,10 @@ limitations under the License. package v1alpha1 import ( + v1alpha1 "github.com/openshift/cluster-api/pkg/apis/cluster/v1alpha1" + "github.com/openshift/cluster-api/pkg/client/clientset_generated/clientset/scheme" serializer "k8s.io/apimachinery/pkg/runtime/serializer" rest "k8s.io/client-go/rest" - v1alpha1 "sigs.k8s.io/cluster-api/pkg/apis/cluster/v1alpha1" - "sigs.k8s.io/cluster-api/pkg/client/clientset_generated/clientset/scheme" ) type ClusterV1alpha1Interface interface { diff --git a/vendor/sigs.k8s.io/cluster-api/pkg/client/clientset_generated/clientset/typed/cluster/v1alpha1/doc.go b/vendor/github.com/openshift/cluster-api/pkg/client/clientset_generated/clientset/typed/cluster/v1alpha1/doc.go similarity index 100% rename from vendor/sigs.k8s.io/cluster-api/pkg/client/clientset_generated/clientset/typed/cluster/v1alpha1/doc.go rename to vendor/github.com/openshift/cluster-api/pkg/client/clientset_generated/clientset/typed/cluster/v1alpha1/doc.go diff --git a/vendor/sigs.k8s.io/cluster-api/pkg/client/clientset_generated/clientset/typed/cluster/v1alpha1/fake/BUILD.bazel b/vendor/github.com/openshift/cluster-api/pkg/client/clientset_generated/clientset/typed/cluster/v1alpha1/fake/BUILD.bazel similarity index 89% rename from vendor/sigs.k8s.io/cluster-api/pkg/client/clientset_generated/clientset/typed/cluster/v1alpha1/fake/BUILD.bazel rename to vendor/github.com/openshift/cluster-api/pkg/client/clientset_generated/clientset/typed/cluster/v1alpha1/fake/BUILD.bazel index 76a6933b2..4da0d037e 100644 --- a/vendor/sigs.k8s.io/cluster-api/pkg/client/clientset_generated/clientset/typed/cluster/v1alpha1/fake/BUILD.bazel +++ b/vendor/github.com/openshift/cluster-api/pkg/client/clientset_generated/clientset/typed/cluster/v1alpha1/fake/BUILD.bazel @@ -11,7 +11,7 @@ go_library( "fake_machinedeployment.go", "fake_machineset.go", ], - importpath = "sigs.k8s.io/cluster-api/pkg/client/clientset_generated/clientset/typed/cluster/v1alpha1/fake", + importpath = "github.com/openshift/cluster-api/pkg/client/clientset_generated/clientset/typed/cluster/v1alpha1/fake", visibility = ["//visibility:public"], deps = [ "//pkg/apis/cluster/v1alpha1:go_default_library", diff --git a/vendor/sigs.k8s.io/cluster-api/pkg/client/clientset_generated/clientset/typed/cluster/v1alpha1/fake/doc.go b/vendor/github.com/openshift/cluster-api/pkg/client/clientset_generated/clientset/typed/cluster/v1alpha1/fake/doc.go similarity index 100% rename from vendor/sigs.k8s.io/cluster-api/pkg/client/clientset_generated/clientset/typed/cluster/v1alpha1/fake/doc.go rename to vendor/github.com/openshift/cluster-api/pkg/client/clientset_generated/clientset/typed/cluster/v1alpha1/fake/doc.go diff --git a/vendor/sigs.k8s.io/cluster-api/pkg/client/clientset_generated/clientset/typed/cluster/v1alpha1/fake/fake_cluster.go b/vendor/github.com/openshift/cluster-api/pkg/client/clientset_generated/clientset/typed/cluster/v1alpha1/fake/fake_cluster.go similarity index 98% rename from vendor/sigs.k8s.io/cluster-api/pkg/client/clientset_generated/clientset/typed/cluster/v1alpha1/fake/fake_cluster.go rename to vendor/github.com/openshift/cluster-api/pkg/client/clientset_generated/clientset/typed/cluster/v1alpha1/fake/fake_cluster.go index 2bdae205a..4554fd127 100644 --- a/vendor/sigs.k8s.io/cluster-api/pkg/client/clientset_generated/clientset/typed/cluster/v1alpha1/fake/fake_cluster.go +++ b/vendor/github.com/openshift/cluster-api/pkg/client/clientset_generated/clientset/typed/cluster/v1alpha1/fake/fake_cluster.go @@ -19,13 +19,13 @@ limitations under the License. package fake import ( + v1alpha1 "github.com/openshift/cluster-api/pkg/apis/cluster/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" - v1alpha1 "sigs.k8s.io/cluster-api/pkg/apis/cluster/v1alpha1" ) // FakeClusters implements ClusterInterface diff --git a/vendor/sigs.k8s.io/cluster-api/pkg/client/clientset_generated/clientset/typed/cluster/v1alpha1/fake/fake_cluster_client.go b/vendor/github.com/openshift/cluster-api/pkg/client/clientset_generated/clientset/typed/cluster/v1alpha1/fake/fake_cluster_client.go similarity index 93% rename from vendor/sigs.k8s.io/cluster-api/pkg/client/clientset_generated/clientset/typed/cluster/v1alpha1/fake/fake_cluster_client.go rename to vendor/github.com/openshift/cluster-api/pkg/client/clientset_generated/clientset/typed/cluster/v1alpha1/fake/fake_cluster_client.go index 9e08c5d5b..aca19fdcb 100644 --- a/vendor/sigs.k8s.io/cluster-api/pkg/client/clientset_generated/clientset/typed/cluster/v1alpha1/fake/fake_cluster_client.go +++ b/vendor/github.com/openshift/cluster-api/pkg/client/clientset_generated/clientset/typed/cluster/v1alpha1/fake/fake_cluster_client.go @@ -19,9 +19,9 @@ limitations under the License. package fake import ( + v1alpha1 "github.com/openshift/cluster-api/pkg/client/clientset_generated/clientset/typed/cluster/v1alpha1" rest "k8s.io/client-go/rest" testing "k8s.io/client-go/testing" - v1alpha1 "sigs.k8s.io/cluster-api/pkg/client/clientset_generated/clientset/typed/cluster/v1alpha1" ) type FakeClusterV1alpha1 struct { diff --git a/vendor/sigs.k8s.io/cluster-api/pkg/client/clientset_generated/clientset/typed/cluster/v1alpha1/fake/fake_machine.go b/vendor/github.com/openshift/cluster-api/pkg/client/clientset_generated/clientset/typed/cluster/v1alpha1/fake/fake_machine.go similarity index 98% rename from vendor/sigs.k8s.io/cluster-api/pkg/client/clientset_generated/clientset/typed/cluster/v1alpha1/fake/fake_machine.go rename to vendor/github.com/openshift/cluster-api/pkg/client/clientset_generated/clientset/typed/cluster/v1alpha1/fake/fake_machine.go index cdd274aa1..70036f36c 100644 --- a/vendor/sigs.k8s.io/cluster-api/pkg/client/clientset_generated/clientset/typed/cluster/v1alpha1/fake/fake_machine.go +++ b/vendor/github.com/openshift/cluster-api/pkg/client/clientset_generated/clientset/typed/cluster/v1alpha1/fake/fake_machine.go @@ -19,13 +19,13 @@ limitations under the License. package fake import ( + v1alpha1 "github.com/openshift/cluster-api/pkg/apis/cluster/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" - v1alpha1 "sigs.k8s.io/cluster-api/pkg/apis/cluster/v1alpha1" ) // FakeMachines implements MachineInterface diff --git a/vendor/sigs.k8s.io/cluster-api/pkg/client/clientset_generated/clientset/typed/cluster/v1alpha1/fake/fake_machineclass.go b/vendor/github.com/openshift/cluster-api/pkg/client/clientset_generated/clientset/typed/cluster/v1alpha1/fake/fake_machineclass.go similarity index 98% rename from vendor/sigs.k8s.io/cluster-api/pkg/client/clientset_generated/clientset/typed/cluster/v1alpha1/fake/fake_machineclass.go rename to vendor/github.com/openshift/cluster-api/pkg/client/clientset_generated/clientset/typed/cluster/v1alpha1/fake/fake_machineclass.go index ee36cd524..995955a7d 100644 --- a/vendor/sigs.k8s.io/cluster-api/pkg/client/clientset_generated/clientset/typed/cluster/v1alpha1/fake/fake_machineclass.go +++ b/vendor/github.com/openshift/cluster-api/pkg/client/clientset_generated/clientset/typed/cluster/v1alpha1/fake/fake_machineclass.go @@ -19,13 +19,13 @@ limitations under the License. package fake import ( + v1alpha1 "github.com/openshift/cluster-api/pkg/apis/cluster/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" - v1alpha1 "sigs.k8s.io/cluster-api/pkg/apis/cluster/v1alpha1" ) // FakeMachineClasses implements MachineClassInterface diff --git a/vendor/sigs.k8s.io/cluster-api/pkg/client/clientset_generated/clientset/typed/cluster/v1alpha1/fake/fake_machinedeployment.go b/vendor/github.com/openshift/cluster-api/pkg/client/clientset_generated/clientset/typed/cluster/v1alpha1/fake/fake_machinedeployment.go similarity index 98% rename from vendor/sigs.k8s.io/cluster-api/pkg/client/clientset_generated/clientset/typed/cluster/v1alpha1/fake/fake_machinedeployment.go rename to vendor/github.com/openshift/cluster-api/pkg/client/clientset_generated/clientset/typed/cluster/v1alpha1/fake/fake_machinedeployment.go index 26fa794d7..092c03c3b 100644 --- a/vendor/sigs.k8s.io/cluster-api/pkg/client/clientset_generated/clientset/typed/cluster/v1alpha1/fake/fake_machinedeployment.go +++ b/vendor/github.com/openshift/cluster-api/pkg/client/clientset_generated/clientset/typed/cluster/v1alpha1/fake/fake_machinedeployment.go @@ -19,13 +19,13 @@ limitations under the License. package fake import ( + v1alpha1 "github.com/openshift/cluster-api/pkg/apis/cluster/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" - v1alpha1 "sigs.k8s.io/cluster-api/pkg/apis/cluster/v1alpha1" ) // FakeMachineDeployments implements MachineDeploymentInterface diff --git a/vendor/sigs.k8s.io/cluster-api/pkg/client/clientset_generated/clientset/typed/cluster/v1alpha1/fake/fake_machineset.go b/vendor/github.com/openshift/cluster-api/pkg/client/clientset_generated/clientset/typed/cluster/v1alpha1/fake/fake_machineset.go similarity index 98% rename from vendor/sigs.k8s.io/cluster-api/pkg/client/clientset_generated/clientset/typed/cluster/v1alpha1/fake/fake_machineset.go rename to vendor/github.com/openshift/cluster-api/pkg/client/clientset_generated/clientset/typed/cluster/v1alpha1/fake/fake_machineset.go index c333daa68..fbd9447fe 100644 --- a/vendor/sigs.k8s.io/cluster-api/pkg/client/clientset_generated/clientset/typed/cluster/v1alpha1/fake/fake_machineset.go +++ b/vendor/github.com/openshift/cluster-api/pkg/client/clientset_generated/clientset/typed/cluster/v1alpha1/fake/fake_machineset.go @@ -19,13 +19,13 @@ limitations under the License. package fake import ( + v1alpha1 "github.com/openshift/cluster-api/pkg/apis/cluster/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" - v1alpha1 "sigs.k8s.io/cluster-api/pkg/apis/cluster/v1alpha1" ) // FakeMachineSets implements MachineSetInterface diff --git a/vendor/sigs.k8s.io/cluster-api/pkg/client/clientset_generated/clientset/typed/cluster/v1alpha1/generated_expansion.go b/vendor/github.com/openshift/cluster-api/pkg/client/clientset_generated/clientset/typed/cluster/v1alpha1/generated_expansion.go similarity index 100% rename from vendor/sigs.k8s.io/cluster-api/pkg/client/clientset_generated/clientset/typed/cluster/v1alpha1/generated_expansion.go rename to vendor/github.com/openshift/cluster-api/pkg/client/clientset_generated/clientset/typed/cluster/v1alpha1/generated_expansion.go diff --git a/vendor/sigs.k8s.io/cluster-api/pkg/client/clientset_generated/clientset/typed/cluster/v1alpha1/machine.go b/vendor/github.com/openshift/cluster-api/pkg/client/clientset_generated/clientset/typed/cluster/v1alpha1/machine.go similarity index 97% rename from vendor/sigs.k8s.io/cluster-api/pkg/client/clientset_generated/clientset/typed/cluster/v1alpha1/machine.go rename to vendor/github.com/openshift/cluster-api/pkg/client/clientset_generated/clientset/typed/cluster/v1alpha1/machine.go index 2d5b5c4cb..4a3ada009 100644 --- a/vendor/sigs.k8s.io/cluster-api/pkg/client/clientset_generated/clientset/typed/cluster/v1alpha1/machine.go +++ b/vendor/github.com/openshift/cluster-api/pkg/client/clientset_generated/clientset/typed/cluster/v1alpha1/machine.go @@ -19,12 +19,12 @@ limitations under the License. package v1alpha1 import ( + v1alpha1 "github.com/openshift/cluster-api/pkg/apis/cluster/v1alpha1" + scheme "github.com/openshift/cluster-api/pkg/client/clientset_generated/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" - v1alpha1 "sigs.k8s.io/cluster-api/pkg/apis/cluster/v1alpha1" - scheme "sigs.k8s.io/cluster-api/pkg/client/clientset_generated/clientset/scheme" ) // MachinesGetter has a method to return a MachineInterface. diff --git a/vendor/sigs.k8s.io/cluster-api/pkg/client/clientset_generated/clientset/typed/cluster/v1alpha1/machineclass.go b/vendor/github.com/openshift/cluster-api/pkg/client/clientset_generated/clientset/typed/cluster/v1alpha1/machineclass.go similarity index 96% rename from vendor/sigs.k8s.io/cluster-api/pkg/client/clientset_generated/clientset/typed/cluster/v1alpha1/machineclass.go rename to vendor/github.com/openshift/cluster-api/pkg/client/clientset_generated/clientset/typed/cluster/v1alpha1/machineclass.go index 9d685d94f..2d01222e8 100644 --- a/vendor/sigs.k8s.io/cluster-api/pkg/client/clientset_generated/clientset/typed/cluster/v1alpha1/machineclass.go +++ b/vendor/github.com/openshift/cluster-api/pkg/client/clientset_generated/clientset/typed/cluster/v1alpha1/machineclass.go @@ -19,12 +19,12 @@ limitations under the License. package v1alpha1 import ( + v1alpha1 "github.com/openshift/cluster-api/pkg/apis/cluster/v1alpha1" + scheme "github.com/openshift/cluster-api/pkg/client/clientset_generated/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" - v1alpha1 "sigs.k8s.io/cluster-api/pkg/apis/cluster/v1alpha1" - scheme "sigs.k8s.io/cluster-api/pkg/client/clientset_generated/clientset/scheme" ) // MachineClassesGetter has a method to return a MachineClassInterface. diff --git a/vendor/sigs.k8s.io/cluster-api/pkg/client/clientset_generated/clientset/typed/cluster/v1alpha1/machinedeployment.go b/vendor/github.com/openshift/cluster-api/pkg/client/clientset_generated/clientset/typed/cluster/v1alpha1/machinedeployment.go similarity index 97% rename from vendor/sigs.k8s.io/cluster-api/pkg/client/clientset_generated/clientset/typed/cluster/v1alpha1/machinedeployment.go rename to vendor/github.com/openshift/cluster-api/pkg/client/clientset_generated/clientset/typed/cluster/v1alpha1/machinedeployment.go index 41a499054..9582b5bc6 100644 --- a/vendor/sigs.k8s.io/cluster-api/pkg/client/clientset_generated/clientset/typed/cluster/v1alpha1/machinedeployment.go +++ b/vendor/github.com/openshift/cluster-api/pkg/client/clientset_generated/clientset/typed/cluster/v1alpha1/machinedeployment.go @@ -19,12 +19,12 @@ limitations under the License. package v1alpha1 import ( + v1alpha1 "github.com/openshift/cluster-api/pkg/apis/cluster/v1alpha1" + scheme "github.com/openshift/cluster-api/pkg/client/clientset_generated/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" - v1alpha1 "sigs.k8s.io/cluster-api/pkg/apis/cluster/v1alpha1" - scheme "sigs.k8s.io/cluster-api/pkg/client/clientset_generated/clientset/scheme" ) // MachineDeploymentsGetter has a method to return a MachineDeploymentInterface. diff --git a/vendor/sigs.k8s.io/cluster-api/pkg/client/clientset_generated/clientset/typed/cluster/v1alpha1/machineset.go b/vendor/github.com/openshift/cluster-api/pkg/client/clientset_generated/clientset/typed/cluster/v1alpha1/machineset.go similarity index 97% rename from vendor/sigs.k8s.io/cluster-api/pkg/client/clientset_generated/clientset/typed/cluster/v1alpha1/machineset.go rename to vendor/github.com/openshift/cluster-api/pkg/client/clientset_generated/clientset/typed/cluster/v1alpha1/machineset.go index 25886851d..42dee1177 100644 --- a/vendor/sigs.k8s.io/cluster-api/pkg/client/clientset_generated/clientset/typed/cluster/v1alpha1/machineset.go +++ b/vendor/github.com/openshift/cluster-api/pkg/client/clientset_generated/clientset/typed/cluster/v1alpha1/machineset.go @@ -19,12 +19,12 @@ limitations under the License. package v1alpha1 import ( + v1alpha1 "github.com/openshift/cluster-api/pkg/apis/cluster/v1alpha1" + scheme "github.com/openshift/cluster-api/pkg/client/clientset_generated/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" - v1alpha1 "sigs.k8s.io/cluster-api/pkg/apis/cluster/v1alpha1" - scheme "sigs.k8s.io/cluster-api/pkg/client/clientset_generated/clientset/scheme" ) // MachineSetsGetter has a method to return a MachineSetInterface. diff --git a/vendor/github.com/openshift/cluster-api/pkg/client/clientset_generated/clientset/typed/machine/v1beta1/BUILD.bazel b/vendor/github.com/openshift/cluster-api/pkg/client/clientset_generated/clientset/typed/machine/v1beta1/BUILD.bazel new file mode 100644 index 000000000..be7c3feb1 --- /dev/null +++ b/vendor/github.com/openshift/cluster-api/pkg/client/clientset_generated/clientset/typed/machine/v1beta1/BUILD.bazel @@ -0,0 +1,26 @@ +load("@io_bazel_rules_go//go:def.bzl", "go_library") + +go_library( + name = "go_default_library", + srcs = [ + "cluster.go", + "doc.go", + "generated_expansion.go", + "machine.go", + "machine_client.go", + "machineclass.go", + "machinedeployment.go", + "machineset.go", + ], + importpath = "github.com/openshift/cluster-api/pkg/client/clientset_generated/clientset/typed/machine/v1beta1", + visibility = ["//visibility:public"], + deps = [ + "//pkg/apis/machine/v1beta1:go_default_library", + "//pkg/client/clientset_generated/clientset/scheme:go_default_library", + "//vendor/k8s.io/apimachinery/pkg/apis/meta/v1:go_default_library", + "//vendor/k8s.io/apimachinery/pkg/runtime/serializer:go_default_library", + "//vendor/k8s.io/apimachinery/pkg/types:go_default_library", + "//vendor/k8s.io/apimachinery/pkg/watch:go_default_library", + "//vendor/k8s.io/client-go/rest:go_default_library", + ], +) diff --git a/vendor/github.com/openshift/cluster-api/pkg/client/clientset_generated/clientset/typed/machine/v1beta1/cluster.go b/vendor/github.com/openshift/cluster-api/pkg/client/clientset_generated/clientset/typed/machine/v1beta1/cluster.go new file mode 100644 index 000000000..b996ae44a --- /dev/null +++ b/vendor/github.com/openshift/cluster-api/pkg/client/clientset_generated/clientset/typed/machine/v1beta1/cluster.go @@ -0,0 +1,174 @@ +/* +Copyright 2018 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by client-gen. DO NOT EDIT. + +package v1beta1 + +import ( + v1beta1 "github.com/openshift/cluster-api/pkg/apis/machine/v1beta1" + scheme "github.com/openshift/cluster-api/pkg/client/clientset_generated/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" +) + +// ClustersGetter has a method to return a ClusterInterface. +// A group's client should implement this interface. +type ClustersGetter interface { + Clusters(namespace string) ClusterInterface +} + +// ClusterInterface has methods to work with Cluster resources. +type ClusterInterface interface { + Create(*v1beta1.Cluster) (*v1beta1.Cluster, error) + Update(*v1beta1.Cluster) (*v1beta1.Cluster, error) + UpdateStatus(*v1beta1.Cluster) (*v1beta1.Cluster, error) + Delete(name string, options *v1.DeleteOptions) error + DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error + Get(name string, options v1.GetOptions) (*v1beta1.Cluster, error) + List(opts v1.ListOptions) (*v1beta1.ClusterList, error) + Watch(opts v1.ListOptions) (watch.Interface, error) + Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1beta1.Cluster, err error) + ClusterExpansion +} + +// clusters implements ClusterInterface +type clusters struct { + client rest.Interface + ns string +} + +// newClusters returns a Clusters +func newClusters(c *MachineV1beta1Client, namespace string) *clusters { + return &clusters{ + client: c.RESTClient(), + ns: namespace, + } +} + +// Get takes name of the cluster, and returns the corresponding cluster object, and an error if there is any. +func (c *clusters) Get(name string, options v1.GetOptions) (result *v1beta1.Cluster, err error) { + result = &v1beta1.Cluster{} + err = c.client.Get(). + Namespace(c.ns). + Resource("clusters"). + Name(name). + VersionedParams(&options, scheme.ParameterCodec). + Do(). + Into(result) + return +} + +// List takes label and field selectors, and returns the list of Clusters that match those selectors. +func (c *clusters) List(opts v1.ListOptions) (result *v1beta1.ClusterList, err error) { + result = &v1beta1.ClusterList{} + err = c.client.Get(). + Namespace(c.ns). + Resource("clusters"). + VersionedParams(&opts, scheme.ParameterCodec). + Do(). + Into(result) + return +} + +// Watch returns a watch.Interface that watches the requested clusters. +func (c *clusters) Watch(opts v1.ListOptions) (watch.Interface, error) { + opts.Watch = true + return c.client.Get(). + Namespace(c.ns). + Resource("clusters"). + VersionedParams(&opts, scheme.ParameterCodec). + Watch() +} + +// Create takes the representation of a cluster and creates it. Returns the server's representation of the cluster, and an error, if there is any. +func (c *clusters) Create(cluster *v1beta1.Cluster) (result *v1beta1.Cluster, err error) { + result = &v1beta1.Cluster{} + err = c.client.Post(). + Namespace(c.ns). + Resource("clusters"). + Body(cluster). + Do(). + Into(result) + return +} + +// Update takes the representation of a cluster and updates it. Returns the server's representation of the cluster, and an error, if there is any. +func (c *clusters) Update(cluster *v1beta1.Cluster) (result *v1beta1.Cluster, err error) { + result = &v1beta1.Cluster{} + err = c.client.Put(). + Namespace(c.ns). + Resource("clusters"). + Name(cluster.Name). + Body(cluster). + Do(). + Into(result) + return +} + +// UpdateStatus was generated because the type contains a Status member. +// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). + +func (c *clusters) UpdateStatus(cluster *v1beta1.Cluster) (result *v1beta1.Cluster, err error) { + result = &v1beta1.Cluster{} + err = c.client.Put(). + Namespace(c.ns). + Resource("clusters"). + Name(cluster.Name). + SubResource("status"). + Body(cluster). + Do(). + Into(result) + return +} + +// Delete takes name of the cluster and deletes it. Returns an error if one occurs. +func (c *clusters) Delete(name string, options *v1.DeleteOptions) error { + return c.client.Delete(). + Namespace(c.ns). + Resource("clusters"). + Name(name). + Body(options). + Do(). + Error() +} + +// DeleteCollection deletes a collection of objects. +func (c *clusters) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error { + return c.client.Delete(). + Namespace(c.ns). + Resource("clusters"). + VersionedParams(&listOptions, scheme.ParameterCodec). + Body(options). + Do(). + Error() +} + +// Patch applies the patch and returns the patched cluster. +func (c *clusters) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1beta1.Cluster, err error) { + result = &v1beta1.Cluster{} + err = c.client.Patch(pt). + Namespace(c.ns). + Resource("clusters"). + SubResource(subresources...). + Name(name). + Body(data). + Do(). + Into(result) + return +} diff --git a/vendor/sigs.k8s.io/cluster-api/cmd/clusterctl/clusterdeployer/bootstrap/provisioner.go b/vendor/github.com/openshift/cluster-api/pkg/client/clientset_generated/clientset/typed/machine/v1beta1/doc.go similarity index 78% rename from vendor/sigs.k8s.io/cluster-api/cmd/clusterctl/clusterdeployer/bootstrap/provisioner.go rename to vendor/github.com/openshift/cluster-api/pkg/client/clientset_generated/clientset/typed/machine/v1beta1/doc.go index 03865ebd7..11ae7049d 100644 --- a/vendor/sigs.k8s.io/cluster-api/cmd/clusterctl/clusterdeployer/bootstrap/provisioner.go +++ b/vendor/github.com/openshift/cluster-api/pkg/client/clientset_generated/clientset/typed/machine/v1beta1/doc.go @@ -14,11 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -package bootstrap +// Code generated by client-gen. DO NOT EDIT. -// Can provision a kubernetes cluster -type ClusterProvisioner interface { - Create() error - Delete() error - GetKubeconfig() (string, error) -} +// This package has the automatically generated typed clients. +package v1beta1 diff --git a/vendor/github.com/openshift/cluster-api/pkg/client/clientset_generated/clientset/typed/machine/v1beta1/fake/BUILD.bazel b/vendor/github.com/openshift/cluster-api/pkg/client/clientset_generated/clientset/typed/machine/v1beta1/fake/BUILD.bazel new file mode 100644 index 000000000..6fcca0ee8 --- /dev/null +++ b/vendor/github.com/openshift/cluster-api/pkg/client/clientset_generated/clientset/typed/machine/v1beta1/fake/BUILD.bazel @@ -0,0 +1,27 @@ +load("@io_bazel_rules_go//go:def.bzl", "go_library") + +go_library( + name = "go_default_library", + srcs = [ + "doc.go", + "fake_cluster.go", + "fake_machine.go", + "fake_machine_client.go", + "fake_machineclass.go", + "fake_machinedeployment.go", + "fake_machineset.go", + ], + importpath = "github.com/openshift/cluster-api/pkg/client/clientset_generated/clientset/typed/machine/v1beta1/fake", + visibility = ["//visibility:public"], + deps = [ + "//pkg/apis/machine/v1beta1:go_default_library", + "//pkg/client/clientset_generated/clientset/typed/machine/v1beta1:go_default_library", + "//vendor/k8s.io/apimachinery/pkg/apis/meta/v1:go_default_library", + "//vendor/k8s.io/apimachinery/pkg/labels:go_default_library", + "//vendor/k8s.io/apimachinery/pkg/runtime/schema:go_default_library", + "//vendor/k8s.io/apimachinery/pkg/types:go_default_library", + "//vendor/k8s.io/apimachinery/pkg/watch:go_default_library", + "//vendor/k8s.io/client-go/rest:go_default_library", + "//vendor/k8s.io/client-go/testing:go_default_library", + ], +) diff --git a/vendor/github.com/openshift/cluster-api/pkg/client/clientset_generated/clientset/typed/machine/v1beta1/fake/doc.go b/vendor/github.com/openshift/cluster-api/pkg/client/clientset_generated/clientset/typed/machine/v1beta1/fake/doc.go new file mode 100644 index 000000000..87a1873ed --- /dev/null +++ b/vendor/github.com/openshift/cluster-api/pkg/client/clientset_generated/clientset/typed/machine/v1beta1/fake/doc.go @@ -0,0 +1,20 @@ +/* +Copyright 2018 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by client-gen. DO NOT EDIT. + +// Package fake has the automatically generated clients. +package fake diff --git a/vendor/github.com/openshift/cluster-api/pkg/client/clientset_generated/clientset/typed/machine/v1beta1/fake/fake_cluster.go b/vendor/github.com/openshift/cluster-api/pkg/client/clientset_generated/clientset/typed/machine/v1beta1/fake/fake_cluster.go new file mode 100644 index 000000000..6e6087777 --- /dev/null +++ b/vendor/github.com/openshift/cluster-api/pkg/client/clientset_generated/clientset/typed/machine/v1beta1/fake/fake_cluster.go @@ -0,0 +1,140 @@ +/* +Copyright 2018 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by client-gen. DO NOT EDIT. + +package fake + +import ( + v1beta1 "github.com/openshift/cluster-api/pkg/apis/machine/v1beta1" + 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" +) + +// FakeClusters implements ClusterInterface +type FakeClusters struct { + Fake *FakeMachineV1beta1 + ns string +} + +var clustersResource = schema.GroupVersionResource{Group: "machine.openshift.io", Version: "v1beta1", Resource: "clusters"} + +var clustersKind = schema.GroupVersionKind{Group: "machine.openshift.io", Version: "v1beta1", Kind: "Cluster"} + +// Get takes name of the cluster, and returns the corresponding cluster object, and an error if there is any. +func (c *FakeClusters) Get(name string, options v1.GetOptions) (result *v1beta1.Cluster, err error) { + obj, err := c.Fake. + Invokes(testing.NewGetAction(clustersResource, c.ns, name), &v1beta1.Cluster{}) + + if obj == nil { + return nil, err + } + return obj.(*v1beta1.Cluster), err +} + +// List takes label and field selectors, and returns the list of Clusters that match those selectors. +func (c *FakeClusters) List(opts v1.ListOptions) (result *v1beta1.ClusterList, err error) { + obj, err := c.Fake. + Invokes(testing.NewListAction(clustersResource, clustersKind, c.ns, opts), &v1beta1.ClusterList{}) + + if obj == nil { + return nil, err + } + + label, _, _ := testing.ExtractFromListOptions(opts) + if label == nil { + label = labels.Everything() + } + list := &v1beta1.ClusterList{ListMeta: obj.(*v1beta1.ClusterList).ListMeta} + for _, item := range obj.(*v1beta1.ClusterList).Items { + if label.Matches(labels.Set(item.Labels)) { + list.Items = append(list.Items, item) + } + } + return list, err +} + +// Watch returns a watch.Interface that watches the requested clusters. +func (c *FakeClusters) Watch(opts v1.ListOptions) (watch.Interface, error) { + return c.Fake. + InvokesWatch(testing.NewWatchAction(clustersResource, c.ns, opts)) + +} + +// Create takes the representation of a cluster and creates it. Returns the server's representation of the cluster, and an error, if there is any. +func (c *FakeClusters) Create(cluster *v1beta1.Cluster) (result *v1beta1.Cluster, err error) { + obj, err := c.Fake. + Invokes(testing.NewCreateAction(clustersResource, c.ns, cluster), &v1beta1.Cluster{}) + + if obj == nil { + return nil, err + } + return obj.(*v1beta1.Cluster), err +} + +// Update takes the representation of a cluster and updates it. Returns the server's representation of the cluster, and an error, if there is any. +func (c *FakeClusters) Update(cluster *v1beta1.Cluster) (result *v1beta1.Cluster, err error) { + obj, err := c.Fake. + Invokes(testing.NewUpdateAction(clustersResource, c.ns, cluster), &v1beta1.Cluster{}) + + if obj == nil { + return nil, err + } + return obj.(*v1beta1.Cluster), err +} + +// UpdateStatus was generated because the type contains a Status member. +// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). +func (c *FakeClusters) UpdateStatus(cluster *v1beta1.Cluster) (*v1beta1.Cluster, error) { + obj, err := c.Fake. + Invokes(testing.NewUpdateSubresourceAction(clustersResource, "status", c.ns, cluster), &v1beta1.Cluster{}) + + if obj == nil { + return nil, err + } + return obj.(*v1beta1.Cluster), err +} + +// Delete takes name of the cluster and deletes it. Returns an error if one occurs. +func (c *FakeClusters) Delete(name string, options *v1.DeleteOptions) error { + _, err := c.Fake. + Invokes(testing.NewDeleteAction(clustersResource, c.ns, name), &v1beta1.Cluster{}) + + return err +} + +// DeleteCollection deletes a collection of objects. +func (c *FakeClusters) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error { + action := testing.NewDeleteCollectionAction(clustersResource, c.ns, listOptions) + + _, err := c.Fake.Invokes(action, &v1beta1.ClusterList{}) + return err +} + +// Patch applies the patch and returns the patched cluster. +func (c *FakeClusters) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1beta1.Cluster, err error) { + obj, err := c.Fake. + Invokes(testing.NewPatchSubresourceAction(clustersResource, c.ns, name, data, subresources...), &v1beta1.Cluster{}) + + if obj == nil { + return nil, err + } + return obj.(*v1beta1.Cluster), err +} diff --git a/vendor/github.com/openshift/cluster-api/pkg/client/clientset_generated/clientset/typed/machine/v1beta1/fake/fake_machine.go b/vendor/github.com/openshift/cluster-api/pkg/client/clientset_generated/clientset/typed/machine/v1beta1/fake/fake_machine.go new file mode 100644 index 000000000..8f6869962 --- /dev/null +++ b/vendor/github.com/openshift/cluster-api/pkg/client/clientset_generated/clientset/typed/machine/v1beta1/fake/fake_machine.go @@ -0,0 +1,140 @@ +/* +Copyright 2018 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by client-gen. DO NOT EDIT. + +package fake + +import ( + v1beta1 "github.com/openshift/cluster-api/pkg/apis/machine/v1beta1" + 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 *FakeMachineV1beta1 + ns string +} + +var machinesResource = schema.GroupVersionResource{Group: "machine.openshift.io", Version: "v1beta1", Resource: "machines"} + +var machinesKind = schema.GroupVersionKind{Group: "machine.openshift.io", Version: "v1beta1", 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 *v1beta1.Machine, err error) { + obj, err := c.Fake. + Invokes(testing.NewGetAction(machinesResource, c.ns, name), &v1beta1.Machine{}) + + if obj == nil { + return nil, err + } + return obj.(*v1beta1.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 *v1beta1.MachineList, err error) { + obj, err := c.Fake. + Invokes(testing.NewListAction(machinesResource, machinesKind, c.ns, opts), &v1beta1.MachineList{}) + + if obj == nil { + return nil, err + } + + label, _, _ := testing.ExtractFromListOptions(opts) + if label == nil { + label = labels.Everything() + } + list := &v1beta1.MachineList{ListMeta: obj.(*v1beta1.MachineList).ListMeta} + for _, item := range obj.(*v1beta1.MachineList).Items { + if label.Matches(labels.Set(item.Labels)) { + list.Items = append(list.Items, item) + } + } + return list, err +} + +// Watch returns a watch.Interface that watches the requested machines. +func (c *FakeMachines) Watch(opts v1.ListOptions) (watch.Interface, error) { + return c.Fake. + InvokesWatch(testing.NewWatchAction(machinesResource, c.ns, opts)) + +} + +// Create takes the representation of a machine and creates it. Returns the server's representation of the machine, and an error, if there is any. +func (c *FakeMachines) Create(machine *v1beta1.Machine) (result *v1beta1.Machine, err error) { + obj, err := c.Fake. + Invokes(testing.NewCreateAction(machinesResource, c.ns, machine), &v1beta1.Machine{}) + + if obj == nil { + return nil, err + } + return obj.(*v1beta1.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 *v1beta1.Machine) (result *v1beta1.Machine, err error) { + obj, err := c.Fake. + Invokes(testing.NewUpdateAction(machinesResource, c.ns, machine), &v1beta1.Machine{}) + + if obj == nil { + return nil, err + } + return obj.(*v1beta1.Machine), err +} + +// UpdateStatus was generated because the type contains a Status member. +// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). +func (c *FakeMachines) UpdateStatus(machine *v1beta1.Machine) (*v1beta1.Machine, error) { + obj, err := c.Fake. + Invokes(testing.NewUpdateSubresourceAction(machinesResource, "status", c.ns, machine), &v1beta1.Machine{}) + + if obj == nil { + return nil, err + } + return obj.(*v1beta1.Machine), err +} + +// Delete takes name of the machine and deletes it. Returns an error if one occurs. +func (c *FakeMachines) Delete(name string, options *v1.DeleteOptions) error { + _, err := c.Fake. + Invokes(testing.NewDeleteAction(machinesResource, c.ns, name), &v1beta1.Machine{}) + + return err +} + +// DeleteCollection deletes a collection of objects. +func (c *FakeMachines) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error { + action := testing.NewDeleteCollectionAction(machinesResource, c.ns, listOptions) + + _, err := c.Fake.Invokes(action, &v1beta1.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 *v1beta1.Machine, err error) { + obj, err := c.Fake. + Invokes(testing.NewPatchSubresourceAction(machinesResource, c.ns, name, data, subresources...), &v1beta1.Machine{}) + + if obj == nil { + return nil, err + } + return obj.(*v1beta1.Machine), err +} diff --git a/vendor/github.com/openshift/cluster-api/pkg/client/clientset_generated/clientset/typed/machine/v1beta1/fake/fake_machine_client.go b/vendor/github.com/openshift/cluster-api/pkg/client/clientset_generated/clientset/typed/machine/v1beta1/fake/fake_machine_client.go new file mode 100644 index 000000000..c94b1ce47 --- /dev/null +++ b/vendor/github.com/openshift/cluster-api/pkg/client/clientset_generated/clientset/typed/machine/v1beta1/fake/fake_machine_client.go @@ -0,0 +1,56 @@ +/* +Copyright 2018 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by client-gen. DO NOT EDIT. + +package fake + +import ( + v1beta1 "github.com/openshift/cluster-api/pkg/client/clientset_generated/clientset/typed/machine/v1beta1" + rest "k8s.io/client-go/rest" + testing "k8s.io/client-go/testing" +) + +type FakeMachineV1beta1 struct { + *testing.Fake +} + +func (c *FakeMachineV1beta1) Clusters(namespace string) v1beta1.ClusterInterface { + return &FakeClusters{c, namespace} +} + +func (c *FakeMachineV1beta1) Machines(namespace string) v1beta1.MachineInterface { + return &FakeMachines{c, namespace} +} + +func (c *FakeMachineV1beta1) MachineClasses(namespace string) v1beta1.MachineClassInterface { + return &FakeMachineClasses{c, namespace} +} + +func (c *FakeMachineV1beta1) MachineDeployments(namespace string) v1beta1.MachineDeploymentInterface { + return &FakeMachineDeployments{c, namespace} +} + +func (c *FakeMachineV1beta1) MachineSets(namespace string) v1beta1.MachineSetInterface { + return &FakeMachineSets{c, namespace} +} + +// RESTClient returns a RESTClient that is used to communicate +// with API server by this client implementation. +func (c *FakeMachineV1beta1) RESTClient() rest.Interface { + var ret *rest.RESTClient + return ret +} diff --git a/vendor/github.com/openshift/cluster-api/pkg/client/clientset_generated/clientset/typed/machine/v1beta1/fake/fake_machineclass.go b/vendor/github.com/openshift/cluster-api/pkg/client/clientset_generated/clientset/typed/machine/v1beta1/fake/fake_machineclass.go new file mode 100644 index 000000000..018e6d24c --- /dev/null +++ b/vendor/github.com/openshift/cluster-api/pkg/client/clientset_generated/clientset/typed/machine/v1beta1/fake/fake_machineclass.go @@ -0,0 +1,128 @@ +/* +Copyright 2018 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by client-gen. DO NOT EDIT. + +package fake + +import ( + v1beta1 "github.com/openshift/cluster-api/pkg/apis/machine/v1beta1" + 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" +) + +// FakeMachineClasses implements MachineClassInterface +type FakeMachineClasses struct { + Fake *FakeMachineV1beta1 + ns string +} + +var machineclassesResource = schema.GroupVersionResource{Group: "machine.openshift.io", Version: "v1beta1", Resource: "machineclasses"} + +var machineclassesKind = schema.GroupVersionKind{Group: "machine.openshift.io", Version: "v1beta1", Kind: "MachineClass"} + +// Get takes name of the machineClass, and returns the corresponding machineClass object, and an error if there is any. +func (c *FakeMachineClasses) Get(name string, options v1.GetOptions) (result *v1beta1.MachineClass, err error) { + obj, err := c.Fake. + Invokes(testing.NewGetAction(machineclassesResource, c.ns, name), &v1beta1.MachineClass{}) + + if obj == nil { + return nil, err + } + return obj.(*v1beta1.MachineClass), err +} + +// List takes label and field selectors, and returns the list of MachineClasses that match those selectors. +func (c *FakeMachineClasses) List(opts v1.ListOptions) (result *v1beta1.MachineClassList, err error) { + obj, err := c.Fake. + Invokes(testing.NewListAction(machineclassesResource, machineclassesKind, c.ns, opts), &v1beta1.MachineClassList{}) + + if obj == nil { + return nil, err + } + + label, _, _ := testing.ExtractFromListOptions(opts) + if label == nil { + label = labels.Everything() + } + list := &v1beta1.MachineClassList{ListMeta: obj.(*v1beta1.MachineClassList).ListMeta} + for _, item := range obj.(*v1beta1.MachineClassList).Items { + if label.Matches(labels.Set(item.Labels)) { + list.Items = append(list.Items, item) + } + } + return list, err +} + +// Watch returns a watch.Interface that watches the requested machineClasses. +func (c *FakeMachineClasses) Watch(opts v1.ListOptions) (watch.Interface, error) { + return c.Fake. + InvokesWatch(testing.NewWatchAction(machineclassesResource, c.ns, opts)) + +} + +// Create takes the representation of a machineClass and creates it. Returns the server's representation of the machineClass, and an error, if there is any. +func (c *FakeMachineClasses) Create(machineClass *v1beta1.MachineClass) (result *v1beta1.MachineClass, err error) { + obj, err := c.Fake. + Invokes(testing.NewCreateAction(machineclassesResource, c.ns, machineClass), &v1beta1.MachineClass{}) + + if obj == nil { + return nil, err + } + return obj.(*v1beta1.MachineClass), err +} + +// Update takes the representation of a machineClass and updates it. Returns the server's representation of the machineClass, and an error, if there is any. +func (c *FakeMachineClasses) Update(machineClass *v1beta1.MachineClass) (result *v1beta1.MachineClass, err error) { + obj, err := c.Fake. + Invokes(testing.NewUpdateAction(machineclassesResource, c.ns, machineClass), &v1beta1.MachineClass{}) + + if obj == nil { + return nil, err + } + return obj.(*v1beta1.MachineClass), err +} + +// Delete takes name of the machineClass and deletes it. Returns an error if one occurs. +func (c *FakeMachineClasses) Delete(name string, options *v1.DeleteOptions) error { + _, err := c.Fake. + Invokes(testing.NewDeleteAction(machineclassesResource, c.ns, name), &v1beta1.MachineClass{}) + + return err +} + +// DeleteCollection deletes a collection of objects. +func (c *FakeMachineClasses) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error { + action := testing.NewDeleteCollectionAction(machineclassesResource, c.ns, listOptions) + + _, err := c.Fake.Invokes(action, &v1beta1.MachineClassList{}) + return err +} + +// Patch applies the patch and returns the patched machineClass. +func (c *FakeMachineClasses) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1beta1.MachineClass, err error) { + obj, err := c.Fake. + Invokes(testing.NewPatchSubresourceAction(machineclassesResource, c.ns, name, data, subresources...), &v1beta1.MachineClass{}) + + if obj == nil { + return nil, err + } + return obj.(*v1beta1.MachineClass), err +} diff --git a/vendor/github.com/openshift/cluster-api/pkg/client/clientset_generated/clientset/typed/machine/v1beta1/fake/fake_machinedeployment.go b/vendor/github.com/openshift/cluster-api/pkg/client/clientset_generated/clientset/typed/machine/v1beta1/fake/fake_machinedeployment.go new file mode 100644 index 000000000..0cd408f6d --- /dev/null +++ b/vendor/github.com/openshift/cluster-api/pkg/client/clientset_generated/clientset/typed/machine/v1beta1/fake/fake_machinedeployment.go @@ -0,0 +1,140 @@ +/* +Copyright 2018 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by client-gen. DO NOT EDIT. + +package fake + +import ( + v1beta1 "github.com/openshift/cluster-api/pkg/apis/machine/v1beta1" + 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 *FakeMachineV1beta1 + ns string +} + +var machinedeploymentsResource = schema.GroupVersionResource{Group: "machine.openshift.io", Version: "v1beta1", Resource: "machinedeployments"} + +var machinedeploymentsKind = schema.GroupVersionKind{Group: "machine.openshift.io", Version: "v1beta1", 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 *v1beta1.MachineDeployment, err error) { + obj, err := c.Fake. + Invokes(testing.NewGetAction(machinedeploymentsResource, c.ns, name), &v1beta1.MachineDeployment{}) + + if obj == nil { + return nil, err + } + return obj.(*v1beta1.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 *v1beta1.MachineDeploymentList, err error) { + obj, err := c.Fake. + Invokes(testing.NewListAction(machinedeploymentsResource, machinedeploymentsKind, c.ns, opts), &v1beta1.MachineDeploymentList{}) + + if obj == nil { + return nil, err + } + + label, _, _ := testing.ExtractFromListOptions(opts) + if label == nil { + label = labels.Everything() + } + list := &v1beta1.MachineDeploymentList{ListMeta: obj.(*v1beta1.MachineDeploymentList).ListMeta} + for _, item := range obj.(*v1beta1.MachineDeploymentList).Items { + if label.Matches(labels.Set(item.Labels)) { + list.Items = append(list.Items, item) + } + } + return list, err +} + +// Watch returns a watch.Interface that watches the requested machineDeployments. +func (c *FakeMachineDeployments) Watch(opts v1.ListOptions) (watch.Interface, error) { + return c.Fake. + InvokesWatch(testing.NewWatchAction(machinedeploymentsResource, c.ns, opts)) + +} + +// Create takes the representation of a machineDeployment and creates it. Returns the server's representation of the machineDeployment, and an error, if there is any. +func (c *FakeMachineDeployments) Create(machineDeployment *v1beta1.MachineDeployment) (result *v1beta1.MachineDeployment, err error) { + obj, err := c.Fake. + Invokes(testing.NewCreateAction(machinedeploymentsResource, c.ns, machineDeployment), &v1beta1.MachineDeployment{}) + + if obj == nil { + return nil, err + } + return obj.(*v1beta1.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 *v1beta1.MachineDeployment) (result *v1beta1.MachineDeployment, err error) { + obj, err := c.Fake. + Invokes(testing.NewUpdateAction(machinedeploymentsResource, c.ns, machineDeployment), &v1beta1.MachineDeployment{}) + + if obj == nil { + return nil, err + } + return obj.(*v1beta1.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 *v1beta1.MachineDeployment) (*v1beta1.MachineDeployment, error) { + obj, err := c.Fake. + Invokes(testing.NewUpdateSubresourceAction(machinedeploymentsResource, "status", c.ns, machineDeployment), &v1beta1.MachineDeployment{}) + + if obj == nil { + return nil, err + } + return obj.(*v1beta1.MachineDeployment), err +} + +// Delete takes name of the machineDeployment and deletes it. Returns an error if one occurs. +func (c *FakeMachineDeployments) Delete(name string, options *v1.DeleteOptions) error { + _, err := c.Fake. + Invokes(testing.NewDeleteAction(machinedeploymentsResource, c.ns, name), &v1beta1.MachineDeployment{}) + + return err +} + +// DeleteCollection deletes a collection of objects. +func (c *FakeMachineDeployments) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error { + action := testing.NewDeleteCollectionAction(machinedeploymentsResource, c.ns, listOptions) + + _, err := c.Fake.Invokes(action, &v1beta1.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 *v1beta1.MachineDeployment, err error) { + obj, err := c.Fake. + Invokes(testing.NewPatchSubresourceAction(machinedeploymentsResource, c.ns, name, data, subresources...), &v1beta1.MachineDeployment{}) + + if obj == nil { + return nil, err + } + return obj.(*v1beta1.MachineDeployment), err +} diff --git a/vendor/github.com/openshift/cluster-api/pkg/client/clientset_generated/clientset/typed/machine/v1beta1/fake/fake_machineset.go b/vendor/github.com/openshift/cluster-api/pkg/client/clientset_generated/clientset/typed/machine/v1beta1/fake/fake_machineset.go new file mode 100644 index 000000000..2bcf0b380 --- /dev/null +++ b/vendor/github.com/openshift/cluster-api/pkg/client/clientset_generated/clientset/typed/machine/v1beta1/fake/fake_machineset.go @@ -0,0 +1,140 @@ +/* +Copyright 2018 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by client-gen. DO NOT EDIT. + +package fake + +import ( + v1beta1 "github.com/openshift/cluster-api/pkg/apis/machine/v1beta1" + 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 *FakeMachineV1beta1 + ns string +} + +var machinesetsResource = schema.GroupVersionResource{Group: "machine.openshift.io", Version: "v1beta1", Resource: "machinesets"} + +var machinesetsKind = schema.GroupVersionKind{Group: "machine.openshift.io", Version: "v1beta1", 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 *v1beta1.MachineSet, err error) { + obj, err := c.Fake. + Invokes(testing.NewGetAction(machinesetsResource, c.ns, name), &v1beta1.MachineSet{}) + + if obj == nil { + return nil, err + } + return obj.(*v1beta1.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 *v1beta1.MachineSetList, err error) { + obj, err := c.Fake. + Invokes(testing.NewListAction(machinesetsResource, machinesetsKind, c.ns, opts), &v1beta1.MachineSetList{}) + + if obj == nil { + return nil, err + } + + label, _, _ := testing.ExtractFromListOptions(opts) + if label == nil { + label = labels.Everything() + } + list := &v1beta1.MachineSetList{ListMeta: obj.(*v1beta1.MachineSetList).ListMeta} + for _, item := range obj.(*v1beta1.MachineSetList).Items { + if label.Matches(labels.Set(item.Labels)) { + list.Items = append(list.Items, item) + } + } + return list, err +} + +// Watch returns a watch.Interface that watches the requested machineSets. +func (c *FakeMachineSets) Watch(opts v1.ListOptions) (watch.Interface, error) { + return c.Fake. + InvokesWatch(testing.NewWatchAction(machinesetsResource, c.ns, opts)) + +} + +// Create takes the representation of a machineSet and creates it. Returns the server's representation of the machineSet, and an error, if there is any. +func (c *FakeMachineSets) Create(machineSet *v1beta1.MachineSet) (result *v1beta1.MachineSet, err error) { + obj, err := c.Fake. + Invokes(testing.NewCreateAction(machinesetsResource, c.ns, machineSet), &v1beta1.MachineSet{}) + + if obj == nil { + return nil, err + } + return obj.(*v1beta1.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 *v1beta1.MachineSet) (result *v1beta1.MachineSet, err error) { + obj, err := c.Fake. + Invokes(testing.NewUpdateAction(machinesetsResource, c.ns, machineSet), &v1beta1.MachineSet{}) + + if obj == nil { + return nil, err + } + return obj.(*v1beta1.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 *v1beta1.MachineSet) (*v1beta1.MachineSet, error) { + obj, err := c.Fake. + Invokes(testing.NewUpdateSubresourceAction(machinesetsResource, "status", c.ns, machineSet), &v1beta1.MachineSet{}) + + if obj == nil { + return nil, err + } + return obj.(*v1beta1.MachineSet), err +} + +// Delete takes name of the machineSet and deletes it. Returns an error if one occurs. +func (c *FakeMachineSets) Delete(name string, options *v1.DeleteOptions) error { + _, err := c.Fake. + Invokes(testing.NewDeleteAction(machinesetsResource, c.ns, name), &v1beta1.MachineSet{}) + + return err +} + +// DeleteCollection deletes a collection of objects. +func (c *FakeMachineSets) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error { + action := testing.NewDeleteCollectionAction(machinesetsResource, c.ns, listOptions) + + _, err := c.Fake.Invokes(action, &v1beta1.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 *v1beta1.MachineSet, err error) { + obj, err := c.Fake. + Invokes(testing.NewPatchSubresourceAction(machinesetsResource, c.ns, name, data, subresources...), &v1beta1.MachineSet{}) + + if obj == nil { + return nil, err + } + return obj.(*v1beta1.MachineSet), err +} diff --git a/vendor/github.com/openshift/cluster-api/pkg/client/clientset_generated/clientset/typed/machine/v1beta1/generated_expansion.go b/vendor/github.com/openshift/cluster-api/pkg/client/clientset_generated/clientset/typed/machine/v1beta1/generated_expansion.go new file mode 100644 index 000000000..e4cc01446 --- /dev/null +++ b/vendor/github.com/openshift/cluster-api/pkg/client/clientset_generated/clientset/typed/machine/v1beta1/generated_expansion.go @@ -0,0 +1,29 @@ +/* +Copyright 2018 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by client-gen. DO NOT EDIT. + +package v1beta1 + +type ClusterExpansion interface{} + +type MachineExpansion interface{} + +type MachineClassExpansion interface{} + +type MachineDeploymentExpansion interface{} + +type MachineSetExpansion interface{} diff --git a/vendor/github.com/openshift/cluster-api/pkg/client/clientset_generated/clientset/typed/machine/v1beta1/machine.go b/vendor/github.com/openshift/cluster-api/pkg/client/clientset_generated/clientset/typed/machine/v1beta1/machine.go new file mode 100644 index 000000000..c3f02e954 --- /dev/null +++ b/vendor/github.com/openshift/cluster-api/pkg/client/clientset_generated/clientset/typed/machine/v1beta1/machine.go @@ -0,0 +1,174 @@ +/* +Copyright 2018 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by client-gen. DO NOT EDIT. + +package v1beta1 + +import ( + v1beta1 "github.com/openshift/cluster-api/pkg/apis/machine/v1beta1" + scheme "github.com/openshift/cluster-api/pkg/client/clientset_generated/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(namespace string) MachineInterface +} + +// MachineInterface has methods to work with Machine resources. +type MachineInterface interface { + Create(*v1beta1.Machine) (*v1beta1.Machine, error) + Update(*v1beta1.Machine) (*v1beta1.Machine, error) + UpdateStatus(*v1beta1.Machine) (*v1beta1.Machine, error) + Delete(name string, options *v1.DeleteOptions) error + DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error + Get(name string, options v1.GetOptions) (*v1beta1.Machine, error) + List(opts v1.ListOptions) (*v1beta1.MachineList, error) + Watch(opts v1.ListOptions) (watch.Interface, error) + Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1beta1.Machine, err error) + MachineExpansion +} + +// machines implements MachineInterface +type machines struct { + client rest.Interface + ns string +} + +// newMachines returns a Machines +func newMachines(c *MachineV1beta1Client, namespace string) *machines { + return &machines{ + client: c.RESTClient(), + ns: namespace, + } +} + +// Get takes name of the machine, and returns the corresponding machine object, and an error if there is any. +func (c *machines) Get(name string, options v1.GetOptions) (result *v1beta1.Machine, err error) { + result = &v1beta1.Machine{} + err = c.client.Get(). + Namespace(c.ns). + Resource("machines"). + Name(name). + VersionedParams(&options, scheme.ParameterCodec). + Do(). + Into(result) + return +} + +// List takes label and field selectors, and returns the list of Machines that match those selectors. +func (c *machines) List(opts v1.ListOptions) (result *v1beta1.MachineList, err error) { + result = &v1beta1.MachineList{} + err = c.client.Get(). + Namespace(c.ns). + Resource("machines"). + VersionedParams(&opts, scheme.ParameterCodec). + Do(). + Into(result) + return +} + +// Watch returns a watch.Interface that watches the requested machines. +func (c *machines) Watch(opts v1.ListOptions) (watch.Interface, error) { + opts.Watch = true + return c.client.Get(). + Namespace(c.ns). + Resource("machines"). + VersionedParams(&opts, scheme.ParameterCodec). + Watch() +} + +// Create takes the representation of a machine and creates it. Returns the server's representation of the machine, and an error, if there is any. +func (c *machines) Create(machine *v1beta1.Machine) (result *v1beta1.Machine, err error) { + result = &v1beta1.Machine{} + err = c.client.Post(). + Namespace(c.ns). + Resource("machines"). + Body(machine). + Do(). + Into(result) + return +} + +// Update takes the representation of a machine and updates it. Returns the server's representation of the machine, and an error, if there is any. +func (c *machines) Update(machine *v1beta1.Machine) (result *v1beta1.Machine, err error) { + result = &v1beta1.Machine{} + err = c.client.Put(). + Namespace(c.ns). + Resource("machines"). + Name(machine.Name). + Body(machine). + Do(). + Into(result) + return +} + +// UpdateStatus was generated because the type contains a Status member. +// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). + +func (c *machines) UpdateStatus(machine *v1beta1.Machine) (result *v1beta1.Machine, err error) { + result = &v1beta1.Machine{} + err = c.client.Put(). + Namespace(c.ns). + Resource("machines"). + Name(machine.Name). + SubResource("status"). + Body(machine). + Do(). + Into(result) + return +} + +// Delete takes name of the machine and deletes it. Returns an error if one occurs. +func (c *machines) Delete(name string, options *v1.DeleteOptions) error { + return c.client.Delete(). + Namespace(c.ns). + Resource("machines"). + Name(name). + Body(options). + Do(). + Error() +} + +// DeleteCollection deletes a collection of objects. +func (c *machines) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error { + return c.client.Delete(). + Namespace(c.ns). + Resource("machines"). + VersionedParams(&listOptions, scheme.ParameterCodec). + Body(options). + Do(). + Error() +} + +// Patch applies the patch and returns the patched machine. +func (c *machines) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1beta1.Machine, err error) { + result = &v1beta1.Machine{} + err = c.client.Patch(pt). + Namespace(c.ns). + Resource("machines"). + SubResource(subresources...). + Name(name). + Body(data). + Do(). + Into(result) + return +} diff --git a/vendor/github.com/openshift/cluster-api/pkg/client/clientset_generated/clientset/typed/machine/v1beta1/machine_client.go b/vendor/github.com/openshift/cluster-api/pkg/client/clientset_generated/clientset/typed/machine/v1beta1/machine_client.go new file mode 100644 index 000000000..93e849157 --- /dev/null +++ b/vendor/github.com/openshift/cluster-api/pkg/client/clientset_generated/clientset/typed/machine/v1beta1/machine_client.go @@ -0,0 +1,110 @@ +/* +Copyright 2018 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by client-gen. DO NOT EDIT. + +package v1beta1 + +import ( + v1beta1 "github.com/openshift/cluster-api/pkg/apis/machine/v1beta1" + "github.com/openshift/cluster-api/pkg/client/clientset_generated/clientset/scheme" + serializer "k8s.io/apimachinery/pkg/runtime/serializer" + rest "k8s.io/client-go/rest" +) + +type MachineV1beta1Interface interface { + RESTClient() rest.Interface + ClustersGetter + MachinesGetter + MachineClassesGetter + MachineDeploymentsGetter + MachineSetsGetter +} + +// MachineV1beta1Client is used to interact with features provided by the machine.openshift.io group. +type MachineV1beta1Client struct { + restClient rest.Interface +} + +func (c *MachineV1beta1Client) Clusters(namespace string) ClusterInterface { + return newClusters(c, namespace) +} + +func (c *MachineV1beta1Client) Machines(namespace string) MachineInterface { + return newMachines(c, namespace) +} + +func (c *MachineV1beta1Client) MachineClasses(namespace string) MachineClassInterface { + return newMachineClasses(c, namespace) +} + +func (c *MachineV1beta1Client) MachineDeployments(namespace string) MachineDeploymentInterface { + return newMachineDeployments(c, namespace) +} + +func (c *MachineV1beta1Client) MachineSets(namespace string) MachineSetInterface { + return newMachineSets(c, namespace) +} + +// NewForConfig creates a new MachineV1beta1Client for the given config. +func NewForConfig(c *rest.Config) (*MachineV1beta1Client, error) { + config := *c + if err := setConfigDefaults(&config); err != nil { + return nil, err + } + client, err := rest.RESTClientFor(&config) + if err != nil { + return nil, err + } + return &MachineV1beta1Client{client}, nil +} + +// NewForConfigOrDie creates a new MachineV1beta1Client for the given config and +// panics if there is an error in the config. +func NewForConfigOrDie(c *rest.Config) *MachineV1beta1Client { + client, err := NewForConfig(c) + if err != nil { + panic(err) + } + return client +} + +// New creates a new MachineV1beta1Client for the given RESTClient. +func New(c rest.Interface) *MachineV1beta1Client { + return &MachineV1beta1Client{c} +} + +func setConfigDefaults(config *rest.Config) error { + gv := v1beta1.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 *MachineV1beta1Client) RESTClient() rest.Interface { + if c == nil { + return nil + } + return c.restClient +} diff --git a/vendor/github.com/openshift/cluster-api/pkg/client/clientset_generated/clientset/typed/machine/v1beta1/machineclass.go b/vendor/github.com/openshift/cluster-api/pkg/client/clientset_generated/clientset/typed/machine/v1beta1/machineclass.go new file mode 100644 index 000000000..7bee80f3c --- /dev/null +++ b/vendor/github.com/openshift/cluster-api/pkg/client/clientset_generated/clientset/typed/machine/v1beta1/machineclass.go @@ -0,0 +1,157 @@ +/* +Copyright 2018 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by client-gen. DO NOT EDIT. + +package v1beta1 + +import ( + v1beta1 "github.com/openshift/cluster-api/pkg/apis/machine/v1beta1" + scheme "github.com/openshift/cluster-api/pkg/client/clientset_generated/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" +) + +// MachineClassesGetter has a method to return a MachineClassInterface. +// A group's client should implement this interface. +type MachineClassesGetter interface { + MachineClasses(namespace string) MachineClassInterface +} + +// MachineClassInterface has methods to work with MachineClass resources. +type MachineClassInterface interface { + Create(*v1beta1.MachineClass) (*v1beta1.MachineClass, error) + Update(*v1beta1.MachineClass) (*v1beta1.MachineClass, error) + Delete(name string, options *v1.DeleteOptions) error + DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error + Get(name string, options v1.GetOptions) (*v1beta1.MachineClass, error) + List(opts v1.ListOptions) (*v1beta1.MachineClassList, error) + Watch(opts v1.ListOptions) (watch.Interface, error) + Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1beta1.MachineClass, err error) + MachineClassExpansion +} + +// machineClasses implements MachineClassInterface +type machineClasses struct { + client rest.Interface + ns string +} + +// newMachineClasses returns a MachineClasses +func newMachineClasses(c *MachineV1beta1Client, namespace string) *machineClasses { + return &machineClasses{ + client: c.RESTClient(), + ns: namespace, + } +} + +// Get takes name of the machineClass, and returns the corresponding machineClass object, and an error if there is any. +func (c *machineClasses) Get(name string, options v1.GetOptions) (result *v1beta1.MachineClass, err error) { + result = &v1beta1.MachineClass{} + err = c.client.Get(). + Namespace(c.ns). + Resource("machineclasses"). + Name(name). + VersionedParams(&options, scheme.ParameterCodec). + Do(). + Into(result) + return +} + +// List takes label and field selectors, and returns the list of MachineClasses that match those selectors. +func (c *machineClasses) List(opts v1.ListOptions) (result *v1beta1.MachineClassList, err error) { + result = &v1beta1.MachineClassList{} + err = c.client.Get(). + Namespace(c.ns). + Resource("machineclasses"). + VersionedParams(&opts, scheme.ParameterCodec). + Do(). + Into(result) + return +} + +// Watch returns a watch.Interface that watches the requested machineClasses. +func (c *machineClasses) Watch(opts v1.ListOptions) (watch.Interface, error) { + opts.Watch = true + return c.client.Get(). + Namespace(c.ns). + Resource("machineclasses"). + VersionedParams(&opts, scheme.ParameterCodec). + Watch() +} + +// Create takes the representation of a machineClass and creates it. Returns the server's representation of the machineClass, and an error, if there is any. +func (c *machineClasses) Create(machineClass *v1beta1.MachineClass) (result *v1beta1.MachineClass, err error) { + result = &v1beta1.MachineClass{} + err = c.client.Post(). + Namespace(c.ns). + Resource("machineclasses"). + Body(machineClass). + Do(). + Into(result) + return +} + +// Update takes the representation of a machineClass and updates it. Returns the server's representation of the machineClass, and an error, if there is any. +func (c *machineClasses) Update(machineClass *v1beta1.MachineClass) (result *v1beta1.MachineClass, err error) { + result = &v1beta1.MachineClass{} + err = c.client.Put(). + Namespace(c.ns). + Resource("machineclasses"). + Name(machineClass.Name). + Body(machineClass). + Do(). + Into(result) + return +} + +// Delete takes name of the machineClass and deletes it. Returns an error if one occurs. +func (c *machineClasses) Delete(name string, options *v1.DeleteOptions) error { + return c.client.Delete(). + Namespace(c.ns). + Resource("machineclasses"). + Name(name). + Body(options). + Do(). + Error() +} + +// DeleteCollection deletes a collection of objects. +func (c *machineClasses) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error { + return c.client.Delete(). + Namespace(c.ns). + Resource("machineclasses"). + VersionedParams(&listOptions, scheme.ParameterCodec). + Body(options). + Do(). + Error() +} + +// Patch applies the patch and returns the patched machineClass. +func (c *machineClasses) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1beta1.MachineClass, err error) { + result = &v1beta1.MachineClass{} + err = c.client.Patch(pt). + Namespace(c.ns). + Resource("machineclasses"). + SubResource(subresources...). + Name(name). + Body(data). + Do(). + Into(result) + return +} diff --git a/vendor/github.com/openshift/cluster-api/pkg/client/clientset_generated/clientset/typed/machine/v1beta1/machinedeployment.go b/vendor/github.com/openshift/cluster-api/pkg/client/clientset_generated/clientset/typed/machine/v1beta1/machinedeployment.go new file mode 100644 index 000000000..0d5550c18 --- /dev/null +++ b/vendor/github.com/openshift/cluster-api/pkg/client/clientset_generated/clientset/typed/machine/v1beta1/machinedeployment.go @@ -0,0 +1,174 @@ +/* +Copyright 2018 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by client-gen. DO NOT EDIT. + +package v1beta1 + +import ( + v1beta1 "github.com/openshift/cluster-api/pkg/apis/machine/v1beta1" + scheme "github.com/openshift/cluster-api/pkg/client/clientset_generated/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(namespace string) MachineDeploymentInterface +} + +// MachineDeploymentInterface has methods to work with MachineDeployment resources. +type MachineDeploymentInterface interface { + Create(*v1beta1.MachineDeployment) (*v1beta1.MachineDeployment, error) + Update(*v1beta1.MachineDeployment) (*v1beta1.MachineDeployment, error) + UpdateStatus(*v1beta1.MachineDeployment) (*v1beta1.MachineDeployment, error) + Delete(name string, options *v1.DeleteOptions) error + DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error + Get(name string, options v1.GetOptions) (*v1beta1.MachineDeployment, error) + List(opts v1.ListOptions) (*v1beta1.MachineDeploymentList, error) + Watch(opts v1.ListOptions) (watch.Interface, error) + Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1beta1.MachineDeployment, err error) + MachineDeploymentExpansion +} + +// machineDeployments implements MachineDeploymentInterface +type machineDeployments struct { + client rest.Interface + ns string +} + +// newMachineDeployments returns a MachineDeployments +func newMachineDeployments(c *MachineV1beta1Client, namespace string) *machineDeployments { + return &machineDeployments{ + client: c.RESTClient(), + ns: namespace, + } +} + +// Get takes name of the machineDeployment, and returns the corresponding machineDeployment object, and an error if there is any. +func (c *machineDeployments) Get(name string, options v1.GetOptions) (result *v1beta1.MachineDeployment, err error) { + result = &v1beta1.MachineDeployment{} + err = c.client.Get(). + Namespace(c.ns). + Resource("machinedeployments"). + Name(name). + VersionedParams(&options, scheme.ParameterCodec). + Do(). + Into(result) + return +} + +// List takes label and field selectors, and returns the list of MachineDeployments that match those selectors. +func (c *machineDeployments) List(opts v1.ListOptions) (result *v1beta1.MachineDeploymentList, err error) { + result = &v1beta1.MachineDeploymentList{} + err = c.client.Get(). + Namespace(c.ns). + Resource("machinedeployments"). + VersionedParams(&opts, scheme.ParameterCodec). + Do(). + Into(result) + return +} + +// Watch returns a watch.Interface that watches the requested machineDeployments. +func (c *machineDeployments) Watch(opts v1.ListOptions) (watch.Interface, error) { + opts.Watch = true + return c.client.Get(). + Namespace(c.ns). + Resource("machinedeployments"). + VersionedParams(&opts, scheme.ParameterCodec). + Watch() +} + +// Create takes the representation of a machineDeployment and creates it. Returns the server's representation of the machineDeployment, and an error, if there is any. +func (c *machineDeployments) Create(machineDeployment *v1beta1.MachineDeployment) (result *v1beta1.MachineDeployment, err error) { + result = &v1beta1.MachineDeployment{} + err = c.client.Post(). + Namespace(c.ns). + Resource("machinedeployments"). + Body(machineDeployment). + Do(). + Into(result) + return +} + +// Update takes the representation of a machineDeployment and updates it. Returns the server's representation of the machineDeployment, and an error, if there is any. +func (c *machineDeployments) Update(machineDeployment *v1beta1.MachineDeployment) (result *v1beta1.MachineDeployment, err error) { + result = &v1beta1.MachineDeployment{} + err = c.client.Put(). + Namespace(c.ns). + Resource("machinedeployments"). + Name(machineDeployment.Name). + Body(machineDeployment). + Do(). + Into(result) + return +} + +// UpdateStatus was generated because the type contains a Status member. +// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). + +func (c *machineDeployments) UpdateStatus(machineDeployment *v1beta1.MachineDeployment) (result *v1beta1.MachineDeployment, err error) { + result = &v1beta1.MachineDeployment{} + err = c.client.Put(). + Namespace(c.ns). + Resource("machinedeployments"). + Name(machineDeployment.Name). + SubResource("status"). + Body(machineDeployment). + Do(). + Into(result) + return +} + +// Delete takes name of the machineDeployment and deletes it. Returns an error if one occurs. +func (c *machineDeployments) Delete(name string, options *v1.DeleteOptions) error { + return c.client.Delete(). + Namespace(c.ns). + Resource("machinedeployments"). + Name(name). + Body(options). + Do(). + Error() +} + +// DeleteCollection deletes a collection of objects. +func (c *machineDeployments) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error { + return c.client.Delete(). + Namespace(c.ns). + Resource("machinedeployments"). + VersionedParams(&listOptions, scheme.ParameterCodec). + Body(options). + Do(). + Error() +} + +// Patch applies the patch and returns the patched machineDeployment. +func (c *machineDeployments) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1beta1.MachineDeployment, err error) { + result = &v1beta1.MachineDeployment{} + err = c.client.Patch(pt). + Namespace(c.ns). + Resource("machinedeployments"). + SubResource(subresources...). + Name(name). + Body(data). + Do(). + Into(result) + return +} diff --git a/vendor/github.com/openshift/cluster-api/pkg/client/clientset_generated/clientset/typed/machine/v1beta1/machineset.go b/vendor/github.com/openshift/cluster-api/pkg/client/clientset_generated/clientset/typed/machine/v1beta1/machineset.go new file mode 100644 index 000000000..73d377629 --- /dev/null +++ b/vendor/github.com/openshift/cluster-api/pkg/client/clientset_generated/clientset/typed/machine/v1beta1/machineset.go @@ -0,0 +1,174 @@ +/* +Copyright 2018 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by client-gen. DO NOT EDIT. + +package v1beta1 + +import ( + v1beta1 "github.com/openshift/cluster-api/pkg/apis/machine/v1beta1" + scheme "github.com/openshift/cluster-api/pkg/client/clientset_generated/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(namespace string) MachineSetInterface +} + +// MachineSetInterface has methods to work with MachineSet resources. +type MachineSetInterface interface { + Create(*v1beta1.MachineSet) (*v1beta1.MachineSet, error) + Update(*v1beta1.MachineSet) (*v1beta1.MachineSet, error) + UpdateStatus(*v1beta1.MachineSet) (*v1beta1.MachineSet, error) + Delete(name string, options *v1.DeleteOptions) error + DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error + Get(name string, options v1.GetOptions) (*v1beta1.MachineSet, error) + List(opts v1.ListOptions) (*v1beta1.MachineSetList, error) + Watch(opts v1.ListOptions) (watch.Interface, error) + Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1beta1.MachineSet, err error) + MachineSetExpansion +} + +// machineSets implements MachineSetInterface +type machineSets struct { + client rest.Interface + ns string +} + +// newMachineSets returns a MachineSets +func newMachineSets(c *MachineV1beta1Client, namespace string) *machineSets { + return &machineSets{ + client: c.RESTClient(), + ns: namespace, + } +} + +// Get takes name of the machineSet, and returns the corresponding machineSet object, and an error if there is any. +func (c *machineSets) Get(name string, options v1.GetOptions) (result *v1beta1.MachineSet, err error) { + result = &v1beta1.MachineSet{} + err = c.client.Get(). + Namespace(c.ns). + Resource("machinesets"). + Name(name). + VersionedParams(&options, scheme.ParameterCodec). + Do(). + Into(result) + return +} + +// List takes label and field selectors, and returns the list of MachineSets that match those selectors. +func (c *machineSets) List(opts v1.ListOptions) (result *v1beta1.MachineSetList, err error) { + result = &v1beta1.MachineSetList{} + err = c.client.Get(). + Namespace(c.ns). + Resource("machinesets"). + VersionedParams(&opts, scheme.ParameterCodec). + Do(). + Into(result) + return +} + +// Watch returns a watch.Interface that watches the requested machineSets. +func (c *machineSets) Watch(opts v1.ListOptions) (watch.Interface, error) { + opts.Watch = true + return c.client.Get(). + Namespace(c.ns). + Resource("machinesets"). + VersionedParams(&opts, scheme.ParameterCodec). + Watch() +} + +// Create takes the representation of a machineSet and creates it. Returns the server's representation of the machineSet, and an error, if there is any. +func (c *machineSets) Create(machineSet *v1beta1.MachineSet) (result *v1beta1.MachineSet, err error) { + result = &v1beta1.MachineSet{} + err = c.client.Post(). + Namespace(c.ns). + Resource("machinesets"). + Body(machineSet). + Do(). + Into(result) + return +} + +// Update takes the representation of a machineSet and updates it. Returns the server's representation of the machineSet, and an error, if there is any. +func (c *machineSets) Update(machineSet *v1beta1.MachineSet) (result *v1beta1.MachineSet, err error) { + result = &v1beta1.MachineSet{} + err = c.client.Put(). + Namespace(c.ns). + Resource("machinesets"). + Name(machineSet.Name). + Body(machineSet). + Do(). + Into(result) + return +} + +// UpdateStatus was generated because the type contains a Status member. +// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). + +func (c *machineSets) UpdateStatus(machineSet *v1beta1.MachineSet) (result *v1beta1.MachineSet, err error) { + result = &v1beta1.MachineSet{} + err = c.client.Put(). + Namespace(c.ns). + Resource("machinesets"). + Name(machineSet.Name). + SubResource("status"). + Body(machineSet). + Do(). + Into(result) + return +} + +// Delete takes name of the machineSet and deletes it. Returns an error if one occurs. +func (c *machineSets) Delete(name string, options *v1.DeleteOptions) error { + return c.client.Delete(). + Namespace(c.ns). + Resource("machinesets"). + Name(name). + Body(options). + Do(). + Error() +} + +// DeleteCollection deletes a collection of objects. +func (c *machineSets) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error { + return c.client.Delete(). + Namespace(c.ns). + Resource("machinesets"). + VersionedParams(&listOptions, scheme.ParameterCodec). + Body(options). + Do(). + Error() +} + +// Patch applies the patch and returns the patched machineSet. +func (c *machineSets) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1beta1.MachineSet, err error) { + result = &v1beta1.MachineSet{} + err = c.client.Patch(pt). + Namespace(c.ns). + Resource("machinesets"). + SubResource(subresources...). + Name(name). + Body(data). + Do(). + Into(result) + return +} diff --git a/vendor/sigs.k8s.io/cluster-api/pkg/client/informers_generated/externalversions/BUILD.bazel b/vendor/github.com/openshift/cluster-api/pkg/client/informers_generated/externalversions/BUILD.bazel similarity index 77% rename from vendor/sigs.k8s.io/cluster-api/pkg/client/informers_generated/externalversions/BUILD.bazel rename to vendor/github.com/openshift/cluster-api/pkg/client/informers_generated/externalversions/BUILD.bazel index 039490a15..60a55cb9f 100644 --- a/vendor/sigs.k8s.io/cluster-api/pkg/client/informers_generated/externalversions/BUILD.bazel +++ b/vendor/github.com/openshift/cluster-api/pkg/client/informers_generated/externalversions/BUILD.bazel @@ -6,13 +6,15 @@ go_library( "factory.go", "generic.go", ], - importpath = "sigs.k8s.io/cluster-api/pkg/client/informers_generated/externalversions", + importpath = "github.com/openshift/cluster-api/pkg/client/informers_generated/externalversions", visibility = ["//visibility:public"], deps = [ "//pkg/apis/cluster/v1alpha1:go_default_library", + "//pkg/apis/machine/v1beta1:go_default_library", "//pkg/client/clientset_generated/clientset:go_default_library", "//pkg/client/informers_generated/externalversions/cluster:go_default_library", "//pkg/client/informers_generated/externalversions/internalinterfaces:go_default_library", + "//pkg/client/informers_generated/externalversions/machine:go_default_library", "//vendor/k8s.io/apimachinery/pkg/apis/meta/v1:go_default_library", "//vendor/k8s.io/apimachinery/pkg/runtime:go_default_library", "//vendor/k8s.io/apimachinery/pkg/runtime/schema:go_default_library", diff --git a/vendor/sigs.k8s.io/cluster-api/pkg/client/informers_generated/externalversions/cluster/BUILD.bazel b/vendor/github.com/openshift/cluster-api/pkg/client/informers_generated/externalversions/cluster/BUILD.bazel similarity index 78% rename from vendor/sigs.k8s.io/cluster-api/pkg/client/informers_generated/externalversions/cluster/BUILD.bazel rename to vendor/github.com/openshift/cluster-api/pkg/client/informers_generated/externalversions/cluster/BUILD.bazel index b8cbc69a9..1d77735c7 100644 --- a/vendor/sigs.k8s.io/cluster-api/pkg/client/informers_generated/externalversions/cluster/BUILD.bazel +++ b/vendor/github.com/openshift/cluster-api/pkg/client/informers_generated/externalversions/cluster/BUILD.bazel @@ -3,7 +3,7 @@ load("@io_bazel_rules_go//go:def.bzl", "go_library") go_library( name = "go_default_library", srcs = ["interface.go"], - importpath = "sigs.k8s.io/cluster-api/pkg/client/informers_generated/externalversions/cluster", + importpath = "github.com/openshift/cluster-api/pkg/client/informers_generated/externalversions/cluster", visibility = ["//visibility:public"], deps = [ "//pkg/client/informers_generated/externalversions/cluster/v1alpha1:go_default_library", diff --git a/vendor/sigs.k8s.io/cluster-api/pkg/client/informers_generated/externalversions/cluster/interface.go b/vendor/github.com/openshift/cluster-api/pkg/client/informers_generated/externalversions/cluster/interface.go similarity index 86% rename from vendor/sigs.k8s.io/cluster-api/pkg/client/informers_generated/externalversions/cluster/interface.go rename to vendor/github.com/openshift/cluster-api/pkg/client/informers_generated/externalversions/cluster/interface.go index 945aef05d..f133f8ea3 100644 --- a/vendor/sigs.k8s.io/cluster-api/pkg/client/informers_generated/externalversions/cluster/interface.go +++ b/vendor/github.com/openshift/cluster-api/pkg/client/informers_generated/externalversions/cluster/interface.go @@ -19,8 +19,8 @@ limitations under the License. package cluster import ( - v1alpha1 "sigs.k8s.io/cluster-api/pkg/client/informers_generated/externalversions/cluster/v1alpha1" - internalinterfaces "sigs.k8s.io/cluster-api/pkg/client/informers_generated/externalversions/internalinterfaces" + v1alpha1 "github.com/openshift/cluster-api/pkg/client/informers_generated/externalversions/cluster/v1alpha1" + internalinterfaces "github.com/openshift/cluster-api/pkg/client/informers_generated/externalversions/internalinterfaces" ) // Interface provides access to each of this group's versions. diff --git a/vendor/sigs.k8s.io/cluster-api/pkg/client/informers_generated/externalversions/cluster/v1alpha1/BUILD.bazel b/vendor/github.com/openshift/cluster-api/pkg/client/informers_generated/externalversions/cluster/v1alpha1/BUILD.bazel similarity index 88% rename from vendor/sigs.k8s.io/cluster-api/pkg/client/informers_generated/externalversions/cluster/v1alpha1/BUILD.bazel rename to vendor/github.com/openshift/cluster-api/pkg/client/informers_generated/externalversions/cluster/v1alpha1/BUILD.bazel index ffabb236f..60d106d83 100644 --- a/vendor/sigs.k8s.io/cluster-api/pkg/client/informers_generated/externalversions/cluster/v1alpha1/BUILD.bazel +++ b/vendor/github.com/openshift/cluster-api/pkg/client/informers_generated/externalversions/cluster/v1alpha1/BUILD.bazel @@ -10,7 +10,7 @@ go_library( "machinedeployment.go", "machineset.go", ], - importpath = "sigs.k8s.io/cluster-api/pkg/client/informers_generated/externalversions/cluster/v1alpha1", + importpath = "github.com/openshift/cluster-api/pkg/client/informers_generated/externalversions/cluster/v1alpha1", visibility = ["//visibility:public"], deps = [ "//pkg/apis/cluster/v1alpha1:go_default_library", diff --git a/vendor/sigs.k8s.io/cluster-api/pkg/client/informers_generated/externalversions/cluster/v1alpha1/cluster.go b/vendor/github.com/openshift/cluster-api/pkg/client/informers_generated/externalversions/cluster/v1alpha1/cluster.go similarity index 89% rename from vendor/sigs.k8s.io/cluster-api/pkg/client/informers_generated/externalversions/cluster/v1alpha1/cluster.go rename to vendor/github.com/openshift/cluster-api/pkg/client/informers_generated/externalversions/cluster/v1alpha1/cluster.go index e5c750411..4a5e1ec53 100644 --- a/vendor/sigs.k8s.io/cluster-api/pkg/client/informers_generated/externalversions/cluster/v1alpha1/cluster.go +++ b/vendor/github.com/openshift/cluster-api/pkg/client/informers_generated/externalversions/cluster/v1alpha1/cluster.go @@ -21,14 +21,14 @@ package v1alpha1 import ( time "time" + clusterv1alpha1 "github.com/openshift/cluster-api/pkg/apis/cluster/v1alpha1" + clientset "github.com/openshift/cluster-api/pkg/client/clientset_generated/clientset" + internalinterfaces "github.com/openshift/cluster-api/pkg/client/informers_generated/externalversions/internalinterfaces" + v1alpha1 "github.com/openshift/cluster-api/pkg/client/listers_generated/cluster/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" - clusterv1alpha1 "sigs.k8s.io/cluster-api/pkg/apis/cluster/v1alpha1" - clientset "sigs.k8s.io/cluster-api/pkg/client/clientset_generated/clientset" - internalinterfaces "sigs.k8s.io/cluster-api/pkg/client/informers_generated/externalversions/internalinterfaces" - v1alpha1 "sigs.k8s.io/cluster-api/pkg/client/listers_generated/cluster/v1alpha1" ) // ClusterInformer provides access to a shared informer and lister for diff --git a/vendor/sigs.k8s.io/cluster-api/pkg/client/informers_generated/externalversions/cluster/v1alpha1/interface.go b/vendor/github.com/openshift/cluster-api/pkg/client/informers_generated/externalversions/cluster/v1alpha1/interface.go similarity index 95% rename from vendor/sigs.k8s.io/cluster-api/pkg/client/informers_generated/externalversions/cluster/v1alpha1/interface.go rename to vendor/github.com/openshift/cluster-api/pkg/client/informers_generated/externalversions/cluster/v1alpha1/interface.go index 40562f0df..68b08874b 100644 --- a/vendor/sigs.k8s.io/cluster-api/pkg/client/informers_generated/externalversions/cluster/v1alpha1/interface.go +++ b/vendor/github.com/openshift/cluster-api/pkg/client/informers_generated/externalversions/cluster/v1alpha1/interface.go @@ -19,7 +19,7 @@ limitations under the License. package v1alpha1 import ( - internalinterfaces "sigs.k8s.io/cluster-api/pkg/client/informers_generated/externalversions/internalinterfaces" + internalinterfaces "github.com/openshift/cluster-api/pkg/client/informers_generated/externalversions/internalinterfaces" ) // Interface provides access to all the informers in this group version. diff --git a/vendor/sigs.k8s.io/cluster-api/pkg/client/informers_generated/externalversions/cluster/v1alpha1/machine.go b/vendor/github.com/openshift/cluster-api/pkg/client/informers_generated/externalversions/cluster/v1alpha1/machine.go similarity index 89% rename from vendor/sigs.k8s.io/cluster-api/pkg/client/informers_generated/externalversions/cluster/v1alpha1/machine.go rename to vendor/github.com/openshift/cluster-api/pkg/client/informers_generated/externalversions/cluster/v1alpha1/machine.go index c0be887be..06063ebe2 100644 --- a/vendor/sigs.k8s.io/cluster-api/pkg/client/informers_generated/externalversions/cluster/v1alpha1/machine.go +++ b/vendor/github.com/openshift/cluster-api/pkg/client/informers_generated/externalversions/cluster/v1alpha1/machine.go @@ -21,14 +21,14 @@ package v1alpha1 import ( time "time" + clusterv1alpha1 "github.com/openshift/cluster-api/pkg/apis/cluster/v1alpha1" + clientset "github.com/openshift/cluster-api/pkg/client/clientset_generated/clientset" + internalinterfaces "github.com/openshift/cluster-api/pkg/client/informers_generated/externalversions/internalinterfaces" + v1alpha1 "github.com/openshift/cluster-api/pkg/client/listers_generated/cluster/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" - clusterv1alpha1 "sigs.k8s.io/cluster-api/pkg/apis/cluster/v1alpha1" - clientset "sigs.k8s.io/cluster-api/pkg/client/clientset_generated/clientset" - internalinterfaces "sigs.k8s.io/cluster-api/pkg/client/informers_generated/externalversions/internalinterfaces" - v1alpha1 "sigs.k8s.io/cluster-api/pkg/client/listers_generated/cluster/v1alpha1" ) // MachineInformer provides access to a shared informer and lister for diff --git a/vendor/sigs.k8s.io/cluster-api/pkg/client/informers_generated/externalversions/cluster/v1alpha1/machineclass.go b/vendor/github.com/openshift/cluster-api/pkg/client/informers_generated/externalversions/cluster/v1alpha1/machineclass.go similarity index 89% rename from vendor/sigs.k8s.io/cluster-api/pkg/client/informers_generated/externalversions/cluster/v1alpha1/machineclass.go rename to vendor/github.com/openshift/cluster-api/pkg/client/informers_generated/externalversions/cluster/v1alpha1/machineclass.go index d224d5516..6db4475b0 100644 --- a/vendor/sigs.k8s.io/cluster-api/pkg/client/informers_generated/externalversions/cluster/v1alpha1/machineclass.go +++ b/vendor/github.com/openshift/cluster-api/pkg/client/informers_generated/externalversions/cluster/v1alpha1/machineclass.go @@ -21,14 +21,14 @@ package v1alpha1 import ( time "time" + clusterv1alpha1 "github.com/openshift/cluster-api/pkg/apis/cluster/v1alpha1" + clientset "github.com/openshift/cluster-api/pkg/client/clientset_generated/clientset" + internalinterfaces "github.com/openshift/cluster-api/pkg/client/informers_generated/externalversions/internalinterfaces" + v1alpha1 "github.com/openshift/cluster-api/pkg/client/listers_generated/cluster/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" - clusterv1alpha1 "sigs.k8s.io/cluster-api/pkg/apis/cluster/v1alpha1" - clientset "sigs.k8s.io/cluster-api/pkg/client/clientset_generated/clientset" - internalinterfaces "sigs.k8s.io/cluster-api/pkg/client/informers_generated/externalversions/internalinterfaces" - v1alpha1 "sigs.k8s.io/cluster-api/pkg/client/listers_generated/cluster/v1alpha1" ) // MachineClassInformer provides access to a shared informer and lister for diff --git a/vendor/sigs.k8s.io/cluster-api/pkg/client/informers_generated/externalversions/cluster/v1alpha1/machinedeployment.go b/vendor/github.com/openshift/cluster-api/pkg/client/informers_generated/externalversions/cluster/v1alpha1/machinedeployment.go similarity index 90% rename from vendor/sigs.k8s.io/cluster-api/pkg/client/informers_generated/externalversions/cluster/v1alpha1/machinedeployment.go rename to vendor/github.com/openshift/cluster-api/pkg/client/informers_generated/externalversions/cluster/v1alpha1/machinedeployment.go index 5c574e7cd..0b5f7c411 100644 --- a/vendor/sigs.k8s.io/cluster-api/pkg/client/informers_generated/externalversions/cluster/v1alpha1/machinedeployment.go +++ b/vendor/github.com/openshift/cluster-api/pkg/client/informers_generated/externalversions/cluster/v1alpha1/machinedeployment.go @@ -21,14 +21,14 @@ package v1alpha1 import ( time "time" + clusterv1alpha1 "github.com/openshift/cluster-api/pkg/apis/cluster/v1alpha1" + clientset "github.com/openshift/cluster-api/pkg/client/clientset_generated/clientset" + internalinterfaces "github.com/openshift/cluster-api/pkg/client/informers_generated/externalversions/internalinterfaces" + v1alpha1 "github.com/openshift/cluster-api/pkg/client/listers_generated/cluster/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" - clusterv1alpha1 "sigs.k8s.io/cluster-api/pkg/apis/cluster/v1alpha1" - clientset "sigs.k8s.io/cluster-api/pkg/client/clientset_generated/clientset" - internalinterfaces "sigs.k8s.io/cluster-api/pkg/client/informers_generated/externalversions/internalinterfaces" - v1alpha1 "sigs.k8s.io/cluster-api/pkg/client/listers_generated/cluster/v1alpha1" ) // MachineDeploymentInformer provides access to a shared informer and lister for diff --git a/vendor/sigs.k8s.io/cluster-api/pkg/client/informers_generated/externalversions/cluster/v1alpha1/machineset.go b/vendor/github.com/openshift/cluster-api/pkg/client/informers_generated/externalversions/cluster/v1alpha1/machineset.go similarity index 89% rename from vendor/sigs.k8s.io/cluster-api/pkg/client/informers_generated/externalversions/cluster/v1alpha1/machineset.go rename to vendor/github.com/openshift/cluster-api/pkg/client/informers_generated/externalversions/cluster/v1alpha1/machineset.go index b24fc14a5..a3179d4fb 100644 --- a/vendor/sigs.k8s.io/cluster-api/pkg/client/informers_generated/externalversions/cluster/v1alpha1/machineset.go +++ b/vendor/github.com/openshift/cluster-api/pkg/client/informers_generated/externalversions/cluster/v1alpha1/machineset.go @@ -21,14 +21,14 @@ package v1alpha1 import ( time "time" + clusterv1alpha1 "github.com/openshift/cluster-api/pkg/apis/cluster/v1alpha1" + clientset "github.com/openshift/cluster-api/pkg/client/clientset_generated/clientset" + internalinterfaces "github.com/openshift/cluster-api/pkg/client/informers_generated/externalversions/internalinterfaces" + v1alpha1 "github.com/openshift/cluster-api/pkg/client/listers_generated/cluster/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" - clusterv1alpha1 "sigs.k8s.io/cluster-api/pkg/apis/cluster/v1alpha1" - clientset "sigs.k8s.io/cluster-api/pkg/client/clientset_generated/clientset" - internalinterfaces "sigs.k8s.io/cluster-api/pkg/client/informers_generated/externalversions/internalinterfaces" - v1alpha1 "sigs.k8s.io/cluster-api/pkg/client/listers_generated/cluster/v1alpha1" ) // MachineSetInformer provides access to a shared informer and lister for diff --git a/vendor/sigs.k8s.io/cluster-api/pkg/client/informers_generated/externalversions/factory.go b/vendor/github.com/openshift/cluster-api/pkg/client/informers_generated/externalversions/factory.go similarity index 91% rename from vendor/sigs.k8s.io/cluster-api/pkg/client/informers_generated/externalversions/factory.go rename to vendor/github.com/openshift/cluster-api/pkg/client/informers_generated/externalversions/factory.go index 29dfc9a45..2383e1a54 100644 --- a/vendor/sigs.k8s.io/cluster-api/pkg/client/informers_generated/externalversions/factory.go +++ b/vendor/github.com/openshift/cluster-api/pkg/client/informers_generated/externalversions/factory.go @@ -23,13 +23,14 @@ import ( sync "sync" time "time" + clientset "github.com/openshift/cluster-api/pkg/client/clientset_generated/clientset" + cluster "github.com/openshift/cluster-api/pkg/client/informers_generated/externalversions/cluster" + internalinterfaces "github.com/openshift/cluster-api/pkg/client/informers_generated/externalversions/internalinterfaces" + machine "github.com/openshift/cluster-api/pkg/client/informers_generated/externalversions/machine" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" runtime "k8s.io/apimachinery/pkg/runtime" schema "k8s.io/apimachinery/pkg/runtime/schema" cache "k8s.io/client-go/tools/cache" - clientset "sigs.k8s.io/cluster-api/pkg/client/clientset_generated/clientset" - cluster "sigs.k8s.io/cluster-api/pkg/client/informers_generated/externalversions/cluster" - internalinterfaces "sigs.k8s.io/cluster-api/pkg/client/informers_generated/externalversions/internalinterfaces" ) // SharedInformerOption defines the functional option type for SharedInformerFactory. @@ -173,8 +174,13 @@ type SharedInformerFactory interface { WaitForCacheSync(stopCh <-chan struct{}) map[reflect.Type]bool Cluster() cluster.Interface + Machine() machine.Interface } func (f *sharedInformerFactory) Cluster() cluster.Interface { return cluster.New(f, f.namespace, f.tweakListOptions) } + +func (f *sharedInformerFactory) Machine() machine.Interface { + return machine.New(f, f.namespace, f.tweakListOptions) +} diff --git a/vendor/sigs.k8s.io/cluster-api/pkg/client/informers_generated/externalversions/generic.go b/vendor/github.com/openshift/cluster-api/pkg/client/informers_generated/externalversions/generic.go similarity index 70% rename from vendor/sigs.k8s.io/cluster-api/pkg/client/informers_generated/externalversions/generic.go rename to vendor/github.com/openshift/cluster-api/pkg/client/informers_generated/externalversions/generic.go index a51e0ed76..b26301d59 100644 --- a/vendor/sigs.k8s.io/cluster-api/pkg/client/informers_generated/externalversions/generic.go +++ b/vendor/github.com/openshift/cluster-api/pkg/client/informers_generated/externalversions/generic.go @@ -21,9 +21,10 @@ package externalversions import ( "fmt" + v1alpha1 "github.com/openshift/cluster-api/pkg/apis/cluster/v1alpha1" + v1beta1 "github.com/openshift/cluster-api/pkg/apis/machine/v1beta1" schema "k8s.io/apimachinery/pkg/runtime/schema" cache "k8s.io/client-go/tools/cache" - v1alpha1 "sigs.k8s.io/cluster-api/pkg/apis/cluster/v1alpha1" ) // GenericInformer is type of SharedIndexInformer which will locate and delegate to other @@ -64,6 +65,18 @@ func (f *sharedInformerFactory) ForResource(resource schema.GroupVersionResource case v1alpha1.SchemeGroupVersion.WithResource("machinesets"): return &genericInformer{resource: resource.GroupResource(), informer: f.Cluster().V1alpha1().MachineSets().Informer()}, nil + // Group=machine.openshift.io, Version=v1beta1 + case v1beta1.SchemeGroupVersion.WithResource("clusters"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Machine().V1beta1().Clusters().Informer()}, nil + case v1beta1.SchemeGroupVersion.WithResource("machines"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Machine().V1beta1().Machines().Informer()}, nil + case v1beta1.SchemeGroupVersion.WithResource("machineclasses"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Machine().V1beta1().MachineClasses().Informer()}, nil + case v1beta1.SchemeGroupVersion.WithResource("machinedeployments"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Machine().V1beta1().MachineDeployments().Informer()}, nil + case v1beta1.SchemeGroupVersion.WithResource("machinesets"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Machine().V1beta1().MachineSets().Informer()}, nil + } return nil, fmt.Errorf("no informer found for %v", resource) diff --git a/vendor/sigs.k8s.io/cluster-api/pkg/client/informers_generated/externalversions/internalinterfaces/BUILD.bazel b/vendor/github.com/openshift/cluster-api/pkg/client/informers_generated/externalversions/internalinterfaces/BUILD.bazel similarity index 80% rename from vendor/sigs.k8s.io/cluster-api/pkg/client/informers_generated/externalversions/internalinterfaces/BUILD.bazel rename to vendor/github.com/openshift/cluster-api/pkg/client/informers_generated/externalversions/internalinterfaces/BUILD.bazel index d6a8332c9..86d3c2e40 100644 --- a/vendor/sigs.k8s.io/cluster-api/pkg/client/informers_generated/externalversions/internalinterfaces/BUILD.bazel +++ b/vendor/github.com/openshift/cluster-api/pkg/client/informers_generated/externalversions/internalinterfaces/BUILD.bazel @@ -3,7 +3,7 @@ load("@io_bazel_rules_go//go:def.bzl", "go_library") go_library( name = "go_default_library", srcs = ["factory_interfaces.go"], - importpath = "sigs.k8s.io/cluster-api/pkg/client/informers_generated/externalversions/internalinterfaces", + importpath = "github.com/openshift/cluster-api/pkg/client/informers_generated/externalversions/internalinterfaces", visibility = ["//visibility:public"], deps = [ "//pkg/client/clientset_generated/clientset:go_default_library", diff --git a/vendor/sigs.k8s.io/cluster-api/pkg/client/informers_generated/externalversions/internalinterfaces/factory_interfaces.go b/vendor/github.com/openshift/cluster-api/pkg/client/informers_generated/externalversions/internalinterfaces/factory_interfaces.go similarity index 93% rename from vendor/sigs.k8s.io/cluster-api/pkg/client/informers_generated/externalversions/internalinterfaces/factory_interfaces.go rename to vendor/github.com/openshift/cluster-api/pkg/client/informers_generated/externalversions/internalinterfaces/factory_interfaces.go index 272ebb198..919e36ac4 100644 --- a/vendor/sigs.k8s.io/cluster-api/pkg/client/informers_generated/externalversions/internalinterfaces/factory_interfaces.go +++ b/vendor/github.com/openshift/cluster-api/pkg/client/informers_generated/externalversions/internalinterfaces/factory_interfaces.go @@ -21,10 +21,10 @@ package internalinterfaces import ( time "time" + clientset "github.com/openshift/cluster-api/pkg/client/clientset_generated/clientset" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" runtime "k8s.io/apimachinery/pkg/runtime" cache "k8s.io/client-go/tools/cache" - clientset "sigs.k8s.io/cluster-api/pkg/client/clientset_generated/clientset" ) type NewInformerFunc func(clientset.Interface, time.Duration) cache.SharedIndexInformer diff --git a/vendor/github.com/openshift/cluster-api/pkg/client/informers_generated/externalversions/machine/BUILD.bazel b/vendor/github.com/openshift/cluster-api/pkg/client/informers_generated/externalversions/machine/BUILD.bazel new file mode 100644 index 000000000..ea2550080 --- /dev/null +++ b/vendor/github.com/openshift/cluster-api/pkg/client/informers_generated/externalversions/machine/BUILD.bazel @@ -0,0 +1,12 @@ +load("@io_bazel_rules_go//go:def.bzl", "go_library") + +go_library( + name = "go_default_library", + srcs = ["interface.go"], + importpath = "github.com/openshift/cluster-api/pkg/client/informers_generated/externalversions/machine", + visibility = ["//visibility:public"], + deps = [ + "//pkg/client/informers_generated/externalversions/internalinterfaces:go_default_library", + "//pkg/client/informers_generated/externalversions/machine/v1beta1:go_default_library", + ], +) diff --git a/vendor/github.com/openshift/cluster-api/pkg/client/informers_generated/externalversions/machine/interface.go b/vendor/github.com/openshift/cluster-api/pkg/client/informers_generated/externalversions/machine/interface.go new file mode 100644 index 000000000..ef2ffff99 --- /dev/null +++ b/vendor/github.com/openshift/cluster-api/pkg/client/informers_generated/externalversions/machine/interface.go @@ -0,0 +1,46 @@ +/* +Copyright 2018 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by informer-gen. DO NOT EDIT. + +package machine + +import ( + internalinterfaces "github.com/openshift/cluster-api/pkg/client/informers_generated/externalversions/internalinterfaces" + v1beta1 "github.com/openshift/cluster-api/pkg/client/informers_generated/externalversions/machine/v1beta1" +) + +// Interface provides access to each of this group's versions. +type Interface interface { + // V1beta1 provides access to shared informers for resources in V1beta1. + V1beta1() v1beta1.Interface +} + +type group struct { + factory internalinterfaces.SharedInformerFactory + namespace string + tweakListOptions internalinterfaces.TweakListOptionsFunc +} + +// New returns a new Interface. +func New(f internalinterfaces.SharedInformerFactory, namespace string, tweakListOptions internalinterfaces.TweakListOptionsFunc) Interface { + return &group{factory: f, namespace: namespace, tweakListOptions: tweakListOptions} +} + +// V1beta1 returns a new v1beta1.Interface. +func (g *group) V1beta1() v1beta1.Interface { + return v1beta1.New(g.factory, g.namespace, g.tweakListOptions) +} diff --git a/vendor/github.com/openshift/cluster-api/pkg/client/informers_generated/externalversions/machine/v1beta1/BUILD.bazel b/vendor/github.com/openshift/cluster-api/pkg/client/informers_generated/externalversions/machine/v1beta1/BUILD.bazel new file mode 100644 index 000000000..65f99f6c1 --- /dev/null +++ b/vendor/github.com/openshift/cluster-api/pkg/client/informers_generated/externalversions/machine/v1beta1/BUILD.bazel @@ -0,0 +1,25 @@ +load("@io_bazel_rules_go//go:def.bzl", "go_library") + +go_library( + name = "go_default_library", + srcs = [ + "cluster.go", + "interface.go", + "machine.go", + "machineclass.go", + "machinedeployment.go", + "machineset.go", + ], + importpath = "github.com/openshift/cluster-api/pkg/client/informers_generated/externalversions/machine/v1beta1", + visibility = ["//visibility:public"], + deps = [ + "//pkg/apis/machine/v1beta1:go_default_library", + "//pkg/client/clientset_generated/clientset:go_default_library", + "//pkg/client/informers_generated/externalversions/internalinterfaces:go_default_library", + "//pkg/client/listers_generated/machine/v1beta1:go_default_library", + "//vendor/k8s.io/apimachinery/pkg/apis/meta/v1:go_default_library", + "//vendor/k8s.io/apimachinery/pkg/runtime:go_default_library", + "//vendor/k8s.io/apimachinery/pkg/watch:go_default_library", + "//vendor/k8s.io/client-go/tools/cache:go_default_library", + ], +) diff --git a/vendor/github.com/openshift/cluster-api/pkg/client/informers_generated/externalversions/machine/v1beta1/cluster.go b/vendor/github.com/openshift/cluster-api/pkg/client/informers_generated/externalversions/machine/v1beta1/cluster.go new file mode 100644 index 000000000..292c42f02 --- /dev/null +++ b/vendor/github.com/openshift/cluster-api/pkg/client/informers_generated/externalversions/machine/v1beta1/cluster.go @@ -0,0 +1,89 @@ +/* +Copyright 2018 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by informer-gen. DO NOT EDIT. + +package v1beta1 + +import ( + time "time" + + machinev1beta1 "github.com/openshift/cluster-api/pkg/apis/machine/v1beta1" + clientset "github.com/openshift/cluster-api/pkg/client/clientset_generated/clientset" + internalinterfaces "github.com/openshift/cluster-api/pkg/client/informers_generated/externalversions/internalinterfaces" + v1beta1 "github.com/openshift/cluster-api/pkg/client/listers_generated/machine/v1beta1" + 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" +) + +// ClusterInformer provides access to a shared informer and lister for +// Clusters. +type ClusterInformer interface { + Informer() cache.SharedIndexInformer + Lister() v1beta1.ClusterLister +} + +type clusterInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc + namespace string +} + +// NewClusterInformer constructs a new informer for Cluster type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewClusterInformer(client clientset.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredClusterInformer(client, namespace, resyncPeriod, indexers, nil) +} + +// NewFilteredClusterInformer constructs a new informer for Cluster type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewFilteredClusterInformer(client clientset.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { + return cache.NewSharedIndexInformer( + &cache.ListWatch{ + ListFunc: func(options v1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.MachineV1beta1().Clusters(namespace).List(options) + }, + WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.MachineV1beta1().Clusters(namespace).Watch(options) + }, + }, + &machinev1beta1.Cluster{}, + resyncPeriod, + indexers, + ) +} + +func (f *clusterInformer) defaultInformer(client clientset.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredClusterInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) +} + +func (f *clusterInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&machinev1beta1.Cluster{}, f.defaultInformer) +} + +func (f *clusterInformer) Lister() v1beta1.ClusterLister { + return v1beta1.NewClusterLister(f.Informer().GetIndexer()) +} diff --git a/vendor/github.com/openshift/cluster-api/pkg/client/informers_generated/externalversions/machine/v1beta1/interface.go b/vendor/github.com/openshift/cluster-api/pkg/client/informers_generated/externalversions/machine/v1beta1/interface.go new file mode 100644 index 000000000..870a0b17b --- /dev/null +++ b/vendor/github.com/openshift/cluster-api/pkg/client/informers_generated/externalversions/machine/v1beta1/interface.go @@ -0,0 +1,73 @@ +/* +Copyright 2018 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by informer-gen. DO NOT EDIT. + +package v1beta1 + +import ( + internalinterfaces "github.com/openshift/cluster-api/pkg/client/informers_generated/externalversions/internalinterfaces" +) + +// Interface provides access to all the informers in this group version. +type Interface interface { + // Clusters returns a ClusterInformer. + Clusters() ClusterInformer + // Machines returns a MachineInformer. + Machines() MachineInformer + // MachineClasses returns a MachineClassInformer. + MachineClasses() MachineClassInformer + // MachineDeployments returns a MachineDeploymentInformer. + MachineDeployments() MachineDeploymentInformer + // MachineSets returns a MachineSetInformer. + MachineSets() MachineSetInformer +} + +type version struct { + factory internalinterfaces.SharedInformerFactory + namespace string + tweakListOptions internalinterfaces.TweakListOptionsFunc +} + +// New returns a new Interface. +func New(f internalinterfaces.SharedInformerFactory, namespace string, tweakListOptions internalinterfaces.TweakListOptionsFunc) Interface { + return &version{factory: f, namespace: namespace, tweakListOptions: tweakListOptions} +} + +// Clusters returns a ClusterInformer. +func (v *version) Clusters() ClusterInformer { + return &clusterInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} +} + +// Machines returns a MachineInformer. +func (v *version) Machines() MachineInformer { + return &machineInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} +} + +// MachineClasses returns a MachineClassInformer. +func (v *version) MachineClasses() MachineClassInformer { + return &machineClassInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} +} + +// MachineDeployments returns a MachineDeploymentInformer. +func (v *version) MachineDeployments() MachineDeploymentInformer { + return &machineDeploymentInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} +} + +// MachineSets returns a MachineSetInformer. +func (v *version) MachineSets() MachineSetInformer { + return &machineSetInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} +} diff --git a/vendor/github.com/openshift/cluster-api/pkg/client/informers_generated/externalversions/machine/v1beta1/machine.go b/vendor/github.com/openshift/cluster-api/pkg/client/informers_generated/externalversions/machine/v1beta1/machine.go new file mode 100644 index 000000000..21a0714e2 --- /dev/null +++ b/vendor/github.com/openshift/cluster-api/pkg/client/informers_generated/externalversions/machine/v1beta1/machine.go @@ -0,0 +1,89 @@ +/* +Copyright 2018 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by informer-gen. DO NOT EDIT. + +package v1beta1 + +import ( + time "time" + + machinev1beta1 "github.com/openshift/cluster-api/pkg/apis/machine/v1beta1" + clientset "github.com/openshift/cluster-api/pkg/client/clientset_generated/clientset" + internalinterfaces "github.com/openshift/cluster-api/pkg/client/informers_generated/externalversions/internalinterfaces" + v1beta1 "github.com/openshift/cluster-api/pkg/client/listers_generated/machine/v1beta1" + 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" +) + +// MachineInformer provides access to a shared informer and lister for +// Machines. +type MachineInformer interface { + Informer() cache.SharedIndexInformer + Lister() v1beta1.MachineLister +} + +type machineInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc + namespace string +} + +// NewMachineInformer constructs a new informer for Machine type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewMachineInformer(client clientset.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredMachineInformer(client, namespace, resyncPeriod, indexers, nil) +} + +// NewFilteredMachineInformer constructs a new informer for Machine type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewFilteredMachineInformer(client clientset.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { + return cache.NewSharedIndexInformer( + &cache.ListWatch{ + ListFunc: func(options v1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.MachineV1beta1().Machines(namespace).List(options) + }, + WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.MachineV1beta1().Machines(namespace).Watch(options) + }, + }, + &machinev1beta1.Machine{}, + resyncPeriod, + indexers, + ) +} + +func (f *machineInformer) defaultInformer(client clientset.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredMachineInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) +} + +func (f *machineInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&machinev1beta1.Machine{}, f.defaultInformer) +} + +func (f *machineInformer) Lister() v1beta1.MachineLister { + return v1beta1.NewMachineLister(f.Informer().GetIndexer()) +} diff --git a/vendor/github.com/openshift/cluster-api/pkg/client/informers_generated/externalversions/machine/v1beta1/machineclass.go b/vendor/github.com/openshift/cluster-api/pkg/client/informers_generated/externalversions/machine/v1beta1/machineclass.go new file mode 100644 index 000000000..dba427007 --- /dev/null +++ b/vendor/github.com/openshift/cluster-api/pkg/client/informers_generated/externalversions/machine/v1beta1/machineclass.go @@ -0,0 +1,89 @@ +/* +Copyright 2018 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by informer-gen. DO NOT EDIT. + +package v1beta1 + +import ( + time "time" + + machinev1beta1 "github.com/openshift/cluster-api/pkg/apis/machine/v1beta1" + clientset "github.com/openshift/cluster-api/pkg/client/clientset_generated/clientset" + internalinterfaces "github.com/openshift/cluster-api/pkg/client/informers_generated/externalversions/internalinterfaces" + v1beta1 "github.com/openshift/cluster-api/pkg/client/listers_generated/machine/v1beta1" + 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" +) + +// MachineClassInformer provides access to a shared informer and lister for +// MachineClasses. +type MachineClassInformer interface { + Informer() cache.SharedIndexInformer + Lister() v1beta1.MachineClassLister +} + +type machineClassInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc + namespace string +} + +// NewMachineClassInformer constructs a new informer for MachineClass type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewMachineClassInformer(client clientset.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredMachineClassInformer(client, namespace, resyncPeriod, indexers, nil) +} + +// NewFilteredMachineClassInformer constructs a new informer for MachineClass type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewFilteredMachineClassInformer(client clientset.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { + return cache.NewSharedIndexInformer( + &cache.ListWatch{ + ListFunc: func(options v1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.MachineV1beta1().MachineClasses(namespace).List(options) + }, + WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.MachineV1beta1().MachineClasses(namespace).Watch(options) + }, + }, + &machinev1beta1.MachineClass{}, + resyncPeriod, + indexers, + ) +} + +func (f *machineClassInformer) defaultInformer(client clientset.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredMachineClassInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) +} + +func (f *machineClassInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&machinev1beta1.MachineClass{}, f.defaultInformer) +} + +func (f *machineClassInformer) Lister() v1beta1.MachineClassLister { + return v1beta1.NewMachineClassLister(f.Informer().GetIndexer()) +} diff --git a/vendor/github.com/openshift/cluster-api/pkg/client/informers_generated/externalversions/machine/v1beta1/machinedeployment.go b/vendor/github.com/openshift/cluster-api/pkg/client/informers_generated/externalversions/machine/v1beta1/machinedeployment.go new file mode 100644 index 000000000..e1c226bdb --- /dev/null +++ b/vendor/github.com/openshift/cluster-api/pkg/client/informers_generated/externalversions/machine/v1beta1/machinedeployment.go @@ -0,0 +1,89 @@ +/* +Copyright 2018 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by informer-gen. DO NOT EDIT. + +package v1beta1 + +import ( + time "time" + + machinev1beta1 "github.com/openshift/cluster-api/pkg/apis/machine/v1beta1" + clientset "github.com/openshift/cluster-api/pkg/client/clientset_generated/clientset" + internalinterfaces "github.com/openshift/cluster-api/pkg/client/informers_generated/externalversions/internalinterfaces" + v1beta1 "github.com/openshift/cluster-api/pkg/client/listers_generated/machine/v1beta1" + 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" +) + +// MachineDeploymentInformer provides access to a shared informer and lister for +// MachineDeployments. +type MachineDeploymentInformer interface { + Informer() cache.SharedIndexInformer + Lister() v1beta1.MachineDeploymentLister +} + +type machineDeploymentInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc + namespace string +} + +// NewMachineDeploymentInformer constructs a new informer for MachineDeployment type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewMachineDeploymentInformer(client clientset.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredMachineDeploymentInformer(client, namespace, resyncPeriod, indexers, nil) +} + +// NewFilteredMachineDeploymentInformer constructs a new informer for MachineDeployment type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewFilteredMachineDeploymentInformer(client clientset.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { + return cache.NewSharedIndexInformer( + &cache.ListWatch{ + ListFunc: func(options v1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.MachineV1beta1().MachineDeployments(namespace).List(options) + }, + WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.MachineV1beta1().MachineDeployments(namespace).Watch(options) + }, + }, + &machinev1beta1.MachineDeployment{}, + resyncPeriod, + indexers, + ) +} + +func (f *machineDeploymentInformer) defaultInformer(client clientset.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredMachineDeploymentInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) +} + +func (f *machineDeploymentInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&machinev1beta1.MachineDeployment{}, f.defaultInformer) +} + +func (f *machineDeploymentInformer) Lister() v1beta1.MachineDeploymentLister { + return v1beta1.NewMachineDeploymentLister(f.Informer().GetIndexer()) +} diff --git a/vendor/github.com/openshift/cluster-api/pkg/client/informers_generated/externalversions/machine/v1beta1/machineset.go b/vendor/github.com/openshift/cluster-api/pkg/client/informers_generated/externalversions/machine/v1beta1/machineset.go new file mode 100644 index 000000000..fe576d632 --- /dev/null +++ b/vendor/github.com/openshift/cluster-api/pkg/client/informers_generated/externalversions/machine/v1beta1/machineset.go @@ -0,0 +1,89 @@ +/* +Copyright 2018 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by informer-gen. DO NOT EDIT. + +package v1beta1 + +import ( + time "time" + + machinev1beta1 "github.com/openshift/cluster-api/pkg/apis/machine/v1beta1" + clientset "github.com/openshift/cluster-api/pkg/client/clientset_generated/clientset" + internalinterfaces "github.com/openshift/cluster-api/pkg/client/informers_generated/externalversions/internalinterfaces" + v1beta1 "github.com/openshift/cluster-api/pkg/client/listers_generated/machine/v1beta1" + 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" +) + +// MachineSetInformer provides access to a shared informer and lister for +// MachineSets. +type MachineSetInformer interface { + Informer() cache.SharedIndexInformer + Lister() v1beta1.MachineSetLister +} + +type machineSetInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc + namespace string +} + +// NewMachineSetInformer constructs a new informer for MachineSet type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewMachineSetInformer(client clientset.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredMachineSetInformer(client, namespace, resyncPeriod, indexers, nil) +} + +// NewFilteredMachineSetInformer constructs a new informer for MachineSet type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewFilteredMachineSetInformer(client clientset.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { + return cache.NewSharedIndexInformer( + &cache.ListWatch{ + ListFunc: func(options v1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.MachineV1beta1().MachineSets(namespace).List(options) + }, + WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.MachineV1beta1().MachineSets(namespace).Watch(options) + }, + }, + &machinev1beta1.MachineSet{}, + resyncPeriod, + indexers, + ) +} + +func (f *machineSetInformer) defaultInformer(client clientset.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredMachineSetInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) +} + +func (f *machineSetInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&machinev1beta1.MachineSet{}, f.defaultInformer) +} + +func (f *machineSetInformer) Lister() v1beta1.MachineSetLister { + return v1beta1.NewMachineSetLister(f.Informer().GetIndexer()) +} diff --git a/vendor/sigs.k8s.io/cluster-api/pkg/client/listers_generated/cluster/v1alpha1/BUILD.bazel b/vendor/github.com/openshift/cluster-api/pkg/client/listers_generated/cluster/v1alpha1/BUILD.bazel similarity index 86% rename from vendor/sigs.k8s.io/cluster-api/pkg/client/listers_generated/cluster/v1alpha1/BUILD.bazel rename to vendor/github.com/openshift/cluster-api/pkg/client/listers_generated/cluster/v1alpha1/BUILD.bazel index 40ed52868..50e7b656d 100644 --- a/vendor/sigs.k8s.io/cluster-api/pkg/client/listers_generated/cluster/v1alpha1/BUILD.bazel +++ b/vendor/github.com/openshift/cluster-api/pkg/client/listers_generated/cluster/v1alpha1/BUILD.bazel @@ -10,7 +10,7 @@ go_library( "machinedeployment.go", "machineset.go", ], - importpath = "sigs.k8s.io/cluster-api/pkg/client/listers_generated/cluster/v1alpha1", + importpath = "github.com/openshift/cluster-api/pkg/client/listers_generated/cluster/v1alpha1", visibility = ["//visibility:public"], deps = [ "//pkg/apis/cluster/v1alpha1:go_default_library", diff --git a/vendor/sigs.k8s.io/cluster-api/pkg/client/listers_generated/cluster/v1alpha1/cluster.go b/vendor/github.com/openshift/cluster-api/pkg/client/listers_generated/cluster/v1alpha1/cluster.go similarity index 97% rename from vendor/sigs.k8s.io/cluster-api/pkg/client/listers_generated/cluster/v1alpha1/cluster.go rename to vendor/github.com/openshift/cluster-api/pkg/client/listers_generated/cluster/v1alpha1/cluster.go index e7d199083..79f5a06f8 100644 --- a/vendor/sigs.k8s.io/cluster-api/pkg/client/listers_generated/cluster/v1alpha1/cluster.go +++ b/vendor/github.com/openshift/cluster-api/pkg/client/listers_generated/cluster/v1alpha1/cluster.go @@ -19,10 +19,10 @@ limitations under the License. package v1alpha1 import ( + v1alpha1 "github.com/openshift/cluster-api/pkg/apis/cluster/v1alpha1" "k8s.io/apimachinery/pkg/api/errors" "k8s.io/apimachinery/pkg/labels" "k8s.io/client-go/tools/cache" - v1alpha1 "sigs.k8s.io/cluster-api/pkg/apis/cluster/v1alpha1" ) // ClusterLister helps list Clusters. diff --git a/vendor/sigs.k8s.io/cluster-api/pkg/client/listers_generated/cluster/v1alpha1/expansion_generated.go b/vendor/github.com/openshift/cluster-api/pkg/client/listers_generated/cluster/v1alpha1/expansion_generated.go similarity index 100% rename from vendor/sigs.k8s.io/cluster-api/pkg/client/listers_generated/cluster/v1alpha1/expansion_generated.go rename to vendor/github.com/openshift/cluster-api/pkg/client/listers_generated/cluster/v1alpha1/expansion_generated.go diff --git a/vendor/sigs.k8s.io/cluster-api/pkg/client/listers_generated/cluster/v1alpha1/machine.go b/vendor/github.com/openshift/cluster-api/pkg/client/listers_generated/cluster/v1alpha1/machine.go similarity index 97% rename from vendor/sigs.k8s.io/cluster-api/pkg/client/listers_generated/cluster/v1alpha1/machine.go rename to vendor/github.com/openshift/cluster-api/pkg/client/listers_generated/cluster/v1alpha1/machine.go index 408a2a983..7d1335329 100644 --- a/vendor/sigs.k8s.io/cluster-api/pkg/client/listers_generated/cluster/v1alpha1/machine.go +++ b/vendor/github.com/openshift/cluster-api/pkg/client/listers_generated/cluster/v1alpha1/machine.go @@ -19,10 +19,10 @@ limitations under the License. package v1alpha1 import ( + v1alpha1 "github.com/openshift/cluster-api/pkg/apis/cluster/v1alpha1" "k8s.io/apimachinery/pkg/api/errors" "k8s.io/apimachinery/pkg/labels" "k8s.io/client-go/tools/cache" - v1alpha1 "sigs.k8s.io/cluster-api/pkg/apis/cluster/v1alpha1" ) // MachineLister helps list Machines. diff --git a/vendor/sigs.k8s.io/cluster-api/pkg/client/listers_generated/cluster/v1alpha1/machineclass.go b/vendor/github.com/openshift/cluster-api/pkg/client/listers_generated/cluster/v1alpha1/machineclass.go similarity index 97% rename from vendor/sigs.k8s.io/cluster-api/pkg/client/listers_generated/cluster/v1alpha1/machineclass.go rename to vendor/github.com/openshift/cluster-api/pkg/client/listers_generated/cluster/v1alpha1/machineclass.go index 61dde88f2..df2c0ed6c 100644 --- a/vendor/sigs.k8s.io/cluster-api/pkg/client/listers_generated/cluster/v1alpha1/machineclass.go +++ b/vendor/github.com/openshift/cluster-api/pkg/client/listers_generated/cluster/v1alpha1/machineclass.go @@ -19,10 +19,10 @@ limitations under the License. package v1alpha1 import ( + v1alpha1 "github.com/openshift/cluster-api/pkg/apis/cluster/v1alpha1" "k8s.io/apimachinery/pkg/api/errors" "k8s.io/apimachinery/pkg/labels" "k8s.io/client-go/tools/cache" - v1alpha1 "sigs.k8s.io/cluster-api/pkg/apis/cluster/v1alpha1" ) // MachineClassLister helps list MachineClasses. diff --git a/vendor/sigs.k8s.io/cluster-api/pkg/client/listers_generated/cluster/v1alpha1/machinedeployment.go b/vendor/github.com/openshift/cluster-api/pkg/client/listers_generated/cluster/v1alpha1/machinedeployment.go similarity index 98% rename from vendor/sigs.k8s.io/cluster-api/pkg/client/listers_generated/cluster/v1alpha1/machinedeployment.go rename to vendor/github.com/openshift/cluster-api/pkg/client/listers_generated/cluster/v1alpha1/machinedeployment.go index 265e4358e..96b47bbf5 100644 --- a/vendor/sigs.k8s.io/cluster-api/pkg/client/listers_generated/cluster/v1alpha1/machinedeployment.go +++ b/vendor/github.com/openshift/cluster-api/pkg/client/listers_generated/cluster/v1alpha1/machinedeployment.go @@ -19,10 +19,10 @@ limitations under the License. package v1alpha1 import ( + v1alpha1 "github.com/openshift/cluster-api/pkg/apis/cluster/v1alpha1" "k8s.io/apimachinery/pkg/api/errors" "k8s.io/apimachinery/pkg/labels" "k8s.io/client-go/tools/cache" - v1alpha1 "sigs.k8s.io/cluster-api/pkg/apis/cluster/v1alpha1" ) // MachineDeploymentLister helps list MachineDeployments. diff --git a/vendor/sigs.k8s.io/cluster-api/pkg/client/listers_generated/cluster/v1alpha1/machineset.go b/vendor/github.com/openshift/cluster-api/pkg/client/listers_generated/cluster/v1alpha1/machineset.go similarity index 97% rename from vendor/sigs.k8s.io/cluster-api/pkg/client/listers_generated/cluster/v1alpha1/machineset.go rename to vendor/github.com/openshift/cluster-api/pkg/client/listers_generated/cluster/v1alpha1/machineset.go index da73376fa..50066366c 100644 --- a/vendor/sigs.k8s.io/cluster-api/pkg/client/listers_generated/cluster/v1alpha1/machineset.go +++ b/vendor/github.com/openshift/cluster-api/pkg/client/listers_generated/cluster/v1alpha1/machineset.go @@ -19,10 +19,10 @@ limitations under the License. package v1alpha1 import ( + v1alpha1 "github.com/openshift/cluster-api/pkg/apis/cluster/v1alpha1" "k8s.io/apimachinery/pkg/api/errors" "k8s.io/apimachinery/pkg/labels" "k8s.io/client-go/tools/cache" - v1alpha1 "sigs.k8s.io/cluster-api/pkg/apis/cluster/v1alpha1" ) // MachineSetLister helps list MachineSets. diff --git a/vendor/github.com/openshift/cluster-api/pkg/client/listers_generated/machine/v1beta1/BUILD.bazel b/vendor/github.com/openshift/cluster-api/pkg/client/listers_generated/machine/v1beta1/BUILD.bazel new file mode 100644 index 000000000..dd5854547 --- /dev/null +++ b/vendor/github.com/openshift/cluster-api/pkg/client/listers_generated/machine/v1beta1/BUILD.bazel @@ -0,0 +1,21 @@ +load("@io_bazel_rules_go//go:def.bzl", "go_library") + +go_library( + name = "go_default_library", + srcs = [ + "cluster.go", + "expansion_generated.go", + "machine.go", + "machineclass.go", + "machinedeployment.go", + "machineset.go", + ], + importpath = "github.com/openshift/cluster-api/pkg/client/listers_generated/machine/v1beta1", + visibility = ["//visibility:public"], + deps = [ + "//pkg/apis/machine/v1beta1:go_default_library", + "//vendor/k8s.io/apimachinery/pkg/api/errors:go_default_library", + "//vendor/k8s.io/apimachinery/pkg/labels:go_default_library", + "//vendor/k8s.io/client-go/tools/cache:go_default_library", + ], +) diff --git a/vendor/github.com/openshift/cluster-api/pkg/client/listers_generated/machine/v1beta1/cluster.go b/vendor/github.com/openshift/cluster-api/pkg/client/listers_generated/machine/v1beta1/cluster.go new file mode 100644 index 000000000..1a509ddaf --- /dev/null +++ b/vendor/github.com/openshift/cluster-api/pkg/client/listers_generated/machine/v1beta1/cluster.go @@ -0,0 +1,94 @@ +/* +Copyright 2018 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by lister-gen. DO NOT EDIT. + +package v1beta1 + +import ( + v1beta1 "github.com/openshift/cluster-api/pkg/apis/machine/v1beta1" + "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/tools/cache" +) + +// ClusterLister helps list Clusters. +type ClusterLister interface { + // List lists all Clusters in the indexer. + List(selector labels.Selector) (ret []*v1beta1.Cluster, err error) + // Clusters returns an object that can list and get Clusters. + Clusters(namespace string) ClusterNamespaceLister + ClusterListerExpansion +} + +// clusterLister implements the ClusterLister interface. +type clusterLister struct { + indexer cache.Indexer +} + +// NewClusterLister returns a new ClusterLister. +func NewClusterLister(indexer cache.Indexer) ClusterLister { + return &clusterLister{indexer: indexer} +} + +// List lists all Clusters in the indexer. +func (s *clusterLister) List(selector labels.Selector) (ret []*v1beta1.Cluster, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*v1beta1.Cluster)) + }) + return ret, err +} + +// Clusters returns an object that can list and get Clusters. +func (s *clusterLister) Clusters(namespace string) ClusterNamespaceLister { + return clusterNamespaceLister{indexer: s.indexer, namespace: namespace} +} + +// ClusterNamespaceLister helps list and get Clusters. +type ClusterNamespaceLister interface { + // List lists all Clusters in the indexer for a given namespace. + List(selector labels.Selector) (ret []*v1beta1.Cluster, err error) + // Get retrieves the Cluster from the indexer for a given namespace and name. + Get(name string) (*v1beta1.Cluster, error) + ClusterNamespaceListerExpansion +} + +// clusterNamespaceLister implements the ClusterNamespaceLister +// interface. +type clusterNamespaceLister struct { + indexer cache.Indexer + namespace string +} + +// List lists all Clusters in the indexer for a given namespace. +func (s clusterNamespaceLister) List(selector labels.Selector) (ret []*v1beta1.Cluster, err error) { + err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { + ret = append(ret, m.(*v1beta1.Cluster)) + }) + return ret, err +} + +// Get retrieves the Cluster from the indexer for a given namespace and name. +func (s clusterNamespaceLister) Get(name string) (*v1beta1.Cluster, error) { + obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(v1beta1.Resource("cluster"), name) + } + return obj.(*v1beta1.Cluster), nil +} diff --git a/vendor/github.com/openshift/cluster-api/pkg/client/listers_generated/machine/v1beta1/expansion_generated.go b/vendor/github.com/openshift/cluster-api/pkg/client/listers_generated/machine/v1beta1/expansion_generated.go new file mode 100644 index 000000000..8333c8008 --- /dev/null +++ b/vendor/github.com/openshift/cluster-api/pkg/client/listers_generated/machine/v1beta1/expansion_generated.go @@ -0,0 +1,59 @@ +/* +Copyright 2018 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by lister-gen. DO NOT EDIT. + +package v1beta1 + +// ClusterListerExpansion allows custom methods to be added to +// ClusterLister. +type ClusterListerExpansion interface{} + +// ClusterNamespaceListerExpansion allows custom methods to be added to +// ClusterNamespaceLister. +type ClusterNamespaceListerExpansion interface{} + +// MachineListerExpansion allows custom methods to be added to +// MachineLister. +type MachineListerExpansion interface{} + +// MachineNamespaceListerExpansion allows custom methods to be added to +// MachineNamespaceLister. +type MachineNamespaceListerExpansion interface{} + +// MachineClassListerExpansion allows custom methods to be added to +// MachineClassLister. +type MachineClassListerExpansion interface{} + +// MachineClassNamespaceListerExpansion allows custom methods to be added to +// MachineClassNamespaceLister. +type MachineClassNamespaceListerExpansion interface{} + +// MachineDeploymentListerExpansion allows custom methods to be added to +// MachineDeploymentLister. +type MachineDeploymentListerExpansion interface{} + +// MachineDeploymentNamespaceListerExpansion allows custom methods to be added to +// MachineDeploymentNamespaceLister. +type MachineDeploymentNamespaceListerExpansion interface{} + +// MachineSetListerExpansion allows custom methods to be added to +// MachineSetLister. +type MachineSetListerExpansion interface{} + +// MachineSetNamespaceListerExpansion allows custom methods to be added to +// MachineSetNamespaceLister. +type MachineSetNamespaceListerExpansion interface{} diff --git a/vendor/github.com/openshift/cluster-api/pkg/client/listers_generated/machine/v1beta1/machine.go b/vendor/github.com/openshift/cluster-api/pkg/client/listers_generated/machine/v1beta1/machine.go new file mode 100644 index 000000000..8208d3386 --- /dev/null +++ b/vendor/github.com/openshift/cluster-api/pkg/client/listers_generated/machine/v1beta1/machine.go @@ -0,0 +1,94 @@ +/* +Copyright 2018 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by lister-gen. DO NOT EDIT. + +package v1beta1 + +import ( + v1beta1 "github.com/openshift/cluster-api/pkg/apis/machine/v1beta1" + "k8s.io/apimachinery/pkg/api/errors" + "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 []*v1beta1.Machine, err error) + // Machines returns an object that can list and get Machines. + Machines(namespace string) MachineNamespaceLister + MachineListerExpansion +} + +// machineLister implements the MachineLister interface. +type machineLister struct { + indexer cache.Indexer +} + +// NewMachineLister returns a new MachineLister. +func NewMachineLister(indexer cache.Indexer) MachineLister { + return &machineLister{indexer: indexer} +} + +// List lists all Machines in the indexer. +func (s *machineLister) List(selector labels.Selector) (ret []*v1beta1.Machine, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*v1beta1.Machine)) + }) + return ret, err +} + +// Machines returns an object that can list and get Machines. +func (s *machineLister) Machines(namespace string) MachineNamespaceLister { + return machineNamespaceLister{indexer: s.indexer, namespace: namespace} +} + +// MachineNamespaceLister helps list and get Machines. +type MachineNamespaceLister interface { + // List lists all Machines in the indexer for a given namespace. + List(selector labels.Selector) (ret []*v1beta1.Machine, err error) + // Get retrieves the Machine from the indexer for a given namespace and name. + Get(name string) (*v1beta1.Machine, error) + MachineNamespaceListerExpansion +} + +// machineNamespaceLister implements the MachineNamespaceLister +// interface. +type machineNamespaceLister struct { + indexer cache.Indexer + namespace string +} + +// List lists all Machines in the indexer for a given namespace. +func (s machineNamespaceLister) List(selector labels.Selector) (ret []*v1beta1.Machine, err error) { + err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { + ret = append(ret, m.(*v1beta1.Machine)) + }) + return ret, err +} + +// Get retrieves the Machine from the indexer for a given namespace and name. +func (s machineNamespaceLister) Get(name string) (*v1beta1.Machine, error) { + obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(v1beta1.Resource("machine"), name) + } + return obj.(*v1beta1.Machine), nil +} diff --git a/vendor/github.com/openshift/cluster-api/pkg/client/listers_generated/machine/v1beta1/machineclass.go b/vendor/github.com/openshift/cluster-api/pkg/client/listers_generated/machine/v1beta1/machineclass.go new file mode 100644 index 000000000..7e78a7ec8 --- /dev/null +++ b/vendor/github.com/openshift/cluster-api/pkg/client/listers_generated/machine/v1beta1/machineclass.go @@ -0,0 +1,94 @@ +/* +Copyright 2018 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by lister-gen. DO NOT EDIT. + +package v1beta1 + +import ( + v1beta1 "github.com/openshift/cluster-api/pkg/apis/machine/v1beta1" + "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/tools/cache" +) + +// MachineClassLister helps list MachineClasses. +type MachineClassLister interface { + // List lists all MachineClasses in the indexer. + List(selector labels.Selector) (ret []*v1beta1.MachineClass, err error) + // MachineClasses returns an object that can list and get MachineClasses. + MachineClasses(namespace string) MachineClassNamespaceLister + MachineClassListerExpansion +} + +// machineClassLister implements the MachineClassLister interface. +type machineClassLister struct { + indexer cache.Indexer +} + +// NewMachineClassLister returns a new MachineClassLister. +func NewMachineClassLister(indexer cache.Indexer) MachineClassLister { + return &machineClassLister{indexer: indexer} +} + +// List lists all MachineClasses in the indexer. +func (s *machineClassLister) List(selector labels.Selector) (ret []*v1beta1.MachineClass, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*v1beta1.MachineClass)) + }) + return ret, err +} + +// MachineClasses returns an object that can list and get MachineClasses. +func (s *machineClassLister) MachineClasses(namespace string) MachineClassNamespaceLister { + return machineClassNamespaceLister{indexer: s.indexer, namespace: namespace} +} + +// MachineClassNamespaceLister helps list and get MachineClasses. +type MachineClassNamespaceLister interface { + // List lists all MachineClasses in the indexer for a given namespace. + List(selector labels.Selector) (ret []*v1beta1.MachineClass, err error) + // Get retrieves the MachineClass from the indexer for a given namespace and name. + Get(name string) (*v1beta1.MachineClass, error) + MachineClassNamespaceListerExpansion +} + +// machineClassNamespaceLister implements the MachineClassNamespaceLister +// interface. +type machineClassNamespaceLister struct { + indexer cache.Indexer + namespace string +} + +// List lists all MachineClasses in the indexer for a given namespace. +func (s machineClassNamespaceLister) List(selector labels.Selector) (ret []*v1beta1.MachineClass, err error) { + err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { + ret = append(ret, m.(*v1beta1.MachineClass)) + }) + return ret, err +} + +// Get retrieves the MachineClass from the indexer for a given namespace and name. +func (s machineClassNamespaceLister) Get(name string) (*v1beta1.MachineClass, error) { + obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(v1beta1.Resource("machineclass"), name) + } + return obj.(*v1beta1.MachineClass), nil +} diff --git a/vendor/github.com/openshift/cluster-api/pkg/client/listers_generated/machine/v1beta1/machinedeployment.go b/vendor/github.com/openshift/cluster-api/pkg/client/listers_generated/machine/v1beta1/machinedeployment.go new file mode 100644 index 000000000..359522d56 --- /dev/null +++ b/vendor/github.com/openshift/cluster-api/pkg/client/listers_generated/machine/v1beta1/machinedeployment.go @@ -0,0 +1,94 @@ +/* +Copyright 2018 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by lister-gen. DO NOT EDIT. + +package v1beta1 + +import ( + v1beta1 "github.com/openshift/cluster-api/pkg/apis/machine/v1beta1" + "k8s.io/apimachinery/pkg/api/errors" + "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 []*v1beta1.MachineDeployment, err error) + // MachineDeployments returns an object that can list and get MachineDeployments. + MachineDeployments(namespace string) MachineDeploymentNamespaceLister + MachineDeploymentListerExpansion +} + +// machineDeploymentLister implements the MachineDeploymentLister interface. +type machineDeploymentLister struct { + indexer cache.Indexer +} + +// NewMachineDeploymentLister returns a new MachineDeploymentLister. +func NewMachineDeploymentLister(indexer cache.Indexer) MachineDeploymentLister { + return &machineDeploymentLister{indexer: indexer} +} + +// List lists all MachineDeployments in the indexer. +func (s *machineDeploymentLister) List(selector labels.Selector) (ret []*v1beta1.MachineDeployment, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*v1beta1.MachineDeployment)) + }) + return ret, err +} + +// MachineDeployments returns an object that can list and get MachineDeployments. +func (s *machineDeploymentLister) MachineDeployments(namespace string) MachineDeploymentNamespaceLister { + return machineDeploymentNamespaceLister{indexer: s.indexer, namespace: namespace} +} + +// MachineDeploymentNamespaceLister helps list and get MachineDeployments. +type MachineDeploymentNamespaceLister interface { + // List lists all MachineDeployments in the indexer for a given namespace. + List(selector labels.Selector) (ret []*v1beta1.MachineDeployment, err error) + // Get retrieves the MachineDeployment from the indexer for a given namespace and name. + Get(name string) (*v1beta1.MachineDeployment, error) + MachineDeploymentNamespaceListerExpansion +} + +// machineDeploymentNamespaceLister implements the MachineDeploymentNamespaceLister +// interface. +type machineDeploymentNamespaceLister struct { + indexer cache.Indexer + namespace string +} + +// List lists all MachineDeployments in the indexer for a given namespace. +func (s machineDeploymentNamespaceLister) List(selector labels.Selector) (ret []*v1beta1.MachineDeployment, err error) { + err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { + ret = append(ret, m.(*v1beta1.MachineDeployment)) + }) + return ret, err +} + +// Get retrieves the MachineDeployment from the indexer for a given namespace and name. +func (s machineDeploymentNamespaceLister) Get(name string) (*v1beta1.MachineDeployment, error) { + obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(v1beta1.Resource("machinedeployment"), name) + } + return obj.(*v1beta1.MachineDeployment), nil +} diff --git a/vendor/github.com/openshift/cluster-api/pkg/client/listers_generated/machine/v1beta1/machineset.go b/vendor/github.com/openshift/cluster-api/pkg/client/listers_generated/machine/v1beta1/machineset.go new file mode 100644 index 000000000..0c5d85c94 --- /dev/null +++ b/vendor/github.com/openshift/cluster-api/pkg/client/listers_generated/machine/v1beta1/machineset.go @@ -0,0 +1,94 @@ +/* +Copyright 2018 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by lister-gen. DO NOT EDIT. + +package v1beta1 + +import ( + v1beta1 "github.com/openshift/cluster-api/pkg/apis/machine/v1beta1" + "k8s.io/apimachinery/pkg/api/errors" + "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 []*v1beta1.MachineSet, err error) + // MachineSets returns an object that can list and get MachineSets. + MachineSets(namespace string) MachineSetNamespaceLister + MachineSetListerExpansion +} + +// machineSetLister implements the MachineSetLister interface. +type machineSetLister struct { + indexer cache.Indexer +} + +// NewMachineSetLister returns a new MachineSetLister. +func NewMachineSetLister(indexer cache.Indexer) MachineSetLister { + return &machineSetLister{indexer: indexer} +} + +// List lists all MachineSets in the indexer. +func (s *machineSetLister) List(selector labels.Selector) (ret []*v1beta1.MachineSet, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*v1beta1.MachineSet)) + }) + return ret, err +} + +// MachineSets returns an object that can list and get MachineSets. +func (s *machineSetLister) MachineSets(namespace string) MachineSetNamespaceLister { + return machineSetNamespaceLister{indexer: s.indexer, namespace: namespace} +} + +// MachineSetNamespaceLister helps list and get MachineSets. +type MachineSetNamespaceLister interface { + // List lists all MachineSets in the indexer for a given namespace. + List(selector labels.Selector) (ret []*v1beta1.MachineSet, err error) + // Get retrieves the MachineSet from the indexer for a given namespace and name. + Get(name string) (*v1beta1.MachineSet, error) + MachineSetNamespaceListerExpansion +} + +// machineSetNamespaceLister implements the MachineSetNamespaceLister +// interface. +type machineSetNamespaceLister struct { + indexer cache.Indexer + namespace string +} + +// List lists all MachineSets in the indexer for a given namespace. +func (s machineSetNamespaceLister) List(selector labels.Selector) (ret []*v1beta1.MachineSet, err error) { + err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { + ret = append(ret, m.(*v1beta1.MachineSet)) + }) + return ret, err +} + +// Get retrieves the MachineSet from the indexer for a given namespace and name. +func (s machineSetNamespaceLister) Get(name string) (*v1beta1.MachineSet, error) { + obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(v1beta1.Resource("machineset"), name) + } + return obj.(*v1beta1.MachineSet), nil +} diff --git a/vendor/sigs.k8s.io/cluster-api/pkg/cmd-runner/BUILD.bazel b/vendor/github.com/openshift/cluster-api/pkg/cmdrunner/BUILD.bazel similarity index 81% rename from vendor/sigs.k8s.io/cluster-api/pkg/cmd-runner/BUILD.bazel rename to vendor/github.com/openshift/cluster-api/pkg/cmdrunner/BUILD.bazel index 40cf8d60b..121fed16c 100644 --- a/vendor/sigs.k8s.io/cluster-api/pkg/cmd-runner/BUILD.bazel +++ b/vendor/github.com/openshift/cluster-api/pkg/cmdrunner/BUILD.bazel @@ -3,7 +3,7 @@ load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test") go_library( name = "go_default_library", srcs = ["cmd_runner.go"], - importpath = "sigs.k8s.io/cluster-api/pkg/cmd-runner", + importpath = "github.com/openshift/cluster-api/pkg/cmdrunner", visibility = ["//visibility:public"], ) diff --git a/vendor/sigs.k8s.io/cluster-api/pkg/cmd-runner/cmd_runner.go b/vendor/github.com/openshift/cluster-api/pkg/cmdrunner/cmd_runner.go similarity index 77% rename from vendor/sigs.k8s.io/cluster-api/pkg/cmd-runner/cmd_runner.go rename to vendor/github.com/openshift/cluster-api/pkg/cmdrunner/cmd_runner.go index e0311e98d..b095b7c64 100644 --- a/vendor/sigs.k8s.io/cluster-api/pkg/cmd-runner/cmd_runner.go +++ b/vendor/github.com/openshift/cluster-api/pkg/cmdrunner/cmd_runner.go @@ -14,24 +14,24 @@ See the License for the specific language governing permissions and limitations under the License. */ -package cmd_runner +package cmdrunner import ( "os/exec" ) -type CmdRunner interface { +type Runner interface { CombinedOutput(cmd string, args ...string) (output string, err error) } -type realCmdRunner struct { +type realRunner struct { } -func New() *realCmdRunner { - return &realCmdRunner{} +func New() *realRunner { + return &realRunner{} } -func (runner *realCmdRunner) CombinedOutput(cmd string, args ...string) (string, error) { +func (runner *realRunner) CombinedOutput(cmd string, args ...string) (string, error) { output, err := exec.Command(cmd, args...).CombinedOutput() return string(output), err } diff --git a/vendor/sigs.k8s.io/cluster-api/pkg/controller/BUILD.bazel b/vendor/github.com/openshift/cluster-api/pkg/controller/BUILD.bazel similarity index 89% rename from vendor/sigs.k8s.io/cluster-api/pkg/controller/BUILD.bazel rename to vendor/github.com/openshift/cluster-api/pkg/controller/BUILD.bazel index 8f075625a..7b27be2c6 100644 --- a/vendor/sigs.k8s.io/cluster-api/pkg/controller/BUILD.bazel +++ b/vendor/github.com/openshift/cluster-api/pkg/controller/BUILD.bazel @@ -8,7 +8,7 @@ go_library( "add_node.go", "controller.go", ], - importpath = "sigs.k8s.io/cluster-api/pkg/controller", + importpath = "github.com/openshift/cluster-api/pkg/controller", visibility = ["//visibility:public"], deps = [ "//pkg/controller/machinedeployment:go_default_library", diff --git a/vendor/sigs.k8s.io/cluster-api/pkg/controller/add_machinedeployment.go b/vendor/github.com/openshift/cluster-api/pkg/controller/add_machinedeployment.go similarity index 91% rename from vendor/sigs.k8s.io/cluster-api/pkg/controller/add_machinedeployment.go rename to vendor/github.com/openshift/cluster-api/pkg/controller/add_machinedeployment.go index abe62f990..9fd46a671 100644 --- a/vendor/sigs.k8s.io/cluster-api/pkg/controller/add_machinedeployment.go +++ b/vendor/github.com/openshift/cluster-api/pkg/controller/add_machinedeployment.go @@ -17,7 +17,7 @@ limitations under the License. package controller import ( - "sigs.k8s.io/cluster-api/pkg/controller/machinedeployment" + "github.com/openshift/cluster-api/pkg/controller/machinedeployment" ) func init() { diff --git a/vendor/sigs.k8s.io/cluster-api/pkg/controller/add_machineset.go b/vendor/github.com/openshift/cluster-api/pkg/controller/add_machineset.go similarity index 92% rename from vendor/sigs.k8s.io/cluster-api/pkg/controller/add_machineset.go rename to vendor/github.com/openshift/cluster-api/pkg/controller/add_machineset.go index bbdb3d36f..b0279c118 100644 --- a/vendor/sigs.k8s.io/cluster-api/pkg/controller/add_machineset.go +++ b/vendor/github.com/openshift/cluster-api/pkg/controller/add_machineset.go @@ -17,7 +17,7 @@ limitations under the License. package controller import ( - "sigs.k8s.io/cluster-api/pkg/controller/machineset" + "github.com/openshift/cluster-api/pkg/controller/machineset" ) func init() { diff --git a/vendor/sigs.k8s.io/cluster-api/pkg/controller/add_node.go b/vendor/github.com/openshift/cluster-api/pkg/controller/add_node.go similarity index 93% rename from vendor/sigs.k8s.io/cluster-api/pkg/controller/add_node.go rename to vendor/github.com/openshift/cluster-api/pkg/controller/add_node.go index f6783fb53..34c00cf72 100644 --- a/vendor/sigs.k8s.io/cluster-api/pkg/controller/add_node.go +++ b/vendor/github.com/openshift/cluster-api/pkg/controller/add_node.go @@ -17,7 +17,7 @@ limitations under the License. package controller import ( - "sigs.k8s.io/cluster-api/pkg/controller/node" + "github.com/openshift/cluster-api/pkg/controller/node" ) func init() { diff --git a/vendor/sigs.k8s.io/cluster-api/pkg/controller/cluster/BUILD.bazel b/vendor/github.com/openshift/cluster-api/pkg/controller/cluster/BUILD.bazel similarity index 96% rename from vendor/sigs.k8s.io/cluster-api/pkg/controller/cluster/BUILD.bazel rename to vendor/github.com/openshift/cluster-api/pkg/controller/cluster/BUILD.bazel index 61c5fa9a2..000be8c49 100644 --- a/vendor/sigs.k8s.io/cluster-api/pkg/controller/cluster/BUILD.bazel +++ b/vendor/github.com/openshift/cluster-api/pkg/controller/cluster/BUILD.bazel @@ -7,7 +7,7 @@ go_library( "controller.go", "testactuator.go", ], - importpath = "sigs.k8s.io/cluster-api/pkg/controller/cluster", + importpath = "github.com/openshift/cluster-api/pkg/controller/cluster", visibility = ["//visibility:public"], deps = [ "//pkg/apis/cluster/v1alpha1:go_default_library", diff --git a/vendor/sigs.k8s.io/cluster-api/pkg/controller/cluster/actuator.go b/vendor/github.com/openshift/cluster-api/pkg/controller/cluster/actuator.go similarity index 92% rename from vendor/sigs.k8s.io/cluster-api/pkg/controller/cluster/actuator.go rename to vendor/github.com/openshift/cluster-api/pkg/controller/cluster/actuator.go index d41a6cbb4..6266aa5de 100644 --- a/vendor/sigs.k8s.io/cluster-api/pkg/controller/cluster/actuator.go +++ b/vendor/github.com/openshift/cluster-api/pkg/controller/cluster/actuator.go @@ -17,7 +17,7 @@ limitations under the License. package cluster import ( - clusterv1 "sigs.k8s.io/cluster-api/pkg/apis/cluster/v1alpha1" + clusterv1 "github.com/openshift/cluster-api/pkg/apis/cluster/v1alpha1" ) /// [Actuator] diff --git a/vendor/sigs.k8s.io/cluster-api/pkg/controller/cluster/controller.go b/vendor/github.com/openshift/cluster-api/pkg/controller/cluster/controller.go similarity index 92% rename from vendor/sigs.k8s.io/cluster-api/pkg/controller/cluster/controller.go rename to vendor/github.com/openshift/cluster-api/pkg/controller/cluster/controller.go index c9b6118f9..5bf21616a 100644 --- a/vendor/sigs.k8s.io/cluster-api/pkg/controller/cluster/controller.go +++ b/vendor/github.com/openshift/cluster-api/pkg/controller/cluster/controller.go @@ -19,13 +19,13 @@ package cluster import ( "context" + clusterv1 "github.com/openshift/cluster-api/pkg/apis/cluster/v1alpha1" + clusterv1alpha1 "github.com/openshift/cluster-api/pkg/apis/cluster/v1alpha1" + controllerError "github.com/openshift/cluster-api/pkg/controller/error" + "github.com/openshift/cluster-api/pkg/util" "k8s.io/apimachinery/pkg/api/errors" "k8s.io/apimachinery/pkg/runtime" "k8s.io/klog" - clusterv1 "sigs.k8s.io/cluster-api/pkg/apis/cluster/v1alpha1" - clusterv1alpha1 "sigs.k8s.io/cluster-api/pkg/apis/cluster/v1alpha1" - controllerError "sigs.k8s.io/cluster-api/pkg/controller/error" - "sigs.k8s.io/cluster-api/pkg/util" "sigs.k8s.io/controller-runtime/pkg/client" "sigs.k8s.io/controller-runtime/pkg/controller" "sigs.k8s.io/controller-runtime/pkg/handler" @@ -71,7 +71,7 @@ type ReconcileCluster struct { actuator Actuator } -// +kubebuilder:rbac:groups=cluster.k8s.io,resources=clusters,verbs=get;list;watch;create;update;patch;delete +// +kubebuilder:rbac:groups=machine.openshift.io,resources=clusters,verbs=get;list;watch;create;update;patch;delete func (r *ReconcileCluster) Reconcile(request reconcile.Request) (reconcile.Result, error) { cluster := &clusterv1alpha1.Cluster{} err := r.Get(context.Background(), request.NamespacedName, cluster) diff --git a/vendor/sigs.k8s.io/cluster-api/pkg/controller/cluster/testactuator.go b/vendor/github.com/openshift/cluster-api/pkg/controller/cluster/testactuator.go similarity index 95% rename from vendor/sigs.k8s.io/cluster-api/pkg/controller/cluster/testactuator.go rename to vendor/github.com/openshift/cluster-api/pkg/controller/cluster/testactuator.go index 5de8a13b9..716521d51 100644 --- a/vendor/sigs.k8s.io/cluster-api/pkg/controller/cluster/testactuator.go +++ b/vendor/github.com/openshift/cluster-api/pkg/controller/cluster/testactuator.go @@ -19,7 +19,7 @@ package cluster import ( "sync" - "sigs.k8s.io/cluster-api/pkg/apis/cluster/v1alpha1" + "github.com/openshift/cluster-api/pkg/apis/cluster/v1alpha1" ) type TestActuator struct { diff --git a/vendor/sigs.k8s.io/cluster-api/pkg/controller/config/BUILD.bazel b/vendor/github.com/openshift/cluster-api/pkg/controller/config/BUILD.bazel similarity index 84% rename from vendor/sigs.k8s.io/cluster-api/pkg/controller/config/BUILD.bazel rename to vendor/github.com/openshift/cluster-api/pkg/controller/config/BUILD.bazel index 67471d9dc..86411f374 100644 --- a/vendor/sigs.k8s.io/cluster-api/pkg/controller/config/BUILD.bazel +++ b/vendor/github.com/openshift/cluster-api/pkg/controller/config/BUILD.bazel @@ -3,7 +3,7 @@ load("@io_bazel_rules_go//go:def.bzl", "go_library") go_library( name = "go_default_library", srcs = ["configuration.go"], - importpath = "sigs.k8s.io/cluster-api/pkg/controller/config", + importpath = "github.com/openshift/cluster-api/pkg/controller/config", visibility = ["//visibility:public"], deps = [ "//vendor/github.com/spf13/pflag:go_default_library", diff --git a/vendor/sigs.k8s.io/cluster-api/pkg/controller/config/configuration.go b/vendor/github.com/openshift/cluster-api/pkg/controller/config/configuration.go similarity index 96% rename from vendor/sigs.k8s.io/cluster-api/pkg/controller/config/configuration.go rename to vendor/github.com/openshift/cluster-api/pkg/controller/config/configuration.go index dc4bef508..6e409320f 100644 --- a/vendor/sigs.k8s.io/cluster-api/pkg/controller/config/configuration.go +++ b/vendor/github.com/openshift/cluster-api/pkg/controller/config/configuration.go @@ -40,7 +40,7 @@ type LeaderElectionConfiguration struct { // by another candidate. This is only applicable if leader election is // enabled. LeaseDuration metav1.Duration - // RenewDeadline is the interval between attempts by the acting master to + // RenewDeadline is the interval between attempts by the acting control plane to // renew a leadership slot before it stops leading. This must be less // than or equal to the lease duration. This is only applicable if leader // election is enabled. @@ -85,7 +85,7 @@ func GetLeaderElectionConfig() *LeaderElectionConfiguration { } func (c *Configuration) AddFlags(fs *pflag.FlagSet) { - fs.StringVar(&c.Kubeconfig, "kubeconfig", c.Kubeconfig, "Path to kubeconfig file with authorization and master location information.") + fs.StringVar(&c.Kubeconfig, "kubeconfig", c.Kubeconfig, "Path to kubeconfig file with authorization and control plane location information.") fs.IntVar(&c.WorkerCount, "workers", c.WorkerCount, "The number of workers for controller.") AddLeaderElectionFlags(c.leaderElectionConfig, fs) @@ -103,7 +103,7 @@ func AddLeaderElectionFlags(l *LeaderElectionConfiguration, fs *pflag.FlagSet) { "before it is replaced by another candidate. This is only applicable if leader "+ "election is enabled.") fs.DurationVar(&l.RenewDeadline.Duration, "leader-elect-renew-deadline", l.RenewDeadline.Duration, ""+ - "The interval between attempts by the acting master to renew a leadership slot "+ + "The interval between attempts by the acting control plane to renew a leadership slot "+ "before it stops leading. This must be less than or equal to the lease duration. "+ "This is only applicable if leader election is enabled.") fs.DurationVar(&l.RetryPeriod.Duration, "leader-elect-retry-period", l.RetryPeriod.Duration, ""+ diff --git a/vendor/sigs.k8s.io/cluster-api/pkg/controller/controller.go b/vendor/github.com/openshift/cluster-api/pkg/controller/controller.go similarity index 100% rename from vendor/sigs.k8s.io/cluster-api/pkg/controller/controller.go rename to vendor/github.com/openshift/cluster-api/pkg/controller/controller.go diff --git a/vendor/sigs.k8s.io/cluster-api/pkg/controller/error/BUILD.bazel b/vendor/github.com/openshift/cluster-api/pkg/controller/error/BUILD.bazel similarity index 70% rename from vendor/sigs.k8s.io/cluster-api/pkg/controller/error/BUILD.bazel rename to vendor/github.com/openshift/cluster-api/pkg/controller/error/BUILD.bazel index db3ab4155..b125943e6 100644 --- a/vendor/sigs.k8s.io/cluster-api/pkg/controller/error/BUILD.bazel +++ b/vendor/github.com/openshift/cluster-api/pkg/controller/error/BUILD.bazel @@ -3,6 +3,6 @@ load("@io_bazel_rules_go//go:def.bzl", "go_library") go_library( name = "go_default_library", srcs = ["requeue_error.go"], - importpath = "sigs.k8s.io/cluster-api/pkg/controller/error", + importpath = "github.com/openshift/cluster-api/pkg/controller/error", visibility = ["//visibility:public"], ) diff --git a/vendor/sigs.k8s.io/cluster-api/pkg/controller/error/requeue_error.go b/vendor/github.com/openshift/cluster-api/pkg/controller/error/requeue_error.go similarity index 100% rename from vendor/sigs.k8s.io/cluster-api/pkg/controller/error/requeue_error.go rename to vendor/github.com/openshift/cluster-api/pkg/controller/error/requeue_error.go diff --git a/vendor/sigs.k8s.io/cluster-api/pkg/controller/machine/BUILD.bazel b/vendor/github.com/openshift/cluster-api/pkg/controller/machine/BUILD.bazel similarity index 84% rename from vendor/sigs.k8s.io/cluster-api/pkg/controller/machine/BUILD.bazel rename to vendor/github.com/openshift/cluster-api/pkg/controller/machine/BUILD.bazel index b63ecbdd5..b9297268f 100644 --- a/vendor/sigs.k8s.io/cluster-api/pkg/controller/machine/BUILD.bazel +++ b/vendor/github.com/openshift/cluster-api/pkg/controller/machine/BUILD.bazel @@ -7,14 +7,15 @@ go_library( "controller.go", "testactuator.go", ], - importpath = "sigs.k8s.io/cluster-api/pkg/controller/machine", + importpath = "github.com/openshift/cluster-api/pkg/controller/machine", visibility = ["//visibility:public"], deps = [ - "//pkg/apis/cluster/v1alpha1:go_default_library", + "//pkg/apis/machine/v1beta1:go_default_library", "//pkg/controller/error:go_default_library", "//pkg/util:go_default_library", "//vendor/k8s.io/api/core/v1:go_default_library", "//vendor/k8s.io/apimachinery/pkg/api/errors:go_default_library", + "//vendor/k8s.io/apimachinery/pkg/apis/meta/v1:go_default_library", "//vendor/k8s.io/apimachinery/pkg/runtime:go_default_library", "//vendor/k8s.io/klog:go_default_library", "//vendor/sigs.k8s.io/controller-runtime/pkg/client:go_default_library", @@ -29,19 +30,21 @@ go_library( go_test( name = "go_default_test", srcs = [ + "controller_test.go", "machine_controller_suite_test.go", "machine_controller_test.go", ], embed = [":go_default_library"], deps = [ "//pkg/apis:go_default_library", - "//pkg/apis/cluster/v1alpha1:go_default_library", + "//pkg/apis/machine/v1beta1:go_default_library", "//vendor/golang.org/x/net/context:go_default_library", "//vendor/k8s.io/apimachinery/pkg/apis/meta/v1:go_default_library", "//vendor/k8s.io/apimachinery/pkg/types:go_default_library", "//vendor/k8s.io/client-go/kubernetes/scheme:go_default_library", "//vendor/k8s.io/client-go/rest:go_default_library", "//vendor/sigs.k8s.io/controller-runtime/pkg/client:go_default_library", + "//vendor/sigs.k8s.io/controller-runtime/pkg/client/fake:go_default_library", "//vendor/sigs.k8s.io/controller-runtime/pkg/envtest:go_default_library", "//vendor/sigs.k8s.io/controller-runtime/pkg/manager:go_default_library", "//vendor/sigs.k8s.io/controller-runtime/pkg/reconcile:go_default_library", diff --git a/vendor/sigs.k8s.io/cluster-api/pkg/controller/machine/actuator.go b/vendor/github.com/openshift/cluster-api/pkg/controller/machine/actuator.go similarity index 76% rename from vendor/sigs.k8s.io/cluster-api/pkg/controller/machine/actuator.go rename to vendor/github.com/openshift/cluster-api/pkg/controller/machine/actuator.go index fb07683b3..6ddd372e6 100644 --- a/vendor/sigs.k8s.io/cluster-api/pkg/controller/machine/actuator.go +++ b/vendor/github.com/openshift/cluster-api/pkg/controller/machine/actuator.go @@ -19,7 +19,7 @@ package machine import ( "context" - clusterv1 "sigs.k8s.io/cluster-api/pkg/apis/cluster/v1alpha1" + machinev1 "github.com/openshift/cluster-api/pkg/apis/machine/v1beta1" ) /// [Actuator] @@ -27,13 +27,13 @@ import ( // methods should be idempotent unless otherwise specified. type Actuator interface { // Create the machine. - Create(context.Context, *clusterv1.Cluster, *clusterv1.Machine) error + Create(context.Context, *machinev1.Cluster, *machinev1.Machine) error // Delete the machine. If no error is returned, it is assumed that all dependent resources have been cleaned up. - Delete(context.Context, *clusterv1.Cluster, *clusterv1.Machine) error + Delete(context.Context, *machinev1.Cluster, *machinev1.Machine) error // Update the machine to the provided definition. - Update(context.Context, *clusterv1.Cluster, *clusterv1.Machine) error + Update(context.Context, *machinev1.Cluster, *machinev1.Machine) error // Checks if the machine currently exists. - Exists(context.Context, *clusterv1.Cluster, *clusterv1.Machine) (bool, error) + Exists(context.Context, *machinev1.Cluster, *machinev1.Machine) (bool, error) } /// [Actuator] diff --git a/vendor/sigs.k8s.io/cluster-api/pkg/controller/machine/controller.go b/vendor/github.com/openshift/cluster-api/pkg/controller/machine/controller.go similarity index 79% rename from vendor/sigs.k8s.io/cluster-api/pkg/controller/machine/controller.go rename to vendor/github.com/openshift/cluster-api/pkg/controller/machine/controller.go index 19f258632..c9d3b9c38 100644 --- a/vendor/sigs.k8s.io/cluster-api/pkg/controller/machine/controller.go +++ b/vendor/github.com/openshift/cluster-api/pkg/controller/machine/controller.go @@ -21,13 +21,14 @@ import ( "errors" "os" + machinev1 "github.com/openshift/cluster-api/pkg/apis/machine/v1beta1" + controllerError "github.com/openshift/cluster-api/pkg/controller/error" + "github.com/openshift/cluster-api/pkg/util" corev1 "k8s.io/api/core/v1" apierrors "k8s.io/apimachinery/pkg/api/errors" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/runtime" "k8s.io/klog" - clusterv1 "sigs.k8s.io/cluster-api/pkg/apis/cluster/v1alpha1" - controllerError "sigs.k8s.io/cluster-api/pkg/controller/error" - "sigs.k8s.io/cluster-api/pkg/util" "sigs.k8s.io/controller-runtime/pkg/client" "sigs.k8s.io/controller-runtime/pkg/controller" "sigs.k8s.io/controller-runtime/pkg/handler" @@ -69,7 +70,7 @@ func add(mgr manager.Manager, r reconcile.Reconciler) error { } // Watch for changes to Machine - err = c.Watch(&source.Kind{Type: &clusterv1.Machine{}}, &handler.EnqueueRequestForObject{}) + err = c.Watch(&source.Kind{Type: &machinev1.Machine{}}, &handler.EnqueueRequestForObject{}) if err != nil { return err } @@ -92,12 +93,12 @@ type ReconcileMachine struct { // Reconcile reads that state of the cluster for a Machine object and makes changes based on the state read // and what is in the Machine.Spec -// +kubebuilder:rbac:groups=cluster.k8s.io,resources=machines,verbs=get;list;watch;create;update;patch;delete +// +kubebuilder:rbac:groups=machine.openshift.io,resources=machines,verbs=get;list;watch;create;update;patch;delete func (r *ReconcileMachine) Reconcile(request reconcile.Request) (reconcile.Result, error) { // TODO(mvladev): Can context be passed from Kubebuilder? ctx := context.TODO() // Fetch the Machine instance - m := &clusterv1.Machine{} + m := &machinev1.Machine{} if err := r.Client.Get(ctx, request.NamespacedName, m); err != nil { if apierrors.IsNotFound(err) { // Object not found, return. Created objects are automatically garbage collected. @@ -112,11 +113,18 @@ func (r *ReconcileMachine) Reconcile(request reconcile.Request) (reconcile.Resul name := m.Name klog.Infof("Running reconcile Machine for %s\n", name) + // Cluster might be nil as some providers might not require a cluster object + // for machine management. + cluster, err := r.getCluster(ctx, m) + if err != nil { + // Just log the error here. + klog.V(4).Infof("Cluster not found, machine actuation might fail: %v", err) + } // If object hasn't been deleted and doesn't have a finalizer, add one // Add a finalizer to newly created objects. if m.ObjectMeta.DeletionTimestamp.IsZero() && - !util.Contains(m.ObjectMeta.Finalizers, clusterv1.MachineFinalizer) { - m.Finalizers = append(m.Finalizers, clusterv1.MachineFinalizer) + !util.Contains(m.ObjectMeta.Finalizers, machinev1.MachineFinalizer) { + m.Finalizers = append(m.Finalizers, machinev1.MachineFinalizer) if err := r.Client.Update(ctx, m); err != nil { klog.Infof("failed to add finalizer to machine object %v due to error %v.", name, err) return reconcile.Result{}, err @@ -128,7 +136,7 @@ func (r *ReconcileMachine) Reconcile(request reconcile.Request) (reconcile.Resul if !m.ObjectMeta.DeletionTimestamp.IsZero() { // no-op if finalizer has been removed. - if !util.Contains(m.ObjectMeta.Finalizers, clusterv1.MachineFinalizer) { + if !util.Contains(m.ObjectMeta.Finalizers, machinev1.MachineFinalizer) { klog.Infof("reconciling machine object %v causes a no-op as there is no finalizer.", name) return reconcile.Result{}, nil } @@ -137,7 +145,7 @@ func (r *ReconcileMachine) Reconcile(request reconcile.Request) (reconcile.Resul return reconcile.Result{}, nil } klog.Infof("reconciling machine object %v triggers delete.", name) - if err := r.delete(ctx, m); err != nil { + if err := r.actuator.Delete(ctx, cluster, m); err != nil { klog.Errorf("Error deleting machine object %v; %v", name, err) if requeueErr, ok := err.(*controllerError.RequeueAfterError); ok { klog.Infof("Actuator returned requeue-after error: %v", requeueErr) @@ -148,7 +156,7 @@ func (r *ReconcileMachine) Reconcile(request reconcile.Request) (reconcile.Resul // Remove finalizer on successful deletion. klog.Infof("machine object %v deletion successful, removing finalizer.", name) - m.ObjectMeta.Finalizers = util.Filter(m.ObjectMeta.Finalizers, clusterv1.MachineFinalizer) + m.ObjectMeta.Finalizers = util.Filter(m.ObjectMeta.Finalizers, machinev1.MachineFinalizer) if err := r.Client.Update(context.Background(), m); err != nil { klog.Errorf("Error removing finalizer from machine object %v; %v", name, err) return reconcile.Result{}, err @@ -156,11 +164,6 @@ func (r *ReconcileMachine) Reconcile(request reconcile.Request) (reconcile.Resul return reconcile.Result{}, nil } - cluster, err := r.getCluster(ctx, m) - if err != nil { - return reconcile.Result{}, err - } - exist, err := r.actuator.Exists(ctx, cluster, m) if err != nil { klog.Errorf("Error checking existence of machine instance for machine object %v; %v", name, err) @@ -168,7 +171,7 @@ func (r *ReconcileMachine) Reconcile(request reconcile.Request) (reconcile.Resul } if exist { klog.Infof("Reconciling machine object %v triggers idempotent update.", name) - if err := r.update(ctx, m); err != nil { + if err := r.actuator.Update(ctx, cluster, m); err != nil { if requeueErr, ok := err.(*controllerError.RequeueAfterError); ok { klog.Infof("Actuator returned requeue-after error: %v", requeueErr) return reconcile.Result{Requeue: true, RequeueAfter: requeueErr.RequeueAfter}, nil @@ -179,7 +182,7 @@ func (r *ReconcileMachine) Reconcile(request reconcile.Request) (reconcile.Resul } // Machine resource created. Machine does not yet exist. klog.Infof("Reconciling machine object %v triggers idempotent create.", m.ObjectMeta.Name) - if err := r.create(ctx, m); err != nil { + if err := r.actuator.Create(ctx, cluster, m); err != nil { klog.Warningf("unable to create machine %v: %v", name, err) if requeueErr, ok := err.(*controllerError.RequeueAfterError); ok { klog.Infof("Actuator returned requeue-after error: %v", requeueErr) @@ -190,38 +193,20 @@ func (r *ReconcileMachine) Reconcile(request reconcile.Request) (reconcile.Resul return reconcile.Result{}, nil } -func (r *ReconcileMachine) create(ctx context.Context, machine *clusterv1.Machine) error { - cluster, err := r.getCluster(ctx, machine) - if err != nil { - return err - } - - return r.actuator.Create(ctx, cluster, machine) -} - -func (r *ReconcileMachine) update(ctx context.Context, new_machine *clusterv1.Machine) error { - cluster, err := r.getCluster(ctx, new_machine) - if err != nil { - return err - } - - // TODO: Assume single master for now. - // TODO: Assume we never change the role for the machines. (Master->Node, Node->Master, etc) - return r.actuator.Update(ctx, cluster, new_machine) -} - -func (r *ReconcileMachine) delete(ctx context.Context, machine *clusterv1.Machine) error { - cluster, err := r.getCluster(ctx, machine) - if err != nil { - return err - } - - return r.actuator.Delete(ctx, cluster, machine) -} - -func (r *ReconcileMachine) getCluster(ctx context.Context, machine *clusterv1.Machine) (*clusterv1.Cluster, error) { - clusterList := clusterv1.ClusterList{} - if err := r.Client.List(ctx, client.InNamespace(machine.Namespace), &clusterList); err != nil { +func (r *ReconcileMachine) getCluster(ctx context.Context, machine *machinev1.Machine) (*machinev1.Cluster, error) { + clusterList := machinev1.ClusterList{} + listOptions := &client.ListOptions{ + Namespace: machine.Namespace, + // This is set so the fake client can be used for unit test. See: + // https://github.com/kubernetes-sigs/controller-runtime/issues/168 + Raw: &metav1.ListOptions{ + TypeMeta: metav1.TypeMeta{ + APIVersion: machinev1.SchemeGroupVersion.String(), + Kind: "Cluster", + }, + }, + } + if err := r.Client.List(ctx, listOptions, &clusterList); err != nil { return nil, err } @@ -235,7 +220,7 @@ func (r *ReconcileMachine) getCluster(ctx context.Context, machine *clusterv1.Ma } } -func (r *ReconcileMachine) isDeleteAllowed(machine *clusterv1.Machine) bool { +func (r *ReconcileMachine) isDeleteAllowed(machine *machinev1.Machine) bool { if r.nodeName == "" || machine.Status.NodeRef == nil { return true } diff --git a/vendor/sigs.k8s.io/cluster-api/pkg/controller/machine/testactuator.go b/vendor/github.com/openshift/cluster-api/pkg/controller/machine/testactuator.go similarity index 77% rename from vendor/sigs.k8s.io/cluster-api/pkg/controller/machine/testactuator.go rename to vendor/github.com/openshift/cluster-api/pkg/controller/machine/testactuator.go index 8b58ab097..819869884 100644 --- a/vendor/sigs.k8s.io/cluster-api/pkg/controller/machine/testactuator.go +++ b/vendor/github.com/openshift/cluster-api/pkg/controller/machine/testactuator.go @@ -20,9 +20,11 @@ import ( "context" "sync" - "sigs.k8s.io/cluster-api/pkg/apis/cluster/v1alpha1" + "github.com/openshift/cluster-api/pkg/apis/machine/v1beta1" ) +var _ Actuator = &TestActuator{} + type TestActuator struct { unblock chan string BlockOnCreate bool @@ -37,7 +39,7 @@ type TestActuator struct { Lock sync.Mutex } -func (a *TestActuator) Create(context.Context, *v1alpha1.Cluster, *v1alpha1.Machine) error { +func (a *TestActuator) Create(context.Context, *v1beta1.Cluster, *v1beta1.Machine) error { defer func() { if a.BlockOnCreate { <-a.unblock @@ -50,7 +52,7 @@ func (a *TestActuator) Create(context.Context, *v1alpha1.Cluster, *v1alpha1.Mach return nil } -func (a *TestActuator) Delete(context.Context, *v1alpha1.Cluster, *v1alpha1.Machine) error { +func (a *TestActuator) Delete(context.Context, *v1beta1.Cluster, *v1beta1.Machine) error { defer func() { if a.BlockOnDelete { <-a.unblock @@ -63,7 +65,7 @@ func (a *TestActuator) Delete(context.Context, *v1alpha1.Cluster, *v1alpha1.Mach return nil } -func (a *TestActuator) Update(ctx context.Context, c *v1alpha1.Cluster, machine *v1alpha1.Machine) error { +func (a *TestActuator) Update(ctx context.Context, c *v1beta1.Cluster, machine *v1beta1.Machine) error { defer func() { if a.BlockOnUpdate { <-a.unblock @@ -75,7 +77,7 @@ func (a *TestActuator) Update(ctx context.Context, c *v1alpha1.Cluster, machine return nil } -func (a *TestActuator) Exists(context.Context, *v1alpha1.Cluster, *v1alpha1.Machine) (bool, error) { +func (a *TestActuator) Exists(context.Context, *v1beta1.Cluster, *v1beta1.Machine) (bool, error) { defer func() { if a.BlockOnExists { <-a.unblock diff --git a/vendor/sigs.k8s.io/cluster-api/pkg/controller/machinedeployment/BUILD.bazel b/vendor/github.com/openshift/cluster-api/pkg/controller/machinedeployment/BUILD.bazel similarity index 79% rename from vendor/sigs.k8s.io/cluster-api/pkg/controller/machinedeployment/BUILD.bazel rename to vendor/github.com/openshift/cluster-api/pkg/controller/machinedeployment/BUILD.bazel index 65ae4d7f8..fa3522eba 100644 --- a/vendor/sigs.k8s.io/cluster-api/pkg/controller/machinedeployment/BUILD.bazel +++ b/vendor/github.com/openshift/cluster-api/pkg/controller/machinedeployment/BUILD.bazel @@ -7,12 +7,13 @@ go_library( "rolling.go", "sync.go", ], - importpath = "sigs.k8s.io/cluster-api/pkg/controller/machinedeployment", + importpath = "github.com/openshift/cluster-api/pkg/controller/machinedeployment", visibility = ["//visibility:public"], deps = [ - "//pkg/apis/cluster/common:go_default_library", - "//pkg/apis/cluster/v1alpha1:go_default_library", + "//pkg/apis/machine/common:go_default_library", + "//pkg/apis/machine/v1beta1:go_default_library", "//pkg/controller/machinedeployment/util:go_default_library", + "//vendor/github.com/pkg/errors:go_default_library", "//vendor/k8s.io/apimachinery/pkg/api/equality:go_default_library", "//vendor/k8s.io/apimachinery/pkg/api/errors:go_default_library", "//vendor/k8s.io/apimachinery/pkg/apis/meta/v1:go_default_library", @@ -35,22 +36,26 @@ go_library( go_test( name = "go_default_test", srcs = [ + "controller_test.go", "machinedeployment_controller_suite_test.go", "machinedeployment_controller_test.go", ], embed = [":go_default_library"], deps = [ "//pkg/apis:go_default_library", - "//pkg/apis/cluster/common:go_default_library", - "//pkg/apis/cluster/v1alpha1:go_default_library", + "//pkg/apis/machine/common:go_default_library", + "//pkg/apis/machine/v1beta1:go_default_library", "//vendor/golang.org/x/net/context:go_default_library", + "//vendor/k8s.io/apimachinery/pkg/api/errors:go_default_library", "//vendor/k8s.io/apimachinery/pkg/apis/meta/v1:go_default_library", "//vendor/k8s.io/apimachinery/pkg/types:go_default_library", "//vendor/k8s.io/apimachinery/pkg/util/intstr:go_default_library", "//vendor/k8s.io/client-go/kubernetes/scheme:go_default_library", "//vendor/k8s.io/client-go/rest:go_default_library", "//vendor/sigs.k8s.io/controller-runtime/pkg/client:go_default_library", + "//vendor/sigs.k8s.io/controller-runtime/pkg/client/fake:go_default_library", "//vendor/sigs.k8s.io/controller-runtime/pkg/envtest:go_default_library", + "//vendor/sigs.k8s.io/controller-runtime/pkg/handler:go_default_library", "//vendor/sigs.k8s.io/controller-runtime/pkg/manager:go_default_library", "//vendor/sigs.k8s.io/controller-runtime/pkg/reconcile:go_default_library", ], diff --git a/vendor/sigs.k8s.io/cluster-api/pkg/controller/machinedeployment/controller.go b/vendor/github.com/openshift/cluster-api/pkg/controller/machinedeployment/controller.go similarity index 84% rename from vendor/sigs.k8s.io/cluster-api/pkg/controller/machinedeployment/controller.go rename to vendor/github.com/openshift/cluster-api/pkg/controller/machinedeployment/controller.go index 6abb0a48a..a963c5710 100644 --- a/vendor/sigs.k8s.io/cluster-api/pkg/controller/machinedeployment/controller.go +++ b/vendor/github.com/openshift/cluster-api/pkg/controller/machinedeployment/controller.go @@ -18,17 +18,17 @@ package machinedeployment import ( "context" - "fmt" "reflect" - "k8s.io/apimachinery/pkg/api/errors" + "github.com/openshift/cluster-api/pkg/apis/machine/common" + "github.com/openshift/cluster-api/pkg/apis/machine/v1beta1" + "github.com/pkg/errors" + apierrors "k8s.io/apimachinery/pkg/api/errors" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/labels" "k8s.io/apimachinery/pkg/runtime" "k8s.io/apimachinery/pkg/types" "k8s.io/klog" - "sigs.k8s.io/cluster-api/pkg/apis/cluster/common" - "sigs.k8s.io/cluster-api/pkg/apis/cluster/v1alpha1" "sigs.k8s.io/controller-runtime/pkg/client" "sigs.k8s.io/controller-runtime/pkg/controller" "sigs.k8s.io/controller-runtime/pkg/handler" @@ -38,7 +38,7 @@ import ( ) // controllerKind contains the schema.GroupVersionKind for this controller type. -var controllerKind = v1alpha1.SchemeGroupVersion.WithKind("MachineDeployment") +var controllerKind = v1beta1.SchemeGroupVersion.WithKind("MachineDeployment") // ReconcileMachineDeployment reconciles a MachineDeployment object type ReconcileMachineDeployment struct { @@ -66,21 +66,21 @@ func add(mgr manager.Manager, r reconcile.Reconciler, mapFn handler.ToRequestsFu } // Watch for changes to MachineDeployment - err = c.Watch(&source.Kind{Type: &v1alpha1.MachineDeployment{}}, &handler.EnqueueRequestForObject{}) + err = c.Watch(&source.Kind{Type: &v1beta1.MachineDeployment{}}, &handler.EnqueueRequestForObject{}) if err != nil { return err } // Watch for changes to MachineSet and reconcile the owner MachineDeployment - err = c.Watch(&source.Kind{Type: &v1alpha1.MachineSet{}}, - &handler.EnqueueRequestForOwner{OwnerType: &v1alpha1.MachineDeployment{}, IsController: true}) + err = c.Watch(&source.Kind{Type: &v1beta1.MachineSet{}}, + &handler.EnqueueRequestForOwner{OwnerType: &v1beta1.MachineDeployment{}, IsController: true}) if err != nil { return err } // Map MachineSet changes to MachineDeployment err = c.Watch( - &source.Kind{Type: &v1alpha1.MachineSet{}}, + &source.Kind{Type: &v1beta1.MachineSet{}}, &handler.EnqueueRequestsFromMapFunc{ToRequests: mapFn}) if err != nil { return err @@ -91,17 +91,17 @@ func add(mgr manager.Manager, r reconcile.Reconciler, mapFn handler.ToRequestsFu var _ reconcile.Reconciler = &ReconcileMachineDeployment{} -func (r *ReconcileMachineDeployment) getMachineSetsForDeployment(d *v1alpha1.MachineDeployment) ([]*v1alpha1.MachineSet, error) { +func (r *ReconcileMachineDeployment) getMachineSetsForDeployment(d *v1beta1.MachineDeployment) ([]*v1beta1.MachineSet, error) { // List all MachineSets to find those we own but that no longer match our // selector. - machineSets := &v1alpha1.MachineSetList{} + machineSets := &v1beta1.MachineSetList{} listOptions := &client.ListOptions{ Namespace: d.Namespace, // This is set so the fake client can be used for unit test. See: // https://github.com/kubernetes-sigs/controller-runtime/issues/168 Raw: &metav1.ListOptions{ TypeMeta: metav1.TypeMeta{ - APIVersion: v1alpha1.SchemeGroupVersion.String(), + APIVersion: v1beta1.SchemeGroupVersion.String(), Kind: "MachineSet", }, }, @@ -112,7 +112,7 @@ func (r *ReconcileMachineDeployment) getMachineSetsForDeployment(d *v1alpha1.Mac // TODO: flush out machine set adoption. - var filteredMS []*v1alpha1.MachineSet + var filteredMS []*v1beta1.MachineSet for idx, _ := range machineSets.Items { ms := &machineSets.Items[idx] if metav1.GetControllerOf(ms) == nil || (metav1.GetControllerOf(ms) != nil && !metav1.IsControlledBy(ms, d)) { @@ -140,13 +140,13 @@ func (r *ReconcileMachineDeployment) getMachineSetsForDeployment(d *v1alpha1.Mac // Reconcile reads that state of the cluster for a MachineDeployment object and makes changes based on the state read // and what is in the MachineDeployment.Spec -// +kubebuilder:rbac:groups=cluster.k8s.io,resources=machinedeployments,verbs=get;list;watch;create;update;patch;delete +// +kubebuilder:rbac:groups=machine.openshift.io,resources=machinedeployments,verbs=get;list;watch;create;update;patch;delete func (r *ReconcileMachineDeployment) Reconcile(request reconcile.Request) (reconcile.Result, error) { // Fetch the MachineDeployment instance - d := &v1alpha1.MachineDeployment{} + d := &v1beta1.MachineDeployment{} err := r.Get(context.TODO(), request.NamespacedName, d) if err != nil { - if errors.IsNotFound(err) { + if apierrors.IsNotFound(err) { // Object not found, return. Created objects are automatically garbage collected. // For additional cleanup logic use finalizers. return reconcile.Result{}, nil @@ -155,7 +155,7 @@ func (r *ReconcileMachineDeployment) Reconcile(request reconcile.Request) (recon return reconcile.Result{}, err } - v1alpha1.PopulateDefaultsMachineDeployment(d) + v1beta1.PopulateDefaultsMachineDeployment(d) everything := metav1.LabelSelector{} if reflect.DeepEqual(d.Spec.Selector, &everything) { @@ -192,25 +192,25 @@ func (r *ReconcileMachineDeployment) Reconcile(request reconcile.Request) (recon return reconcile.Result{}, r.rolloutRolling(d, msList, machineMap) } - return reconcile.Result{}, fmt.Errorf("unexpected deployment strategy type: %s", d.Spec.Strategy.Type) + return reconcile.Result{}, errors.Errorf("unexpected deployment strategy type: %s", d.Spec.Strategy.Type) } // getMachineDeploymentsForMachineSet returns a list of Deployments that potentially // match a MachineSet. -func (r *ReconcileMachineDeployment) getMachineDeploymentsForMachineSet(ms *v1alpha1.MachineSet) []*v1alpha1.MachineDeployment { +func (r *ReconcileMachineDeployment) getMachineDeploymentsForMachineSet(ms *v1beta1.MachineSet) []*v1beta1.MachineDeployment { if len(ms.Labels) == 0 { klog.Warningf("no machine deployments found for MachineSet %v because it has no labels", ms.Name) return nil } - dList := &v1alpha1.MachineDeploymentList{} + dList := &v1beta1.MachineDeploymentList{} listOptions := &client.ListOptions{ Namespace: ms.Namespace, // This is set so the fake client can be used for unit test. See: // https://github.com/kubernetes-sigs/controller-runtime/issues/168 Raw: &metav1.ListOptions{ TypeMeta: metav1.TypeMeta{ - APIVersion: v1alpha1.SchemeGroupVersion.String(), + APIVersion: v1beta1.SchemeGroupVersion.String(), Kind: "MachineDeployment", }, }, @@ -220,7 +220,7 @@ func (r *ReconcileMachineDeployment) getMachineDeploymentsForMachineSet(ms *v1al return nil } - var deployments []*v1alpha1.MachineDeployment + var deployments []*v1beta1.MachineDeployment for idx, d := range dList.Items { selector, err := metav1.LabelSelectorAsSelector(&d.Spec.Selector) if err != nil { @@ -240,7 +240,7 @@ func (r *ReconcileMachineDeployment) getMachineDeploymentsForMachineSet(ms *v1al // // It returns a map from MachineSet UID to a list of Machines controlled by that MS, // according to the Machine's ControllerRef. -func (r *ReconcileMachineDeployment) getMachineMapForDeployment(d *v1alpha1.MachineDeployment, msList []*v1alpha1.MachineSet) (map[types.UID]*v1alpha1.MachineList, error) { +func (r *ReconcileMachineDeployment) getMachineMapForDeployment(d *v1beta1.MachineDeployment, msList []*v1beta1.MachineSet) (map[types.UID]*v1beta1.MachineList, error) { // TODO(droot): double check if previous selector maps correctly to new one. // _, err := metav1.LabelSelectorAsSelector(&d.Spec.Selector) @@ -249,14 +249,14 @@ func (r *ReconcileMachineDeployment) getMachineMapForDeployment(d *v1alpha1.Mach if err != nil { return nil, err } - machines := &v1alpha1.MachineList{} + machines := &v1beta1.MachineList{} listOptions := &client.ListOptions{ Namespace: d.Namespace, // This is set so the fake client can be used for unit test. See: // https://github.com/kubernetes-sigs/controller-runtime/issues/168 Raw: &metav1.ListOptions{ TypeMeta: metav1.TypeMeta{ - APIVersion: v1alpha1.SchemeGroupVersion.String(), + APIVersion: v1beta1.SchemeGroupVersion.String(), Kind: "Machine", }, }, @@ -265,9 +265,9 @@ func (r *ReconcileMachineDeployment) getMachineMapForDeployment(d *v1alpha1.Mach return nil, err } // Group Machines by their controller (if it's in msList). - machineMap := make(map[types.UID]*v1alpha1.MachineList, len(msList)) + machineMap := make(map[types.UID]*v1beta1.MachineList, len(msList)) for _, ms := range msList { - machineMap[ms.UID] = &v1alpha1.MachineList{} + machineMap[ms.UID] = &v1beta1.MachineList{} } for idx := range machines.Items { machine := &machines.Items[idx] @@ -287,7 +287,7 @@ func (r *ReconcileMachineDeployment) getMachineMapForDeployment(d *v1alpha1.Mach func (r *ReconcileMachineDeployment) MachineSetToDeployments(o handler.MapObject) []reconcile.Request { result := []reconcile.Request{} - ms := &v1alpha1.MachineSet{} + ms := &v1beta1.MachineSet{} key := client.ObjectKey{Namespace: o.Meta.GetNamespace(), Name: o.Meta.GetName()} err := r.Client.Get(context.Background(), key, ms) if err != nil { diff --git a/vendor/sigs.k8s.io/cluster-api/pkg/controller/machinedeployment/rolling.go b/vendor/github.com/openshift/cluster-api/pkg/controller/machinedeployment/rolling.go similarity index 82% rename from vendor/sigs.k8s.io/cluster-api/pkg/controller/machinedeployment/rolling.go rename to vendor/github.com/openshift/cluster-api/pkg/controller/machinedeployment/rolling.go index b6786fb10..092a14639 100644 --- a/vendor/sigs.k8s.io/cluster-api/pkg/controller/machinedeployment/rolling.go +++ b/vendor/github.com/openshift/cluster-api/pkg/controller/machinedeployment/rolling.go @@ -17,19 +17,19 @@ limitations under the License. package machinedeployment import ( - "fmt" "sort" + "github.com/pkg/errors" "k8s.io/apimachinery/pkg/types" "k8s.io/client-go/util/integer" "k8s.io/klog" - "sigs.k8s.io/cluster-api/pkg/apis/cluster/v1alpha1" - dutil "sigs.k8s.io/cluster-api/pkg/controller/machinedeployment/util" + "github.com/openshift/cluster-api/pkg/apis/machine/v1beta1" + dutil "github.com/openshift/cluster-api/pkg/controller/machinedeployment/util" ) // rolloutRolling implements the logic for rolling a new machine set. -func (r *ReconcileMachineDeployment) rolloutRolling(d *v1alpha1.MachineDeployment, msList []*v1alpha1.MachineSet, machineMap map[types.UID]*v1alpha1.MachineList) error { +func (r *ReconcileMachineDeployment) rolloutRolling(d *v1beta1.MachineDeployment, msList []*v1beta1.MachineSet, machineMap map[types.UID]*v1beta1.MachineList) error { newMS, oldMSs, err := r.getAllMachineSetsAndSyncRevision(d, msList, machineMap, true) if err != nil { return err @@ -67,12 +67,12 @@ func (r *ReconcileMachineDeployment) rolloutRolling(d *v1alpha1.MachineDeploymen return nil } -func (r *ReconcileMachineDeployment) reconcileNewMachineSet(allMSs []*v1alpha1.MachineSet, newMS *v1alpha1.MachineSet, deployment *v1alpha1.MachineDeployment) error { +func (r *ReconcileMachineDeployment) reconcileNewMachineSet(allMSs []*v1beta1.MachineSet, newMS *v1beta1.MachineSet, deployment *v1beta1.MachineDeployment) error { if deployment.Spec.Replicas == nil { - return fmt.Errorf("spec replicas for deployment set %v is nil, this is unexpected", deployment.Name) + return errors.Errorf("spec replicas for deployment set %v is nil, this is unexpected", deployment.Name) } if newMS.Spec.Replicas == nil { - return fmt.Errorf("spec replicas for machine set %v is nil, this is unexpected", newMS.Name) + return errors.Errorf("spec replicas for machine set %v is nil, this is unexpected", newMS.Name) } if *(newMS.Spec.Replicas) == *(deployment.Spec.Replicas) { @@ -92,12 +92,12 @@ func (r *ReconcileMachineDeployment) reconcileNewMachineSet(allMSs []*v1alpha1.M return err } -func (r *ReconcileMachineDeployment) reconcileOldMachineSets(allMSs []*v1alpha1.MachineSet, oldMSs []*v1alpha1.MachineSet, newMS *v1alpha1.MachineSet, deployment *v1alpha1.MachineDeployment) error { +func (r *ReconcileMachineDeployment) reconcileOldMachineSets(allMSs []*v1beta1.MachineSet, oldMSs []*v1beta1.MachineSet, newMS *v1beta1.MachineSet, deployment *v1beta1.MachineDeployment) error { if deployment.Spec.Replicas == nil { - return fmt.Errorf("spec replicas for deployment set %v is nil, this is unexpected", deployment.Name) + return errors.Errorf("spec replicas for deployment set %v is nil, this is unexpected", deployment.Name) } if newMS.Spec.Replicas == nil { - return fmt.Errorf("spec replicas for machine set %v is nil, this is unexpected", newMS.Name) + return errors.Errorf("spec replicas for machine set %v is nil, this is unexpected", newMS.Name) } oldMachinesCount := dutil.GetReplicaCountForMachineSets(oldMSs) @@ -167,7 +167,7 @@ func (r *ReconcileMachineDeployment) reconcileOldMachineSets(allMSs []*v1alpha1. } // cleanupUnhealthyReplicas will scale down old machine sets with unhealthy replicas, so that all unhealthy replicas will be deleted. -func (r *ReconcileMachineDeployment) cleanupUnhealthyReplicas(oldMSs []*v1alpha1.MachineSet, deployment *v1alpha1.MachineDeployment, maxCleanupCount int32) ([]*v1alpha1.MachineSet, int32, error) { +func (r *ReconcileMachineDeployment) cleanupUnhealthyReplicas(oldMSs []*v1beta1.MachineSet, deployment *v1beta1.MachineDeployment, maxCleanupCount int32) ([]*v1beta1.MachineSet, int32, error) { sort.Sort(dutil.MachineSetsByCreationTimestamp(oldMSs)) // Safely scale down all old machine sets with unhealthy replicas. Replica set will sort the machines in the order // such that not-ready < ready, unscheduled < scheduled, and pending < running. This ensures that unhealthy replicas will @@ -175,7 +175,7 @@ func (r *ReconcileMachineDeployment) cleanupUnhealthyReplicas(oldMSs []*v1alpha1 totalScaledDown := int32(0) for _, targetMS := range oldMSs { if targetMS.Spec.Replicas == nil { - return nil, 0, fmt.Errorf("spec replicas for machine set %v is nil, this is unexpected", targetMS.Name) + return nil, 0, errors.Errorf("spec replicas for machine set %v is nil, this is unexpected", targetMS.Name) } if totalScaledDown >= maxCleanupCount { @@ -199,7 +199,7 @@ func (r *ReconcileMachineDeployment) cleanupUnhealthyReplicas(oldMSs []*v1alpha1 newReplicasCount := oldMSReplicas - scaledDownCount if newReplicasCount > oldMSReplicas { - return nil, 0, fmt.Errorf("when cleaning up unhealthy replicas, got invalid request to scale down %s/%s %d -> %d", targetMS.Namespace, targetMS.Name, oldMSReplicas, newReplicasCount) + return nil, 0, errors.Errorf("when cleaning up unhealthy replicas, got invalid request to scale down %s/%s %d -> %d", targetMS.Namespace, targetMS.Name, oldMSReplicas, newReplicasCount) } _, err := r.scaleMachineSet(targetMS, newReplicasCount, deployment) if err != nil { @@ -212,9 +212,9 @@ func (r *ReconcileMachineDeployment) cleanupUnhealthyReplicas(oldMSs []*v1alpha1 // scaleDownOldMachineSetsForRollingUpdate scales down old machine sets when deployment strategy is "RollingUpdate". // Need check maxUnavailable to ensure availability -func (r *ReconcileMachineDeployment) scaleDownOldMachineSetsForRollingUpdate(allMSs []*v1alpha1.MachineSet, oldMSs []*v1alpha1.MachineSet, deployment *v1alpha1.MachineDeployment) (int32, error) { +func (r *ReconcileMachineDeployment) scaleDownOldMachineSetsForRollingUpdate(allMSs []*v1beta1.MachineSet, oldMSs []*v1beta1.MachineSet, deployment *v1beta1.MachineDeployment) (int32, error) { if deployment.Spec.Replicas == nil { - return 0, fmt.Errorf("spec replicas for deployment %v is nil, this is unexpected", deployment.Name) + return 0, errors.Errorf("spec replicas for deployment %v is nil, this is unexpected", deployment.Name) } maxUnavailable := dutil.MaxUnavailable(*deployment) @@ -235,7 +235,7 @@ func (r *ReconcileMachineDeployment) scaleDownOldMachineSetsForRollingUpdate(all totalScaleDownCount := availableMachineCount - minAvailable for _, targetMS := range oldMSs { if targetMS.Spec.Replicas == nil { - return 0, fmt.Errorf("spec replicas for machine set %v is nil, this is unexpected", targetMS.Name) + return 0, errors.Errorf("spec replicas for machine set %v is nil, this is unexpected", targetMS.Name) } if totalScaledDown >= totalScaleDownCount { @@ -250,7 +250,7 @@ func (r *ReconcileMachineDeployment) scaleDownOldMachineSetsForRollingUpdate(all scaleDownCount := int32(integer.Int32Min(*(targetMS.Spec.Replicas), totalScaleDownCount-totalScaledDown)) newReplicasCount := *(targetMS.Spec.Replicas) - scaleDownCount if newReplicasCount > *(targetMS.Spec.Replicas) { - return totalScaledDown, fmt.Errorf("when scaling down old MS, got invalid request to scale down %s/%s %d -> %d", targetMS.Namespace, targetMS.Name, *(targetMS.Spec.Replicas), newReplicasCount) + return totalScaledDown, errors.Errorf("when scaling down old MS, got invalid request to scale down %s/%s %d -> %d", targetMS.Namespace, targetMS.Name, *(targetMS.Spec.Replicas), newReplicasCount) } _, err := r.scaleMachineSet(targetMS, newReplicasCount, deployment) if err != nil { diff --git a/vendor/sigs.k8s.io/cluster-api/pkg/controller/machinedeployment/sync.go b/vendor/github.com/openshift/cluster-api/pkg/controller/machinedeployment/sync.go similarity index 83% rename from vendor/sigs.k8s.io/cluster-api/pkg/controller/machinedeployment/sync.go rename to vendor/github.com/openshift/cluster-api/pkg/controller/machinedeployment/sync.go index 557e49fdd..f37c053ab 100644 --- a/vendor/sigs.k8s.io/cluster-api/pkg/controller/machinedeployment/sync.go +++ b/vendor/github.com/openshift/cluster-api/pkg/controller/machinedeployment/sync.go @@ -23,22 +23,23 @@ import ( "sort" "strconv" + machinev1beta1 "github.com/openshift/cluster-api/pkg/apis/machine/v1beta1" + "github.com/pkg/errors" "k8s.io/apimachinery/pkg/api/equality" - "k8s.io/apimachinery/pkg/api/errors" + apierrors "k8s.io/apimachinery/pkg/api/errors" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/types" apirand "k8s.io/apimachinery/pkg/util/rand" "k8s.io/client-go/util/retry" "k8s.io/klog" - clusterv1alpha1 "sigs.k8s.io/cluster-api/pkg/apis/cluster/v1alpha1" "sigs.k8s.io/controller-runtime/pkg/client" - dutil "sigs.k8s.io/cluster-api/pkg/controller/machinedeployment/util" + dutil "github.com/openshift/cluster-api/pkg/controller/machinedeployment/util" ) // sync is responsible for reconciling deployments on scaling events or when they // are paused. -func (r *ReconcileMachineDeployment) sync(d *clusterv1alpha1.MachineDeployment, msList []*clusterv1alpha1.MachineSet, machineMap map[types.UID]*clusterv1alpha1.MachineList) error { +func (r *ReconcileMachineDeployment) sync(d *machinev1beta1.MachineDeployment, msList []*machinev1beta1.MachineSet, machineMap map[types.UID]*machinev1beta1.MachineList) error { newMS, oldMSs, err := r.getAllMachineSetsAndSyncRevision(d, msList, machineMap, false) if err != nil { return err @@ -68,7 +69,7 @@ func (r *ReconcileMachineDeployment) sync(d *clusterv1alpha1.MachineDeployment, // // Note that currently the deployment controller is using caches to avoid querying the server for reads. // This may lead to stale reads of machine sets, thus incorrect deployment status. -func (r *ReconcileMachineDeployment) getAllMachineSetsAndSyncRevision(d *clusterv1alpha1.MachineDeployment, msList []*clusterv1alpha1.MachineSet, machineMap map[types.UID]*clusterv1alpha1.MachineList, createIfNotExisted bool) (*clusterv1alpha1.MachineSet, []*clusterv1alpha1.MachineSet, error) { +func (r *ReconcileMachineDeployment) getAllMachineSetsAndSyncRevision(d *machinev1beta1.MachineDeployment, msList []*machinev1beta1.MachineSet, machineMap map[types.UID]*machinev1beta1.MachineList, createIfNotExisted bool) (*machinev1beta1.MachineSet, []*machinev1beta1.MachineSet, error) { _, allOldMSs := dutil.FindOldMachineSets(d, msList) // Get new machine set with the updated revision number @@ -85,7 +86,7 @@ func (r *ReconcileMachineDeployment) getAllMachineSetsAndSyncRevision(d *cluster // 2. If there's existing new MS, update its revision number if it's smaller than (maxOldRevision + 1), where maxOldRevision is the max revision number among all old MSes. // 3. If there's no existing new MS and createIfNotExisted is true, create one with appropriate revision number (maxOldRevision + 1) and replicas. // Note that the machine-template-hash will be added to adopted MSes and machines. -func (r *ReconcileMachineDeployment) getNewMachineSet(d *clusterv1alpha1.MachineDeployment, msList, oldMSs []*clusterv1alpha1.MachineSet, createIfNotExisted bool) (*clusterv1alpha1.MachineSet, error) { +func (r *ReconcileMachineDeployment) getNewMachineSet(d *machinev1beta1.MachineDeployment, msList, oldMSs []*machinev1beta1.MachineSet, createIfNotExisted bool) (*machinev1beta1.MachineSet, error) { existingNewMS := dutil.FindNewMachineSet(d, msList) // Calculate the max revision number among all old MSes @@ -110,7 +111,7 @@ func (r *ReconcileMachineDeployment) getNewMachineSet(d *clusterv1alpha1.Machine } // Apply revision annotation from existingNewMS if it is missing from the deployment. - err := r.updateMachineDeployment(d, func(innerDeployment *clusterv1alpha1.MachineDeployment) { + err := r.updateMachineDeployment(d, func(innerDeployment *machinev1beta1.MachineDeployment) { dutil.SetDeploymentRevision(d, msCopy.Annotations[dutil.RevisionAnnotation]) }) return msCopy, err @@ -133,7 +134,7 @@ func (r *ReconcileMachineDeployment) getNewMachineSet(d *clusterv1alpha1.Machine } // Create new MachineSet - newMS := clusterv1alpha1.MachineSet{ + newMS := machinev1beta1.MachineSet{ ObjectMeta: metav1.ObjectMeta{ // Make the name deterministic, to ensure idempotence Name: d.Name + "-" + apirand.SafeEncodeString(machineTemplateSpecHash), @@ -141,7 +142,7 @@ func (r *ReconcileMachineDeployment) getNewMachineSet(d *clusterv1alpha1.Machine Labels: newMSTemplate.Labels, OwnerReferences: []metav1.OwnerReference{*metav1.NewControllerRef(d, controllerKind)}, }, - Spec: clusterv1alpha1.MachineSetSpec{ + Spec: machinev1beta1.MachineSetSpec{ Replicas: new(int32), MinReadySeconds: minReadySeconds, Selector: *newMSSelector, @@ -165,10 +166,10 @@ func (r *ReconcileMachineDeployment) getNewMachineSet(d *clusterv1alpha1.Machine createdMS := &newMS switch { // We may end up hitting this due to a slow cache or a fast resync of the Deployment. - case errors.IsAlreadyExists(err): + case apierrors.IsAlreadyExists(err): alreadyExists = true - ms := &clusterv1alpha1.MachineSet{} + ms := &machinev1beta1.MachineSet{} msErr := r.Get(context.Background(), client.ObjectKey{Namespace: newMS.Namespace, Name: newMS.Name}, ms) if msErr != nil { return nil, msErr @@ -194,7 +195,7 @@ func (r *ReconcileMachineDeployment) getNewMachineSet(d *clusterv1alpha1.Machine if !alreadyExists { klog.V(4).Infof("Created new machine set %q", createdMS.Name) } - err = r.updateMachineDeployment(d, func(innerDeployment *clusterv1alpha1.MachineDeployment) { + err = r.updateMachineDeployment(d, func(innerDeployment *machinev1beta1.MachineDeployment) { dutil.SetDeploymentRevision(d, newRevision) }) return createdMS, err @@ -205,15 +206,15 @@ func (r *ReconcileMachineDeployment) getNewMachineSet(d *clusterv1alpha1.Machine // 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 (r *ReconcileMachineDeployment) scale(deployment *clusterv1alpha1.MachineDeployment, newMS *clusterv1alpha1.MachineSet, oldMSs []*clusterv1alpha1.MachineSet) error { +func (r *ReconcileMachineDeployment) scale(deployment *machinev1beta1.MachineDeployment, newMS *machinev1beta1.MachineSet, oldMSs []*machinev1beta1.MachineSet) error { if deployment.Spec.Replicas == nil { - return fmt.Errorf("spec replicas for deployment %v is nil, this is unexpected", deployment.Name) + return errors.Errorf("spec replicas for deployment %v is nil, this is unexpected", deployment.Name) } // 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 := dutil.FindOneActiveOrLatest(newMS, oldMSs); activeOrLatest != nil { if activeOrLatest.Spec.Replicas == nil { - return fmt.Errorf("spec replicas for machine set %v is nil, this is unexpected", activeOrLatest.Name) + return errors.Errorf("spec replicas for machine set %v is nil, this is unexpected", activeOrLatest.Name) } if *(activeOrLatest.Spec.Replicas) == *(deployment.Spec.Replicas) { return nil @@ -314,7 +315,7 @@ func (r *ReconcileMachineDeployment) scale(deployment *clusterv1alpha1.MachineDe } // syncDeploymentStatus checks if the status is up-to-date and sync it if necessary -func (r *ReconcileMachineDeployment) syncDeploymentStatus(allMSs []*clusterv1alpha1.MachineSet, newMS *clusterv1alpha1.MachineSet, d *clusterv1alpha1.MachineDeployment) error { +func (r *ReconcileMachineDeployment) syncDeploymentStatus(allMSs []*machinev1beta1.MachineSet, newMS *machinev1beta1.MachineSet, d *machinev1beta1.MachineDeployment) error { newStatus := calculateStatus(allMSs, newMS, d) if reflect.DeepEqual(d.Status, newStatus) { @@ -326,7 +327,7 @@ func (r *ReconcileMachineDeployment) syncDeploymentStatus(allMSs []*clusterv1alp } // calculateStatus calculates the latest status for the provided deployment by looking into the provided machine sets. -func calculateStatus(allMSs []*clusterv1alpha1.MachineSet, newMS *clusterv1alpha1.MachineSet, deployment *clusterv1alpha1.MachineDeployment) clusterv1alpha1.MachineDeploymentStatus { +func calculateStatus(allMSs []*machinev1beta1.MachineSet, newMS *machinev1beta1.MachineSet, deployment *machinev1beta1.MachineDeployment) machinev1beta1.MachineDeploymentStatus { availableReplicas := dutil.GetAvailableReplicaCountForMachineSets(allMSs) totalReplicas := dutil.GetReplicaCountForMachineSets(allMSs) unavailableReplicas := totalReplicas - availableReplicas @@ -336,11 +337,11 @@ func calculateStatus(allMSs []*clusterv1alpha1.MachineSet, newMS *clusterv1alpha unavailableReplicas = 0 } - status := clusterv1alpha1.MachineDeploymentStatus{ + status := machinev1beta1.MachineDeploymentStatus{ // TODO: Ensure that if we start retrying status updates, we won't pick up a new Generation value. ObservedGeneration: deployment.Generation, Replicas: dutil.GetActualReplicaCountForMachineSets(allMSs), - UpdatedReplicas: dutil.GetActualReplicaCountForMachineSets([]*clusterv1alpha1.MachineSet{newMS}), + UpdatedReplicas: dutil.GetActualReplicaCountForMachineSets([]*machinev1beta1.MachineSet{newMS}), ReadyReplicas: dutil.GetReadyReplicaCountForMachineSets(allMSs), AvailableReplicas: availableReplicas, UnavailableReplicas: unavailableReplicas, @@ -349,9 +350,9 @@ func calculateStatus(allMSs []*clusterv1alpha1.MachineSet, newMS *clusterv1alpha return status } -func (r *ReconcileMachineDeployment) scaleMachineSet(ms *clusterv1alpha1.MachineSet, newScale int32, deployment *clusterv1alpha1.MachineDeployment) (bool, error) { +func (r *ReconcileMachineDeployment) scaleMachineSet(ms *machinev1beta1.MachineSet, newScale int32, deployment *machinev1beta1.MachineDeployment) (bool, error) { if ms.Spec.Replicas == nil { - return false, fmt.Errorf("spec replicas for machine set %v is nil, this is unexpected", ms.Name) + return false, errors.Errorf("spec replicas for machine set %v is nil, this is unexpected", ms.Name) } // No need to scale if *(ms.Spec.Replicas) == newScale { @@ -368,9 +369,9 @@ func (r *ReconcileMachineDeployment) scaleMachineSet(ms *clusterv1alpha1.Machine return scaled, err } -func (r *ReconcileMachineDeployment) scaleMachineSetOperation(ms *clusterv1alpha1.MachineSet, newScale int32, deployment *clusterv1alpha1.MachineDeployment, scaleOperation string) (bool, error) { +func (r *ReconcileMachineDeployment) scaleMachineSetOperation(ms *machinev1beta1.MachineSet, newScale int32, deployment *machinev1beta1.MachineDeployment, scaleOperation string) (bool, error) { if ms.Spec.Replicas == nil { - return false, fmt.Errorf("spec replicas for machine set %v is nil, this is unexpected", ms.Name) + return false, errors.Errorf("spec replicas for machine set %v is nil, this is unexpected", ms.Name) } sizeNeedsUpdate := *(ms.Spec.Replicas) != newScale @@ -392,13 +393,13 @@ func (r *ReconcileMachineDeployment) scaleMachineSetOperation(ms *clusterv1alpha // cleanupDeployment is responsible for cleaning up a deployment i.e. 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 (r *ReconcileMachineDeployment) cleanupDeployment(oldMSs []*clusterv1alpha1.MachineSet, deployment *clusterv1alpha1.MachineDeployment) error { +func (r *ReconcileMachineDeployment) cleanupDeployment(oldMSs []*machinev1beta1.MachineSet, deployment *machinev1beta1.MachineDeployment) error { if deployment.Spec.RevisionHistoryLimit == nil { return nil } // Avoid deleting machine set with deletion timestamp set - aliveFilter := func(ms *clusterv1alpha1.MachineSet) bool { + aliveFilter := func(ms *machinev1beta1.MachineSet) bool { return ms != nil && ms.ObjectMeta.DeletionTimestamp == nil } cleanableMSes := dutil.FilterMachineSets(oldMSs, aliveFilter) @@ -414,14 +415,14 @@ func (r *ReconcileMachineDeployment) cleanupDeployment(oldMSs []*clusterv1alpha1 for i := int32(0); i < diff; i++ { ms := cleanableMSes[i] if ms.Spec.Replicas == nil { - return fmt.Errorf("spec replicas for machine set %v is nil, this is unexpected", ms.Name) + return errors.Errorf("spec replicas for machine set %v is nil, this is unexpected", ms.Name) } // Avoid delete machine set with non-zero replica counts if ms.Status.Replicas != 0 || *(ms.Spec.Replicas) != 0 || ms.Generation > ms.Status.ObservedGeneration || ms.DeletionTimestamp != nil { continue } klog.V(4).Infof("Trying to cleanup machine set %q for deployment %q", ms.Name, deployment.Name) - if err := r.Delete(context.Background(), ms); err != nil && !errors.IsNotFound(err) { + if err := r.Delete(context.Background(), ms); err != nil && !apierrors.IsNotFound(err) { // Return error instead of aggregating and continuing DELETEs on the theory // that we may be overloading the api server. return err @@ -436,9 +437,9 @@ func (r *ReconcileMachineDeployment) cleanupDeployment(oldMSs []*clusterv1alpha1 // // msList should come from getMachineSetsForDeployment(d). // machineMap should come from getMachineMapForDeployment(d, msList). -func (r *ReconcileMachineDeployment) isScalingEvent(d *clusterv1alpha1.MachineDeployment, msList []*clusterv1alpha1.MachineSet, machineMap map[types.UID]*clusterv1alpha1.MachineList) (bool, error) { +func (r *ReconcileMachineDeployment) isScalingEvent(d *machinev1beta1.MachineDeployment, msList []*machinev1beta1.MachineSet, machineMap map[types.UID]*machinev1beta1.MachineList) (bool, error) { if d.Spec.Replicas == nil { - return false, fmt.Errorf("spec replicas for deployment %v is nil, this is unexpected", d.Name) + return false, errors.Errorf("spec replicas for deployment %v is nil, this is unexpected", d.Name) } newMS, oldMSs, err := r.getAllMachineSetsAndSyncRevision(d, msList, machineMap, false) if err != nil { @@ -457,12 +458,12 @@ func (r *ReconcileMachineDeployment) isScalingEvent(d *clusterv1alpha1.MachineDe return false, nil } -func (r *ReconcileMachineDeployment) updateMachineDeployment(d *clusterv1alpha1.MachineDeployment, modify func(*clusterv1alpha1.MachineDeployment)) error { +func (r *ReconcileMachineDeployment) updateMachineDeployment(d *machinev1beta1.MachineDeployment, modify func(*machinev1beta1.MachineDeployment)) error { return updateMachineDeployment(r.Client, d, modify) } // We have this as standalone variant to be able to use it from the tests -func updateMachineDeployment(c client.Client, d *clusterv1alpha1.MachineDeployment, modify func(*clusterv1alpha1.MachineDeployment)) error { +func updateMachineDeployment(c client.Client, d *machinev1beta1.MachineDeployment, modify func(*machinev1beta1.MachineDeployment)) error { dCopy := d.DeepCopy() modify(dCopy) if equality.Semantic.DeepEqual(dCopy, d) { @@ -474,7 +475,7 @@ func updateMachineDeployment(c client.Client, d *clusterv1alpha1.MachineDeployme return err } - clusterv1alpha1.PopulateDefaultsMachineDeployment(d) + machinev1beta1.PopulateDefaultsMachineDeployment(d) // Apply modifications modify(d) // Update the machineDeployment diff --git a/vendor/sigs.k8s.io/cluster-api/pkg/controller/machinedeployment/util/BUILD.bazel b/vendor/github.com/openshift/cluster-api/pkg/controller/machinedeployment/util/BUILD.bazel similarity index 79% rename from vendor/sigs.k8s.io/cluster-api/pkg/controller/machinedeployment/util/BUILD.bazel rename to vendor/github.com/openshift/cluster-api/pkg/controller/machinedeployment/util/BUILD.bazel index 97d651bc8..fbe6d9230 100644 --- a/vendor/sigs.k8s.io/cluster-api/pkg/controller/machinedeployment/util/BUILD.bazel +++ b/vendor/github.com/openshift/cluster-api/pkg/controller/machinedeployment/util/BUILD.bazel @@ -3,11 +3,11 @@ load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test") go_library( name = "go_default_library", srcs = ["util.go"], - importpath = "sigs.k8s.io/cluster-api/pkg/controller/machinedeployment/util", + importpath = "github.com/openshift/cluster-api/pkg/controller/machinedeployment/util", visibility = ["//visibility:public"], deps = [ - "//pkg/apis/cluster/common:go_default_library", - "//pkg/apis/cluster/v1alpha1:go_default_library", + "//pkg/apis/machine/common:go_default_library", + "//pkg/apis/machine/v1beta1:go_default_library", "//vendor/github.com/davecgh/go-spew/spew:go_default_library", "//vendor/k8s.io/api/core/v1:go_default_library", "//vendor/k8s.io/apimachinery/pkg/api/equality:go_default_library", @@ -25,9 +25,10 @@ go_test( srcs = ["util_test.go"], embed = [":go_default_library"], deps = [ - "//pkg/apis/cluster/common:go_default_library", - "//pkg/apis/cluster/v1alpha1:go_default_library", + "//pkg/apis/machine/common:go_default_library", + "//pkg/apis/machine/v1beta1:go_default_library", "//pkg/client/clientset_generated/clientset/fake:go_default_library", + "//vendor/github.com/pkg/errors:go_default_library", "//vendor/k8s.io/apimachinery/pkg/apis/meta/v1:go_default_library", "//vendor/k8s.io/apimachinery/pkg/runtime:go_default_library", "//vendor/k8s.io/apimachinery/pkg/types:go_default_library", diff --git a/vendor/sigs.k8s.io/cluster-api/pkg/controller/machinedeployment/util/util.go b/vendor/github.com/openshift/cluster-api/pkg/controller/machinedeployment/util/util.go similarity index 88% rename from vendor/sigs.k8s.io/cluster-api/pkg/controller/machinedeployment/util/util.go rename to vendor/github.com/openshift/cluster-api/pkg/controller/machinedeployment/util/util.go index f95739e0d..2bade09b9 100644 --- a/vendor/sigs.k8s.io/cluster-api/pkg/controller/machinedeployment/util/util.go +++ b/vendor/github.com/openshift/cluster-api/pkg/controller/machinedeployment/util/util.go @@ -25,7 +25,7 @@ import ( "strings" "github.com/davecgh/go-spew/spew" - "k8s.io/api/core/v1" + v1 "k8s.io/api/core/v1" apiequality "k8s.io/apimachinery/pkg/api/equality" "k8s.io/apimachinery/pkg/api/meta" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" @@ -34,8 +34,8 @@ import ( "k8s.io/client-go/util/integer" "k8s.io/klog" - "sigs.k8s.io/cluster-api/pkg/apis/cluster/common" - "sigs.k8s.io/cluster-api/pkg/apis/cluster/v1alpha1" + "github.com/openshift/cluster-api/pkg/apis/machine/common" + "github.com/openshift/cluster-api/pkg/apis/machine/v1beta1" ) const ( @@ -73,7 +73,7 @@ const ( ) // MachineSetsByCreationTimestamp sorts a list of MachineSet by creation timestamp, using their names as a tie breaker. -type MachineSetsByCreationTimestamp []*v1alpha1.MachineSet +type MachineSetsByCreationTimestamp []*v1beta1.MachineSet func (o MachineSetsByCreationTimestamp) Len() int { return len(o) } func (o MachineSetsByCreationTimestamp) Swap(i, j int) { o[i], o[j] = o[j], o[i] } @@ -86,7 +86,7 @@ func (o MachineSetsByCreationTimestamp) Less(i, j int) bool { // 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 +type MachineSetsBySizeOlder []*v1beta1.MachineSet func (o MachineSetsBySizeOlder) Len() int { return len(o) } func (o MachineSetsBySizeOlder) Swap(i, j int) { o[i], o[j] = o[j], o[i] } @@ -99,7 +99,7 @@ func (o MachineSetsBySizeOlder) Less(i, j int) bool { // 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 +type MachineSetsBySizeNewer []*v1beta1.MachineSet func (o MachineSetsBySizeNewer) Len() int { return len(o) } func (o MachineSetsBySizeNewer) Swap(i, j int) { o[i], o[j] = o[j], o[i] } @@ -111,7 +111,7 @@ func (o MachineSetsBySizeNewer) Less(i, j int) bool { } // SetDeploymentRevision updates the revision for a deployment. -func SetDeploymentRevision(deployment *v1alpha1.MachineDeployment, revision string) bool { +func SetDeploymentRevision(deployment *v1beta1.MachineDeployment, revision string) bool { updated := false if deployment.Annotations == nil { @@ -126,7 +126,7 @@ func SetDeploymentRevision(deployment *v1alpha1.MachineDeployment, revision stri } // MaxRevision finds the highest revision in the machine sets -func MaxRevision(allMSs []*v1alpha1.MachineSet) int64 { +func MaxRevision(allMSs []*v1beta1.MachineSet) int64 { max := int64(0) for _, ms := range allMSs { if v, err := Revision(ms); err != nil { @@ -170,7 +170,7 @@ func skipCopyAnnotation(key string) bool { // 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 copyDeploymentAnnotationsToMachineSet(deployment *v1alpha1.MachineDeployment, ms *v1alpha1.MachineSet) bool { +func copyDeploymentAnnotationsToMachineSet(deployment *v1beta1.MachineDeployment, ms *v1beta1.MachineSet) bool { msAnnotationsChanged := false if ms.Annotations == nil { ms.Annotations = make(map[string]string) @@ -189,15 +189,15 @@ func copyDeploymentAnnotationsToMachineSet(deployment *v1alpha1.MachineDeploymen } // GetDesiredReplicasAnnotation returns the number of desired replicas -func GetDesiredReplicasAnnotation(ms *v1alpha1.MachineSet) (int32, bool) { +func GetDesiredReplicasAnnotation(ms *v1beta1.MachineSet) (int32, bool) { return getIntFromAnnotation(ms, DesiredReplicasAnnotation) } -func getMaxReplicasAnnotation(ms *v1alpha1.MachineSet) (int32, bool) { +func getMaxReplicasAnnotation(ms *v1beta1.MachineSet) (int32, bool) { return getIntFromAnnotation(ms, MaxReplicasAnnotation) } -func getIntFromAnnotation(ms *v1alpha1.MachineSet, annotationKey string) (int32, bool) { +func getIntFromAnnotation(ms *v1beta1.MachineSet, annotationKey string) (int32, bool) { annotationValue, ok := ms.Annotations[annotationKey] if !ok { return int32(0), false @@ -212,7 +212,7 @@ func getIntFromAnnotation(ms *v1alpha1.MachineSet, annotationKey string) (int32, // 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, newMS *v1alpha1.MachineSet, newRevision string, exists bool) bool { +func SetNewMachineSetAnnotations(deployment *v1beta1.MachineDeployment, newMS *v1beta1.MachineSet, newRevision string, exists bool) bool { // First, copy deployment's annotations (except for apply and revision annotations) annotationChanged := copyDeploymentAnnotationsToMachineSet(deployment, newMS) // Then, update machine set's revision annotation @@ -266,7 +266,7 @@ func SetNewMachineSetAnnotations(deployment *v1alpha1.MachineDeployment, newMS * // FindOneActiveOrLatest returns the only active or the latest machine set in case there is at most one active // machine set. If there are more than one active machine sets, return nil so machine sets can be scaled down // to the point where there is only one active machine set. -func FindOneActiveOrLatest(newMS *v1alpha1.MachineSet, oldMSs []*v1alpha1.MachineSet) *v1alpha1.MachineSet { +func FindOneActiveOrLatest(newMS *v1beta1.MachineSet, oldMSs []*v1beta1.MachineSet) *v1beta1.MachineSet { if newMS == nil && len(oldMSs) == 0 { return nil } @@ -289,7 +289,7 @@ func FindOneActiveOrLatest(newMS *v1alpha1.MachineSet, oldMSs []*v1alpha1.Machin } // SetReplicasAnnotations sets the desiredReplicas and maxReplicas into the annotations -func SetReplicasAnnotations(ms *v1alpha1.MachineSet, desiredReplicas, maxReplicas int32) bool { +func SetReplicasAnnotations(ms *v1beta1.MachineSet, desiredReplicas, maxReplicas int32) bool { updated := false if ms.Annotations == nil { ms.Annotations = make(map[string]string) @@ -308,7 +308,7 @@ func SetReplicasAnnotations(ms *v1alpha1.MachineSet, desiredReplicas, maxReplica } // AnnotationsNeedUpdate return true if ReplicasAnnotations need to be updated -func ReplicasAnnotationsNeedUpdate(ms *v1alpha1.MachineSet, desiredReplicas, maxReplicas int32) bool { +func ReplicasAnnotationsNeedUpdate(ms *v1beta1.MachineSet, desiredReplicas, maxReplicas int32) bool { if ms.Annotations == nil { return true } @@ -324,7 +324,7 @@ func ReplicasAnnotationsNeedUpdate(ms *v1alpha1.MachineSet, desiredReplicas, max } // MaxUnavailable returns the maximum unavailable machines a rolling deployment can take. -func MaxUnavailable(deployment v1alpha1.MachineDeployment) int32 { +func MaxUnavailable(deployment v1beta1.MachineDeployment) int32 { if !IsRollingUpdate(&deployment) || *(deployment.Spec.Replicas) == 0 { return int32(0) } @@ -337,7 +337,7 @@ func MaxUnavailable(deployment v1alpha1.MachineDeployment) int32 { } // MaxSurge returns the maximum surge machines a rolling deployment can take. -func MaxSurge(deployment v1alpha1.MachineDeployment) int32 { +func MaxSurge(deployment v1beta1.MachineDeployment) int32 { if !IsRollingUpdate(&deployment) { return int32(0) } @@ -349,7 +349,7 @@ func MaxSurge(deployment v1alpha1.MachineDeployment) 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(ms *v1alpha1.MachineSet, d v1alpha1.MachineDeployment, deploymentReplicasToAdd, deploymentReplicasAdded int32) int32 { +func GetProportion(ms *v1beta1.MachineSet, d v1beta1.MachineDeployment, deploymentReplicasToAdd, deploymentReplicasAdded int32) int32 { if ms == nil || *(ms.Spec.Replicas) == 0 || deploymentReplicasToAdd == 0 || deploymentReplicasToAdd == deploymentReplicasAdded { return int32(0) } @@ -371,7 +371,7 @@ func GetProportion(ms *v1alpha1.MachineSet, d v1alpha1.MachineDeployment, deploy // 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 getMachineSetFraction(ms v1alpha1.MachineSet, d v1alpha1.MachineDeployment) int32 { +func getMachineSetFraction(ms v1beta1.MachineSet, d v1beta1.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 -*(ms.Spec.Replicas) @@ -398,7 +398,7 @@ func getMachineSetFraction(ms v1alpha1.MachineSet, d v1alpha1.MachineDeployment) // 1. 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) // 2. The deployment template won't have hash labels -func EqualIgnoreHash(template1, template2 *v1alpha1.MachineTemplateSpec) bool { +func EqualIgnoreHash(template1, template2 *v1beta1.MachineTemplateSpec) bool { t1Copy := template1.DeepCopy() t2Copy := template2.DeepCopy() // Remove hash labels from template.Labels before comparing @@ -408,7 +408,7 @@ func EqualIgnoreHash(template1, template2 *v1alpha1.MachineTemplateSpec) bool { } // FindNewMachineSet returns the new MS this given deployment targets (the one with the same machine template). -func FindNewMachineSet(deployment *v1alpha1.MachineDeployment, msList []*v1alpha1.MachineSet) *v1alpha1.MachineSet { +func FindNewMachineSet(deployment *v1beta1.MachineDeployment, msList []*v1beta1.MachineSet) *v1beta1.MachineSet { sort.Sort(MachineSetsByCreationTimestamp(msList)) for i := range msList { if EqualIgnoreHash(&msList[i].Spec.Template, &deployment.Spec.Template) { @@ -427,9 +427,9 @@ func FindNewMachineSet(deployment *v1alpha1.MachineDeployment, msList []*v1alpha // Returns two list of machine sets // - the first contains all old machine sets with all non-zero replicas // - the second contains all old machine sets -func FindOldMachineSets(deployment *v1alpha1.MachineDeployment, msList []*v1alpha1.MachineSet) ([]*v1alpha1.MachineSet, []*v1alpha1.MachineSet) { - var requiredMSs []*v1alpha1.MachineSet - var allMSs []*v1alpha1.MachineSet +func FindOldMachineSets(deployment *v1beta1.MachineDeployment, msList []*v1beta1.MachineSet) ([]*v1beta1.MachineSet, []*v1beta1.MachineSet) { + var requiredMSs []*v1beta1.MachineSet + var allMSs []*v1beta1.MachineSet newMS := FindNewMachineSet(deployment, msList) for _, ms := range msList { // Filter out new machine set @@ -445,7 +445,7 @@ func FindOldMachineSets(deployment *v1alpha1.MachineDeployment, msList []*v1alph } // GetReplicaCountForMachineSets returns the sum of Replicas of the given machine sets. -func GetReplicaCountForMachineSets(machineSets []*v1alpha1.MachineSet) int32 { +func GetReplicaCountForMachineSets(machineSets []*v1beta1.MachineSet) int32 { totalReplicas := int32(0) for _, ms := range machineSets { if ms != nil { @@ -456,7 +456,7 @@ func GetReplicaCountForMachineSets(machineSets []*v1alpha1.MachineSet) int32 { } // GetActualReplicaCountForMachineSets returns the sum of actual replicas of the given machine sets. -func GetActualReplicaCountForMachineSets(machineSets []*v1alpha1.MachineSet) int32 { +func GetActualReplicaCountForMachineSets(machineSets []*v1beta1.MachineSet) int32 { totalActualReplicas := int32(0) for _, ms := range machineSets { if ms != nil { @@ -467,7 +467,7 @@ func GetActualReplicaCountForMachineSets(machineSets []*v1alpha1.MachineSet) int } // GetReadyReplicaCountForMachineSets returns the number of ready machines corresponding to the given machine sets. -func GetReadyReplicaCountForMachineSets(machineSets []*v1alpha1.MachineSet) int32 { +func GetReadyReplicaCountForMachineSets(machineSets []*v1beta1.MachineSet) int32 { totalReadyReplicas := int32(0) for _, ms := range machineSets { if ms != nil { @@ -478,7 +478,7 @@ func GetReadyReplicaCountForMachineSets(machineSets []*v1alpha1.MachineSet) int3 } // GetAvailableReplicaCountForMachineSets returns the number of available machines corresponding to the given machine sets. -func GetAvailableReplicaCountForMachineSets(machineSets []*v1alpha1.MachineSet) int32 { +func GetAvailableReplicaCountForMachineSets(machineSets []*v1beta1.MachineSet) int32 { totalAvailableReplicas := int32(0) for _, ms := range machineSets { if ms != nil { @@ -489,13 +489,13 @@ func GetAvailableReplicaCountForMachineSets(machineSets []*v1alpha1.MachineSet) } // IsRollingUpdate returns true if the strategy type is a rolling update. -func IsRollingUpdate(deployment *v1alpha1.MachineDeployment) bool { +func IsRollingUpdate(deployment *v1beta1.MachineDeployment) bool { return deployment.Spec.Strategy.Type == common.RollingUpdateMachineDeploymentStrategyType } // DeploymentComplete considers a deployment to be complete once all of its desired replicas // are updated and available, and no old machines are running. -func DeploymentComplete(deployment *v1alpha1.MachineDeployment, newStatus *v1alpha1.MachineDeploymentStatus) bool { +func DeploymentComplete(deployment *v1beta1.MachineDeployment, newStatus *v1beta1.MachineDeploymentStatus) bool { return newStatus.UpdatedReplicas == *(deployment.Spec.Replicas) && newStatus.Replicas == *(deployment.Spec.Replicas) && newStatus.AvailableReplicas == *(deployment.Spec.Replicas) && @@ -506,7 +506,7 @@ func DeploymentComplete(deployment *v1alpha1.MachineDeployment, newStatus *v1alp // When one of the following is true, we're rolling out the deployment; otherwise, we're scaling it. // 1) The new MS is saturated: newMS's replicas == deployment's replicas // 2) Max number of machines allowed is reached: deployment's replicas + maxSurge == all MSs' replicas -func NewMSNewReplicas(deployment *v1alpha1.MachineDeployment, allMSs []*v1alpha1.MachineSet, newMS *v1alpha1.MachineSet) (int32, error) { +func NewMSNewReplicas(deployment *v1beta1.MachineDeployment, allMSs []*v1beta1.MachineSet, newMS *v1beta1.MachineSet) (int32, error) { switch deployment.Spec.Strategy.Type { case common.RollingUpdateMachineDeploymentStrategyType: // Check if we can scale up. @@ -544,7 +544,7 @@ func NewMSNewReplicas(deployment *v1alpha1.MachineDeployment, allMSs []*v1alpha1 // Do not exceed the number of desired replicas. scaleUpCount = int32(integer.Int32Min(scaleUpCount, *(deployment.Spec.Replicas)-*(newMS.Spec.Replicas))) return *(newMS.Spec.Replicas) + scaleUpCount, nil - // -- return 0, fmt.Errorf("deployment type %v isn't supported", deployment.Spec.Strategy.Type) + // -- return 0, errors.Errorf("deployment type %v isn't supported", deployment.Spec.Strategy.Type) } } @@ -552,7 +552,7 @@ func NewMSNewReplicas(deployment *v1alpha1.MachineDeployment, allMSs []*v1alpha1 // 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.MachineDeployment, ms *v1alpha1.MachineSet) bool { +func IsSaturated(deployment *v1beta1.MachineDeployment, ms *v1beta1.MachineSet) bool { if ms == nil { return false } @@ -597,18 +597,18 @@ func ResolveFenceposts(maxSurge, maxUnavailable *intstrutil.IntOrString, desired } // FilterActiveMachineSets returns machine sets that have (or at least ought to have) machines. -func FilterActiveMachineSets(machineSets []*v1alpha1.MachineSet) []*v1alpha1.MachineSet { - activeFilter := func(ms *v1alpha1.MachineSet) bool { +func FilterActiveMachineSets(machineSets []*v1beta1.MachineSet) []*v1beta1.MachineSet { + activeFilter := func(ms *v1beta1.MachineSet) bool { return ms != nil && ms.Spec.Replicas != nil && *(ms.Spec.Replicas) > 0 } return FilterMachineSets(machineSets, activeFilter) } -type filterMS func(ms *v1alpha1.MachineSet) bool +type filterMS func(ms *v1beta1.MachineSet) bool // FilterMachineSets returns machine sets that are filtered by filterFn (all returned ones should match filterFn). -func FilterMachineSets(MSes []*v1alpha1.MachineSet, filterFn filterMS) []*v1alpha1.MachineSet { - var filtered []*v1alpha1.MachineSet +func FilterMachineSets(MSes []*v1beta1.MachineSet, filterFn filterMS) []*v1beta1.MachineSet { + var filtered []*v1beta1.MachineSet for i := range MSes { if filterFn(MSes[i]) { filtered = append(filtered, MSes[i]) @@ -687,7 +687,7 @@ func DeepHashObject(hasher hash.Hash, objectToWrite interface{}) { printer.Fprintf(hasher, "%#v", objectToWrite) } -func ComputeHash(template *v1alpha1.MachineTemplateSpec) uint32 { +func ComputeHash(template *v1beta1.MachineTemplateSpec) uint32 { machineTemplateSpecHasher := fnv.New32a() DeepHashObject(machineTemplateSpecHasher, *template) diff --git a/vendor/sigs.k8s.io/cluster-api/pkg/controller/machineset/BUILD.bazel b/vendor/github.com/openshift/cluster-api/pkg/controller/machineset/BUILD.bazel similarity index 82% rename from vendor/sigs.k8s.io/cluster-api/pkg/controller/machineset/BUILD.bazel rename to vendor/github.com/openshift/cluster-api/pkg/controller/machineset/BUILD.bazel index 8aec373aa..94eb791b9 100644 --- a/vendor/sigs.k8s.io/cluster-api/pkg/controller/machineset/BUILD.bazel +++ b/vendor/github.com/openshift/cluster-api/pkg/controller/machineset/BUILD.bazel @@ -8,12 +8,13 @@ go_library( "machine.go", "status.go", ], - importpath = "sigs.k8s.io/cluster-api/pkg/controller/machineset", + importpath = "github.com/openshift/cluster-api/pkg/controller/machineset", visibility = ["//visibility:public"], deps = [ - "//pkg/apis/cluster/v1alpha1:go_default_library", + "//pkg/apis/machine/v1beta1:go_default_library", "//pkg/controller/noderefutil:go_default_library", "//pkg/util:go_default_library", + "//vendor/github.com/pkg/errors:go_default_library", "//vendor/k8s.io/api/core/v1:go_default_library", "//vendor/k8s.io/apimachinery/pkg/api/errors:go_default_library", "//vendor/k8s.io/apimachinery/pkg/apis/meta/v1:go_default_library", @@ -32,21 +33,25 @@ go_library( go_test( name = "go_default_test", srcs = [ + "controller_test.go", "delete_policy_test.go", + "machine_test.go", "machineset_controller_suite_test.go", "machineset_controller_test.go", ], embed = [":go_default_library"], deps = [ "//pkg/apis:go_default_library", - "//pkg/apis/cluster/v1alpha1:go_default_library", + "//pkg/apis/machine/v1beta1:go_default_library", "//vendor/golang.org/x/net/context:go_default_library", "//vendor/k8s.io/apimachinery/pkg/apis/meta/v1:go_default_library", "//vendor/k8s.io/apimachinery/pkg/types:go_default_library", "//vendor/k8s.io/client-go/kubernetes/scheme:go_default_library", "//vendor/k8s.io/client-go/rest:go_default_library", "//vendor/sigs.k8s.io/controller-runtime/pkg/client:go_default_library", + "//vendor/sigs.k8s.io/controller-runtime/pkg/client/fake:go_default_library", "//vendor/sigs.k8s.io/controller-runtime/pkg/envtest:go_default_library", + "//vendor/sigs.k8s.io/controller-runtime/pkg/handler:go_default_library", "//vendor/sigs.k8s.io/controller-runtime/pkg/manager:go_default_library", "//vendor/sigs.k8s.io/controller-runtime/pkg/reconcile:go_default_library", ], diff --git a/vendor/sigs.k8s.io/cluster-api/pkg/controller/machineset/controller.go b/vendor/github.com/openshift/cluster-api/pkg/controller/machineset/controller.go similarity index 80% rename from vendor/sigs.k8s.io/cluster-api/pkg/controller/machineset/controller.go rename to vendor/github.com/openshift/cluster-api/pkg/controller/machineset/controller.go index 949647598..550655d89 100644 --- a/vendor/sigs.k8s.io/cluster-api/pkg/controller/machineset/controller.go +++ b/vendor/github.com/openshift/cluster-api/pkg/controller/machineset/controller.go @@ -24,12 +24,13 @@ import ( "sync" "time" - "k8s.io/apimachinery/pkg/api/errors" + machinev1beta1 "github.com/openshift/cluster-api/pkg/apis/machine/v1beta1" + "github.com/openshift/cluster-api/pkg/util" + "github.com/pkg/errors" + apierrors "k8s.io/apimachinery/pkg/api/errors" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/runtime" "k8s.io/klog" - clusterv1alpha1 "sigs.k8s.io/cluster-api/pkg/apis/cluster/v1alpha1" - "sigs.k8s.io/cluster-api/pkg/util" "sigs.k8s.io/controller-runtime/pkg/client" "sigs.k8s.io/controller-runtime/pkg/controller" "sigs.k8s.io/controller-runtime/pkg/handler" @@ -38,7 +39,7 @@ import ( "sigs.k8s.io/controller-runtime/pkg/source" ) -var controllerKind = clusterv1alpha1.SchemeGroupVersion.WithKind("MachineSet") +var controllerKind = machinev1beta1.SchemeGroupVersion.WithKind("MachineSet") // stateConfirmationTimeout is the amount of time allowed to wait for desired state. var stateConfirmationTimeout = 10 * time.Second @@ -68,15 +69,15 @@ func add(mgr manager.Manager, r reconcile.Reconciler, mapFn handler.ToRequestsFu } // Watch for changes to MachineSet - err = c.Watch(&source.Kind{Type: &clusterv1alpha1.MachineSet{}}, &handler.EnqueueRequestForObject{}) + err = c.Watch(&source.Kind{Type: &machinev1beta1.MachineSet{}}, &handler.EnqueueRequestForObject{}) if err != nil { return err } // Map Machine changes to MachineSets using ControllerRef err = c.Watch( - &source.Kind{Type: &clusterv1alpha1.Machine{}}, - &handler.EnqueueRequestForOwner{IsController: true, OwnerType: &clusterv1alpha1.MachineSet{}}, + &source.Kind{Type: &machinev1beta1.Machine{}}, + &handler.EnqueueRequestForOwner{IsController: true, OwnerType: &machinev1beta1.MachineSet{}}, ) if err != nil { return err @@ -84,7 +85,7 @@ func add(mgr manager.Manager, r reconcile.Reconciler, mapFn handler.ToRequestsFu // Map Machine changes to MachineSets by machining labels err = c.Watch( - &source.Kind{Type: &clusterv1alpha1.Machine{}}, + &source.Kind{Type: &machinev1beta1.Machine{}}, &handler.EnqueueRequestsFromMapFunc{ToRequests: mapFn}) if err != nil { return err @@ -103,7 +104,7 @@ type ReconcileMachineSet struct { func (r *ReconcileMachineSet) MachineToMachineSets(o handler.MapObject) []reconcile.Request { result := []reconcile.Request{} - m := &clusterv1alpha1.Machine{} + m := &machinev1beta1.Machine{} key := client.ObjectKey{Namespace: o.Meta.GetNamespace(), Name: o.Meta.GetName()} err := r.Client.Get(context.Background(), key, m) if err != nil { @@ -134,14 +135,14 @@ func (r *ReconcileMachineSet) MachineToMachineSets(o handler.MapObject) []reconc // Reconcile reads that state of the cluster for a MachineSet object and makes changes based on the state read // and what is in the MachineSet.Spec // Automatically generate RBAC rules to allow the Controller to read and write Deployments -// +kubebuilder:rbac:groups=cluster.k8s.io,resources=machinesets,verbs=get;list;watch;create;update;patch;delete -// +kubebuilder:rbac:groups=cluster.k8s.io,resources=machines,verbs=get;list;watch;create;update;patch;delete +// +kubebuilder:rbac:groups=machine.openshift.io,resources=machinesets,verbs=get;list;watch;create;update;patch;delete +// +kubebuilder:rbac:groups=machine.openshift.io,resources=machines,verbs=get;list;watch;create;update;patch;delete func (r *ReconcileMachineSet) Reconcile(request reconcile.Request) (reconcile.Result, error) { // Fetch the MachineSet instance - machineSet := &clusterv1alpha1.MachineSet{} + machineSet := &machinev1beta1.MachineSet{} err := r.Get(context.TODO(), request.NamespacedName, machineSet) if err != nil { - if errors.IsNotFound(err) { + if apierrors.IsNotFound(err) { // Object not found, return. Created objects are automatically garbage collected. // For additional cleanup logic use finalizers. return reconcile.Result{}, nil @@ -151,23 +152,22 @@ func (r *ReconcileMachineSet) Reconcile(request reconcile.Request) (reconcile.Re } klog.V(4).Infof("Reconcile machineset %v", machineSet.Name) - if errList := machineSet.Validate(); len(errList) > 0 { err := fmt.Errorf("%q machineset validation failed: %v", machineSet.Name, errList.ToAggregate().Error()) klog.Error(err) return reconcile.Result{}, err } - allMachines := &clusterv1alpha1.MachineList{} + allMachines := &machinev1beta1.MachineList{} err = r.Client.List(context.Background(), client.InNamespace(machineSet.Namespace), allMachines) if err != nil { - return reconcile.Result{}, fmt.Errorf("failed to list machines, %v", err) + return reconcile.Result{}, errors.Wrap(err, "failed to list machines") } // Filter out irrelevant machines (deleting/mismatch labels) and claim orphaned machines. var machineNames []string - machineSetMachines := make(map[string]*clusterv1alpha1.Machine) + machineSetMachines := make(map[string]*machinev1beta1.Machine) for idx := range allMachines.Items { machine := &allMachines.Items[idx] if shouldExcludeMachine(machineSet, machine) { @@ -183,11 +183,10 @@ func (r *ReconcileMachineSet) Reconcile(request reconcile.Request) (reconcile.Re machineNames = append(machineNames, machine.Name) machineSetMachines[machine.Name] = machine } - // sort the filteredMachines from the oldest to the youngest sort.Strings(machineNames) - var filteredMachines []*clusterv1alpha1.Machine + var filteredMachines []*machinev1beta1.Machine for _, machineName := range machineNames { filteredMachines = append(filteredMachines, machineSetMachines[machineName]) } @@ -201,9 +200,9 @@ func (r *ReconcileMachineSet) Reconcile(request reconcile.Request) (reconcile.Re updatedMS, err := updateMachineSetStatus(r.Client, machineSet, newStatus) if err != nil { if syncErr != nil { - return reconcile.Result{}, fmt.Errorf("failed to sync machines. %v. failed to update machine set status. %v", syncErr, err) + return reconcile.Result{}, errors.Wrapf(err, "failed to sync machines: %v. failed to update machine set status", syncErr) } - return reconcile.Result{}, fmt.Errorf("failed to update machine set status. %v", err) + return reconcile.Result{}, errors.Wrap(err, "failed to update machine set status") } var replicas int32 @@ -229,9 +228,9 @@ func (r *ReconcileMachineSet) Reconcile(request reconcile.Request) (reconcile.Re } // syncReplicas essentially scales machine resources up and down. -func (c *ReconcileMachineSet) syncReplicas(ms *clusterv1alpha1.MachineSet, machines []*clusterv1alpha1.Machine) error { +func (c *ReconcileMachineSet) syncReplicas(ms *machinev1beta1.MachineSet, machines []*machinev1beta1.Machine) error { if ms.Spec.Replicas == nil { - return fmt.Errorf("the Replicas field in Spec for machineset %v is nil, this should not be allowed.", ms.Name) + return errors.Errorf("the Replicas field in Spec for machineset %v is nil, this should not be allowed", ms.Name) } diff := len(machines) - int(*(ms.Spec.Replicas)) @@ -239,7 +238,7 @@ func (c *ReconcileMachineSet) syncReplicas(ms *clusterv1alpha1.MachineSet, machi diff *= -1 klog.Infof("Too few replicas for %v %s/%s, need %d, creating %d", controllerKind, ms.Namespace, ms.Name, *(ms.Spec.Replicas), diff) - var machineList []*clusterv1alpha1.Machine + var machineList []*machinev1beta1.Machine var errstrings []string for i := 0; i < diff; i++ { klog.Infof("creating machine %d of %d, ( spec.replicas(%d) > currentMachineCount(%d) )", i+1, diff, *(ms.Spec.Replicas), len(machines)) @@ -254,7 +253,7 @@ func (c *ReconcileMachineSet) syncReplicas(ms *clusterv1alpha1.MachineSet, machi } if len(errstrings) > 0 { - return fmt.Errorf(strings.Join(errstrings, "; ")) + return errors.New(strings.Join(errstrings, "; ")) } return c.waitForMachineCreation(machineList) } else if diff > 0 { @@ -268,7 +267,7 @@ func (c *ReconcileMachineSet) syncReplicas(ms *clusterv1alpha1.MachineSet, machi var wg sync.WaitGroup wg.Add(diff) for _, machine := range machinesToDelete { - go func(targetMachine *clusterv1alpha1.Machine) { + go func(targetMachine *machinev1beta1.Machine) { defer wg.Done() err := c.Client.Delete(context.Background(), targetMachine) if err != nil { @@ -295,9 +294,9 @@ func (c *ReconcileMachineSet) syncReplicas(ms *clusterv1alpha1.MachineSet, machi // createMachine creates a machine resource. // the name of the newly created resource is going to be created by the API server, we set the generateName field -func (c *ReconcileMachineSet) createMachine(machineSet *clusterv1alpha1.MachineSet) *clusterv1alpha1.Machine { - gv := clusterv1alpha1.SchemeGroupVersion - machine := &clusterv1alpha1.Machine{ +func (c *ReconcileMachineSet) createMachine(machineSet *machinev1beta1.MachineSet) *machinev1beta1.Machine { + gv := machinev1beta1.SchemeGroupVersion + machine := &machinev1beta1.Machine{ TypeMeta: metav1.TypeMeta{ Kind: gv.WithKind("Machine").Kind, APIVersion: gv.String(), @@ -313,7 +312,7 @@ func (c *ReconcileMachineSet) createMachine(machineSet *clusterv1alpha1.MachineS } // shouldExcludeMachine returns true if the machine should be filtered out, false otherwise. -func shouldExcludeMachine(machineSet *clusterv1alpha1.MachineSet, machine *clusterv1alpha1.Machine) bool { +func shouldExcludeMachine(machineSet *machinev1beta1.MachineSet, machine *machinev1beta1.Machine) bool { // Ignore inactive machines. if metav1.GetControllerOf(machine) != nil && !metav1.IsControlledBy(machine, machineSet) { klog.V(4).Infof("%s not controlled by %v", machine.Name, machineSet.Name) @@ -328,7 +327,7 @@ func shouldExcludeMachine(machineSet *clusterv1alpha1.MachineSet, machine *clust return false } -func (c *ReconcileMachineSet) adoptOrphan(machineSet *clusterv1alpha1.MachineSet, machine *clusterv1alpha1.Machine) error { +func (c *ReconcileMachineSet) adoptOrphan(machineSet *machinev1beta1.MachineSet, machine *machinev1beta1.Machine) error { // Add controller reference. ownerRefs := machine.ObjectMeta.GetOwnerReferences() if ownerRefs == nil { @@ -345,44 +344,44 @@ func (c *ReconcileMachineSet) adoptOrphan(machineSet *clusterv1alpha1.MachineSet return nil } -func (c *ReconcileMachineSet) waitForMachineCreation(machineList []*clusterv1alpha1.Machine) error { +func (c *ReconcileMachineSet) waitForMachineCreation(machineList []*machinev1beta1.Machine) error { for _, machine := range machineList { - pollErr := util.Poll(stateConfirmationInterval, stateConfirmationTimeout, func() (bool, error) { + pollErr := util.PollImmediate(stateConfirmationInterval, stateConfirmationTimeout, func() (bool, error) { err := c.Client.Get(context.Background(), client.ObjectKey{Namespace: machine.Namespace, Name: machine.Name}, - &clusterv1alpha1.Machine{}) + &machinev1beta1.Machine{}) if err == nil { return true, nil } klog.Error(err) - if errors.IsNotFound(err) { + if apierrors.IsNotFound(err) { return false, nil } return false, err }) if pollErr != nil { klog.Error(pollErr) - return fmt.Errorf("failed waiting for machine object to be created. %v", pollErr) + return errors.Wrap(pollErr, "failed waiting for machine object to be created") } } return nil } -func (c *ReconcileMachineSet) waitForMachineDeletion(machineList []*clusterv1alpha1.Machine) error { +func (c *ReconcileMachineSet) waitForMachineDeletion(machineList []*machinev1beta1.Machine) error { for _, machine := range machineList { - pollErr := util.Poll(stateConfirmationInterval, stateConfirmationTimeout, func() (bool, error) { - m := &clusterv1alpha1.Machine{} + pollErr := util.PollImmediate(stateConfirmationInterval, stateConfirmationTimeout, func() (bool, error) { + m := &machinev1beta1.Machine{} err := c.Client.Get(context.Background(), client.ObjectKey{Namespace: machine.Namespace, Name: machine.Name}, m) - if errors.IsNotFound(err) || !m.DeletionTimestamp.IsZero() { + if apierrors.IsNotFound(err) || !m.DeletionTimestamp.IsZero() { return true, nil } return false, err }) if pollErr != nil { klog.Error(pollErr) - return fmt.Errorf("failed waiting for machine object to be deleted. %v", pollErr) + return errors.Wrap(pollErr, "failed waiting for machine object to be deleted") } } return nil diff --git a/vendor/sigs.k8s.io/cluster-api/pkg/controller/machineset/delete_policy.go b/vendor/github.com/openshift/cluster-api/pkg/controller/machineset/delete_policy.go similarity index 76% rename from vendor/sigs.k8s.io/cluster-api/pkg/controller/machineset/delete_policy.go rename to vendor/github.com/openshift/cluster-api/pkg/controller/machineset/delete_policy.go index 9f5e519b9..f73e9ca08 100644 --- a/vendor/sigs.k8s.io/cluster-api/pkg/controller/machineset/delete_policy.go +++ b/vendor/github.com/openshift/cluster-api/pkg/controller/machineset/delete_policy.go @@ -17,7 +17,7 @@ limitations under the License. package machineset import ( - "sigs.k8s.io/cluster-api/pkg/apis/cluster/v1alpha1" + "github.com/openshift/cluster-api/pkg/apis/machine/v1beta1" ) type deletePriority int @@ -29,18 +29,19 @@ const ( mustNotDelete deletePriority = 0 ) -type deletePriorityFunc func(machine *v1alpha1.Machine) deletePriority +type deletePriorityFunc func(machine *v1beta1.Machine) deletePriority // machineDeleteAnnotationKey annotates machines to be delete among first ones -var machineDeleteAnnotationKey = "sigs.k8s.io/cluster-api-delete-machine" +var machineDeleteAnnotationKey = "machine.openshift.io/cluster-api-delete-machine" -func simpleDeletePriority(machine *v1alpha1.Machine) deletePriority { +func simpleDeletePriority(machine *v1beta1.Machine) deletePriority { if machine.DeletionTimestamp != nil && !machine.DeletionTimestamp.IsZero() { return mustDelete } if _, exists := machine.Annotations[machineDeleteAnnotationKey]; exists { return mustDelete } + if machine.Status.ErrorReason != nil || machine.Status.ErrorMessage != nil { return betterDelete } @@ -49,21 +50,21 @@ func simpleDeletePriority(machine *v1alpha1.Machine) deletePriority { // TODO: Define machines deletion policies. // see: https://github.com/kubernetes/kube-deploy/issues/625 -func getMachinesToDeletePrioritized(filteredMachines []*v1alpha1.Machine, diff int, fun deletePriorityFunc) []*v1alpha1.Machine { +func getMachinesToDeletePrioritized(filteredMachines []*v1beta1.Machine, diff int, fun deletePriorityFunc) []*v1beta1.Machine { if diff >= len(filteredMachines) { return filteredMachines } else if diff <= 0 { - return []*v1alpha1.Machine{} + return []*v1beta1.Machine{} } - machines := make(map[deletePriority][]*v1alpha1.Machine) + machines := make(map[deletePriority][]*v1beta1.Machine) for _, machine := range filteredMachines { priority := fun(machine) machines[priority] = append(machines[priority], machine) } - result := []*v1alpha1.Machine{} + result := []*v1beta1.Machine{} for _, priority := range []deletePriority{ mustDelete, betterDelete, diff --git a/vendor/sigs.k8s.io/cluster-api/pkg/controller/machineset/machine.go b/vendor/github.com/openshift/cluster-api/pkg/controller/machineset/machine.go similarity index 84% rename from vendor/sigs.k8s.io/cluster-api/pkg/controller/machineset/machine.go rename to vendor/github.com/openshift/cluster-api/pkg/controller/machineset/machine.go index f6b6c0e6d..8628700cf 100644 --- a/vendor/sigs.k8s.io/cluster-api/pkg/controller/machineset/machine.go +++ b/vendor/github.com/openshift/cluster-api/pkg/controller/machineset/machine.go @@ -18,27 +18,28 @@ package machineset import ( "context" + + "github.com/openshift/cluster-api/pkg/apis/machine/v1beta1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/labels" "k8s.io/klog" - "sigs.k8s.io/cluster-api/pkg/apis/cluster/v1alpha1" "sigs.k8s.io/controller-runtime/pkg/client" ) -func (c *ReconcileMachineSet) getMachineSetsForMachine(m *v1alpha1.Machine) []*v1alpha1.MachineSet { +func (c *ReconcileMachineSet) getMachineSetsForMachine(m *v1beta1.Machine) []*v1beta1.MachineSet { if len(m.Labels) == 0 { klog.Warningf("No machine sets found for Machine %v because it has no labels", m.Name) return nil } - msList := &v1alpha1.MachineSetList{} + msList := &v1beta1.MachineSetList{} listOptions := &client.ListOptions{ Namespace: m.Namespace, // This is set so the fake client can be used for unit test. See: // https://github.com/kubernetes-sigs/controller-runtime/issues/168 Raw: &metav1.ListOptions{ TypeMeta: metav1.TypeMeta{ - APIVersion: v1alpha1.SchemeGroupVersion.String(), + APIVersion: v1beta1.SchemeGroupVersion.String(), Kind: "MachineSet", }, }, @@ -50,7 +51,7 @@ func (c *ReconcileMachineSet) getMachineSetsForMachine(m *v1alpha1.Machine) []*v return nil } - var mss []*v1alpha1.MachineSet + var mss []*v1beta1.MachineSet for idx := range msList.Items { ms := &msList.Items[idx] if hasMatchingLabels(ms, m) { @@ -61,7 +62,7 @@ func (c *ReconcileMachineSet) getMachineSetsForMachine(m *v1alpha1.Machine) []*v return mss } -func hasMatchingLabels(machineSet *v1alpha1.MachineSet, machine *v1alpha1.Machine) bool { +func hasMatchingLabels(machineSet *v1beta1.MachineSet, machine *v1beta1.Machine) bool { selector, err := metav1.LabelSelectorAsSelector(&machineSet.Spec.Selector) if err != nil { klog.Warningf("unable to convert selector: %v", err) diff --git a/vendor/sigs.k8s.io/cluster-api/pkg/controller/machineset/status.go b/vendor/github.com/openshift/cluster-api/pkg/controller/machineset/status.go similarity index 89% rename from vendor/sigs.k8s.io/cluster-api/pkg/controller/machineset/status.go rename to vendor/github.com/openshift/cluster-api/pkg/controller/machineset/status.go index fed150a29..51e3758fe 100644 --- a/vendor/sigs.k8s.io/cluster-api/pkg/controller/machineset/status.go +++ b/vendor/github.com/openshift/cluster-api/pkg/controller/machineset/status.go @@ -17,17 +17,16 @@ limitations under the License. package machineset import ( + "context" "fmt" + "github.com/openshift/cluster-api/pkg/apis/machine/v1beta1" + "github.com/openshift/cluster-api/pkg/controller/noderefutil" + "github.com/pkg/errors" corev1 "k8s.io/api/core/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/labels" "k8s.io/klog" - - "context" - - "sigs.k8s.io/cluster-api/pkg/apis/cluster/v1alpha1" - "sigs.k8s.io/cluster-api/pkg/controller/noderefutil" "sigs.k8s.io/controller-runtime/pkg/client" ) @@ -36,7 +35,7 @@ const ( statusUpdateRetries = 1 ) -func (c *ReconcileMachineSet) calculateStatus(ms *v1alpha1.MachineSet, filteredMachines []*v1alpha1.Machine) v1alpha1.MachineSetStatus { +func (c *ReconcileMachineSet) calculateStatus(ms *v1beta1.MachineSet, filteredMachines []*v1beta1.Machine) v1beta1.MachineSetStatus { newStatus := ms.Status // Count the number of machines that have labels matching the labels of the machine // template of the replica set, the matching machines may have more @@ -72,7 +71,7 @@ func (c *ReconcileMachineSet) calculateStatus(ms *v1alpha1.MachineSet, filteredM } // updateMachineSetStatus attempts to update the Status.Replicas of the given MachineSet, with a single GET/PUT retry. -func updateMachineSetStatus(c client.Client, ms *v1alpha1.MachineSet, newStatus v1alpha1.MachineSetStatus) (*v1alpha1.MachineSet, error) { +func updateMachineSetStatus(c client.Client, ms *v1beta1.MachineSet, newStatus v1beta1.MachineSetStatus) (*v1beta1.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. @@ -123,10 +122,10 @@ func updateMachineSetStatus(c client.Client, ms *v1alpha1.MachineSet, newStatus return nil, updateErr } -func (c *ReconcileMachineSet) getMachineNode(machine *v1alpha1.Machine) (*corev1.Node, error) { +func (c *ReconcileMachineSet) getMachineNode(machine *v1beta1.Machine) (*corev1.Node, error) { nodeRef := machine.Status.NodeRef if nodeRef == nil { - return nil, fmt.Errorf("machine has no node ref") + return nil, errors.New("machine has no node ref") } node := &corev1.Node{} diff --git a/vendor/sigs.k8s.io/cluster-api/pkg/controller/node/BUILD.bazel b/vendor/github.com/openshift/cluster-api/pkg/controller/node/BUILD.bazel similarity index 94% rename from vendor/sigs.k8s.io/cluster-api/pkg/controller/node/BUILD.bazel rename to vendor/github.com/openshift/cluster-api/pkg/controller/node/BUILD.bazel index 0af213d29..52fa66267 100644 --- a/vendor/sigs.k8s.io/cluster-api/pkg/controller/node/BUILD.bazel +++ b/vendor/github.com/openshift/cluster-api/pkg/controller/node/BUILD.bazel @@ -6,10 +6,10 @@ go_library( "node.go", "node_controller.go", ], - importpath = "sigs.k8s.io/cluster-api/pkg/controller/node", + importpath = "github.com/openshift/cluster-api/pkg/controller/node", visibility = ["//visibility:public"], deps = [ - "//pkg/apis/cluster/v1alpha1:go_default_library", + "//pkg/apis/machine/v1beta1:go_default_library", "//pkg/controller/noderefutil:go_default_library", "//pkg/util:go_default_library", "//vendor/k8s.io/api/core/v1:go_default_library", diff --git a/vendor/sigs.k8s.io/cluster-api/pkg/controller/node/node.go b/vendor/github.com/openshift/cluster-api/pkg/controller/node/node.go similarity index 87% rename from vendor/sigs.k8s.io/cluster-api/pkg/controller/node/node.go rename to vendor/github.com/openshift/cluster-api/pkg/controller/node/node.go index a954342d3..12f59cbb6 100644 --- a/vendor/sigs.k8s.io/cluster-api/pkg/controller/node/node.go +++ b/vendor/github.com/openshift/cluster-api/pkg/controller/node/node.go @@ -24,17 +24,18 @@ import ( "context" - "sigs.k8s.io/cluster-api/pkg/apis/cluster/v1alpha1" - "sigs.k8s.io/cluster-api/pkg/controller/noderefutil" - "sigs.k8s.io/cluster-api/pkg/util" + "github.com/openshift/cluster-api/pkg/apis/machine/v1beta1" + "github.com/openshift/cluster-api/pkg/controller/noderefutil" + "github.com/openshift/cluster-api/pkg/util" "sigs.k8s.io/controller-runtime/pkg/client" ) const ( - machineAnnotationKey = "cluster.k8s.io/machine" + // MachineAnnotationKey annotation used to link node and machine resource + MachineAnnotationKey = "machine.openshift.io/machine" ) -// We are using "machine" annotation to link node and machine resource. The "machine" +// We are using "machine.openshift.io/machine" annotation to link node and machine resource. The "machine.openshift.io/machine" // annotation is an implementation detail of how the two objects can get linked together, but it is // not required behavior. However, in the event that a Machine.Spec update requires replacing the // Node, this can allow for faster turn-around time by allowing a new Node to be created with a new @@ -52,7 +53,7 @@ func (c *ReconcileNode) link(node *corev1.Node) error { } } - val, ok := node.ObjectMeta.Annotations[machineAnnotationKey] + val, ok := node.ObjectMeta.Annotations[MachineAnnotationKey] if !ok { return nil } @@ -65,7 +66,7 @@ func (c *ReconcileNode) link(node *corev1.Node) error { namespace = util.GetNamespaceOrDefault(namespace) key := client.ObjectKey{Namespace: namespace, Name: mach} - machine := &v1alpha1.Machine{} + machine := &v1beta1.Machine{} if err = c.Client.Get(context.Background(), key, machine); err != nil { klog.Errorf("Error getting machine %v: %v\n", mach, err) return err @@ -86,7 +87,7 @@ func (c *ReconcileNode) link(node *corev1.Node) error { } func (c *ReconcileNode) unlink(node *corev1.Node) error { - val, ok := node.ObjectMeta.Annotations[machineAnnotationKey] + val, ok := node.ObjectMeta.Annotations[MachineAnnotationKey] if !ok { return nil } @@ -99,7 +100,7 @@ func (c *ReconcileNode) unlink(node *corev1.Node) error { namespace = util.GetNamespaceOrDefault(namespace) key := client.ObjectKey{Namespace: namespace, Name: mach} - machine := &v1alpha1.Machine{} + machine := &v1beta1.Machine{} if err = c.Client.Get(context.Background(), key, machine); err != nil { klog.Errorf("Error getting machine %v: %v\n", mach, err) return err diff --git a/vendor/sigs.k8s.io/cluster-api/pkg/controller/node/node_controller.go b/vendor/github.com/openshift/cluster-api/pkg/controller/node/node_controller.go similarity index 96% rename from vendor/sigs.k8s.io/cluster-api/pkg/controller/node/node_controller.go rename to vendor/github.com/openshift/cluster-api/pkg/controller/node/node_controller.go index d66fee4e1..8e821a740 100644 --- a/vendor/sigs.k8s.io/cluster-api/pkg/controller/node/node_controller.go +++ b/vendor/github.com/openshift/cluster-api/pkg/controller/node/node_controller.go @@ -78,7 +78,7 @@ type ReconcileNode struct { // Reconcile reads that state of the cluster for a Node object and makes changes based on the state read // and what is in the Node.Spec // +kubebuilder:rbac:groups=core,resources=nodes,verbs=get;list;watch;create;update;patch;delete -// +kubebuilder:rbac:groups=cluster.k8s.io,resources=machines,verbs=get;list;watch;create;update;patch;delete +// +kubebuilder:rbac:groups=machine.openshift.io,resources=machines,verbs=get;list;watch;create;update;patch;delete func (r *ReconcileNode) Reconcile(request reconcile.Request) (reconcile.Result, error) { // Fetch the Node instance instance := &corev1.Node{} diff --git a/vendor/sigs.k8s.io/cluster-api/pkg/controller/noderefutil/BUILD.bazel b/vendor/github.com/openshift/cluster-api/pkg/controller/noderefutil/BUILD.bazel similarity index 88% rename from vendor/sigs.k8s.io/cluster-api/pkg/controller/noderefutil/BUILD.bazel rename to vendor/github.com/openshift/cluster-api/pkg/controller/noderefutil/BUILD.bazel index 7868e41e8..50c7a2b34 100644 --- a/vendor/sigs.k8s.io/cluster-api/pkg/controller/noderefutil/BUILD.bazel +++ b/vendor/github.com/openshift/cluster-api/pkg/controller/noderefutil/BUILD.bazel @@ -3,7 +3,7 @@ load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test") go_library( name = "go_default_library", srcs = ["util.go"], - importpath = "sigs.k8s.io/cluster-api/pkg/controller/noderefutil", + importpath = "github.com/openshift/cluster-api/pkg/controller/noderefutil", visibility = ["//visibility:public"], deps = [ "//vendor/k8s.io/api/core/v1:go_default_library", diff --git a/vendor/sigs.k8s.io/cluster-api/pkg/controller/noderefutil/util.go b/vendor/github.com/openshift/cluster-api/pkg/controller/noderefutil/util.go similarity index 100% rename from vendor/sigs.k8s.io/cluster-api/pkg/controller/noderefutil/util.go rename to vendor/github.com/openshift/cluster-api/pkg/controller/noderefutil/util.go diff --git a/vendor/sigs.k8s.io/cluster-api/pkg/errors/BUILD.bazel b/vendor/github.com/openshift/cluster-api/pkg/errors/BUILD.bazel similarity index 53% rename from vendor/sigs.k8s.io/cluster-api/pkg/errors/BUILD.bazel rename to vendor/github.com/openshift/cluster-api/pkg/errors/BUILD.bazel index 3d2cd66d0..8e9c9e928 100644 --- a/vendor/sigs.k8s.io/cluster-api/pkg/errors/BUILD.bazel +++ b/vendor/github.com/openshift/cluster-api/pkg/errors/BUILD.bazel @@ -7,7 +7,10 @@ go_library( "deployer.go", "machines.go", ], - importpath = "sigs.k8s.io/cluster-api/pkg/errors", + importpath = "github.com/openshift/cluster-api/pkg/errors", visibility = ["//visibility:public"], - deps = ["//pkg/apis/cluster/common:go_default_library"], + deps = [ + "//pkg/apis/machine/common:go_default_library", + "//vendor/github.com/pkg/errors:go_default_library", + ], ) diff --git a/vendor/sigs.k8s.io/cluster-api/pkg/errors/clusters.go b/vendor/github.com/openshift/cluster-api/pkg/errors/clusters.go similarity index 96% rename from vendor/sigs.k8s.io/cluster-api/pkg/errors/clusters.go rename to vendor/github.com/openshift/cluster-api/pkg/errors/clusters.go index f6a0f7809..cdb63b368 100644 --- a/vendor/sigs.k8s.io/cluster-api/pkg/errors/clusters.go +++ b/vendor/github.com/openshift/cluster-api/pkg/errors/clusters.go @@ -19,7 +19,7 @@ package errors import ( "fmt" - commonerrors "sigs.k8s.io/cluster-api/pkg/apis/cluster/common" + commonerrors "github.com/openshift/cluster-api/pkg/apis/machine/common" ) // A more descriptive kind of error that represents an error condition that diff --git a/vendor/sigs.k8s.io/cluster-api/pkg/errors/deployer.go b/vendor/github.com/openshift/cluster-api/pkg/errors/deployer.go similarity index 87% rename from vendor/sigs.k8s.io/cluster-api/pkg/errors/deployer.go rename to vendor/github.com/openshift/cluster-api/pkg/errors/deployer.go index 8c7041dbf..408871ecc 100644 --- a/vendor/sigs.k8s.io/cluster-api/pkg/errors/deployer.go +++ b/vendor/github.com/openshift/cluster-api/pkg/errors/deployer.go @@ -16,8 +16,6 @@ limitations under the License. package errors -import ( - "fmt" -) +import "github.com/pkg/errors" -var NotImplementedError = fmt.Errorf("not implemented") +var NotImplementedError = errors.New("not implemented") diff --git a/vendor/sigs.k8s.io/cluster-api/pkg/errors/machines.go b/vendor/github.com/openshift/cluster-api/pkg/errors/machines.go similarity index 96% rename from vendor/sigs.k8s.io/cluster-api/pkg/errors/machines.go rename to vendor/github.com/openshift/cluster-api/pkg/errors/machines.go index fcd50f9f8..eaf8c0cc2 100644 --- a/vendor/sigs.k8s.io/cluster-api/pkg/errors/machines.go +++ b/vendor/github.com/openshift/cluster-api/pkg/errors/machines.go @@ -19,7 +19,7 @@ package errors import ( "fmt" - commonerrors "sigs.k8s.io/cluster-api/pkg/apis/cluster/common" + commonerrors "github.com/openshift/cluster-api/pkg/apis/machine/common" ) // A more descriptive kind of error that represents an error condition that diff --git a/vendor/sigs.k8s.io/cluster-api/pkg/kubeadm/BUILD.bazel b/vendor/github.com/openshift/cluster-api/pkg/kubeadm/BUILD.bazel similarity index 63% rename from vendor/sigs.k8s.io/cluster-api/pkg/kubeadm/BUILD.bazel rename to vendor/github.com/openshift/cluster-api/pkg/kubeadm/BUILD.bazel index d260f7ac7..0f5c4b33f 100644 --- a/vendor/sigs.k8s.io/cluster-api/pkg/kubeadm/BUILD.bazel +++ b/vendor/github.com/openshift/cluster-api/pkg/kubeadm/BUILD.bazel @@ -3,14 +3,14 @@ load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test") go_library( name = "go_default_library", srcs = ["kubeadm.go"], - importpath = "sigs.k8s.io/cluster-api/pkg/kubeadm", + importpath = "github.com/openshift/cluster-api/pkg/kubeadm", visibility = ["//visibility:public"], - deps = ["//pkg/cmd-runner:go_default_library"], + deps = ["//pkg/cmdrunner:go_default_library"], ) go_test( name = "go_default_test", srcs = ["kubeadm_test.go"], embed = [":go_default_library"], - deps = ["//pkg/test-cmd-runner:go_default_library"], + deps = ["//pkg/testcmdrunner:go_default_library"], ) diff --git a/vendor/sigs.k8s.io/cluster-api/pkg/kubeadm/kubeadm.go b/vendor/github.com/openshift/cluster-api/pkg/kubeadm/kubeadm.go similarity index 94% rename from vendor/sigs.k8s.io/cluster-api/pkg/kubeadm/kubeadm.go rename to vendor/github.com/openshift/cluster-api/pkg/kubeadm/kubeadm.go index e6cb3dc84..4e3f4bb4e 100644 --- a/vendor/sigs.k8s.io/cluster-api/pkg/kubeadm/kubeadm.go +++ b/vendor/github.com/openshift/cluster-api/pkg/kubeadm/kubeadm.go @@ -20,13 +20,13 @@ import ( "strings" "time" - "sigs.k8s.io/cluster-api/pkg/cmd-runner" + "github.com/openshift/cluster-api/pkg/cmdrunner" ) // The purpose of Kubeadm and this file is to provide a unit tested wrapper around the 'kubeadm' exec command. Higher // level, application specific functionality built on top of kubeadm should be be in another location. type Kubeadm struct { - runner cmd_runner.CmdRunner + runner cmdrunner.Runner } // see https://kubernetes.io/docs/reference/setup-tools/kubeadm/kubeadm-token/ for an explanation of the parameters @@ -41,14 +41,14 @@ type TokenCreateParams struct { Usages []string } -func NewWithCmdRunner(runner cmd_runner.CmdRunner) *Kubeadm { +func NewWithRunner(runner cmdrunner.Runner) *Kubeadm { return &Kubeadm{ runner: runner, } } func New() *Kubeadm { - return NewWithCmdRunner(cmd_runner.New()) + return NewWithRunner(cmdrunner.New()) } // TokenCreate execs `kubeadm token create` with the appropriate flags added by interpreting the params argument. The output of diff --git a/vendor/github.com/openshift/cluster-api/pkg/testcmdrunner/BUILD.bazel b/vendor/github.com/openshift/cluster-api/pkg/testcmdrunner/BUILD.bazel new file mode 100644 index 000000000..48e6a2cb6 --- /dev/null +++ b/vendor/github.com/openshift/cluster-api/pkg/testcmdrunner/BUILD.bazel @@ -0,0 +1,8 @@ +load("@io_bazel_rules_go//go:def.bzl", "go_library") + +go_library( + name = "go_default_library", + srcs = ["test_cmd_runner.go"], + importpath = "github.com/openshift/cluster-api/pkg/testcmdrunner", + visibility = ["//visibility:public"], +) diff --git a/vendor/github.com/openshift/cluster-api/pkg/testcmdrunner/test_cmd_runner.go b/vendor/github.com/openshift/cluster-api/pkg/testcmdrunner/test_cmd_runner.go new file mode 100644 index 000000000..239b49214 --- /dev/null +++ b/vendor/github.com/openshift/cluster-api/pkg/testcmdrunner/test_cmd_runner.go @@ -0,0 +1,46 @@ +/* +Copyright 2018 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package testcmdrunner + +import ( + "testing" +) + +// TestRunner mocks out command execution. +type TestRunner struct { + callback func(cmd string, args ...string) (string, error) +} + +// New builds a TestRunner to mock out command execution. +func New(callback func(cmd string, args ...string) (string, error)) (*TestRunner, error) { + return &TestRunner{ + callback: callback, + }, nil +} + +// NewOrDie builds a TestRunner or calls t.Fatal on error +func NewOrDie(t *testing.T, callback func(cmd string, args ...string) (string, error)) *TestRunner { + runner, err := New(callback) + if err != nil { + t.Fatal(err) + } + return runner +} + +func (runner *TestRunner) CombinedOutput(cmd string, args ...string) (string, error) { + return runner.callback(cmd, args...) +} diff --git a/vendor/sigs.k8s.io/cluster-api/pkg/util/BUILD.bazel b/vendor/github.com/openshift/cluster-api/pkg/util/BUILD.bazel similarity index 92% rename from vendor/sigs.k8s.io/cluster-api/pkg/util/BUILD.bazel rename to vendor/github.com/openshift/cluster-api/pkg/util/BUILD.bazel index d0bc45d47..bf1bc17c0 100644 --- a/vendor/sigs.k8s.io/cluster-api/pkg/util/BUILD.bazel +++ b/vendor/github.com/openshift/cluster-api/pkg/util/BUILD.bazel @@ -6,7 +6,7 @@ go_library( "retry.go", "util.go", ], - importpath = "sigs.k8s.io/cluster-api/pkg/util", + importpath = "github.com/openshift/cluster-api/pkg/util", visibility = ["//visibility:public"], deps = [ "//pkg/apis/cluster/v1alpha1:go_default_library", diff --git a/vendor/sigs.k8s.io/cluster-api/pkg/util/retry.go b/vendor/github.com/openshift/cluster-api/pkg/util/retry.go similarity index 100% rename from vendor/sigs.k8s.io/cluster-api/pkg/util/retry.go rename to vendor/github.com/openshift/cluster-api/pkg/util/retry.go diff --git a/vendor/sigs.k8s.io/cluster-api/pkg/util/util.go b/vendor/github.com/openshift/cluster-api/pkg/util/util.go similarity index 92% rename from vendor/sigs.k8s.io/cluster-api/pkg/util/util.go rename to vendor/github.com/openshift/cluster-api/pkg/util/util.go index b67bb0023..d476eccc3 100644 --- a/vendor/sigs.k8s.io/cluster-api/pkg/util/util.go +++ b/vendor/github.com/openshift/cluster-api/pkg/util/util.go @@ -27,10 +27,10 @@ import ( "strings" "time" - "k8s.io/api/core/v1" + clusterv1 "github.com/openshift/cluster-api/pkg/apis/cluster/v1alpha1" + v1 "k8s.io/api/core/v1" "k8s.io/apimachinery/pkg/api/errors" "k8s.io/klog" - clusterv1 "sigs.k8s.io/cluster-api/pkg/apis/cluster/v1alpha1" "sigs.k8s.io/controller-runtime/pkg/client" "sigs.k8s.io/yaml" ) @@ -55,9 +55,9 @@ func RandomString(n int) string { return string(result) } -func GetMaster(machines []*clusterv1.Machine) *clusterv1.Machine { +func GetControlPlaneMachine(machines []*clusterv1.Machine) *clusterv1.Machine { for _, machine := range machines { - if IsMaster(machine) { + if IsControlPlaneMachine(machine) { return machine } } @@ -99,7 +99,7 @@ func GetDefaultKubeConfigPath() string { func GetMachineIfExists(c client.Client, namespace, name string) (*clusterv1.Machine, error) { if c == nil { - // Being called before k8s is setup as part of master VM creation + // Being called before k8s is setup as part of control plane VM creation return nil, nil } @@ -117,7 +117,7 @@ func GetMachineIfExists(c client.Client, namespace, name string) (*clusterv1.Mac } // TODO(robertbailey): Remove this function -func IsMaster(machine *clusterv1.Machine) bool { +func IsControlPlaneMachine(machine *clusterv1.Machine) bool { return machine.Spec.Versions.ControlPlane != "" } diff --git a/vendor/sigs.k8s.io/cluster-api/sample/cluster.yaml b/vendor/github.com/openshift/cluster-api/sample/cluster.yaml similarity index 100% rename from vendor/sigs.k8s.io/cluster-api/sample/cluster.yaml rename to vendor/github.com/openshift/cluster-api/sample/cluster.yaml diff --git a/vendor/sigs.k8s.io/cluster-api/sample/machine.yaml b/vendor/github.com/openshift/cluster-api/sample/machine.yaml similarity index 100% rename from vendor/sigs.k8s.io/cluster-api/sample/machine.yaml rename to vendor/github.com/openshift/cluster-api/sample/machine.yaml diff --git a/vendor/sigs.k8s.io/cluster-api/sample/machineclass.yaml b/vendor/github.com/openshift/cluster-api/sample/machineclass.yaml similarity index 100% rename from vendor/sigs.k8s.io/cluster-api/sample/machineclass.yaml rename to vendor/github.com/openshift/cluster-api/sample/machineclass.yaml diff --git a/vendor/sigs.k8s.io/cluster-api/sample/machinedeployment.yaml b/vendor/github.com/openshift/cluster-api/sample/machinedeployment.yaml similarity index 100% rename from vendor/sigs.k8s.io/cluster-api/sample/machinedeployment.yaml rename to vendor/github.com/openshift/cluster-api/sample/machinedeployment.yaml diff --git a/vendor/sigs.k8s.io/cluster-api/sample/machineset.yaml b/vendor/github.com/openshift/cluster-api/sample/machineset.yaml similarity index 100% rename from vendor/sigs.k8s.io/cluster-api/sample/machineset.yaml rename to vendor/github.com/openshift/cluster-api/sample/machineset.yaml diff --git a/vendor/sigs.k8s.io/cluster-api/scripts/ci-build.sh b/vendor/github.com/openshift/cluster-api/scripts/ci-build.sh similarity index 100% rename from vendor/sigs.k8s.io/cluster-api/scripts/ci-build.sh rename to vendor/github.com/openshift/cluster-api/scripts/ci-build.sh diff --git a/vendor/sigs.k8s.io/cluster-api/scripts/ci-is-vendor-in-sync.sh b/vendor/github.com/openshift/cluster-api/scripts/ci-is-vendor-in-sync.sh similarity index 91% rename from vendor/sigs.k8s.io/cluster-api/scripts/ci-is-vendor-in-sync.sh rename to vendor/github.com/openshift/cluster-api/scripts/ci-is-vendor-in-sync.sh index 88e42f725..71c11a718 100755 --- a/vendor/sigs.k8s.io/cluster-api/scripts/ci-is-vendor-in-sync.sh +++ b/vendor/github.com/openshift/cluster-api/scripts/ci-is-vendor-in-sync.sh @@ -20,4 +20,6 @@ set -o pipefail REPO_ROOT=$(dirname "${BASH_SOURCE}")/.. -cd $REPO_ROOT && dep status +cd $REPO_ROOT +find vendor -name 'BUILD.bazel' -delete +dep check diff --git a/vendor/sigs.k8s.io/cluster-api/scripts/ci-make.sh b/vendor/github.com/openshift/cluster-api/scripts/ci-make.sh similarity index 100% rename from vendor/sigs.k8s.io/cluster-api/scripts/ci-make.sh rename to vendor/github.com/openshift/cluster-api/scripts/ci-make.sh diff --git a/vendor/sigs.k8s.io/cluster-api/scripts/ci-test.sh b/vendor/github.com/openshift/cluster-api/scripts/ci-test.sh similarity index 100% rename from vendor/sigs.k8s.io/cluster-api/scripts/ci-test.sh rename to vendor/github.com/openshift/cluster-api/scripts/ci-test.sh diff --git a/vendor/sigs.k8s.io/cluster-api/scripts/fetch_ext_bins.sh b/vendor/github.com/openshift/cluster-api/scripts/fetch_ext_bins.sh similarity index 100% rename from vendor/sigs.k8s.io/cluster-api/scripts/fetch_ext_bins.sh rename to vendor/github.com/openshift/cluster-api/scripts/fetch_ext_bins.sh diff --git a/vendor/sigs.k8s.io/cluster-api/OWNERS b/vendor/sigs.k8s.io/cluster-api/OWNERS deleted file mode 100644 index d21d03dc2..000000000 --- a/vendor/sigs.k8s.io/cluster-api/OWNERS +++ /dev/null @@ -1,9 +0,0 @@ -# See the OWNERS docs: https://git.k8s.io/community/contributors/guide/owners.md - -approvers: - - sig-cluster-lifecycle-leads - - cluster-api-admins - - cluster-api-maintainers - -reviewers: - - cluster-api-maintainers diff --git a/vendor/sigs.k8s.io/cluster-api/cmd/clusterctl/clusterdeployer/bootstrap/existing/BUILD.bazel b/vendor/sigs.k8s.io/cluster-api/cmd/clusterctl/clusterdeployer/bootstrap/existing/BUILD.bazel deleted file mode 100644 index 1eaa6f4db..000000000 --- a/vendor/sigs.k8s.io/cluster-api/cmd/clusterctl/clusterdeployer/bootstrap/existing/BUILD.bazel +++ /dev/null @@ -1,14 +0,0 @@ -load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test") - -go_library( - name = "go_default_library", - srcs = ["existingcluster.go"], - importpath = "sigs.k8s.io/cluster-api/cmd/clusterctl/clusterdeployer/bootstrap/existing", - visibility = ["//visibility:public"], -) - -go_test( - name = "go_default_test", - srcs = ["existingcluster_test.go"], - embed = [":go_default_library"], -) diff --git a/vendor/sigs.k8s.io/cluster-api/cmd/clusterctl/testdata/create-cluster-no-args-invalid-flag.golden b/vendor/sigs.k8s.io/cluster-api/cmd/clusterctl/testdata/create-cluster-no-args-invalid-flag.golden deleted file mode 100644 index b58867c78..000000000 --- a/vendor/sigs.k8s.io/cluster-api/cmd/clusterctl/testdata/create-cluster-no-args-invalid-flag.golden +++ /dev/null @@ -1,30 +0,0 @@ -Error: unknown flag: --invalid-flag -Usage: - clusterctl create cluster [flags] - -Flags: - -a, --addon-components string A yaml file containing cluster addons to apply to the internal cluster - --cleanup-bootstrap-cluster Whether to cleanup the bootstrap cluster after bootstrap (default true) - -c, --cluster string A yaml file containing cluster object definition - -e, --existing-bootstrap-cluster-kubeconfig string Path to an existing cluster's kubeconfig for bootstrapping (intead of using minikube) - -h, --help help for cluster - --kubeconfig-out string Where to output the kubeconfig for the provisioned cluster (default "kubeconfig") - -m, --machines string A yaml file containing machine object definition(s) - --minikube strings Minikube options - --provider string Which provider deployment logic to use (google/vsphere/azure) - -p, --provider-components string A yaml file containing cluster api provider controllers and supporting objects - --vm-driver string Which vm driver to use for minikube - -Global Flags: - --alsologtostderr log to standard error as well as files - --kubeconfig string Paths to a kubeconfig. Only required if out-of-cluster. - --log-flush-frequency duration Maximum number of seconds between log flushes (default 5s) - --log_backtrace_at traceLocation when logging hits line file:N, emit a stack trace (default :0) - --log_dir string If non-empty, write log files in this directory - --logtostderr log to standard error instead of files (default true) - --master string The address of the Kubernetes API server. Overrides any value in kubeconfig. Only required if out-of-cluster. - --stderrthreshold severity logs at or above this threshold go to stderr (default 2) - -v, --v Level log level for V logs - --vmodule moduleSpec comma-separated list of pattern=N settings for file-filtered logging - -unknown flag: --invalid-flag diff --git a/vendor/sigs.k8s.io/cluster-api/cmd/clusterctl/testdata/create-cluster-no-args.golden b/vendor/sigs.k8s.io/cluster-api/cmd/clusterctl/testdata/create-cluster-no-args.golden deleted file mode 100644 index ff3fa0c33..000000000 --- a/vendor/sigs.k8s.io/cluster-api/cmd/clusterctl/testdata/create-cluster-no-args.golden +++ /dev/null @@ -1,30 +0,0 @@ -Please provide yaml file for cluster definition. -Create a kubernetes cluster with one command - -Usage: - clusterctl create cluster [flags] - -Flags: - -a, --addon-components string A yaml file containing cluster addons to apply to the internal cluster - --cleanup-bootstrap-cluster Whether to cleanup the bootstrap cluster after bootstrap (default true) - -c, --cluster string A yaml file containing cluster object definition - -e, --existing-bootstrap-cluster-kubeconfig string Path to an existing cluster's kubeconfig for bootstrapping (intead of using minikube) - -h, --help help for cluster - --kubeconfig-out string Where to output the kubeconfig for the provisioned cluster (default "kubeconfig") - -m, --machines string A yaml file containing machine object definition(s) - --minikube strings Minikube options - --provider string Which provider deployment logic to use (google/vsphere/azure) - -p, --provider-components string A yaml file containing cluster api provider controllers and supporting objects - --vm-driver string Which vm driver to use for minikube - -Global Flags: - --alsologtostderr log to standard error as well as files - --kubeconfig string Paths to a kubeconfig. Only required if out-of-cluster. - --log-flush-frequency duration Maximum number of seconds between log flushes (default 5s) - --log_backtrace_at traceLocation when logging hits line file:N, emit a stack trace (default :0) - --log_dir string If non-empty, write log files in this directory - --logtostderr log to standard error instead of files (default true) - --master string The address of the Kubernetes API server. Overrides any value in kubeconfig. Only required if out-of-cluster. - --stderrthreshold severity logs at or above this threshold go to stderr (default 2) - -v, --v Level log level for V logs - --vmodule moduleSpec comma-separated list of pattern=N settings for file-filtered logging diff --git a/vendor/sigs.k8s.io/cluster-api/cmd/clusterctl/testdata/delete-cluster-no-args-invalid-flag.golden b/vendor/sigs.k8s.io/cluster-api/cmd/clusterctl/testdata/delete-cluster-no-args-invalid-flag.golden deleted file mode 100644 index cdb500afe..000000000 --- a/vendor/sigs.k8s.io/cluster-api/cmd/clusterctl/testdata/delete-cluster-no-args-invalid-flag.golden +++ /dev/null @@ -1,29 +0,0 @@ -Error: unknown flag: --invalid-flag -Usage: - clusterctl delete cluster [flags] - -Flags: - --cleanup-bootstrap-cluster Whether to cleanup the bootstrap cluster after bootstrap (default true) - --cluster string The name of the kubeconfig cluster to use - --cluster-namespace string Namespace where the cluster to be deleted resides (default "default") - -e, --existing-bootstrap-cluster-kubeconfig string Path to an existing cluster's kubeconfig for bootstrapping (intead of using minikube) - -h, --help help for cluster - --minikube strings Minikube options - -n, --namespace string If present, the namespace scope for this CLI request - -p, --provider-components string A yaml file containing cluster api provider controllers and supporting objects, if empty the value is loaded from the cluster's configuration store. - --user string The name of the kubeconfig user to use - --vm-driver string Which vm driver to use for minikube - -Global Flags: - --alsologtostderr log to standard error as well as files - --kubeconfig string Paths to a kubeconfig. Only required if out-of-cluster. - --log-flush-frequency duration Maximum number of seconds between log flushes (default 5s) - --log_backtrace_at traceLocation when logging hits line file:N, emit a stack trace (default :0) - --log_dir string If non-empty, write log files in this directory - --logtostderr log to standard error instead of files (default true) - --master string The address of the Kubernetes API server. Overrides any value in kubeconfig. Only required if out-of-cluster. - --stderrthreshold severity logs at or above this threshold go to stderr (default 2) - -v, --v Level log level for V logs - --vmodule moduleSpec comma-separated list of pattern=N settings for file-filtered logging - -unknown flag: --invalid-flag diff --git a/vendor/sigs.k8s.io/cluster-api/config/crds/cluster_v1alpha1_cluster.yaml b/vendor/sigs.k8s.io/cluster-api/config/crds/cluster_v1alpha1_cluster.yaml deleted file mode 100644 index ac8250c70..000000000 --- a/vendor/sigs.k8s.io/cluster-api/config/crds/cluster_v1alpha1_cluster.yaml +++ /dev/null @@ -1,98 +0,0 @@ -apiVersion: apiextensions.k8s.io/v1beta1 -kind: CustomResourceDefinition -metadata: - creationTimestamp: null - labels: - controller-tools.k8s.io: "1.0" - name: clusters.cluster.k8s.io -spec: - group: cluster.k8s.io - names: - kind: Cluster - plural: clusters - scope: Namespaced - subresources: - status: {} - validation: - openAPIV3Schema: - properties: - apiVersion: - type: string - kind: - type: string - metadata: - type: object - spec: - properties: - clusterNetwork: - properties: - pods: - properties: - cidrBlocks: - items: - type: string - type: array - required: - - cidrBlocks - type: object - serviceDomain: - type: string - services: - properties: - cidrBlocks: - items: - type: string - type: array - required: - - cidrBlocks - type: object - required: - - services - - pods - - serviceDomain - type: object - providerSpec: - properties: - value: - type: object - valueFrom: - properties: - machineClass: - properties: - provider: - type: string - type: object - type: object - type: object - required: - - clusterNetwork - type: object - status: - properties: - apiEndpoints: - items: - properties: - host: - type: string - port: - format: int64 - type: integer - required: - - host - - port - type: object - type: array - errorMessage: - type: string - errorReason: - type: string - providerStatus: - type: object - type: object - version: v1alpha1 -status: - acceptedNames: - kind: "" - plural: "" - conditions: [] - storedVersions: [] diff --git a/vendor/sigs.k8s.io/cluster-api/config/crds/cluster_v1alpha1_machine.yaml b/vendor/sigs.k8s.io/cluster-api/config/crds/cluster_v1alpha1_machine.yaml deleted file mode 100644 index e53b5a635..000000000 --- a/vendor/sigs.k8s.io/cluster-api/config/crds/cluster_v1alpha1_machine.yaml +++ /dev/null @@ -1,111 +0,0 @@ -apiVersion: apiextensions.k8s.io/v1beta1 -kind: CustomResourceDefinition -metadata: - creationTimestamp: null - labels: - controller-tools.k8s.io: "1.0" - name: machines.cluster.k8s.io -spec: - group: cluster.k8s.io - names: - kind: Machine - plural: machines - scope: Namespaced - subresources: - status: {} - validation: - openAPIV3Schema: - properties: - apiVersion: - type: string - kind: - type: string - metadata: - type: object - spec: - properties: - configSource: - type: object - metadata: - type: object - providerSpec: - properties: - value: - type: object - valueFrom: - properties: - machineClass: - properties: - provider: - type: string - type: object - type: object - type: object - taints: - items: - type: object - type: array - versions: - properties: - controlPlane: - type: string - kubelet: - type: string - required: - - kubelet - type: object - required: - - providerSpec - type: object - status: - properties: - addresses: - items: - type: object - type: array - conditions: - items: - type: object - type: array - errorMessage: - type: string - errorReason: - type: string - lastOperation: - properties: - description: - type: string - lastUpdated: - format: date-time - type: string - state: - type: string - type: - type: string - type: object - lastUpdated: - format: date-time - type: string - nodeRef: - type: object - phase: - type: string - providerStatus: - type: object - versions: - properties: - controlPlane: - type: string - kubelet: - type: string - required: - - kubelet - type: object - type: object - version: v1alpha1 -status: - acceptedNames: - kind: "" - plural: "" - conditions: [] - storedVersions: [] diff --git a/vendor/sigs.k8s.io/cluster-api/config/crds/cluster_v1alpha1_machineclass.yaml b/vendor/sigs.k8s.io/cluster-api/config/crds/cluster_v1alpha1_machineclass.yaml deleted file mode 100644 index 5de01dc58..000000000 --- a/vendor/sigs.k8s.io/cluster-api/config/crds/cluster_v1alpha1_machineclass.yaml +++ /dev/null @@ -1,33 +0,0 @@ -apiVersion: apiextensions.k8s.io/v1beta1 -kind: CustomResourceDefinition -metadata: - creationTimestamp: null - labels: - controller-tools.k8s.io: "1.0" - name: machineclasses.cluster.k8s.io -spec: - group: cluster.k8s.io - names: - kind: MachineClass - plural: machineclasses - scope: Namespaced - validation: - openAPIV3Schema: - properties: - apiVersion: - type: string - kind: - type: string - metadata: - type: object - providerSpec: - type: object - required: - - providerSpec - version: v1alpha1 -status: - acceptedNames: - kind: "" - plural: "" - conditions: [] - storedVersions: [] diff --git a/vendor/sigs.k8s.io/cluster-api/config/crds/cluster_v1alpha1_machinedeployment.yaml b/vendor/sigs.k8s.io/cluster-api/config/crds/cluster_v1alpha1_machinedeployment.yaml deleted file mode 100644 index cc174de47..000000000 --- a/vendor/sigs.k8s.io/cluster-api/config/crds/cluster_v1alpha1_machinedeployment.yaml +++ /dev/null @@ -1,128 +0,0 @@ -apiVersion: apiextensions.k8s.io/v1beta1 -kind: CustomResourceDefinition -metadata: - creationTimestamp: null - labels: - controller-tools.k8s.io: "1.0" - name: machinedeployments.cluster.k8s.io -spec: - group: cluster.k8s.io - names: - kind: MachineDeployment - plural: machinedeployments - scope: Namespaced - subresources: - scale: - labelSelectorPath: .status.labelSelector - specReplicasPath: .spec.replicas - statusReplicasPath: .status.replicas - status: {} - validation: - openAPIV3Schema: - properties: - apiVersion: - type: string - kind: - type: string - metadata: - type: object - spec: - properties: - minReadySeconds: - format: int32 - type: integer - paused: - type: boolean - progressDeadlineSeconds: - format: int32 - type: integer - replicas: - format: int32 - type: integer - revisionHistoryLimit: - format: int32 - type: integer - selector: - type: object - strategy: - properties: - rollingUpdate: - properties: - maxSurge: {} - maxUnavailable: {} - type: object - type: - type: string - type: object - template: - properties: - metadata: - type: object - spec: - properties: - configSource: - type: object - metadata: - type: object - providerSpec: - properties: - value: - type: object - valueFrom: - properties: - machineClass: - properties: - provider: - type: string - type: object - type: object - type: object - taints: - items: - type: object - type: array - versions: - properties: - controlPlane: - type: string - kubelet: - type: string - required: - - kubelet - type: object - required: - - providerSpec - type: object - type: object - required: - - selector - - template - type: object - status: - properties: - availableReplicas: - format: int32 - type: integer - observedGeneration: - format: int64 - type: integer - readyReplicas: - format: int32 - type: integer - replicas: - format: int32 - type: integer - unavailableReplicas: - format: int32 - type: integer - updatedReplicas: - format: int32 - type: integer - type: object - version: v1alpha1 -status: - acceptedNames: - kind: "" - plural: "" - conditions: [] - storedVersions: [] diff --git a/vendor/sigs.k8s.io/cluster-api/config/crds/cluster_v1alpha1_machineset.yaml b/vendor/sigs.k8s.io/cluster-api/config/crds/cluster_v1alpha1_machineset.yaml deleted file mode 100644 index 101db0996..000000000 --- a/vendor/sigs.k8s.io/cluster-api/config/crds/cluster_v1alpha1_machineset.yaml +++ /dev/null @@ -1,112 +0,0 @@ -apiVersion: apiextensions.k8s.io/v1beta1 -kind: CustomResourceDefinition -metadata: - creationTimestamp: null - labels: - controller-tools.k8s.io: "1.0" - name: machinesets.cluster.k8s.io -spec: - group: cluster.k8s.io - names: - kind: MachineSet - plural: machinesets - scope: Namespaced - subresources: - scale: - labelSelectorPath: .status.labelSelector - specReplicasPath: .spec.replicas - statusReplicasPath: .status.replicas - status: {} - validation: - openAPIV3Schema: - properties: - apiVersion: - type: string - kind: - type: string - metadata: - type: object - spec: - properties: - minReadySeconds: - format: int32 - type: integer - replicas: - format: int32 - type: integer - selector: - type: object - template: - properties: - metadata: - type: object - spec: - properties: - configSource: - type: object - metadata: - type: object - providerSpec: - properties: - value: - type: object - valueFrom: - properties: - machineClass: - properties: - provider: - type: string - type: object - type: object - type: object - taints: - items: - type: object - type: array - versions: - properties: - controlPlane: - type: string - kubelet: - type: string - required: - - kubelet - type: object - required: - - providerSpec - type: object - type: object - required: - - selector - type: object - status: - properties: - availableReplicas: - format: int32 - type: integer - errorMessage: - type: string - errorReason: - type: string - fullyLabeledReplicas: - format: int32 - type: integer - observedGeneration: - format: int64 - type: integer - readyReplicas: - format: int32 - type: integer - replicas: - format: int32 - type: integer - required: - - replicas - type: object - version: v1alpha1 -status: - acceptedNames: - kind: "" - plural: "" - conditions: [] - storedVersions: [] diff --git a/vendor/sigs.k8s.io/cluster-api/pkg/apis/cluster/common/BUILD.bazel b/vendor/sigs.k8s.io/cluster-api/pkg/apis/cluster/common/BUILD.bazel deleted file mode 100644 index 899f3e11d..000000000 --- a/vendor/sigs.k8s.io/cluster-api/pkg/apis/cluster/common/BUILD.bazel +++ /dev/null @@ -1,12 +0,0 @@ -load("@io_bazel_rules_go//go:def.bzl", "go_library") - -go_library( - name = "go_default_library", - srcs = [ - "consts.go", - "plugins.go", - ], - importpath = "sigs.k8s.io/cluster-api/pkg/apis/cluster/common", - visibility = ["//visibility:public"], - deps = ["//vendor/k8s.io/klog:go_default_library"], -) diff --git a/vendor/sigs.k8s.io/cluster-api/pkg/test-cmd-runner/BUILD.bazel b/vendor/sigs.k8s.io/cluster-api/pkg/test-cmd-runner/BUILD.bazel deleted file mode 100644 index e0fb797d3..000000000 --- a/vendor/sigs.k8s.io/cluster-api/pkg/test-cmd-runner/BUILD.bazel +++ /dev/null @@ -1,14 +0,0 @@ -load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test") - -go_library( - name = "go_default_library", - srcs = ["test_cmd_runner.go"], - importpath = "sigs.k8s.io/cluster-api/pkg/test-cmd-runner", - visibility = ["//visibility:public"], -) - -go_test( - name = "go_default_test", - srcs = ["test_cmd_runner_test.go"], - embed = [":go_default_library"], -) diff --git a/vendor/sigs.k8s.io/cluster-api/pkg/test-cmd-runner/test_cmd_runner.go b/vendor/sigs.k8s.io/cluster-api/pkg/test-cmd-runner/test_cmd_runner.go deleted file mode 100644 index 88de1b594..000000000 --- a/vendor/sigs.k8s.io/cluster-api/pkg/test-cmd-runner/test_cmd_runner.go +++ /dev/null @@ -1,119 +0,0 @@ -/* -Copyright 2018 The Kubernetes Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -package test_cmd_runner - -import ( - "flag" - "fmt" - "os" - "os/exec" - "reflect" - "runtime" - "strings" - "testing" -) - -type TestRunner struct { - callback func(string, ...string) int -} - -var ( - TestModeEnvVar = "GO_TEST_MODE" - CallbackTestMode = "CALLBACK" - CallbackFunctionName = "GO_CALLBACK_FUNCTION_NAME" - reggedFunctions = make(map[string]func(string, ...string) int) -) - -// TestRunner makes it easy to mock out shell commands. It will start a new program that calls into the callback function -// supplied when creating TestRunner. -// -// To use TestRunner from your test, you must do the following: -// 1. In your test file's init() method call RegisterCallback with the same callback function you passed into TestRunner -// 2. Copy the TestMain below and insert it into your test file: -// func TestMain(m *testing.M) { -// cmd_runner.TestMain(m) -// } -func NewTestRunner(callback func(cmd string, args ...string) (exitCode int)) (*TestRunner, error) { - name := getFullyQualifiedFunctionName(callback) - if _, ok := reggedFunctions[name]; !ok { - shortName := getUnqualifiedFunctionName(name) - registerCallbackShortName := getUnqualifiedFunctionName(getFullyQualifiedFunctionName(RegisterCallback)) - return nil, fmt.Errorf("unregistered function: '%v', you must add the following to your package's init() method, %v(%v)", name, registerCallbackShortName, shortName) - } - return &TestRunner{ - callback: callback, - }, nil -} - -func NewTestRunnerFailOnErr(t *testing.T, callback func(cmd string, args ...string) int) *TestRunner { - runner, err := NewTestRunner(callback) - if err != nil { - t.Fatal(err) - } - return runner -} - -// Call this method to register your callback function from your init() method. This is required before creating a TestRunner that uses your function. -func RegisterCallback(fn func(cmd string, args ...string) int) { - name := getFullyQualifiedFunctionName(fn) - reggedFunctions[name] = fn -} - -func (runner *TestRunner) CombinedOutput(cmd string, args ...string) (string, error) { - args = append([]string{cmd}, args...) - command := exec.Command(os.Args[0], args...) - command.Env = []string{ - fmt.Sprintf("%v=%v", TestModeEnvVar, CallbackTestMode), - fmt.Sprintf("%v=%v", CallbackFunctionName, getFullyQualifiedFunctionName(runner.callback)), - } - output, err := command.CombinedOutput() - return string(output), err -} - -func TestMain(m *testing.M) { - flag.Parse() - os.Exit(run(m)) -} - -func run(m *testing.M) int { - switch os.Getenv(TestModeEnvVar) { - case CallbackTestMode: - return runTestExec() - default: - return m.Run() - } -} - -func runTestExec() int { - functionName := os.Getenv(CallbackFunctionName) - fn := reggedFunctions[functionName] - if fn == nil { - panic(fmt.Errorf("unregistered function name: %v", functionName)) - } - return fn(os.Args[1], os.Args[2:len(os.Args)]...) -} - -// given the output of getFullyQualifiedFunctionName(...) this function returns the actual 'short' function name stripping off the package path and file name. -func getUnqualifiedFunctionName(fullyQualifiedName string) string { - parts := strings.Split(fullyQualifiedName, ".") - return parts[len(parts)-1] -} - -// code assumes that the 'fn' parameter has a kind of 'Func' -func getFullyQualifiedFunctionName(fn interface{}) string { - return runtime.FuncForPC(reflect.ValueOf(fn).Pointer()).Name() -}