openstack-helm/neutron/templates/configmap-etc.yaml

210 lines
12 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" | quote | trunc 0 -}}
{{- 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" | quote | trunc 0 -}}
{{- 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 | quote | trunc 0 -}}
{{- 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 | quote | trunc 0 -}}
{{- 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 | quote | trunc 0 -}}
{{- 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 | quote | trunc 0 -}}
{{- 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 | quote | trunc 0 -}}
{{- 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 | quote | trunc 0 -}}
{{- 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" | quote | trunc 0 -}}
{{- 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 ) | quote | trunc 0 -}}
{{- 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" | quote | trunc 0 -}}
{{- 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" | quote | trunc 0 -}}
{{- 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" | quote | trunc 0 -}}
{{- 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 | quote | trunc 0 -}}
{{- 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 | quote | trunc 0 -}}
{{- 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 | quote | trunc 0 -}}
{{- 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 | quote | trunc 0 -}}
{{- end -}}
{{- if empty $envAll.Values.conf.neutron.nova.username -}}
{{- set $envAll.Values.conf.neutron.nova "username" $envAll.Values.endpoints.identity.auth.nova.username | quote | trunc 0 -}}
{{- end -}}
{{- if empty $envAll.Values.conf.neutron.nova.password -}}
{{- set $envAll.Values.conf.neutron.nova "password" $envAll.Values.endpoints.identity.auth.nova.password | quote | trunc 0 -}}
{{- 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" | quote | trunc 0 -}}
{{- 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" | quote | trunc 0 -}}
{{- end -}}
{{- if empty $envAll.Values.conf.metadata_agent.DEFAULT.nova_metadata_port -}}
{{- set $envAll.Values.conf.metadata_agent.DEFAULT "nova_metadata_port" 80 | quote | trunc 0 -}}
{{- 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" | quote | trunc 0 -}}
{{- 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 | quote | trunc 0 -}}
{{- 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 | quote | trunc 0 -}}
{{- 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 | quote | trunc 0 -}}
{{- 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 | quote | trunc 0 -}}
{{- 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" | quote | trunc 0 -}}
{{- end -}}
---
apiVersion: v1
kind: ConfigMap
metadata:
name: {{ $configMapName }}
data:
rally_tests.yaml: |
{{ toYaml $envAll.Values.conf.rally_tests.tests | indent 4 }}
api-paste.ini: |
{{ include "helm-toolkit.utils.to_ini" $envAll.Values.conf.paste | indent 4 }}
policy.json: |
{{ toJson $envAll.Values.conf.policy | indent 4 }}
neutron.conf: |
{{ include "helm-toolkit.utils.to_oslo_conf" $envAll.Values.conf.neutron | indent 4 }}
dhcp_agent.ini: |
{{ include "helm-toolkit.utils.to_oslo_conf" $envAll.Values.conf.dhcp_agent | indent 4 }}
l3_agent.ini: |
{{ include "helm-toolkit.utils.to_oslo_conf" $envAll.Values.conf.l3_agent | indent 4 }}
metadata_agent.ini: |
{{ include "helm-toolkit.utils.to_oslo_conf" $envAll.Values.conf.metadata_agent | indent 4 }}
metering_agent.ini: |
{{ include "helm-toolkit.utils.to_oslo_conf" $envAll.Values.conf.metering_agent | indent 4 }}
ml2_conf.ini: |
{{ include "helm-toolkit.utils.to_oslo_conf" $envAll.Values.conf.plugins.ml2_conf | indent 4 }}
ml2_conf_sriov.ini: |
{{ include "helm-toolkit.utils.to_oslo_conf" $envAll.Values.conf.plugins.ml2_conf_sriov | indent 4 }}
macvtap_agent.ini: |
{{ include "helm-toolkit.utils.to_oslo_conf" $envAll.Values.conf.plugins.macvtap_agent | indent 4 }}
linuxbridge_agent.ini: |
{{ include "helm-toolkit.utils.to_oslo_conf" $envAll.Values.conf.plugins.linuxbridge_agent | indent 4 }}
openvswitch_agent.ini: |
{{ include "helm-toolkit.utils.to_oslo_conf" $envAll.Values.conf.plugins.openvswitch_agent | indent 4 }}
sriov_agent.ini: |
{{ include "helm-toolkit.utils.to_oslo_conf" $envAll.Values.conf.plugins.sriov_agent | indent 4 }}
dnsmasq.conf: ""
neutron_sudoers: |
{{ $envAll.Values.conf.neutron_sudoers | indent 4 }}
rootwrap.conf: |
{{ $envAll.Values.conf.rootwrap | indent 4 }}
{{- range $key, $value := $envAll.Values.conf.rootwrap_filters }}
{{- $filePrefix := replace "_" "-" $key }}
{{ printf "%s.filters" $filePrefix }}: |
{{ $value.content | indent 4 }}
{{- end }}
{{- end }}
{{- end }}
{{- if .Values.manifests.configmap_etc }}
{{- list "neutron-etc" . | include "neutron.configmap.etc" }}
{{- end }}