{{- if .Values.ingress.enabled }} {{- if semverCompare ">=1.19-0" .Capabilities.KubeVersion.GitVersion -}} apiVersion: networking.k8s.io/v1 {{- else -}} apiVersion: networking.k8s.io/v1beta1 {{- end }} kind: Ingress metadata: name: longhorn-ingress namespace: {{ include "release_namespace" . }} labels: {{- include "longhorn.labels" . | nindent 4 }} app: longhorn-ingress annotations: {{- if .Values.ingress.secureBackends }} ingress.kubernetes.io/secure-backends: "true" {{- end }} {{- range $key, $value := .Values.ingress.annotations }} {{ $key }}: {{ $value | quote }} {{- end }} spec: {{- if and .Values.ingress.ingressClassName (semverCompare ">=1.18-0" .Capabilities.KubeVersion.GitVersion) }} ingressClassName: {{ .Values.ingress.ingressClassName }} {{- end }} rules: - host: {{ .Values.ingress.host }} http: paths: - path: {{ default "" .Values.ingress.path }} {{- if (semverCompare ">=1.18-0" $.Capabilities.KubeVersion.GitVersion) }} pathType: ImplementationSpecific {{- end }} backend: {{- if semverCompare ">=1.19-0" $.Capabilities.KubeVersion.GitVersion }} service: name: longhorn-frontend port: number: 80 {{- else }} serviceName: longhorn-frontend servicePort: 80 {{- end }} {{- if .Values.ingress.tls }} tls: - hosts: - {{ .Values.ingress.host }} secretName: {{ .Values.ingress.tlsSecret }} {{- end }} {{- end }}