mirror of
https://github.com/edgelesssys/constellation.git
synced 2024-12-13 09:54:29 -05:00
1180b376fa
We sometimes run older CLI versions in the CI. Those versions may not support the flag.
49 lines
1.5 KiB
YAML
49 lines
1.5 KiB
YAML
name: Constellation destroy
|
|
description: "Destroy a running Constellation cluster."
|
|
|
|
inputs:
|
|
kubeconfig:
|
|
description: "The kubeconfig for the cluster."
|
|
required: true
|
|
|
|
runs:
|
|
using: "composite"
|
|
steps:
|
|
- name: Delete persistent volumes
|
|
if: inputs.kubeconfig != ''
|
|
shell: bash
|
|
env:
|
|
KUBECONFIG: ${{ inputs.kubeconfig }}
|
|
PV_DELETION_TIMEOUT: "120" # 2 minutes timeout for pv deletion
|
|
run: |
|
|
ELAPSED=0
|
|
echo "::group::Wait for PV deletion"
|
|
|
|
# Scrap namespaces that contain PVCs
|
|
for namespace in `kubectl get namespace --no-headers=true -o custom-columns=":metadata.name"`; do
|
|
if [[ `kubectl get pvc -n $namespace --no-headers=true -o custom-columns=":metadata.name" | wc -l` -gt 0 ]]; then
|
|
kubectl delete namespace $namespace --wait
|
|
fi
|
|
done
|
|
|
|
until [[ "$(kubectl get pv -o json | jq '.items | length')" == "0" ]] || [[ $ELAPSED -gt $PV_DELETION_TIMEOUT ]];
|
|
do
|
|
echo $(kubectl get pv -o json | jq '.items | length') PV remaining..
|
|
sleep 1
|
|
ELAPSED=$((ELAPSED+1))
|
|
done
|
|
if [[ $ELAPSED -gt $PV_DELETION_TIMEOUT ]]; then
|
|
echo "Timed out waiting for PV deletion.."
|
|
exit 1
|
|
fi
|
|
echo "::endgroup::"
|
|
|
|
- name: Constellation terminate
|
|
shell: bash
|
|
run: |
|
|
output=$(constellation --help)
|
|
if [[ $output == *"tf-log"* ]]; then
|
|
TFFLAG="--tf-log=DEBUG"
|
|
fi
|
|
constellation terminate --yes ${TFFLAG:-}
|