Nova: Update Cell management to allow db updates and improve rabbit

This PS allows the db connection string for the singular cell that OSH
currently supports to be updated, and also uses the full connection
string for the transport url.

Change-Id: I700133263273e04dad5b3e69d5e1f8255323e560
Signed-off-by: Pete Birley <pete@port.direct>
This commit is contained in:
Pete Birley 2019-07-25 07:28:23 -05:00 committed by Pete Birley
parent 2c166a726c
commit 09616b4f3f
3 changed files with 17 additions and 11 deletions

View File

@ -27,18 +27,19 @@ function manage_cells () {
nova-manage cell_v2 list_cells | grep -q " cell1 " || \ nova-manage cell_v2 list_cells | grep -q " cell1 " || \
nova-manage cell_v2 create_cell --name=cell1 --verbose 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 ' ') CELL1_ID=$(nova-manage cell_v2 list_cells | awk -F '|' '/ cell1 / { print $3 }' | tr -d ' ')
set +x set +x
if [ -z "${TRANSPORT_URL}" ]; then for VAR in TRANSPORT_URL DB_CONNECTION; do
echo "Error: Transport URL is not set, exiting." if [ -z "${!VAR}" ]; then
exit 1 echo "ERROR: missing $VAR variable"
else exit 1
nova-manage cell_v2 update_cell \ fi
--cell_uuid="${CELL1_ID}" \ done
--name="cell1" \ nova-manage cell_v2 update_cell \
--transport-url="${TRANSPORT_URL}" --cell_uuid="${CELL1_ID}" \
fi --name="cell1" \
--transport-url="${TRANSPORT_URL}" \
--database_connection="${DB_CONNECTION}"
set -x set -x
fi fi
} }

View File

@ -22,6 +22,11 @@ env:
secretKeyRef: secretKeyRef:
name: {{ $envAll.Values.secrets.oslo_messaging.nova }} name: {{ $envAll.Values.secrets.oslo_messaging.nova }}
key: TRANSPORT_URL key: TRANSPORT_URL
- name: DB_CONNECTION
valueFrom:
secretKeyRef:
name: {{ $envAll.Values.secrets.oslo_db.nova }}
key: DB_CONNECTION
{{- end }} {{- end }}
{{- if .Values.manifests.job_db_sync }} {{- if .Values.manifests.job_db_sync }}

View File

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