Advanced setting to delete all GitLab k8s resources on cluster removal
Problem to solve
Currently, removing a cluster from a GitLab project/group/instance does not clear out any of the resources created by GitLab (namespaces, roles, bindings, etc). If user wants to re-use the cluster, they will receive errors related to attempting to create resources that already exist.
Sasha, Software Developer, https://design.gitlab.com/research/personas#persona-sasha
Devon, DevOps Engineer, https://design.gitlab.com/research/personas#persona-devon
When developers are experimenting/learning how the GitLab Kubernetes integration works, they may re-use the same cluster in different projects to run experiments.
I want to remove resources installed by GitLab but I want to keep using my cluster for other purposes (and not have to delete the cluster)
- As a DevOps engineer, I might have added my existing cluster with other deployments / data in the cluster.
- I then added my existing cluster to GitLab as a trial
- I then want to keep my existing cluster but remove GitLab installed resources
- Maybe I can then re-use the cluster in another GitLab project / group.
Add a split button in the Advanced section of the cluster page that includes an option to remove the integration and all resources or simply remove the integration. Removing the integration and resources is the default option.
Removing resources removes:
- all installed applications (from GitLab DB and on the cluster itself)
- remove project namespace(s)
clusterrolescreated by GitLab
clusterrolebindingscreated by GitLab
- if Knative present, remove all Knative-related resources
Clicking this option brings up a confirmation modal:
To remove the integration and resources, a user must enter the name of the cluster in the input.
Because removing the resources can take a while, we will redirect the user to the cluster overview page and show a loading indicator with a tooltip. The cluster detail view is no longer available (see follow up issue gitlab-foss#66728 (moved))
Once the cluster has been removed/resources deleted, we show a toast notifying the user: