Skip to content

Helm chart API version for networking.k8s.io fails #12796

@ledroide

Description

@ledroide

A similar issue had been reported in #6466 2 years ago, and at that time a fix was obviously working for some people.

However, when I try to use the chart, I get this error :

error: resource mapping not found for name: "defectdojo" namespace: "defectdojo" from "STDIN": no matches for kind "Ingress" in version "for /v1beta1"
ensure CRDs are installed first

By the way, my clusters are running Kubernetes v1.32.5, which supports networking.k8s.io/v1 only.

$ kubectl api-versions | grep ^networking.k8s.io
networking.k8s.io/v1

The problem is in templates/django-ingress.yaml at lines 3, 34, and 51.

In order to make it work on my clusters, I had to remove all lines regarding the
deprecated API version

The extensions/v1beta1 and networking.k8s.io/v1beta1 API versions of Ingress is no longer served as of v1.22.
Migrate manifests and API clients to use the networking.k8s.io/v1 API version, available since v1.19.

Since networking.k8s.io/v1 is the API version since the pre-pandemic era, I suggest that we simply clean up the code.

Here is my django-ingress.yaml - that works fine for me :

{{- if .Values.django.ingress.enabled -}}
{{- $fullName := include "defectdojo.fullname" . -}}
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  name: {{ $fullName }}
  labels:
    defectdojo.org/component: django
    app.kubernetes.io/name: {{ include "defectdojo.name" . }}
    app.kubernetes.io/instance: {{ .Release.Name }}
    app.kubernetes.io/managed-by: {{ .Release.Service }}
    helm.sh/chart: {{ include "defectdojo.chart" . }}
    {{- with .Values.extraLabels }}
    {{- toYaml . | nindent 4 }}
    {{- end }}
{{- if or .Values.django.ingress.annotations .Values.gke.useGKEIngress }}
  annotations:
    {{- with .Values.django.ingress.annotations }}
    {{- toYaml . | nindent 4 }}
    {{- end }}
    {{- if .Values.gke.useGKEIngress }}
    kubernetes.io/ingress.class: gce
    {{- if .Values.gke.useManagedCertificate }}
    kubernetes.io/ingress.allow-http: "false"
    networking.gke.io/managed-certificates: {{ $fullName }}-django
    {{- end }}
    {{- end }}
{{- end }}
spec:
  {{- if .Values.django.ingress.ingressClassName }}
  ingressClassName: {{ .Values.django.ingress.ingressClassName }}
  {{- end }}
  {{- if .Values.django.ingress.activateTLS }}
  tls:
    - hosts:
        - {{ .Values.host | quote }}
      {{- if .Values.django.ingress.secretName }}
      secretName: {{ .Values.django.ingress.secretName | quote }}
      {{- end }}
  {{- end }}
  rules:
    - host: {{ .Values.host | quote }}
      http:
        paths:
          - path: {{ .Values.django.ingress.path | default "/" | quote }}
            pathType: Prefix
            backend:
              service:
                name: {{ $fullName }}-django
                port:
                  name: http
{{- end }}

I have no particular settings in my values.yaml to help reproduce the bug, I just had set the django.ingress.enabled: true parameter.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions