Mohammed Naser | f3f59a7 | 2023-01-15 21:02:04 -0500 | [diff] [blame] | 1 | {{/* |
| 2 | Licensed under the Apache License, Version 2.0 (the "License"); |
| 3 | you may not use this file except in compliance with the License. |
| 4 | You may obtain a copy of the License at |
| 5 | |
| 6 | http://www.apache.org/licenses/LICENSE-2.0 |
| 7 | |
| 8 | Unless required by applicable law or agreed to in writing, software |
| 9 | distributed under the License is distributed on an "AS IS" BASIS, |
| 10 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 11 | See the License for the specific language governing permissions and |
| 12 | limitations under the License. |
| 13 | */}} |
| 14 | |
| 15 | {{- if (.Values.global).subchart_release_name }} |
| 16 | {{- $_ := set . "deployment_name" .Chart.Name }} |
| 17 | {{- else }} |
| 18 | {{- $_ := set . "deployment_name" .Release.Name }} |
| 19 | {{- end }} |
| 20 | |
| 21 | {{- if .Values.manifests.configmap_etc }} |
| 22 | {{- $envAll := . }} |
| 23 | |
| 24 | {{- if empty .Values.conf.glance.keystone_authtoken.auth_uri -}} |
| 25 | {{- $_ := tuple "identity" "internal" "api" . | include "helm-toolkit.endpoints.keystone_endpoint_uri_lookup"| set .Values.conf.glance.keystone_authtoken "auth_uri" -}} |
| 26 | {{- end -}} |
| 27 | |
| 28 | {{- if empty .Values.conf.glance.keystone_authtoken.auth_url -}} |
| 29 | {{- $_ := tuple "identity" "internal" "api" . | include "helm-toolkit.endpoints.keystone_endpoint_uri_lookup"| set .Values.conf.glance.keystone_authtoken "auth_url" -}} |
| 30 | {{- end -}} |
| 31 | |
| 32 | {{- if empty .Values.conf.glance.keystone_authtoken.region_name -}} |
| 33 | {{- $_ := set .Values.conf.glance.keystone_authtoken "region_name" .Values.endpoints.identity.auth.glance.region_name -}} |
| 34 | {{- end -}} |
| 35 | {{- if empty .Values.conf.glance.keystone_authtoken.project_name -}} |
| 36 | {{- $_ := set .Values.conf.glance.keystone_authtoken "project_name" .Values.endpoints.identity.auth.glance.project_name -}} |
| 37 | {{- end -}} |
| 38 | {{- if empty .Values.conf.glance.keystone_authtoken.project_domain_name -}} |
| 39 | {{- $_ := set .Values.conf.glance.keystone_authtoken "project_domain_name" .Values.endpoints.identity.auth.glance.project_domain_name -}} |
| 40 | {{- end -}} |
| 41 | {{- if empty .Values.conf.glance.keystone_authtoken.user_domain_name -}} |
| 42 | {{- $_ := set .Values.conf.glance.keystone_authtoken "user_domain_name" .Values.endpoints.identity.auth.glance.user_domain_name -}} |
| 43 | {{- end -}} |
| 44 | {{- if empty .Values.conf.glance.keystone_authtoken.username -}} |
| 45 | {{- $_ := set .Values.conf.glance.keystone_authtoken "username" .Values.endpoints.identity.auth.glance.username -}} |
| 46 | {{- end -}} |
| 47 | {{- if empty .Values.conf.glance.keystone_authtoken.password -}} |
| 48 | {{- $_ := set .Values.conf.glance.keystone_authtoken "password" .Values.endpoints.identity.auth.glance.password -}} |
| 49 | {{- end -}} |
| 50 | |
| 51 | {{- if empty .Values.conf.glance.keystone_authtoken.memcached_servers -}} |
| 52 | {{- $_ := tuple "oslo_cache" "internal" "memcache" . | include "helm-toolkit.endpoints.host_and_port_endpoint_uri_lookup" | set .Values.conf.glance.keystone_authtoken "memcached_servers" -}} |
| 53 | {{- end -}} |
| 54 | {{- if empty .Values.conf.glance.keystone_authtoken.memcache_secret_key -}} |
| 55 | {{- $_ := set .Values.conf.glance.keystone_authtoken "memcache_secret_key" ( default ( randAlphaNum 64 ) .Values.endpoints.oslo_cache.auth.memcache_secret_key ) -}} |
| 56 | {{- end -}} |
| 57 | |
| 58 | {{- if empty .Values.conf.glance.database.connection -}} |
| 59 | {{- $connection := tuple "oslo_db" "internal" "glance" "mysql" . | include "helm-toolkit.endpoints.authenticated_endpoint_uri_lookup" -}} |
| 60 | {{- if .Values.manifests.certificates -}} |
| 61 | {{- $_ := (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.glance.database "connection" -}} |
| 62 | {{- else -}} |
| 63 | {{- $_ := set .Values.conf.glance.database "connection" $connection -}} |
| 64 | {{- end -}} |
| 65 | {{- end -}} |
| 66 | |
| 67 | {{- if empty .Values.conf.glance.DEFAULT.transport_url -}} |
| 68 | {{- $_ := tuple "oslo_messaging" "internal" "glance" "amqp" . | include "helm-toolkit.endpoints.authenticated_transport_endpoint_uri_lookup" | set .Values.conf.glance.DEFAULT "transport_url" -}} |
| 69 | {{- end -}} |
| 70 | |
| 71 | {{- if empty .Values.conf.glance.DEFAULT.public_endpoint -}} |
| 72 | {{- $_ := tuple "image" "public" "api" . | include "helm-toolkit.endpoints.keystone_endpoint_uri_lookup" | set .Values.conf.glance.DEFAULT "public_endpoint" -}} |
| 73 | {{- end -}} |
| 74 | |
| 75 | {{- if empty .Values.conf.glance.glance_store.stores -}} |
| 76 | {{- if eq .Values.storage "rbd" }} |
| 77 | {{- $_ := "file, http, rbd" | set .Values.conf.glance.glance_store "stores" -}} |
| 78 | {{- end -}} |
| 79 | {{- if eq .Values.storage "pvc" }} |
| 80 | {{- $_ := "file, http" | set .Values.conf.glance.glance_store "stores" -}} |
| 81 | {{- end -}} |
| 82 | {{ if or (eq .Values.storage "radosgw") (eq .Values.storage "swift") }} |
| 83 | {{- $_ := "file, http, swift" | set .Values.conf.glance.glance_store "stores" -}} |
| 84 | {{- end -}} |
| 85 | {{- end -}} |
| 86 | |
| 87 | {{- if empty .Values.conf.glance.glance_store.default_store -}} |
| 88 | {{- if eq .Values.storage "rbd" }} |
| 89 | {{- $_ := "rbd" | set .Values.conf.glance.glance_store "default_store" -}} |
| 90 | {{- end -}} |
| 91 | {{- if eq .Values.storage "pvc" }} |
| 92 | {{- $_ := "file" | set .Values.conf.glance.glance_store "default_store" -}} |
| 93 | {{- end -}} |
| 94 | {{ if or (eq .Values.storage "radosgw") (eq .Values.storage "swift") }} |
| 95 | {{- $_ := "swift" | set .Values.conf.glance.glance_store "default_store" -}} |
| 96 | {{- end -}} |
| 97 | {{- end -}} |
| 98 | |
| 99 | {{- if empty .Values.conf.glance.DEFAULT.bind_port -}} |
| 100 | {{- $_ := tuple "image" "service" "api" . | include "helm-toolkit.endpoints.endpoint_port_lookup" | set .Values.conf.glance.DEFAULT "bind_port" -}} |
| 101 | {{- end -}} |
| 102 | |
Oleksandr Kozachenko | 469612f | 2023-10-04 17:34:40 +0200 | [diff] [blame] | 103 | {{- if empty .Values.conf.glance_api_uwsgi.uwsgi.processes -}} |
| 104 | {{- $_ := set .Values.conf.glance_api_uwsgi.uwsgi "processes" .Values.conf.glance.DEFAULT.workers -}} |
| 105 | {{- end -}} |
| 106 | {{- if empty (index .Values.conf.glance_api_uwsgi.uwsgi "http-socket") -}} |
| 107 | {{- $http_socket_port := tuple "image" "service" "api" . | include "helm-toolkit.endpoints.endpoint_port_lookup" | toString }} |
| 108 | {{- $http_socket := printf "0.0.0.0:%s" $http_socket_port }} |
| 109 | {{- $_ := set .Values.conf.glance_api_uwsgi.uwsgi "http-socket" $http_socket -}} |
| 110 | {{- end -}} |
| 111 | |
Mohammed Naser | f3f59a7 | 2023-01-15 21:02:04 -0500 | [diff] [blame] | 112 | {{- if and (empty .Values.conf.logging.handler_fluent) (has "fluent" .Values.conf.logging.handlers.keys) -}} |
| 113 | {{- $fluentd_host := tuple "fluentd" "internal" $envAll | include "helm-toolkit.endpoints.hostname_namespaced_endpoint_lookup" }} |
| 114 | {{- $fluentd_port := tuple "fluentd" "internal" "service" $envAll | include "helm-toolkit.endpoints.endpoint_port_lookup" }} |
| 115 | {{- $fluent_args := printf "('%s.%s', '%s', %s)" .Release.Namespace .deployment_name $fluentd_host $fluentd_port }} |
| 116 | {{- $handler_fluent := dict "class" "fluent.handler.FluentHandler" "formatter" "fluent" "args" $fluent_args -}} |
| 117 | {{- $_ := set .Values.conf.logging "handler_fluent" $handler_fluent -}} |
| 118 | {{- end -}} |
| 119 | |
| 120 | {{- if and (empty .Values.conf.logging.formatter_fluent) (has "fluent" .Values.conf.logging.formatters.keys) -}} |
| 121 | {{- $formatter_fluent := dict "class" "oslo_log.formatters.FluentFormatter" -}} |
| 122 | {{- $_ := set .Values.conf.logging "formatter_fluent" $formatter_fluent -}} |
| 123 | {{- end -}} |
| 124 | |
| 125 | {{- if empty .Values.conf.glance.cors.allowed_origin -}} |
| 126 | {{- $endpointScheme := tuple "dashboard" "public" "web" . | include "helm-toolkit.endpoints.keystone_endpoint_scheme_lookup" }} |
| 127 | {{- $endpointHost := tuple "dashboard" "public" . | include "helm-toolkit.endpoints.endpoint_host_lookup" }} |
| 128 | {{- $endpointPort := tuple "dashboard" "public" "web" . | include "helm-toolkit.endpoints.endpoint_port_lookup" }} |
| 129 | {{- if eq $endpointPort "80" "443" -}} |
| 130 | {{/* |
| 131 | Common browsers don't add default ports like 80 and 443 to the headers |
| 132 | and URLs therefore CORS should allow to use URLs both with 80,443 and |
| 133 | without it in the URL. |
| 134 | */}} |
| 135 | {{- $_ := set $envAll.Values.conf.glance.cors "allowed_origin" ( list ) }} |
| 136 | {{- $__allowed_origin := append $envAll.Values.conf.glance.cors.allowed_origin (printf "%s://%s" $endpointScheme $endpointHost) }} |
| 137 | {{- $_ := set $envAll.Values.conf.glance.cors "allowed_origin" $__allowed_origin }} |
| 138 | {{- $__allowed_origin := append $envAll.Values.conf.glance.cors.allowed_origin (printf "%s://%s:%s" $endpointScheme $endpointHost $endpointPort) }} |
| 139 | {{- $_ := set $envAll.Values.conf.glance.cors "allowed_origin" $__allowed_origin }} |
| 140 | {{- else }} |
| 141 | {{- printf "%s://%s:%s" $endpointScheme $endpointHost $endpointPort | set .Values.conf.glance.cors "allowed_origin" }} |
| 142 | {{- end }} |
| 143 | {{- end -}} |
| 144 | --- |
| 145 | apiVersion: v1 |
| 146 | kind: Secret |
| 147 | metadata: |
| 148 | name: glance-etc |
| 149 | type: Opaque |
| 150 | data: |
| 151 | rally_tests.yaml: {{ toYaml .Values.conf.rally_tests.tests | b64enc }} |
| 152 | glance-api.conf: {{ include "helm-toolkit.utils.to_oslo_conf" .Values.conf.glance | b64enc }} |
Oleksandr Kozachenko | 469612f | 2023-10-04 17:34:40 +0200 | [diff] [blame] | 153 | glance-api-uwsgi.ini: {{ include "helm-toolkit.utils.to_oslo_conf" .Values.conf.glance_api_uwsgi | b64enc }} |
Mohammed Naser | f3f59a7 | 2023-01-15 21:02:04 -0500 | [diff] [blame] | 154 | logging.conf: {{ include "helm-toolkit.utils.to_oslo_conf" .Values.conf.logging | b64enc }} |
| 155 | glance-api-paste.ini: {{ include "helm-toolkit.utils.to_ini" .Values.conf.paste | b64enc }} |
Mohammed Naser | f3f59a7 | 2023-01-15 21:02:04 -0500 | [diff] [blame] | 156 | policy.yaml: {{ toYaml .Values.conf.policy | b64enc }} |
| 157 | api_audit_map.conf: {{ include "helm-toolkit.utils.to_oslo_conf" .Values.conf.api_audit_map | b64enc }} |
| 158 | glance_sudoers: {{ $envAll.Values.conf.glance_sudoers | b64enc }} |
| 159 | rootwrap.conf: {{ $envAll.Values.conf.rootwrap | b64enc }} |
| 160 | {{- range $key, $value := $envAll.Values.conf.rootwrap_filters }} |
| 161 | {{- $filePrefix := replace "_" "-" $key }} |
| 162 | {{ printf "%s.filters" $filePrefix }}: {{ $value.content | b64enc }} |
| 163 | {{- end }} |
| 164 | {{- include "helm-toolkit.snippets.values_template_renderer" ( dict "envAll" $envAll "template" .Values.conf.swift_store "key" "swift-store.conf" "format" "Secret" ) | indent 2 }} |
| 165 | {{- include "helm-toolkit.snippets.values_template_renderer" ( dict "envAll" $envAll "template" .Values.conf.nginx "key" "nginx.conf" "format" "Secret" ) | indent 2 }} |
| 166 | {{- end }} |