Kubernetes resources should be re-created when deleted
I was overhauling my pipeline configuration and I deleted the whole project namespace from the Kubernetes cluster, to get rid of all old resources and to start over. Then all my jobs started to fail.
How to reproduce
- Create a group Kubernetes cluster
- Run a CI job with
environment
set in a project of the group - Check that a namespace has been created for the project:
kubectl get namespaces
- Delete the namespace:
kubectl delete namespace my-project-123
- Run the same job again
Exprected result
I expected the namespace and its resources to be created again.
Actual result
No namespace is created. The job does not have the kubernetes variables available and if the job uses kubectl
it will fail.
Workaround
I connected to GitLab's database and I deleted the namespace from table clusters_kubernetes_namespaces
. After that the namespace was created again.