ingress-tls-secrets.yaml 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. {{- /*
  2. Copyright Broadcom, Inc. All Rights Reserved.
  3. SPDX-License-Identifier: APACHE-2.0
  4. */}}
  5. {{- if .Values.ingress.enabled }}
  6. {{- if .Values.ingress.secrets }}
  7. {{- range .Values.ingress.secrets }}
  8. apiVersion: v1
  9. kind: Secret
  10. metadata:
  11. name: {{ .name }}
  12. namespace: {{ $.Release.Namespace | quote }}
  13. labels: {{- include "common.labels.standard" ( dict "customLabels" $.Values.commonLabels "context" $ ) | nindent 4 }}
  14. {{- if $.Values.commonAnnotations }}
  15. annotations: {{- include "common.tplvalues.render" ( dict "value" $.Values.commonAnnotations "context" $ ) | nindent 4 }}
  16. {{- end }}
  17. type: kubernetes.io/tls
  18. data:
  19. tls.crt: {{ .certificate | b64enc }}
  20. tls.key: {{ .key | b64enc }}
  21. ---
  22. {{- end }}
  23. {{- end }}
  24. {{- if and .Values.ingress.tls .Values.ingress.selfSigned }}
  25. {{- $secretName := printf "%s-tls" .Values.ingress.hostname }}
  26. {{- $ca := genCA "clickhouse-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: {{ .Release.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. {{- end }}
  43. {{- end }}