Skip to content

Commit

Permalink
updating create cluster to be idempotent
Browse files Browse the repository at this point in the history
  • Loading branch information
warroyo committed May 21, 2019
1 parent bda738b commit fbaa4cb
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
3 changes: 2 additions & 1 deletion pipeline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -676,6 +676,7 @@ jobs:
- get: configuration
trigger: true
passed: ['create-cluster']
- get: env-state-gcp
- get: pcf-automation-source
- <<: *interpolate
- put: cluster-state-gcp
Expand All @@ -698,7 +699,7 @@ groups:
- apply-product-changes
- name: create-cluster
jobs:
# - terraforming-k8s
- terraforming-k8s
- create-cluster
- name: destroy
jobs:
Expand Down
8 changes: 8 additions & 0 deletions tasks/create-cluster.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,14 @@ run:
export PKS_PASSWORD="$(om --env env/${ENV_FILE} credentials --product-name pivotal-container-service --credential-reference .properties.uaa_admin_password -f secret)"
export PKS_API="$(./jq -r .pks_api_endpoint terraform-output/metadata)"
echo "checking if cluster exists"
set +e
./pks-cli cluster "${CLUSTER_NAME}"
if [ $? -eq 0 ]; then
echo "cluster exists skipping creation"
exit 0
fi
set -e
echo "starting cluster creation"
./pks-cli login -a $PKS_API -u admin -p $PKS_PASSWORD -k
./pks-cli create-cluster "${CLUSTER_NAME}" -e "${CLUSTER_HOSTNAME}" -p small --wait
Expand Down

0 comments on commit fbaa4cb

Please sign in to comment.