When a branch removal triggers a destroy command via GitlabCI, configMaps and Certmanager created secrets are left behind as orphaned artifacts related to the now deleted deployment. Adding additional kubectl delete commands to the destroy script would remove these artifacts during the destroy run.
When a branch removal triggers a destroy command via GitlabCI, configMaps and Certmanager created secrets are left behind as orphaned artifacts related to the now deleted deployment. Adding additional kubectl delete commands to the destroy script would remove these artifacts during the destroy run.
kubectl delete deploy,pod,rs,svc,ing,ds,configmap -l "app=$CI_ENVIRONMENT_SLUG" -n "$KUBE_NAMESPACE"
kubectl delete certificate tls-$CI_ENVIRONMENT_HOSTNAME -n "$KUBE_NAMESPACE"