Unverified Commit 68b0a4a6 authored by Hordur Freyr Yngvason's avatar Hordur Freyr Yngvason
Browse files

fix: use kubernetes.io/ingress.class when present

It is possible to have an up-to-date cluster, but an outdated ingress
controller. This means that the API networking.k8s.io/v1/Ingress is
available, but no valid ingressClassName exists in the cluster.

See https://gitlab.com/gitlab-org/cluster-integration/auto-deploy-image/-/issues/206
parent cf163fcb
Loading
Loading
Loading
Loading
+9 −4
Original line number Diff line number Diff line
@@ -12,8 +12,10 @@ metadata:
  labels:
{{ include "sharedlabels" . | indent 4 }}
  annotations:
{{- if not (.Capabilities.APIVersions.Has "networking.k8s.io/v1/Ingress") }}
    kubernetes.io/ingress.class: {{ .Values.ingress.className | quote }}
{{- if not (or (.Capabilities.APIVersions.Has "networking.k8s.io/v1/Ingress")
               (hasKey .Values.ingress.annotations "kubernetes.io/ingress.class"))
}}
    kubernetes.io/ingress.class: {{ .Values.ingress.className | default "nginx" | quote }}
{{- end }}
{{- if .Values.ingress.annotations }}
{{ toYaml .Values.ingress.annotations | indent 4 }}
@@ -46,8 +48,11 @@ metadata:

{{- end }}
spec:
{{- if .Capabilities.APIVersions.Has "networking.k8s.io/v1/Ingress" }}
  ingressClassName: {{ .Values.ingress.className | quote }}
{{- if and (.Capabilities.APIVersions.Has "networking.k8s.io/v1/Ingress")
           (or (hasKey .Values.ingress "className")
               (not (hasKey .Values.ingress.annotations "kubernetes.io/ingress.class")))
}}
  ingressClassName: {{ .Values.ingress.className | default "nginx" | quote }}
{{- end }}
{{- if .Values.ingress.tls.enabled }}
  tls:
+2 −1
Original line number Diff line number Diff line
@@ -80,7 +80,7 @@ ingress:
    acme: true
    secretName: ""
    useDefaultSecret: false
  className: nginx
  # className: nginx
  modSecurity:
    enabled: false
    secRuleEngine: "DetectionOnly"
@@ -90,6 +90,7 @@ ingress:
    #     action: ""
  canary:
    weight:
  annotations: {}
prometheus:
  metrics: false
livenessProbe: