Allow clearing of cluster cache to avoid getting out of sync
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:
- gitlab-foss#58432 (comment 215143210)
- gitlab-foss#58432 (comment 189766784)
- gitlab-foss#58432 (comment 179603894)
- gitlab-foss#58432 (comment 147131208)
- gitlab-foss#62032 (comment 214800544)
- #28824 (comment 233041113)
Proposal
In the advance cluster settings, provide an option to clear all namespaces and service accounts:
Clear cluster cache
Delete GitLab's local cache of namespace and service accounts. This is necessary if your integration has become out of sync. The cache is repopulated during the next CI job that requires them.
[Clear cluster cache]
This deletes 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.
Styling
The text should be our default text color and the button should be our primary blue, as it indicated management.
Permissions and Security
This should only be available to Maintainer for whatever cluster the namespace is related to.