3 SPDX-License-Identifier: APACHE-2.0
6 {{/* vim: set filetype=mustache: */}}
9 Generate backend entry that is compatible with all Kubernetes API versions.
12 {{ include "common.ingress.backend" (dict "serviceName" "backendName" "servicePort" "backendPort" "context" $) }}
15 - serviceName - String. Name of an existing service backend
16 - 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.
17 - context - Dict - Required. The context for the template evaluation.
19 {{- define "common.ingress.backend" -}}
20 {{- $apiVersion := (include "common.capabilities.ingress.apiVersion" .context) -}}
21 {{- if or (eq $apiVersion "extensions/v1beta1") (eq $apiVersion "networking.k8s.io/v1beta1") -}}
22 serviceName: {{ .serviceName }}
23 servicePort: {{ .servicePort }}
26 name: {{ .serviceName }}
28 {{- if typeIs "string" .servicePort }}
29 name: {{ .servicePort }}
30 {{- else if or (typeIs "int" .servicePort) (typeIs "float64" .servicePort) }}
31 number: {{ .servicePort | int }}
37 Print "true" if the API pathType field is supported
39 {{ include "common.ingress.supportsPathType" . }}
41 {{- define "common.ingress.supportsPathType" -}}
42 {{- if (semverCompare "<1.18-0" (include "common.capabilities.kubeVersion" .)) -}}
50 Returns true if the ingressClassname field is supported
52 {{ include "common.ingress.supportsIngressClassname" . }}
54 {{- define "common.ingress.supportsIngressClassname" -}}
55 {{- if semverCompare "<1.18-0" (include "common.capabilities.kubeVersion" .) -}}
63 Return true if cert-manager required annotations for TLS signed
64 certificates are set in the Ingress annotations
65 Ref: https://cert-manager.io/docs/usage/ingress/#supported-annotations
67 {{ include "common.ingress.certManagerRequest" ( dict "annotations" .Values.path.to.the.ingress.annotations ) }}
69 {{- define "common.ingress.certManagerRequest" -}}
70 {{ if or (hasKey .annotations "cert-manager.io/cluster-issuer") (hasKey .annotations "cert-manager.io/issuer") (hasKey .annotations "kubernetes.io/tls-acme") }}