Skip to content

Instantly share code, notes, and snippets.

@ptx96
Created July 12, 2021 17:03
Show Gist options
  • Save ptx96/89f0a34bc97ba380b7e372e98716958a to your computer and use it in GitHub Desktop.
Save ptx96/89f0a34bc97ba380b7e372e98716958a 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