Skip to content

Commit 26d61fa

Browse files
Kirill-GarbarKirill Garbar
and
Kirill Garbar
authored
Add support for Helm 3 --disable-openapi-validation flag (#210)
Resolves #209 Co-authored-by: Kirill Garbar <[email protected]>
1 parent 8175484 commit 26d61fa

File tree

2 files changed

+26
-20
lines changed

2 files changed

+26
-20
lines changed

cmd/helm3.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,10 @@ func (d *diffCmd) template(isUpgrade bool) ([]byte, error) {
132132
flags = append(flags, "--is-upgrade")
133133
}
134134

135+
if d.disableOpenAPIValidation {
136+
flags = append(flags, "--disable-openapi-validation")
137+
}
138+
135139
args := []string{"template", d.release, d.chart}
136140
args = append(args, flags...)
137141
cmd := exec.Command(os.Getenv("HELM_BIN"), args...)

cmd/upgrade.go

Lines changed: 22 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -14,26 +14,27 @@ import (
1414
)
1515

1616
type diffCmd struct {
17-
release string
18-
chart string
19-
chartVersion string
20-
client helm.Interface
21-
detailedExitCode bool
22-
devel bool
23-
namespace string // namespace to assume the release to be installed into. Defaults to the current kube config namespace.
24-
valueFiles valueFiles
25-
values []string
26-
stringValues []string
27-
fileValues []string
28-
reuseValues bool
29-
resetValues bool
30-
allowUnreleased bool
31-
noHooks bool
32-
includeTests bool
33-
suppressedKinds []string
34-
outputContext int
35-
showSecrets bool
36-
postRenderer string
17+
release string
18+
chart string
19+
chartVersion string
20+
client helm.Interface
21+
detailedExitCode bool
22+
devel bool
23+
disableOpenAPIValidation bool
24+
namespace string // namespace to assume the release to be installed into. Defaults to the current kube config namespace.
25+
valueFiles valueFiles
26+
values []string
27+
stringValues []string
28+
fileValues []string
29+
reuseValues bool
30+
resetValues bool
31+
allowUnreleased bool
32+
noHooks bool
33+
includeTests bool
34+
suppressedKinds []string
35+
outputContext int
36+
showSecrets bool
37+
postRenderer string
3738
}
3839

3940
const globalUsage = `Show a diff explaining what a helm upgrade would change.
@@ -97,6 +98,7 @@ func newChartCommand() *cobra.Command {
9798
f.BoolVar(&diff.devel, "devel", false, "use development versions, too. Equivalent to version '>0.0.0-0'. If --version is set, this is ignored.")
9899
f.StringArrayVar(&diff.suppressedKinds, "suppress", []string{}, "allows suppression of the values listed in the diff output")
99100
f.IntVarP(&diff.outputContext, "context", "C", -1, "output NUM lines of context around changes")
101+
f.BoolVar(&diff.disableOpenAPIValidation, "disable-openapi-validation", false, "disables rendered templates validation against the Kubernetes OpenAPI Schema")
100102
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")
101103
if !isHelm3() {
102104
f.StringVar(&diff.namespace, "namespace", "default", "namespace to assume the release to be installed into")

0 commit comments

Comments
 (0)