Update scripts and templates

This commit is contained in:
Nikolai Rodionov 2024-04-03 09:50:45 +02:00
parent d4be11fd65
commit eb03484d56
Signed by: allanger
GPG Key ID: 0AA46A90E25592AD
2 changed files with 10 additions and 1 deletions

View File

@ -7,6 +7,7 @@ kubernetes:
- name: Watch bootstrap configmaps getting removed
apiVersion: v1
kind: ConfigMap
executeHookOnSynchronization: false
executeHookOnEvent: ["Modified"]
jqFilter: ".metadata.deletionTimestamp"
labelSelector:
@ -18,13 +19,20 @@ EOF
else
PROVIDER=$(jq -r .[0].objects.[0].object.data.provider $BINDING_CONTEXT_PATH)
KUBERNETES=$(jq -r .[0].objects.[0].object.data.kubernetes $BINDING_CONTEXT_PATH)
echo "running the ${PROVIDER}-cleanup hook"
if ! [ -f /tpls/${PROVIDER}-cleanup.yaml ]; then
echo "ERROR: template not found for ${PROVIDER}-cleanup"
echo "template not found for ${PROVIDER}-cleanup"
exit 1
fi
export SP_CUSTOMER_ID=$(jq -r .[0].objects.[0].object.metadata.namespace $BINDING_CONTEXT_PATH)
export SP_ENVIRONMENT=$(jq -r .[0].objects.[0].object.metadata.name $BINDING_CONTEXT_PATH)
echo "removing the ${SP_ENVIRONMENT} owned by ${SP_CUSTOMER_ID}"
envsubst < /tpls/${PROVIDER}-cleanup.yaml | kubectl create -f -
# -- Removing the finalizer
kubectl patch configmap -n ${SP_CUSTOMER_ID} ${SP_ENVIRONMENT} \
-p '{"metadata":{"finalizers":null}}' --type=merge
fi

View File

@ -12,6 +12,7 @@ kubernetes:
- name: Watch bootstrap configmaps getting created
apiVersion: v1
kind: ConfigMap
executeHookOnSynchronization: false
executeHookOnEvent: ["Added", "Modified"]
jqFilter: ".data"
labelSelector: