Created
October 28, 2021 12:39
-
-
Save haraldsk/7fdd6b16623503795aa14e70d2b111cc to your computer and use it in GitHub Desktop.
Safely diff helm charts between two cluster contexts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
set -o errexit | |
set -o nounset | |
# ./diff-helm $chart $namespace | |
CHART=${1} | |
NAMESPACE=${2} | |
CTX_ONE="coronita" | |
CTX_TWO="corona" | |
OBJECTS="all" # all, manifest, values | |
DIFF_CMD="/opt/homebrew/bin/diff --color -urN" # needs gnu diffutils - brew install diffutils | |
CTX_ONE_FILE=$(mktemp) | |
CTX_TWO_FILE=$(mktemp) | |
trap "rm -f $CTX_ONE_FILE $CTX_TWO_FILE" EXIT | |
HELM_KUBECONTEXT=$CTX_ONE helm get manifest $CHART -n $NAMESPACE > $CTX_ONE_FILE | |
HELM_KUBECONTEXT=$CTX_TWO helm get manifest $CHART -n $NAMESPACE > $CTX_TWO_FILE | |
$DIFF_CMD $CTX_ONE_FILE $CTX_TWO_FILE |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
you can use stdout in diffs if you want