tls-secrets.yaml 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. {{- /*
  2. Copyright VMware, Inc.
  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: {{ include "common.names.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 "minio-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. {{- end }}
  43. {{- end }}
  44. {{- if (include "minio.createTlsSecret" .) }}
  45. {{- $secretName := printf "%s-crt" (include "common.names.fullname" .) }}
  46. {{- $ca := genCA "minio-ca" 365 }}
  47. {{- $releaseNamespace := include "common.names.namespace" . }}
  48. {{- $clusterDomain := .Values.clusterDomain }}
  49. {{- $fullname := include "common.names.fullname" . }}
  50. {{- $serviceName := include "common.names.fullname" . }}
  51. {{- $headlessServiceName := printf "%s-headless" (include "common.names.fullname" .) }}
  52. {{- $altNames := list (printf "*.%s.%s.svc.%s" $serviceName $releaseNamespace $clusterDomain) (printf "%s.%s.svc.%s" $serviceName $releaseNamespace $clusterDomain) (printf "*.%s.%s.svc.%s" $headlessServiceName $releaseNamespace $clusterDomain) (printf "%s.%s.svc.%s" $headlessServiceName $releaseNamespace $clusterDomain) "127.0.0.1" "localhost" $fullname }}
  53. {{- $cert := genSignedCert $fullname nil $altNames 365 $ca }}
  54. ---
  55. apiVersion: v1
  56. kind: Secret
  57. metadata:
  58. name: {{ $secretName }}
  59. labels: {{- include "common.labels.standard" ( dict "customLabels" .Values.commonLabels "context" $ ) | nindent 4 }}
  60. {{- if .Values.commonAnnotations }}
  61. annotations: {{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }}
  62. {{- end }}
  63. type: kubernetes.io/tls
  64. data:
  65. tls.crt: {{ include "common.secrets.lookup" (dict "secret" $secretName "key" "tls.crt" "defaultValue" $cert.Cert "context" $) }}
  66. tls.key: {{ include "common.secrets.lookup" (dict "secret" $secretName "key" "tls.key" "defaultValue" $cert.Key "context" $) }}
  67. ca.crt: {{ include "common.secrets.lookup" (dict "secret" $secretName "key" "ca.crt" "defaultValue" $ca.Cert "context" $) }}
  68. {{- end }}