From 486274bc946ce0df431819e9884fd81abe5a3ed9 Mon Sep 17 00:00:00 2001
From: Pete Birley <pete@port.direct>
Date: Tue, 26 Sep 2017 07:26:51 -0500
Subject: [PATCH] Nova: Move Neutron credentials to endpoints in values.yaml

This PS moves the neutron credentials from the config section
of the values.yaml to the endpoints section, seperating them from
the service configuration.

Change-Id: I548148449f56e4eea92669ad8e98e3eff1ca7b27
---
 nova/templates/configmap-etc.yaml | 19 +++++++++++++++++++
 nova/values.yaml                  | 13 +++++++------
 2 files changed, 26 insertions(+), 6 deletions(-)

diff --git a/nova/templates/configmap-etc.yaml b/nova/templates/configmap-etc.yaml
index ee5507b4d5..496331d8ab 100644
--- a/nova/templates/configmap-etc.yaml
+++ b/nova/templates/configmap-etc.yaml
@@ -78,6 +78,25 @@ limitations under the License.
 {{- tuple "identity" "internal" "api" . | include "helm-toolkit.endpoints.keystone_endpoint_uri_lookup"| set .Values.conf.nova.neutron "auth_url" | quote | trunc 0 -}}
 {{- end -}}
 
+{{- if empty .Values.conf.nova.neutron.region_name -}}
+{{- set .Values.conf.nova.neutron "region_name" .Values.endpoints.identity.auth.neutron.region_name | quote | trunc 0 -}}
+{{- end -}}
+{{- if empty .Values.conf.nova.neutron.project_name -}}
+{{- set .Values.conf.nova.neutron "project_name" .Values.endpoints.identity.auth.neutron.project_name | quote | trunc 0 -}}
+{{- end -}}
+{{- if empty .Values.conf.nova.neutron.project_domain_name -}}
+{{- set .Values.conf.nova.neutron "project_domain_name" .Values.endpoints.identity.auth.neutron.project_domain_name | quote | trunc 0 -}}
+{{- end -}}
+{{- if empty .Values.conf.nova.neutron.user_domain_name -}}
+{{- set .Values.conf.nova.neutron "user_domain_name" .Values.endpoints.identity.auth.neutron.user_domain_name | quote | trunc 0 -}}
+{{- end -}}
+{{- if empty .Values.conf.nova.neutron.username -}}
+{{- set .Values.conf.nova.neutron "username" .Values.endpoints.identity.auth.neutron.username | quote | trunc 0 -}}
+{{- end -}}
+{{- if empty .Values.conf.nova.neutron.password -}}
+{{- set .Values.conf.nova.neutron "password" .Values.endpoints.identity.auth.neutron.password | quote | trunc 0 -}}
+{{- end -}}
+
 {{- if empty .Values.conf.nova.cache.memcache_servers -}}
 {{- tuple "oslo_cache" "internal" "memcache" . | include "helm-toolkit.endpoints.host_and_port_endpoint_uri_lookup" | set .Values.conf.nova.cache "memcache_servers" | quote | trunc 0 -}}
 {{- end -}}
diff --git a/nova/values.yaml b/nova/values.yaml
index 003d86e134..6abc3a3f57 100644
--- a/nova/values.yaml
+++ b/nova/values.yaml
@@ -639,12 +639,6 @@ conf:
       service_metadata_proxy: True
       auth_type: password
       auth_version: v3
-      region_name: RegionOne
-      project_name: service
-      project_domain_name: default
-      user_domain_name: default
-      username: neutron
-      password: password
     database:
       max_retries: -1
     api_database:
@@ -764,6 +758,13 @@ endpoints:
         project_name: service
         user_domain_name: default
         project_domain_name: default
+      neutron:
+        region_name: RegionOne
+        project_name: service
+        project_domain_name: default
+        user_domain_name: default
+        username: neutron
+        password: password
     hosts:
       default: keystone-api
       public: keystone