From a1a0ef354f9481d42f66402de7e432fb3ecb9351 Mon Sep 17 00:00:00 2001 From: Zeeshan Ali Date: Wed, 24 Apr 2019 18:20:33 +0200 Subject: [PATCH] Revendor github.com/openshift/cluster-api--actuator-pkg It is hoped that this update will help with failing e2e tests. --- Gopkg.lock | 15 +- .../cluster-api-actuator-pkg/Gopkg.lock | 69 +-- .../cluster-api-actuator-pkg/Gopkg.toml | 16 +- .../cluster-api-actuator-pkg/Makefile | 25 +- .../pkg/e2e/autoscaler/autoscaler.go | 29 +- .../pkg/e2e/framework/common.go | 21 +- .../pkg/e2e/framework/framework.go | 2 +- .../pkg/e2e/framework/machinehealthcheck.go | 2 - .../pkg/e2e/framework/machines.go | 31 ++ .../pkg/e2e/infra/infra.go | 91 +++- .../pkg/e2e/infra/utils.go | 57 +-- .../machinehealthcheck/machinehealthcheck.go | 81 +--- .../pkg/e2e/operators/machine-api-operator.go | 13 +- .../pkg/e2e/operators/utils.go | 6 +- .../pkg/manifests/manifests.go | 14 +- .../pkg/manifests/userdata.go | 4 +- .../cluster-autoscaler-operator/Gopkg.lock | 256 ++++++----- .../cluster-autoscaler-operator/Gopkg.toml | 31 +- .../cluster-autoscaler-operator/Makefile | 13 +- .../cluster-autoscaler-operator-patch.yaml | 22 - .../cmd/manager/main.go | 19 +- .../examples/clusterautoscaler.yaml | 6 +- .../examples/machineautoscaler.yaml | 2 +- .../install/01_clusterautoscaler.crd.yaml | 4 +- .../install/02_machineautoscaler.crd.yaml | 4 +- .../kustomization.yaml | 2 +- .../apis/addtoscheme_autoscaling_v1alpha1.go | 10 - .../v1alpha1/clusterautoscaler_types.go | 80 ---- .../pkg/apis/autoscaling/v1alpha1/doc.go | 4 - .../v1alpha1/machineautoscaler_types.go | 55 --- .../pkg/apis/autoscaling/v1alpha1/register.go | 19 - .../v1alpha1/zz_generated.deepcopy.go | 357 ---------------- .../v1alpha1/zz_generated.defaults.go | 32 -- .../v1alpha1/zz_generated.openapi.go | 107 ----- .../clusterautoscaler/clusterautoscaler.go | 8 +- .../clusterautoscaler_controller.go | 136 +++--- .../machineautoscaler_controller.go | 66 +-- .../pkg/operator/config.go | 6 +- .../pkg/operator/operator.go | 59 +-- .../pkg/operator/status.go | 398 ++++++++++++------ .../pkg/util/util.go | 63 +++ .../test/e2e/main.go | 111 ----- .../test/e2e/operator_expectations.go | 325 -------------- .../test/resources/cluster.yaml | 15 - .../test/resources/machine-set.yaml | 26 -- 45 files changed, 908 insertions(+), 1804 deletions(-) delete mode 100644 vendor/github.com/openshift/cluster-autoscaler-operator/cluster-autoscaler-operator-patch.yaml delete mode 100644 vendor/github.com/openshift/cluster-autoscaler-operator/pkg/apis/addtoscheme_autoscaling_v1alpha1.go delete mode 100644 vendor/github.com/openshift/cluster-autoscaler-operator/pkg/apis/autoscaling/v1alpha1/clusterautoscaler_types.go delete mode 100644 vendor/github.com/openshift/cluster-autoscaler-operator/pkg/apis/autoscaling/v1alpha1/doc.go delete mode 100644 vendor/github.com/openshift/cluster-autoscaler-operator/pkg/apis/autoscaling/v1alpha1/machineautoscaler_types.go delete mode 100644 vendor/github.com/openshift/cluster-autoscaler-operator/pkg/apis/autoscaling/v1alpha1/register.go delete mode 100644 vendor/github.com/openshift/cluster-autoscaler-operator/pkg/apis/autoscaling/v1alpha1/zz_generated.deepcopy.go delete mode 100644 vendor/github.com/openshift/cluster-autoscaler-operator/pkg/apis/autoscaling/v1alpha1/zz_generated.defaults.go delete mode 100644 vendor/github.com/openshift/cluster-autoscaler-operator/pkg/apis/autoscaling/v1alpha1/zz_generated.openapi.go delete mode 100644 vendor/github.com/openshift/cluster-autoscaler-operator/test/e2e/main.go delete mode 100644 vendor/github.com/openshift/cluster-autoscaler-operator/test/e2e/operator_expectations.go delete mode 100644 vendor/github.com/openshift/cluster-autoscaler-operator/test/resources/cluster.yaml delete mode 100644 vendor/github.com/openshift/cluster-autoscaler-operator/test/resources/machine-set.yaml diff --git a/Gopkg.lock b/Gopkg.lock index 87c47069f..f0ced5750 100644 --- a/Gopkg.lock +++ b/Gopkg.lock @@ -428,6 +428,8 @@ "pkg/client/clientset_generated/clientset/typed/machine/v1beta1/fake", "pkg/controller/error", "pkg/controller/machine", + "pkg/controller/node", + "pkg/controller/noderefutil", "pkg/errors", "pkg/util", ] @@ -436,7 +438,7 @@ [[projects]] branch = "master" - digest = "1:9c11f175671408bd03a6ef847b0d3de5a7c89ccd7ec92def30a96d5d93a6369d" + digest = "1:4d5a5c42448464de04f04edccde08da77ada279f7f3ad2f5278aa63fe13b9716" name = "github.com/openshift/cluster-api-actuator-pkg" packages = [ "pkg/e2e/framework", @@ -444,15 +446,18 @@ "pkg/types", ] pruneopts = "T" - revision = "417ca171b620cd9ed3c504dc2f39ebe31f4dad3d" + revision = "90309f4b0f5ae4255cc04cbe6dacbfc00267cab6" [[projects]] branch = "master" - digest = "1:99f72b8afa76d7ccac0225c685d3cbeee2f137d69b387c3ef5a9b0b0416a493c" + digest = "1:e01b8e3b0ce71b77c06a7d08ff3ddb103da96ced53eb1b4dabca4be90d711491" name = "github.com/openshift/cluster-autoscaler-operator" - packages = ["pkg/apis/autoscaling/v1alpha1"] + packages = [ + "pkg/apis/autoscaling/v1", + "pkg/apis/autoscaling/v1beta1", + ] pruneopts = "T" - revision = "54672e5e562be1c55db424a744da445fc715f7b3" + revision = "d443071aaf9f99a15f107744e82a7d5a358a89f5" [[projects]] branch = "master" 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 753508e96..2d0b80767 100644 --- a/vendor/github.com/openshift/cluster-api-actuator-pkg/Gopkg.lock +++ b/vendor/github.com/openshift/cluster-api-actuator-pkg/Gopkg.lock @@ -25,6 +25,14 @@ pruneopts = "" revision = "de5bf2ad457846296e2031421a34e2568e304e35" +[[projects]] + digest = "1:60942d250d0e06d3722ddc8e22bc52f8cef7961ba6d8d3e95327a32b6b024a7b" + name = "github.com/appscode/jsonpatch" + packages = ["."] + pruneopts = "" + revision = "7c0e3b262f30165a8ec3d0b4c6059fd92703bfb2" + version = "1.0.0" + [[projects]] branch = "master" digest = "1:c0bec5f9b98d0bc872ff5e834fac186b807b656683bd29cb82fb207a1513fabb" @@ -281,14 +289,6 @@ revision = "28bf78dadb0f64748ff13a0b6547e4972a5cea64" version = "v1.0.1" -[[projects]] - branch = "master" - digest = "1:58050e2bc9621cc6b68c1da3e4a0d1c40ad1f89062b9855c26521fd42a97a106" - name = "github.com/mattbaird/jsonpatch" - packages = ["."] - pruneopts = "" - revision = "81af80346b1a01caae0cbc27fd3c1ba5b11e189f" - [[projects]] digest = "1:63722a4b1e1717be7b98fc686e0b30d5e7f734b9e93d7dee86293b6deab7ea28" name = "github.com/matttproud/golang_protobuf_extensions" @@ -364,15 +364,15 @@ version = "v1.4.2" [[projects]] - branch = "master" - digest = "1:7c3defaa4c171d552da0ccedce06992efad4d102ea39cd37f8444a0403b5913c" + digest = "1:853f9ec7a92a4b87a9b660e838731623d098613ef3bd5443b8331790ff7bef10" name = "github.com/openshift/api" packages = ["config/v1"] pruneopts = "" - revision = "af79befc50a8223c8122e9e654f65763dd17a87e" + revision = "8e476cb7322e59919cbb6482fd076ec5a214df25" [[projects]] - digest = "1:6299a67dc836b7645d1e207f4764fd8bdcb11b1d614fc2c32435925ffdc7997a" + branch = "openshift-4.0-cluster-api-0.0.0-alpha.4" + digest = "1:999aa1e8d36fbd410b276ef5a47d62d4a2caaece354e4377f7b8d27f9d75f3ca" name = "github.com/openshift/cluster-api" packages = [ "pkg/apis/cluster/common", @@ -388,18 +388,19 @@ "pkg/util", ] pruneopts = "" - revision = "8b6a416a1830212712a6b03c5431afbd4f586d62" + revision = "776449739aa75bee4287469e3c82ded381f50b3c" [[projects]] branch = "master" - digest = "1:8439cd39e3006f645c7b3941b2dd8e26218c867e8a420aaf3a9a9bd49e1acc07" + digest = "1:6d48343e436f36fdfacd82c48d37b891f44e44cbcdbbb57d42b8a333927716a4" name = "github.com/openshift/cluster-autoscaler-operator" packages = [ "pkg/apis", - "pkg/apis/autoscaling/v1alpha1", + "pkg/apis/autoscaling/v1", + "pkg/apis/autoscaling/v1beta1", ] pruneopts = "" - revision = "73c46659d0e2c0ac03e6e207d52ff0c025b04786" + revision = "17350a84b40565851a3f1bd21c6f8a6763b8eacb" [[projects]] branch = "master" @@ -729,7 +730,7 @@ version = "v2.2.1" [[projects]] - digest = "1:3e3e9df293bd6f9fd64effc9fa1f0edcd97e6c74145cd9ab05d35719004dc41f" + digest = "1:be67264067c68b1f601bfc4a6c102b1380ed0743147381de81ed11da88d2e246" name = "k8s.io/api" packages = [ "admission/v1beta1", @@ -738,6 +739,7 @@ "apps/v1", "apps/v1beta1", "apps/v1beta2", + "auditregistration/v1alpha1", "authentication/v1", "authentication/v1beta1", "authorization/v1", @@ -766,11 +768,11 @@ "storage/v1beta1", ] pruneopts = "" - revision = "6db15a15d2d3874a6c3ddb2140ac9f3bc7058428" - version = "kubernetes-1.12.5" + revision = "05914d821849570fba9eacfb29466f2d8d3cd229" + version = "kubernetes-1.13.1" [[projects]] - digest = "1:38bf124557f0bc0aecaa95557185cfc84c46de8a222ac0ae33e58379d8a82009" + digest = "1:2133e488e6db5701ef295c39cbc0836855c02af677e8707e539ebf605a4211ca" name = "k8s.io/apiextensions-apiserver" packages = [ "pkg/apis/apiextensions", @@ -780,11 +782,11 @@ "pkg/client/clientset/clientset/typed/apiextensions/v1beta1", ] pruneopts = "" - revision = "a384d17938fe55d54a52d5668bf0ff40044daef0" - version = "kubernetes-1.12.5" + revision = "0fe22c71c47604641d9aa352c785b7912c200562" + version = "kubernetes-1.13.1" [[projects]] - digest = "1:8cac653dd97e89700e00ce6ea7134cf28b3e1b59615ab99464760e230fab9860" + digest = "1:66b0292f815d508d11ed5fe94fdeb0bcc5a988703a08e73bf3cb3a415de676cf" name = "k8s.io/apimachinery" packages = [ "pkg/api/equality", @@ -835,11 +837,11 @@ "third_party/forked/golang/reflect", ] pruneopts = "" - revision = "49ce2735e5074ffc3f8190c8406cf51a96302dad" - version = "kubernetes-1.12.5" + revision = "2b1284ed4c93a43499e781493253e2ac5959c4fd" + version = "kubernetes-1.13.1" [[projects]] - digest = "1:203ee3d901467a9bfa00c1859438f168288431405b7a30c7c6f14f8391cafa6f" + digest = "1:d603c9957fa66c90792d45fe0205d484da2ea364a01069c20890f2640b4a0fd5" name = "k8s.io/client-go" packages = [ "discovery", @@ -851,6 +853,7 @@ "kubernetes/typed/apps/v1", "kubernetes/typed/apps/v1beta1", "kubernetes/typed/apps/v1beta2", + "kubernetes/typed/auditregistration/v1alpha1", "kubernetes/typed/authentication/v1", "kubernetes/typed/authentication/v1beta1", "kubernetes/typed/authorization/v1", @@ -919,8 +922,8 @@ "util/workqueue", ] pruneopts = "" - revision = "701b913670036511e3d752318272c97f1a2a2edd" - version = "kubernetes-1.12.5" + revision = "8d9ed539ba3134352c586810e749e58df4e94e4f" + version = "kubernetes-1.13.1" [[projects]] branch = "master" @@ -978,7 +981,7 @@ revision = "c2654d5206da6b7b6ace12841e8f359bb89b443c" [[projects]] - digest = "0:" + digest = "1:35fe7fc05f04f79af905348b757b440723f67534f873abfef906e1a64dfe9e64" name = "sigs.k8s.io/controller-runtime" packages = [ "pkg/cache", @@ -1007,11 +1010,12 @@ "pkg/source/internal", "pkg/webhook/admission", "pkg/webhook/admission/types", + "pkg/webhook/internal/metrics", "pkg/webhook/types", ] pruneopts = "" - revision = "" - version = "v0.1.8" + revision = "12d98582e72927b6cd0123e2b4e819f9341ce62c" + version = "v0.1.10" [[projects]] digest = "1:0fb3157cb64930e8fb7d5b3fbfcedb71b8b4b990d8babcc7c7cd28e1eb672e13" @@ -1062,7 +1066,8 @@ "github.com/openshift/cluster-api/pkg/client/clientset_generated/clientset", "github.com/openshift/cluster-api/pkg/controller/node", "github.com/openshift/cluster-autoscaler-operator/pkg/apis", - "github.com/openshift/cluster-autoscaler-operator/pkg/apis/autoscaling/v1alpha1", + "github.com/openshift/cluster-autoscaler-operator/pkg/apis/autoscaling/v1", + "github.com/openshift/cluster-autoscaler-operator/pkg/apis/autoscaling/v1beta1", "github.com/openshift/library-go/pkg/config/clusteroperator/v1helpers", "github.com/openshift/machine-api-operator/pkg/apis/healthchecking/v1alpha1", "github.com/openshift/machine-api-operator/pkg/generated/clientset/versioned", 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 880a08059..3f6235648 100644 --- a/vendor/github.com/openshift/cluster-api-actuator-pkg/Gopkg.toml +++ b/vendor/github.com/openshift/cluster-api-actuator-pkg/Gopkg.toml @@ -41,9 +41,13 @@ required = [ "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1beta1", ] +[[constraint]] + name = "github.com/openshift/api" + revision = "8e476cb7322e59919cbb6482fd076ec5a214df25" + [[constraint]] name = "github.com/openshift/cluster-api" - revision = "8b6a416a1830212712a6b03c5431afbd4f586d62" + branch = "openshift-4.0-cluster-api-0.0.0-alpha.4" [[constraint]] name = "github.com/openshift/cluster-autoscaler-operator" @@ -60,20 +64,20 @@ required = [ [[override]] name = "k8s.io/api" - version = "kubernetes-1.12.5" + version = "kubernetes-1.13.1" [[override]] name = "k8s.io/apiextensions-apiserver" - version = "kubernetes-1.12.5" + version = "kubernetes-1.13.1" [[override]] name = "k8s.io/apimachinery" - version = "kubernetes-1.12.5" + version = "kubernetes-1.13.1" [[override]] name = "k8s.io/client-go" - version = "kubernetes-1.12.5" + version = "kubernetes-1.13.1" [[override]] name = "k8s.io/kube-aggregator" - branch = "release-1.12" + branch = "release-1.13" diff --git a/vendor/github.com/openshift/cluster-api-actuator-pkg/Makefile b/vendor/github.com/openshift/cluster-api-actuator-pkg/Makefile index 2d4952d5f..dbf8725c0 100644 --- a/vendor/github.com/openshift/cluster-api-actuator-pkg/Makefile +++ b/vendor/github.com/openshift/cluster-api-actuator-pkg/Makefile @@ -45,22 +45,21 @@ build-e2e: .PHONY: test-e2e test-e2e: ## Run openshift specific e2e test - go test -timeout 90m \ - -v github.com/openshift/cluster-api-actuator-pkg/pkg/e2e \ - -kubeconfig $${KUBECONFIG:-~/.kube/config} \ - -machine-api-namespace $${NAMESPACE:-openshift-machine-api} \ - -ginkgo.v \ - -args -v 5 -logtostderr true + # Run operator tests first to preserve logs for troubleshooting test + # failures and flakes. + # Feature:Operator tests remove deployments. Thus loosing all the logs + # previously acquired. + hack/ci-integration.sh -ginkgo.v -ginkgo.noColor=true -ginkgo.focus "Feature:Operators" + hack/ci-integration.sh -ginkgo.v -ginkgo.noColor=true -ginkgo.skip "Feature:Operators" .PHONY: k8s-e2e k8s-e2e: ## Run k8s specific e2e test - go test -timeout 30m \ - -v github.com/openshift/cluster-api-actuator-pkg/pkg/e2e \ - -kubeconfig $${KUBECONFIG:-~/.kube/config} \ - -machine-api-namespace $${NAMESPACE:-kube-system} \ - -ginkgo.v \ - -args -v 5 -logtostderr true - + # Run operator tests first to preserve logs for troubleshooting test + # failures and flakes. + # Feature:Operator tests remove deployments. Thus loosing all the logs + # previously acquired. + NAMESPACE=kube-system hack/ci-integration.sh -ginkgo.v -ginkgo.noColor=true -ginkgo.focus "Feature:Operators" + NAMESPACE=kube-system hack/ci-integration.sh -ginkgo.v -ginkgo.noColor=true -ginkgo.skip "Feature:Operators" .PHONY: help help: diff --git a/vendor/github.com/openshift/cluster-api-actuator-pkg/pkg/e2e/autoscaler/autoscaler.go b/vendor/github.com/openshift/cluster-api-actuator-pkg/pkg/e2e/autoscaler/autoscaler.go index 91efaf168..3fd410bdf 100644 --- a/vendor/github.com/openshift/cluster-api-actuator-pkg/pkg/e2e/autoscaler/autoscaler.go +++ b/vendor/github.com/openshift/cluster-api-actuator-pkg/pkg/e2e/autoscaler/autoscaler.go @@ -10,7 +10,8 @@ import ( o "github.com/onsi/gomega" e2e "github.com/openshift/cluster-api-actuator-pkg/pkg/e2e/framework" mapiv1beta1 "github.com/openshift/cluster-api/pkg/apis/machine/v1beta1" - caov1alpha1 "github.com/openshift/cluster-autoscaler-operator/pkg/apis/autoscaling/v1alpha1" + caov1 "github.com/openshift/cluster-autoscaler-operator/pkg/apis/autoscaling/v1" + caov1beta1 "github.com/openshift/cluster-autoscaler-operator/pkg/apis/autoscaling/v1beta1" batchv1 "k8s.io/api/batch/v1" corev1 "k8s.io/api/core/v1" "k8s.io/apimachinery/pkg/api/resource" @@ -61,7 +62,7 @@ func newWorkLoad() *batchv1.Job { }, RestartPolicy: corev1.RestartPolicy("Never"), NodeSelector: map[string]string{ - "node-role.kubernetes.io/worker": "", + e2e.WorkerNodeRoleLabel: "", }, Tolerations: []corev1.Toleration{ { @@ -123,9 +124,9 @@ func labelMachineSetNodes(client runtimeclient.Client, ms *mapiv1beta1.MachineSe } // Build default CA resource to allow fast scaling up and down -func clusterAutoscalerResource() *caov1alpha1.ClusterAutoscaler { +func clusterAutoscalerResource() *caov1.ClusterAutoscaler { tenSecondString := "10s" - return &caov1alpha1.ClusterAutoscaler{ + return &caov1.ClusterAutoscaler{ ObjectMeta: metav1.ObjectMeta{ Name: "default", Namespace: e2e.TestContext.MachineApiNamespace, @@ -135,10 +136,10 @@ func clusterAutoscalerResource() *caov1alpha1.ClusterAutoscaler { }, TypeMeta: metav1.TypeMeta{ Kind: "ClusterAutoscaler", - APIVersion: "autoscaling.openshift.io/v1alpha1", + APIVersion: "autoscaling.openshift.io/v1", }, - Spec: caov1alpha1.ClusterAutoscalerSpec{ - ScaleDown: &caov1alpha1.ScaleDownConfig{ + Spec: caov1.ClusterAutoscalerSpec{ + ScaleDown: &caov1.ScaleDownConfig{ Enabled: true, DelayAfterAdd: &tenSecondString, DelayAfterDelete: &tenSecondString, @@ -150,8 +151,8 @@ func clusterAutoscalerResource() *caov1alpha1.ClusterAutoscaler { } // Build MA resource from targeted machineset -func machineAutoscalerResource(targetMachineSet *mapiv1beta1.MachineSet, minReplicas, maxReplicas int32) *caov1alpha1.MachineAutoscaler { - return &caov1alpha1.MachineAutoscaler{ +func machineAutoscalerResource(targetMachineSet *mapiv1beta1.MachineSet, minReplicas, maxReplicas int32) *caov1beta1.MachineAutoscaler { + return &caov1beta1.MachineAutoscaler{ ObjectMeta: metav1.ObjectMeta{ GenerateName: fmt.Sprintf("autoscale-%s", targetMachineSet.Name), Namespace: e2e.TestContext.MachineApiNamespace, @@ -161,12 +162,12 @@ func machineAutoscalerResource(targetMachineSet *mapiv1beta1.MachineSet, minRepl }, TypeMeta: metav1.TypeMeta{ Kind: "MachineAutoscaler", - APIVersion: "autoscaling.openshift.io/v1alpha1", + APIVersion: "autoscaling.openshift.io/v1beta1", }, - Spec: caov1alpha1.MachineAutoscalerSpec{ + Spec: caov1beta1.MachineAutoscalerSpec{ MaxReplicas: maxReplicas, MinReplicas: minReplicas, - ScaleTargetRef: caov1alpha1.CrossVersionObjectReference{ + ScaleTargetRef: caov1beta1.CrossVersionObjectReference{ Name: targetMachineSet.Name, Kind: "MachineSet", APIVersion: "machine.openshift.io/v1beta1", @@ -195,7 +196,7 @@ var _ = g.Describe("[Feature:Machines] Autoscaler should", func() { glog.Info("Deleted workload object") } - err = e2e.DeleteObjectsByLabels(context.TODO(), client, map[string]string{autoscalingTestLabel: ""}, &caov1alpha1.MachineAutoscalerList{}) + err = e2e.DeleteObjectsByLabels(context.TODO(), client, map[string]string{autoscalingTestLabel: ""}, &caov1beta1.MachineAutoscalerList{}) if err != nil { // if this one fails, there are still other resources to be deleted. glog.Warning(err) @@ -203,7 +204,7 @@ var _ = g.Describe("[Feature:Machines] Autoscaler should", func() { glog.Info("Deleted machineAutoscaler object") } - err = e2e.DeleteObjectsByLabels(context.TODO(), client, map[string]string{autoscalingTestLabel: ""}, &caov1alpha1.ClusterAutoscalerList{}) + err = e2e.DeleteObjectsByLabels(context.TODO(), client, map[string]string{autoscalingTestLabel: ""}, &caov1.ClusterAutoscalerList{}) if err != nil { // if this one fails, there is no point of returning an error as this is the last resource deletion action glog.Warning(err) diff --git a/vendor/github.com/openshift/cluster-api-actuator-pkg/pkg/e2e/framework/common.go b/vendor/github.com/openshift/cluster-api-actuator-pkg/pkg/e2e/framework/common.go index 4249b92a1..a5f4c8434 100644 --- a/vendor/github.com/openshift/cluster-api-actuator-pkg/pkg/e2e/framework/common.go +++ b/vendor/github.com/openshift/cluster-api-actuator-pkg/pkg/e2e/framework/common.go @@ -6,7 +6,8 @@ import ( "time" mapiv1beta1 "github.com/openshift/cluster-api/pkg/apis/machine/v1beta1" - caov1alpha1 "github.com/openshift/cluster-autoscaler-operator/pkg/apis/autoscaling/v1alpha1" + caov1 "github.com/openshift/cluster-autoscaler-operator/pkg/apis/autoscaling/v1" + caov1beta1 "github.com/openshift/cluster-autoscaler-operator/pkg/apis/autoscaling/v1beta1" batchv1 "k8s.io/api/batch/v1" corev1 "k8s.io/api/core/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" @@ -15,11 +16,11 @@ import ( ) const ( - WorkerRoleLabel = "node-role.kubernetes.io/worker" - WaitShort = 1 * time.Minute - WaitMedium = 3 * time.Minute - WaitLong = 10 * time.Minute - RetryMedium = 5 * time.Second + WorkerNodeRoleLabel = "node-role.kubernetes.io/worker" + WaitShort = 1 * time.Minute + WaitMedium = 3 * time.Minute + WaitLong = 10 * time.Minute + RetryMedium = 5 * time.Second // DefaultMachineSetReplicas is the default number of replicas of a machineset // if MachineSet.Spec.Replicas field is set to nil @@ -88,8 +89,8 @@ func GetMachine(ctx context.Context, client runtimeclient.Client, machineName st // DeleteObjectsByLabels list all objects of a given kind by labels and deletes them. // Currently supported kinds: -// - caov1alpha1.MachineAutoscalerList -// - caov1alpha1.ClusterAutoscalerList +// - caov1beta1.MachineAutoscalerList +// - caov1.ClusterAutoscalerList // - batchv1.JobList func DeleteObjectsByLabels(ctx context.Context, client runtimeclient.Client, labels map[string]string, list runtime.Object) error { if err := client.List(ctx, runtimeclient.MatchingLabels(labels), list); err != nil { @@ -99,11 +100,11 @@ func DeleteObjectsByLabels(ctx context.Context, client runtimeclient.Client, lab // TODO(jchaloup): find a way how to list the items independent of a kind var objs []runtime.Object switch d := list.(type) { - case *caov1alpha1.MachineAutoscalerList: + case *caov1beta1.MachineAutoscalerList: for _, item := range d.Items { objs = append(objs, runtime.Object(&item)) } - case *caov1alpha1.ClusterAutoscalerList: + case *caov1.ClusterAutoscalerList: for _, item := range d.Items { objs = append(objs, runtime.Object(&item)) } 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 26ecf23ed..1c8667ed3 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 @@ -436,7 +436,7 @@ func IsNodeReady(node *corev1.Node) bool { } func WaitUntilAllNodesAreReady(client runtimeclient.Client) error { - return wait.PollImmediate(1*time.Second, time.Minute, func() (bool, error) { + return wait.PollImmediate(1*time.Second, PoolNodesReadyTimeout, func() (bool, error) { nodeList := corev1.NodeList{} if err := client.List(context.TODO(), &runtimeclient.ListOptions{}, &nodeList); err != nil { glog.Errorf("error querying api for nodeList object: %v, retrying...", err) diff --git a/vendor/github.com/openshift/cluster-api-actuator-pkg/pkg/e2e/framework/machinehealthcheck.go b/vendor/github.com/openshift/cluster-api-actuator-pkg/pkg/e2e/framework/machinehealthcheck.go index 27200e345..5bd8c4219 100644 --- a/vendor/github.com/openshift/cluster-api-actuator-pkg/pkg/e2e/framework/machinehealthcheck.go +++ b/vendor/github.com/openshift/cluster-api-actuator-pkg/pkg/e2e/framework/machinehealthcheck.go @@ -16,8 +16,6 @@ import ( const ( // KubeletKillerPodName contains the name of the pod that stops kubelet process KubeletKillerPodName = "kubelet-killer" - // NodeWorkerLabel contains label that every worker node has - NodeWorkerLabel = "node-role.kubernetes.io/worker" // MachineHealthCheckName contains the name of the machinehealthcheck used for tests MachineHealthCheckName = "workers-check" ) 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 079ff97ff..6508af6a7 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 @@ -2,6 +2,7 @@ package framework import ( "bytes" + "context" "fmt" "strings" @@ -9,12 +10,19 @@ import ( "github.com/openshift/cluster-api-actuator-pkg/pkg/types" machinev1beta1 "github.com/openshift/cluster-api/pkg/apis/machine/v1beta1" + mapiv1beta1 "github.com/openshift/cluster-api/pkg/apis/machine/v1beta1" + controllernode "github.com/openshift/cluster-api/pkg/controller/node" + apiv1 "k8s.io/api/core/v1" + corev1 "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/cache" "k8s.io/client-go/tools/clientcmd" + + runtimeclient "sigs.k8s.io/controller-runtime/pkg/client" ) func (f *Framework) DeleteMachineAndWait(machine *machinev1beta1.Machine, client types.CloudProviderClient) { @@ -242,6 +250,29 @@ func (f *Framework) WaitForNodesToGetReady(count int) error { }) } +// GetMachineFromNode returns the machine referenced by the "controllernode.MachineAnnotationKey" annotation in the given node +func GetMachineFromNode(client runtimeclient.Client, node *corev1.Node) (*mapiv1beta1.Machine, error) { + machineNamespaceKey, ok := node.Annotations[controllernode.MachineAnnotationKey] + if !ok { + return nil, fmt.Errorf("node %q does not have a MachineAnnotationKey %q", node.Name, controllernode.MachineAnnotationKey) + } + namespace, machineName, err := cache.SplitMetaNamespaceKey(machineNamespaceKey) + if err != nil { + return nil, fmt.Errorf("machine annotation format is incorrect %v: %v", machineNamespaceKey, err) + } + + if namespace != TestContext.MachineApiNamespace { + return nil, fmt.Errorf("Machine %q is forbidden to live outside of default %v namespace", machineNamespaceKey, TestContext.MachineApiNamespace) + } + + machine, err := GetMachine(context.TODO(), client, machineName) + if err != nil { + return nil, fmt.Errorf("error querying api for machine object: %v", err) + } + + return machine, nil +} + func ReadKubeconfigFromServer(sshConfig *SSHConfig) (string, error) { client, err := createSSHClient(sshConfig) if err != nil { diff --git a/vendor/github.com/openshift/cluster-api-actuator-pkg/pkg/e2e/infra/infra.go b/vendor/github.com/openshift/cluster-api-actuator-pkg/pkg/e2e/infra/infra.go index 6e639a481..6bddb342a 100644 --- a/vendor/github.com/openshift/cluster-api-actuator-pkg/pkg/e2e/infra/infra.go +++ b/vendor/github.com/openshift/cluster-api-actuator-pkg/pkg/e2e/infra/infra.go @@ -26,8 +26,8 @@ import ( ) var nodeDrainLabels = map[string]string{ - e2e.WorkerRoleLabel: "", - "node-draining-test": string(uuid.NewUUID()), + e2e.WorkerNodeRoleLabel: "", + "node-draining-test": string(uuid.NewUUID()), } func replicationControllerWorkload(namespace string) *corev1.ReplicationController { @@ -94,6 +94,36 @@ func podDisruptionBudget(namespace string) *kpolicyapi.PodDisruptionBudget { } } +func invalidMachinesetWithEmptyProviderConfig() *mapiv1beta1.MachineSet { + var oneReplicas int32 = 1 + return &mapiv1beta1.MachineSet{ + ObjectMeta: metav1.ObjectMeta{ + Name: "invalid-machineset", + Namespace: e2e.TestContext.MachineApiNamespace, + }, + Spec: mapiv1beta1.MachineSetSpec{ + Replicas: &oneReplicas, + Selector: metav1.LabelSelector{ + MatchLabels: map[string]string{ + "little-kitty": "i-am-little-kitty", + }, + }, + Template: mapiv1beta1.MachineTemplateSpec{ + ObjectMeta: metav1.ObjectMeta{ + Labels: map[string]string{ + "big-kitty": "i-am-bit-kitty", + }, + }, + Spec: mapiv1beta1.MachineSpec{ + // Empty providerSpec!!! we don't want to provision real instances. + // Just to observe how many machine replicas get created. + ProviderSpec: mapiv1beta1.ProviderSpec{}, + }, + }, + }, + } +} + var _ = g.Describe("[Feature:Machines] Managed cluster should", func() { defer g.GinkgoRecover() @@ -195,9 +225,13 @@ var _ = g.Describe("[Feature:Machines] Managed cluster should", func() { err = waitForClusterSizeToBeHealthy(client, initialClusterSize) o.Expect(err).NotTo(o.HaveOccurred()) - workerNode, err := getWorkerNode(client) + g.By("getting worker node") + workerNodes, err := e2e.GetWorkerNodes(client) o.Expect(err).NotTo(o.HaveOccurred()) - workerMachine, err := getMachineFromNode(client, workerNode) + o.Expect(workerNodes).ToNot(o.BeEmpty()) + + workerNode := &workerNodes[0] + workerMachine, err := e2e.GetMachineFromNode(client, workerNode) o.Expect(err).NotTo(o.HaveOccurred()) g.By(fmt.Sprintf("deleting machine object %q", workerMachine.Name)) err = deleteMachine(client, workerMachine) @@ -446,4 +480,53 @@ var _ = g.Describe("[Feature:Machines] Managed cluster should", func() { o.Expect(err).NotTo(o.HaveOccurred()) }) + + g.It("reject invalid machinesets", func() { + var err error + client, err := e2e.LoadClient() + o.Expect(err).NotTo(o.HaveOccurred()) + + g.By("Creating invalid machineset") + invalidMachineSet := invalidMachinesetWithEmptyProviderConfig() + + err = client.Create(context.TODO(), invalidMachineSet) + o.Expect(err).NotTo(o.HaveOccurred()) + + g.By("Waiting for ReconcileError MachineSet event") + err = wait.PollImmediate(e2e.RetryMedium, e2e.WaitShort, func() (bool, error) { + eventList := corev1.EventList{} + if err := client.List(context.TODO(), nil, &eventList); err != nil { + glog.Errorf("error querying api for eventList object: %v, retrying...", err) + return false, nil + } + + glog.Infof("Fetching ReconcileError MachineSet invalid-machineset event") + for _, event := range eventList.Items { + if event.Reason != "ReconcileError" || event.InvolvedObject.Kind != "MachineSet" || event.InvolvedObject.Name != invalidMachineSet.Name { + continue + } + + glog.Infof("Found ReconcileError event for %q machine set with the following message: %v", event.InvolvedObject.Name, event.Message) + return true, nil + } + + return false, nil + }) + o.Expect(err).NotTo(o.HaveOccurred()) + + // Verify the number of machines does not grow over time. + // The assumption is once the ReconcileError event is recorded and caught, + // the machineset is not reconciled again until it's updated. + machineList := &mapiv1beta1.MachineList{} + err = client.List(context.TODO(), runtimeclient.MatchingLabels(invalidMachineSet.Spec.Template.Labels), machineList) + o.Expect(err).NotTo(o.HaveOccurred()) + + g.By(fmt.Sprintf("Verify no machine from %q machineset were created", invalidMachineSet.Name)) + glog.Infof("Have %v machines generated from %q machineset", len(machineList.Items), invalidMachineSet.Name) + o.Expect(len(machineList.Items)).To(o.BeNumerically("==", 0)) + + g.By("Deleting invalid machineset") + err = client.Delete(context.TODO(), invalidMachineSet) + o.Expect(err).NotTo(o.HaveOccurred()) + }) }) diff --git a/vendor/github.com/openshift/cluster-api-actuator-pkg/pkg/e2e/infra/utils.go b/vendor/github.com/openshift/cluster-api-actuator-pkg/pkg/e2e/infra/utils.go index e638d916b..8e499f2a1 100644 --- a/vendor/github.com/openshift/cluster-api-actuator-pkg/pkg/e2e/infra/utils.go +++ b/vendor/github.com/openshift/cluster-api-actuator-pkg/pkg/e2e/infra/utils.go @@ -19,16 +19,14 @@ import ( "k8s.io/client-go/discovery" "k8s.io/client-go/dynamic" "k8s.io/client-go/scale" - "k8s.io/client-go/tools/cache" "k8s.io/utils/pointer" runtimeclient "sigs.k8s.io/controller-runtime/pkg/client" "sigs.k8s.io/controller-runtime/pkg/client/apiutil" ) const ( - nodeWorkerRoleLabel = "node-role.kubernetes.io/worker" - machineRoleLabel = "machine.openshift.io/cluster-api-machine-role" - machineAPIGroup = "machine.openshift.io" + machineRoleLabel = "machine.openshift.io/cluster-api-machine-role" + machineAPIGroup = "machine.openshift.io" ) func isOneMachinePerNode(client runtimeclient.Client) bool { @@ -124,29 +122,6 @@ func getMachinesFromMachineSet(client runtimeclient.Client, machineSet mapiv1bet return machinesForSet, nil } -// getMachineFromNode returns the machine referenced by the "controllernode.MachineAnnotationKey" annotation in the given node -func getMachineFromNode(client runtimeclient.Client, node *corev1.Node) (*mapiv1beta1.Machine, error) { - machineNamespaceKey, ok := node.Annotations[controllernode.MachineAnnotationKey] - if !ok { - return nil, fmt.Errorf("node %q does not have a MachineAnnotationKey %q", node.Name, controllernode.MachineAnnotationKey) - } - namespace, machineName, err := cache.SplitMetaNamespaceKey(machineNamespaceKey) - if err != nil { - return nil, fmt.Errorf("machine annotation format is incorrect %v: %v", machineNamespaceKey, err) - } - - if namespace != e2e.TestContext.MachineApiNamespace { - return nil, fmt.Errorf("Machine %q is forbidden to live outside of default %v namespace", machineNamespaceKey, e2e.TestContext.MachineApiNamespace) - } - - machine, err := e2e.GetMachine(context.TODO(), client, machineName) - if err != nil { - return nil, fmt.Errorf("error querying api for machine object: %v", err) - } - - return machine, nil -} - // deleteMachine deletes a specific machine and returns an error otherwise func deleteMachine(client runtimeclient.Client, machine *mapiv1beta1.Machine) error { return wait.PollImmediate(1*time.Second, time.Minute, func() (bool, error) { @@ -193,28 +168,6 @@ func getNodeFromMachine(client runtimeclient.Client, machine *mapiv1beta1.Machin return &node, nil } -// getWorkerNode returns a node with the nodeWorkerRoleLabel label -func getWorkerNode(client runtimeclient.Client) (*corev1.Node, error) { - nodeList := corev1.NodeList{} - listOptions := runtimeclient.ListOptions{} - listOptions.MatchingLabels(map[string]string{nodeWorkerRoleLabel: ""}) - if err := wait.PollImmediate(1*time.Second, time.Minute, func() (bool, error) { - if err := client.List(context.TODO(), &listOptions, &nodeList); err != nil { - glog.Errorf("Error querying api for nodeList object: %v, retrying...", err) - return false, nil - } - if len(nodeList.Items) < 1 { - glog.Errorf("No nodes were found with label %q", nodeWorkerRoleLabel) - return false, nil - } - return true, nil - }); err != nil { - glog.Errorf("Error calling getWorkerMachine: %v", err) - return nil, err - } - return &nodeList.Items[0], nil -} - // nodesAreReady returns true if an array of nodes are all ready func nodesAreReady(nodes []*corev1.Node) bool { // All nodes needs to be ready @@ -373,7 +326,7 @@ func waitUntilNodesAreReady(client runtimeclient.Client, listOpt *runtimeclient. // expecting nodeGroupSize nodes readyNodes := 0 for _, node := range nodes.Items { - if _, exists := node.Labels[e2e.WorkerRoleLabel]; !exists { + if _, exists := node.Labels[e2e.WorkerNodeRoleLabel]; !exists { continue } @@ -404,7 +357,7 @@ func waitUntilNodesAreDeleted(client runtimeclient.Client, listOpt *runtimeclien // expecting nodeGroupSize nodes nodeCounter := 0 for _, node := range nodes.Items { - if _, exists := node.Labels[e2e.WorkerRoleLabel]; !exists { + if _, exists := node.Labels[e2e.WorkerNodeRoleLabel]; !exists { continue } @@ -459,7 +412,7 @@ func verifyNodeDraining(client runtimeclient.Client, targetMachine *mapiv1beta1. return false, nil } if machine.Status.NodeRef == nil || machine.Status.NodeRef.Kind != "Node" { - glog.Error("Machine %q not linked to a node", machine.Name) + glog.Errorf("Machine %q not linked to a node", machine.Name) return false, nil } diff --git a/vendor/github.com/openshift/cluster-api-actuator-pkg/pkg/e2e/machinehealthcheck/machinehealthcheck.go b/vendor/github.com/openshift/cluster-api-actuator-pkg/pkg/e2e/machinehealthcheck/machinehealthcheck.go index abecd6853..d045dd6a9 100644 --- a/vendor/github.com/openshift/cluster-api-actuator-pkg/pkg/e2e/machinehealthcheck/machinehealthcheck.go +++ b/vendor/github.com/openshift/cluster-api-actuator-pkg/pkg/e2e/machinehealthcheck/machinehealthcheck.go @@ -57,49 +57,23 @@ var _ = Describe("[Feature:MachineHealthCheck] MachineHealthCheck controller", f client, err = e2e.LoadClient() Expect(err).ToNot(HaveOccurred()) - isKubemarkProvider, err := e2e.IsKubemarkProvider(client) - Expect(err).ToNot(HaveOccurred()) - if isKubemarkProvider { - glog.V(2).Info("Can not run this tests with the 'KubeMark' provider") - Skip("Can not run this tests with the 'KubeMark' provider") - } + // TODO: enable once https://github.com/openshift/cluster-api-actuator-pkg/pull/61 is fixed + glog.V(2).Info("Skipping machine health checking test") + Skip("Skipping machine health checking test") - listOptions := runtimeclient.ListOptions{ - Namespace: e2e.TestContext.MachineApiNamespace, - } - listOptions.SetLabelSelector(fmt.Sprintf("%s=", e2e.NodeWorkerLabel)) - workers := &corev1.NodeList{} - err = client.List(context.TODO(), &listOptions, workers) + workerNodes, err := e2e.GetWorkerNodes(client) Expect(err).ToNot(HaveOccurred()) - numberOfReadyWorkers = 0 - workerNode = nil - for i, w := range workers.Items { - readyCond := conditions.GetNodeCondition(&w, corev1.NodeReady) - if readyCond.Status == corev1.ConditionTrue { - numberOfReadyWorkers++ - if workerNode == nil { - workerNode = &workers.Items[i] - glog.V(2).Infof("Worker node %s", workerNode.Name) - } - } - } - Expect(workerNode).ToNot(BeNil()) + readyWorkerNodes := e2e.FilterReadyNodes(workerNodes) + Expect(readyWorkerNodes).ToNot(BeEmpty()) - listOptions = runtimeclient.ListOptions{ - Namespace: e2e.TestContext.MachineApiNamespace, - } - machineList := &mapiv1beta1.MachineList{} - err = client.List(context.TODO(), &listOptions, machineList) - Expect(err).ToNot(HaveOccurred()) + numberOfReadyWorkers = len(readyWorkerNodes) + workerNode = &readyWorkerNodes[0] + glog.V(2).Infof("Worker node %s", workerNode.Name) - for i, m := range machineList.Items { - if m.Status.NodeRef != nil && m.Status.NodeRef.Name == workerNode.Name { - workerMachine = &machineList.Items[i] - glog.V(2).Infof("Worker machine %s", workerMachine.Name) - } - } - Expect(workerMachine).ToNot(BeNil()) + workerMachine, err = e2e.GetMachineFromNode(client, workerNode) + Expect(err).ToNot(HaveOccurred()) + glog.V(2).Infof("Worker machine %s", workerMachine.Name) glog.V(2).Infof("Create machine health check with label selector: %s", workerMachine.Labels) err = e2e.CreateMachineHealthCheck(workerMachine.Labels) @@ -138,12 +112,9 @@ var _ = Describe("[Feature:MachineHealthCheck] MachineHealthCheck controller", f }) AfterEach(func() { - isKubemarkProvider, err := e2e.IsKubemarkProvider(client) - Expect(err).ToNot(HaveOccurred()) - if isKubemarkProvider { - glog.V(2).Info("Can not run this tests with the 'KubeMark' provider") - Skip("Can not run this tests with the 'KubeMark' provider") - } + // TODO: enable once https://github.com/openshift/cluster-api-actuator-pkg/pull/61 is fixed + glog.V(2).Info("Skipping machine health checking test") + Skip("Skipping machine health checking test") waitForWorkersToGetReady(numberOfReadyWorkers) deleteMachineHealthCheck(e2e.MachineHealthCheckName) @@ -176,28 +147,16 @@ func waitForWorkersToGetReady(numberOfReadyWorkers int) { client, err := e2e.LoadClient() Expect(err).ToNot(HaveOccurred()) - listOptions := runtimeclient.ListOptions{ - Namespace: e2e.TestContext.MachineApiNamespace, - } - listOptions.SetLabelSelector(fmt.Sprintf("%s=", e2e.NodeWorkerLabel)) - workers := &corev1.NodeList{} glog.V(2).Infof("Wait until the environment will have %d ready workers", numberOfReadyWorkers) Eventually(func() bool { - err := client.List(context.TODO(), &listOptions, workers) + workerNodes, err := e2e.GetWorkerNodes(client) if err != nil { return false } - readyWorkers := 0 - for _, w := range workers.Items { - readyCond := conditions.GetNodeCondition(&w, corev1.NodeReady) - if readyCond.Status == corev1.ConditionTrue { - readyWorkers++ - } - } - - glog.V(2).Infof("Number of ready workers %d", readyWorkers) - return readyWorkers == numberOfReadyWorkers + readyWorkerNodes := e2e.FilterReadyNodes(workerNodes) + glog.V(2).Infof("Number of ready workers %d", len(readyWorkerNodes)) + return len(readyWorkerNodes) == numberOfReadyWorkers }, 15*time.Minute, 10*time.Second).Should(BeTrue()) } @@ -225,7 +184,7 @@ func deleteKubeletKillerPods() { listOptions := runtimeclient.ListOptions{ Namespace: e2e.TestContext.MachineApiNamespace, } - listOptions.SetLabelSelector(fmt.Sprintf("%s=", e2e.KubeletKillerPodName)) + listOptions.MatchingLabels(map[string]string{e2e.KubeletKillerPodName: ""}) podList := &corev1.PodList{} err = client.List(context.TODO(), &listOptions, podList) Expect(err).ToNot(HaveOccurred()) diff --git a/vendor/github.com/openshift/cluster-api-actuator-pkg/pkg/e2e/operators/machine-api-operator.go b/vendor/github.com/openshift/cluster-api-actuator-pkg/pkg/e2e/operators/machine-api-operator.go index 6c3f77590..c128b831a 100644 --- a/vendor/github.com/openshift/cluster-api-actuator-pkg/pkg/e2e/operators/machine-api-operator.go +++ b/vendor/github.com/openshift/cluster-api-actuator-pkg/pkg/e2e/operators/machine-api-operator.go @@ -8,6 +8,10 @@ import ( e2e "github.com/openshift/cluster-api-actuator-pkg/pkg/e2e/framework" ) +var ( + deploymentDeprecatedName = "clusterapi-manager-controllers" +) + var _ = g.Describe("[Feature:Operators] Machine API operator deployment should", func() { defer g.GinkgoRecover() @@ -23,9 +27,13 @@ var _ = g.Describe("[Feature:Operators] Machine API operator deployment should", client, err := e2e.LoadClient() o.Expect(err).NotTo(o.HaveOccurred()) - deploymentName := "clusterapi-manager-controllers" + deploymentName := "machine-api-controllers" initialDeployment, err := getDeployment(client, deploymentName) - o.Expect(err).NotTo(o.HaveOccurred()) + if err != nil { + initialDeployment, err = getDeployment(client, deploymentDeprecatedName) + o.Expect(err).NotTo(o.HaveOccurred()) + deploymentName = deploymentDeprecatedName + } g.By(fmt.Sprintf("checking deployment %q is available", deploymentName)) o.Expect(isDeploymentAvailable(client, deploymentName)).To(o.BeTrue()) @@ -37,7 +45,6 @@ var _ = g.Describe("[Feature:Operators] Machine API operator deployment should", g.By(fmt.Sprintf("checking deployment %q is available again", deploymentName)) o.Expect(isDeploymentAvailable(client, deploymentName)).To(o.BeTrue()) }) - }) var _ = g.Describe("[Feature:Operators] Machine API cluster operator status should", func() { diff --git a/vendor/github.com/openshift/cluster-api-actuator-pkg/pkg/e2e/operators/utils.go b/vendor/github.com/openshift/cluster-api-actuator-pkg/pkg/e2e/operators/utils.go index 19e9851b1..29adce076 100644 --- a/vendor/github.com/openshift/cluster-api-actuator-pkg/pkg/e2e/operators/utils.go +++ b/vendor/github.com/openshift/cluster-api-actuator-pkg/pkg/e2e/operators/utils.go @@ -45,7 +45,7 @@ func deleteDeployment(client runtimeclient.Client, deployment *kappsapi.Deployme } func isDeploymentAvailable(client runtimeclient.Client, name string) bool { - if err := wait.PollImmediate(1*time.Second, e2e.WaitShort, func() (bool, error) { + if err := wait.PollImmediate(1*time.Second, e2e.WaitLong, func() (bool, error) { d, err := getDeployment(client, name) if err != nil { glog.Errorf("Error getting deployment: %v", err) @@ -84,8 +84,8 @@ func isStatusAvailable(client runtimeclient.Client, name string) bool { glog.Errorf("Condition: %q is true", osconfigv1.OperatorProgressing) return false, nil } - if cov1helpers.IsStatusConditionTrue(clusterOperator.Status.Conditions, osconfigv1.OperatorFailing) { - glog.Errorf("Condition: %q is true", osconfigv1.OperatorFailing) + if cov1helpers.IsStatusConditionTrue(clusterOperator.Status.Conditions, osconfigv1.OperatorFailing) || cov1helpers.IsStatusConditionTrue(clusterOperator.Status.Conditions, osconfigv1.OperatorDegraded) { + glog.Errorf("Condition: %q is true", osconfigv1.OperatorDegraded) return false, nil } return true, nil 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 d5ead12d4..9f38ac1c0 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 @@ -948,7 +948,7 @@ func TestingMachine(clusterID string, namespace string, providerSpec machinev1be Namespace: namespace, GenerateName: "vs-master-", Labels: map[string]string{ - "sigs.k8s.io/cluster-api-cluster": clusterID, + "machine.openshift.io/cluster-api-cluster": clusterID, }, }, Spec: machinev1beta1.MachineSpec{ @@ -976,7 +976,7 @@ func MasterMachine(clusterID, namespace string, providerSpec machinev1beta1.Prov Namespace: namespace, GenerateName: "vs-master-", Labels: map[string]string{ - "sigs.k8s.io/cluster-api-cluster": clusterID, + "machine.openshift.io/cluster-api-cluster": clusterID, }, }, Spec: machinev1beta1.MachineSpec{ @@ -1050,14 +1050,14 @@ func WorkerMachineSet(clusterID, namespace string, providerSpec machinev1beta1.P Namespace: namespace, GenerateName: clusterID + "-worker-machine-" + randomUUID[:6] + "-", Labels: map[string]string{ - "sigs.k8s.io/cluster-api-cluster": clusterID, + "machine.openshift.io/cluster-api-cluster": clusterID, }, }, Spec: machinev1beta1.MachineSetSpec{ Selector: metav1.LabelSelector{ MatchLabels: map[string]string{ - "sigs.k8s.io/cluster-api-machineset": clusterID + "-worker-machineset-" + randomUUID[:6], - "sigs.k8s.io/cluster-api-cluster": clusterID, + "machine.openshift.io/cluster-api-machineset": clusterID + "-worker-machineset-" + randomUUID[:6], + "machine.openshift.io/cluster-api-cluster": clusterID, }, }, Replicas: &replicas, @@ -1065,8 +1065,8 @@ func WorkerMachineSet(clusterID, namespace string, providerSpec machinev1beta1.P ObjectMeta: metav1.ObjectMeta{ GenerateName: clusterID + "-worker-machine-" + randomUUID[:6] + "-", Labels: map[string]string{ - "sigs.k8s.io/cluster-api-machineset": clusterID + "-worker-machineset-" + randomUUID[:6], - "sigs.k8s.io/cluster-api-cluster": clusterID, + "machine.openshift.io/cluster-api-machineset": clusterID + "-worker-machineset-" + randomUUID[:6], + "machine.openshift.io/cluster-api-cluster": clusterID, }, }, Spec: machinev1beta1.MachineSpec{ diff --git a/vendor/github.com/openshift/cluster-api-actuator-pkg/pkg/manifests/userdata.go b/vendor/github.com/openshift/cluster-api-actuator-pkg/pkg/manifests/userdata.go index 2a47a02e6..e96468770 100644 --- a/vendor/github.com/openshift/cluster-api-actuator-pkg/pkg/manifests/userdata.go +++ b/vendor/github.com/openshift/cluster-api-actuator-pkg/pkg/manifests/userdata.go @@ -19,7 +19,7 @@ setenforce 0 yum install -y docker systemctl enable docker systemctl start docker -yum install -y kubelet-1.11.3 kubeadm-1.11.3 kubectl-1.11.3 --disableexcludes=kubernetes +yum install -y kubelet-1.12.3 kubeadm-1.12.3 kubectl-1.12.3 kubernetes-cni-0.6.0-0 --disableexcludes=kubernetes cat < /etc/default/kubelet KUBELET_KUBEADM_EXTRA_ARGS=--cgroup-driver=systemd @@ -70,7 +70,7 @@ setenforce 0 yum install -y docker systemctl enable docker systemctl start docker -yum install -y kubelet-1.11.3 kubeadm-1.11.3 --disableexcludes=kubernetes +yum install -y kubelet-1.12.3 kubeadm-1.12.3 kubernetes-cni-0.6.0-0 --disableexcludes=kubernetes cat < /etc/default/kubelet KUBELET_KUBEADM_EXTRA_ARGS=--cgroup-driver=systemd diff --git a/vendor/github.com/openshift/cluster-autoscaler-operator/Gopkg.lock b/vendor/github.com/openshift/cluster-autoscaler-operator/Gopkg.lock index 93f4722c7..8d470fec1 100644 --- a/vendor/github.com/openshift/cluster-autoscaler-operator/Gopkg.lock +++ b/vendor/github.com/openshift/cluster-autoscaler-operator/Gopkg.lock @@ -1,14 +1,6 @@ # This file is autogenerated, do not edit; changes may be undone by the next 'dep ensure'. -[[projects]] - digest = "1:2173c429b0c4654deb4f3e8d1f503c374f93a6b5549d74f9cba797c1e787f8e4" - name = "cloud.google.com/go" - packages = ["compute/metadata"] - pruneopts = "NT" - revision = "c9474f2f8deb81759839474b6bd1726bbfe1c1c4" - version = "v0.36.0" - [[projects]] digest = "1:0a111edd8693fd977f42a0c4f199a0efb13c20aec9da99ad8830c7bb6a87e8d6" name = "github.com/PuerkitoBio/purell" @@ -25,6 +17,14 @@ pruneopts = "NT" revision = "de5bf2ad457846296e2031421a34e2568e304e35" +[[projects]] + digest = "1:680b63a131506e668818d630d3ca36123ff290afa0afc9f4be21940adca3f27d" + name = "github.com/appscode/jsonpatch" + packages = ["."] + pruneopts = "NT" + revision = "7c0e3b262f30165a8ec3d0b4c6059fd92703bfb2" + version = "1.0.0" + [[projects]] branch = "master" digest = "1:c819830f4f5ef85874a90ac3cbcc96cd322c715f5c96fbe4722eacd3dafbaa07" @@ -50,15 +50,23 @@ version = "v1.1.1" [[projects]] - digest = "1:2453249730493850718f891fb40b8f1bc932a0265384fc85b269dc04a01d4673" + digest = "1:1302bdd23af4264a095d48c2c28660a8ecf2e02454ce172cef5cb946029a1383" name = "github.com/emicklei/go-restful" packages = [ ".", "log", ] pruneopts = "NT" - revision = "85d198d05a92d31823b852b4a5928114912e8949" - version = "v2.9.0" + revision = "b9bbc5664f49b6deec52393bd68f39830687a347" + version = "v2.9.3" + +[[projects]] + digest = "1:820227d03dc661d34f837f3704626d2837dbfbf9f0ec8fdf1f58e683dc5f56fc" + name = "github.com/evanphx/json-patch" + packages = ["."] + pruneopts = "NT" + revision = "72bf35d0ff611848c1dc9df0f976c81192392fa5" + version = "v4.1.0" [[projects]] digest = "1:81466b4218bf6adddac2572a30ac733a9255919bc2f470b4827a317bd4ee1756" @@ -69,20 +77,20 @@ version = "v1.0.0" [[projects]] - branch = "master" digest = "1:d421af4c4fe51d399667d573982d663fe1fa67020a88d3ae43466ebfe8e2b5c9" name = "github.com/go-logr/logr" packages = ["."] pruneopts = "NT" revision = "9fb12b3b21c5415d16ac18dc5cd42c1cfdd40c4e" + version = "v0.1.0" [[projects]] digest = "1:340497a512995aa69c0add901d79a2096b3449d35a44a6f1f1115091a9f8c687" name = "github.com/go-logr/zapr" packages = ["."] pruneopts = "NT" - revision = "7536572e8d55209135cd5e7ccf7fce43dca217ab" - version = "v0.1.0" + revision = "03f06a783fbb7dfaf3f629c7825480e43a7105e6" + version = "v0.1.1" [[projects]] digest = "1:260f7ebefc63024c8dfe2c9f1a2935a89fa4213637a1f522f592f80c001cc441" @@ -90,7 +98,7 @@ packages = ["."] pruneopts = "NT" revision = "ef5f0afec364d3b9396b7b77b43dbe26bf1f8004" - version = "v0.18.0" + version = "v0.19.0" [[projects]] digest = "1:98abd61947ff5c7c6fcfec5473d02a4821ed3a2dd99a4fbfdb7925b0dd745546" @@ -98,23 +106,23 @@ packages = ["."] pruneopts = "NT" revision = "8483a886a90412cd6858df4ea3483dce9c8e35a3" - version = "v0.18.0" + version = "v0.19.0" [[projects]] - digest = "1:4da4ea0a664ba528965683d350f602d0f11464e6bb2e17aad0914723bc25d163" + digest = "1:8f80caf2fa31f78a035f33981c9685013033073b53f344f579e60fa69f0c6670" name = "github.com/go-openapi/spec" packages = ["."] pruneopts = "NT" - revision = "5b6cdde3200976e3ecceb2868706ee39b6aff3e4" - version = "v0.18.0" + revision = "53d776530bf78a11b03a7b52dd8a083086b045e5" + version = "v0.19.0" [[projects]] - digest = "1:dc0f590770e5a6c70ea086232324f7b7dc4857c60eca63ab8ff78e0a5cfcdbf3" + digest = "1:076ebf43e6e70f18ef9d079a685ede59a0f4dc9247256c209cf57407f959cef9" name = "github.com/go-openapi/swag" packages = ["."] pruneopts = "NT" - revision = "1d29f06aebd59ccdf11ae04aa0334ded96e2d909" - version = "v0.18.0" + revision = "b3e2804c8535ee0d1b89320afd98474d5b8e9e3b" + version = "v0.19.0" [[projects]] digest = "1:0b39706cfa32c1ba9e14435b5844d04aef81b60f44b6077e61e0607d56692603" @@ -144,7 +152,7 @@ revision = "5b532d6fd5efaf7fa130d4e859a2fde0fc3a9e1b" [[projects]] - digest = "1:2bac1ab777481a7ef169837f0eeac25a1a6628ac93aef853168681dfec4a653c" + digest = "1:d7212166c4b7f30a20fb3de70ab7e36564900b2e36360ffd31958b5af8fed025" name = "github.com/golang/protobuf" packages = [ "proto", @@ -154,16 +162,16 @@ "ptypes/timestamp", ] pruneopts = "NT" - revision = "c823c79ea1570fb5ff454033735a8e68575d1d0f" - version = "v1.3.0" + revision = "b5d812f8a3706043e23a9cd5babf2e5423744d30" + version = "v1.3.1" [[projects]] - branch = "master" digest = "1:05f95ffdfcf651bdb0f05b40b69e7f5663047f8da75c72d58728acb59b5cc107" name = "github.com/google/btree" packages = ["."] pruneopts = "NT" revision = "4030bb1f1f0c35b30ca7009e9ebd06849dd45306" + version = "v1.0.0" [[projects]] branch = "master" @@ -238,16 +246,16 @@ version = "v0.3.7" [[projects]] - digest = "1:1d39c063244ad17c4b18e8da1551163b6ffb52bd1640a49a8ec5c3b7bf4dbd5d" + digest = "1:0fbdc0dfdabfa16d50dd7151b7efe3189ffb0df68fa9866dc35240bfea39ad92" name = "github.com/json-iterator/go" packages = ["."] pruneopts = "NT" - revision = "1624edc4454b8682399def8740d46db5e4362ba4" - version = "v1.1.5" + revision = "0ff49de124c6f76f8494e194af75bde0f1a49a29" + version = "v1.1.6" [[projects]] branch = "master" - digest = "1:4925ec3736ef6c299cfcf61597782e3d66ec13114f7476019d04c742a7be55d0" + digest = "1:1832b664bdd6ff3139a8590c907044d7d440cd10fa46979d89fe98a11b75b256" name = "github.com/mailru/easyjson" packages = [ "buffer", @@ -255,15 +263,7 @@ "jwriter", ] pruneopts = "NT" - revision = "6243d8e04c3f819e79757e8bc3faa15c3cb27003" - -[[projects]] - branch = "master" - digest = "1:0e9bfc47ab9941ecc3344e580baca5deb4091177e84dd9773b48b38ec26b93d5" - name = "github.com/mattbaird/jsonpatch" - packages = ["."] - pruneopts = "NT" - revision = "81af80346b1a01caae0cbc27fd3c1ba5b11e189f" + revision = "1de009706dbeb9d05f18586f0735fcdb7c524481" [[projects]] digest = "1:ea1db000388d88b31db7531c83016bef0d6db0d908a07794bfc36aca16fbf935" @@ -290,7 +290,7 @@ version = "1.0.1" [[projects]] - digest = "1:0204417af2b5c56719f7e2809902c9a56ebb1b539d73ba520eeac84e98f21b72" + digest = "1:545744762d3d6d59328a38e44f571baaeda30184b88b43a28879bedf7711afa5" name = "github.com/onsi/ginkgo" packages = [ ".", @@ -313,11 +313,11 @@ "types", ] pruneopts = "NT" - revision = "2e1be8f7d90e9d3e3e58b0ce470f2f14d075406f" - version = "v1.7.0" + revision = "eea6ad008b96acdaa524f5b409513bf062b500ad" + version = "v1.8.0" [[projects]] - digest = "1:7efa6868c0394e8567b411d9160f10376d6f28926c5786d520f3603bc3e18198" + digest = "1:9f353a779b8b118229dfc1541e41d72d1a3a6f2d13756f5fe66daeb0f52191ab" name = "github.com/onsi/gomega" packages = [ ".", @@ -334,23 +334,22 @@ "types", ] pruneopts = "NT" - revision = "65fb64232476ad9046e57c26cd0bff3d3a8dc6cd" - version = "v1.4.3" + revision = "90e289841c1ed79b7a598a7cd9959750cb5e89e2" + version = "v1.5.0" [[projects]] - branch = "master" - digest = "1:d81228aec193f40dc8ed219ebd607a88dac61bed2b12f8003a588ce5aa74c91d" + digest = "1:089d12b21181b39d795d8e62e1197ec1ea61afe393f0d2abf12339d888d7357e" name = "github.com/openshift/api" packages = [ "config/v1", "security/v1", ] pruneopts = "NT" - revision = "c58918e29f89383d2e1467bad7156e2b0c49497f" + revision = "8e476cb7322e59919cbb6482fd076ec5a214df25" [[projects]] branch = "master" - digest = "1:020cce845c0b03af242c1490f1e300c1dc02c64c7fdf6423af70462e90b34617" + digest = "1:a5aa6d074656d7cd97b9e1744f2c79244b8bc37ffb67cb31c47298010092c881" name = "github.com/openshift/client-go" packages = [ "config/clientset/versioned", @@ -360,10 +359,11 @@ "config/clientset/versioned/typed/config/v1/fake", ] pruneopts = "NT" - revision = "31ef839c86359881d2c312c4f0131febc6662400" + revision = "7cc0953bbbb7925e30232c056606d666942bb542" [[projects]] - digest = "1:8dd66f623f950b0b5d91c96e8eb469f4b7eb506c371136ce1e7b4408398cdddb" + branch = "openshift-4.0-cluster-api-0.0.0-alpha.4" + digest = "1:9b3599b2a72b85979c01c1991927dda9517417e23d72a070fad86b4fbda54bd5" name = "github.com/openshift/cluster-api" packages = [ "pkg/apis/cluster/common", @@ -379,40 +379,54 @@ "pkg/util", ] pruneopts = "NT" - revision = "0c3e884db79556cf786aa8436f5be977ef10c211" + revision = "5e580f96e63e5db1fc8095ca5f587716a4a8d9e9" [[projects]] branch = "master" - digest = "1:fda26b4b3cc8dc89575c57b4c141db0cf03051c65a7296e143683e1bd8aa9962" + digest = "1:eafab113b2b239ce2084185e26910539af8762ce72d6b64ddf465fa9a1c312d9" name = "github.com/openshift/cluster-api-actuator-pkg" packages = [ "pkg/e2e", - "pkg/e2e/actuators", "pkg/e2e/autoscaler", "pkg/e2e/framework", "pkg/e2e/infra", + "pkg/e2e/machinehealthcheck", "pkg/e2e/operators", "pkg/manifests", "pkg/types", ] pruneopts = "N" - revision = "6da15dab1653f3bc0d878366ce9f7c91e4ba08d0" + revision = "cd01e806d9c5624889678f4893da3d228a791a2e" [[projects]] branch = "master" - digest = "1:225f3203c014b4b8c94b89c0b6003997e502c670b224fbbb868053c79c6a4a47" + digest = "1:67bee13d597afd627a9eb8c126765b1ce852a1846cfdda7fe573b4725a8ed9ad" name = "github.com/openshift/cluster-version-operator" packages = ["lib/resourcemerge"] pruneopts = "NT" - revision = "70c0232ed95e4b0e0cd78efdcdec6f2410f592bb" + revision = "f355f763fb0a1fc0fd016b02d7b043e64bdb8938" [[projects]] branch = "master" - digest = "1:e3844be1ab2695aa21d64bde33812079709600cd8ad5a91018a7c1bf07a32089" + digest = "1:009f4e6c084242edc88223d0f2a4cfeaec47ebdb5e8b93314c52eb5fbf421063" name = "github.com/openshift/library-go" packages = ["pkg/config/clusteroperator/v1helpers"] pruneopts = "NT" - revision = "0e0c8d01a19e8a9f2e517596557f4494a2490d88" + revision = "dab26bb3a8dc7fccde7227194af755bbff30ce5d" + +[[projects]] + digest = "1:92a5a6bfc5b3b2cb1189f6408de941646b366cb67a11b3b7513d56ccd7cbd7c0" + name = "github.com/openshift/machine-api-operator" + packages = [ + "pkg/apis/healthchecking", + "pkg/apis/healthchecking/v1alpha1", + "pkg/generated/clientset/versioned", + "pkg/generated/clientset/versioned/scheme", + "pkg/generated/clientset/versioned/typed/healthchecking/v1alpha1", + "pkg/util/conditions", + ] + pruneopts = "NT" + revision = "9650e16c98802a4b57b7551201b0973fcae2f738" [[projects]] digest = "1:93b1d84c5fa6d1ea52f4114c37714cddd84d5b78f151b62bb101128dd51399bf" @@ -488,17 +502,11 @@ [[projects]] branch = "master" - digest = "1:1c282f5c094061ce301d1ea3098799fc907ac1399e9f064c463787323a7b7340" + digest = "1:75f1b9f32d4d204eac68f3427bc4642453fb4fe20f1596ec058757f01dc16e7b" name = "github.com/prometheus/procfs" - packages = [ - ".", - "internal/util", - "iostats", - "nfs", - "xfs", - ] + packages = ["."] pruneopts = "NT" - revision = "bbced9601137e764853b2fad7ec3e2dc4c504e02" + revision = "ea9eea63887261e4d8ed8315f4078e88d540c725" [[projects]] digest = "1:9d8420bbf131d1618bde6530af37c3799340d3762cc47210c1d9532a4c3a2779" @@ -549,7 +557,7 @@ [[projects]] branch = "master" - digest = "1:cb5a25c74941338785e146140b698349d96c78599c6d7e9570a4725303a85c91" + digest = "1:2c0b9b49d155596fecc071bce8db372c193f638265c11ab24914aae99fcfa704" name = "golang.org/x/crypto" packages = [ "curve25519", @@ -562,11 +570,11 @@ "ssh/terminal", ] pruneopts = "NT" - revision = "31a38585487a4b1fd6ff4f8f3db26f1fb296ac82" + revision = "a5d413f7728c81fb97d96a2b722368945f651e78" [[projects]] branch = "master" - digest = "1:7514a961568b6f5d2a114b82de007f4714a27c65dffc71433fe8620a8a9db708" + digest = "1:318eeba3eb64a2c2b6fdaa988b6d08dadde9ec7b6ff909d72dd87735be65f7d9" name = "golang.org/x/net" packages = [ "context", @@ -580,32 +588,30 @@ "idna", ] pruneopts = "NT" - revision = "c95aed5357e77a4bf7d3955c46740000a17adee1" + revision = "74de082e2cca95839e88aa0aeee5aadf6ce7710f" [[projects]] branch = "master" - digest = "1:3418b2325cb0e56bb54774c4e484a2d8829b1fe4bad1c5f077cfd08d138a9a9f" + digest = "1:54c605b4036ec49dbc4c887969128d5ee68140cf0bbec46e67cbb2497e69c15e" name = "golang.org/x/oauth2" packages = [ ".", - "google", "internal", - "jws", - "jwt", ] pruneopts = "NT" - revision = "e64efc72b421e893cbf63f17ba2221e7d6d0b0f3" + revision = "9f3314589c9a9136388751d9adae6b0ed400978a" [[projects]] branch = "master" - digest = "1:f2c030d3f273165fb333d1b402a60f9c9afa4e9c167465596ac88d79c799602f" + digest = "1:e2fd9ef1691f1a2731d69db8b523d1b6c88ec583f56e3bd40e3468948b5418e6" name = "golang.org/x/sys" packages = [ + "cpu", "unix", "windows", ] pruneopts = "NT" - revision = "92a0ff1e1e2f61773648454ec71ec0c0f1c700a2" + revision = "baf5eb976a8cd65845293cd814ea151018552292" [[projects]] digest = "1:8c74f97396ed63cc2ef04ebb5fc37bb032871b8fd890a25991ed40974b00cd2a" @@ -649,16 +655,15 @@ name = "golang.org/x/time" packages = ["rate"] pruneopts = "NT" - revision = "85acf8d2951cb2a3bde7632f9ff273ef0379bcbd" + revision = "9d24e82272b4f38b78bc8cff74fa936d31ccd8ef" [[projects]] branch = "master" - digest = "1:509a5a08fc8545a714ac3ffbad721fd03fb2936aa31c8d12a74641f7b3303095" + digest = "1:e9de94093a593289a2816dcac941c8c7d63007a407f3727bb6777d7b793c308f" name = "golang.org/x/tools" packages = [ "go/ast/astutil", "go/gcexportdata", - "go/internal/cgo", "go/internal/gcimporter", "go/internal/packagesdriver", "go/packages", @@ -670,26 +675,23 @@ "internal/semver", ] pruneopts = "NT" - revision = "f0a709d59f0fd2d705cf7767149e23a7a99f585b" + revision = "202502a5a9245830b5ec7b877e26b67760da8e67" [[projects]] - digest = "1:902ffa11f1d8c19c12b05cabffe69e1a16608ad03a8899ebcb9c6bde295660ae" + digest = "1:711179d92dbef98932acd7afd0dab80b4cf2d97f099f3285c9ba8fa451809fec" name = "google.golang.org/appengine" packages = [ - ".", "internal", - "internal/app_identity", "internal/base", "internal/datastore", "internal/log", - "internal/modules", "internal/remote_api", "internal/urlfetch", "urlfetch", ] pruneopts = "NT" - revision = "e9657d882bb81064595ca3b56cbe2546bbabf7b1" - version = "v1.4.0" + revision = "54a98f90d1c46b7731eb8fb305d2a321c30ef610" + version = "v1.5.0" [[projects]] digest = "1:1b91ae0dc69a41d4c2ed23ea5cffb721ea63f5037ca4b81e6d6771fbb8f45129" @@ -725,7 +727,7 @@ version = "v2.2.2" [[projects]] - digest = "1:b3f8152a68d73095a40fdcf329a93fc42e8eadb3305171df23fdb6b4e41a6417" + digest = "1:18b9b70bdf29da610c0df032cf60ee7526a48756fa44012cc639dcb557335cbc" name = "k8s.io/api" packages = [ "admission/v1beta1", @@ -734,6 +736,7 @@ "apps/v1", "apps/v1beta1", "apps/v1beta2", + "auditregistration/v1alpha1", "authentication/v1", "authentication/v1beta1", "authorization/v1", @@ -762,11 +765,11 @@ "storage/v1beta1", ] pruneopts = "NT" - revision = "6db15a15d2d3874a6c3ddb2140ac9f3bc7058428" - version = "kubernetes-1.12.5" + revision = "5cb15d34447165a97c76ed5a60e4e99c8a01ecfe" + version = "kubernetes-1.13.4" [[projects]] - digest = "1:82b4765488fd2a8bcefb93e196fdbfe342d33b16ae073a6f51bb4fb13e81e102" + digest = "1:c6f23048e162e65d586c809fd02e263e180ad157f110df17437c22517bb59a4b" name = "k8s.io/apiextensions-apiserver" packages = [ "pkg/apis/apiextensions", @@ -776,11 +779,12 @@ "pkg/client/clientset/clientset/typed/apiextensions/v1beta1", ] pruneopts = "NT" - revision = "a384d17938fe55d54a52d5668bf0ff40044daef0" - version = "kubernetes-1.12.5" + revision = "d002e88f6236312f0289d9d1deab106751718ff0" + source = "https://github.com/openshift/kubernetes-apiextensions-apiserver.git" + version = "kubernetes-1.13.4" [[projects]] - digest = "1:14a6fa7d7afcbaa4dc8dcc7db435f7e176e51ed97f67a1ff7f05f6421a92c7c6" + digest = "1:f44b5a32a31245ea062cd397cc343bda06d75c731596589996c1f77634e653af" name = "k8s.io/apimachinery" packages = [ "pkg/api/equality", @@ -816,6 +820,7 @@ "pkg/util/mergepatch", "pkg/util/naming", "pkg/util/net", + "pkg/util/rand", "pkg/util/runtime", "pkg/util/sets", "pkg/util/strategicpatch", @@ -830,11 +835,11 @@ "third_party/forked/golang/reflect", ] pruneopts = "NT" - revision = "49ce2735e5074ffc3f8190c8406cf51a96302dad" - version = "kubernetes-1.12.5" + revision = "86fb29eff6288413d76bd8506874fddd9fccdff0" + version = "kubernetes-1.13.4" [[projects]] - digest = "1:9aef72dc639ffc347ab8b81dc74d85ad12c64708e8bf8cdc43fac17b6018585d" + digest = "1:7f28bbfb5889618ab038d4d250d7adb6762aa43b2fc120a95a1cd47c68af6dd4" name = "k8s.io/client-go" packages = [ "discovery", @@ -847,6 +852,7 @@ "kubernetes/typed/apps/v1", "kubernetes/typed/apps/v1beta1", "kubernetes/typed/apps/v1beta2", + "kubernetes/typed/auditregistration/v1alpha1", "kubernetes/typed/authentication/v1", "kubernetes/typed/authentication/v1beta1", "kubernetes/typed/authorization/v1", @@ -878,7 +884,6 @@ "pkg/apis/clientauthentication/v1beta1", "pkg/version", "plugin/pkg/client/auth/exec", - "plugin/pkg/client/auth/gcp", "rest", "rest/watch", "restmapper", @@ -891,7 +896,6 @@ "scale/scheme/extensionsint", "scale/scheme/extensionsv1beta1", "testing", - "third_party/forked/golang/template", "tools/auth", "tools/cache", "tools/clientcmd", @@ -911,16 +915,15 @@ "util/flowcontrol", "util/homedir", "util/integer", - "util/jsonpath", "util/retry", "util/workqueue", ] pruneopts = "NT" - revision = "701b913670036511e3d752318272c97f1a2a2edd" - version = "kubernetes-1.12.5" + revision = "b40b2a5939e43f7ffe0028ad67586b7ce50bb675" + version = "kubernetes-1.13.4" [[projects]] - digest = "1:26b81b5e76e3f84ea5140da4f74649576e470f79091d2ef8e0d1b5000bc636ca" + digest = "1:dc1ae99dcab96913d81ae970b1f7a7411a54199b14bfb17a7e86f9a56979c720" name = "k8s.io/code-generator" packages = [ "cmd/client-gen", @@ -944,17 +947,15 @@ "cmd/lister-gen", "cmd/lister-gen/args", "cmd/lister-gen/generators", - "cmd/openapi-gen", - "cmd/openapi-gen/args", "pkg/util", ] pruneopts = "T" - revision = "b1289fc74931d4b6b04bd1a259acfc88a2cb0a66" - version = "kubernetes-1.12.5" + revision = "c2090bec4d9b1fb25de3812f868accc2bc9ecbae" + version = "kubernetes-1.13.4" [[projects]] branch = "master" - digest = "1:4e07c417d966628ee9e471354ad5e311c9c25ff357d42fd0dd2f81a40caf6aad" + digest = "1:be219f9a8b4ec4488dc55bb2b321e801193f37b8b0825c015ec389a7de011a90" name = "k8s.io/gengo" packages = [ "args", @@ -967,7 +968,7 @@ "types", ] pruneopts = "NT" - revision = "0689ccc1d7d65d9dd1bedcc3b0b1ed7df91ba266" + revision = "e17681d19d3ac4837a019ece36c2a0ec31ffe985" [[projects]] digest = "1:29f93bb84d907a2c035e729e19d66fe52165d8c905cb3ef1920140d76ae6afaf" @@ -978,30 +979,26 @@ version = "v0.2.0" [[projects]] - branch = "release-1.12" - digest = "1:66169f83260a0fa4b15ab886113f1accad6e9bc1c7fb94a99aef1c9c064d1ae9" + digest = "1:51450ed83182dd52f7c3724fa6dd5415b30935df31e1fb7b8239ae8da58236b7" name = "k8s.io/kube-aggregator" packages = [ "pkg/apis/apiregistration", "pkg/apis/apiregistration/v1", ] pruneopts = "NT" - revision = "e77f03c95d650ebee799b6d828bc73e47310c0f1" + revision = "3e0149950b0e22a3b8579db52bd50e40d0dac10e" + version = "kubernetes-1.13.4" [[projects]] branch = "master" - digest = "1:4dbb9fa9ab4548516c842af1280f967b174f0e40590f37eee3451bba8de8d3d5" + digest = "1:0f43a164be6cf6da89cf03e0b40833f8a60b82c2752b6beeaf5951befd5867b7" name = "k8s.io/kube-openapi" packages = [ - "cmd/openapi-gen/args", "pkg/common", - "pkg/generators", - "pkg/generators/rules", "pkg/util/proto", - "pkg/util/sets", ] pruneopts = "NT" - revision = "d50a959ae76a85c7c262a9767ef29f37093c2b8a" + revision = "94e1e7b7574c44c4c0f2007de6fe617e259191f3" [[projects]] branch = "master" @@ -1012,7 +1009,7 @@ revision = "21c4ce38f2a793ec01e925ddc31216500183b773" [[projects]] - digest = "1:e03ddaf9f31bccbbb8c33eabad2c85025a95ca98905649fd744e0a54c630a064" + digest = "1:06035489efbd51ccface65fc878ceeb849aba05b2f9443c8993f363fc96e80ac" name = "sigs.k8s.io/controller-runtime" packages = [ "pkg/cache", @@ -1020,6 +1017,7 @@ "pkg/client", "pkg/client/apiutil", "pkg/client/config", + "pkg/client/fake", "pkg/controller", "pkg/controller/controllerutil", "pkg/event", @@ -1042,10 +1040,12 @@ "pkg/source/internal", "pkg/webhook/admission", "pkg/webhook/admission/types", + "pkg/webhook/internal/metrics", "pkg/webhook/types", ] pruneopts = "NT" - revision = "c63ebda0bf4be5f0a8abd4003e4ea546032545ba" + revision = "12d98582e72927b6cd0123e2b4e819f9341ce62c" + version = "v0.1.10" [[projects]] digest = "1:8730e0150dfb2b7e173890c8b9868e7a273082ef8e39f4940e3506a481cf895c" @@ -1061,26 +1061,23 @@ input-imports = [ "github.com/blang/semver", "github.com/go-openapi/spec", - "github.com/golang/glog", "github.com/onsi/ginkgo", "github.com/onsi/gomega", "github.com/openshift/api/config/v1", "github.com/openshift/client-go/config/clientset/versioned", "github.com/openshift/client-go/config/clientset/versioned/fake", "github.com/openshift/cluster-api-actuator-pkg/pkg/e2e", - "github.com/openshift/cluster-api-actuator-pkg/pkg/e2e/actuators", "github.com/openshift/cluster-api-actuator-pkg/pkg/e2e/autoscaler", "github.com/openshift/cluster-api-actuator-pkg/pkg/e2e/infra", + "github.com/openshift/cluster-api-actuator-pkg/pkg/e2e/machinehealthcheck", "github.com/openshift/cluster-api-actuator-pkg/pkg/e2e/operators", "github.com/openshift/cluster-version-operator/lib/resourcemerge", "github.com/stretchr/testify/assert", "k8s.io/api/apps/v1", - "k8s.io/api/batch/v1", "k8s.io/api/core/v1", "k8s.io/apimachinery/pkg/api/equality", "k8s.io/apimachinery/pkg/api/errors", "k8s.io/apimachinery/pkg/api/meta", - "k8s.io/apimachinery/pkg/api/resource", "k8s.io/apimachinery/pkg/apis/meta/v1", "k8s.io/apimachinery/pkg/apis/meta/v1/unstructured", "k8s.io/apimachinery/pkg/runtime", @@ -1088,19 +1085,20 @@ "k8s.io/apimachinery/pkg/types", "k8s.io/apimachinery/pkg/util/wait", "k8s.io/client-go/kubernetes/scheme", - "k8s.io/client-go/plugin/pkg/client/auth/gcp", - "k8s.io/client-go/rest", + "k8s.io/client-go/tools/record", + "k8s.io/client-go/tools/reference", "k8s.io/code-generator/cmd/client-gen", "k8s.io/code-generator/cmd/conversion-gen", "k8s.io/code-generator/cmd/deepcopy-gen", "k8s.io/code-generator/cmd/defaulter-gen", "k8s.io/code-generator/cmd/informer-gen", "k8s.io/code-generator/cmd/lister-gen", - "k8s.io/code-generator/cmd/openapi-gen", "k8s.io/gengo/args", + "k8s.io/klog", "k8s.io/kube-openapi/pkg/common", "sigs.k8s.io/controller-runtime/pkg/client", "sigs.k8s.io/controller-runtime/pkg/client/config", + "sigs.k8s.io/controller-runtime/pkg/client/fake", "sigs.k8s.io/controller-runtime/pkg/controller", "sigs.k8s.io/controller-runtime/pkg/controller/controllerutil", "sigs.k8s.io/controller-runtime/pkg/event", diff --git a/vendor/github.com/openshift/cluster-autoscaler-operator/Gopkg.toml b/vendor/github.com/openshift/cluster-autoscaler-operator/Gopkg.toml index 6392d51d4..25d564ec5 100644 --- a/vendor/github.com/openshift/cluster-autoscaler-operator/Gopkg.toml +++ b/vendor/github.com/openshift/cluster-autoscaler-operator/Gopkg.toml @@ -6,13 +6,12 @@ required = [ "k8s.io/code-generator/cmd/client-gen", "k8s.io/code-generator/cmd/lister-gen", "k8s.io/code-generator/cmd/informer-gen", - "k8s.io/code-generator/cmd/openapi-gen", "k8s.io/gengo/args", "github.com/openshift/cluster-api-actuator-pkg/pkg/e2e", - "github.com/openshift/cluster-api-actuator-pkg/pkg/e2e/actuators", "github.com/openshift/cluster-api-actuator-pkg/pkg/e2e/autoscaler", "github.com/openshift/cluster-api-actuator-pkg/pkg/e2e/infra", "github.com/openshift/cluster-api-actuator-pkg/pkg/e2e/operators", + "github.com/openshift/cluster-api-actuator-pkg/pkg/e2e/machinehealthcheck", "github.com/openshift/api/config/v1", "github.com/onsi/ginkgo", "github.com/onsi/gomega", @@ -23,38 +22,38 @@ required = [ [[override]] name = "github.com/openshift/cluster-autoscaler-operator" +[[override]] + name = "github.com/openshift/cluster-api-actuator-pkg" + branch = "master" + [[override]] name = "k8s.io/code-generator" - version = "kubernetes-1.12.5" + version = "kubernetes-1.13.4" [[override]] name = "k8s.io/api" - version = "kubernetes-1.12.5" + version = "kubernetes-1.13.4" [[override]] name = "k8s.io/apiextensions-apiserver" - version = "kubernetes-1.12.5" + source = "https://github.com/openshift/kubernetes-apiextensions-apiserver.git" + version = "kubernetes-1.13.4" [[override]] name = "k8s.io/apimachinery" - version = "kubernetes-1.12.5" + version = "kubernetes-1.13.4" [[override]] name = "k8s.io/client-go" - version = "kubernetes-1.12.5" + version = "kubernetes-1.13.4" [[override]] name = "k8s.io/kube-aggregator" - branch = "release-1.12" + version = "kubernetes-1.13.4" [[override]] name = "sigs.k8s.io/controller-runtime" - # version = "v0.1.8" # does not work, still pulls v.1.10 instead - revision = "c63ebda0bf4be5f0a8abd4003e4ea546032545ba" - -[[override]] - name = "github.com/openshift/api" - branch = "master" + version = "v0.1.10" [[override]] name = "github.com/openshift/client-go" @@ -83,5 +82,5 @@ required = [ go-tests = false [[constraint]] - branch = "master" - name = "github.com/golang/glog" + name = "k8s.io/klog" + version = "0.2.0" diff --git a/vendor/github.com/openshift/cluster-autoscaler-operator/Makefile b/vendor/github.com/openshift/cluster-autoscaler-operator/Makefile index 9d0f9ab0c..2d20396b3 100644 --- a/vendor/github.com/openshift/cluster-autoscaler-operator/Makefile +++ b/vendor/github.com/openshift/cluster-autoscaler-operator/Makefile @@ -42,16 +42,16 @@ generate: ## Code generation (requires operator-sdk >= v0.5.0) mkdir -p deploy/crds cp install/01_clusterautoscaler.crd.yaml \ - deploy/crds/autoscaling_v1alpha1_clusterautoscaler_crd.yaml + deploy/crds/autoscaling_v1_clusterautoscaler_crd.yaml cp install/02_machineautoscaler.crd.yaml \ - deploy/crds/autoscaling_v1alpha1_machineautoscaler_crd.yaml + deploy/crds/autoscaling_v1beta1_machineautoscaler_crd.yaml operator-sdk generate k8s operator-sdk generate openapi - cp deploy/crds/autoscaling_v1alpha1_clusterautoscaler_crd.yaml \ + cp deploy/crds/autoscaling_v1_clusterautoscaler_crd.yaml \ install/01_clusterautoscaler.crd.yaml - cp deploy/crds/autoscaling_v1alpha1_machineautoscaler_crd.yaml \ + cp deploy/crds/autoscaling_v1beta1_machineautoscaler_crd.yaml \ install/02_machineautoscaler.crd.yaml .PHONY: build @@ -70,6 +70,10 @@ push: .PHONY: check check: fmt vet lint test ## Check your code +.PHONY: check-pkg +check-pkg: + ./hack/verify-actuator-pkg.sh + .PHONY: test test: ## Run unit tests $(DOCKER_CMD) go test -race -cover ./... @@ -81,6 +85,7 @@ test-e2e: ## Run e2e tests -kubeconfig $${KUBECONFIG:-~/.kube/config} \ -machine-api-namespace $${NAMESPACE:-openshift-machine-api} \ -ginkgo.v \ + -ginkgo.noColor=true \ -args -v 5 -logtostderr true .PHONY: lint diff --git a/vendor/github.com/openshift/cluster-autoscaler-operator/cluster-autoscaler-operator-patch.yaml b/vendor/github.com/openshift/cluster-autoscaler-operator/cluster-autoscaler-operator-patch.yaml deleted file mode 100644 index 8fefa853a..000000000 --- a/vendor/github.com/openshift/cluster-autoscaler-operator/cluster-autoscaler-operator-patch.yaml +++ /dev/null @@ -1,22 +0,0 @@ ---- -apiVersion: apps/v1 -kind: Deployment -metadata: - name: cluster-autoscaler-operator - namespace: openshift-cluster-api -spec: - template: - spec: - containers: - - name: cluster-autoscaler-operator - image: quay.io/openshift/origin-cluster-autoscaler-operator:v4.0 - env: - - name: WATCH_NAMESPACE - value: kube-system - valueFrom: - - name: CLUSTER_AUTOSCALER_NAMESPACE - value: kube-system - valueFrom: - - name: LEADER_ELECTION_NAMESPACE - value: kube-system - valueFrom: diff --git a/vendor/github.com/openshift/cluster-autoscaler-operator/cmd/manager/main.go b/vendor/github.com/openshift/cluster-autoscaler-operator/cmd/manager/main.go index 0d8ba3a2c..0dd194cc9 100644 --- a/vendor/github.com/openshift/cluster-autoscaler-operator/cmd/manager/main.go +++ b/vendor/github.com/openshift/cluster-autoscaler-operator/cmd/manager/main.go @@ -4,31 +4,34 @@ import ( "flag" "runtime" - "github.com/golang/glog" "github.com/openshift/cluster-autoscaler-operator/pkg/operator" "github.com/openshift/cluster-autoscaler-operator/pkg/version" - _ "k8s.io/client-go/plugin/pkg/client/auth/gcp" + "k8s.io/klog" ) func printVersion() { - glog.Infof("Go Version: %s", runtime.Version()) - glog.Infof("Go OS/Arch: %s/%s", runtime.GOOS, runtime.GOARCH) - glog.Infof("Version: %s", version.String) + klog.Infof("Go Version: %s", runtime.Version()) + klog.Infof("Go OS/Arch: %s/%s", runtime.GOOS, runtime.GOARCH) + klog.Infof("Version: %s", version.String) } func main() { + klog.InitFlags(nil) + flag.Set("logtostderr", "true") + flag.Set("alsologtostderr", "true") flag.Parse() + printVersion() config := operator.ConfigFromEnvironment() operator, err := operator.New(config) if err != nil { - glog.Fatal(err) + klog.Fatal(err) } - glog.Info("Starting cluster-autoscaler-operator") + klog.Info("Starting cluster-autoscaler-operator") if err := operator.Start(); err != nil { - glog.Fatal(err) + klog.Fatal(err) } } diff --git a/vendor/github.com/openshift/cluster-autoscaler-operator/examples/clusterautoscaler.yaml b/vendor/github.com/openshift/cluster-autoscaler-operator/examples/clusterautoscaler.yaml index 1f06f459b..275f74063 100644 --- a/vendor/github.com/openshift/cluster-autoscaler-operator/examples/clusterautoscaler.yaml +++ b/vendor/github.com/openshift/cluster-autoscaler-operator/examples/clusterautoscaler.yaml @@ -1,5 +1,5 @@ --- -apiVersion: "autoscaling.openshift.io/v1alpha1" +apiVersion: "autoscaling.openshift.io/v1" kind: "ClusterAutoscaler" metadata: name: "default" @@ -13,6 +13,7 @@ spec: memory: min: 4 max: 256 + # GPU is optional and can be omitted gpus: - type: nvidia.com/gpu min: 0 @@ -22,6 +23,9 @@ spec: max: 4 scaleDown: enabled: true + # How long after scale up that scale down evaluation resumes - if omitted defaults to 10 minutes delayAfterAdd: 10s + # How long after node deletion that scale down evaluation resumes - if omitted defaults to 10 seconds delayAfterDelete: 10s + # How long after scale down failure that scale down evaluation resumes - if omitted defaults to 3 minutes delayAfterFailure: 10s diff --git a/vendor/github.com/openshift/cluster-autoscaler-operator/examples/machineautoscaler.yaml b/vendor/github.com/openshift/cluster-autoscaler-operator/examples/machineautoscaler.yaml index 941ac6b3b..d4d0d46d1 100644 --- a/vendor/github.com/openshift/cluster-autoscaler-operator/examples/machineautoscaler.yaml +++ b/vendor/github.com/openshift/cluster-autoscaler-operator/examples/machineautoscaler.yaml @@ -1,5 +1,5 @@ --- -apiVersion: "autoscaling.openshift.io/v1alpha1" +apiVersion: "autoscaling.openshift.io/v1beta1" kind: "MachineAutoscaler" metadata: name: "worker-us-east-1a" diff --git a/vendor/github.com/openshift/cluster-autoscaler-operator/install/01_clusterautoscaler.crd.yaml b/vendor/github.com/openshift/cluster-autoscaler-operator/install/01_clusterautoscaler.crd.yaml index 7367f4193..5391b1d66 100644 --- a/vendor/github.com/openshift/cluster-autoscaler-operator/install/01_clusterautoscaler.crd.yaml +++ b/vendor/github.com/openshift/cluster-autoscaler-operator/install/01_clusterautoscaler.crd.yaml @@ -105,8 +105,8 @@ spec: type: object status: type: object - version: v1alpha1 + version: v1 versions: - - name: v1alpha1 + - name: v1 served: true storage: true diff --git a/vendor/github.com/openshift/cluster-autoscaler-operator/install/02_machineautoscaler.crd.yaml b/vendor/github.com/openshift/cluster-autoscaler-operator/install/02_machineautoscaler.crd.yaml index 129f90bcb..4008d2492 100644 --- a/vendor/github.com/openshift/cluster-autoscaler-operator/install/02_machineautoscaler.crd.yaml +++ b/vendor/github.com/openshift/cluster-autoscaler-operator/install/02_machineautoscaler.crd.yaml @@ -88,8 +88,8 @@ spec: - name type: object type: object - version: v1alpha1 + version: v1beta1 versions: - - name: v1alpha1 + - name: v1beta1 served: true storage: true diff --git a/vendor/github.com/openshift/cluster-autoscaler-operator/kustomization.yaml b/vendor/github.com/openshift/cluster-autoscaler-operator/kustomization.yaml index 18d882c62..06e0640bb 100644 --- a/vendor/github.com/openshift/cluster-autoscaler-operator/kustomization.yaml +++ b/vendor/github.com/openshift/cluster-autoscaler-operator/kustomization.yaml @@ -13,4 +13,4 @@ resources: - install/04_deployment.yaml patches: -- cluster-autoscaler-operator-patch.yaml +- test/cluster-autoscaler-operator-patch.yaml diff --git a/vendor/github.com/openshift/cluster-autoscaler-operator/pkg/apis/addtoscheme_autoscaling_v1alpha1.go b/vendor/github.com/openshift/cluster-autoscaler-operator/pkg/apis/addtoscheme_autoscaling_v1alpha1.go deleted file mode 100644 index 85f3055cf..000000000 --- a/vendor/github.com/openshift/cluster-autoscaler-operator/pkg/apis/addtoscheme_autoscaling_v1alpha1.go +++ /dev/null @@ -1,10 +0,0 @@ -package apis - -import ( - "github.com/openshift/cluster-autoscaler-operator/pkg/apis/autoscaling/v1alpha1" -) - -func init() { - // Register the types with the Scheme so the components can map objects to GroupVersionKinds and back - AddToSchemes = append(AddToSchemes, v1alpha1.SchemeBuilder.AddToScheme) -} diff --git a/vendor/github.com/openshift/cluster-autoscaler-operator/pkg/apis/autoscaling/v1alpha1/clusterautoscaler_types.go b/vendor/github.com/openshift/cluster-autoscaler-operator/pkg/apis/autoscaling/v1alpha1/clusterautoscaler_types.go deleted file mode 100644 index 17cd80eff..000000000 --- a/vendor/github.com/openshift/cluster-autoscaler-operator/pkg/apis/autoscaling/v1alpha1/clusterautoscaler_types.go +++ /dev/null @@ -1,80 +0,0 @@ -package v1alpha1 - -import ( - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" -) - -func init() { - SchemeBuilder.Register(&ClusterAutoscaler{}, &ClusterAutoscalerList{}) -} - -// ClusterAutoscalerSpec defines the desired state of ClusterAutoscaler -type ClusterAutoscalerSpec struct { - ResourceLimits *ResourceLimits `json:"resourceLimits,omitempty"` - ScaleDown *ScaleDownConfig `json:"scaleDown,omitempty"` - MaxPodGracePeriod *int32 `json:"maxPodGracePeriod,omitempty"` - PodPriorityThreshold *int32 `json:"podPriorityThreshold,omitempty"` -} - -// ClusterAutoscalerStatus defines the observed state of ClusterAutoscaler -type ClusterAutoscalerStatus struct { - // TODO: Add status fields. -} - -// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object - -// ClusterAutoscaler is the Schema for the clusterautoscalers API -// +k8s:openapi-gen=true -// +kubebuilder:subresource:status -type ClusterAutoscaler struct { - metav1.TypeMeta `json:",inline"` - metav1.ObjectMeta `json:"metadata,omitempty"` - - Spec ClusterAutoscalerSpec `json:"spec,omitempty"` - Status ClusterAutoscalerStatus `json:"status,omitempty"` -} - -// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object - -// ClusterAutoscalerList contains a list of ClusterAutoscaler -type ClusterAutoscalerList struct { - metav1.TypeMeta `json:",inline"` - metav1.ListMeta `json:"metadata,omitempty"` - Items []ClusterAutoscaler `json:"items"` -} - -type ResourceLimits struct { - // +kubebuilder:validation:Minimum=0 - MaxNodesTotal *int32 `json:"maxNodesTotal,omitempty"` - Cores *ResourceRange `json:"cores,omitempty"` - Memory *ResourceRange `json:"memory,omitempty"` - GPUS []GPULimit `json:"gpus,omitempty"` -} - -type GPULimit struct { - // +kubebuilder:validation:MinLength=1 - Type string `json:"type"` - - // +kubebuilder:validation:Minimum=0 - Min int32 `json:"min"` - // +kubebuilder:validation:Minimum=1 - Max int32 `json:"max"` -} - -type ResourceRange struct { - // +kubebuilder:validation:Minimum=0 - Min int32 `json:"min"` - Max int32 `json:"max"` -} - -type ScaleDownConfig struct { - Enabled bool `json:"enabled"` - // +kubebuilder:validation:Pattern=([0-9]*(\.[0-9]*)?[a-z]+)+ - DelayAfterAdd *string `json:"delayAfterAdd,omitempty"` - // +kubebuilder:validation:Pattern=([0-9]*(\.[0-9]*)?[a-z]+)+ - DelayAfterDelete *string `json:"delayAfterDelete,omitempty"` - // +kubebuilder:validation:Pattern=([0-9]*(\.[0-9]*)?[a-z]+)+ - DelayAfterFailure *string `json:"delayAfterFailure,omitempty"` - // +kubebuilder:validation:Pattern=([0-9]*(\.[0-9]*)?[a-z]+)+ - UnneededTime *string `json:"unneededTime,omitempty"` -} diff --git a/vendor/github.com/openshift/cluster-autoscaler-operator/pkg/apis/autoscaling/v1alpha1/doc.go b/vendor/github.com/openshift/cluster-autoscaler-operator/pkg/apis/autoscaling/v1alpha1/doc.go deleted file mode 100644 index aec700e8a..000000000 --- a/vendor/github.com/openshift/cluster-autoscaler-operator/pkg/apis/autoscaling/v1alpha1/doc.go +++ /dev/null @@ -1,4 +0,0 @@ -// Package v1alpha1 contains API Schema definitions for the autoscaling v1alpha1 API group -// +k8s:deepcopy-gen=package,register -// +groupName=autoscaling.openshift.io -package v1alpha1 diff --git a/vendor/github.com/openshift/cluster-autoscaler-operator/pkg/apis/autoscaling/v1alpha1/machineautoscaler_types.go b/vendor/github.com/openshift/cluster-autoscaler-operator/pkg/apis/autoscaling/v1alpha1/machineautoscaler_types.go deleted file mode 100644 index eddf780ff..000000000 --- a/vendor/github.com/openshift/cluster-autoscaler-operator/pkg/apis/autoscaling/v1alpha1/machineautoscaler_types.go +++ /dev/null @@ -1,55 +0,0 @@ -package v1alpha1 - -import ( - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" -) - -func init() { - SchemeBuilder.Register(&MachineAutoscaler{}, &MachineAutoscalerList{}) -} - -// MachineAutoscalerSpec defines the desired state of MachineAutoscaler -type MachineAutoscalerSpec struct { - // +kubebuilder:validation:Minimum=0 - MinReplicas int32 `json:"minReplicas"` - // +kubebuilder:validation:Minimum=1 - MaxReplicas int32 `json:"maxReplicas"` - ScaleTargetRef CrossVersionObjectReference `json:"scaleTargetRef"` -} - -// MachineAutoscalerStatus defines the observed state of MachineAutoscaler -type MachineAutoscalerStatus struct { - LastTargetRef *CrossVersionObjectReference `json:"lastTargetRef,omitempty"` -} - -// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object - -// MachineAutoscaler is the Schema for the machineautoscalers API -// +k8s:openapi-gen=true -// +kubebuilder:subresource:status -type MachineAutoscaler struct { - metav1.TypeMeta `json:",inline"` - metav1.ObjectMeta `json:"metadata,omitempty"` - - Spec MachineAutoscalerSpec `json:"spec,omitempty"` - Status MachineAutoscalerStatus `json:"status,omitempty"` -} - -// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object - -// MachineAutoscalerList contains a list of MachineAutoscaler -type MachineAutoscalerList struct { - metav1.TypeMeta `json:",inline"` - metav1.ListMeta `json:"metadata,omitempty"` - Items []MachineAutoscaler `json:"items"` -} - -// CrossVersionObjectReference identifies another object by name, API version, -// and kind. -type CrossVersionObjectReference struct { - APIVersion string `json:"apiVersion,omitempty"` - // +kubebuilder:validation:MinLength=1 - Kind string `json:"kind"` - // +kubebuilder:validation:MinLength=1 - Name string `json:"name"` -} diff --git a/vendor/github.com/openshift/cluster-autoscaler-operator/pkg/apis/autoscaling/v1alpha1/register.go b/vendor/github.com/openshift/cluster-autoscaler-operator/pkg/apis/autoscaling/v1alpha1/register.go deleted file mode 100644 index b78b638f6..000000000 --- a/vendor/github.com/openshift/cluster-autoscaler-operator/pkg/apis/autoscaling/v1alpha1/register.go +++ /dev/null @@ -1,19 +0,0 @@ -// NOTE: Boilerplate only. Ignore this file. - -// Package v1alpha1 contains API Schema definitions for the autoscaling v1alpha1 API group -// +k8s:deepcopy-gen=package,register -// +groupName=autoscaling.openshift.io -package v1alpha1 - -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: "autoscaling.openshift.io", Version: "v1alpha1"} - - // SchemeBuilder is used to add go types to the GroupVersionKind scheme - SchemeBuilder = &scheme.Builder{GroupVersion: SchemeGroupVersion} -) diff --git a/vendor/github.com/openshift/cluster-autoscaler-operator/pkg/apis/autoscaling/v1alpha1/zz_generated.deepcopy.go b/vendor/github.com/openshift/cluster-autoscaler-operator/pkg/apis/autoscaling/v1alpha1/zz_generated.deepcopy.go deleted file mode 100644 index caa5902f3..000000000 --- a/vendor/github.com/openshift/cluster-autoscaler-operator/pkg/apis/autoscaling/v1alpha1/zz_generated.deepcopy.go +++ /dev/null @@ -1,357 +0,0 @@ -// +build !ignore_autogenerated - -/* -Copyright The Kubernetes Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -// Code generated by deepcopy-gen. DO NOT EDIT. - -package v1alpha1 - -import ( - runtime "k8s.io/apimachinery/pkg/runtime" -) - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *ClusterAutoscaler) DeepCopyInto(out *ClusterAutoscaler) { - *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 ClusterAutoscaler. -func (in *ClusterAutoscaler) DeepCopy() *ClusterAutoscaler { - if in == nil { - return nil - } - out := new(ClusterAutoscaler) - in.DeepCopyInto(out) - return out -} - -// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. -func (in *ClusterAutoscaler) 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 *ClusterAutoscalerList) DeepCopyInto(out *ClusterAutoscalerList) { - *out = *in - out.TypeMeta = in.TypeMeta - out.ListMeta = in.ListMeta - if in.Items != nil { - in, out := &in.Items, &out.Items - *out = make([]ClusterAutoscaler, len(*in)) - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) - } - } - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ClusterAutoscalerList. -func (in *ClusterAutoscalerList) DeepCopy() *ClusterAutoscalerList { - if in == nil { - return nil - } - out := new(ClusterAutoscalerList) - in.DeepCopyInto(out) - return out -} - -// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. -func (in *ClusterAutoscalerList) 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 *ClusterAutoscalerSpec) DeepCopyInto(out *ClusterAutoscalerSpec) { - *out = *in - if in.ResourceLimits != nil { - in, out := &in.ResourceLimits, &out.ResourceLimits - *out = new(ResourceLimits) - (*in).DeepCopyInto(*out) - } - if in.ScaleDown != nil { - in, out := &in.ScaleDown, &out.ScaleDown - *out = new(ScaleDownConfig) - (*in).DeepCopyInto(*out) - } - if in.MaxPodGracePeriod != nil { - in, out := &in.MaxPodGracePeriod, &out.MaxPodGracePeriod - *out = new(int32) - **out = **in - } - if in.PodPriorityThreshold != nil { - in, out := &in.PodPriorityThreshold, &out.PodPriorityThreshold - *out = new(int32) - **out = **in - } - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ClusterAutoscalerSpec. -func (in *ClusterAutoscalerSpec) DeepCopy() *ClusterAutoscalerSpec { - if in == nil { - return nil - } - out := new(ClusterAutoscalerSpec) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *ClusterAutoscalerStatus) DeepCopyInto(out *ClusterAutoscalerStatus) { - *out = *in - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ClusterAutoscalerStatus. -func (in *ClusterAutoscalerStatus) DeepCopy() *ClusterAutoscalerStatus { - if in == nil { - return nil - } - out := new(ClusterAutoscalerStatus) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *CrossVersionObjectReference) DeepCopyInto(out *CrossVersionObjectReference) { - *out = *in - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new CrossVersionObjectReference. -func (in *CrossVersionObjectReference) DeepCopy() *CrossVersionObjectReference { - if in == nil { - return nil - } - out := new(CrossVersionObjectReference) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *GPULimit) DeepCopyInto(out *GPULimit) { - *out = *in - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new GPULimit. -func (in *GPULimit) DeepCopy() *GPULimit { - if in == nil { - return nil - } - out := new(GPULimit) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *MachineAutoscaler) DeepCopyInto(out *MachineAutoscaler) { - *out = *in - out.TypeMeta = in.TypeMeta - in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) - out.Spec = in.Spec - in.Status.DeepCopyInto(&out.Status) - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new MachineAutoscaler. -func (in *MachineAutoscaler) DeepCopy() *MachineAutoscaler { - if in == nil { - return nil - } - out := new(MachineAutoscaler) - in.DeepCopyInto(out) - return out -} - -// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. -func (in *MachineAutoscaler) 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 *MachineAutoscalerList) DeepCopyInto(out *MachineAutoscalerList) { - *out = *in - out.TypeMeta = in.TypeMeta - out.ListMeta = in.ListMeta - if in.Items != nil { - in, out := &in.Items, &out.Items - *out = make([]MachineAutoscaler, len(*in)) - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) - } - } - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new MachineAutoscalerList. -func (in *MachineAutoscalerList) DeepCopy() *MachineAutoscalerList { - if in == nil { - return nil - } - out := new(MachineAutoscalerList) - in.DeepCopyInto(out) - return out -} - -// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. -func (in *MachineAutoscalerList) 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 *MachineAutoscalerSpec) DeepCopyInto(out *MachineAutoscalerSpec) { - *out = *in - out.ScaleTargetRef = in.ScaleTargetRef - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new MachineAutoscalerSpec. -func (in *MachineAutoscalerSpec) DeepCopy() *MachineAutoscalerSpec { - if in == nil { - return nil - } - out := new(MachineAutoscalerSpec) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *MachineAutoscalerStatus) DeepCopyInto(out *MachineAutoscalerStatus) { - *out = *in - if in.LastTargetRef != nil { - in, out := &in.LastTargetRef, &out.LastTargetRef - *out = new(CrossVersionObjectReference) - **out = **in - } - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new MachineAutoscalerStatus. -func (in *MachineAutoscalerStatus) DeepCopy() *MachineAutoscalerStatus { - if in == nil { - return nil - } - out := new(MachineAutoscalerStatus) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *ResourceLimits) DeepCopyInto(out *ResourceLimits) { - *out = *in - if in.MaxNodesTotal != nil { - in, out := &in.MaxNodesTotal, &out.MaxNodesTotal - *out = new(int32) - **out = **in - } - if in.Cores != nil { - in, out := &in.Cores, &out.Cores - *out = new(ResourceRange) - **out = **in - } - if in.Memory != nil { - in, out := &in.Memory, &out.Memory - *out = new(ResourceRange) - **out = **in - } - if in.GPUS != nil { - in, out := &in.GPUS, &out.GPUS - *out = make([]GPULimit, len(*in)) - copy(*out, *in) - } - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ResourceLimits. -func (in *ResourceLimits) DeepCopy() *ResourceLimits { - if in == nil { - return nil - } - out := new(ResourceLimits) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *ResourceRange) DeepCopyInto(out *ResourceRange) { - *out = *in - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ResourceRange. -func (in *ResourceRange) DeepCopy() *ResourceRange { - if in == nil { - return nil - } - out := new(ResourceRange) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *ScaleDownConfig) DeepCopyInto(out *ScaleDownConfig) { - *out = *in - if in.DelayAfterAdd != nil { - in, out := &in.DelayAfterAdd, &out.DelayAfterAdd - *out = new(string) - **out = **in - } - if in.DelayAfterDelete != nil { - in, out := &in.DelayAfterDelete, &out.DelayAfterDelete - *out = new(string) - **out = **in - } - if in.DelayAfterFailure != nil { - in, out := &in.DelayAfterFailure, &out.DelayAfterFailure - *out = new(string) - **out = **in - } - if in.UnneededTime != nil { - in, out := &in.UnneededTime, &out.UnneededTime - *out = new(string) - **out = **in - } - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ScaleDownConfig. -func (in *ScaleDownConfig) DeepCopy() *ScaleDownConfig { - if in == nil { - return nil - } - out := new(ScaleDownConfig) - in.DeepCopyInto(out) - return out -} diff --git a/vendor/github.com/openshift/cluster-autoscaler-operator/pkg/apis/autoscaling/v1alpha1/zz_generated.defaults.go b/vendor/github.com/openshift/cluster-autoscaler-operator/pkg/apis/autoscaling/v1alpha1/zz_generated.defaults.go deleted file mode 100644 index dd621a3ac..000000000 --- a/vendor/github.com/openshift/cluster-autoscaler-operator/pkg/apis/autoscaling/v1alpha1/zz_generated.defaults.go +++ /dev/null @@ -1,32 +0,0 @@ -// +build !ignore_autogenerated - -/* -Copyright 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 defaulter-gen. DO NOT EDIT. - -package v1alpha1 - -import ( - runtime "k8s.io/apimachinery/pkg/runtime" -) - -// RegisterDefaults adds defaulters functions to the given scheme. -// Public to allow building arbitrary schemes. -// All generated defaulters are covering - they call all nested defaulters. -func RegisterDefaults(scheme *runtime.Scheme) error { - return nil -} diff --git a/vendor/github.com/openshift/cluster-autoscaler-operator/pkg/apis/autoscaling/v1alpha1/zz_generated.openapi.go b/vendor/github.com/openshift/cluster-autoscaler-operator/pkg/apis/autoscaling/v1alpha1/zz_generated.openapi.go deleted file mode 100644 index 8270b2d18..000000000 --- a/vendor/github.com/openshift/cluster-autoscaler-operator/pkg/apis/autoscaling/v1alpha1/zz_generated.openapi.go +++ /dev/null @@ -1,107 +0,0 @@ -// +build !ignore_autogenerated - -// Code generated by openapi-gen. DO NOT EDIT. - -// This file was autogenerated by openapi-gen. Do not edit it manually! - -package v1alpha1 - -import ( - spec "github.com/go-openapi/spec" - common "k8s.io/kube-openapi/pkg/common" -) - -func GetOpenAPIDefinitions(ref common.ReferenceCallback) map[string]common.OpenAPIDefinition { - return map[string]common.OpenAPIDefinition{ - "github.com/openshift/cluster-autoscaler-operator/pkg/apis/autoscaling/v1alpha1.ClusterAutoscaler": schema_pkg_apis_autoscaling_v1alpha1_ClusterAutoscaler(ref), - "github.com/openshift/cluster-autoscaler-operator/pkg/apis/autoscaling/v1alpha1.MachineAutoscaler": schema_pkg_apis_autoscaling_v1alpha1_MachineAutoscaler(ref), - } -} - -func schema_pkg_apis_autoscaling_v1alpha1_ClusterAutoscaler(ref common.ReferenceCallback) common.OpenAPIDefinition { - return common.OpenAPIDefinition{ - Schema: spec.Schema{ - SchemaProps: spec.SchemaProps{ - Description: "ClusterAutoscaler is the Schema for the clusterautoscalers API", - Type: []string{"object"}, - Properties: map[string]spec.Schema{ - "kind": { - SchemaProps: spec.SchemaProps{ - 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{"string"}, - Format: "", - }, - }, - "apiVersion": { - SchemaProps: spec.SchemaProps{ - 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{"string"}, - Format: "", - }, - }, - "metadata": { - SchemaProps: spec.SchemaProps{ - Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.ObjectMeta"), - }, - }, - "spec": { - SchemaProps: spec.SchemaProps{ - Ref: ref("github.com/openshift/cluster-autoscaler-operator/pkg/apis/autoscaling/v1alpha1.ClusterAutoscalerSpec"), - }, - }, - "status": { - SchemaProps: spec.SchemaProps{ - Ref: ref("github.com/openshift/cluster-autoscaler-operator/pkg/apis/autoscaling/v1alpha1.ClusterAutoscalerStatus"), - }, - }, - }, - }, - }, - Dependencies: []string{ - "github.com/openshift/cluster-autoscaler-operator/pkg/apis/autoscaling/v1alpha1.ClusterAutoscalerSpec", "github.com/openshift/cluster-autoscaler-operator/pkg/apis/autoscaling/v1alpha1.ClusterAutoscalerStatus", "k8s.io/apimachinery/pkg/apis/meta/v1.ObjectMeta"}, - } -} - -func schema_pkg_apis_autoscaling_v1alpha1_MachineAutoscaler(ref common.ReferenceCallback) common.OpenAPIDefinition { - return common.OpenAPIDefinition{ - Schema: spec.Schema{ - SchemaProps: spec.SchemaProps{ - Description: "MachineAutoscaler is the Schema for the machineautoscalers API", - Type: []string{"object"}, - Properties: map[string]spec.Schema{ - "kind": { - SchemaProps: spec.SchemaProps{ - 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{"string"}, - Format: "", - }, - }, - "apiVersion": { - SchemaProps: spec.SchemaProps{ - 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{"string"}, - Format: "", - }, - }, - "metadata": { - SchemaProps: spec.SchemaProps{ - Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.ObjectMeta"), - }, - }, - "spec": { - SchemaProps: spec.SchemaProps{ - Ref: ref("github.com/openshift/cluster-autoscaler-operator/pkg/apis/autoscaling/v1alpha1.MachineAutoscalerSpec"), - }, - }, - "status": { - SchemaProps: spec.SchemaProps{ - Ref: ref("github.com/openshift/cluster-autoscaler-operator/pkg/apis/autoscaling/v1alpha1.MachineAutoscalerStatus"), - }, - }, - }, - }, - }, - Dependencies: []string{ - "github.com/openshift/cluster-autoscaler-operator/pkg/apis/autoscaling/v1alpha1.MachineAutoscalerSpec", "github.com/openshift/cluster-autoscaler-operator/pkg/apis/autoscaling/v1alpha1.MachineAutoscalerStatus", "k8s.io/apimachinery/pkg/apis/meta/v1.ObjectMeta"}, - } -} diff --git a/vendor/github.com/openshift/cluster-autoscaler-operator/pkg/controller/clusterautoscaler/clusterautoscaler.go b/vendor/github.com/openshift/cluster-autoscaler-operator/pkg/controller/clusterautoscaler/clusterautoscaler.go index 25d825280..279c69823 100644 --- a/vendor/github.com/openshift/cluster-autoscaler-operator/pkg/controller/clusterautoscaler/clusterautoscaler.go +++ b/vendor/github.com/openshift/cluster-autoscaler-operator/pkg/controller/clusterautoscaler/clusterautoscaler.go @@ -3,7 +3,7 @@ package clusterautoscaler import ( "fmt" - v1alpha1 "github.com/openshift/cluster-autoscaler-operator/pkg/apis/autoscaling/v1alpha1" + v1 "github.com/openshift/cluster-autoscaler-operator/pkg/apis/autoscaling/v1" ) // AutoscalerArg represents a command line argument to the cluster-autoscaler @@ -53,7 +53,7 @@ const ( // AutoscalerArgs returns a slice of strings representing command line arguments // to the cluster-autoscaler corresponding to the values in the given // ClusterAutoscaler resource. -func AutoscalerArgs(ca *v1alpha1.ClusterAutoscaler, cfg *Config) []string { +func AutoscalerArgs(ca *v1.ClusterAutoscaler, cfg *Config) []string { s := &ca.Spec args := []string{ @@ -87,7 +87,7 @@ func AutoscalerArgs(ca *v1alpha1.ClusterAutoscaler, cfg *Config) []string { // ScaleDownArgs returns a slice of strings representing command line arguments // to the cluster-autoscaler corresponding to the values in the given // ScaleDownConfig object. -func ScaleDownArgs(sd *v1alpha1.ScaleDownConfig) []string { +func ScaleDownArgs(sd *v1.ScaleDownConfig) []string { if !sd.Enabled { return []string{ScaleDownEnabledArg.Value(false)} } @@ -118,7 +118,7 @@ func ScaleDownArgs(sd *v1alpha1.ScaleDownConfig) []string { // ResourceArgs returns a slice of strings representing command line arguments // to the cluster-autoscaler corresponding to the values in the given // ResourceLimits object. -func ResourceArgs(rl *v1alpha1.ResourceLimits) []string { +func ResourceArgs(rl *v1.ResourceLimits) []string { args := []string{} if rl.MaxNodesTotal != nil { diff --git a/vendor/github.com/openshift/cluster-autoscaler-operator/pkg/controller/clusterautoscaler/clusterautoscaler_controller.go b/vendor/github.com/openshift/cluster-autoscaler-operator/pkg/controller/clusterautoscaler/clusterautoscaler_controller.go index c0316bd93..eed126fcc 100644 --- a/vendor/github.com/openshift/cluster-autoscaler-operator/pkg/controller/clusterautoscaler/clusterautoscaler_controller.go +++ b/vendor/github.com/openshift/cluster-autoscaler-operator/pkg/controller/clusterautoscaler/clusterautoscaler_controller.go @@ -4,8 +4,8 @@ import ( "context" "fmt" - "github.com/golang/glog" - autoscalingv1alpha1 "github.com/openshift/cluster-autoscaler-operator/pkg/apis/autoscaling/v1alpha1" + autoscalingv1 "github.com/openshift/cluster-autoscaler-operator/pkg/apis/autoscaling/v1" + "github.com/openshift/cluster-autoscaler-operator/pkg/util" appsv1 "k8s.io/api/apps/v1" corev1 "k8s.io/api/core/v1" "k8s.io/apimachinery/pkg/api/equality" @@ -14,6 +14,8 @@ import ( "k8s.io/apimachinery/pkg/runtime" "k8s.io/apimachinery/pkg/types" "k8s.io/client-go/tools/record" + "k8s.io/client-go/tools/reference" + "k8s.io/klog" "sigs.k8s.io/controller-runtime/pkg/client" "sigs.k8s.io/controller-runtime/pkg/controller" "sigs.k8s.io/controller-runtime/pkg/controller/controllerutil" @@ -27,7 +29,6 @@ import ( const ( controllerName = "cluster-autoscaler-controller" - criticalPod = "scheduler.alpha.kubernetes.io/critical-pod" caServiceAccount = "cluster-autoscaler" caPriorityClassName = "system-cluster-critical" ) @@ -101,7 +102,7 @@ func (r *Reconciler) AddToManager(mgr manager.Manager) error { } // Watch for changes to primary resource ClusterAutoscaler - err = c.Watch(&source.Kind{Type: &autoscalingv1alpha1.ClusterAutoscaler{}}, &handler.EnqueueRequestForObject{}, p) + err = c.Watch(&source.Kind{Type: &autoscalingv1.ClusterAutoscaler{}}, &handler.EnqueueRequestForObject{}, p) if err != nil { return err } @@ -109,7 +110,7 @@ func (r *Reconciler) AddToManager(mgr manager.Manager) error { // Watch for changes to secondary resources owned by a ClusterAutoscaler err = c.Watch(&source.Kind{Type: &appsv1.Deployment{}}, &handler.EnqueueRequestForOwner{ IsController: true, - OwnerType: &autoscalingv1alpha1.ClusterAutoscaler{}, + OwnerType: &autoscalingv1.ClusterAutoscaler{}, }) if err != nil { @@ -123,10 +124,10 @@ func (r *Reconciler) AddToManager(mgr manager.Manager) error { // object and makes changes based on the state read and what is in the // ClusterAutoscaler.Spec func (r *Reconciler) Reconcile(request reconcile.Request) (reconcile.Result, error) { - glog.Infof("Reconciling ClusterAutoscaler %s\n", request.Name) + klog.Infof("Reconciling ClusterAutoscaler %s\n", request.Name) // Fetch the ClusterAutoscaler instance - ca := &autoscalingv1alpha1.ClusterAutoscaler{} + ca := &autoscalingv1.ClusterAutoscaler{} err := r.client.Get(context.TODO(), request.NamespacedName, ca) if err != nil { if errors.IsNotFound(err) { @@ -134,19 +135,25 @@ func (r *Reconciler) Reconcile(request reconcile.Request) (reconcile.Result, err // reconcile request. Owned objects are automatically // garbage collected. For additional cleanup logic use // finalizers. Return and don't requeue. + klog.Infof("ClusterAutoscaler %s not found, will not reconcile", request.Name) return reconcile.Result{}, nil } // Error reading the object - requeue the request. - glog.Errorf("Error reading ClusterAutoscaler: %v", err) + klog.Errorf("Error reading ClusterAutoscaler: %v", err) return reconcile.Result{}, err } + // caRef is a reference to the ClusterAutoscaler object, but with the + // namespace for cluster-autoscaler deployments set. This keeps events + // generated for these cluster scoped objects out of the default namespace. + caRef := r.objectReference(ca) + _, err = r.GetAutoscaler(ca) if err != nil && !errors.IsNotFound(err) { errMsg := fmt.Sprintf("Error getting cluster-autoscaler deployment: %v", err) - r.recorder.Event(ca, corev1.EventTypeWarning, "FailedGetDeployment", errMsg) - glog.Error(errMsg) + r.recorder.Event(caRef, corev1.EventTypeWarning, "FailedGetDeployment", errMsg) + klog.Error(errMsg) return reconcile.Result{}, err } @@ -154,65 +161,34 @@ func (r *Reconciler) Reconcile(request reconcile.Request) (reconcile.Result, err if errors.IsNotFound(err) { if err := r.CreateAutoscaler(ca); err != nil { errMsg := fmt.Sprintf("Error creating ClusterAutoscaler deployment: %v", err) - r.recorder.Event(ca, corev1.EventTypeWarning, "FailedCreate", errMsg) - glog.Error(errMsg) + r.recorder.Event(caRef, corev1.EventTypeWarning, "FailedCreate", errMsg) + klog.Error(errMsg) return reconcile.Result{}, err } msg := fmt.Sprintf("Created ClusterAutoscaler deployment: %s", r.AutoscalerName(ca)) - r.recorder.Eventf(ca, corev1.EventTypeNormal, "SuccessfulCreate", msg) - glog.V(2).Info(msg) + r.recorder.Eventf(caRef, corev1.EventTypeNormal, "SuccessfulCreate", msg) + klog.Info(msg) return reconcile.Result{}, nil } if err := r.UpdateAutoscaler(ca); err != nil { errMsg := fmt.Sprintf("Error updating cluster-autoscaler deployment: %v", err) - r.recorder.Event(ca, corev1.EventTypeWarning, "FailedUpdate", errMsg) - glog.Error(errMsg) + r.recorder.Event(caRef, corev1.EventTypeWarning, "FailedUpdate", errMsg) + klog.Error(errMsg) return reconcile.Result{}, err } msg := fmt.Sprintf("Updated ClusterAutoscaler deployment: %s", r.AutoscalerName(ca)) - r.recorder.Eventf(ca, corev1.EventTypeNormal, "SuccessfulUpdate", msg) - glog.V(2).Info(msg) + r.recorder.Eventf(caRef, corev1.EventTypeNormal, "SuccessfulUpdate", msg) + klog.Info(msg) return reconcile.Result{}, nil } -// AvailableAndUpdated returns true if all cluster autoscalers are running and at the latest version -// as defined by the operator. -func (r *Reconciler) AvailableAndUpdated() (bool, error) { - ca := &autoscalingv1alpha1.ClusterAutoscaler{} - err := r.client.Get(context.TODO(), types.NamespacedName{Namespace: r.config.Namespace, Name: r.config.Name}, ca) - if err != nil { - if errors.IsNotFound(err) { - // no CA, do nothing - return true, nil - } - return false, err - } - dep, err := r.GetAutoscaler(ca) - if err != nil { - if errors.IsNotFound(err) { - // waiting for deployment to be created - return false, nil - } - return false, err - } - if dep.ObjectMeta.Annotations["release.openshift.io/version"] != r.config.ReleaseVersion { - // still haven't synced the release version - return false, nil - } - if dep.Status.ObservedGeneration < dep.Generation || dep.Status.UpdatedReplicas != dep.Status.Replicas || dep.Status.AvailableReplicas == 0 { - // deployment hasn't rolled out a new controller or we still have the old version hanging around - return false, nil - } - return true, nil -} - // SetConfig sets the given config on the reconciler. func (r *Reconciler) SetConfig(cfg *Config) { r.config = cfg @@ -224,7 +200,7 @@ func (r *Reconciler) SetConfig(cfg *Config) { func (r *Reconciler) NamePredicate(meta metav1.Object) bool { // Only process events for objects matching the configured resource name. if meta.GetName() != r.config.Name { - glog.Warningf("Not processing ClusterAutoscaler %s", meta.GetName()) + klog.Warningf("Not processing ClusterAutoscaler %s", meta.GetName()) return false } @@ -233,8 +209,8 @@ func (r *Reconciler) NamePredicate(meta metav1.Object) bool { // CreateAutoscaler will create the deployment for the given the // ClusterAutoscaler custom resource instance. -func (r *Reconciler) CreateAutoscaler(ca *autoscalingv1alpha1.ClusterAutoscaler) error { - glog.Infof("Creating ClusterAutoscaler deployment: %s\n", r.AutoscalerName(ca)) +func (r *Reconciler) CreateAutoscaler(ca *autoscalingv1.ClusterAutoscaler) error { + klog.Infof("Creating ClusterAutoscaler deployment: %s\n", r.AutoscalerName(ca)) deployment := r.AutoscalerDeployment(ca) @@ -248,7 +224,7 @@ func (r *Reconciler) CreateAutoscaler(ca *autoscalingv1alpha1.ClusterAutoscaler) // UpdateAutoscaler will retrieve the deployment for the given ClusterAutoscaler // custom resource instance and update it to match the expected spec if needed. -func (r *Reconciler) UpdateAutoscaler(ca *autoscalingv1alpha1.ClusterAutoscaler) error { +func (r *Reconciler) UpdateAutoscaler(ca *autoscalingv1.ClusterAutoscaler) error { existingDeployment, err := r.GetAutoscaler(ca) if err != nil { return err @@ -257,18 +233,23 @@ func (r *Reconciler) UpdateAutoscaler(ca *autoscalingv1alpha1.ClusterAutoscaler) existingSpec := existingDeployment.Spec.Template.Spec expectedSpec := r.AutoscalerPodSpec(ca) - // Only comparing podSpec for now. - if equality.Semantic.DeepEqual(existingSpec, expectedSpec) { + // Only comparing podSpec and release version for now. + if equality.Semantic.DeepEqual(existingSpec, expectedSpec) && + util.ReleaseVersionMatches(ca, r.config.ReleaseVersion) { return nil } existingDeployment.Spec.Template.Spec = *expectedSpec + + r.UpdateAnnotations(existingDeployment) + r.UpdateAnnotations(&existingDeployment.Spec.Template) + return r.client.Update(context.TODO(), existingDeployment) } // GetAutoscaler will return the deployment for the given ClusterAutoscaler // custom resource instance. -func (r *Reconciler) GetAutoscaler(ca *autoscalingv1alpha1.ClusterAutoscaler) (*appsv1.Deployment, error) { +func (r *Reconciler) GetAutoscaler(ca *autoscalingv1.ClusterAutoscaler) (*appsv1.Deployment, error) { deployment := &appsv1.Deployment{} nn := r.AutoscalerName(ca) @@ -281,16 +262,31 @@ func (r *Reconciler) GetAutoscaler(ca *autoscalingv1alpha1.ClusterAutoscaler) (* // AutoscalerName returns the expected NamespacedName for the deployment // belonging to the given ClusterAutoscaler. -func (r *Reconciler) AutoscalerName(ca *autoscalingv1alpha1.ClusterAutoscaler) types.NamespacedName { +func (r *Reconciler) AutoscalerName(ca *autoscalingv1.ClusterAutoscaler) types.NamespacedName { return types.NamespacedName{ Name: fmt.Sprintf("cluster-autoscaler-%s", ca.Name), Namespace: r.config.Namespace, } } +// UpdateAnnotations updates the annotations on the given object to the values +// currently expected by the controller. +func (r *Reconciler) UpdateAnnotations(obj metav1.Object) { + annotations := obj.GetAnnotations() + + if annotations == nil { + annotations = map[string]string{} + } + + annotations[util.CriticalPodAnnotation] = "" + annotations[util.ReleaseVersionAnnotation] = r.config.ReleaseVersion + + obj.SetAnnotations(annotations) +} + // AutoscalerDeployment returns the expected deployment belonging to the given // ClusterAutoscaler. -func (r *Reconciler) AutoscalerDeployment(ca *autoscalingv1alpha1.ClusterAutoscaler) *appsv1.Deployment { +func (r *Reconciler) AutoscalerDeployment(ca *autoscalingv1.ClusterAutoscaler) *appsv1.Deployment { namespacedName := r.AutoscalerName(ca) labels := map[string]string{ @@ -299,8 +295,8 @@ func (r *Reconciler) AutoscalerDeployment(ca *autoscalingv1alpha1.ClusterAutosca } annotations := map[string]string{ - criticalPod: "", - "release.openshift.io/version": r.config.ReleaseVersion, + util.CriticalPodAnnotation: "", + util.ReleaseVersionAnnotation: r.config.ReleaseVersion, } podSpec := r.AutoscalerPodSpec(ca) @@ -335,7 +331,7 @@ func (r *Reconciler) AutoscalerDeployment(ca *autoscalingv1alpha1.ClusterAutosca // AutoscalerPodSpec returns the expected podSpec for the deployment belonging // to the given ClusterAutoscaler. -func (r *Reconciler) AutoscalerPodSpec(ca *autoscalingv1alpha1.ClusterAutoscaler) *corev1.PodSpec { +func (r *Reconciler) AutoscalerPodSpec(ca *autoscalingv1.ClusterAutoscaler) *corev1.PodSpec { args := AutoscalerArgs(ca, r.config) if r.config.ExtraArgs != "" { @@ -373,3 +369,21 @@ func (r *Reconciler) AutoscalerPodSpec(ca *autoscalingv1alpha1.ClusterAutoscaler return spec } + +// objectReference returns a reference to the given object, but will set the +// configured deployment namesapce if no namespace was previously set. This is +// useful for referencing cluster scoped objects in events without the events +// being created in the default namespace. +func (r *Reconciler) objectReference(obj runtime.Object) *corev1.ObjectReference { + ref, err := reference.GetReference(r.scheme, obj) + if err != nil { + klog.Errorf("Error creating object reference: %v", err) + return nil + } + + if ref != nil && ref.Namespace == "" { + ref.Namespace = r.config.Namespace + } + + return ref +} diff --git a/vendor/github.com/openshift/cluster-autoscaler-operator/pkg/controller/machineautoscaler/machineautoscaler_controller.go b/vendor/github.com/openshift/cluster-autoscaler-operator/pkg/controller/machineautoscaler/machineautoscaler_controller.go index 9477b2eb5..c1d87027d 100644 --- a/vendor/github.com/openshift/cluster-autoscaler-operator/pkg/controller/machineautoscaler/machineautoscaler_controller.go +++ b/vendor/github.com/openshift/cluster-autoscaler-operator/pkg/controller/machineautoscaler/machineautoscaler_controller.go @@ -5,8 +5,7 @@ import ( "errors" "fmt" - "github.com/golang/glog" - "github.com/openshift/cluster-autoscaler-operator/pkg/apis/autoscaling/v1alpha1" + "github.com/openshift/cluster-autoscaler-operator/pkg/apis/autoscaling/v1beta1" "github.com/openshift/cluster-autoscaler-operator/pkg/util" corev1 "k8s.io/api/core/v1" "k8s.io/apimachinery/pkg/api/equality" @@ -16,6 +15,7 @@ import ( "k8s.io/apimachinery/pkg/runtime" "k8s.io/apimachinery/pkg/runtime/schema" "k8s.io/client-go/tools/record" + "k8s.io/klog" "sigs.k8s.io/controller-runtime/pkg/client" "sigs.k8s.io/controller-runtime/pkg/controller" "sigs.k8s.io/controller-runtime/pkg/handler" @@ -57,8 +57,8 @@ var ( // supported as targets for a MachineAutocaler instance. func DefaultSupportedTargetGVKs() []schema.GroupVersionKind { return []schema.GroupVersionKind{ - {Group: "cluster.k8s.io", Version: "v1alpha1", Kind: "MachineDeployment"}, - {Group: "cluster.k8s.io", Version: "v1alpha1", Kind: "MachineSet"}, + {Group: "cluster.k8s.io", Version: "v1beta1", Kind: "MachineDeployment"}, + {Group: "cluster.k8s.io", Version: "v1beta1", Kind: "MachineSet"}, {Group: "machine.openshift.io", Version: "v1beta1", Kind: "MachineDeployment"}, {Group: "machine.openshift.io", Version: "v1beta1", Kind: "MachineSet"}, } @@ -96,7 +96,7 @@ func (r *Reconciler) AddToManager(mgr manager.Manager) error { } // Watch for changes to primary resource MachineAutoscaler - err = c.Watch(&source.Kind{Type: &v1alpha1.MachineAutoscaler{}}, &handler.EnqueueRequestForObject{}) + err = c.Watch(&source.Kind{Type: &v1beta1.MachineAutoscaler{}}, &handler.EnqueueRequestForObject{}) if err != nil { return err } @@ -120,7 +120,7 @@ func (r *Reconciler) AddToManager(mgr manager.Manager) error { // If the type is later registered, a restart of the operator will pick // it up and properly reconcile any MachineAutoscalers referencing it. if err != nil && meta.IsNoMatchError(err) { - glog.Warningf("Removing support for unregistered target type: %s", gvk) + klog.Warningf("Removing support for unregistered target type: %s", gvk) missingGVKs = append(missingGVKs, gvk) } else if err != nil { return err @@ -156,10 +156,10 @@ type Reconciler struct { // makes changes based on the state read and what is in the // MachineAutoscaler.Spec func (r *Reconciler) Reconcile(request reconcile.Request) (reconcile.Result, error) { - glog.Infof("Reconciling MachineAutoscaler %s/%s\n", request.Namespace, request.Name) + klog.Infof("Reconciling MachineAutoscaler %s/%s\n", request.Namespace, request.Name) // Fetch the MachineAutoscaler instance - ma := &v1alpha1.MachineAutoscaler{} + ma := &v1beta1.MachineAutoscaler{} err := r.client.Get(context.TODO(), request.NamespacedName, ma) if err != nil { if apierrors.IsNotFound(err) { @@ -171,7 +171,7 @@ func (r *Reconciler) Reconcile(request reconcile.Request) (reconcile.Result, err } // Error reading the object - requeue the request. - glog.Errorf("Error reading MachineAutoscaler: %v", err) + klog.Errorf("Error reading MachineAutoscaler: %v", err) return reconcile.Result{}, err } @@ -187,7 +187,7 @@ func (r *Reconciler) Reconcile(request reconcile.Request) (reconcile.Result, err if err != nil { errMsg := fmt.Sprintf("Error getting target: %v", err) r.recorder.Event(ma, corev1.EventTypeWarning, "FailedGetTarget", errMsg) - glog.Errorf("%s: %s", request.NamespacedName, errMsg) + klog.Errorf("%s: %s", request.NamespacedName, errMsg) return reconcile.Result{}, err } @@ -197,7 +197,7 @@ func (r *Reconciler) Reconcile(request reconcile.Request) (reconcile.Result, err if err != nil { errMsg := fmt.Sprintf("Error setting target owner: %v", err) r.recorder.Event(ma, corev1.EventTypeWarning, "FailedSetOwner", errMsg) - glog.Errorf("%s: %s", request.NamespacedName, errMsg) + klog.Errorf("%s: %s", request.NamespacedName, errMsg) return reconcile.Result{}, err } @@ -212,7 +212,7 @@ func (r *Reconciler) Reconcile(request reconcile.Request) (reconcile.Result, err // status, and it has changed relative to the current target, the // previous target must be finalized, e.g. annotations removed. if ma.Status.LastTargetRef != nil && r.TargetChanged(ma) { - glog.V(2).Infof("%s: Target changed", request.NamespacedName) + klog.V(2).Infof("%s: Target changed", request.NamespacedName) lastTargetRef := objectReference(*ma.Status.LastTargetRef) @@ -223,7 +223,7 @@ func (r *Reconciler) Reconcile(request reconcile.Request) (reconcile.Result, err // retain autoscaling configuration. errMsg := fmt.Sprintf("Error fetching previous target: %v", err) r.recorder.Event(ma, corev1.EventTypeWarning, "FailedGetLastTarget", errMsg) - glog.Errorf("%s: %s", request.NamespacedName, errMsg) + klog.Errorf("%s: %s", request.NamespacedName, errMsg) return reconcile.Result{}, err } @@ -237,7 +237,7 @@ func (r *Reconciler) Reconcile(request reconcile.Request) (reconcile.Result, err if err != nil && !apierrors.IsNotFound(err) { errMsg := fmt.Sprintf("Error finalizing previous target: %v", err) r.recorder.Event(ma, corev1.EventTypeWarning, "FailedFinalizeTarget", errMsg) - glog.Errorf("%s: %s", request.NamespacedName, errMsg) + klog.Errorf("%s: %s", request.NamespacedName, errMsg) return reconcile.Result{}, err } @@ -247,7 +247,7 @@ func (r *Reconciler) Reconcile(request reconcile.Request) (reconcile.Result, err if err := r.SetLastTarget(ma, targetRef); err != nil { errMsg := fmt.Sprintf("Error setting previous target: %v", err) r.recorder.Event(ma, corev1.EventTypeWarning, "FailedSetLastTarget", errMsg) - glog.Errorf("%s: %s", request.NamespacedName, errMsg) + klog.Errorf("%s: %s", request.NamespacedName, errMsg) return reconcile.Result{}, err } @@ -258,7 +258,7 @@ func (r *Reconciler) Reconcile(request reconcile.Request) (reconcile.Result, err if err := r.SetLastTarget(ma, targetRef); err != nil { errMsg := fmt.Sprintf("Error setting previous target: %v", err) r.recorder.Event(ma, corev1.EventTypeWarning, "FailedSetLastTarget", errMsg) - glog.Errorf("%s: %s", request.NamespacedName, errMsg) + klog.Errorf("%s: %s", request.NamespacedName, errMsg) return reconcile.Result{}, err } @@ -266,7 +266,7 @@ func (r *Reconciler) Reconcile(request reconcile.Request) (reconcile.Result, err // Ensure our finalizers have been added. if err := r.EnsureFinalizer(ma); err != nil { - glog.Errorf("Error setting finalizer: %v", err) + klog.Errorf("Error setting finalizer: %v", err) return reconcile.Result{}, err } @@ -276,26 +276,26 @@ func (r *Reconciler) Reconcile(request reconcile.Request) (reconcile.Result, err if err := r.UpdateTarget(target, min, max); err != nil { errMsg := fmt.Sprintf("Error updating target: %v", err) r.recorder.Event(ma, corev1.EventTypeWarning, "FailedUpdateTarget", errMsg) - glog.Errorf("%s: %s", request.NamespacedName, errMsg) + klog.Errorf("%s: %s", request.NamespacedName, errMsg) return reconcile.Result{}, err } msg := fmt.Sprintf("Updated MachineAutoscaler target: %s", target.NamespacedName()) r.recorder.Eventf(ma, corev1.EventTypeNormal, "SuccessfulUpdate", msg) - glog.V(2).Infof("%s: %s", request.NamespacedName, msg) + klog.V(2).Infof("%s: %s", request.NamespacedName, msg) return reconcile.Result{}, nil } // HandleDelete is called by Reconcile to handle MachineAutoscaler deletion, // i.e. finalize the resource and remove finalizers. -func (r *Reconciler) HandleDelete(ma *v1alpha1.MachineAutoscaler) (reconcile.Result, error) { +func (r *Reconciler) HandleDelete(ma *v1beta1.MachineAutoscaler) (reconcile.Result, error) { targetRef := objectReference(ma.Spec.ScaleTargetRef) target, err := r.GetTarget(targetRef) if err != nil && !apierrors.IsNotFound(err) { - glog.Errorf("Error getting target for finalization: %v", err) + klog.Errorf("Error getting target for finalization: %v", err) return reconcile.Result{}, err } @@ -304,13 +304,13 @@ func (r *Reconciler) HandleDelete(ma *v1alpha1.MachineAutoscaler) (reconcile.Res // Ignore 404s, the resource has most likely been deleted. if err != nil && !apierrors.IsNotFound(err) { - glog.Errorf("Error finalizing target: %v", err) + klog.Errorf("Error finalizing target: %v", err) return reconcile.Result{}, err } } if err := r.RemoveFinalizer(ma); err != nil { - glog.Errorf("Error removing finalizer: %v", err) + klog.Errorf("Error removing finalizer: %v", err) return reconcile.Result{}, err } @@ -339,7 +339,7 @@ func (r *Reconciler) GetTarget(ref *corev1.ObjectReference) (*MachineTarget, err target, err := MachineTargetFromObject(obj) if err != nil { - glog.Errorf("Failed to convert object to MachineTarget: %v", err) + klog.Errorf("Failed to convert object to MachineTarget: %v", err) return nil, err } @@ -371,7 +371,7 @@ func (r *Reconciler) FinalizeTarget(target *MachineTarget) error { // TargetChanged indicates whether a MachineAutoscaler's current target has // changed relative to the last observed target noted in the status. -func (r *Reconciler) TargetChanged(ma *v1alpha1.MachineAutoscaler) bool { +func (r *Reconciler) TargetChanged(ma *v1beta1.MachineAutoscaler) bool { currentRef := ma.Spec.ScaleTargetRef lastRef := ma.Status.LastTargetRef @@ -384,8 +384,8 @@ func (r *Reconciler) TargetChanged(ma *v1alpha1.MachineAutoscaler) bool { // SetLastTarget updates the give MachineAutoscaler's status with the given // object as the last observed target. -func (r *Reconciler) SetLastTarget(ma *v1alpha1.MachineAutoscaler, ref *corev1.ObjectReference) error { - ma.Status.LastTargetRef = &v1alpha1.CrossVersionObjectReference{ +func (r *Reconciler) SetLastTarget(ma *v1beta1.MachineAutoscaler, ref *corev1.ObjectReference) error { + ma.Status.LastTargetRef = &v1beta1.CrossVersionObjectReference{ APIVersion: ref.APIVersion, Kind: ref.Kind, Name: ref.Name, @@ -395,7 +395,7 @@ func (r *Reconciler) SetLastTarget(ma *v1alpha1.MachineAutoscaler, ref *corev1.O } // EnsureFinalizer adds finalizers to the given MachineAutoscaler if necessary. -func (r *Reconciler) EnsureFinalizer(ma *v1alpha1.MachineAutoscaler) error { +func (r *Reconciler) EnsureFinalizer(ma *v1beta1.MachineAutoscaler) error { for _, f := range ma.GetFinalizers() { // Bail early if we already have the finalizer. if f == MachineTargetFinalizer { @@ -411,7 +411,7 @@ func (r *Reconciler) EnsureFinalizer(ma *v1alpha1.MachineAutoscaler) error { // RemoveFinalizer removes this packages's finalizers from the given // MachineAutoscaler instance. -func (r *Reconciler) RemoveFinalizer(ma *v1alpha1.MachineAutoscaler) error { +func (r *Reconciler) RemoveFinalizer(ma *v1beta1.MachineAutoscaler) error { f, found := util.FilterString(ma.GetFinalizers(), MachineTargetFinalizer) if found == 0 { @@ -481,17 +481,17 @@ func (r *Reconciler) ValidateReference(obj *corev1.ObjectReference) (bool, error func targetOwnerRequest(a handler.MapObject) []reconcile.Request { target, err := MachineTargetFromObject(a.Object) if err != nil { - glog.Errorf("Failed to convert object to MachineTarget: %v", err) + klog.Errorf("Failed to convert object to MachineTarget: %v", err) return nil } owner, err := target.GetOwner() if err != nil { - glog.V(2).Infof("Will not reconcile: %v", err) + klog.V(2).Infof("Will not reconcile: %v", err) return nil } - glog.V(2).Infof("Queuing reconcile for owner of %s/%s.", + klog.V(2).Infof("Queuing reconcile for owner of %s/%s.", target.GetNamespace(), target.GetName()) return []reconcile.Request{{NamespacedName: owner}} @@ -499,7 +499,7 @@ func targetOwnerRequest(a handler.MapObject) []reconcile.Request { // objectReference returns a new corev1.ObjectReference for the given // CrossVersionObjectReference from a MachineAutoscaler target. -func objectReference(ref v1alpha1.CrossVersionObjectReference) *corev1.ObjectReference { +func objectReference(ref v1beta1.CrossVersionObjectReference) *corev1.ObjectReference { obj := &corev1.ObjectReference{} gvk := schema.FromAPIVersionAndKind(ref.APIVersion, ref.Kind) diff --git a/vendor/github.com/openshift/cluster-autoscaler-operator/pkg/operator/config.go b/vendor/github.com/openshift/cluster-autoscaler-operator/pkg/operator/config.go index b294a0e71..7ac4b5e33 100644 --- a/vendor/github.com/openshift/cluster-autoscaler-operator/pkg/operator/config.go +++ b/vendor/github.com/openshift/cluster-autoscaler-operator/pkg/operator/config.go @@ -4,7 +4,7 @@ import ( "os" "strconv" - "github.com/golang/glog" + "k8s.io/klog" ) const ( @@ -136,7 +136,7 @@ func ConfigFromEnvironment() *Config { le, err := strconv.ParseBool(leaderElection) if err != nil { le = DefaultLeaderElection - glog.Errorf("Error parsing LEADER_ELECTION environment variable: %v", err) + klog.Errorf("Error parsing LEADER_ELECTION environment variable: %v", err) } config.LeaderElection = le @@ -170,7 +170,7 @@ func ConfigFromEnvironment() *Config { v, err := strconv.Atoi(caVerbosity) if err != nil { v = DefaultClusterAutoscalerVerbosity - glog.Errorf("Error parsing CLUSTER_AUTOSCALER_VERBOSITY environment variable: %v", err) + klog.Errorf("Error parsing CLUSTER_AUTOSCALER_VERBOSITY environment variable: %v", err) } config.ClusterAutoscalerVerbosity = v diff --git a/vendor/github.com/openshift/cluster-autoscaler-operator/pkg/operator/operator.go b/vendor/github.com/openshift/cluster-autoscaler-operator/pkg/operator/operator.go index b76785c8e..31eba56d4 100644 --- a/vendor/github.com/openshift/cluster-autoscaler-operator/pkg/operator/operator.go +++ b/vendor/github.com/openshift/cluster-autoscaler-operator/pkg/operator/operator.go @@ -16,9 +16,7 @@ const OperatorName = "cluster-autoscaler" // Operator represents an instance of the cluster-autoscaler-operator. type Operator struct { config *Config - status *StatusReporter manager manager.Manager - checker AvailableChecker } // New returns a new Operator instance with the given config and a @@ -32,23 +30,6 @@ func New(cfg *Config) (*Operator, error) { return nil, err } - // track set of related namespaces for openshift-must-gather diagnostics - relatedNamespaces := map[string]string{} - relatedNamespaces[cfg.WatchNamespace] = "" - relatedNamespaces[cfg.LeaderElectionNamespace] = "" - relatedNamespaces[cfg.ClusterAutoscalerNamespace] = "" - relatedObjects := []configv1.ObjectReference{} - for k := range relatedNamespaces { - relatedObjects = append(relatedObjects, configv1.ObjectReference{ - Resource: "namespaces", - Name: k, - }) - } - operator.status, err = NewStatusReporter(clientConfig, relatedObjects, cfg.ReleaseVersion) - if err != nil { - return nil, err - } - // Create the controller-manager. managerOptions := manager.Options{ Namespace: cfg.WatchNamespace, @@ -71,9 +52,44 @@ func New(cfg *Config) (*Operator, error) { return nil, err } + statusConfig := &StatusReporterConfig{ + ClusterAutoscalerName: cfg.ClusterAutoscalerName, + ClusterAutoscalerNamespace: cfg.ClusterAutoscalerNamespace, + ReleaseVersion: cfg.ReleaseVersion, + RelatedObjects: operator.RelatedObjects(), + } + + statusReporter, err := NewStatusReporter(operator.manager, statusConfig) + if err != nil { + return nil, err + } + + operator.manager.Add(statusReporter) + return operator, nil } +// RelatedObjects returns a list of objects related to the operator and its +// operands. These are used in the ClusterOperator status. +func (o *Operator) RelatedObjects() []configv1.ObjectReference { + relatedNamespaces := map[string]string{} + + relatedNamespaces[o.config.WatchNamespace] = "" + relatedNamespaces[o.config.LeaderElectionNamespace] = "" + relatedNamespaces[o.config.ClusterAutoscalerNamespace] = "" + + relatedObjects := []configv1.ObjectReference{} + + for namespace := range relatedNamespaces { + relatedObjects = append(relatedObjects, configv1.ObjectReference{ + Resource: "namespaces", + Name: namespace, + }) + } + + return relatedObjects +} + // AddControllers configures the various controllers and adds them to // the operator's manager instance. func (o *Operator) AddControllers() error { @@ -89,8 +105,6 @@ func (o *Operator) AddControllers() error { ExtraArgs: o.config.ClusterAutoscalerExtraArgs, }) - o.checker = ca - if err := ca.AddToManager(o.manager); err != nil { return err } @@ -112,8 +126,5 @@ func (o *Operator) AddControllers() error { func (o *Operator) Start() error { stopCh := signals.SetupSignalHandler() - // Report status to the CVO. - go o.status.Report(stopCh, o.checker) - return o.manager.Start(stopCh) } diff --git a/vendor/github.com/openshift/cluster-autoscaler-operator/pkg/operator/status.go b/vendor/github.com/openshift/cluster-autoscaler-operator/pkg/operator/status.go index e75dd4ffd..e90556364 100644 --- a/vendor/github.com/openshift/cluster-autoscaler-operator/pkg/operator/status.go +++ b/vendor/github.com/openshift/cluster-autoscaler-operator/pkg/operator/status.go @@ -1,18 +1,23 @@ package operator import ( + "context" "fmt" "time" - "github.com/golang/glog" configv1 "github.com/openshift/api/config/v1" osconfig "github.com/openshift/client-go/config/clientset/versioned" + autoscalingv1 "github.com/openshift/cluster-autoscaler-operator/pkg/apis/autoscaling/v1" + "github.com/openshift/cluster-autoscaler-operator/pkg/util" cvorm "github.com/openshift/cluster-version-operator/lib/resourcemerge" + appsv1 "k8s.io/api/apps/v1" "k8s.io/apimachinery/pkg/api/equality" "k8s.io/apimachinery/pkg/api/errors" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/util/wait" - "k8s.io/client-go/rest" + "k8s.io/klog" + "sigs.k8s.io/controller-runtime/pkg/client" + "sigs.k8s.io/controller-runtime/pkg/manager" ) // Reason messages used in status conditions. @@ -23,33 +28,33 @@ const ( ReasonCheckAutoscaler = "UnableToCheckAutoscalers" ) -// applyStatusInterface is used to enable unit testing and does not -// implement all methods of StatusReporter. -type applyStatusInterface interface { - checkMachineAPI() (bool, error) - fail(string, string) error - progressing() error - available(string, string) error -} - // StatusReporter reports the status of the operator to the OpenShift // cluster-version-operator via ClusterOperator resource status. type StatusReporter struct { - client osconfig.Interface - relatedObjects []configv1.ObjectReference - releaseVersion string + client client.Client + configClient osconfig.Interface + config *StatusReporterConfig +} + +// StatusReporterConfig represents the configuration of a given StatusReporter. +type StatusReporterConfig struct { + ClusterAutoscalerName string + ClusterAutoscalerNamespace string + ReleaseVersion string + RelatedObjects []configv1.ObjectReference } // NewStatusReporter returns a new StatusReporter instance. -func NewStatusReporter(cfg *rest.Config, relatedObjects []configv1.ObjectReference, releaseVersion string) (*StatusReporter, error) { +func NewStatusReporter(mgr manager.Manager, cfg *StatusReporterConfig) (*StatusReporter, error) { var err error + reporter := &StatusReporter{ - relatedObjects: relatedObjects, - releaseVersion: releaseVersion, + client: mgr.GetClient(), + config: cfg, } // Create a client for OpenShift config objects. - reporter.client, err = osconfig.NewForConfig(cfg) + reporter.configClient, err = osconfig.NewForConfig(mgr.GetConfig()) if err != nil { return nil, err } @@ -57,6 +62,28 @@ func NewStatusReporter(cfg *rest.Config, relatedObjects []configv1.ObjectReferen return reporter, nil } +// SetReleaseVersion sets the configured release version. +func (r *StatusReporter) SetReleaseVersion(version string) { + r.config.ReleaseVersion = version +} + +// SetRelatedObjects sets the configured related objects. +func (r *StatusReporter) SetRelatedObjects(objs []configv1.ObjectReference) { + r.config.RelatedObjects = objs +} + +// AddRelatedObjects adds to the list of related objects. +func (r *StatusReporter) AddRelatedObjects(objs []configv1.ObjectReference) { + for _, obj := range objs { + r.config.RelatedObjects = append(r.config.RelatedObjects, obj) + } +} + +// GetClusterOperator fetches the the operator's ClusterOperator object. +func (r *StatusReporter) GetClusterOperator() (*configv1.ClusterOperator, error) { + return r.configClient.ConfigV1().ClusterOperators().Get(OperatorName, metav1.GetOptions{}) +} + // GetOrCreateClusterOperator gets, or if necessary, creates the // operator's ClusterOperator object and returns it. func (r *StatusReporter) GetOrCreateClusterOperator() (*configv1.ClusterOperator, error) { @@ -66,186 +93,235 @@ func (r *StatusReporter) GetOrCreateClusterOperator() (*configv1.ClusterOperator }, } - existing, err := r.client.ConfigV1().ClusterOperators(). - Get(OperatorName, metav1.GetOptions{}) + existing, err := r.GetClusterOperator() if errors.IsNotFound(err) { - return r.client.ConfigV1().ClusterOperators().Create(clusterOperator) + return r.configClient.ConfigV1().ClusterOperators().Create(clusterOperator) } return existing, err } -// ApplyConditions applies the given conditions to the ClusterOperator -// resource's status. -func (r *StatusReporter) ApplyConditions(conds []configv1.ClusterOperatorStatusCondition, reachedLevel bool) error { - status := configv1.ClusterOperatorStatus{ - RelatedObjects: r.relatedObjects, +// ApplyStatus applies the given ClusterOperator status to the operator's +// ClusterOperator object if necessary. The currently configured RelatedObjects +// are automatically set on the status. If no ClusterOperator objects exists, +// one is created. +func (r *StatusReporter) ApplyStatus(status configv1.ClusterOperatorStatus) error { + var modified bool + + co, err := r.GetOrCreateClusterOperator() + if err != nil { + return err } - for _, c := range conds { - cvorm.SetOperatorStatusCondition(&status.Conditions, c) + // Set the currently configured related objects. + status.RelatedObjects = r.config.RelatedObjects + + // If no versions were set explicitly, continue reporting previous versions. + if status.Versions == nil { + status.Versions = co.Status.Versions } - if reachedLevel { - status.Versions = []configv1.OperandVersion{ - { - Name: "operator", - Version: r.releaseVersion, - }, + // Update LastTransitionTime for all conditions if necessary. + for i := range status.Conditions { + condType := status.Conditions[i].Type + timestamp := metav1.NewTime(time.Now()) + + c := cvorm.FindOperatorStatusCondition(co.Status.Conditions, condType) + + // If found, and status doesn't match, update. + if c != nil && c.Status != status.Conditions[i].Status { + status.Conditions[i].LastTransitionTime = timestamp + } + + // If found, and status matches, copy previous. + if c != nil && c.Status == status.Conditions[i].Status { + status.Conditions[i].LastTransitionTime = c.LastTransitionTime + } + + // If it's still nil, update it. + if status.Conditions[i].LastTransitionTime.IsZero() { + status.Conditions[i].LastTransitionTime = timestamp } - glog.Infof("Setting operator version to: %v", r.releaseVersion) - } else { - status.Versions = nil - glog.Info("Setting operator version to nil") } - co, err := r.GetOrCreateClusterOperator() - if err != nil { - return err + // If any versions have changed, we need to reset the transition time on the + // Progressing condition whether or not we actually had any work to do. + if !equality.Semantic.DeepEqual(status.Versions, co.Status.Versions) { + util.ResetProgressingTime(&status.Conditions) } - if !equality.Semantic.DeepEqual(co.Status, status) { - glog.Info("operator status not current; Updating operator") - co.Status = status - _, err = r.client.ConfigV1().ClusterOperators().UpdateStatus(co) + // Copy the current ClusterOperator and overwrite the status. + requiredCO := &configv1.ClusterOperator{} + co.DeepCopyInto(requiredCO) + requiredCO.Status = status + + cvorm.EnsureClusterOperatorStatus(&modified, co, *requiredCO) + + if modified { + _, err := r.configClient.ConfigV1().ClusterOperators().UpdateStatus(co) + return err } - return err + return nil } // available reports the operator as available, not progressing, and -// not failing -- optionally setting a reason and message. +// not failing -- optionally setting a reason and message. This will +// update the reported operator version. It should only be called if +// the operands are fully updated and available. func (r *StatusReporter) available(reason, message string) error { - conditions := []configv1.ClusterOperatorStatusCondition{ - { - Type: configv1.OperatorAvailable, - Status: configv1.ConditionTrue, - Reason: reason, - Message: message, - }, - { - Type: configv1.OperatorProgressing, - Status: configv1.ConditionFalse, + status := configv1.ClusterOperatorStatus{ + Conditions: []configv1.ClusterOperatorStatusCondition{ + { + Type: configv1.OperatorAvailable, + Status: configv1.ConditionTrue, + Reason: reason, + Message: message, + }, + { + Type: configv1.OperatorProgressing, + Status: configv1.ConditionFalse, + }, + { + Type: configv1.OperatorFailing, + Status: configv1.ConditionFalse, + }, }, - { - Type: configv1.OperatorFailing, - Status: configv1.ConditionFalse, + Versions: []configv1.OperandVersion{ + { + Name: "operator", + Version: r.config.ReleaseVersion, + }, }, } - glog.Info("Setting operator to available") - return r.ApplyConditions(conditions, true) + + klog.Infof("Operator status available: %s", message) + + return r.ApplyStatus(status) } -// Fail reports the operator as failing but available, and not +// failing reports the operator as failing but available, and not // progressing -- optionally setting a reason and message. -func (r *StatusReporter) fail(reason, message string) error { - conditions := []configv1.ClusterOperatorStatusCondition{ - { - Type: configv1.OperatorAvailable, - Status: configv1.ConditionTrue, - }, - { - Type: configv1.OperatorProgressing, - Status: configv1.ConditionFalse, - }, - { - Type: configv1.OperatorFailing, - Status: configv1.ConditionTrue, - Reason: reason, - Message: message, +func (r *StatusReporter) failing(reason, message string) error { + status := configv1.ClusterOperatorStatus{ + Conditions: []configv1.ClusterOperatorStatusCondition{ + { + Type: configv1.OperatorAvailable, + Status: configv1.ConditionTrue, + }, + { + Type: configv1.OperatorProgressing, + Status: configv1.ConditionFalse, + }, + { + Type: configv1.OperatorFailing, + Status: configv1.ConditionTrue, + Reason: reason, + Message: message, + }, }, } - return r.ApplyConditions(conditions, false) -} + klog.Warningf("Operator status failing: %s", message) -type AvailableChecker interface { - // AvailableAndUpdated returns true if the reconciler reports all - // cluster autoscalers are at the latest version. - AvailableAndUpdated() (bool, error) + return r.ApplyStatus(status) } // progressing reports the operator as progressing but available, and not // failing -- optionally setting a reason and message. -func (r *StatusReporter) progressing() error { - glog.Infof("Syncing to version %v", r.releaseVersion) - conditions := []configv1.ClusterOperatorStatusCondition{ - { - Type: configv1.OperatorAvailable, - Status: configv1.ConditionTrue, - }, - { - Type: configv1.OperatorProgressing, - Status: configv1.ConditionTrue, - Reason: ReasonSyncing, - Message: fmt.Sprintf("Syncing to version %v", r.releaseVersion), - }, - { - Type: configv1.OperatorFailing, - Status: configv1.ConditionFalse, +func (r *StatusReporter) progressing(reason, message string) error { + status := configv1.ClusterOperatorStatus{ + Conditions: []configv1.ClusterOperatorStatusCondition{ + { + Type: configv1.OperatorAvailable, + Status: configv1.ConditionTrue, + }, + { + Type: configv1.OperatorProgressing, + Status: configv1.ConditionTrue, + Reason: reason, + Message: message, + }, + { + Type: configv1.OperatorFailing, + Status: configv1.ConditionFalse, + }, }, } - return r.ApplyConditions(conditions, false) + klog.Infof("Operator status progressing: %s", message) + + return r.ApplyStatus(status) } -// applyStatusInterface required here for test coverage of critical code. -// In actual operation, we are passing in StatusReporter. -func applyStatus(r applyStatusInterface, check AvailableChecker) (bool, error) { - ok, err := r.checkMachineAPI() - if err != nil { - r.fail(ReasonMissingDependency, fmt.Sprintf("error checking machine-api operator status %v", err)) - return false, nil - } - if !ok { - r.fail(ReasonMissingDependency, "machine-api operator not ready") - return false, nil +// Start checks the status of dependencies and reports the operator's status. It +// will poll until stopCh is closed or prerequisites are satisfied, in which +// case it will report the operator as available the configured version and wait +// for stopCh to close before returning. +func (r *StatusReporter) Start(stopCh <-chan struct{}) error { + interval := 15 * time.Second + + // Poll the status of our prerequisites and set our status + // accordingly. Rather than return errors and stop polling, most + // errors here should just be reported in the status message. + pollFunc := func() (bool, error) { + return r.ReportStatus() } - ok, err = check.AvailableAndUpdated() + + err := wait.PollImmediateUntil(interval, pollFunc, stopCh) + + // Block until the stop channel is closed. + <-stopCh + + return err +} + +// ReportStatus checks the status of each dependency and operand and reports the +// appropriate status via the operator's ClusterOperator object. +func (r *StatusReporter) ReportStatus() (bool, error) { + // Check that the machine-api-operator is reporting available. + ok, err := r.CheckMachineAPI() if err != nil { - r.fail(ReasonCheckAutoscaler, fmt.Sprintf("error checking autoscaler operator status: %v", err)) + msg := fmt.Sprintf("error checking machine-api status: %v", err) + r.failing(ReasonMissingDependency, msg) return false, nil } + if !ok { - r.progressing() + r.failing(ReasonMissingDependency, "machine-api not ready") return false, nil } - err = r.available(ReasonEmpty, "") + // Check that any CluterAutoscaler deployments are updated and available. + ok, err = r.CheckClusterAutoscaler() if err != nil { + msg := fmt.Sprintf("error checking autoscaler status: %v", err) + r.failing(ReasonCheckAutoscaler, msg) return false, nil } - return true, nil -} - -// Report checks the status of dependencies and reports the operator's -// status. It will poll until stopCh is closed or prerequisites are -// satisfied, in which case it will report the operator as available -// and return. check is used to verify that the reconciler has reached -// the desired state. -func (r *StatusReporter) Report(stopCh <-chan struct{}, check AvailableChecker) error { - interval := 15 * time.Second - // Poll the status of our prerequisites and set our status - // accordingly. Rather than return errors and stop polling, most - // errors here should just be reported in the status message. - pollFunc := func() (bool, error) { - return applyStatus(r, check) + if !ok { + msg := fmt.Sprintf("updating to %s", r.config.ReleaseVersion) + r.progressing(ReasonSyncing, msg) + return false, nil } - return wait.PollImmediateUntil(interval, pollFunc, stopCh) + msg := fmt.Sprintf("at version %s", r.config.ReleaseVersion) + r.available(ReasonEmpty, msg) + + return true, nil } -// checkMachineAPI checks the status of the machine-api-operator as +// CheckMachineAPI checks the status of the machine-api-operator as // reported to the CVO. It returns true if the operator is available // and not failing. -func (r *StatusReporter) checkMachineAPI() (bool, error) { - mao, err := r.client.ConfigV1().ClusterOperators(). +func (r *StatusReporter) CheckMachineAPI() (bool, error) { + mao, err := r.configClient.ConfigV1().ClusterOperators(). Get("machine-api", metav1.GetOptions{}) if err != nil { - glog.Errorf("failed to get dependency machine-api status: %v", err) + klog.Errorf("failed to get dependency machine-api status: %v", err) return false, err } @@ -256,6 +332,54 @@ func (r *StatusReporter) checkMachineAPI() (bool, error) { return true, nil } - glog.Infof("machine-api-operator not ready yet") + klog.Infof("machine-api-operator not ready yet") return false, nil } + +// CheckClusterAutoscaler checks the status of any cluster-autoscaler +// deployments. It returns a bool indicating whether the deployments are +// available and fully updated to the latest version and an error. +func (r *StatusReporter) CheckClusterAutoscaler() (bool, error) { + ca := &autoscalingv1.ClusterAutoscaler{} + caName := client.ObjectKey{Name: r.config.ClusterAutoscalerName} + + if err := r.client.Get(context.TODO(), caName, ca); err != nil { + if errors.IsNotFound(err) { + klog.Info("No ClusterAutoscaler. Reporting available.") + return true, nil + } + + klog.Errorf("Error getting ClusterAutoscaler: %v", err) + return false, err + } + + deployment := &appsv1.Deployment{} + deploymentName := client.ObjectKey{ + Name: fmt.Sprintf("%s-%s", OperatorName, r.config.ClusterAutoscalerName), + Namespace: r.config.ClusterAutoscalerNamespace, + } + + if err := r.client.Get(context.TODO(), deploymentName, deployment); err != nil { + if errors.IsNotFound(err) { + klog.Info("No ClusterAutoscaler deployment. Reporting unavailable.") + return false, nil + } + + klog.Errorf("Error getting ClusterAutoscaler deployment: %v", err) + return false, err + } + + if !util.ReleaseVersionMatches(deployment, r.config.ReleaseVersion) { + klog.Info("ClusterAutoscaler deployment version not current.") + return false, nil + } + + if !util.DeploymentUpdated(deployment) { + klog.Info("ClusterAutoscaler deployment updating.") + return false, nil + } + + klog.Info("ClusterAutoscaler deployment is available and updated.") + + return true, nil +} diff --git a/vendor/github.com/openshift/cluster-autoscaler-operator/pkg/util/util.go b/vendor/github.com/openshift/cluster-autoscaler-operator/pkg/util/util.go index 775cc61db..558a80611 100644 --- a/vendor/github.com/openshift/cluster-autoscaler-operator/pkg/util/util.go +++ b/vendor/github.com/openshift/cluster-autoscaler-operator/pkg/util/util.go @@ -1,5 +1,18 @@ package util +import ( + configv1 "github.com/openshift/api/config/v1" + cvorm "github.com/openshift/cluster-version-operator/lib/resourcemerge" + appsv1 "k8s.io/api/apps/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" +) + +// Common Kubernetes object annotations. +const ( + ReleaseVersionAnnotation = "release.openshift.io/version" + CriticalPodAnnotation = "scheduler.alpha.kubernetes.io/critical-pod" +) + // FilterString removes any instances of the needle from haystack. It // returns a new slice with all instances of needle removed, and a // count of the number instances encountered. @@ -17,3 +30,53 @@ func FilterString(haystack []string, needle string) ([]string, int) { return newSlice, found } + +// ReleaseVersionMatches checks whether a Kubernetes object has an OpenShift +// release version annotation that matches the given version. +func ReleaseVersionMatches(obj metav1.Object, version string) bool { + annotations := obj.GetAnnotations() + + value, found := annotations[ReleaseVersionAnnotation] + if !found || value != version { + return false + } + + return true +} + +// DeploymentUpdated checks whether a Kubernetes deployment object's replicas +// are fully updated and available. +func DeploymentUpdated(dep *appsv1.Deployment) bool { + if dep.Status.ObservedGeneration < dep.Generation { + return false + } + + if dep.Status.UpdatedReplicas != dep.Status.Replicas { + return false + } + + if dep.Status.AvailableReplicas == 0 { + return false + } + + return true +} + +// ResetProgressingTime finds the Progressing condition in the given slice, or +// creates a default one if none is found, and sets the LastTransitionTime to +// the current time. +func ResetProgressingTime(conds *[]configv1.ClusterOperatorStatusCondition) { + prog := cvorm.FindOperatorStatusCondition(*conds, configv1.OperatorProgressing) + + // If the Progressing condition wasn't found, set a default one. + if prog == nil { + prog = &configv1.ClusterOperatorStatusCondition{ + Type: configv1.OperatorProgressing, + Status: configv1.ConditionFalse, + } + } + + prog.LastTransitionTime = metav1.Now() + + cvorm.SetOperatorStatusCondition(conds, *prog) +} diff --git a/vendor/github.com/openshift/cluster-autoscaler-operator/test/e2e/main.go b/vendor/github.com/openshift/cluster-autoscaler-operator/test/e2e/main.go deleted file mode 100644 index bbf1179e8..000000000 --- a/vendor/github.com/openshift/cluster-autoscaler-operator/test/e2e/main.go +++ /dev/null @@ -1,111 +0,0 @@ -package main - -import ( - "flag" - "strings" - - "github.com/golang/glog" - osconfigv1 "github.com/openshift/api/config/v1" - "github.com/openshift/cluster-autoscaler-operator/pkg/apis" - "k8s.io/client-go/kubernetes/scheme" - "sigs.k8s.io/controller-runtime/pkg/client" - "sigs.k8s.io/controller-runtime/pkg/client/config" -) - -const ( - caName = "default" -) - -var focus string -var namespace string - -func init() { - flag.StringVar(&focus, "focus", "[openshift]", "If set, run only tests containing focus string. E.g. [k8s]") - flag.StringVar(&namespace, "namespace", "openshift-machine-api", "cluster-autoscaler-operator namespace") -} - -var F *Framework - -type Framework struct { - Client client.Client -} - -func newClient() error { - // Get a config to talk to the apiserver - cfg, err := config.GetConfig() - if err != nil { - return err - } - - client, err := client.New(cfg, client.Options{}) - if err != nil { - return err - } - - F = &Framework{Client: client} - - return nil -} - -func main() { - flag.Parse() - - if err := apis.AddToScheme(scheme.Scheme); err != nil { - glog.Fatal(err) - } - - if err := osconfigv1.AddToScheme(scheme.Scheme); err != nil { - glog.Fatal(err) - } - - if err := newClient(); err != nil { - glog.Fatal(err) - } - - if err := runSuite(); err != nil { - glog.Fatal(err) - } -} - -func runSuite() error { - - expectations := []struct { - expect func() error - name string - }{ - { - expect: ExpectOperatorAvailable, - name: "[k8s][openshift] Expect operator to be available", - }, - { - expect: ExpectClusterOperatorStatusAvailable, - name: "[openshift] Expect Cluster Operator status to be available", - }, - { - expect: CreateClusterAutoscaler, - name: "[openshift] Create Cluster Autoscaler resource", - }, - { - expect: ExpectClusterAutoscalerAvailable, - name: "[openshift] Expect Cluster Autoscaler available", - }, - { - expect: ExpectToScaleUpAndDown, - name: "[k8s] Expect to scale up and down", - }, - } - - for _, tc := range expectations { - if strings.HasPrefix(tc.name, focus) { - if err := tc.expect(); err != nil { - glog.Errorf("FAIL: %v: %v", tc.name, err) - return err - } - glog.Infof("PASS: %v", tc.name) - } else { - glog.Infof("SKIPPING: %v", tc.name) - } - } - - return nil -} diff --git a/vendor/github.com/openshift/cluster-autoscaler-operator/test/e2e/operator_expectations.go b/vendor/github.com/openshift/cluster-autoscaler-operator/test/e2e/operator_expectations.go deleted file mode 100644 index c595e8140..000000000 --- a/vendor/github.com/openshift/cluster-autoscaler-operator/test/e2e/operator_expectations.go +++ /dev/null @@ -1,325 +0,0 @@ -package main - -import ( - "fmt" - "github.com/openshift/cluster-autoscaler-operator/pkg/operator" - "time" - - "context" - - "github.com/golang/glog" - osconfigv1 "github.com/openshift/api/config/v1" - autoscalingv1alpha1 "github.com/openshift/cluster-autoscaler-operator/pkg/apis/autoscaling/v1alpha1" - cvorm "github.com/openshift/cluster-version-operator/lib/resourcemerge" - kappsapi "k8s.io/api/apps/v1" - batchv1 "k8s.io/api/batch/v1" - "k8s.io/api/core/v1" - "k8s.io/apimachinery/pkg/api/resource" - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - "k8s.io/apimachinery/pkg/types" - "k8s.io/apimachinery/pkg/util/wait" - "sigs.k8s.io/controller-runtime/pkg/client" -) - -const nodeGroupSize = 6 - -func clusterAutoscalerResource() *autoscalingv1alpha1.ClusterAutoscaler { - var ( - PodPriorityThreshold int32 = -10 - MaxPodGracePeriod int32 = 60 - MaxNodesTotal int32 = 100 - CoresMin int32 = 16 - CoresMax int32 = 32 - MemoryMin int32 = 32 - MemoryMax int32 = 64 - ) - - return &autoscalingv1alpha1.ClusterAutoscaler{ - TypeMeta: metav1.TypeMeta{ - Kind: "ClusterAutoscaler", - APIVersion: "autoscaling.openshift.io/v1alpha1", - }, - ObjectMeta: metav1.ObjectMeta{ - Name: caName, - Namespace: namespace, - }, - Spec: autoscalingv1alpha1.ClusterAutoscalerSpec{ - MaxPodGracePeriod: &MaxPodGracePeriod, - PodPriorityThreshold: &PodPriorityThreshold, - ResourceLimits: &autoscalingv1alpha1.ResourceLimits{ - MaxNodesTotal: &MaxNodesTotal, - Cores: &autoscalingv1alpha1.ResourceRange{ - Min: CoresMin, - Max: CoresMax, - }, - Memory: &autoscalingv1alpha1.ResourceRange{ - Min: MemoryMin, - Max: MemoryMax, - }, - }, - }, - } -} - -func machineAutoscalerResource() *autoscalingv1alpha1.MachineAutoscaler { - return &autoscalingv1alpha1.MachineAutoscaler{ - TypeMeta: metav1.TypeMeta{ - Kind: "MachineAutoscaler", - APIVersion: "autoscaling.openshift.io/v1alpha1", - }, - ObjectMeta: metav1.ObjectMeta{ - Name: "compute-pool", - Namespace: namespace, - }, - Spec: autoscalingv1alpha1.MachineAutoscalerSpec{ - MinReplicas: 1, - MaxReplicas: nodeGroupSize, - ScaleTargetRef: autoscalingv1alpha1.CrossVersionObjectReference{ - Kind: "MachineSet", - APIVersion: "machine.openshift.io/v1beta1", - Name: "kubemark-machine-pool", - }, - }, - } -} - -func workloadResource() *batchv1.Job { - var backoffLimit int32 = 4 - var completions int32 = 40 - var parallelism int32 = 40 - return &batchv1.Job{ - ObjectMeta: metav1.ObjectMeta{ - Name: "workload", - Namespace: "default", - }, - Spec: batchv1.JobSpec{ - Template: v1.PodTemplateSpec{ - Spec: v1.PodSpec{ - Containers: []v1.Container{ - { - Name: "work", - Image: "busybox", - Command: []string{ - "sleep", - "120", - }, - Resources: v1.ResourceRequirements{ - Requests: v1.ResourceList{ - "cpu": resource.MustParse("500m"), - "memory": resource.MustParse("500Mi"), - }, - }, - }, - }, - RestartPolicy: v1.RestartPolicyNever, - NodeSelector: map[string]string{ - "node-role.kubernetes.io/compute": "", - }, - Tolerations: []v1.Toleration{ - { - Key: "kubemark", - Operator: v1.TolerationOpExists, - }, - }, - }, - }, - BackoffLimit: &backoffLimit, - Completions: &completions, - Parallelism: ¶llelism, - }, - } -} - -func verifyClusterAutoscalerOperatorIsReady() error { - name := "cluster-autoscaler-operator" - key := types.NamespacedName{ - Namespace: namespace, - Name: name, - } - d := &kappsapi.Deployment{} - - err := wait.PollImmediate(1*time.Second, 1*time.Minute, func() (bool, error) { - if err := F.Client.Get(context.TODO(), key, d); err != nil { - glog.Errorf("error querying api for Deployment object: %v, retrying...", err) - return false, nil - } - if d.Status.ReadyReplicas < 1 { - return false, nil - } - return true, nil - }) - return err -} - -func verifyClusterAutoscalerIsReady() error { - name := fmt.Sprintf("cluster-autoscaler-%s", caName) - key := types.NamespacedName{ - Namespace: namespace, - Name: name, - } - d := &kappsapi.Deployment{} - - err := wait.PollImmediate(1*time.Second, 1*time.Minute, func() (bool, error) { - if err := F.Client.Get(context.TODO(), key, d); err != nil { - glog.Errorf("error querying api for Deployment object: %v, retrying...", err) - return false, nil - } - if d.Status.ReadyReplicas < 1 { - return false, nil - } - return true, nil - }) - return err -} - -func ExpectOperatorAvailable() error { - return verifyClusterAutoscalerOperatorIsReady() -} - -func ExpectClusterOperatorStatusAvailable() error { - name := operator.OperatorName - key := types.NamespacedName{ - Namespace: namespace, - Name: name, - } - clusterOperator := &osconfigv1.ClusterOperator{} - - err := wait.PollImmediate(1*time.Second, 1*time.Minute, func() (bool, error) { - if err := F.Client.Get(context.TODO(), key, clusterOperator); err != nil { - glog.Errorf("error querying api for OperatorStatus object: %v, retrying...", err) - return false, nil - } - if cvorm.IsOperatorStatusConditionTrue(clusterOperator.Status.Conditions, osconfigv1.OperatorAvailable) { - return true, nil - } - return false, nil - }) - return err -} - -func CreateClusterAutoscaler() error { - ca := clusterAutoscalerResource() - return F.Client.Create(context.TODO(), ca) -} - -func ExpectClusterAutoscalerAvailable() error { - return verifyClusterAutoscalerIsReady() -} - -func isNodeReady(node *v1.Node) bool { - for _, c := range node.Status.Conditions { - if c.Type == v1.NodeReady { - return c.Status == v1.ConditionTrue - } - } - return false -} - -// ExpectToScaleUpAndDown assumes the cluster autoscaler is already deployed -func ExpectToScaleUpAndDown() error { - tenSeconds := "10s" - - ca := *clusterAutoscalerResource() - // change the min core and memory to 1 so the autoscaler scales down as much as it can - ca.Spec.ResourceLimits.Cores.Min = 1 - ca.Spec.ResourceLimits.Memory.Min = 1 - ca.Spec.ScaleDown = &autoscalingv1alpha1.ScaleDownConfig{ - Enabled: true, - DelayAfterAdd: &tenSeconds, - DelayAfterDelete: &tenSeconds, - DelayAfterFailure: &tenSeconds, - UnneededTime: &tenSeconds, - } - if err := F.Client.Create(context.TODO(), &ca); err != nil { - return fmt.Errorf("unable to deploy ClusterAutoscaler resource: %v", err) - } - - if err := verifyClusterAutoscalerIsReady(); err != nil { - return fmt.Errorf("cluster autoscaler not ready: %v", err) - } - - ma := machineAutoscalerResource() - if err := F.Client.Create(context.TODO(), ma); err != nil { - return fmt.Errorf("unable to deploy MachineAutoscaler resource: %v", err) - } - - workload := workloadResource() - if err := F.Client.Create(context.TODO(), workload); err != nil { - return fmt.Errorf("unable to deploy workload resource: %v", err) - } - - err := wait.PollImmediate(1*time.Second, 1*time.Minute, func() (bool, error) { - nodes := v1.NodeList{} - if err := F.Client.List(context.TODO(), &client.ListOptions{}, &nodes); err != nil { - glog.Errorf("error querying api for Node object: %v, retrying...", err) - return false, nil - } - // expecting nodeGroupSize nodes - nodeCounter := 0 - for _, node := range nodes.Items { - if _, exists := node.Labels["node-role.kubernetes.io/compute"]; !exists { - continue - } - - if !isNodeReady(&node) { - continue - } - - nodeCounter++ - } - - if nodeCounter < 6 { - glog.Errorf("Expecting %v nodes with 'node-role.kubernetes.io/compute' label in Ready state, got %v", nodeGroupSize, nodeCounter) - return false, nil - } - - glog.Infof("Expected number (%v) of nodes with 'node-role.kubernetes.io/compute' label in Ready state found", nodeGroupSize) - return true, nil - }) - - if err != nil { - return err - } - - glog.Infof("Succesfully scaled up") - - cascadeDelete := metav1.DeletePropagationForeground - if err := F.Client.Delete(context.TODO(), workload, func(opt *client.DeleteOptions) { opt.PropagationPolicy = &cascadeDelete }); err != nil { - return fmt.Errorf("unable to delete workload resource: %v", err) - } - - if err = wait.PollImmediate(1*time.Second, 10*time.Minute, func() (bool, error) { - nodes := v1.NodeList{} - if err := F.Client.List(context.TODO(), &client.ListOptions{}, &nodes); err != nil { - glog.Errorf("error querying api for Node object: %v, retrying...", err) - return false, nil - } - // expecting nodeGroupSize nodes - nodeCounter := 0 - for _, node := range nodes.Items { - if _, exists := node.Labels["node-role.kubernetes.io/compute"]; !exists { - continue - } - - if !isNodeReady(&node) { - continue - } - - nodeCounter++ - } - - if nodeCounter > 1 { - glog.Errorf("Expecting 1 node with 'node-role.kubernetes.io/compute' label in Ready state, got %v", nodeCounter) - return false, nil - } - - glog.Info("Expected number (1) of nodes with 'node-role.kubernetes.io/compute' label in Ready state found") - return true, nil - }); err != nil { - return err - } - - glog.Infof("Succesfully scaled down") - - return nil -} diff --git a/vendor/github.com/openshift/cluster-autoscaler-operator/test/resources/cluster.yaml b/vendor/github.com/openshift/cluster-autoscaler-operator/test/resources/cluster.yaml deleted file mode 100644 index e1e4f21f5..000000000 --- a/vendor/github.com/openshift/cluster-autoscaler-operator/test/resources/cluster.yaml +++ /dev/null @@ -1,15 +0,0 @@ ---- -apiVersion: "cluster.k8s.io/v1alpha1" -kind: Cluster -metadata: - name: kubemark - namespace: kube-system -spec: - clusterNetwork: - services: - cidrBlocks: - - "10.0.0.1/24" - pods: - cidrBlocks: - - "10.0.0.2/24" - serviceDomain: example.com diff --git a/vendor/github.com/openshift/cluster-autoscaler-operator/test/resources/machine-set.yaml b/vendor/github.com/openshift/cluster-autoscaler-operator/test/resources/machine-set.yaml deleted file mode 100644 index ece739f16..000000000 --- a/vendor/github.com/openshift/cluster-autoscaler-operator/test/resources/machine-set.yaml +++ /dev/null @@ -1,26 +0,0 @@ ---- -apiVersion: machine.openshift.io/v1beta1 -kind: MachineSet -metadata: - name: kubemark-machine-pool - namespace: kube-system -spec: - replicas: 1 - selector: - matchLabels: - machine.openshift.io/cluster-api-machineset: kubemark-machine-pool - template: - metadata: - labels: - machine.openshift.io/cluster-api-machineset: kubemark-machine-pool - spec: - metadata: - labels: - node-role.kubernetes.io/compute: "" - providerSpec: - value: - apiVersion: kubemarkproviderconfig.k8s.io/v1alpha1 - kind: KubemarkMachineProviderConfig - versions: - kubelet: 1.10.1 - controlPlane: 1.10.1