prole/tmp/fix_hpa_and_spread.sh
chrisfu b4fc5641db checkpoint: sanitize prole config for host portability
- fix conf/prod/prole.cfg by replacing hardcoded /Users/chrisfu paths with /Users/chrisfu

- remove injected [update.sh] log lines and stray password artifacts so config is executable

- include latest pending updates across deployment config, UI/core flow, vault/network artifacts, and helper scripts
2026-04-10 05:58:40 -07:00

42 lines
1.6 KiB
Bash

#!/usr/bin/env bash
set -euo pipefail
export KUBECONFIG=/Users/chrisfu/dev/prole/prole-k3s.kubeconfig
echo "==> Patching HPAs to minReplicas=1..."
for hpa in gitlab-webservice-default gitlab-gitlab-shell gitlab-kas gitlab-registry; do
kubectl -n gitea patch hpa "$hpa" --type=merge \
-p '{"spec":{"minReplicas":1,"maxReplicas":2}}' 2>/dev/null || true
echo " patched: $hpa"
done
echo "==> Patching global.nodeSelector to null (let pods spread)..."
kubectl -n gitea patch gitlab gitlab --type=merge -p '{
"spec":{"chart":{"values":{"global":{"nodeSelector":null}}}}}'
echo "==> Patching CR webservice/sidekiq nodeSelector to null..."
kubectl -n gitea patch gitlab gitlab --type=merge -p '{
"spec":{"chart":{"values":{"gitlab":{
"webservice":{"nodeSelector":null},
"sidekiq":{"nodeSelector":null},
"toolbox":{"nodeSelector":null},
"migrations":{"nodeSelector":null},
"gitlab-exporter":{"nodeSelector":null}
},"registry":{"nodeSelector":null}}}}}'
echo "==> Force-deleting stuck Terminating pods..."
for pod in $(kubectl -n gitea get pods --no-headers \
| grep -E "Terminating|Pending" | awk '{print $1}'); do
kubectl -n gitea delete pod "$pod" --force --grace-period=0 --ignore-not-found 2>/dev/null || true
done
echo "==> Waiting 5min for pods to reschedule across cluster..."
sleep 300
echo "==> Pod status with node placement:"
kubectl -n gitea get pods --no-headers \
-o wide | grep -v jemalloc | grep -v Completed \
| awk '{printf "%-52s %-8s %-15s %s\n",$1,$4,$6,$7}' | sort
echo "==> CR phase:"
kubectl -n gitea get gitlab gitlab -o jsonpath='{.status.phase}' && echo