From 8d7ecdda11999adeaeb5c914d3f6feb220f629e7 Mon Sep 17 00:00:00 2001 From: Konstantin Renner Date: Mon, 29 Jun 2026 21:46:00 +0200 Subject: [PATCH] fix(home-assistant): stop config-sync sidecar OOM (disable git auto-gc, raise limit) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The config-sync sidecar OOMKilled (exit 137) at the 64Mi limit and crashlooped, so it never synced. Root cause: this repo's .git is ~1.1 GB (a 1 GB backup tar lives in history), and git auto-gc tried to repack that whole pack inside the tiny sidecar on first fetch. - Disable gc.auto in the sync script and cap pack window / delta caches, so fetch/checkout only ever touch the small config blobs and never repack. - Raise the sidecar memory limit 64Mi -> 256Mi for index-pack headroom on the first fetch. Follow-up (not here): purge the 1 GB backup tar from the homeassistant repo history and .gitignore backups/ — it bloats every clone and the config PVC. Co-Authored-By: Claude Opus 4.8 Claude-Session: https://claude.ai/code/session_01GgbyKgrN1yYWrkAA32rJE5 --- kubernetes/apps/home-assistant/config-sync.sh | 8 ++++++++ kubernetes/apps/home-assistant/deployment.yaml | 5 ++++- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/kubernetes/apps/home-assistant/config-sync.sh b/kubernetes/apps/home-assistant/config-sync.sh index 3c8c6464..ef788b92 100644 --- a/kubernetes/apps/home-assistant/config-sync.sh +++ b/kubernetes/apps/home-assistant/config-sync.sh @@ -44,6 +44,14 @@ reload_ha() { log "starting (branch=${BRANCH} interval=${INTERVAL}s dir=${CONFIG_DIR})" cd "${CONFIG_DIR}" git config --global --add safe.directory "${CONFIG_DIR}" 2>/dev/null || true +# This repo's .git is ~1.1 GB (a 1 GB backup tar sits in history). Auto-gc would +# try to repack that whole pack inside this tiny sidecar and OOM. Disable it and +# cap delta/window memory so fetch/checkout stay cheap (we only touch small +# config blobs, never the big objects). +git config --global gc.auto 0 2>/dev/null || true +git config --global pack.windowMemory 32m 2>/dev/null || true +git config --global pack.deltaCacheSize 32m 2>/dev/null || true +git config --global core.deltaBaseCacheLimit 16m 2>/dev/null || true while true; do if git fetch --quiet origin "${BRANCH}" 2>/dev/null; then diff --git a/kubernetes/apps/home-assistant/deployment.yaml b/kubernetes/apps/home-assistant/deployment.yaml index c5b30232..8739c5ec 100644 --- a/kubernetes/apps/home-assistant/deployment.yaml +++ b/kubernetes/apps/home-assistant/deployment.yaml @@ -183,12 +183,15 @@ spec: - name: config-sync-script mountPath: /scripts readOnly: true + # ~1.1 GB .git (a 1 GB backup tar in history); auto-gc is disabled in + # the script so it never repacks. fetch/checkout of small config blobs + # peak well under this; the headroom covers index-pack on first fetch. resources: requests: cpu: 10m memory: 32Mi limits: - memory: 64Mi + memory: 256Mi securityContext: runAsUser: 0 runAsGroup: 0 -- 2.54.0