| 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 | {{- if .Values.ingress.secrets }} |
| 8 | {{- range .Values.ingress.secrets }} |
| 9 | apiVersion: v1 |
| 10 | kind: Secret |
| 11 | metadata: |
| 12 | name: {{ .name }} |
| 13 | namespace: {{ include "common.names.namespace" $ | quote }} |
| 14 | labels: {{- include "common.labels.standard" ( dict "customLabels" $.Values.commonLabels "context" $ ) | nindent 4 }} |
| 15 | {{- if $.Values.commonAnnotations }} |
| 16 | annotations: {{- include "common.tplvalues.render" ( dict "value" $.Values.commonAnnotations "context" $ ) | nindent 4 }} |
| 17 | {{- end }} |
| 18 | type: kubernetes.io/tls |
| 19 | data: |
| 20 | tls.crt: {{ .certificate | b64enc }} |
| 21 | tls.key: {{ .key | b64enc }} |
| 22 | --- |
| 23 | {{- end }} |
| 24 | {{- else if and .Values.ingress.tls .Values.ingress.selfSigned }} |
| 25 | {{- $secretName := printf "%s-tls" (.Values.ingress.hostname | replace "*." "") }} |
| 26 | {{- $ca := genCA "nginx-ca" 365 }} |
| 27 | {{- $cert := genSignedCert .Values.ingress.hostname nil (list .Values.ingress.hostname) 365 $ca }} |
| 28 | apiVersion: v1 |
| 29 | kind: Secret |
| 30 | metadata: |
| 31 | name: {{ $secretName }} |
| 32 | namespace: {{ include "common.names.namespace" . | quote }} |
| 33 | labels: {{- include "common.labels.standard" ( dict "customLabels" .Values.commonLabels "context" $ ) | nindent 4 }} |
| 34 | {{- if .Values.commonAnnotations }} |
| 35 | annotations: {{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }} |
| 36 | {{- end }} |
| 37 | type: kubernetes.io/tls |
| 38 | data: |
| 39 | tls.crt: {{ include "common.secrets.lookup" (dict "secret" $secretName "key" "tls.crt" "defaultValue" $cert.Cert "context" $) }} |
| 40 | tls.key: {{ include "common.secrets.lookup" (dict "secret" $secretName "key" "tls.key" "defaultValue" $cert.Key "context" $) }} |
| 41 | ca.crt: {{ include "common.secrets.lookup" (dict "secret" $secretName "key" "ca.crt" "defaultValue" $ca.Cert "context" $) }} |
| 42 | --- |
| 43 | {{- end }} |
| 44 | {{- end }} |
| 45 | {{- if .Values.healthIngress.enabled }} |
| 46 | {{- if .Values.healthIngress.secrets }} |
| 47 | {{- range .Values.healthIngress.secrets }} |
| 48 | apiVersion: v1 |
| 49 | kind: Secret |
| 50 | metadata: |
| 51 | name: {{ .name }} |
| 52 | namespace: {{ include "common.names.namespace" $ | quote }} |
| 53 | labels: {{- include "common.labels.standard" ( dict "customLabels" $.Values.commonLabels "context" $ ) | nindent 4 }} |
| 54 | {{- if $.Values.commonAnnotations }} |
| 55 | annotations: {{- include "common.tplvalues.render" ( dict "value" $.Values.commonAnnotations "context" $ ) | nindent 4 }} |
| 56 | {{- end }} |
| 57 | type: kubernetes.io/tls |
| 58 | data: |
| 59 | tls.crt: {{ .certificate | b64enc }} |
| 60 | tls.key: {{ .key | b64enc }} |
| 61 | --- |
| 62 | {{- end }} |
| 63 | {{- else if and .Values.healthIngress.tls .Values.healthIngress.selfSigned }} |
| 64 | {{- $secretName := printf "%s-tls" .Values.healthIngress.hostname }} |
| 65 | {{- $ca := genCA "nginx-health-ca" 365 }} |
| 66 | {{- $cert := genSignedCert .Values.healthIngress.hostname nil (list .Values.healthIngress.hostname) 365 $ca }} |
| 67 | apiVersion: v1 |
| 68 | kind: Secret |
| 69 | metadata: |
| 70 | name: {{ $secretName }} |
| 71 | namespace: {{ include "common.names.namespace" . | quote }} |
| 72 | labels: {{- include "common.labels.standard" ( dict "customLabels" .Values.commonLabels "context" $ ) | nindent 4 }} |
| 73 | {{- if .Values.commonAnnotations }} |
| 74 | annotations: {{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }} |
| 75 | {{- end }} |
| 76 | type: kubernetes.io/tls |
| 77 | data: |
| 78 | tls.crt: {{ include "common.secrets.lookup" (dict "secret" $secretName "key" "tls.crt" "defaultValue" $cert.Cert "context" $) }} |
| 79 | tls.key: {{ include "common.secrets.lookup" (dict "secret" $secretName "key" "tls.key" "defaultValue" $cert.Key "context" $) }} |
| 80 | ca.crt: {{ include "common.secrets.lookup" (dict "secret" $secretName "key" "ca.crt" "defaultValue" $ca.Cert "context" $) }} |
| 81 | --- |
| 82 | {{- end }} |
| 83 | {{- end }} |