Skip to content

fix(k8s): do not let kind inherit the kind-ci placeholder client id - #663

Merged
cwiklik merged 1 commit into
rossoctl:mainfrom
cwiklik:fix/429-kindci-placeholder-leak
Oct 29, 2026
Merged

cwiklik merged 1 commit into
rossoctl:mainfrom
cwiklik:fix/429-kindci-placeholder-leak

Conversation

@cwiklik

@cwiklik cwiklik commented Oct 29, 2026

Copy link
Copy Markdown
Contributor

Summary

--target kind and --target kind-ci share one Kind cluster (KIND_CLUSTER=moca) and therefore one moca-settings. Since settings became sticky (#427), a kind run after a kind-ci run read the CI placeholder Iv1.k8s-smoke-unused back as if an operator had set it: the control plane came up at 1 replica with an id nobody can log in with, instead of 0 replicas and the "no client id" warning.

The placeholder (6f3495d6) predates stickiness (d777233d), so stickiness retroactively turned a render-time default into persisted configuration. That is the bug.

This takes fix (a) from the issue — never treat the placeholder as stored input.

What changed

Name the placeholder CI_CLIENT_ID and discard it on read-back when the target is not kind-ci — the same shape public_harness_url already uses (setup.sh:1019-1026) to drop a stored value that no longer suits the current target.

Sequence CLIENT_ID Control-plane replicas
kind-ci, first run placeholder (derived) 1
kind-ci, re-run (CI's second step) placeholder (filtered, re-derived — same string) 1
kind after kind-ci '' 0 + warning ← the fix
kind with a real stored id that id 1

Why the key is still written

"Apply it at render time only" can't mean omitting or emptying the key:

  • base/control-plane.yaml:60-61 is a configMapKeyRef without optional: true (unlike its neighbours) — an absent key gives CreateContainerConfigError, and packages/supervisor/test/k8s/base-control-plane.test.ts:85-98 pins that shape.
  • required() in packages/control-plane/src/main.ts:37-45 uses if (!v), so an empty value throws exactly like an absent one.
  • The kind-ci smoke execs into a running control-plane pod to mint its own token (smoke.sh:230-237).

So kind-ci keeps re-deriving a non-empty placeholder every run. The ConfigMap keeps its ten-key shape, and the settings hash is byte-identical across this change, so k8s-e2e.yml's second kind-ci run still converges without rolling a pod (README: "a re-run with nothing changed converges without restarting any pod").

Verification

Check Result
Reproduction, before → after id=Iv1.k8s-smoke-unused replicas=1, no warning → id='' replicas=0, warning printed
Negative test of the new assertions fails on pristine setup.sh at exactly kind inherited the kind-ci placeholder client id (#429); passes with the fix
deploy/k8s/tests/setup.test.sh 109 oks, exit 0
kind-ci settings hash across the fix byte-identical (ceb7a64…)
Real stored id still sticky Iv1.real → 1 replica, unaffected
make test-deploy-bash32 (#440) exit 0 on /bin/bash 3.2.57, 138 oks, no skips
make test-deploy only build-snapshot.test.sh fails — confirmed identical with these changes stashed (needs microVM tooling absent on macOS; CI runs it on ubuntu)
supervisor k8s manifest tests 105 passed, incl. the non-optional configMapKeyRef test
shellcheck -x -S warning, /bin/bash -n, prettier, doc links clean

The live kind-ci path is covered by k8s-e2e.yml on this PR.

Also

deploy/k8s/README.md stated inputs are sticky without exception; it now documents this one, both in the sticky-inputs list and under the CI variant.

Fixes #429

Assisted-By: Claude Code

--target kind and --target kind-ci share one Kind cluster, hence one
moca-settings. Since settings became sticky (rossoctl#427), a kind run after a
kind-ci run read the CI placeholder Iv1.k8s-smoke-unused back as if an
operator had set it: the control plane came up at 1 replica with an id
nobody can log in with, instead of 0 replicas and the "no client id"
warning. The placeholder predates stickiness, which retroactively turned
a render-time default into persisted configuration.

Name the placeholder CI_CLIENT_ID and discard it on read-back when the
target is not kind-ci, the same shape public_harness_url already uses to
drop a stored value that no longer suits the target. kind-ci re-derives
it every run, so the key stays present and non-empty (base/control-plane
.yaml refs it without optional: true, and the control plane's required()
rejects an empty value), the ConfigMap keeps its ten-key shape, and the
settings hash is byte-identical across the change -- a kind-ci re-run
still converges without rolling a pod.

Fixes rossoctl#429

Assisted-By: Claude (Anthropic AI) <[email protected]>
Signed-off-by: cwiklik <[email protected]>
@cwiklik
cwiklik requested a review from pdettori as a code owner October 29, 2026 14:50
@cwiklik cwiklik added the ready-for-ai-review Request automated AI code review from clawgenti label Oct 29, 2026

@ingpaolodettori-dev ingpaolodettori-dev left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. The placeholder is dropped only on read-back and only off kind-ci. An explicit or real stored id is unaffected. kind-ci re-derives the same string, so the settings hash and convergence are unchanged. The new kind-ci → kind → kind-ci test (no reset between runs) covers both halves, and the README documents the one exception to stickiness. CI is green, including deploy-scripts-bash32 and k8s-kind-e2e.

Author: cwiklik (MEMBER — maintainer)
Areas reviewed: Shell, Docs
Agent/IDE config (.claude/.vscode): none
Commits: 1 commit, all signed-off: yes
CI status: passing

@cwiklik
cwiklik merged commit 2a47f99 into rossoctl:main Oct 29, 2026
17 checks passed
webchang added a commit to webchang/moca that referenced this pull request Nov 2, 2026
Takes upstream's 11 commits after 071b213: gh vendored into the sandbox images (rossoctl#661), the sandbox image pulled on every run in both VM paths (rossoctl#665) and in compose (rossoctl#664), a cached login matched by endpoint (rossoctl#667), a kind-ci fix (rossoctl#663). No conflicts.

Assisted-By: Claude (Anthropic AI) <[email protected]>
Signed-off-by: Rong Chang <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ready-for-ai-review Request automated AI code review from clawgenti

Projects

None yet

Development

Successfully merging this pull request may close these issues.

deploy/k8s: kind and kind-ci share moca-settings, so kind keeps the kind-ci placeholder client id

2 participants