Files
openstack-armada-app/openstack-helm/debian/deb_folder/patches/0019-Add-cluster-host-ip-env-var-to-nova.patch
Daniel Caires 5b3917befd Upversion base OSH to Caracal-3013cbc9
This task aims to Upversion base OSH to Caracal (3013cbc9)

This change upversions the base commit SHA for openstack-helm
to the Caracal version. Because upstream OSH does not track
versions the same way Openstack does, the base commit [1] was
chosen after the caracal release date and the stability of the
changes in the upstream repo.

It also ports all StarlingX specific patches on top of it,
dropping the patches that are no longer necessary and updating
what needs to be updated in order to be applied on top of the
new base SHA.

Patches 0002, 0009, 0019 and 0022 had their changes merged
on the upstream OSH repo, therefore they were dropped in this
upversion.

Patch 0003 was also removed since a similar job was created
upstream. It remains a point of attention because altough
a similar job was created upstream there are some differences
between them. Patch 0012 was dropped as it only modified the
file created by the patch 0003.

Most of patch 0020 was merged upstream, because of that the size
of the patch was significantly reduced.

All static overrides had the dep_check image added, this image
was already present on the values file upstream but was not being
exposed on the static overrides.

In the Neutron Helm chart, some additional images were added. Most
of the images that were not previously used by STX-O were set as "null"
in the static overrides. The rpc_server proved to be necessary for the
deployment. Similarly, the Nova Helm chart had some images added and
deleted. The static overrides was updated accordingly.

Test Plan:
PASS - Run downloader to get new OSH version
PASS - Run build-pkgs -c -a -l openstack to rebuild all packages
PASS - OSH is on the Caracal version
PASS - All OSH patches are applied
PASS - STX-O is built

With this change STX-Openstack will stop applying until the all
reviews in the relation chain are merged as well. Because of that,
the Test Plan does not include the apply and proper functioning of
the application. The last review of the relation chain will have a
more torough test plan. In order for the build not to be broken, all
reviews in the relation chain should be merged together.

Story: 2011303
Task: 51429

[1] - 3013cbc94a

Change-Id: I988051a73c405c0df810cd24e9dc08fa1051faac
Signed-off-by: Daniel Caires <DanielMarques.Caires@windriver.com>
2025-02-17 18:59:31 +00:00

128 lines
4.8 KiB
Diff

