Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add script to delete deployments #20

Open
jodyhuntatx opened this issue Aug 2, 2018 · 0 comments
Open

add script to delete deployments #20

jodyhuntatx opened this issue Aug 2, 2018 · 0 comments

Comments

@jodyhuntatx
Copy link
Member

When bringing up a new cluster, one often needs to delete the one that isn't working. I hacked this from 3_deploy_conjur_cluster.sh and 4_create_load_balancer.sh:

$ cat delete-deployments.sh
#!/bin/bash
#set -eo pipefail

. utils.sh

announce "Deleting Conjur cluster."

set_namespace $CONJUR_NAMESPACE_NAME

conjur_appliance_image=$(platform_image "conjur-appliance")

echo "deleting main cluster"
if $cli get statefulset &>/dev/null; then # this returns non-0 if platform doesn't support statefulset
conjur_cluster_template="./$PLATFORM/conjur-cluster-stateful.yaml"
else
conjur_cluster_template="./$PLATFORM/conjur-cluster.yaml"
fi
sed -e "s#{{ CONJUR_APPLIANCE_IMAGE }}#$conjur_appliance_image#g" $conjur_cluster_template |
$cli delete -f -

echo "deleting load balancer"
docker_image=$(platform_image haproxy)

sed -e "s#{{ DOCKER_IMAGE }}#$docker_image#g" "./$PLATFORM/haproxy-conjur-master.yaml" |
$cli delete -f -

echo "deleting followers"
sed -e "s#{{ CONJUR_APPLIANCE_IMAGE }}#$conjur_appliance_image#g" "./$PLATFORM/conjur-follower.yaml" |
sed -e "s#{{ AUTHENTICATOR_ID }}#$AUTHENTICATOR_ID#g" |
$cli delete -f -

sleep 10

echo "Waiting for Conjur pods to terminate..."
conjur_pod_count=0
wait_for_it 300 "$cli describe po conjur-cluster | grep Status: | grep -c Running | grep -q $conjur_pod_count"

echo "Cluster deleted."

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

No branches or pull requests

2 participants