aboutsummaryrefslogtreecommitdiffstats
path: root/kubernetes/common/nginx/templates/ingress.yaml
diff options
context:
space:
mode:
Diffstat (limited to 'kubernetes/common/nginx/templates/ingress.yaml')
-rw-r--r--kubernetes/common/nginx/templates/ingress.yaml73
1 files changed, 73 insertions, 0 deletions
diff --git a/kubernetes/common/nginx/templates/ingress.yaml b/kubernetes/common/nginx/templates/ingress.yaml
new file mode 100644
index 0000000000..b49f86b46f
--- /dev/null
+++ b/kubernetes/common/nginx/templates/ingress.yaml
@@ -0,0 +1,73 @@
+{{- /*
+Copyright Broadcom, Inc. All Rights Reserved.
+SPDX-License-Identifier: APACHE-2.0
+*/}}
+
+{{- if .Values.ingress.enabled }}
+apiVersion: {{ include "common.capabilities.ingress.apiVersion" . }}
+kind: Ingress
+metadata:
+ name: {{ include "common.names.fullname" . }}
+ namespace: {{ include "common.names.namespace" . | quote }}
+ labels: {{- include "common.labels.standard" ( dict "customLabels" .Values.commonLabels "context" $ ) | nindent 4 }}
+ {{- if or .Values.ingress.annotations .Values.commonAnnotations }}
+ {{- $annotations := include "common.tplvalues.merge" ( dict "values" ( list .Values.ingress.annotations .Values.commonAnnotations ) "context" . ) }}
+ annotations: {{- include "common.tplvalues.render" ( dict "value" $annotations "context" $) | nindent 4 }}
+ {{- end }}
+spec:
+ {{- if and .Values.ingress.ingressClassName (eq "true" (include "common.ingress.supportsIngressClassname" .)) }}
+ ingressClassName: {{ .Values.ingress.ingressClassName | quote }}
+ {{- end }}
+ rules:
+ {{- if .Values.ingress.hostname }}
+ - host: {{ .Values.ingress.hostname | quote }}
+ http:
+ paths:
+ {{- if .Values.ingress.extraPaths }}
+ {{- toYaml .Values.ingress.extraPaths | nindent 10 }}
+ {{- end }}
+ - path: {{ .Values.ingress.path }}
+ {{- if eq "true" (include "common.ingress.supportsPathType" .) }}
+ pathType: {{ .Values.ingress.pathType }}
+ {{- end }}
+ backend: {{- include "common.ingress.backend" (dict "serviceName" (include "common.names.fullname" .) "servicePort" "http" "context" $) | nindent 14 }}
+ {{- else if .Values.ingress.path }}
+ - http:
+ paths:
+ {{- if .Values.ingress.extraPaths }}
+ {{- toYaml .Values.ingress.extraPaths | nindent 10 }}
+ {{- end }}
+ - path: {{ .Values.ingress.path }}
+ {{- if eq "true" (include "common.ingress.supportsPathType" .) }}
+ pathType: {{ .Values.ingress.pathType }}
+ {{- end }}
+ backend: {{- include "common.ingress.backend" (dict "serviceName" (include "common.names.fullname" .) "servicePort" "http" "context" $) | nindent 14 }}
+ {{- end }}
+ {{- range .Values.ingress.extraHosts }}
+ - host: {{ .name | quote }}
+ http:
+ paths:
+ - path: {{ default "/" .path }}
+ {{- if eq "true" (include "common.ingress.supportsPathType" $) }}
+ pathType: {{ default "ImplementationSpecific" .pathType }}
+ {{- end }}
+ backend: {{- include "common.ingress.backend" (dict "serviceName" (include "common.names.fullname" $) "servicePort" "http" "context" $) | nindent 14 }}
+ {{- end }}
+ {{- if .Values.ingress.extraRules }}
+ {{- include "common.tplvalues.render" (dict "value" .Values.ingress.extraRules "context" $) | nindent 4 }}
+ {{- end }}
+ {{- if or (and .Values.ingress.tls (or (include "common.ingress.certManagerRequest" ( dict "annotations" .Values.ingress.annotations )) .Values.ingress.selfSigned (not (empty .Values.ingress.secrets)))) .Values.ingress.extraTls }}
+ tls:
+ {{- if and .Values.ingress.tls (or (include "common.ingress.certManagerRequest" ( dict "annotations" .Values.ingress.annotations )) .Values.ingress.selfSigned (not (empty .Values.ingress.secrets))) }}
+ - hosts:
+ - {{ .Values.ingress.hostname | quote }}
+ {{- if and (or (.Values.ingress.tlsWwwPrefix) (eq (index .Values.ingress.annotations "nginx.ingress.kubernetes.io/from-to-www-redirect") "true" )) (not (contains "www." .Values.ingress.hostname)) }}
+ - {{ printf "www.%s" (tpl .Values.ingress.hostname $) | quote }}
+ {{- end }}
+ secretName: {{ printf "%s-tls" .Values.ingress.hostname }}
+ {{- end }}
+ {{- if .Values.ingress.extraTls }}
+ {{- include "common.tplvalues.render" (dict "value" .Values.ingress.extraTls "context" $) | nindent 4 }}
+ {{- end }}
+ {{- end }}
+{{- end }}