Skip to content

Commit 64015ca

Browse files
authored
Add post-renderer-args flag (databus23#427)
Signed-off-by: Daniel Lenar <[email protected]>
1 parent 9e2ef9d commit 64015ca

File tree

3 files changed

+83
-72
lines changed

3 files changed

+83
-72
lines changed

README.md

Lines changed: 78 additions & 72 deletions
Original file line numberDiff line numberDiff line change
@@ -76,45 +76,48 @@ Usage:
7676
diff [command]
7777
7878
Available Commands:
79+
completion Generate the autocompletion script for the specified shell
7980
release Shows diff between release's manifests
8081
revision Shows diff between revision's manifests
8182
rollback Show a diff explaining what a helm rollback could perform
8283
upgrade Show a diff explaining what a helm upgrade would change.
8384
version Show version of the helm diff plugin
8485
8586
Flags:
86-
--allow-unreleased enables diffing of releases that are not yet deployed via Helm
87-
-a, --api-versions stringArray Kubernetes api versions used for Capabilities.APIVersions
88-
--color color output. You can control the value for this flag via HELM_DIFF_COLOR=[true|false]. If both --no-color and --color are unspecified, coloring enabled only when the stdout is a term and TERM is not "dumb"
89-
-C, --context int output NUM lines of context around changes (default -1)
90-
--detailed-exitcode return a non-zero exit code when there are changes
91-
--devel use development versions, too. Equivalent to version '>0.0.0-0'. If --version is set, this is ignored.
92-
--disable-openapi-validation disables rendered templates validation against the Kubernetes OpenAPI Schema
93-
--disable-validation disables rendered templates validation against the Kubernetes cluster you are currently pointing to. This is the same validation performed on an install
94-
--dry-run disables cluster access and show diff as if it was install. Implies --install, --reset-values, and --disable-validation
95-
-h, --help help for diff
96-
--include-tests enable the diffing of the helm test hooks
97-
--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
99-
--kubeconfig string This flag is ignored, to allow passing of this top level flag to helm
100-
--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"
101-
--no-hooks disable diffing of hooks
102-
--normalize-manifests normalize manifests before running diff to exclude style differences from the output
103-
--output string Possible values: diff, simple, json, template. When set to "template", use the env var HELM_DIFF_TPL to specify the template. (default "diff")
104-
--post-renderer string 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
105-
--repo string specify the chart repository url to locate the requested chart
106-
--reset-values reset the values to the ones built into the chart and merge in any new values
107-
--reuse-values reuse the last release's values and merge in any new values. If '--reset-values' is specified, this is ignored
108-
--set stringArray set values on the command line (can specify multiple or separate values with commas: key1=val1,key2=val2)
109-
--set-file stringArray set values from respective files specified via the command line (can specify multiple or separate values with commas: key1=path1,key2=path2)
110-
--set-string stringArray set STRING values on the command line (can specify multiple or separate values with commas: key1=val1,key2=val2)
111-
--show-secrets do not redact secret values in the output
112-
--strip-trailing-cr strip trailing carriage return on input
113-
--suppress stringArray allows suppression of the values listed in the diff output
114-
-q, --suppress-secrets suppress secrets in the output
115-
--three-way-merge use three-way-merge to compute patch and generate diff output
116-
-f, --values valueFiles specify values in a YAML file (can specify multiple) (default [])
117-
--version string specify the exact chart version to use. If this is not specified, the latest version is used
87+
--allow-unreleased enables diffing of releases that are not yet deployed via Helm
88+
-a, --api-versions stringArray Kubernetes api versions used for Capabilities.APIVersions
89+
--color color output. You can control the value for this flag via HELM_DIFF_COLOR=[true|false]. If both --no-color and --color are unspecified, coloring enabled only when the stdout is a term and TERM is not "dumb"
90+
-C, --context int output NUM lines of context around changes (default -1)
91+
--detailed-exitcode return a non-zero exit code when there are changes
92+
--devel use development versions, too. Equivalent to version '>0.0.0-0'. If --version is set, this is ignored.
93+
--disable-openapi-validation disables rendered templates validation against the Kubernetes OpenAPI Schema
94+
--disable-validation disables rendered templates validation against the Kubernetes cluster you are currently pointing to. This is the same validation performed on an install
95+
--dry-run disables cluster access and show diff as if it was install. Implies --install, --reset-values, and --disable-validation
96+
-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
97+
-h, --help help for diff
98+
--include-tests enable the diffing of the helm test hooks
99+
--install enables diffing of releases that are not yet deployed via Helm (equivalent to --allow-unreleased, added to match "helm upgrade --install" command
100+
--kube-version string Kubernetes version used for Capabilities.KubeVersion
101+
--kubeconfig string This flag is ignored, to allow passing of this top level flag to helm
102+
--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"
103+
--no-hooks disable diffing of hooks
104+
--normalize-manifests normalize manifests before running diff to exclude style differences from the output
105+
--output string Possible values: diff, simple, template. When set to "template", use the env var HELM_DIFF_TPL to specify the template. (default "diff")
106+
--post-renderer string 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
107+
--post-renderer-args stringArray an argument to the post-renderer (can specify multiple)
108+
--repo string specify the chart repository url to locate the requested chart
109+
--reset-values reset the values to the ones built into the chart and merge in any new values
110+
--reuse-values reuse the last release's values and merge in any new values. If '--reset-values' is specified, this is ignored
111+
--set stringArray set values on the command line (can specify multiple or separate values with commas: key1=val1,key2=val2)
112+
--set-file stringArray set values from respective files specified via the command line (can specify multiple or separate values with commas: key1=path1,key2=path2)
113+
--set-string stringArray set STRING values on the command line (can specify multiple or separate values with commas: key1=val1,key2=val2)
114+
--show-secrets do not redact secret values in the output
115+
--strip-trailing-cr strip trailing carriage return on input
116+
--suppress stringArray allows suppression of the values listed in the diff output
117+
-q, --suppress-secrets suppress secrets in the output
118+
--three-way-merge use three-way-merge to compute patch and generate diff output
119+
-f, --values valueFiles specify values in a YAML file (can specify multiple) (default [])
120+
--version string specify the exact chart version to use. If this is not specified, the latest version is used
118121
119122
Additional help topics:
120123
diff
@@ -157,51 +160,54 @@ Examples:
157160
# Read the flag usage below for more information on --three-way-merge.
158161
HELM_DIFF_THREE_WAY_MERGE=true helm diff upgrade my-release datadog/datadog
159162
160-
# Set HELM_DIFF_NORMALIZE_MANIFESTS=true to",
161-
# normalize the yaml file content when using helm diff.",
162-
# This is equivalent to specifying the --normalize-manifests flag.",
163-
# Read the flag usage below for more information on --normalize-manifests.",
164-
HELM_DIFF_NORMALIZE_MANIFESTS=true helm diff upgrade my-release datadog/datadog",
163+
# Set HELM_DIFF_NORMALIZE_MANIFESTS=true to
164+
# normalize the yaml file content when using helm diff.
165+
# This is equivalent to specifying the --normalize-manifests flag.
166+
# Read the flag usage below for more information on --normalize-manifests.
167+
HELM_DIFF_NORMALIZE_MANIFESTS=true helm diff upgrade my-release datadog/datadog
165168
166-
# Set HELM_DIFF_OUTPUT_CONTEXT=n to configure the output context to n lines.
167-
# This is equivalent to specifying the --context flag.
168-
# Read the flag usage below for more information on --context.
169-
HELM_DIFF_OUTPUT_CONTEXT=5 helm diff upgrade my-release datadog/datadog
169+
# Set HELM_DIFF_OUTPUT_CONTEXT=n to configure the output context to n lines.
170+
# This is equivalent to specifying the --context flag.
171+
# Read the flag usage below for more information on --context.
172+
HELM_DIFF_OUTPUT_CONTEXT=5 helm diff upgrade my-release datadog/datadog
170173
171174
Flags:
172-
--allow-unreleased enables diffing of releases that are not yet deployed via Helm
173-
-a, --api-versions stringArray Kubernetes api versions used for Capabilities.APIVersions
174-
-C, --context int output NUM lines of context around changes (default -1), or use HELM_DIFF_OUTPUT_CONTEXT=num
175-
--detailed-exitcode return a non-zero exit code when there are changes
176-
--devel use development versions, too. Equivalent to version '>0.0.0-0'. If --version is set, this is ignored.
177-
--disable-openapi-validation disables rendered templates validation against the Kubernetes OpenAPI Schema
178-
--disable-validation disables rendered templates validation against the Kubernetes cluster you are currently pointing to. This is the same validation performed on an install
179-
--dry-run disables cluster access and show diff as if it was install. Implies --install, --reset-values, and --disable-validation
180-
-h, --help help for upgrade
181-
--include-tests enable the diffing of the helm test hooks
182-
--install enables diffing of releases that are not yet deployed via Helm (equivalent to --allow-unreleased, added to match "helm upgrade --install" command
183-
--kube-version string Kubernetes version used for Capabilities.KubeVersion
184-
--kubeconfig string This flag is ignored, to allow passing of this top level flag to helm
185-
--no-hooks disable diffing of hooks
186-
--normalize-manifests normalize manifests before running diff to exclude style differences from the output, or use HELM_DIFF_NORMALIZE_MANIFESTS=true.
187-
--output string Possible values: diff, simple, json, template. When set to "template", use the env var HELM_DIFF_TPL to specify the template. (default "diff")
188-
--post-renderer string 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
189-
--repo string specify the chart repository url to locate the requested chart
190-
--reset-values reset the values to the ones built into the chart and merge in any new values
191-
--reuse-values reuse the last release's values and merge in any new values. If '--reset-values' is specified, this is ignored
192-
--set stringArray set values on the command line (can specify multiple or separate values with commas: key1=val1,key2=val2)
193-
--set-file stringArray set values from respective files specified via the command line (can specify multiple or separate values with commas: key1=path1,key2=path2)
194-
--set-string stringArray set STRING values on the command line (can specify multiple or separate values with commas: key1=val1,key2=val2)
195-
--show-secrets do not redact secret values in the output
196-
--strip-trailing-cr strip trailing carriage return on input
197-
--suppress stringArray allows suppression of the values listed in the diff output
198-
-q, --suppress-secrets suppress secrets in the output
199-
--three-way-merge use three-way-merge to compute patch and generate diff output, or use HELM_DIFF_THREE_WAY_MERGE=true.
200-
-f, --values valueFiles specify values in a YAML file (can specify multiple) (default [])
201-
--version string specify the exact chart version to use. If this is not specified, the latest version is used
175+
--allow-unreleased enables diffing of releases that are not yet deployed via Helm
176+
-a, --api-versions stringArray Kubernetes api versions used for Capabilities.APIVersions
177+
-C, --context int output NUM lines of context around changes (default -1)
178+
--detailed-exitcode return a non-zero exit code when there are changes
179+
--devel use development versions, too. Equivalent to version '>0.0.0-0'. If --version is set, this is ignored.
180+
--disable-openapi-validation disables rendered templates validation against the Kubernetes OpenAPI Schema
181+
--disable-validation disables rendered templates validation against the Kubernetes cluster you are currently pointing to. This is the same validation performed on an install
182+
--dry-run disables cluster access and show diff as if it was install. Implies --install, --reset-values, and --disable-validation
183+
-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
184+
-h, --help help for upgrade
185+
--include-tests enable the diffing of the helm test hooks
186+
--install enables diffing of releases that are not yet deployed via Helm (equivalent to --allow-unreleased, added to match "helm upgrade --install" command
187+
--kube-version string Kubernetes version used for Capabilities.KubeVersion
188+
--kubeconfig string This flag is ignored, to allow passing of this top level flag to helm
189+
--no-hooks disable diffing of hooks
190+
--normalize-manifests normalize manifests before running diff to exclude style differences from the output
191+
--output string Possible values: diff, simple, template. When set to "template", use the env var HELM_DIFF_TPL to specify the template. (default "diff")
192+
--post-renderer string 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
193+
--post-renderer-args stringArray an argument to the post-renderer (can specify multiple)
194+
--repo string specify the chart repository url to locate the requested chart
195+
--reset-values reset the values to the ones built into the chart and merge in any new values
196+
--reuse-values reuse the last release's values and merge in any new values. If '--reset-values' is specified, this is ignored
197+
--set stringArray set values on the command line (can specify multiple or separate values with commas: key1=val1,key2=val2)
198+
--set-file stringArray set values from respective files specified via the command line (can specify multiple or separate values with commas: key1=path1,key2=path2)
199+
--set-string stringArray set STRING values on the command line (can specify multiple or separate values with commas: key1=val1,key2=val2)
200+
--show-secrets do not redact secret values in the output
201+
--strip-trailing-cr strip trailing carriage return on input
202+
--suppress stringArray allows suppression of the values listed in the diff output
203+
-q, --suppress-secrets suppress secrets in the output
204+
--three-way-merge use three-way-merge to compute patch and generate diff output
205+
-f, --values valueFiles specify values in a YAML file (can specify multiple) (default [])
206+
--version string specify the exact chart version to use. If this is not specified, the latest version is used
202207
203208
Global Flags:
204-
--no-color remove colors from the output
209+
--color color output. You can control the value for this flag via HELM_DIFF_COLOR=[true|false]. If both --no-color and --color are unspecified, coloring enabled only when the stdout is a term and TERM is not "dumb"
210+
--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"
205211
```
206212

207213
### release:

cmd/helm3.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,9 @@ func (d *diffCmd) template(isUpgrade bool) ([]byte, error) {
102102
if d.postRenderer != "" {
103103
flags = append(flags, "--post-renderer", d.postRenderer)
104104
}
105+
for _, arg := range d.postRendererArgs {
106+
flags = append(flags, "--post-renderer-args", arg)
107+
}
105108
// Helm automatically enable --reuse-values when there's no --set, --set-string, --set-values, --set-file present.
106109
// Let's simulate that in helm-diff.
107110
// See https://medium.com/@kcatstack/understand-helm-upgrade-flags-reset-values-reuse-values-6e58ac8f127e

0 commit comments

Comments
 (0)