1804203ea1
- Support configured Postgres admin password - Use secrets for database job environment setup Change-Id: Icf7ceb4efb1b1bf976ca36e4fdd21b9b7990bc83
42 lines
1.6 KiB
YAML
42 lines
1.6 KiB
YAML
{{/*
|
|
# Copyright (c) 2017 AT&T Intellectual Property. All rights reserved.
|
|
#
|
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
# you may not use this file except in compliance with the License.
|
|
# You may obtain a copy of the License at
|
|
#
|
|
# http://www.apache.org/licenses/LICENSE-2.0
|
|
#
|
|
# Unless required by applicable law or agreed to in writing, software
|
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
# See the License for the specific language governing permissions and
|
|
# limitations under the License.
|
|
*/}}
|
|
{{- if .Values.manifests.secret_database }}
|
|
{{- $envAll := . }}
|
|
{{- range $key1, $userClass := tuple "admin" "user" }}
|
|
{{- $secretName := index $envAll.Values.secrets.postgresql $userClass }}
|
|
{{- $auth := index $envAll.Values.endpoints.postgresql.auth $userClass }}
|
|
---
|
|
apiVersion: v1
|
|
kind: Secret
|
|
metadata:
|
|
name: {{ $secretName }}
|
|
type: Opaque
|
|
data:
|
|
DATABASE_HOST: |-
|
|
{{ tuple "postgresql" "internal" $envAll | include "helm-toolkit.endpoints.hostname_fqdn_endpoint_lookup" | b64enc | indent 4 }}
|
|
DATABASE_USERNAME: |-
|
|
{{ $auth.username | b64enc | indent 4 }}
|
|
DATABASE_PASSWORD: |-
|
|
{{ $auth.password | b64enc | indent 4 }}
|
|
DATABASE_NAME: |-
|
|
{{ $auth.database | default "" | b64enc | indent 4 }}
|
|
DATABASE_PORT: {{ tuple "postgresql" "internal" "postgresql" $envAll | include "helm-toolkit.endpoints.endpoint_port_lookup" | b64enc }}
|
|
DATABASE_URI: |-
|
|
{{ tuple "postgresql" "internal" "user" "postgresql" $envAll | include "helm-toolkit.endpoints.authenticated_endpoint_uri_lookup" | b64enc | indent 4 }}
|
|
...
|
|
{{- end }}
|
|
{{- end }}
|