Nova: Update DB sync job to update transport url

If the transport url changes, cell needs to be updated to use new
transport.

Change-Id: I1a931b5ce272a731be710c43f3fea08abc79af71
Signed-off-by: Pete Birley <pete@port.direct>
This commit is contained in:
Pete Birley 2019-07-24 12:01:26 -05:00 committed by Sangeet Gupta
parent 28574d01cd
commit 467b81a3e4
3 changed files with 27 additions and 2 deletions

View File

@ -17,7 +17,6 @@ limitations under the License.
*/}}
set -ex
NOVA_VERSION=$(nova-manage --version 2>&1)
function manage_cells () {
@ -27,6 +26,20 @@ function manage_cells () {
nova-manage cell_v2 map_cell0
nova-manage cell_v2 list_cells | grep -q " cell1 " || \
nova-manage cell_v2 create_cell --name=cell1 --verbose
# NOTE: We do this to allow the transport url to be updated.
CELL1_ID=$(nova-manage cell_v2 list_cells | awk -F '|' '/ cell1 / { print $3 }' | tr -d ' ')
set +x
if [ -z "${TRANSPORT_URL}" ]; then
echo "Error: Transport URL is not set, exiting."
exit 1
else
nova-manage cell_v2 update_cell \
--cell_uuid="${CELL1_ID}" \
--name="cell1" \
--transport-url="${TRANSPORT_URL}"
fi
set -x
fi
}

View File

@ -14,7 +14,18 @@ See the License for the specific language governing permissions and
limitations under the License.
*/}}
{{- define "nova.templates._job_db_sync.env_vars" -}}
{{- $envAll := index . 0 }}
env:
- name: TRANSPORT_URL
valueFrom:
secretKeyRef:
name: {{ $envAll.Values.secrets.oslo_messaging.nova }}
key: TRANSPORT_URL
{{- end }}
{{- if .Values.manifests.job_db_sync }}
{{- $dbSyncJob := dict "envAll" . "serviceName" "nova" "podVolMounts" .Values.pod.mounts.nova_db_sync.nova_db_sync.volumeMounts "podVols" .Values.pod.mounts.nova_db_sync.nova_db_sync.volumes -}}
{{- $podEnvVars := include "nova.templates._job_db_sync.env_vars" (tuple .) | toString | fromYaml }}
{{- $dbSyncJob := dict "envAll" . "serviceName" "nova" "podVolMounts" .Values.pod.mounts.nova_db_sync.nova_db_sync.volumeMounts "podVols" .Values.pod.mounts.nova_db_sync.nova_db_sync.volumes "podEnvVars" $podEnvVars.env -}}
{{ $dbSyncJob | include "helm-toolkit.manifests.job_db_sync" }}
{{- end }}

View File

@ -26,5 +26,6 @@ metadata:
type: Opaque
data:
RABBITMQ_CONNECTION: {{ tuple "oslo_messaging" "internal" $userClass "http" $envAll | include "helm-toolkit.endpoints.authenticated_endpoint_uri_lookup" | b64enc }}
TRANSPORT_URL: {{ tuple "oslo_messaging" "internal" $userClass "amqp" $envAll | include "helm-toolkit.endpoints.authenticated_endpoint_uri_lookup" | b64enc }}
{{- end }}
{{- end }}