Default Ingress to networking.k8s.io/v1
What does this MR do?
Defaults the Ingress apiVersion to networking.k8s.io/v1, following the same pattern as !5409 (merged) (HPA), !5410 (merged) (PDB) and !5416 (merged) (CronJob).
When the chart is rendered without cluster API discovery (for example helm template without --api-versions, as common in GitOps pipelines), gitlab.ingress.apiVersion fell back to extensions/v1beta1, which was removed in Kubernetes 1.22 together with networking.k8s.io/v1beta1. Every Kubernetes version the chart supports serves networking.k8s.io/v1, so this makes it the default and drops the capability probes.
The Ingress templates chose the backend shape (service.name/service.port vs. serviceName/servicePort) and pathType with a separate check on Capabilities and global.ingress.apiVersion, independent of the apiVersion actually rendered. With only the default changed, offline renders would have produced networking.k8s.io/v1 objects with v1beta1 backends. This MR bases those conditions on the gitlab.ingress.apiVersion result instead (KAS, webservice, webservice smartcard, Pages and Registry Ingresses), so the backend always matches the rendered apiVersion. As a side effect this also fixes a local ingress.apiVersion: networking.k8s.io/v1beta1 override on a cluster serving v1 rendering v1beta1 objects with v1 backends.
Kept as-is: explicit global.ingress.apiVersion / local ingress.apiVersion overrides, and the v1beta1 branches for class annotation and backends, since explicit overrides to older versions still select them. The KAS gRPC Ingress already hardcoded v1 backends and is untouched.
Also:
- Removes the now-redundant
global.ingress.apiVersion: networking.k8s.io/v1pin fromHELM_DEFAULT_SETTINGSin.gitlab-ci.yml, so kubeconform and the template checks exercise the chart default (as suggested in review of !5410 (merged) / !5409 (merged)). - Documents the
networking.k8s.io/v1default indoc/charts/globals.md. - Specs: default now expects
networking.k8s.io/v1withingressClassNameand v1 backends; drops the redundant "with cluster connection" case; adds a v1beta1-override backend-shape case; updates the smartcard backend and Geo ingress class expectations.
Verification (helm template):
- No discovery: all 6 Ingresses render
networking.k8s.io/v1,ingressClassName,servicebackends. Same with the CIHELM_DEFAULT_SETTINGS. global.ingress.apiVersion=networking.k8s.io/v1beta1: all render v1beta1 with the class annotation andserviceNamebackends (KAS gRPC keeps v1 backends, as before).- Local webservice override to v1beta1: webservice Ingresses render v1beta1 with
serviceNamebackends. - With
--api-versions networking.k8s.io/v1/Ingress: output identical tomaster. glab ci lint: valid.
RSpec ran locally at 95c2de12b with Ruby 3.3.12 and Helm 4.2.4 (the CI versions): all 26 specs under spec/configuration/ that touch Ingress pass (762 examples, 0 failures). The updated ingress_spec.rb and geo_ingress_spec.rb fail against master (5 failures: the v1 default, v1 backends, smartcard route and both Geo Ingresses), as expected. RuboCop reports no offenses on the changed specs.
Kubernetes references:
extensions/v1beta1andnetworking.k8s.io/v1beta1Ingress are no longer served as of Kubernetes 1.22: Deprecated API Migration Guide – Ingress v1.22
Related issues
- Related: !5409 (merged), !5410 (merged), !5416 (merged)
Author checklist
For general guidance, please follow our Contributing guide.
Required
For anything in this list which will not be completed, please provide a reason in the MR discussion.
- Merge Request Title and Description are up to date, accurate, and descriptive.
- MR targeting the appropriate branch.
- MR has a green pipeline.
- Documentation created/updated.
- Tests added/updated.
- Have you validated that your change works end-to-end on a real cluster deployment?
- Describe how you did it in a comment.
- Equivalent MR/issue for omnibus-gitlab opened.
- When ready for review, MR is marked as ready (not a draft) and assigned to a reviewer.
Reviewers checklist
- As soon as you begin reviewing, select Start a review on your first comment so the MR shows Reviewer started review.
- MR has a green pipeline on https://gitlab.com/gitlab-org/charts/gitlab.
- Consider downstream impact to the Operator, as per evaluating impact from changes to GitLab chart.