Resolve "Gitlab doesn't detect the deployment pods after K8s cluster upgrade to v1.22"
What does this MR do and why?
The extensions/v1beta1
was removed on Kubernetes 1.22: https://kubernetes.io/blog/2021/07/14/upcoming-changes-in-kubernetes-1-22/
Whenever we call extensions_client.discover
the code raises a 404 not found and we fail to load deployments
and ingresses
. Consequently our deploy_boards also fail.
The fix is simply to not use this client anymore, since we don't need to look for resources in this APIs anymore. We should simply use the new APIs as suggested by the Kubernetes 1.22 documentation. That is networking.k8s.io/v1
for ingresses and apps/v1
for deployments. This also works in 1.21 because these APIs were already available and being used by us on our Auto DevOps chart.
Related Issues
Screenshots or screen recordings
Deployed the environment to K8s 1.22
Deploy Boards loads the pods correctly.
When toggling between master and this branch we unsee/see the pods.
How to set up and validate locally
- Have a deployable app.
- Enable these FF to allow you to use the deprecated
certificate_based_clusters
features:Feature.enable(:certificate_based_clusters)
. - Create a 1.22 Kubernetes cluster somewhere.
- Connect it to your GitLab project via https://docs.gitlab.com/ee/user/project/clusters/add_existing_cluster.html#how-to-add-an-existing-cluster.
- Set up Auto DevOps or at least just Auto Deploy in case you already have a docker image.
- Run a pipeline.
- Go to Deployments -> Environments on the left-side menu.
- Check that your pods will show on the screen after awhile.
MR acceptance checklist
This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.
-
I have evaluated the MR acceptance checklist for this MR.
Related to #357612 (closed)