2 Returns `true` if the API `ingressClassName` field is supported and `false` otherwise
4 {{- define "ingress.supportsIngressClassName" -}}
5 {{- if ( semverCompare "<1.18-0" ( .Values.kubeVersion | default .Capabilities.KubeVersion.Version ) ) -}}
13 Returns `true` if the API `pathType` field is supported and `false` otherwise
15 {{- define "ingress.supportsPathType" -}}
16 {{- if ( semverCompare "<1.18-0" ( .Values.kubeVersion | default .Capabilities.KubeVersion.Version ) ) -}}
24 Returns the appropriate ingress `backend` fields depending on the Kubernetes API version.
25 e.g.: `{{ include "common.ingress.backend" (dict "serviceName" "backendName" "servicePort" "backendPort" "context" $) }}`
26 Where the dict must contain the following entries:
27 - `serviceName` {String} - Name of an existing service backend
28 - `servicePort` {String|Number} - Port name or port number of the service.
29 - `context` {Dict} - (Parent) Context for the template evaluation required for the API version detection.
31 {{- define "ingress.backend" -}}
32 {{- $apiVersion := ( include "capabilities.ingress.apiVersion" .context ) -}}
33 {{- if or ( eq $apiVersion "extensions/v1beta1" ) ( eq $apiVersion "networking.k8s.io/v1beta1" ) -}}
34 serviceName: {{ .serviceName }}
35 servicePort: {{ .servicePort }}
38 name: {{ .serviceName }}
40 {{- if typeIs "string" .servicePort }}
41 name: {{ .servicePort }}
42 {{- else if or ( typeIs "int" .servicePort ) ( typeIs "float64" .servicePort ) }}
43 number: {{ .servicePort }}