From edfe160b4f87db1b18d88dce3dca21b0ffd26f0e Mon Sep 17 00:00:00 2001 From: Michael Trip Date: Tue, 23 Jun 2026 15:29:06 +0200 Subject: [PATCH] Update entrypoint.sh to prevent failure on missing password entry and modify deployment.yaml to use latest image tag with Always pull policy --- entrypoint.sh | 3 ++- k8s/deployment.yaml | 4 ++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/entrypoint.sh b/entrypoint.sh index 22436d7..30d4e14 100644 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -70,7 +70,8 @@ store_generated_password() { read_generated_password() { local username="$1" - grep -E "^${username}=" "${GENERATED_PASSWORDS_FILE}" | tail -n 1 | cut -d '=' -f 2- + # Return an empty string if no entry exists; never fail under `set -euo pipefail`. + awk -F '=' -v username="${username}" '$1 == username { value = substr($0, index($0, "=") + 1) } END { if (value != "") print value }' "${GENERATED_PASSWORDS_FILE}" } write_authorized_keys() { diff --git a/k8s/deployment.yaml b/k8s/deployment.yaml index 2972315..1bfb963 100644 --- a/k8s/deployment.yaml +++ b/k8s/deployment.yaml @@ -21,8 +21,8 @@ spec: type: RuntimeDefault containers: - name: k8s-mgmt-pod - image: git.alcatrash.net/michael/k8s-mgmt-pod/k8s-mgmt-pod:v1.0.0 - imagePullPolicy: IfNotPresent + image: git.alcatrash.net/michael/k8s-mgmt-pod/k8s-mgmt-pod:latest + imagePullPolicy: Always ports: - name: ssh containerPort: 22