Skip to content

Commit 1cf06fa

Browse files
authored
Allow diff to include crds (#762)
* Allow diff to include crds * Add new include-crds flag to README.md
1 parent d69fff5 commit 1cf06fa

File tree

3 files changed

+7
-0
lines changed

3 files changed

+7
-0
lines changed

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,7 @@ Flags:
9191
--skip-schema-validation disables rendered templates validation against the Kubernetes OpenAPI Schema
9292
-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
9393
-h, --help help for diff
94+
--include-crds include CRDs in the diffing
9495
--include-tests enable the diffing of the helm test hooks
9596
--install enables diffing of releases that are not yet deployed via Helm (equivalent to --allow-unreleased, added to match "helm upgrade --install" command
9697
--kube-version string Kubernetes version used for Capabilities.KubeVersion
@@ -189,6 +190,7 @@ Flags:
189190
--skip-schema-validation skip validation of rendered templates against the Kubernetes OpenAPI Schema
190191
-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
191192
-h, --help help for upgrade
193+
--include-crds include CRDs in the diffing
192194
--include-tests enable the diffing of the helm test hooks
193195
--install enables diffing of releases that are not yet deployed via Helm (equivalent to --allow-unreleased, added to match "helm upgrade --install" command
194196
--kube-version string Kubernetes version used for Capabilities.KubeVersion

cmd/helm3.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,9 @@ func (d *diffCmd) template(isUpgrade bool) ([]byte, error) {
113113
if d.noHooks && !d.useUpgradeDryRun {
114114
flags = append(flags, "--no-hooks")
115115
}
116+
if d.includeCRDs {
117+
flags = append(flags, "--include-crds")
118+
}
116119
if d.chartVersion != "" {
117120
flags = append(flags, "--version", d.chartVersion)
118121
}

cmd/upgrade.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ type diffCmd struct {
5353
allowUnreleased bool
5454
noHooks bool
5555
includeTests bool
56+
includeCRDs bool
5657
postRenderer string
5758
postRendererArgs []string
5859
insecureSkipTLSVerify bool
@@ -241,6 +242,7 @@ func newChartCommand() *cobra.Command {
241242
f.BoolVar(&diff.install, "install", false, "enables diffing of releases that are not yet deployed via Helm (equivalent to --allow-unreleased, added to match \"helm upgrade --install\" command")
242243
f.BoolVar(&diff.noHooks, "no-hooks", false, "disable diffing of hooks")
243244
f.BoolVar(&diff.includeTests, "include-tests", false, "enable the diffing of the helm test hooks")
245+
f.BoolVar(&diff.includeCRDs, "include-crds", false, "include CRDs in the diffing")
244246
f.BoolVar(&diff.devel, "devel", false, "use development versions, too. Equivalent to version '>0.0.0-0'. If --version is set, this is ignored.")
245247
f.BoolVar(&diff.disableValidation, "disable-validation", false, "disables rendered templates validation against the Kubernetes cluster you are currently pointing to. This is the same validation performed on an install")
246248
f.BoolVar(&diff.disableOpenAPIValidation, "disable-openapi-validation", false, "disables rendered templates validation against the Kubernetes OpenAPI Schema")

0 commit comments

Comments
 (0)