mirror of
https://github.com/edgelesssys/constellation.git
synced 2024-10-01 01:36:09 -04:00
ci: fix pvc clean-up on non deletable namespaces (#2994)
* Only delete namespace if its deletable * For "default" namespace, delete all resources in that namespace * For "kube-system" namespace, delete all PVCs in that namespace * Don't abort terminate action if PVC deletion fails --------- Signed-off-by: Daniel Weiße <dw@edgeless.systems>
This commit is contained in:
parent
dc86a30988
commit
0da6f0d014
@ -24,6 +24,7 @@ runs:
|
||||
- name: Delete persistent volumes
|
||||
if: inputs.kubeconfig != ''
|
||||
shell: bash
|
||||
continue-on-error: true
|
||||
env:
|
||||
KUBECONFIG: ${{ inputs.kubeconfig }}
|
||||
PV_DELETION_TIMEOUT: "120" # 2 minutes timeout for pv deletion
|
||||
@ -34,6 +35,14 @@ runs:
|
||||
# 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
|
||||
if [[ "${namespace}" == "default" ]]; then
|
||||
kubectl delete all --all --namespace "default" --wait
|
||||
continue
|
||||
fi
|
||||
if [[ "${namespace}" == "kube-system" ]]; then
|
||||
kubectl delete pvc --all --namespace "kube-system" --wait
|
||||
continue
|
||||
fi
|
||||
kubectl delete namespace $namespace --wait
|
||||
fi
|
||||
done
|
||||
|
Loading…
Reference in New Issue
Block a user