Skip to content

Instantly share code, notes, and snippets.

@funkytaco
Forked from ptx96/charts_compare.sh
Created August 19, 2021 15:24
Show Gist options
  • Save funkytaco/49b44df63b6e18ea46481bd6fbd9a32d to your computer and use it in GitHub Desktop.
Save funkytaco/49b44df63b6e18ea46481bd6fbd9a32d to your computer and use it in GitHub Desktop.
./charts_compare.sh <TEMPLATENAME>
#!/bin/bash
set -euo
TEMPLATE=$1
yttFolder="ckd-capsule-app/"
helmFolder="capsule"
pushd $yttFolder
echo -e "=== Creating ytt template $TEMPLATE ===\n"
ytt -f values.yaml -f config.lib.yml -f $TEMPLATE \
> ../compare/ytt-$TEMPLATE \
&& echo -e "OK\n"
echo -e "=== Let me see ytt-$TEMPLATE ===\n"
cat ../compare/ytt-$TEMPLATE &&
echo -e "\n=== Try apply $TEMPLATE ===\n"
kubectl apply --dry-run=client -f ../compare/ytt-$TEMPLATE \
&& echo -e "OK\n"
popd
pushd $helmFolder
echo -e "\n=== Rendering helm template $TEMPLATE ===\n"
helm template -s templates/$TEMPLATE . \
--set "manager.image.repository=quay.io/clastix/capsule" \
--set "manager.image.tag=v0.1.0-rc2" \
--set 'serviceMonitor.enabled=true' \
--set "podSecurityPolicy.enabled=true" \
--include-crds \
--name-template=capsule \
--namespace=capsule-system \
> ../compare/helm-$TEMPLATE \
&& echo -e "OK\n"
echo -e "=== Let me see helm-$TEMPLATE ===\n"
cat ../compare/helm-$TEMPLATE
popd
echo -e "\n=== Show me the differences ===\n"
diff compare/ytt-$TEMPLATE compare/helm-$TEMPLATE
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment