blob: fba29565b5504c039688d9b7a2f69810fe97eb74 [file] [log] [blame]
Mohammed Naserf3f59a72023-01-15 21:02:04 -05001{{/*
2Licensed under the Apache License, Version 2.0 (the "License");
3you may not use this file except in compliance with the License.
4You may obtain a copy of the License at
5
6 http://www.apache.org/licenses/LICENSE-2.0
7
8Unless required by applicable law or agreed to in writing, software
9distributed under the License is distributed on an "AS IS" BASIS,
10WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11See the License for the specific language governing permissions and
12limitations under the License.
13*/}}
14
15{{- if .Values.manifests.configmap_etc }}
16{{- $envAll := . }}
17
18{{- if empty .Values.conf.barbican.keystone_authtoken.auth_uri -}}
19{{- $_ := tuple "identity" "internal" "api" . | include "helm-toolkit.endpoints.keystone_endpoint_uri_lookup"| set .Values.conf.barbican.keystone_authtoken "auth_uri" -}}
20{{- end -}}
21
22{{- if empty .Values.conf.barbican.keystone_authtoken.auth_url -}}
23{{- $_ := tuple "identity" "internal" "api" . | include "helm-toolkit.endpoints.keystone_endpoint_uri_lookup"| set .Values.conf.barbican.keystone_authtoken "auth_url" -}}
24{{- end -}}
25
26{{- if empty .Values.conf.barbican.keystone_authtoken.region_name -}}
27{{- $_ := set .Values.conf.barbican.keystone_authtoken "region_name" .Values.endpoints.identity.auth.barbican.region_name -}}
28{{- end -}}
29{{- if empty .Values.conf.barbican.keystone_authtoken.project_name -}}
30{{- $_ := set .Values.conf.barbican.keystone_authtoken "project_name" .Values.endpoints.identity.auth.barbican.project_name -}}
31{{- end -}}
32{{- if empty .Values.conf.barbican.keystone_authtoken.project_domain_name -}}
33{{- $_ := set .Values.conf.barbican.keystone_authtoken "project_domain_name" .Values.endpoints.identity.auth.barbican.project_domain_name -}}
34{{- end -}}
35{{- if empty .Values.conf.barbican.keystone_authtoken.user_domain_name -}}
36{{- $_ := set .Values.conf.barbican.keystone_authtoken "user_domain_name" .Values.endpoints.identity.auth.barbican.user_domain_name -}}
37{{- end -}}
38{{- if empty .Values.conf.barbican.keystone_authtoken.username -}}
39{{- $_ := set .Values.conf.barbican.keystone_authtoken "username" .Values.endpoints.identity.auth.barbican.username -}}
40{{- end -}}
41{{- if empty .Values.conf.barbican.keystone_authtoken.password -}}
42{{- $_ := set .Values.conf.barbican.keystone_authtoken "password" .Values.endpoints.identity.auth.barbican.password -}}
43{{- end -}}
44
45{{- if empty .Values.conf.barbican.keystone_authtoken.memcached_servers -}}
46{{- $_ := tuple "oslo_cache" "internal" "memcache" . | include "helm-toolkit.endpoints.host_and_port_endpoint_uri_lookup" | set .Values.conf.barbican.keystone_authtoken "memcached_servers" -}}
47{{- end -}}
48{{- if empty .Values.conf.barbican.keystone_authtoken.memcache_secret_key -}}
49{{- $_ := set .Values.conf.barbican.keystone_authtoken "memcache_secret_key" ( default ( randAlphaNum 64 ) .Values.endpoints.oslo_cache.auth.memcache_secret_key ) -}}
50{{- end -}}
51
Rico Lin50f71472025-01-10 06:34:30 +080052{{- if empty .Values.conf.barbican.database.connection -}}
Mohammed Naserf3f59a72023-01-15 21:02:04 -050053{{- $connection := tuple "oslo_db" "internal" "barbican" "mysql" . | include "helm-toolkit.endpoints.authenticated_endpoint_uri_lookup" -}}
54{{- if .Values.manifests.certificates -}}
Rico Lin50f71472025-01-10 06:34:30 +080055{{- $_ := (printf "%s?charset=utf8&ssl_ca=/etc/mysql/certs/ca.crt&ssl_key=/etc/mysql/certs/tls.key&ssl_cert=/etc/mysql/certs/tls.crt&ssl_verify_cert" $connection ) | set .Values.conf.barbican.database "connection" -}}
Mohammed Naserf3f59a72023-01-15 21:02:04 -050056{{- else -}}
Rico Lin50f71472025-01-10 06:34:30 +080057{{- $_ := set .Values.conf.barbican.database "connection" $connection -}}
Mohammed Naserf3f59a72023-01-15 21:02:04 -050058{{- end -}}
59{{- end -}}
60
61{{- if empty .Values.conf.barbican.DEFAULT.transport_url -}}
62{{- $_ := tuple "oslo_messaging" "internal" "barbican" "amqp" . | include "helm-toolkit.endpoints.authenticated_transport_endpoint_uri_lookup" | set .Values.conf.barbican.DEFAULT "transport_url" -}}
63{{- end -}}
64
65{{- $barbicanPath := index .Values "endpoints" "key_manager" "path" "default" }}
66{{- if empty .Values.conf.barbican.DEFAULT.host_href -}}
67{{- $_ := tuple "key_manager" "public" "api" . | include "helm-toolkit.endpoints.keystone_endpoint_uri_lookup" | trimSuffix $barbicanPath | set .Values.conf.barbican.DEFAULT "host_href" -}}
68{{- end -}}
69
Rico Lin36e65de2024-04-22 00:08:06 +080070{{- if empty (index .Values.conf.barbican_api_uwsgi.uwsgi "http-socket") -}}
71{{- $http_socket_port := tuple "key_manager" "service" "api" . | include "helm-toolkit.endpoints.endpoint_port_lookup" | toString }}
72{{- $http_socket := printf "0.0.0.0:%s" $http_socket_port }}
73{{- $_ := set .Values.conf.barbican_api_uwsgi.uwsgi "http-socket" $http_socket -}}
Mohammed Naserf3f59a72023-01-15 21:02:04 -050074{{- end -}}
75
76{{- if and (empty .Values.conf.logging.handler_fluent) (has "fluent" .Values.conf.logging.handlers.keys) -}}
77{{- $fluentd_host := tuple "fluentd" "internal" $envAll | include "helm-toolkit.endpoints.hostname_namespaced_endpoint_lookup" }}
78{{- $fluentd_port := tuple "fluentd" "internal" "service" $envAll | include "helm-toolkit.endpoints.endpoint_port_lookup" }}
79{{- $fluent_args := printf "('%s.%s', '%s', %s)" .Release.Namespace .Release.Name $fluentd_host $fluentd_port }}
80{{- $handler_fluent := dict "class" "fluent.handler.FluentHandler" "formatter" "fluent" "args" $fluent_args -}}
81{{- $_ := set .Values.conf.logging "handler_fluent" $handler_fluent -}}
82{{- end -}}
83
84{{- if and (empty .Values.conf.logging.formatter_fluent) (has "fluent" .Values.conf.logging.formatters.keys) -}}
85{{- $formatter_fluent := dict "class" "oslo_log.formatters.FluentFormatter" -}}
86{{- $_ := set .Values.conf.logging "formatter_fluent" $formatter_fluent -}}
87{{- end -}}
88---
89apiVersion: v1
90kind: Secret
91metadata:
92 name: barbican-etc
93type: Opaque
94data:
95 barbican.conf: {{ include "helm-toolkit.utils.to_oslo_conf" .Values.conf.barbican | b64enc }}
96 logging.conf: {{ include "helm-toolkit.utils.to_oslo_conf" .Values.conf.logging | b64enc }}
97 barbican-api-paste.ini: {{ include "helm-toolkit.utils.to_ini" .Values.conf.paste | b64enc }}
Mohammed Naserf3f59a72023-01-15 21:02:04 -050098 api_audit_map.conf: {{ include "helm-toolkit.utils.to_ini" .Values.conf.audit_map | b64enc }}
99 policy.yaml: {{ toYaml .Values.conf.policy | b64enc }}
Rico Lin36e65de2024-04-22 00:08:06 +0800100 barbican-api-uwsgi.ini: {{ include "helm-toolkit.utils.to_ini" .Values.conf.barbican_api_uwsgi | b64enc }}
Mohammed Naserf3f59a72023-01-15 21:02:04 -0500101 old_kek: {{ index .Values.conf.simple_crypto_kek_rewrap "old_kek" | default "" | b64enc | quote }}
102{{- end }}