1 {{/* vim: set filetype=mustache: */}}
4 Generate backend entry that is compatible with all Kubernetes API versions.
7 {{ include "common.ingress.backend" (dict "serviceName" "backendName" "servicePort" "backendPort" "context" $) }}
10 - serviceName - String. Name of an existing service backend
11 - servicePort - String/Int. Port name (or number) of the service. It will be translated to different yaml depending if it is a string or an integer.
12 - context - Dict - Required. The context for the template evaluation.
14 {{- define "common.ingress.backend" -}}
15 {{- $apiVersion := (include "common.capabilities.ingress.apiVersion" .context) -}}
16 {{- if or (eq $apiVersion "extensions/v1beta1") (eq $apiVersion "networking.k8s.io/v1beta1") -}}
17 serviceName: {{ .serviceName }}
18 servicePort: {{ .servicePort }}
21 name: {{ .serviceName }}
23 {{- if typeIs "string" .servicePort }}
24 name: {{ .servicePort }}
25 {{- else if or (typeIs "int" .servicePort) (typeIs "float64" .servicePort) }}
26 number: {{ .servicePort | int }}
32 Print "true" if the API pathType field is supported
34 {{ include "common.ingress.supportsPathType" . }}
36 {{- define "common.ingress.supportsPathType" -}}
37 {{- if (semverCompare "<1.18-0" (include "common.capabilities.kubeVersion" .)) -}}
45 Returns true if the ingressClassname field is supported
47 {{ include "common.ingress.supportsIngressClassname" . }}
49 {{- define "common.ingress.supportsIngressClassname" -}}
50 {{- if semverCompare "<1.18-0" (include "common.capabilities.kubeVersion" .) -}}
58 Return true if cert-manager required annotations for TLS signed
59 certificates are set in the Ingress annotations
60 Ref: https://cert-manager.io/docs/usage/ingress/#supported-annotations
62 {{ include "common.ingress.certManagerRequest" ( dict "annotations" .Values.path.to.the.ingress.annotations ) }}
64 {{- define "common.ingress.certManagerRequest" -}}
65 {{ if or (hasKey .annotations "cert-manager.io/cluster-issuer") (hasKey .annotations "cert-manager.io/issuer") (hasKey .annotations "kubernetes.io/tls-acme") }}