From 9dbf2a0cc29a051471b7bdf8f4f762259722d5a9 Mon Sep 17 00:00:00 2001
From: marantes <murillo.arantes@windriver.com>
Date: Fri, 3 Jan 2025 16:04:17 -0300
Subject: [PATCH] Add cluster host ip env var to nova
This patch reads the Nova configurations from /etc/nova/nova.conf and
writes them to a new Nova configuration file located at
/tmp/pod-shared/nova.conf, with the only difference being that the
fields DEFAULT.my_ip, vnc.server_listen, vnc.server_proxyclient_address
and libvirt.live_migration_inbound_addr will be updated to contain the
cluster host IP configured in a environment variable. This new
configuration file will be used by the Nova compute container.
This patch aims to assist in the task of changing the IP acquisition
method for Nova compute pods from the Nova plugin to an environment
variable-based approach that will provide the cluster host IP address
to the Nova compute container. Since the Nova configuration file
located at /etc/nova is read-only, the solution of creating a new
configuration file was used, following a similar approach that is
already followed by other Nova configuration files using this path
(nova-console.conf, nova-hypervisor.conf and nova-libvirt.conf).
Signed-off-by: Murillo Arantes <murillo.arantes@windriver.com>
---
nova/templates/bin/_nova-compute.sh.tpl | 51 ++++++++++++++++++++++++-
nova/templates/daemonset-compute.yaml | 8 +++-
2 files changed, 56 insertions(+), 3 deletions(-)
diff --git a/nova/templates/bin/_nova-compute.sh.tpl b/nova/templates/bin/_nova-compute.sh.tpl
index 702e3b92..116f41a6 100644
--- a/nova/templates/bin/_nova-compute.sh.tpl
+++ b/nova/templates/bin/_nova-compute.sh.tpl
@@ -16,8 +16,57 @@ limitations under the License.
set -ex
+# Check if environment variable exists
+if [ -z "$CLUSTER_HOST_IP" ]; then
+ echo "Error: CLUSTER_HOST_IP environment variable is not set."
+ exit 1
+fi
+
+# Set input and output files
+INPUT_FILE="/etc/nova/nova.conf"
+OUTPUT_FILE="/tmp/pod-shared/nova.conf"
+
+# Check if the output directory exists
+if [ ! -d "$(dirname "$OUTPUT_FILE")" ]; then
+ echo "Error: Output directory does not exist."
+ exit 1
+fi
+
+# Set fields to replace with cluster host ip
+declare -A CONFIG_CHANGES
+CONFIG_CHANGES["DEFAULT.my_ip"]="$CLUSTER_HOST_IP"
+CONFIG_CHANGES["vnc.server_listen"]="$CLUSTER_HOST_IP"
+CONFIG_CHANGES["vnc.server_proxyclient_address"]="$CLUSTER_HOST_IP"
+CONFIG_CHANGES["libvirt.live_migration_inbound_addr"]="$CLUSTER_HOST_IP"
+
+# Loop through the lines of the input file
+while IFS="=" read -r line; do
+ # Check if the line is a section
+ if [[ "$line" =~ ^\[.*\]$ ]]; then
+ section="${line//[\[\]]/}" # Get section name by stripping brackets
+ fi
+
+ # Loop through the dictionary of field.section and update the values
+ for field_section in "${!CONFIG_CHANGES[@]}"; do
+ section_name="${field_section%%.*}" # Extract section (before the dot)
+ field_name="${field_section#*.}" # Extract field (after the dot)
+ new_value="${CONFIG_CHANGES[$field_section]}"
+
+ # If we are in the correct section, update the field value
+ if [[ "$section" == "$section_name" && "$line" =~ ^$field_name\ = ]]; then
+ line="$field_name = $new_value"
+ fi
+ done
+
+ # Write the line (modified or unmodified) to the output file
+ if ! echo "$line" >> "$OUTPUT_FILE"; then
+ echo "Error: Failed to write to output file."
+ exit 1
+ fi
+done < "$INPUT_FILE"
+
exec nova-compute \
- --config-file /etc/nova/nova.conf \
+ --config-file /tmp/pod-shared/nova.conf \
{{- if .Values.console.address_search_enabled }}
--config-file /tmp/pod-shared/nova-console.conf \
{{- end }}
diff --git a/nova/templates/daemonset-compute.yaml b/nova/templates/daemonset-compute.yaml
index 1a117456..794674f3 100644
--- a/nova/templates/daemonset-compute.yaml
+++ b/nova/templates/daemonset-compute.yaml
@@ -18,7 +18,7 @@ exec:
- python
- /tmp/health-probe.py
- --config-file
- - /etc/nova/nova.conf
+ - /tmp/pod-shared/nova.conf
- --service-queue-name
- compute
- --liveness-probe
@@ -33,7 +33,7 @@ exec:
- python
- /tmp/health-probe.py
- --config-file
- - /etc/nova/nova.conf
+ - /tmp/pod-shared/nova.conf
- --service-queue-name
- compute
{{- if .Values.pod.use_fqdn.compute }}
@@ -278,6 +278,10 @@ spec:
value: "{{ .Values.pod.probes.rpc_timeout }}"
- name: RPC_PROBE_RETRIES
value: "{{ .Values.pod.probes.rpc_retries }}"
+ - name: CLUSTER_HOST_IP
+ valueFrom:
+ fieldRef:
+ fieldPath: status.hostIP
{{- if or .Values.manifests.certificates .Values.tls.identity }}
- name: REQUESTS_CA_BUNDLE
value: "/etc/ssl/certs/openstack-helm.crt"
--
2.34.1