tls-secrets.yaml 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. {{- if (include "zookeeper.client.createTlsSecret" .) }}
  2. {{- $secretName := printf "%s-client-crt" (include "common.names.fullname" .) }}
  3. {{- $ca := genCA "zookeeper-client-ca" 365 }}
  4. {{- $releaseNamespace := .Release.Namespace }}
  5. {{- $clusterDomain := .Values.clusterDomain }}
  6. {{- $fullname := include "common.names.fullname" . }}
  7. {{- $serviceName := include "common.names.fullname" . }}
  8. {{- $headlessServiceName := printf "%s-headless" (include "common.names.fullname" .) }}
  9. {{- $altNames := list (printf "*.%s.%s.svc.%s" $headlessServiceName $releaseNamespace $clusterDomain) (printf "%s.%s.svc.%s" $headlessServiceName $releaseNamespace $clusterDomain) (printf "*.%s.%s.svc.%s" $serviceName $releaseNamespace $clusterDomain) (printf "%s.%s.svc.%s" $serviceName $releaseNamespace $clusterDomain) "127.0.0.1" "localhost" $fullname }}
  10. {{- $cert := genSignedCert $fullname nil $altNames 365 $ca }}
  11. apiVersion: v1
  12. kind: Secret
  13. metadata:
  14. name: {{ $secretName }}
  15. namespace: {{ template "zookeeper.namespace" . }}
  16. labels: {{- include "common.labels.standard" . | nindent 4 }}
  17. {{- if .Values.commonLabels }}
  18. {{- include "common.tplvalues.render" ( dict "value" .Values.commonLabels "context" $ ) | nindent 4 }}
  19. {{- end }}
  20. {{- if .Values.commonAnnotations }}
  21. annotations: {{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }}
  22. {{- end }}
  23. type: kubernetes.io/tls
  24. data:
  25. tls.crt: {{ include "common.secrets.lookup" (dict "secret" $secretName "key" "tls.crt" "defaultValue" $cert.Cert "context" $) }}
  26. tls.key: {{ include "common.secrets.lookup" (dict "secret" $secretName "key" "tls.key" "defaultValue" $cert.Key "context" $) }}
  27. ca.crt: {{ include "common.secrets.lookup" (dict "secret" $secretName "key" "ca.crt" "defaultValue" $ca.Cert "context" $) }}
  28. {{- end }}
  29. {{- if (include "zookeeper.quorum.createTlsSecret" .) }}
  30. {{- $secretName := printf "%s-quorum-crt" (include "common.names.fullname" .) }}
  31. {{- $ca := genCA "zookeeper-quorum-ca" 365 }}
  32. {{- $releaseNamespace := .Release.Namespace }}
  33. {{- $clusterDomain := .Values.clusterDomain }}
  34. {{- $fullname := include "common.names.fullname" . }}
  35. {{- $serviceName := include "common.names.fullname" . }}
  36. {{- $headlessServiceName := printf "%s-headless" (include "common.names.fullname" .) }}
  37. {{- $altNames := list (printf "*.%s.%s.svc.%s" $headlessServiceName $releaseNamespace $clusterDomain) (printf "%s.%s.svc.%s" $headlessServiceName $releaseNamespace $clusterDomain) (printf "*.%s.%s.svc.%s" $serviceName $releaseNamespace $clusterDomain) (printf "%s.%s.svc.%s" $serviceName $releaseNamespace $clusterDomain) $fullname }}
  38. {{- $cert := genSignedCert $fullname nil $altNames 365 $ca }}
  39. ---
  40. apiVersion: v1
  41. kind: Secret
  42. metadata:
  43. name: {{ $secretName }}
  44. namespace: {{ template "zookeeper.namespace" . }}
  45. labels: {{- include "common.labels.standard" . | nindent 4 }}
  46. {{- if .Values.commonLabels }}
  47. {{- include "common.tplvalues.render" ( dict "value" .Values.commonLabels "context" $ ) | nindent 4 }}
  48. {{- end }}
  49. {{- if .Values.commonAnnotations }}
  50. annotations: {{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }}
  51. {{- end }}
  52. type: kubernetes.io/tls
  53. data:
  54. tls.crt: {{ include "common.secrets.lookup" (dict "secret" $secretName "key" "tls.crt" "defaultValue" $cert.Cert "context" $) }}
  55. tls.key: {{ include "common.secrets.lookup" (dict "secret" $secretName "key" "tls.key" "defaultValue" $cert.Key "context" $) }}
  56. ca.crt: {{ include "common.secrets.lookup" (dict "secret" $secretName "key" "ca.crt" "defaultValue" $ca.Cert "context" $) }}
  57. {{- end }}