drydock/charts/drydock/templates/configmap-etc.yaml

91 lines
3.9 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.configmap_etc }}
{{- $envAll := . }}
# Render Database connection string if it is not explicitly configured
{{- if empty .Values.conf.drydock.database.database_connect_string -}}
{{- tuple "postgresql" "internal" "user" "postgresql" . | include "helm-toolkit.endpoints.authenticated_endpoint_uri_lookup" | set .Values.conf.drydock.database "database_connect_string" | quote | trunc 0 -}}
{{- end -}}
# Render MAAS connection string if it is not explicitly configured
{{- if empty .Values.conf.drydock.maasdriver.maas_api_url -}}
{{- tuple "maas_region" "internal" "region_api" . | include "helm-toolkit.endpoints.keystone_endpoint_uri_lookup" | set .Values.conf.drydock.maasdriver "maas_api_url" | quote | trunc 0 -}}
{{- end -}}
{{- if empty .Values.conf.drydock.keystone_authtoken.auth_uri -}}
{{- tuple "identity" "internal" "api" . | include "helm-toolkit.endpoints.keystone_endpoint_uri_lookup" | set .Values.conf.drydock.keystone_authtoken "auth_uri" | quote | trunc 0 -}}
{{- end -}}
# FIXME(sh8121att) fix for broken keystonemiddleware oslo config gen in newton - will remove in future
{{- if empty .Values.conf.drydock.keystone_authtoken.auth_url -}}
{{- tuple "identity" "internal" "api" . | include "helm-toolkit.endpoints.keystone_endpoint_uri_lookup"| set .Values.conf.drydock.keystone_authtoken "auth_url" | quote | trunc 0 -}}
{{- end -}}
{{- $userIdentity := .Values.endpoints.identity.auth.drydock -}}
{{- if empty .Values.conf.drydock.keystone_authtoken.project_name -}}
{{- set .Values.conf.drydock.keystone_authtoken "project_name" $userIdentity.project_name | quote | trunc 0 -}}
{{- end -}}
{{- if empty .Values.conf.drydock.keystone_authtoken.project_domain_name -}}
{{- set .Values.conf.drydock.keystone_authtoken "project_domain_name" $userIdentity.project_domain_name | quote | trunc 0 -}}
{{- end -}}
{{- if empty .Values.conf.drydock.keystone_authtoken.user_domain_name -}}
{{- set .Values.conf.drydock.keystone_authtoken "user_domain_name" $userIdentity.user_domain_name | quote | trunc 0 -}}
{{- end -}}
{{- if empty .Values.conf.drydock.keystone_authtoken.username -}}
{{- set .Values.conf.drydock.keystone_authtoken "username" $userIdentity.username | quote | trunc 0 -}}
{{- end -}}
{{- if empty .Values.conf.drydock.keystone_authtoken.password -}}
{{- set .Values.conf.drydock.keystone_authtoken "password" $userIdentity.password | quote | trunc 0 -}}
{{- end -}}
---
apiVersion: v1
kind: ConfigMap
metadata:
name: drydock-etc
data:
drydock.conf: |+
{{ include "helm-toolkit.utils.to_oslo_conf" .Values.conf.drydock | indent 4 }}
api-paste.ini: |+
{{ if .Values.conf.paste.override -}}
{{ .Values.conf.paste.override | indent 4 }}
{{- else -}}
{{- if .Values.conf.paste.prefix -}}
{{ .Values.conf.paste.prefix | indent 4 }}
{{- end }}
{{ tuple "etc/_api-paste.ini.tpl" . | include "helm-toolkit.utils.template" | indent 4 }}
{{- if .Values.conf.paste.append -}}
{{ .Values.conf.paste.append | indent 4 }}
{{- end }}
{{- end }}
policy.yaml: |+
{{ if .Values.conf.policy.override -}}
{{ .Values.conf.policy.override | indent 4 }}
{{- else -}}
{{ tuple "etc/_policy.yaml.tpl" . | include "helm-toolkit.utils.template" | indent 4 }}
{{- end }}
{{ if .Values.manifests.secret_ssh_key }}
ssh-config: |+
{{- range $option, $val := .Values.conf.ssh.config }}
{{ $option }}={{ $val }}
{{ end }}
{{- end }}
...
{{- end }}