openstack-helm/neutron/templates/configmap-etc.yaml
Pete Birley 74da069530 Neutron: Make config secret conform to k8s schema validation
This PS updates the neutron secret to conform to K8s schema
validation.

Change-Id: Id477510873362224ba919b0c97e09664d5c1b205
Signed-off-by: Pete Birley <pete@port.direct>
2019-06-17 15:52:06 +00:00

211 lines
13 KiB
YAML

{{/*
Copyright 2017 The Openstack-Helm Authors.
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.
*/}}
{{- define "neutron.configmap.etc" }}
{{- $configMapName := index . 0 }}
{{- $envAll := index . 1 }}
{{- with $envAll }}
{{- if empty $envAll.Values.conf.neutron.keystone_authtoken.auth_uri -}}
{{- $_ := tuple "identity" "internal" "api" . | include "helm-toolkit.endpoints.keystone_endpoint_uri_lookup"| set $envAll.Values.conf.neutron.keystone_authtoken "auth_uri" -}}
{{- end }}
{{- if empty $envAll.Values.conf.neutron.keystone_authtoken.auth_url -}}
{{- $_ := tuple "identity" "internal" "api" . | include "helm-toolkit.endpoints.keystone_endpoint_uri_lookup"| set $envAll.Values.conf.neutron.keystone_authtoken "auth_url" -}}
{{- end }}
{{- if empty .Values.conf.neutron.keystone_authtoken.project_name -}}
{{- $_ := set .Values.conf.neutron.keystone_authtoken "project_name" .Values.endpoints.identity.auth.neutron.project_name -}}
{{- end -}}
{{- if empty $envAll.Values.conf.neutron.keystone_authtoken.project_domain_name -}}
{{- $_ := set $envAll.Values.conf.neutron.keystone_authtoken "project_domain_name" $envAll.Values.endpoints.identity.auth.neutron.project_domain_name -}}
{{- end -}}
{{- if empty $envAll.Values.conf.neutron.keystone_authtoken.user_domain_name -}}
{{- $_ := set $envAll.Values.conf.neutron.keystone_authtoken "user_domain_name" $envAll.Values.endpoints.identity.auth.neutron.user_domain_name -}}
{{- end -}}
{{- if empty $envAll.Values.conf.neutron.keystone_authtoken.username -}}
{{- $_ := set $envAll.Values.conf.neutron.keystone_authtoken "username" $envAll.Values.endpoints.identity.auth.neutron.username -}}
{{- end -}}
{{- if empty $envAll.Values.conf.neutron.keystone_authtoken.password -}}
{{- $_ := set $envAll.Values.conf.neutron.keystone_authtoken "password" $envAll.Values.endpoints.identity.auth.neutron.password -}}
{{- end -}}
{{- if empty $envAll.Values.conf.neutron.keystone_authtoken.region_name -}}
{{- $_ := set $envAll.Values.conf.neutron.keystone_authtoken "region_name" $envAll.Values.endpoints.identity.auth.neutron.region_name -}}
{{- end -}}
{{- if empty $envAll.Values.conf.neutron.keystone_authtoken.memcached_servers -}}
{{- $_ := tuple "oslo_cache" "internal" "memcache" . | include "helm-toolkit.endpoints.host_and_port_endpoint_uri_lookup" | set $envAll.Values.conf.neutron.keystone_authtoken "memcached_servers" -}}
{{- end }}
{{- if empty .Values.conf.neutron.keystone_authtoken.memcache_secret_key -}}
{{- $_ := set .Values.conf.neutron.keystone_authtoken "memcache_secret_key" ( default ( randAlphaNum 64 ) .Values.endpoints.oslo_cache.auth.memcache_secret_key ) -}}
{{- end -}}
{{- if empty $envAll.Values.conf.neutron.database.connection -}}
{{- $_ := tuple "oslo_db" "internal" "neutron" "mysql" . | include "helm-toolkit.endpoints.authenticated_endpoint_uri_lookup"| set $envAll.Values.conf.neutron.database "connection" -}}
{{- end }}
{{- if empty $envAll.Values.conf.neutron.DEFAULT.transport_url -}}
{{- $_ := tuple "oslo_messaging" "internal" "neutron" "amqp" . | include "helm-toolkit.endpoints.authenticated_endpoint_uri_lookup" | set $envAll.Values.conf.neutron.DEFAULT "transport_url" -}}
{{- end }}
{{- if empty $envAll.Values.conf.neutron.nova.auth_url -}}
{{- $_ := tuple "identity" "internal" "api" . | include "helm-toolkit.endpoints.keystone_endpoint_uri_lookup"| set $envAll.Values.conf.neutron.nova "auth_url" -}}
{{- end }}
{{- if empty $envAll.Values.conf.neutron.nova.region_name -}}
{{- $_ := set $envAll.Values.conf.neutron.nova "region_name" $envAll.Values.endpoints.identity.auth.nova.region_name -}}
{{- end -}}
{{- if empty $envAll.Values.conf.neutron.nova.project_name -}}
{{- $_ := set $envAll.Values.conf.neutron.nova "project_name" $envAll.Values.endpoints.identity.auth.nova.project_name -}}
{{- end -}}
{{- if empty $envAll.Values.conf.neutron.nova.project_domain_name -}}
{{- $_ := set $envAll.Values.conf.neutron.nova "project_domain_name" $envAll.Values.endpoints.identity.auth.nova.project_domain_name -}}
{{- end -}}
{{- if empty $envAll.Values.conf.neutron.nova.user_domain_name -}}
{{- $_ := set $envAll.Values.conf.neutron.nova "user_domain_name" $envAll.Values.endpoints.identity.auth.nova.user_domain_name -}}
{{- end -}}
{{- if empty $envAll.Values.conf.neutron.nova.username -}}
{{- $_ := set $envAll.Values.conf.neutron.nova "username" $envAll.Values.endpoints.identity.auth.nova.username -}}
{{- end -}}
{{- if empty $envAll.Values.conf.neutron.nova.password -}}
{{- $_ := set $envAll.Values.conf.neutron.nova "password" $envAll.Values.endpoints.identity.auth.nova.password -}}
{{- end -}}
{{/*
nova_metadata_ip can go away when Newton is no longer supported, otherwise
just set it along with nova_metadata_host.
*/}}
{{- if empty $envAll.Values.conf.metadata_agent.DEFAULT.nova_metadata_ip -}}
{{- $_ := tuple "compute_metadata" "public" . | include "helm-toolkit.endpoints.hostname_fqdn_endpoint_lookup" | set $envAll.Values.conf.metadata_agent.DEFAULT "nova_metadata_ip" -}}
{{- end -}}
{{- if empty $envAll.Values.conf.metadata_agent.DEFAULT.nova_metadata_host -}}
{{- $_ := tuple "compute_metadata" "public" . | include "helm-toolkit.endpoints.hostname_fqdn_endpoint_lookup" | set $envAll.Values.conf.metadata_agent.DEFAULT "nova_metadata_host" -}}
{{- end -}}
{{- if empty $envAll.Values.conf.metadata_agent.DEFAULT.nova_metadata_port -}}
{{- $_ := set $envAll.Values.conf.metadata_agent.DEFAULT "nova_metadata_port" 80 -}}
{{- end -}}
{{- if empty $envAll.Values.conf.metadata_agent.cache.memcache_servers -}}
{{- $_ := tuple "oslo_cache" "internal" "memcache" . | include "helm-toolkit.endpoints.host_and_port_endpoint_uri_lookup" | set $envAll.Values.conf.metadata_agent.cache "memcache_servers" -}}
{{- end -}}
{{- if empty $envAll.Values.conf.neutron.DEFAULT.interface_driver -}}
{{- $_ := set $envAll.Values "__interface_driver" ( list ) }}
{{- if ( has "openvswitch" $envAll.Values.network.backend ) -}}
{{ $__interface_driver := append $envAll.Values.__interface_driver "openvswitch" }}
{{- $_ := set $envAll.Values "__interface_driver" $__interface_driver }}
{{- end -}}
{{- if ( has "linuxbridge" $envAll.Values.network.backend ) -}}
{{ $__interface_driver := append $envAll.Values.__interface_driver "linuxbridge" }}
{{- $_ := set $envAll.Values "__interface_driver" $__interface_driver }}
{{- end -}}
{{- $_ := set $envAll.Values.conf.neutron.DEFAULT "interface_driver" $envAll.Values.__interface_driver -}}
{{- end -}}
{{- if empty $envAll.Values.conf.dhcp_agent.DEFAULT.interface_driver -}}
{{- $_ := set $envAll.Values "__interface_driver" ( list ) }}
{{- if ( has "openvswitch" $envAll.Values.network.backend ) -}}
{{ $__interface_driver := append $envAll.Values.__interface_driver "openvswitch" }}
{{- $_ := set $envAll.Values "__interface_driver" $__interface_driver }}
{{- end -}}
{{- if ( has "linuxbridge" $envAll.Values.network.backend ) -}}
{{ $__interface_driver := append $envAll.Values.__interface_driver "linuxbridge" }}
{{- $_ := set $envAll.Values "__interface_driver" $__interface_driver }}
{{- end -}}
{{- $_ := set $envAll.Values.conf.dhcp_agent.DEFAULT "interface_driver" $envAll.Values.__interface_driver -}}
{{- end -}}
{{- if empty $envAll.Values.conf.l3_agent.DEFAULT.interface_driver -}}
{{- $_ := set $envAll.Values "__interface_driver" ( list ) }}
{{- if ( has "openvswitch" $envAll.Values.network.backend ) -}}
{{ $__interface_driver := append $envAll.Values.__interface_driver "openvswitch" }}
{{- $_ := set $envAll.Values "__interface_driver" $__interface_driver }}
{{- end -}}
{{- if ( has "linuxbridge" $envAll.Values.network.backend ) -}}
{{ $__interface_driver := append $envAll.Values.__interface_driver "linuxbridge" }}
{{- $_ := set $envAll.Values "__interface_driver" $__interface_driver }}
{{- end -}}
{{- $_ := set $envAll.Values.conf.l3_agent.DEFAULT "interface_driver" $envAll.Values.__interface_driver -}}
{{- end -}}
{{- if empty $envAll.Values.conf.plugins.ml2_conf.ml2.mechanism_drivers -}}
{{- $_ := set $envAll.Values "__mechanism_drivers" ( list "l2population" ) }}
{{- if ( has "openvswitch" $envAll.Values.network.backend ) -}}
{{ $__mechanism_drivers := append $envAll.Values.__mechanism_drivers "openvswitch" }}
{{- $_ := set $envAll.Values "__mechanism_drivers" $__mechanism_drivers }}
{{- end -}}
{{- if ( has "linuxbridge" $envAll.Values.network.backend ) -}}
{{ $__mechanism_drivers := append $envAll.Values.__mechanism_drivers "linuxbridge" }}
{{- $_ := set $envAll.Values "__mechanism_drivers" $__mechanism_drivers }}
{{- end -}}
{{- $_ := set $envAll.Values.conf.plugins.ml2_conf.ml2 "mechanism_drivers" $envAll.Values.__mechanism_drivers -}}
{{- end -}}
{{- if empty .Values.conf.neutron.DEFAULT.bind_port -}}
{{- $_ := tuple "network" "internal" "api" . | include "helm-toolkit.endpoints.endpoint_port_lookup" | set .Values.conf.neutron.DEFAULT "bind_port" -}}
{{- end -}}
{{- if and (empty .Values.conf.logging.handler_fluent) (has "fluent" .Values.conf.logging.handlers.keys) -}}
{{- $fluentd_host := tuple "fluentd" "internal" $envAll | include "helm-toolkit.endpoints.hostname_namespaced_endpoint_lookup" }}
{{- $fluentd_port := tuple "fluentd" "internal" "service" $envAll | include "helm-toolkit.endpoints.endpoint_port_lookup" }}
{{- $fluent_args := printf "('%s.%s', '%s', %s)" .Release.Namespace .Release.Name $fluentd_host $fluentd_port }}
{{- $handler_fluent := dict "class" "fluent.handler.FluentHandler" "formatter" "fluent" "args" $fluent_args -}}
{{- $_ := set .Values.conf.logging "handler_fluent" $handler_fluent -}}
{{- end -}}
{{- if and (empty .Values.conf.logging.formatter_fluent) (has "fluent" .Values.conf.logging.formatters.keys) -}}
{{- $formatter_fluent := dict "class" "oslo_log.formatters.FluentFormatter" -}}
{{- $_ := set .Values.conf.logging "formatter_fluent" $formatter_fluent -}}
{{- end -}}
---
apiVersion: v1
kind: Secret
metadata:
name: {{ $configMapName }}
type: Opaque
data:
rally_tests.yaml: {{ toYaml $envAll.Values.conf.rally_tests.tests | b64enc }}
api-paste.ini: {{ include "helm-toolkit.utils.to_ini" $envAll.Values.conf.paste | b64enc }}
policy.json: {{ toJson $envAll.Values.conf.policy | b64enc }}
neutron.conf: {{ include "helm-toolkit.utils.to_oslo_conf" $envAll.Values.conf.neutron | b64enc }}
logging.conf: {{ include "helm-toolkit.utils.to_oslo_conf" .Values.conf.logging | b64enc }}
api_audit_map.conf: {{ include "helm-toolkit.utils.to_oslo_conf" .Values.conf.api_audit_map | b64enc }}
dhcp_agent.ini: {{ include "helm-toolkit.utils.to_oslo_conf" $envAll.Values.conf.dhcp_agent | b64enc }}
l3_agent.ini: {{ include "helm-toolkit.utils.to_oslo_conf" $envAll.Values.conf.l3_agent | b64enc }}
metadata_agent.ini: {{ include "helm-toolkit.utils.to_oslo_conf" $envAll.Values.conf.metadata_agent | b64enc }}
metering_agent.ini: {{ default ( include "helm-toolkit.utils.to_oslo_conf" $envAll.Values.conf.metering_agent | b64enc ) "\"\"" }}
taas_plugin.ini: {{ default ( include "helm-toolkit.utils.to_oslo_conf" $envAll.Values.conf.taas_plugin | b64enc ) "\"\"" }}
ml2_conf.ini: {{ include "helm-toolkit.utils.to_oslo_conf" $envAll.Values.conf.plugins.ml2_conf | b64enc }}
ml2_conf_sriov.ini: {{ default ( include "helm-toolkit.utils.to_oslo_conf" $envAll.Values.conf.plugins.ml2_conf_sriov | b64enc ) "\"\"" }}
taas.ini: {{ include "helm-toolkit.utils.to_oslo_conf" $envAll.Values.conf.plugins.taas | b64enc }}
macvtap_agent.ini: {{ default ( include "helm-toolkit.utils.to_oslo_conf" $envAll.Values.conf.plugins.macvtap_agent | b64enc ) "\"\"" }}
linuxbridge_agent.ini: {{ include "helm-toolkit.utils.to_oslo_conf" $envAll.Values.conf.plugins.linuxbridge_agent | b64enc }}
openvswitch_agent.ini: {{ include "helm-toolkit.utils.to_oslo_conf" $envAll.Values.conf.plugins.openvswitch_agent | b64enc }}
sriov_agent.ini: {{ include "helm-toolkit.utils.to_oslo_conf" $envAll.Values.conf.plugins.sriov_agent | b64enc }}
dnsmasq.conf: ""
neutron_sudoers: {{ $envAll.Values.conf.neutron_sudoers | b64enc }}
rootwrap.conf: {{ $envAll.Values.conf.rootwrap | b64enc }}
auto_bridge_add: {{ toJson $envAll.Values.conf.auto_bridge_add | b64enc }}
{{- range $key, $value := $envAll.Values.conf.rootwrap_filters }}
{{- $filePrefix := replace "_" "-" $key }}
{{ printf "%s.filters" $filePrefix }}: {{ $value.content | b64enc }}
{{- end }}
{{- end }}
{{- end }}
{{- if .Values.manifests.configmap_etc }}
{{- list "neutron-etc" . | include "neutron.configmap.etc" }}
{{- end }}