From 47549d92841e64f28b6d0372b1f98048a9d8b97e Mon Sep 17 00:00:00 2001 From: yxxhero Date: Sat, 19 Oct 2024 19:25:42 +0800 Subject: [PATCH 1/2] feat: add skip-schema-validation feature Signed-off-by: yxxhero --- cmd/helm3.go | 4 ++++ cmd/upgrade.go | 2 ++ 2 files changed, 6 insertions(+) diff --git a/cmd/helm3.go b/cmd/helm3.go index 8eccf723..f730de73 100644 --- a/cmd/helm3.go +++ b/cmd/helm3.go @@ -198,6 +198,10 @@ func (d *diffCmd) template(isUpgrade bool) ([]byte, error) { flags = append(flags, "--enable-dns") } + if d.SkipSchemaValidation { + flags = append(flags, "--skip-schema-validation") + } + var ( subcmd string filter func([]byte) []byte diff --git a/cmd/upgrade.go b/cmd/upgrade.go index 4fe554f7..c0067839 100644 --- a/cmd/upgrade.go +++ b/cmd/upgrade.go @@ -47,6 +47,7 @@ type diffCmd struct { disableValidation bool disableOpenAPIValidation bool enableDNS bool + SkipSchemaValidation bool namespace string // namespace to assume the release to be installed into. Defaults to the current kube config namespace. valueFiles valueFiles values []string @@ -253,6 +254,7 @@ func newChartCommand() *cobra.Command { " --dry-run=server enables the cluster access with helm-get and the lookup template function.") f.Lookup("dry-run").NoOptDefVal = dryRunNoOptDefVal f.BoolVar(&diff.enableDNS, "enable-dns", false, "enable DNS lookups when rendering templates") + f.BoolVar(&diff.SkipSchemaValidation, "skip-schema-validation", false, "skip validation of the rendered manifests against the Kubernetes OpenAPI schema") f.StringVar(&diff.postRenderer, "post-renderer", "", "the path to an executable to be used for post rendering. If it exists in $PATH, the binary will be used, otherwise it will try to look for the executable at the given path") f.StringArrayVar(&diff.postRendererArgs, "post-renderer-args", []string{}, "an argument to the post-renderer (can specify multiple)") f.BoolVar(&diff.insecureSkipTLSVerify, "insecure-skip-tls-verify", false, "skip tls certificate checks for the chart download") From 3d24e9eb1596d5dc8f2c23fe2a9d0449dbc40bb3 Mon Sep 17 00:00:00 2001 From: yxxhero Date: Sat, 19 Oct 2024 19:29:13 +0800 Subject: [PATCH 2/2] feat: add --skip-schema-validation flag Signed-off-by: yxxhero --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index 8b38a43e..0c349da2 100644 --- a/README.md +++ b/README.md @@ -88,6 +88,7 @@ Flags: --disable-validation disables rendered templates validation against the Kubernetes cluster you are currently pointing to. This is the same validation performed on an install --dry-run disables cluster access and show diff as if it was install. Implies --install, --reset-values, and --disable-validation --enable-dns enable DNS lookups when rendering templates + --skip-schema-validation disables rendered templates validation against the Kubernetes OpenAPI Schema -D, --find-renames float32 Enable rename detection if set to any value greater than 0. If specified, the value denotes the maximum fraction of changed content as lines added + removed compared to total lines in a diff for considering it a rename. Only objects of the same Kind are attempted to be matched -h, --help help for diff --include-tests enable the diffing of the helm test hooks @@ -184,6 +185,7 @@ Flags: --disable-validation disables rendered templates validation against the Kubernetes cluster you are currently pointing to. This is the same validation performed on an install --dry-run disables cluster access and show diff as if it was install. Implies --install, --reset-values, and --disable-validation --enable-dns enable DNS lookups when rendering templates + --skip-schema-validation skip validation of rendered templates against the Kubernetes OpenAPI Schema -D, --find-renames float32 Enable rename detection if set to any value greater than 0. If specified, the value denotes the maximum fraction of changed content as lines added + removed compared to total lines in a diff for considering it a rename. Only objects of the same Kind are attempted to be matched -h, --help help for upgrade --include-tests enable the diffing of the helm test hooks