postgres-secret.yaml 926 B

1234567891011121314151617181920
  1. {{ if .Values.logsearchapi.enabled }}
  2. {{ $dbPass := randAlphaNum 32 | b64enc }}
  3. {{ $pgValues := (. | mustDeepCopy) }}
  4. {{ $_ := set $pgValues "common" (dict "nameSuffix" (include "postgres.nameSuffix" .)) }}
  5. apiVersion: v1
  6. kind: Secret
  7. metadata:
  8. name: {{ include "postgres.secretName" . }}
  9. data:
  10. db_user: {{ include "postgres.dbUser" . | b64enc }}
  11. db_name: {{ include "postgres.dbName" . | b64enc }}
  12. {{ with (lookup "v1" "Secret" .Release.Namespace (include "postgres.secretName" .)) }}
  13. {{ $dbPass = (index .data "db_password") }}
  14. db_password: {{ $dbPass }}
  15. {{ else }}
  16. db_password: {{ $dbPass }}
  17. {{ end }}
  18. postgresURL: {{ printf "postgres://%v:%v@%v:5432/%v?sslmode=disable" (include "postgres.dbUser" .) ($dbPass | b64dec) (include "common.names.fullname" $pgValues) (include "postgres.dbName" .) | b64enc }}
  19. postgresHost: {{ printf "%v" (include "common.names.fullname" $pgValues) | b64enc }}
  20. {{ end }}