Skip to content

Commit ac48eca

Browse files
authored
Merge pull request #386 from semoac/chore/add-support-for-kube-version
chore: Added support for setting --kube-version
2 parents e41445a + b413e51 commit ac48eca

File tree

3 files changed

+9
-0
lines changed

3 files changed

+9
-0
lines changed

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,7 @@ Flags:
9595
-h, --help help for diff
9696
--include-tests enable the diffing of the helm test hooks
9797
--install enables diffing of releases that are not yet deployed via Helm (equivalent to --allow-unreleased, added to match "helm upgrade --install" command
98+
--kube-version string Kubernetes version used for Capabilities.KubeVersion
9899
--kubeconfig string This flag is ignored, to allow passing of this top level flag to helm
99100
--no-color remove colors from the output. If both --no-color and --color are unspecified, coloring enabled only when the stdout is a term and TERM is not "dumb"
100101
--no-hooks disable diffing of hooks
@@ -168,6 +169,7 @@ Flags:
168169
-h, --help help for upgrade
169170
--include-tests enable the diffing of the helm test hooks
170171
--install enables diffing of releases that are not yet deployed via Helm (equivalent to --allow-unreleased, added to match "helm upgrade --install" command
172+
--kube-version string Kubernetes version used for Capabilities.KubeVersion
171173
--kubeconfig string This flag is ignored, to allow passing of this top level flag to helm
172174
--no-hooks disable diffing of hooks
173175
--normalize-manifests normalize manifests before running diff to exclude style differences from the output

cmd/helm3.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -192,6 +192,10 @@ func (d *diffCmd) template(isUpgrade bool) ([]byte, error) {
192192
flags = append(flags, "--api-versions", a)
193193
}
194194

195+
if d.kubeVersion != "" {
196+
flags = append(flags, "--kube-version", d.kubeVersion)
197+
}
198+
195199
subcmd = "template"
196200

197201
filter = func(s []byte) []byte {

cmd/upgrade.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ type diffCmd struct {
5656
normalizeManifests bool
5757
threeWayMerge bool
5858
extraAPIs []string
59+
kubeVersion string
5960
useUpgradeDryRun bool
6061
diff.Options
6162
}
@@ -157,6 +158,8 @@ func newChartCommand() *cobra.Command {
157158
// - https://github.com/helm/helm/blob/d9ffe37d371c9d06448c55c852c800051830e49a/cmd/helm/template.go#L184
158159
// - https://github.com/databus23/helm-diff/issues/318
159160
f.StringArrayVarP(&diff.extraAPIs, "api-versions", "a", []string{}, "Kubernetes api versions used for Capabilities.APIVersions")
161+
// Support for kube-version was re-enabled and ported from helm2 to helm3 on https://github.com/helm/helm/pull/9040
162+
f.StringVar(&diff.kubeVersion, "kube-version", "", "Kubernetes version used for Capabilities.KubeVersion")
160163
f.VarP(&diff.valueFiles, "values", "f", "specify values in a YAML file (can specify multiple)")
161164
f.StringArrayVar(&diff.values, "set", []string{}, "set values on the command line (can specify multiple or separate values with commas: key1=val1,key2=val2)")
162165
f.StringArrayVar(&diff.stringValues, "set-string", []string{}, "set STRING values on the command line (can specify multiple or separate values with commas: key1=val1,key2=val2)")

0 commit comments

Comments
 (0)