Cleanup namespaces created for environments on environment-elimination
Problem to solve
Once https://gitlab.com/gitlab-org/gitlab-ce/issues/52494 is complete, a dedicated namespace will be created for each environment that is created. When the environment is eliminated, the corresponding namespace will remain.
Further details
Proposal
When an environment is destroyed so should the corresponding namespace be destroyed.
In order to make this configurable by the user, we want to add a new option delete_namespace
to <job>.environment.kubernetes
. Using the environment.on_stop
feature, deleting namespaces could be achieved by two jobs and a cluster with a *
environment scope to deploy the review app:
review_app:
script: deploy-review-app
environment:
name: review/$CI_COMMIT_REF_NAME
on_stop: stop_review
stop_review:
environment:
action: stop
kubernetes:
delete_namespace: true
Permissions and Security
Documentation
What does success look like, and how can we measure that?
Links / references
Edited by Viktor Nagy (GitLab)