From c63b1920d50ef5b856784f650dd868263cf45d36 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/Chart.yaml | 2 +- nova/templates/bin/_ssh-init.sh.tpl | 13 ++++++++----- nova/templates/daemonset-compute.yaml | 16 ++++++++++++---- nova/values.yaml | 4 +++- releasenotes/notes/nova.yaml | 1 + 5 files changed, 25 insertions(+), 11 deletions(-) diff --git a/nova/Chart.yaml b/nova/Chart.yaml index fba86e1f48..75b90a8a83 100644 --- a/nova/Chart.yaml +++ b/nova/Chart.yaml @@ -14,7 +14,7 @@ apiVersion: v1 appVersion: v1.0.0 description: OpenStack-Helm Nova name: nova -version: 0.2.25 +version: 0.2.26 home: https://docs.openstack.org/nova/latest/ icon: https://www.openstack.org/themes/openstack/images/project-mascots/Nova/OpenStack_Project_Nova_vertical.png sources: diff --git a/nova/templates/bin/_ssh-init.sh.tpl b/nova/templates/bin/_ssh-init.sh.tpl index be2e33a418..9032933d2a 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 <