From 2481a7201d81b73ba31b436abffa0f4a521778cc Mon Sep 17 00:00:00 2001 From: Chris Bandy Date: Wed, 10 Apr 2024 13:11:29 -0500 Subject: [PATCH] Bump controller-tools to v0.9.0 This version supports CEL validation rules via Go markers. --- Makefile | 2 +- build/crd/crunchybridgeclusters/immutable.yaml | 11 ----------- .../crunchybridgeclusters/kustomization.yaml | 18 ------------------ build/crd/pgadmins/kustomization.yaml | 12 ------------ build/crd/pgupgrades/kustomization.yaml | 12 ------------ build/crd/postgresclusters/kustomization.yaml | 6 ------ build/crd/postgresclusters/status.yaml | 6 ------ ....crunchydata.com_crunchybridgeclusters.yaml | 2 +- ...gres-operator.crunchydata.com_pgadmins.yaml | 2 +- ...es-operator.crunchydata.com_pgupgrades.yaml | 2 +- ...rator.crunchydata.com_postgresclusters.yaml | 2 +- .../v1beta1/crunchy_bridgecluster_types.go | 2 ++ 12 files changed, 7 insertions(+), 70 deletions(-) delete mode 100644 build/crd/crunchybridgeclusters/immutable.yaml delete mode 100644 build/crd/postgresclusters/status.yaml diff --git a/Makefile b/Makefile index 5b8a097a77..fccd332bc4 100644 --- a/Makefile +++ b/Makefile @@ -324,7 +324,7 @@ endef CONTROLLER ?= hack/tools/controller-gen tools: tools/controller-gen tools/controller-gen: - $(call go-get-tool,$(CONTROLLER),sigs.k8s.io/controller-tools/cmd/controller-gen@v0.8.0) + $(call go-get-tool,$(CONTROLLER),sigs.k8s.io/controller-tools/cmd/controller-gen@v0.9.0) ENVTEST ?= hack/tools/setup-envtest tools: tools/setup-envtest diff --git a/build/crd/crunchybridgeclusters/immutable.yaml b/build/crd/crunchybridgeclusters/immutable.yaml deleted file mode 100644 index 588d051e5d..0000000000 --- a/build/crd/crunchybridgeclusters/immutable.yaml +++ /dev/null @@ -1,11 +0,0 @@ -- op: add - path: /work - value: [{ message: 'immutable', rule: 'self == oldSelf'}] -- op: copy - from: /work - path: /spec/versions/0/schema/openAPIV3Schema/properties/spec/properties/provider/x-kubernetes-validations -- op: copy - from: /work - path: /spec/versions/0/schema/openAPIV3Schema/properties/spec/properties/region/x-kubernetes-validations -- op: remove - path: /work diff --git a/build/crd/crunchybridgeclusters/kustomization.yaml b/build/crd/crunchybridgeclusters/kustomization.yaml index 33e74bdef3..26454f3b07 100644 --- a/build/crd/crunchybridgeclusters/kustomization.yaml +++ b/build/crd/crunchybridgeclusters/kustomization.yaml @@ -5,18 +5,6 @@ resources: - generated/postgres-operator.crunchydata.com_crunchybridgeclusters.yaml patches: -# Remove the zero status field included by controller-gen@v0.8.0. These zero -# values conflict with the CRD controller in Kubernetes before v1.22. -# - https://github.com/kubernetes-sigs/controller-tools/pull/630 -# - https://pr.k8s.io/100970 -- target: - group: apiextensions.k8s.io - version: v1 - kind: CustomResourceDefinition - name: crunchybridgeclusters.postgres-operator.crunchydata.com - patch: |- - - op: remove - path: /status - target: group: apiextensions.k8s.io version: v1 @@ -29,9 +17,3 @@ patches: value: app.kubernetes.io/name: pgo app.kubernetes.io/version: latest -- target: - group: apiextensions.k8s.io - version: v1 - kind: CustomResourceDefinition - name: crunchybridgeclusters.postgres-operator.crunchydata.com - path: immutable.yaml diff --git a/build/crd/pgadmins/kustomization.yaml b/build/crd/pgadmins/kustomization.yaml index 78888103ef..ca67fb89fa 100644 --- a/build/crd/pgadmins/kustomization.yaml +++ b/build/crd/pgadmins/kustomization.yaml @@ -5,18 +5,6 @@ resources: - generated/postgres-operator.crunchydata.com_pgadmins.yaml patches: -# Remove the zero status field included by controller-gen@v0.8.0. These zero -# values conflict with the CRD controller in Kubernetes before v1.22. -# - https://github.com/kubernetes-sigs/controller-tools/pull/630 -# - https://pr.k8s.io/100970 -- target: - group: apiextensions.k8s.io - version: v1 - kind: CustomResourceDefinition - name: pgadmins.postgres-operator.crunchydata.com - patch: |- - - op: remove - path: /status - target: group: apiextensions.k8s.io version: v1 diff --git a/build/crd/pgupgrades/kustomization.yaml b/build/crd/pgupgrades/kustomization.yaml index 67bca8fca8..260b7e42cd 100644 --- a/build/crd/pgupgrades/kustomization.yaml +++ b/build/crd/pgupgrades/kustomization.yaml @@ -5,18 +5,6 @@ resources: - generated/postgres-operator.crunchydata.com_pgupgrades.yaml patches: -# Remove the zero status field included by controller-gen@v0.8.0. These zero -# values conflict with the CRD controller in Kubernetes before v1.22. -# - https://github.com/kubernetes-sigs/controller-tools/pull/630 -# - https://pr.k8s.io/100970 -- target: - group: apiextensions.k8s.io - version: v1 - kind: CustomResourceDefinition - name: pgupgrades.postgres-operator.crunchydata.com - patch: |- - - op: remove - path: /status - target: group: apiextensions.k8s.io version: v1 diff --git a/build/crd/postgresclusters/kustomization.yaml b/build/crd/postgresclusters/kustomization.yaml index 4e790295c4..eb8cb6540f 100644 --- a/build/crd/postgresclusters/kustomization.yaml +++ b/build/crd/postgresclusters/kustomization.yaml @@ -11,12 +11,6 @@ patchesJson6902: kind: CustomResourceDefinition name: postgresclusters.postgres-operator.crunchydata.com path: condition.yaml -- target: - group: apiextensions.k8s.io - version: v1 - kind: CustomResourceDefinition - name: postgresclusters.postgres-operator.crunchydata.com - path: status.yaml - target: group: apiextensions.k8s.io version: v1 diff --git a/build/crd/postgresclusters/status.yaml b/build/crd/postgresclusters/status.yaml deleted file mode 100644 index eacd47582f..0000000000 --- a/build/crd/postgresclusters/status.yaml +++ /dev/null @@ -1,6 +0,0 @@ -# Remove the zero status field included by controller-gen@v0.8.0. These zero -# values conflict with the CRD controller in Kubernetes before v1.22. -# - https://github.com/kubernetes-sigs/controller-tools/pull/630 -# - https://pr.k8s.io/100970 -- op: remove - path: /status diff --git a/config/crd/bases/postgres-operator.crunchydata.com_crunchybridgeclusters.yaml b/config/crd/bases/postgres-operator.crunchydata.com_crunchybridgeclusters.yaml index 8cc44b0881..e0bff0cc56 100644 --- a/config/crd/bases/postgres-operator.crunchydata.com_crunchybridgeclusters.yaml +++ b/config/crd/bases/postgres-operator.crunchydata.com_crunchybridgeclusters.yaml @@ -2,7 +2,7 @@ apiVersion: apiextensions.k8s.io/v1 kind: CustomResourceDefinition metadata: annotations: - controller-gen.kubebuilder.io/version: v0.8.0 + controller-gen.kubebuilder.io/version: v0.9.0 creationTimestamp: null labels: app.kubernetes.io/name: pgo diff --git a/config/crd/bases/postgres-operator.crunchydata.com_pgadmins.yaml b/config/crd/bases/postgres-operator.crunchydata.com_pgadmins.yaml index f0dae5f9c3..40a8330085 100644 --- a/config/crd/bases/postgres-operator.crunchydata.com_pgadmins.yaml +++ b/config/crd/bases/postgres-operator.crunchydata.com_pgadmins.yaml @@ -2,7 +2,7 @@ apiVersion: apiextensions.k8s.io/v1 kind: CustomResourceDefinition metadata: annotations: - controller-gen.kubebuilder.io/version: v0.8.0 + controller-gen.kubebuilder.io/version: v0.9.0 creationTimestamp: null labels: app.kubernetes.io/name: pgo diff --git a/config/crd/bases/postgres-operator.crunchydata.com_pgupgrades.yaml b/config/crd/bases/postgres-operator.crunchydata.com_pgupgrades.yaml index b35c209b37..08d1472582 100644 --- a/config/crd/bases/postgres-operator.crunchydata.com_pgupgrades.yaml +++ b/config/crd/bases/postgres-operator.crunchydata.com_pgupgrades.yaml @@ -2,7 +2,7 @@ apiVersion: apiextensions.k8s.io/v1 kind: CustomResourceDefinition metadata: annotations: - controller-gen.kubebuilder.io/version: v0.8.0 + controller-gen.kubebuilder.io/version: v0.9.0 creationTimestamp: null labels: app.kubernetes.io/name: pgo diff --git a/config/crd/bases/postgres-operator.crunchydata.com_postgresclusters.yaml b/config/crd/bases/postgres-operator.crunchydata.com_postgresclusters.yaml index 4b6a4f84a1..700b0e3173 100644 --- a/config/crd/bases/postgres-operator.crunchydata.com_postgresclusters.yaml +++ b/config/crd/bases/postgres-operator.crunchydata.com_postgresclusters.yaml @@ -2,7 +2,7 @@ apiVersion: apiextensions.k8s.io/v1 kind: CustomResourceDefinition metadata: annotations: - controller-gen.kubebuilder.io/version: v0.8.0 + controller-gen.kubebuilder.io/version: v0.9.0 creationTimestamp: null labels: app.kubernetes.io/name: pgo diff --git a/pkg/apis/postgres-operator.crunchydata.com/v1beta1/crunchy_bridgecluster_types.go b/pkg/apis/postgres-operator.crunchydata.com/v1beta1/crunchy_bridgecluster_types.go index 0513a4fb6b..c72ca07471 100644 --- a/pkg/apis/postgres-operator.crunchydata.com/v1beta1/crunchy_bridgecluster_types.go +++ b/pkg/apis/postgres-operator.crunchydata.com/v1beta1/crunchy_bridgecluster_types.go @@ -64,10 +64,12 @@ type CrunchyBridgeClusterSpec struct { // Currently Bridge offers aws, azure, and gcp only // +kubebuilder:validation:Required // +kubebuilder:validation:Enum={aws,azure,gcp} + // +kubebuilder:validation:XValidation:rule=`self == oldSelf`,message="immutable" Provider string `json:"provider"` // The provider region where the cluster is located. // +kubebuilder:validation:Required + // +kubebuilder:validation:XValidation:rule=`self == oldSelf`,message="immutable" Region string `json:"region"` // Roles for which to create Secrets that contain their credentials which