From 7446bfb4533c44a6db23d3c41dae4d29242e4757 Mon Sep 17 00:00:00 2001 From: Max Lendrich Date: Fri, 9 Dec 2022 12:52:26 +0100 Subject: [PATCH] Update README with actual usage output --- README.md | 86 +++++++++++++++++++++++++++++++---------------------- cmd/root.go | 8 ++--- 2 files changed, 54 insertions(+), 40 deletions(-) diff --git a/README.md b/README.md index 901e14eb..ad695cca 100644 --- a/README.md +++ b/README.md @@ -57,18 +57,18 @@ The Helm Diff Plugin * Shows a diff explaining what a helm upgrade would change: This fetches the currently deployed version of a release - and compares it to a local chart plus values. This can be + and compares it to a local chart plus values. This can be used visualize what changes a helm upgrade will perform. * Shows a diff explaining what had changed between two revisions: This fetches previously deployed versions of a release - and compares them. This can be used visualize what changes + and compares them. This can be used visualize what changes were made during revision change. * Shows a diff explaining what a helm rollback would change: This fetches the currently deployed version of a release - and compares it to the previously deployed version of the release, that you - want to rollback. This can be used visualize what changes a + and compares it to the previously deployed version of the release, that you + want to rollback. This can be used visualize what changes a helm rollback will perform. Usage: @@ -76,6 +76,7 @@ Usage: diff [command] Available Commands: + completion Generate the autocompletion script for the specified shell release Shows diff between release's manifests revision Shows diff between revision's manifests rollback Show a diff explaining what a helm rollback could perform @@ -92,6 +93,7 @@ Flags: --disable-openapi-validation disables rendered templates validation against the Kubernetes OpenAPI Schema --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 + -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 --install enables diffing of releases that are not yet deployed via Helm (equivalent to --allow-unreleased, added to match "helm upgrade --install" command @@ -100,7 +102,7 @@ Flags: --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" --no-hooks disable diffing of hooks --normalize-manifests normalize manifests before running diff to exclude style differences from the output - --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") + --output string Possible values: diff, simple, template. When set to "template", use the env var HELM_DIFF_TPL to specify the template. (default "diff") --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 --repo string specify the chart repository url to locate the requested chart --reset-values reset the values to the ones built into the chart and merge in any new values @@ -117,7 +119,7 @@ Flags: --version string specify the exact chart version to use. If this is not specified, the latest version is used Additional help topics: - diff + diff Use "diff [command] --help" for more information about a command. ``` @@ -149,42 +151,38 @@ Examples: # Set HELM_DIFF_USE_UPGRADE_DRY_RUN=true to # use `helm upgrade --dry-run` instead of `helm template` to render manifests from the chart. # See https://github.com/databus23/helm-diff/issues/253 for more information. - HELM_DIFF_USE_UPGRADE_DRY_RUN=true helm diff upgrade my-release datadog/datadog + HELM_DIFF_USE_UPGRADE_DRY_RUN=true helm diff upgarde my-release datadog/datadog # Set HELM_DIFF_THREE_WAY_MERGE=true to # enable the three-way-merge on diff. # This is equivalent to specifying the --three-way-merge flag. # Read the flag usage below for more information on --three-way-merge. - HELM_DIFF_THREE_WAY_MERGE=true helm diff upgrade my-release datadog/datadog + HELM_DIFF_THREE_WAY_MERGE=true helm diff upgarde my-release datadog/datadog - # Set HELM_DIFF_NORMALIZE_MANIFESTS=true to", - # normalize the yaml file content when using helm diff.", - # This is equivalent to specifying the --normalize-manifests flag.", - # Read the flag usage below for more information on --normalize-manifests.", - HELM_DIFF_NORMALIZE_MANIFESTS=true helm diff upgrade my-release datadog/datadog", - - # Set HELM_DIFF_OUTPUT_CONTEXT=n to configure the output context to n lines. - # This is equivalent to specifying the --context flag. - # Read the flag usage below for more information on --context. - HELM_DIFF_OUTPUT_CONTEXT=5 helm diff upgrade my-release datadog/datadog + # Set HELM_DIFF_NORMALIZE_MANIFESTS=true to + # normalize the yaml file content when using helm diff. + # This is equivalent to specifying the --normalize-manifests flag. + # Read the flag usage below for more information on --normalize-manifests. + HELM_DIFF_NORMALIZE_MANIFESTS=true helm diff upgrade my-release datadog/datadog Flags: --allow-unreleased enables diffing of releases that are not yet deployed via Helm -a, --api-versions stringArray Kubernetes api versions used for Capabilities.APIVersions - -C, --context int output NUM lines of context around changes (default -1), or use HELM_DIFF_OUTPUT_CONTEXT=num + -C, --context int output NUM lines of context around changes (default -1) --detailed-exitcode return a non-zero exit code when there are changes --devel use development versions, too. Equivalent to version '>0.0.0-0'. If --version is set, this is ignored. --disable-openapi-validation disables rendered templates validation against the Kubernetes OpenAPI Schema --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 + -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 --install enables diffing of releases that are not yet deployed via Helm (equivalent to --allow-unreleased, added to match "helm upgrade --install" command --kube-version string Kubernetes version used for Capabilities.KubeVersion --kubeconfig string This flag is ignored, to allow passing of this top level flag to helm --no-hooks disable diffing of hooks - --normalize-manifests normalize manifests before running diff to exclude style differences from the output, or use HELM_DIFF_NORMALIZE_MANIFESTS=true. - --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") + --normalize-manifests normalize manifests before running diff to exclude style differences from the output + --output string Possible values: diff, simple, template. When set to "template", use the env var HELM_DIFF_TPL to specify the template. (default "diff") --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 --repo string specify the chart repository url to locate the requested chart --reset-values reset the values to the ones built into the chart and merge in any new values @@ -196,12 +194,13 @@ Flags: --strip-trailing-cr strip trailing carriage return on input --suppress stringArray allows suppression of the values listed in the diff output -q, --suppress-secrets suppress secrets in the output - --three-way-merge use three-way-merge to compute patch and generate diff output, or use HELM_DIFF_THREE_WAY_MERGE=true. + --three-way-merge use three-way-merge to compute patch and generate diff output -f, --values valueFiles specify values in a YAML file (can specify multiple) (default []) --version string specify the exact chart version to use. If this is not specified, the latest version is used Global Flags: - --no-color remove colors from the output + --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" + --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" ``` ### release: @@ -209,7 +208,7 @@ Global Flags: ``` $ helm diff release -h -This command compares the manifests details of a different release created from the same chart +This command compares the manifests details of a different releases created from the same chart It can be used to compare the manifests of @@ -223,21 +222,20 @@ Usage: Flags: -C, --context int output NUM lines of context around changes (default -1) + --detailed-exitcode return a non-zero exit code when there are changes + -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 release - --home string location of your Helm config. Overrides $HELM_HOME (default "/home/aananth/.helm") --include-tests enable the diffing of the helm test hooks + --normalize-manifests normalize manifests before running diff to exclude style differences from the output + --output string Possible values: diff, simple, template. When set to "template", use the env var HELM_DIFF_TPL to specify the template. (default "diff") + --show-secrets do not redact secret values in the output --strip-trailing-cr strip trailing carriage return on input --suppress stringArray allows suppression of the values listed in the diff output -q, --suppress-secrets suppress secrets in the output - --tls enable TLS for request - --tls-ca-cert string path to TLS CA certificate file (default "$HELM_HOME/ca.pem") - --tls-cert string path to TLS certificate file (default "$HELM_HOME/cert.pem") - --tls-hostname string the server name used to verify the hostname on the returned certificates from the server - --tls-key string path to TLS key file (default "$HELM_HOME/key.pem") - --tls-verify enable TLS for request and verify remote Global Flags: - --no-color remove colors from the output + --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" + --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" ``` ### revision: @@ -245,11 +243,11 @@ Global Flags: ``` $ helm diff revision -h -This command compares the manifest details of a named release. +This command compares the manifests details of a named release. It can be used to compare the manifests of - - latest REVISION with specified REVISION + - lastest REVISION with specified REVISION $ helm diff revision [flags] RELEASE REVISION1 Example: $ helm diff revision my-release 2 @@ -263,13 +261,21 @@ Usage: diff revision [flags] RELEASE REVISION1 [REVISION2] Flags: + -C, --context int output NUM lines of context around changes (default -1) + --detailed-exitcode return a non-zero exit code when there are changes + -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 revision + --include-tests enable the diffing of the helm test hooks + --normalize-manifests normalize manifests before running diff to exclude style differences from the output + --output string Possible values: diff, simple, template. When set to "template", use the env var HELM_DIFF_TPL to specify the template. (default "diff") + --show-secrets do not redact secret values in the output --strip-trailing-cr strip trailing carriage return on input --suppress stringArray allows suppression of the values listed in the diff output -q, --suppress-secrets suppress secrets in the output Global Flags: - --no-color remove colors from the output + --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" + --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" ``` ### rollback: @@ -289,13 +295,21 @@ Examples: helm diff rollback my-release 2 Flags: + -C, --context int output NUM lines of context around changes (default -1) + --detailed-exitcode return a non-zero exit code when there are changes + -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 rollback + --include-tests enable the diffing of the helm test hooks + --normalize-manifests normalize manifests before running diff to exclude style differences from the output + --output string Possible values: diff, simple, template. When set to "template", use the env var HELM_DIFF_TPL to specify the template. (default "diff") + --show-secrets do not redact secret values in the output --strip-trailing-cr strip trailing carriage return on input --suppress stringArray allows suppression of the values listed in the diff output -q, --suppress-secrets suppress secrets in the output Global Flags: - --no-color remove colors from the output + --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" + --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" ``` ## Build diff --git a/cmd/root.go b/cmd/root.go index 8e629f29..2ea5d085 100644 --- a/cmd/root.go +++ b/cmd/root.go @@ -15,18 +15,18 @@ The Helm Diff Plugin * Shows a diff explaining what a helm upgrade would change: This fetches the currently deployed version of a release - and compares it to a local chart plus values. This can be + and compares it to a local chart plus values. This can be used visualize what changes a helm upgrade will perform. * Shows a diff explaining what had changed between two revisions: This fetches previously deployed versions of a release - and compares them. This can be used visualize what changes + and compares them. This can be used visualize what changes were made during revision change. * Shows a diff explaining what a helm rollback would change: This fetches the currently deployed version of a release - and compares it to the previously deployed version of the release, that you - want to rollback. This can be used visualize what changes a + and compares it to the previously deployed version of the release, that you + want to rollback. This can be used visualize what changes a helm rollback will perform. `