secret.yaml 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. {{- $host := include "common.names.fullname" . }}
  2. {{- if not .Values.sentinel.enabled }}
  3. {{- $host = printf "%s-master" (include "common.names.fullname" .) }}
  4. {{- end }}
  5. {{- $port := print .Values.master.service.ports.redis }}
  6. {{- if .Values.sentinel.enabled }}
  7. {{- $port = print .Values.sentinel.service.ports.redis }}
  8. {{- end }}
  9. {{- $password := include "redis.password" . }}
  10. {{- if and .Values.auth.enabled (not .Values.auth.existingSecret) -}}
  11. apiVersion: v1
  12. kind: Secret
  13. metadata:
  14. name: {{ template "common.names.fullname" . }}
  15. namespace: {{ .Release.Namespace | quote }}
  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 or .Values.secretAnnotations .Values.commonAnnotations }}
  21. annotations:
  22. {{- if .Values.secretAnnotations }}
  23. {{- include "common.tplvalues.render" ( dict "value" .Values.secretAnnotations "context" $ ) | nindent 4 }}
  24. {{- end }}
  25. {{- if .Values.commonAnnotations }}
  26. {{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }}
  27. {{- end }}
  28. {{- end }}
  29. type: Opaque
  30. data:
  31. redis-password: {{ print $password | b64enc | quote }}
  32. {{- end -}}
  33. {{- if .Values.serviceBindings.enabled }}
  34. ---
  35. apiVersion: v1
  36. kind: Secret
  37. metadata:
  38. name: {{ include "common.names.fullname" . }}-svcbind
  39. namespace: {{ .Release.Namespace | quote }}
  40. labels: {{- include "common.labels.standard" . | nindent 4 }}
  41. {{- if .Values.commonLabels }}
  42. {{- include "common.tplvalues.render" ( dict "value" .Values.commonLabels "context" $ ) | nindent 4 }}
  43. {{- end }}
  44. {{- if .Values.commonAnnotations }}
  45. annotations: {{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }}
  46. {{- end }}
  47. type: servicebinding.io/redis
  48. data:
  49. provider: {{ print "bitnami" | b64enc | quote }}
  50. type: {{ print "redis" | b64enc | quote }}
  51. host: {{ print $host | b64enc | quote }}
  52. port: {{ print $port | b64enc | quote }}
  53. password: {{ print $password | b64enc | quote }}
  54. uri: {{ printf "redis://%s@%s:%s" $password $host $port | b64enc | quote }}
  55. {{- end }}