feat: add imperative --image source to kuke create cell (step 2) - #1305
Conversation
|
PR #1305 Review — LGTM — adds Deferred for you to run pre-merge: |
|
Heads-up for review: testing surfaced that a freshly I traced this to a pre-existing daemon bug independent of this PR: Filed as #1306 (bug, priority:B) with the full root-cause trace and fix proposal. This PR is unaffected — the daemon fix lands separately. |
|
Update: per maintainer direction, the #1306 daemon fix is now bundled into this PR (commit |
|
|
|
PR #1305 Review — LGTM — adds The unchecked |
Summary
--image <ref>(plus--command <cmd>) as a fourth source tokuke create cell, making the install onboarding commandkuke create cell my-first --image docker.io/library/alpine:3work (it previously erroredunknown flag: --image).cell.SynthesizeFromImage(cmd/kuke/create/cell/image.go, cli: add imperative --image flag to kuke run (step 1) #1244/feat: add imperative --image source to kuke run (step 1) #1287) — no re-implementation. The create-side path persists the cell stopped viaMaterializeCell(thecreateverb's materialise-without-start contract, epic:create planning: kuke create — kind coverage symmetry + scaffolding for complex kinds #814), wherekuke run --imagecreate+start+attaches viaCreateCell.--imageis mutually exclusive with--from-blueprint/--from-config/--clone(cobraMarkFlagsMutuallyExclusive); the binding render-time/override knobs--param/--param-file/--envand--command-without---imageare rejected with clear errors (parity withkuke run's flag-compat checks).scripts/install.sh+ itsdocs/site/install.shmirror to a verified, copy-pasteable sequence (create → list → start, plus thekuke run --imageone-shot alternative).docs/site/cli/kuke-create.md(sources/name-rule/flag-table/example) anddocs/cli-use-cases.md. The no-source error message now names--image; its test assertion and thedocs/cli-use-cases.mdreference were swept to match.Bundled daemon fix (#1306)
Testing surfaced that a freshly materialised cell, followed by
kuke run <cell>, failed withcell "x" is recorded Ready but its containers are gone from containerd. Root cause:provisionNewCell(internal/controller/runner/provision.go) unconditionally callsmarkCellReady, so everyMaterializeCell-materialised cell was persistedReadydespite never being started —kuke runthen read that bogusReady, found no live root task, and refused with a spurious divergence error pointing atkuke delete cell. Pre-existing and source-independent (affected--from-blueprint/--from-config/--clonetoo); the--imageflag merely exposed it, and it directly undermined this PR's AC#1 ("leaves it Stopped").Fix (
internal/controller/create_cell.go): on theMaterializeCell(don't-start) path for a freshly-created cell, persistStatus.State = Stopped(mirroringrunner.StopCell, leavingReadyObservedlatched) sokuke run <cell>reaches the Stopped→start branch andkuke get cellsreports it Stopped. Scoped towasCreatedso an existing cell's live state is never clobbered. TheCreateCell(start) path is untouched.Notes for reviewer
--commandflag added alongside--image(not strictly enumerated by the AC): the shared helperSynthesizeFromImage(image, command)already takes a command andkuke run --imageexposes--command, so adding it here keeps the two verbs symmetric. Low blast radius; rejected when--imageis absent.requires --from-blueprint, --from-config, or --clonetorequires --image, --from-blueprint, --from-config, or --clonefor accuracy now that--imageis a valid source. This touched one unit-test assertion and onedocs/cli-use-cases.mdline (both updated in this PR;git grepconfirms no other references).Test plan
make test(full CI target,GOWORK=off) — passes (exit 0), including the new controller test.cmd/kuke/create/cell/cell_test.go:TestCreateCell_FromImage_HappyPath(assertsMaterializeCellcalled with the single synthesized attachable container + "containers: not started" → AC#1 stopped-persist),_GeneratedName,_SourceMutex(AC#2),_RejectsBindingKnobs, andTestCreateCell_CommandRejectedWithoutImage. Synthesis itself is covered by the existingimage_test.go(AC#3/AC#5).internal/controller/materialize_cell_test.go:TestMaterializeCell_NewCell_SkipsStartnow asserts the materialised cell persists Stopped (not Ready) viaUpdateCellMetadata;_ExistingCell_SkipsStartasserts an existing cell's state is left untouched (bug: kuke create cell materialises the cell as Ready (not Stopped), breaking kuke run <cell> #1306 regression guards).kukebinary (make kuke) daemon-free checks:--helpshows--image/--command; source mutex rejects--image+--from-blueprintand--image+--clone;--commandwithout--imagerejected; no-source error names--image.make dev-initsmoke / daemon-parity tail — not run here: thekuke build(BuildKit) phase fails withno space left on device(/var/lib/containerdis a 4 GB tmpfs at 97% on this host). CLI + controller behavior is covered by the unit/controller tests above; recommend the reviewer run the live smoke on a host with adequate containerd storage.Closes #1245
Closes #1306