From 63d571ee2f0acf4d2f4bf939089f801848655d34 Mon Sep 17 00:00:00 2001 From: Hui Kang Date: Thu, 30 Dec 2021 15:11:21 -0500 Subject: [PATCH 1/3] fix: missing array type in the CRD rollout's spec volumes Signed-off-by: Hui Kang Signed-off-by: Hui Kang --- docs/features/kustomize/rollout_cr_schema.json | 7 +++++-- hack/gen-crd-spec/main.go | 2 +- manifests/crds/rollout-crd.yaml | 4 +++- manifests/install.yaml | 4 +++- manifests/namespace-install.yaml | 4 +++- pkg/apis/rollouts/v1alpha1/zz_generated.deepcopy.go | 1 + 6 files changed, 16 insertions(+), 6 deletions(-) diff --git a/docs/features/kustomize/rollout_cr_schema.json b/docs/features/kustomize/rollout_cr_schema.json index c228c79733..0578824a9d 100644 --- a/docs/features/kustomize/rollout_cr_schema.json +++ b/docs/features/kustomize/rollout_cr_schema.json @@ -2834,9 +2834,12 @@ "x-kubernetes-patch-strategy": "merge" }, "volumes": { + "items": { + "x-kubernetes-preserve-unknown-fields": true + }, + "type": "array", "x-kubernetes-patch-merge-key": "name", - "x-kubernetes-patch-strategy": "merge,retainKeys", - "x-kubernetes-preserve-unknown-fields": true + "x-kubernetes-patch-strategy": "merge,retainKeys" } }, "required": [ diff --git a/hack/gen-crd-spec/main.go b/hack/gen-crd-spec/main.go index 42f611d009..8ed5f46ede 100644 --- a/hack/gen-crd-spec/main.go +++ b/hack/gen-crd-spec/main.go @@ -244,7 +244,7 @@ func removeK8S118Fields(un *unstructured.Unstructured) { setValidationOverride(un, preserveUnknownFields, "spec.template.spec.ephemeralContainers[].resources.requests") // Replace this with "spec.template.spec.volumes[].ephemeral.volumeClaimTemplate.spec.resources.{limits/requests}" // when it's ok to only support k8s 1.17+ - setValidationOverride(un, preserveUnknownFields, "spec.template.spec.volumes") + setValidationOverride(un, preserveUnknownFields, "spec.template.spec.volumes[]") case "Experiment": setValidationOverride(un, preserveUnknownFields, "spec.templates[].template.spec.containers[].resources.limits") setValidationOverride(un, preserveUnknownFields, "spec.templates[].template.spec.containers[].resources.requests") diff --git a/manifests/crds/rollout-crd.yaml b/manifests/crds/rollout-crd.yaml index 22a475b1c4..8c258e1405 100644 --- a/manifests/crds/rollout-crd.yaml +++ b/manifests/crds/rollout-crd.yaml @@ -2882,7 +2882,9 @@ spec: - whenUnsatisfiable x-kubernetes-list-type: map volumes: - x-kubernetes-preserve-unknown-fields: true + items: + x-kubernetes-preserve-unknown-fields: true + type: array required: - containers type: object diff --git a/manifests/install.yaml b/manifests/install.yaml index ac1f78a792..564b23f827 100644 --- a/manifests/install.yaml +++ b/manifests/install.yaml @@ -13354,7 +13354,9 @@ spec: - whenUnsatisfiable x-kubernetes-list-type: map volumes: - x-kubernetes-preserve-unknown-fields: true + items: + x-kubernetes-preserve-unknown-fields: true + type: array required: - containers type: object diff --git a/manifests/namespace-install.yaml b/manifests/namespace-install.yaml index 05ff7bc8d7..d229e6bb58 100644 --- a/manifests/namespace-install.yaml +++ b/manifests/namespace-install.yaml @@ -13354,7 +13354,9 @@ spec: - whenUnsatisfiable x-kubernetes-list-type: map volumes: - x-kubernetes-preserve-unknown-fields: true + items: + x-kubernetes-preserve-unknown-fields: true + type: array required: - containers type: object diff --git a/pkg/apis/rollouts/v1alpha1/zz_generated.deepcopy.go b/pkg/apis/rollouts/v1alpha1/zz_generated.deepcopy.go index 0a048cbd5c..e2fc88796b 100644 --- a/pkg/apis/rollouts/v1alpha1/zz_generated.deepcopy.go +++ b/pkg/apis/rollouts/v1alpha1/zz_generated.deepcopy.go @@ -1,3 +1,4 @@ +//go:build !ignore_autogenerated // +build !ignore_autogenerated /* From b6b23b616276a47e0673880b881dab130bb30130 Mon Sep 17 00:00:00 2001 From: Hui Kang Date: Sat, 1 Jan 2022 13:17:21 -0500 Subject: [PATCH 2/3] fix codegen Signed-off-by: Hui Kang --- pkg/apis/rollouts/v1alpha1/zz_generated.deepcopy.go | 1 - 1 file changed, 1 deletion(-) diff --git a/pkg/apis/rollouts/v1alpha1/zz_generated.deepcopy.go b/pkg/apis/rollouts/v1alpha1/zz_generated.deepcopy.go index e2fc88796b..0a048cbd5c 100644 --- a/pkg/apis/rollouts/v1alpha1/zz_generated.deepcopy.go +++ b/pkg/apis/rollouts/v1alpha1/zz_generated.deepcopy.go @@ -1,4 +1,3 @@ -//go:build !ignore_autogenerated // +build !ignore_autogenerated /* From 498477257a17a3e8befda2c915c03c555d5c8003 Mon Sep 17 00:00:00 2001 From: Hui Kang Date: Tue, 11 Jan 2022 13:17:09 -0500 Subject: [PATCH 3/3] add volume to e2e test Signed-off-by: Hui Kang --- test/e2e/bluegreen_test.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/test/e2e/bluegreen_test.go b/test/e2e/bluegreen_test.go index 0d1e38bf5d..a7c263acb3 100644 --- a/test/e2e/bluegreen_test.go +++ b/test/e2e/bluegreen_test.go @@ -111,6 +111,9 @@ spec: requests: memory: 16Mi cpu: 1m + volumes: + - name: cache-volume + emptyDir: {} `). When(). ApplyManifests().