diff --git a/openstack-helm/centos/openstack-helm.spec b/openstack-helm/centos/openstack-helm.spec index 1b586b08..d7fb66cf 100644 --- a/openstack-helm/centos/openstack-helm.spec +++ b/openstack-helm/centos/openstack-helm.spec @@ -29,6 +29,7 @@ Patch07: 0007-Add-stx_admin-account.patch Patch08: 0008-Disabling-helm3_hook.patch Patch09: 0009-Add-flavor-extra-spec-hw-pci_irq_affinity_mask.patch Patch10: 0010-Enable-taint-toleration-for-Openstack-services.patch +Patch11: 0011-Fix-nova-compute-ssh-init-to-execute-as-runAsUser.patch BuildRequires: helm BuildRequires: openstack-helm-infra @@ -50,6 +51,7 @@ Openstack Helm charts %patch08 -p1 %patch09 -p1 %patch10 -p1 +%patch11 -p1 %build # Stage helm-toolkit in the local repo diff --git a/openstack-helm/debian/deb_folder/rules b/openstack-helm/debian/deb_folder/rules index 33d7c2f1..eb9242c7 100755 --- a/openstack-helm/debian/deb_folder/rules +++ b/openstack-helm/debian/deb_folder/rules @@ -26,6 +26,7 @@ override_dh_auto_build: patch --no-backup-if-mismatch --fuzz=0 -p1 < 0008-Disabling-helm3_hook.patch patch --no-backup-if-mismatch --fuzz=0 -p1 < 0009-Add-flavor-extra-spec-hw-pci_irq_affinity_mask.patch patch --no-backup-if-mismatch --fuzz=0 -p1 < 0010-Enable-taint-toleration-for-Openstack-services.patch + patch --no-backup-if-mismatch --fuzz=0 -p1 < 0011-Fix-nova-compute-ssh-init-to-execute-as-runAsUser.patch # Host a server for the helm charts. chartmuseum --debug --port=8879 --context-path='/charts' --storage="local" \ --storage-local-rootdir="." & diff --git a/openstack-helm/files/0011-Fix-nova-compute-ssh-init-to-execute-as-runAsUser.patch b/openstack-helm/files/0011-Fix-nova-compute-ssh-init-to-execute-as-runAsUser.patch new file mode 100644 index 00000000..d4c3afcc --- /dev/null +++ b/openstack-helm/files/0011-Fix-nova-compute-ssh-init-to-execute-as-runAsUser.patch @@ -0,0 +1,172 @@ +From fc736ec3993ff18b6380d2016060991e2c3a11f4 Mon Sep 17 00:00:00 2001 +From: Thiago Brito +Date: Fri, 7 Jan 2022 15:59:41 -0300 +Subject: [PATCH] Fix nova-compute-ssh init to execute as runAsUser + +On _ssh-init.sh.tpl, despite one change the runAsUser for the +nova-compute container on the securityContext, the ssh keys are always +being copied into the 'nova' user's folder. This change fixes it by +getting the correct user defined on the securityContext and copying the +keys to its correct folder. + +Signed-off-by: Thiago Brito +Change-Id: Ia7883dc4626a295892eb4637ef717b0b1725ac89 +--- + nova/templates/bin/_ssh-init.sh.tpl | 13 ++++++++----- + nova/templates/daemonset-compute.yaml | 16 ++++++++++++---- + nova/values.yaml | 4 +++- + 3 files changed, 23 insertions(+), 10 deletions(-) + +diff --git a/nova/templates/bin/_ssh-init.sh.tpl b/nova/templates/bin/_ssh-init.sh.tpl +index be2e33a4..fbd96f04 100644 +--- a/nova/templates/bin/_ssh-init.sh.tpl ++++ b/nova/templates/bin/_ssh-init.sh.tpl +@@ -16,10 +16,13 @@ limitations under the License. + + set -ex + +-mkdir -p ~nova/.ssh +-chown -R nova:nova ~nova/.ssh ++export NOVA_USERNAME=$(id -u ${NOVA_USER_UID} -n) ++export NOVA_USER_HOME=$(eval echo ~${NOVA_USERNAME}) + +-cat > ~nova/.ssh/config < ${NOVA_USER_HOME}/.ssh/config <