| Sketch🕴️ | 620d57b | 2025-07-31 22:31:14 +0400 | [diff] [blame] | 1 | {{- /* |
| 2 | Copyright Broadcom, Inc. All Rights Reserved. |
| 3 | SPDX-License-Identifier: APACHE-2.0 |
| 4 | */}} |
| 5 | |
| 6 | {{- if .Values.ingress.enabled }} |
| 7 | apiVersion: {{ include "common.capabilities.ingress.apiVersion" . }} |
| 8 | kind: Ingress |
| 9 | metadata: |
| 10 | name: {{ include "common.names.fullname" . }} |
| 11 | namespace: {{ include "common.names.namespace" . | quote }} |
| 12 | labels: {{- include "common.labels.standard" ( dict "customLabels" .Values.commonLabels "context" $ ) | nindent 4 }} |
| 13 | {{- if or .Values.ingress.annotations .Values.commonAnnotations }} |
| 14 | {{- $annotations := include "common.tplvalues.merge" ( dict "values" ( list .Values.ingress.annotations .Values.commonAnnotations ) "context" . ) }} |
| 15 | annotations: {{- include "common.tplvalues.render" ( dict "value" $annotations "context" $) | nindent 4 }} |
| 16 | {{- end }} |
| 17 | spec: |
| 18 | {{- if .Values.ingress.ingressClassName }} |
| 19 | ingressClassName: {{ .Values.ingress.ingressClassName | quote }} |
| 20 | {{- end }} |
| 21 | rules: |
| 22 | {{- if .Values.ingress.hostname }} |
| 23 | - host: {{ (tpl .Values.ingress.hostname .) | quote }} |
| 24 | http: |
| 25 | paths: |
| 26 | {{- if .Values.ingress.extraPaths }} |
| 27 | {{- toYaml .Values.ingress.extraPaths | nindent 10 }} |
| 28 | {{- end }} |
| 29 | - path: {{ .Values.ingress.path }} |
| 30 | pathType: {{ .Values.ingress.pathType }} |
| 31 | backend: {{- include "common.ingress.backend" (dict "serviceName" (include "common.names.fullname" .) "servicePort" "http" "context" $) | nindent 14 }} |
| 32 | {{- else if .Values.ingress.path }} |
| 33 | - http: |
| 34 | paths: |
| 35 | {{- if .Values.ingress.extraPaths }} |
| 36 | {{- toYaml .Values.ingress.extraPaths | nindent 10 }} |
| 37 | {{- end }} |
| 38 | - path: {{ .Values.ingress.path }} |
| 39 | pathType: {{ .Values.ingress.pathType }} |
| 40 | backend: {{- include "common.ingress.backend" (dict "serviceName" (include "common.names.fullname" .) "servicePort" "http" "context" $) | nindent 14 }} |
| 41 | {{- end }} |
| 42 | {{- range .Values.ingress.extraHosts }} |
| 43 | - host: {{ .name | quote }} |
| 44 | http: |
| 45 | paths: |
| 46 | - path: {{ default "/" .path }} |
| 47 | pathType: {{ default "ImplementationSpecific" .pathType }} |
| 48 | backend: {{- include "common.ingress.backend" (dict "serviceName" (include "common.names.fullname" $) "servicePort" "http" "context" $) | nindent 14 }} |
| 49 | {{- end }} |
| 50 | {{- if .Values.ingress.extraRules }} |
| 51 | {{- include "common.tplvalues.render" (dict "value" .Values.ingress.extraRules "context" $) | nindent 4 }} |
| 52 | {{- end }} |
| 53 | {{- 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 }} |
| 54 | tls: |
| 55 | {{- if and .Values.ingress.tls (or (include "common.ingress.certManagerRequest" ( dict "annotations" .Values.ingress.annotations )) .Values.ingress.selfSigned (not (empty .Values.ingress.secrets))) }} |
| 56 | - hosts: |
| 57 | - {{ (tpl .Values.ingress.hostname .) | quote }} |
| 58 | {{- if and (or (.Values.ingress.tlsWwwPrefix) (eq (index .Values.ingress.annotations "nginx.ingress.kubernetes.io/from-to-www-redirect") "true" )) (not (contains "www." (tpl .Values.ingress.hostname .))) }} |
| 59 | - {{ printf "www.%s" (tpl .Values.ingress.hostname $) | quote }} |
| 60 | {{- end }} |
| 61 | secretName: {{ printf "%s-tls" (.Values.ingress.hostname | replace "*." "") }} |
| 62 | {{- end }} |
| 63 | {{- if .Values.ingress.extraTls }} |
| 64 | {{- include "common.tplvalues.render" (dict "value" .Values.ingress.extraTls "context" $) | nindent 4 }} |
| 65 | {{- end }} |
| 66 | {{- end }} |
| 67 | {{- end }} |