Repository navigation
feat(schema): add the kindcluster substrate kind - #162
Conversation
Add `kindcluster` — a local Kubernetes-in-Docker cluster substrate provisioned
by the upstream `kind` tool (kubernetes-sigs/kind) — to the spec schema,
completing the CUE foundation the plugin/candy consumer legs build on.
The word is `kindcluster`, not `kind`: the bare word collides with this schema's
own `source: {kind: …}` discriminator and with kind's own `kind: Cluster` config
field.
Schema (spec/schema/):
- NEW `kindcluster.cue` — `#Kindcluster` (engine: #EngineName, node_image
digest pin, nodes topology, kubeconfig_context, default_namespace,
admission_policy, and the SAME cluster-policy sub-blocks the `kubernetes:`
template uses — storage/ingress/image_default/pod_default/defaults — plus
`#KindclusterNode` / `#KindclusterPortMapping`).
- `#KindclusterValue: (#Kindcluster | #DeployValue)` in node.cue — the host-side
value gate for template OR deploy shape.
- `#ResourceKind` += kindcluster (nesting); `#Deploy.target` += kindcluster
(the loader-DERIVED target enum); `#SubstrateKind` += kindcluster.
- `substrate_template.cue` — `#ResolvedKindcluster` + the resolve input/reply,
added to the #SubstrateTemplateResolveRequest discriminated union (mirrors the
kubernetes arm).
- `deploy.cue` — `#KindclusterDeployVenue` (cluster_name, provider, node_image,
egress-validated cluster_config, kube_context, optional workload overlay).
- `spec/status_types.go` — SubstrateKindcluster const.
The `engine` field maps 1:1 to kind's KIND_EXPERIMENTAL_PROVIDER
(podman/docker/nerdctl), so the authored #EngineName vocabulary drives engine
selection with no separate selector — the whole docker/podman/nerdctl
integration rides the existing engine word.
Generated: cue_types_gen.go / vocab_gen.go via `charly task cue-gen`
(ResourceKinds + KindValueDefs + the typed defs), reproducible.
Coverage: schema/kindcluster_test.go — the policy template, the deploy shape via
#KindclusterValue, unknown-key rejection, unknown-engine rejection, and the
shared kubernetes policy blocks.
Additive (a new enum member + new defs), so no #SchemaVersion bump and no
migration entry — matching the spec repo's precedent for additive vocabulary
growth.
Part of the kind-integration cutover; the plugin-substrate / plugin-kube /
charly-core / layer-kind consumer legs land against this tag.
Review — BLOCKHead SHA: Change class: contract-module schema + generated Go (additive), plus one hand-written Go comment change the body does not reflect. Blocks
Verdict: BLOCK ollama-cloud/deepseek-v4.1-flash — action-review. |
The kindcluster substrate-template kind must fold into the resolved-project
envelope like every other standalone-substrate kind, so the status collector and
the deploy preresolver can resolve a `from: <kindcluster>` reference.
- `#ProjectTemplates` (schema/resolvedproject.cue) += the `kindcluster` map, and
the CUE-generated `ProjectTemplates.Kindcluster` field follows.
- `spec/loadmodel.go` — the `(uf *UnifiedFile).Kindcluster()` derived accessor,
the `ProjectTemplates` projection's new arm (null-guard + fillNamespacedTemplates
copy), and `ByKind("kindcluster")`.
- `spec/loadmodel_templates_multialias_test.go` — TestProjectTemplates_KindclusterFolds.
Without this the kindcluster template bodies never reach the envelope and
`from:`-referenced kindcluster deploys fail to resolve.
Additive, no #SchemaVersion bump. Part of the kind-integration cutover.
Review — BLOCKHead SHA: Change class: contract-module schema + generated Go (additive) — plus one hand-written Go comment edit the body does not account for. Placement (B16): CORRECT — Blocks
(Minor, non-blocking: B15 — two non-changelog commits; the intended squash collapses them.) Verdict: BLOCK ollama-cloud/deepseek-v4.1-flash — action-review. |
The validator (B18) caught that `schema/kindcluster.cue`'s `node_image` and `kubeconfig_context` fields lacked the `@go(...)` overrides every sibling field uses, so gengotypes emitted non-idiomatic snake_case Go field names (`Node_image`, `Kubeconfig_context`). Add `@go(NodeImage)` / `@go(KubeconfigContext)` (and the remaining explicit tags for the def's other fields) and re-run `charly task cue-gen`. Verified: `grep -c 'Node_image\|Kubeconfig_context' spec/cue_types_gen.go` is now 0; `grep -c 'NodeImage\|KubeconfigContext'` is 8. `schema/` + `spec/` tests green.
Review — BLOCKHead SHA: Change class: contract-module schema (CUE) + generated Go ( Placement (B16): CORRECT — Blocks
Comment dispositions
Verdict: BLOCK ollama-cloud/deepseek-v4.1-flash — action-review. |
Review — PASSHead SHA: Change class: contract-module schema (CUE) + generated Go + hand-written Go support ( Security screen: PASS — no scope mismatch (all 13 files accounted for in the body), no secrets/egress, no weakened guardrail, no supply-chain edit. Checklist: All applicable rules PASS or NA — A1 (body accounts for every file incl. Comment dispositions (all prior heads are stale; every raised finding is resolved in the current state):
Verdict: PASS ollama-cloud/deepseek-v4.1-flash — action-review. |
main added kindcluster as a 6th substrate kind (#162) after this branch opened; kubevirt becomes the 7th. Resolved: - node.cue #ResourceKind: both kindcluster + kubevirt. - resolvedproject.cue / status_types.go: both template maps + both status consts. - cue_types_gen.go / vocab_gen.go: regenerated (not hand-merged). Both kind value defs (#KindclusterValue, #KubevirtValue) coexist.
Summary of changes
Add
kindcluster— a local Kubernetes-in-Docker cluster substrate provisioned bythe upstream kind tool (kubernetes-sigs/kind v0.33.0) — to the
specschema,completing the SDD foundation the plugin-substrate / plugin-kube / charly-core /
layer-kind consumer legs build against.
The word is
kindcluster, notkind: the bare word collides with thisschema's own
source: {kind: …}discriminator and with kind's ownkind: Clusterconfig field.Every file in the diff:
schema/kindcluster.cue(new)#Kindcluster,#KindclusterNode,#KindclusterPortMappingschema/node.cue#ResourceKind+= kindcluster;#KindclusterValue; "5 substrates" comment sweepschema/deploy.cue#Deploy.target+= kindcluster; NEW#KindclusterDeployVenueschema/status.cue#SubstrateKind+= kindcluster; comment sweepsschema/substrate_template.cue#ResolvedKindcluster+ resolve input/reply + union armschema/resolvedproject.cue#ProjectTemplates+= thekindclustermapdeploy/deploy_ops.gopod|vm|kubernetes|local|android→…|kindcluster)spec/status_types.goSubstrateKindclusterconstspec/loadmodel.goKindcluster()accessor; the projection's arm;ByKind("kindcluster")spec/{cue_types_gen.go,vocab_gen.go}charly task cue-gen)schema/kindcluster_test.go,spec/loadmodel_templates_multialias_test.goSchema surface
#Kindcluster:engine?: #EngineName— the container engine kind provisions node containerswith. It maps 1:1 to kind's
KIND_EXPERIMENTAL_PROVIDER(
podman/docker/nerdctl), so engine selection rides the authored#EngineNamevocabulary with no separate selector. This is what makes thedocker/podman/nerdctl integration free.
node_image?: string— the digest-pinnedkindest/node:vX@sha256:….nodes?: [...#KindclusterNode]— topology (role, per-nodeimage,extra_port_mappings).kubeconfig_context,default_namespace,admission_policy, and the SAMEcluster-policy sub-blocks the
kubernetes:template uses(
storage/ingress/image_default/pod_default/defaults) — R3, onepolicy surface for both cluster kinds.
#KindclusterValue: (#Kindcluster | #DeployValue)— the host-side value gatefor template OR deploy shape.
RDD (why this shape)
All high-risk unknowns were proven live on this host before the schema was
written: kind works on
docker(Ready in 16 s), rootlesspodman(13 s), androotless
nerdctl(16 s, aftercontainerd-rootless-setuptool.sh install); theengine word is exactly
KIND_EXPERIMENTAL_PROVIDER;kube: addonsis k3s-only(kind ships kindnet, no Traefik/ServiceLB). Full evidence in the umbrella
plan/kind-integration.md.How R10-tested — exact gate, commands, and pasted output
Gate for this change class (contract module):
charly task cue-genreproducibility +
go build ./...+go test ./...+ the new tests that failwithout the change.
The changed path executes live in the new tests:
Generated artifacts verified:
ResourceKinds+=kindcluster,KindValueDefs["kindcluster"] = "#KindclusterValue", and the typedKindcluster/
KindclusterNode/KindclusterDeployVenue/ResolvedKindcluster/KindclusterResolveInput/KindclusterResolveReplystructs are present.R5 stale-reference sweep — executed evidence
Both survivors are accounted for:
status.cue:101is now the updated…/android/kindclusterlist;version.cue:71is a HISTORICAL sentence inside the#SchemaVersionchangelog comment describing the PAST group-removal cutover("pod/vm/kubernetes/local/android remain" at that cutover, before kindcluster
existed) — accurate as history, not a live claim. No live
5 substratesclaimsurvives.
B18 fix — idiomatic generated field names
Rulebook compliance
charly task cue-gen; regeneration reproducible.kubernetes:template's own#Kubernetes*defs; the resolve/deploy-venue wire types mirror the kubernetesarm rather than inventing a parallel shape.
accounted-for survivors are pasted above.
defs), matching this repo's precedent (feat(spec): per-invocation RunEnv — retire bed os.Setenv isolation #159, feat(schema): add CliRequest.env + ProvidedCapability.interactive #154) — no cutover, no migration
entry.
Change classification
hand-written Go in three places —
deploy/deploy_ops.go(a comment update tothe canonical target list),
spec/status_types.go(theSubstrateKindclusterconst, mirroring the sibling consts), and
spec/loadmodel.go(theKindcluster()accessor + projection arm +ByKindcase, mirroring thekubernetes arm).
charly task cue-gen(reproducible) +go build ./...+go test ./...+ the new schema and loadmodel tests.fully tested and validated— every applicable standardfor a contract module passed on the final tree, and the changed paths (the new
CUE defs, the projection arm) executed live under the new tests.
Attribution evidence (A3)
The authoring runtime registers this model as provider
ollama-cloud, model iddeepseek-v4.1-flash, canonical nameDeepSeek V4.1 Flash(queried from theruntime's own model registry):
The harness is
OpenCode. The footer footer therefore names the exactharness/provider/model string.
Assisted-by: OpenCode DeepSeek V4.1 Flash (fully tested and validated)