Skip to content

Instantly share code, notes, and snippets.

@omerh
Created January 23, 2019 18:55
Show Gist options
  • Save omerh/177727f2957b6ccc021d825765640c9f to your computer and use it in GitHub Desktop.
Save omerh/177727f2957b6ccc021d825765640c9f to your computer and use it in GitHub Desktop.
This can help with proper git flow before changes when using Kops
#!/bin/bash
echo "Getting all statestore safe configs from S3"
CLUSTERS=$(kops get cluster | grep -v NAME | awk '{print $1}')
for CLUSTER in $CLUSTERS; do
if [ ! -d $CLUSTER ]; then
mkdir $CLUSTER
fi
cd $CLUSTER
kops get --name $CLUSTER -o yaml > $CLUSTER.yml
cd ..
done
git add .
# whoami is not mandatory due to git config
git commit -m "`whoami` edited kops config"
git push
echo "After altering the files you can run kops replace -f ./[CLUSTER_NAME]/[CLUSTER_YAML] --name [CLUSTER_NAME] --force"
echo "Note that force will create the resource if not exists"
echo "And run kops update cluster --name [CLUSTER_NAME] --yes"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment