ingress-tls-secrets.yaml 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. {{- if .Values.ingress.enabled }}
  2. {{- if .Values.ingress.secrets }}
  3. {{- range .Values.ingress.secrets }}
  4. apiVersion: v1
  5. kind: Secret
  6. metadata:
  7. name: {{ .name }}
  8. namespace: {{ $.Release.Namespace | quote }}
  9. labels: {{- include "common.labels.standard" $ | nindent 4 }}
  10. {{- if $.Values.commonLabels }}
  11. {{- include "common.tplvalues.render" ( dict "value" .Values.commonLabels "context" $ ) | nindent 4 }}
  12. {{- end }}
  13. {{- if $.Values.commonAnnotations }}
  14. annotations: {{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }}
  15. {{- end }}
  16. type: kubernetes.io/tls
  17. data:
  18. tls.crt: {{ .certificate | b64enc }}
  19. tls.key: {{ .key | b64enc }}
  20. ---
  21. {{- end }}
  22. {{- end }}
  23. {{- if and .Values.ingress.tls .Values.ingress.selfSigned }}
  24. {{- $secretName := printf "%s-tls" .Values.ingress.hostname }}
  25. {{- $ca := genCA "clickhouse-ca" 365 }}
  26. {{- $cert := genSignedCert .Values.ingress.hostname nil (list .Values.ingress.hostname) 365 $ca }}
  27. apiVersion: v1
  28. kind: Secret
  29. metadata:
  30. name: {{ $secretName }}
  31. namespace: {{ .Release.Namespace | quote }}
  32. labels: {{- include "common.labels.standard" . | nindent 4 }}
  33. {{- if .Values.commonLabels }}
  34. {{- include "common.tplvalues.render" ( dict "value" .Values.commonLabels "context" $ ) | nindent 4 }}
  35. {{- end }}
  36. {{- if .Values.commonAnnotations }}
  37. annotations: {{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }}
  38. {{- end }}
  39. type: kubernetes.io/tls
  40. data:
  41. tls.crt: {{ include "common.secrets.lookup" (dict "secret" $secretName "key" "tls.crt" "defaultValue" $cert.Cert "context" $) }}
  42. tls.key: {{ include "common.secrets.lookup" (dict "secret" $secretName "key" "tls.key" "defaultValue" $cert.Key "context" $) }}
  43. ca.crt: {{ include "common.secrets.lookup" (dict "secret" $secretName "key" "ca.crt" "defaultValue" $ca.Cert "context" $) }}
  44. {{- end }}
  45. {{- end }}