Fix: config-sync sidecar logging (stderr + idle heartbeat) #89

Merged
k.renner merged 1 commits from fix-config-sync-logging into master 2026-06-29 20:21:50 +00:00
Owner

Problem

Only config-sync: starting showed in kubectl logs — the per-sync lines never appeared. Cause: busybox sh block-buffers stdout when it's a pipe (as under kubelet), so lines after the first can sit unflushed for the lifetime of the loop.

Fix

  • log() now writes to stderr (unbuffered; still captured into the container log) → lines reach kubectl logs immediately.
  • Added a one-time initial check: config in sync with origin/main at <sha> line, so an idle loop (nothing to sync) is still observably alive instead of looking silent after "starting".

Validated: sh -n clean, kubectl kustomize builds. Rolls on merge via Flux (the deployment is unchanged, but the configMap script content changes; a rollout restart may be needed since the script configMap has disableNameSuffixHash).

🤖 Generated with Claude Code

## Problem Only `config-sync: starting` showed in `kubectl logs` — the per-sync lines never appeared. Cause: **busybox `sh` block-buffers stdout when it's a pipe** (as under kubelet), so lines after the first can sit unflushed for the lifetime of the loop. ## Fix - `log()` now writes to **stderr** (unbuffered; still captured into the container log) → lines reach `kubectl logs` immediately. - Added a one-time **`initial check: config in sync with origin/main at <sha>`** line, so an idle loop (nothing to sync) is still observably alive instead of looking silent after "starting". Validated: `sh -n` clean, `kubectl kustomize` builds. Rolls on merge via Flux (the deployment is unchanged, but the configMap script content changes; a `rollout restart` may be needed since the script configMap has `disableNameSuffixHash`). 🤖 Generated with [Claude Code](https://claude.com/claude-code)
k.renner added 1 commit 2026-06-29 20:07:20 +00:00
Only the "starting" line surfaced in `kubectl logs`: busybox sh block-buffers
stdout when it's a pipe, so subsequent lines could sit unflushed for the life of
the loop. Log to stderr instead (unbuffered; still captured in the container
log). Also emit a one-time "initial check: config in sync" line so an idle loop
is observably alive even when there's nothing to sync.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01GgbyKgrN1yYWrkAA32rJE5
k.renner merged commit 185cffc7e2 into master 2026-06-29 20:21:50 +00:00
Sign in to join this conversation.