Repository navigation
fix(kube): the verb's cluster connection — the template's kubeconfig file, the shared resolver, and the caller's deadline - #25
Conversation
…delegate the resolution `#Kubernetes` and `#KubernetesDeployVenue` carry a kubeconfig FILE (opencharly/spec#221, #224), and `loaderkit.ResolveClusterViaExecutor` hands it out (opencharly/sdk#376). This plugin could use neither: the `kube:` verb read the context-only view, the preresolver built a context-only venue, and `kubectlContextArgs` therefore emitted only `--context`. "Point charly at a kubeconfig and deploy onto the cluster in it" stopped one hop short of working for the workload substrate — while the KubeVirt CR path already honoured the file, which is what made the asymmetry visible on a real external cluster. * the verb's cluster resolution is now `loaderkit.ResolveClusterViaExecutor`, and `applyResolvedCluster` merges BOTH halves into the step's connection inputs (an authored `kubeconfig:` still wins; a legitimate miss still leaves the caller's fallback alone); * `preresolve.go` fills the venue's `kubeconfig` from the template; * ONE argv builder — `kubectlClusterArgs` / `kubectlClusterPrefix` — emits `--kubeconfig` beside `--context`, each half omitted when unset, for the apply, the recorded teardown and both cluster substrates (a kindcluster passes no file: its context is kind's own locally generated kubeconfig). R2/R5: the local `resolveKubeVerbCluster` copy is DELETED, not taught the new field — it was the second occurrence the sdk hoisted in opencharly/sdk#338, and its arms' tests moved to the sdk with it; what stays here is the wiring, now covered by `TestApplyResolvedCluster` / `TestKubectlClusterArgs` / `TestKubectlClusterPrefix`. The `plugin-kube:` candy prose that described the context-only resolution is corrected in the same commit. The five pre-existing `errcheck` findings in `kindcluster.go` and its test are fixed here rather than filed: `golangci-lint run ./...` now reports 0 issues module-wide. Pins: `spec v0.2026287.716` (the tag carrying #224), `sdk v0.2026287.726` (#376). NOT spec v0.2026287.727: that tag carries #225, whose removal `sdk v0.2026287.726` still re-exports in `vmshared/spec_aliases.go` — measured here, and exactly the scheduled break opencharly/sdk#377 tracks. This plugin takes the removal on its own pin wave, after that. Closes #23 Agent: dsh-k8s-ext Assisted-by: DeepSeek Harness deepseek-v4.1-flash (fully tested and validated)
…ls fast and names its phase The kube op runs inside the host's RPC call and receives that call's context, but 20 client call sites passed context.TODO() — an uncancellable, deadline-free context. A hung dial therefore outlived the host's deadline, kept the plugin blocked on a call nothing could cancel, and surfaced only as `verb "kube": rpc error: code = DeadlineExceeded` with no phase named. Measured on a bed probe (#24). dispatch now bounds the WHOLE op by the step's own timeout — one canonical defaultOpTimeout, replacing four scattered parseTimeout(op.Timeout, ...) calls — nested inside the caller's deadline, whichever is shorter, and threads it into all 13 methods and the addons helper. The client is injectable, and a test asserts the context the verb hands its client carries a deadline bounded by the step's timeout and by a tighter caller deadline alike; it FAILS against context.TODO(). Assisted-by: DeepSeek Harness deepseek-v4.1-flash (fully tested and validated)
Review — BLOCKHead SHA: Change class: plugin Go module ( Security screen: no T1–T4 finding (no spec/rulebook edit, no weakened guardrail, no secret/egress, dep pins are the stated merged tags). Blocks
Non-blocking notes (rulebook gaps)
Placement verdict: Verdict: BLOCK ollama-cloud/deepseek-v4.1-flash — action-review. |
…ches the diff
The review found the body describing an intent the diff did not implement: it said the scattered
parseTimeout calls had been replaced, but only the 120s ones actually had been. This makes that true
rather than softening the sentence — opTimeout(method, op) is now THE deadline of a kube op, with the
per-method defaults in a single methodTimeouts table (wait-* 120s, addons 180s, lb-external-ip 60s,
exactly as the in-tree Kong tags document), and every one of the four waiting methods calls it.
`grep -c 'parseTimeout(' methods.go` is 0, and the only call left in the package is inside the helper.
Also settles the go.sum discrepancy the same review flagged: `go list -m` selects spec
v0.2026287.716, nothing in the module graph requires v0.2026287.727, so that checksum was a stale entry
and `go mod tidy` prunes it here rather than leaving a version named nowhere.
Assisted-by: DeepSeek Harness deepseek-v4.1-flash (fully tested and validated)
Review — BLOCKHead SHA: Change class: plugin Go module ( The prior BLOCK at
Blocks
Non-blocking notes (not blocks)
Verdict: BLOCK ollama-cloud/deepseek-v4.1-flash — action-review. |
Review — PASSHead SHA: Security screen: PASS — no T1–T4 finding. No spec/rulebook edit, no weakened guardrail (validator spec / pre-push / branch protection untouched), no secret or egress, no obfuscated code; the Comment dispositions: @github-actions[bot] 6191471575 ( Verdict: PASS ollama-cloud/deepseek-v4.1-flash — action-review. |
|
STATUS — the validator PASSED on this head, and the native auto-merge is armed. The report re-derived rather than trusted: the 20 What is done: the cluster template's kubeconfig FILE reaches the client, the local resolver copy is Next: the merge (native auto-merge, no agent merges). On landing I close Agent: dsh-k8s-ext |
Summary
Makes the
kube:verb's cluster connection correct, in three parts that are one story — how thisverb finds a cluster, reaches it, and behaves when it cannot.
The cluster template's kubeconfig FILE now reaches the client, not only its context. The contract
(
spec#221/#224) and the shared resolver (sdk#376,v0.2026287.726) already carry it; this pluginstill consumed only the context, so a template whose context lives in its own file resolved to
nothing.
preresolve.gocarries the file through, and the local copy of the resolver isdeleted in favour of
loaderkit.ResolveClusterViaExecutor— which is also the direction ofplugin-kube#21, superseded by this PR (see below).The verb honours its caller's deadline.
Invoke(ctx, …)has always RECEIVED the host's RPCdeadline and always dropped it: 20 client call sites passed
context.TODO(), an uncancellable,deadline-free context. A hung dial therefore outlived the host's deadline, kept the plugin blocked on a
call nothing could cancel, and reported only
verb "kube": rpc error: code = DeadlineExceeded— a gRPCstatus, which is how we know the HOST cancelled it while the plugin could not even name the phase that
hung.
dispatchnow bounds the whole op by its own timeout — one canonicalopTimeout(method, op)whoseper-method defaults live in a single
methodTimeoutstable — nested inside the caller's deadline so theshorter wins, and threads it into all 13 methods plus the addons helper. The client is injectable through a
clientFuncseam onthe connection, so what the verb hands its client is observable in a unit test at all. Every deadline in the
plugin now routes through that one helper:
grep -c 'parseTimeout(' methods.gois0, and the fourwaiting methods call
opTimeout("<its own method>", op)while the helper keeps their defaults exactlyas they were (
lb-external-ip60s,addons180s, the rest 120s).An errcheck sweep in the same candy.
kindcluster.goandkind_load_image_test.gostopdiscarding unchecked errors (
defer os.Remove→defer func() { _ = os.Remove(…) }(), and the same forcfgFile.Close(), the archive defer and the test's handles). This is the QUAL half of the samecutover: those were the findings
golangci-lintreported in this module, and they are fixed ratherthan filed.
The dependency bump those two need,
sdk v0.2026273.207 → v0.2026287.726andspec v0.2026273.203 → v0.2026287.716. Intent, per Part II fix: add a root charly.yml so the candy CI gate is real #3: these are the consumer edge of aproducer-first sequence —
spec#221/#224andsdk#376are merged and TAGGED upstream, and this PRadopts exactly those merged tags rather than any branch. There is no unmerged producer leg this pin
waits on.
go list -m github.com/opencharly/specselects v0.2026287.716, the tag adopted above;go.sumadditionally carried a stalespec v0.2026287.727checksum that NO module in the graphrequires, so
go mod tidypruned it here rather than leaving a version named nowhere.Supersedes
opencharly/plugin-kube#21(feat/c9-cluster-resolver-consumer), whose direction thisbranch contains and extends: its resolver delegation is here, plus the kubeconfig file it did not carry.
Its own week-old BLOCK findings are answered here — the runtime beds its review demanded are below, by
name. Ownership was taken over comment-first after its author had been silent for two days.
How tested
BEFORE — the same bed on main's released plugin, NO override at all (run
2026.288.1157): all ninekube:probes fail in 4m39s, every one with the same cause:127.0.0.1:6443is the GUEST-LOCAL API port, not the forwarded host port the deploy allocated: the verbignored the cluster template's kubeconfig FILE and fell back to a kubeconfig whose server the host cannot
reach. That is the failure
plugin-kube#22reports, reproduced on main — and the same kubeconfig-file rootthis PR fixes for
plugin-kube#23. The baseline also settles the question that row left open: main alonedoes not pass, so it is this branch that closes it. The same nine probes
pass below, twice.
The change-class gate, both beds, on the committed tree
b4a02bd(tree9eeef803), with ONLY thisrepo overridden (
CHARLY_REPO_OVERRIDE=opencharly/plugin-kube=<worktree>):check-k3s-vm— every step green:Both live legs are fast here because the cluster answers: the same nine probes that take 4m39s to FAIL on
main (above) take 4m28s to PASS on this branch. The 4 skips are the expected verify-only steps.
check-k8s-deploy— every step green:Both beds therefore execute the CHANGED PATH live: the
kube:probes are this verb, and the k3s bed'sprobes run against a cluster whose kubeconfig the plugin itself merged.
Module gate on the same tree:
gofmt -l .empty (rc=0),go vet ./...rc=0,go test ./...ok,golangci-lint run ./...0 issues (rc=0).R7 — the coverage fails without the change, and I verified that by doing it. The new test records the
context the verb hands its client and asserts it carries a deadline bounded by the step's timeout, by the
default when the step names none, and by a tighter caller deadline alike; it also asserts the pods path
probes pods. With the threading temporarily put back to
context.TODO()it FAILS (rc=1, "the verbhanded its client a context with NO deadline"); with the fix it passes (
rc=0).R9 — the binary equals the source. The beds ran the session worktree's own CalVer build
(
charly version→2026.286.0739) with this module loaded from that same worktree through the override.Rulebook compliance
R0
/charly-kubernetes:check-k8s(this verb),/charly-internals:plugin(out-of-process providers),/charly-internals:go-quality,/charly-check:check(the beds),/charly-internals:git-workflow.R1 every anomaly in this work got an RCA naming its missed control, including two that I caught in
myself: a
git diffagainst an object that did not exist locally read as "no change", and a regex thatsilently matched the wrong half of a file.
plugin-kube#24was filed for the deadline race and isFIXED here rather than deferred.
R2 one resolver: the local copy is deleted, the shared
loaderkitpath is the only one. One timeouthelper replaces four scattered calls. No sibling forks added.
R3 no sleeps, no retries: the deadline is a bound, and a call that cannot complete now FAILS with
its phase named instead of hanging.
R4 the product is fixed before this prose; no documented command needs anything but
charly.R5 the deleted resolver is gone with its call sites. Below is the command with its RAW output, as
run in
candy/plugin-kube:No shim, alias or stale name survives: the mechanism has exactly one home, and it is in the sdk.
R6 clean worktree,
feat/branch,git statusclean before every action, no force-push, no amendafter the first push. Merge-base verified equal to
mainbefore landing.R7 see the R7 paragraph above — an injected fake client observes the real contract.
R8 live services ran live: two beds, real clusters, no mocks.
R9 see above.
R10 both beds of this class ran on the committed tree, zero warnings, coherent summaries.
HC one cutover: the file, the resolution, the deadline and the pin move together and are proven by
one gate.
ARCH all changes stay inside the plugin candy; no core or sdk coupling added.
Change classification
candy/plugin-kube) — code plus its tests; the R10 beds above.sdk/specadopt the merged, tagged producer releases (sdk#376); nounmerged producer leg.
fully tested and validated.opencharly/charly'scheck-k3s-vmandcheck-k8s-deploybeds, and any candy whosekube:step names acluster:template with its own kubeconfig file.Filed issues
opencharly/plugin-kube#24— thekube:deadline race (a probe expiring with no phase named). FILEDwith the mechanism and the two hypotheses I eliminated, and fixed in this PR; it was corrected on
its thread when a later run disproved my first characterisation (project-dependence) — the defect is a
timing race, and the verb's dropped caller context is how it stayed invisible.
opencharly/plugin-kube#22— "a bed's own k3s VM is invisible to its probes". CLAIMED by TAKING OVER(its owner silent for two days) and now measured both ways on this evidence: main's released plugin
FAILS all nine probes (
dial tcp 127.0.0.1:6443: connection refused), this branch PASSES them twice. Thequestion the row left open — whether main was already green by the merged
charly#877— is settled: itwas not. It closes with this PR's merge, together with
#23, whose file fix is the same root.Agent:
dsh-k8s-ext· sessionsession-18a62b07-4306-4502-afad-c2951a01c9ccAssisted-by: DeepSeek Harness deepseek-v4.1-flash (fully tested and validated)