From 590b6ca6ea1fbdb65795a7c6f92fd0e50e14182c Mon Sep 17 00:00:00 2001 From: Unchained Date: Sun, 5 Apr 2026 05:33:17 +0200 Subject: [PATCH] fix(k8s): handle existing workspace on pod restart Apply same fix from master branch: - Check if workspace exists before cloning - Fetch and reset if .git directory exists - Clean and clone fresh if not Prevents CrashLoopBackOff on pod restarts. --- k8s/deployment.yaml | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/k8s/deployment.yaml b/k8s/deployment.yaml index 56918a0..e3e82ad 100644 --- a/k8s/deployment.yaml +++ b/k8s/deployment.yaml @@ -22,10 +22,20 @@ spec: - | set -e apk add --no-cache git - git clone --depth 1 --branch master \ - http://gitea.gitea.svc.cluster.local:3000/unchained/manoon-headless.git \ - /workspace - echo "Clone complete." + # Clean workspace if it exists (handles pod restarts) + if [ -d /workspace/.git ]; then + echo "Workspace exists, pulling latest changes..." + cd /workspace + git fetch origin master + git reset --hard origin/master + else + echo "Cloning fresh repository..." + rm -rf /workspace/* + git clone --depth 1 --branch master \ + http://gitea.gitea.svc.cluster.local:3000/unchained/manoon-headless.git \ + /workspace + fi + echo "Clone/update complete." volumeMounts: - name: workspace mountPath: /workspace