blob: b8005a58a22479b54e1f4e732461f6ec3ba63355 [file] [log] [blame]
Mohammed Naserf3f59a72023-01-15 21:02:04 -05001{{/*
2Copyright 2019 Samsung Electronics Co., Ltd.
3
4Licensed under the Apache License, Version 2.0 (the "License");
5you may not use this file except in compliance with the License.
6You may obtain a copy of the License at
7
8 http://www.apache.org/licenses/LICENSE-2.0
9
10Unless required by applicable law or agreed to in writing, software
11distributed under the License is distributed on an "AS IS" BASIS,
12WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13See the License for the specific language governing permissions and
14limitations under the License.
15*/}}
16
17{{- define "octavia.configmap.etc" }}
18{{- $configMapName := index . 0 }}
19{{- $envAll := index . 1 }}
20{{- with $envAll }}
21
22{{- if empty .Values.conf.octavia.keystone_authtoken.auth_uri -}}
23{{- $_ := tuple "identity" "internal" "api" . | include "helm-toolkit.endpoints.keystone_endpoint_uri_lookup"| set .Values.conf.octavia.keystone_authtoken "auth_uri" -}}
24{{- end -}}
25
26{{- if empty .Values.conf.octavia.keystone_authtoken.auth_url -}}
27{{- $_ := tuple "identity" "internal" "api" . | include "helm-toolkit.endpoints.keystone_endpoint_uri_lookup"| set .Values.conf.octavia.keystone_authtoken "auth_url" -}}
28{{- end -}}
29
30{{- if empty .Values.conf.octavia.keystone_authtoken.region_name -}}
31{{- $_ := set .Values.conf.octavia.keystone_authtoken "region_name" .Values.endpoints.identity.auth.octavia.region_name -}}
32{{- end -}}
33{{- if empty .Values.conf.octavia.keystone_authtoken.project_name -}}
34{{- $_ := set .Values.conf.octavia.keystone_authtoken "project_name" .Values.endpoints.identity.auth.octavia.project_name -}}
35{{- end -}}
36{{- if empty .Values.conf.octavia.keystone_authtoken.project_domain_name -}}
37{{- $_ := set .Values.conf.octavia.keystone_authtoken "project_domain_name" .Values.endpoints.identity.auth.octavia.project_domain_name -}}
38{{- end -}}
39{{- if empty .Values.conf.octavia.keystone_authtoken.user_domain_name -}}
40{{- $_ := set .Values.conf.octavia.keystone_authtoken "user_domain_name" .Values.endpoints.identity.auth.octavia.user_domain_name -}}
41{{- end -}}
42{{- if empty .Values.conf.octavia.keystone_authtoken.username -}}
43{{- $_ := set .Values.conf.octavia.keystone_authtoken "username" .Values.endpoints.identity.auth.octavia.username -}}
44{{- end -}}
45{{- if empty .Values.conf.octavia.keystone_authtoken.password -}}
46{{- $_ := set .Values.conf.octavia.keystone_authtoken "password" .Values.endpoints.identity.auth.octavia.password -}}
47{{- end -}}
48
49{{- if empty .Values.conf.octavia.keystone_authtoken.memcached_servers -}}
50{{- $_ := tuple "oslo_cache" "internal" "memcache" . | include "helm-toolkit.endpoints.host_and_port_endpoint_uri_lookup" | set .Values.conf.octavia.keystone_authtoken "memcached_servers" -}}
51{{- end -}}
52{{- if empty .Values.conf.octavia.keystone_authtoken.memcache_secret_key -}}
53{{- $_ := set .Values.conf.octavia.keystone_authtoken "memcache_secret_key" ( default ( randAlphaNum 64 ) .Values.endpoints.oslo_cache.auth.memcache_secret_key ) -}}
54{{- end -}}
55
56{{- if empty .Values.conf.octavia.service_auth.auth_url -}}
57{{- $_ := tuple "identity" "internal" "api" . | include "helm-toolkit.endpoints.keystone_endpoint_uri_lookup"| set .Values.conf.octavia.service_auth "auth_url" -}}
58{{- end -}}
59
60{{- if empty .Values.conf.octavia.service_auth.project_name -}}
61{{- $_ := set .Values.conf.octavia.service_auth "project_name" .Values.endpoints.identity.auth.admin.project_name -}}
62{{- end -}}
63{{- if empty .Values.conf.octavia.service_auth.project_domain_name -}}
64{{- $_ := set .Values.conf.octavia.service_auth "project_domain_name" .Values.endpoints.identity.auth.admin.project_domain_name -}}
65{{- end -}}
66{{- if empty .Values.conf.octavia.service_auth.user_domain_name -}}
67{{- $_ := set .Values.conf.octavia.service_auth "user_domain_name" .Values.endpoints.identity.auth.admin.user_domain_name -}}
68{{- end -}}
69{{- if empty .Values.conf.octavia.service_auth.username -}}
70{{- $_ := set .Values.conf.octavia.service_auth "username" .Values.endpoints.identity.auth.admin.username -}}
71{{- end -}}
72{{- if empty .Values.conf.octavia.service_auth.password -}}
73{{- $_ := set .Values.conf.octavia.service_auth "password" .Values.endpoints.identity.auth.admin.password -}}
74{{- end -}}
75
76{{- if empty .Values.conf.octavia.service_auth.memcached_servers -}}
77{{- $_ := tuple "oslo_cache" "internal" "memcache" . | include "helm-toolkit.endpoints.host_and_port_endpoint_uri_lookup" | set .Values.conf.octavia.service_auth "memcached_servers" -}}
78{{- end -}}
79{{- if empty .Values.conf.octavia.service_auth.memcache_secret_key -}}
80{{- $_ := set .Values.conf.octavia.service_auth "memcache_secret_key" ( default ( randAlphaNum 64 ) .Values.endpoints.oslo_cache.auth.memcache_secret_key ) -}}
81{{- end -}}
82
83{{- if empty .Values.conf.octavia.database.connection -}}
84{{- $_ := tuple "oslo_db" "internal" "octavia" "mysql" . | include "helm-toolkit.endpoints.authenticated_endpoint_uri_lookup"| set .Values.conf.octavia.database "connection" -}}
85{{- end -}}
86
87{{- if empty .Values.conf.octavia.DEFAULT.transport_url -}}
88{{- $_ := tuple "oslo_messaging" "internal" "octavia" "amqp" . | include "helm-toolkit.endpoints.authenticated_transport_endpoint_uri_lookup" | set .Values.conf.octavia.DEFAULT "transport_url" -}}
89{{- end -}}
90
Oleksandr Kozachenko573b0e52023-10-04 17:38:01 +020091{{- if empty (index .Values.conf.octavia_api_uwsgi.uwsgi "http-socket") -}}
92{{- $http_socket_port := tuple "load_balancer" "service" "api" . | include "helm-toolkit.endpoints.endpoint_port_lookup" | toString }}
93{{- $http_socket := printf "0.0.0.0:%s" $http_socket_port }}
94{{- $_ := set .Values.conf.octavia_api_uwsgi.uwsgi "http-socket" $http_socket -}}
95{{- end -}}
96
Mohammed Naserf3f59a72023-01-15 21:02:04 -050097{{- if and (empty .Values.conf.logging.handler_fluent) (has "fluent" .Values.conf.logging.handlers.keys) -}}
98{{- $fluentd_host := tuple "fluentd" "internal" $envAll | include "helm-toolkit.endpoints.hostname_namespaced_endpoint_lookup" }}
99{{- $fluentd_port := tuple "fluentd" "internal" "service" $envAll | include "helm-toolkit.endpoints.endpoint_port_lookup" }}
100{{- $fluent_args := printf "('%s.%s', '%s', %s)" .Release.Namespace .Release.Name $fluentd_host $fluentd_port }}
101{{- $handler_fluent := dict "class" "fluent.handler.FluentHandler" "formatter" "fluent" "args" $fluent_args -}}
102{{- $_ := set .Values.conf.logging "handler_fluent" $handler_fluent -}}
103{{- end -}}
104
105{{- if and (empty .Values.conf.logging.formatter_fluent) (has "fluent" .Values.conf.logging.formatters.keys) -}}
106{{- $formatter_fluent := dict "class" "oslo_log.formatters.FluentFormatter" -}}
107{{- $_ := set .Values.conf.logging "formatter_fluent" $formatter_fluent -}}
108{{- end -}}
109---
110apiVersion: v1
111kind: Secret
112metadata:
113 name: {{ $configMapName }}
114type: Opaque
115data:
116 octavia.conf: {{ include "helm-toolkit.utils.to_oslo_conf" .Values.conf.octavia | b64enc }}
Oleksandr Kozachenko573b0e52023-10-04 17:38:01 +0200117 octavia-api-uwsgi.ini: {{ include "helm-toolkit.utils.to_oslo_conf" .Values.conf.octavia_api_uwsgi | b64enc }}
Mohammed Naserf3f59a72023-01-15 21:02:04 -0500118 logging.conf: {{ include "helm-toolkit.utils.to_oslo_conf" .Values.conf.logging | b64enc }}
119{{- end }}
120{{- end }}
121
122{{- if .Values.manifests.configmap_etc }}
123{{- list "octavia-etc" . | include "octavia.configmap.etc" }}
124{{- end }}