Allow users to recreate namespaces and service accounts for a cluster
Problem to solve
Sometimes a users GitLab <-> Cluster integration may get out of sync. For example if a user manually deletes a namespace. GitLab ends up being in a bad state where it won't recreate the namespace because it thinks it already exists.
Intended users
Further details
Requests for this feature in:
- https://gitlab.com/gitlab-org/gitlab-ce/issues/58432#note_215143210
- https://gitlab.com/gitlab-org/gitlab-ce/issues/58432#note_189766784
- https://gitlab.com/gitlab-org/gitlab-ce/issues/58432#note_179603894
- https://gitlab.com/gitlab-org/gitlab-ce/issues/58432#note_147131208
- https://gitlab.com/gitlab-org/gitlab-ce/issues/62032#note_214800544
Proposal
Add a button to the cluster page that allows the use to clear all namespaces and service accounts. It should be made clear that this will only clear them on GitLab's side and thus they will be recreated next time a CI job runs. The button could be called "refresh namespaces" or something.
All it needs to do is delete GitLab's local cache of namespaces and service accounts. Next time a job runs for an environment it will recreate the namespace and service account in K8s if it doesn't exist. If it does exist in K8s then GitLab will just reload them so it's safe either way.
Permissions and Security
This should only be available to Maintainer for whatever cluster the namespace is related to.