From 4fded3d5eab201f4f71b5170ef06be9ec34ec25d Mon Sep 17 00:00:00 2001 From: Fumiaki MATSUSHIMA Date: Wed, 23 Sep 2020 18:10:17 +0900 Subject: [PATCH] chore: Set preserveUnknownFields: false to prevent mistake (#708) --- Makefile | 2 +- hack/gen-crd-spec/main.go | 6 ++++++ hack/update-codegen.sh | 2 ++ manifests/crds/analysis-run-crd.yaml | 1 + manifests/crds/analysis-template-crd.yaml | 1 + manifests/crds/cluster-analysis-template-crd.yaml | 1 + manifests/crds/experiment-crd.yaml | 1 + manifests/crds/rollout-crd.yaml | 1 + manifests/install.yaml | 11 +++++++---- manifests/namespace-install.yaml | 11 +++++++---- 10 files changed, 28 insertions(+), 9 deletions(-) diff --git a/Makefile b/Makefile index ef6b14d6bc..a342f570ac 100644 --- a/Makefile +++ b/Makefile @@ -54,7 +54,7 @@ all: controller image codegen: mocks ./hack/update-codegen.sh ./hack/update-openapigen.sh - PATH=$$DIST_DIR:$$PATH go run ./hack/gen-crd-spec/main.go + PATH=${DIST_DIR}:$$PATH go run ./hack/gen-crd-spec/main.go .PHONY: controller controller: clean-debug diff --git a/hack/gen-crd-spec/main.go b/hack/gen-crd-spec/main.go index 42d64c7843..0e1f0fbc45 100644 --- a/hack/gen-crd-spec/main.go +++ b/hack/gen-crd-spec/main.go @@ -57,6 +57,7 @@ func NewCustomResourceDefinition() []*extensionsobj.CustomResourceDefinition { "controller-gen", "paths=./pkg/apis/rollouts/...", "crd:trivialVersions=true", + "crd:preserveUnknownFields=false", "output:crd:stdout", ).Output() if err != nil { @@ -72,6 +73,11 @@ func NewCustomResourceDefinition() []*extensionsobj.CustomResourceDefinition { // clean up stuff left by controller-gen deleteFile("config/webhook/manifests.yaml") deleteFile("config/webhook") + deleteFile("config/argoproj.io_analysisruns.yaml") + deleteFile("config/argoproj.io_analysistemplates.yaml") + deleteFile("config/argoproj.io_clusteranalysistemplates.yaml") + deleteFile("config/argoproj.io_experiments.yaml") + deleteFile("config/argoproj.io_rollouts.yaml") deleteFile("config") crds := []*extensionsobj.CustomResourceDefinition{} diff --git a/hack/update-codegen.sh b/hack/update-codegen.sh index 62899b3671..bf4ad242ef 100755 --- a/hack/update-codegen.sh +++ b/hack/update-codegen.sh @@ -1,3 +1,5 @@ +#! /usr/bin/env bash + set -o errexit set -o nounset set -o pipefail diff --git a/manifests/crds/analysis-run-crd.yaml b/manifests/crds/analysis-run-crd.yaml index 3c1c5e8d7b..77dd4e8daf 100644 --- a/manifests/crds/analysis-run-crd.yaml +++ b/manifests/crds/analysis-run-crd.yaml @@ -18,6 +18,7 @@ spec: shortNames: - ar singular: analysisrun + preserveUnknownFields: false scope: Namespaced subresources: {} validation: diff --git a/manifests/crds/analysis-template-crd.yaml b/manifests/crds/analysis-template-crd.yaml index 9da40799a2..cad17a64cb 100644 --- a/manifests/crds/analysis-template-crd.yaml +++ b/manifests/crds/analysis-template-crd.yaml @@ -13,6 +13,7 @@ spec: shortNames: - at singular: analysistemplate + preserveUnknownFields: false scope: Namespaced validation: openAPIV3Schema: diff --git a/manifests/crds/cluster-analysis-template-crd.yaml b/manifests/crds/cluster-analysis-template-crd.yaml index 3cb48436cf..9800ebce5f 100644 --- a/manifests/crds/cluster-analysis-template-crd.yaml +++ b/manifests/crds/cluster-analysis-template-crd.yaml @@ -13,6 +13,7 @@ spec: shortNames: - cat singular: clusteranalysistemplate + preserveUnknownFields: false scope: Cluster validation: openAPIV3Schema: diff --git a/manifests/crds/experiment-crd.yaml b/manifests/crds/experiment-crd.yaml index 22c4026b20..a1f9c95e8c 100644 --- a/manifests/crds/experiment-crd.yaml +++ b/manifests/crds/experiment-crd.yaml @@ -18,6 +18,7 @@ spec: shortNames: - exp singular: experiment + preserveUnknownFields: false scope: Namespaced subresources: {} validation: diff --git a/manifests/crds/rollout-crd.yaml b/manifests/crds/rollout-crd.yaml index 9ed9a8d608..e51ea00863 100644 --- a/manifests/crds/rollout-crd.yaml +++ b/manifests/crds/rollout-crd.yaml @@ -30,6 +30,7 @@ spec: shortNames: - ro singular: rollout + preserveUnknownFields: false scope: Namespaced subresources: scale: diff --git a/manifests/install.yaml b/manifests/install.yaml index 7903b8d31a..b386a51412 100644 --- a/manifests/install.yaml +++ b/manifests/install.yaml @@ -19,6 +19,7 @@ spec: shortNames: - ar singular: analysisrun + preserveUnknownFields: false scope: Namespaced subresources: {} validation: @@ -2824,6 +2825,7 @@ spec: shortNames: - at singular: analysistemplate + preserveUnknownFields: false scope: Namespaced validation: openAPIV3Schema: @@ -5556,6 +5558,7 @@ spec: shortNames: - cat singular: clusteranalysistemplate + preserveUnknownFields: false scope: Cluster validation: openAPIV3Schema: @@ -8293,6 +8296,7 @@ spec: shortNames: - exp singular: experiment + preserveUnknownFields: false scope: Namespaced subresources: {} validation: @@ -10964,13 +10968,11 @@ spec: name: Current type: integer - JSONPath: .status.updatedReplicas - description: Total number of non-terminated pods targeted by this rollout that - have the desired template spec + description: Total number of non-terminated pods targeted by this rollout that have the desired template spec name: Up-to-date type: integer - JSONPath: .status.availableReplicas - description: Total number of available pods (ready for at least minReadySeconds) - targeted by this rollout + description: Total number of available pods (ready for at least minReadySeconds) targeted by this rollout name: Available type: integer group: argoproj.io @@ -10981,6 +10983,7 @@ spec: shortNames: - ro singular: rollout + preserveUnknownFields: false scope: Namespaced subresources: scale: diff --git a/manifests/namespace-install.yaml b/manifests/namespace-install.yaml index d34744dccd..a03d20173e 100644 --- a/manifests/namespace-install.yaml +++ b/manifests/namespace-install.yaml @@ -19,6 +19,7 @@ spec: shortNames: - ar singular: analysisrun + preserveUnknownFields: false scope: Namespaced subresources: {} validation: @@ -2824,6 +2825,7 @@ spec: shortNames: - at singular: analysistemplate + preserveUnknownFields: false scope: Namespaced validation: openAPIV3Schema: @@ -5556,6 +5558,7 @@ spec: shortNames: - cat singular: clusteranalysistemplate + preserveUnknownFields: false scope: Cluster validation: openAPIV3Schema: @@ -8293,6 +8296,7 @@ spec: shortNames: - exp singular: experiment + preserveUnknownFields: false scope: Namespaced subresources: {} validation: @@ -10964,13 +10968,11 @@ spec: name: Current type: integer - JSONPath: .status.updatedReplicas - description: Total number of non-terminated pods targeted by this rollout that - have the desired template spec + description: Total number of non-terminated pods targeted by this rollout that have the desired template spec name: Up-to-date type: integer - JSONPath: .status.availableReplicas - description: Total number of available pods (ready for at least minReadySeconds) - targeted by this rollout + description: Total number of available pods (ready for at least minReadySeconds) targeted by this rollout name: Available type: integer group: argoproj.io @@ -10981,6 +10983,7 @@ spec: shortNames: - ro singular: rollout + preserveUnknownFields: false scope: Namespaced subresources: scale: