Rename mesh-control -> mesh-controller, substrate -> foundation
One name per thing, per the HQ glossary: the module/container/image/binary/repo becomes mesh-controller, the seat the-controller, and the store+broker pair the foundation (embedded base bundles, default template and example lock renamed with their go:embed directives). No behaviour change — a pure vocabulary rename. Claude-Session: https://claude.ai/code/session_01D6qtiYU3P9jk3pnAXyAFyx
This commit is contained in:
@@ -19,27 +19,27 @@ import (
|
||||
// broker and no mesh.
|
||||
const ControlPlaneID = "control-plane"
|
||||
|
||||
// TempPrefix is what the substrate's control plane is renamed with.
|
||||
// TempPrefix is what the foundation's control plane is renamed with.
|
||||
//
|
||||
// **This is the whole of how a carried resource becomes a declared one.** The substrate raises a
|
||||
// **This is the whole of how a carried resource becomes a declared one.** The foundation raises a
|
||||
// control plane and a module later declares one, and for a moment both exist — which looked like a
|
||||
// handover problem needing a way for the host to stop owning something without destroying it. It is
|
||||
// not one. The temporary control plane is called `temp-mesh-control` and the permanent one is
|
||||
// called `mesh-control`: two containers, two owners, nothing shared and nothing to hand over. At
|
||||
// not one. The temporary control plane is called `temp-mesh-controller` and the permanent one is
|
||||
// called `mesh-controller`: two containers, two owners, nothing shared and nothing to hand over. At
|
||||
// the end the temporary one is dropped from the bundle and the host removes it, which is exactly
|
||||
// what should happen to something named "temp" (novox/hq ADR 0067).
|
||||
//
|
||||
// The name is also the audit. After the pivot, a machine running `mesh-control` and not
|
||||
// `temp-mesh-control` has completed it; one running both stopped in the middle; one running only
|
||||
// The name is also the audit. After the pivot, a machine running `mesh-controller` and not
|
||||
// `temp-mesh-controller` has completed it; one running both stopped in the middle; one running only
|
||||
// the temp has not started. That is readable from `docker ps` by somebody who knows nothing else.
|
||||
const TempPrefix = "temp-"
|
||||
|
||||
// ControlPlaneModule is the module the permanent control plane is installed as, and the name its
|
||||
// container takes — the name the substrate's own control plane gives up here so that it can.
|
||||
// container takes — the name the foundation's own control plane gives up here so that it can.
|
||||
//
|
||||
// Declared beside the rename rather than beside the step that uses it, because this is where the
|
||||
// two names are decided together and where the reason for both of them is written down.
|
||||
const ControlPlaneModule = "mesh-control"
|
||||
const ControlPlaneModule = "mesh-controller"
|
||||
|
||||
// brokerAddressVar is what a token tells an enrolling node to dial.
|
||||
//
|
||||
@@ -85,11 +85,11 @@ type Rewritten struct {
|
||||
// Rewrite produces the bundle this machine will apply from the template it was given.
|
||||
//
|
||||
// **Two substitutions, and both are textual.** The control plane's image becomes the id of the image
|
||||
// this machine now holds, and its container is renamed `temp-mesh-control`; nothing else changes.
|
||||
// this machine now holds, and its container is renamed `temp-mesh-controller`; nothing else changes.
|
||||
// The rename is what makes the pivot expressible at all — see TempPrefix. Textual rather than
|
||||
// parse-and-re-serialise because
|
||||
// the produced file has to be *read* — a person getting a machine working must be able to open it,
|
||||
// see the substrate they recognise, and see exactly one thing different. Re-serialising a parsed
|
||||
// see the foundation they recognise, and see exactly one thing different. Re-serialising a parsed
|
||||
// declaration would drop every comment in the template, and those comments are where the reasons
|
||||
// live.
|
||||
//
|
||||
@@ -182,7 +182,7 @@ func Rewrite(template []byte, imageID string) (Rewritten, error) {
|
||||
if produced.Name != out.TempName {
|
||||
return Rewritten{}, fmt.Errorf(
|
||||
"the produced bundle still calls the control plane's container %q, not %q. The "+
|
||||
"permanent one is a module and takes the plain name, so a substrate that kept it "+
|
||||
"permanent one is a module and takes the plain name, so a foundation that kept it "+
|
||||
"would put two owners on one container", produced.Name, out.TempName)
|
||||
}
|
||||
|
||||
@@ -209,7 +209,7 @@ func Rewrite(template []byte, imageID string) (Rewritten, error) {
|
||||
return Rewritten{}, fmt.Errorf(
|
||||
"renaming the control plane's container also renamed %q, from %q to %q. Only the "+
|
||||
"control plane moves out of the way; every other container keeps the name the "+
|
||||
"substrate gave it", id, wasName[id], name)
|
||||
"foundation gave it", id, wasName[id], name)
|
||||
}
|
||||
sortStrings(out.Kept)
|
||||
return out, nil
|
||||
@@ -217,15 +217,15 @@ func Rewrite(template []byte, imageID string) (Rewritten, error) {
|
||||
|
||||
// renameContainer changes one container's name in the bundle's text.
|
||||
//
|
||||
// **The quoted name, not the bare word.** `mesh-control` also appears inside the image reference
|
||||
// the template carries (`…/mesh-control@sha256:…`) and could appear inside a command line; a bare
|
||||
// **The quoted name, not the bare word.** `mesh-controller` also appears inside the image reference
|
||||
// the template carries (`…/mesh-controller@sha256:…`) and could appear inside a command line; a bare
|
||||
// substitution would catch those too. What is wanted is a JSON string that IS the name, so the
|
||||
// quotes are part of what is matched — `"mesh-control"` matches the container's `name` and an
|
||||
// quotes are part of what is matched — `"mesh-controller"` matches the container's `name` and an
|
||||
// action's `in`, which are exactly the places the name means the container, and nothing else.
|
||||
//
|
||||
// It refuses when the text does not contain what the parse says is there, for the same reason the
|
||||
// image substitution does: the two would then be reading different things, and a rename that
|
||||
// replaced nothing and reported success would leave the module and the substrate fighting over one
|
||||
// replaced nothing and reported success would leave the module and the foundation fighting over one
|
||||
// container three steps later.
|
||||
func renameContainer(bundle []byte, from, to string) ([]byte, error) {
|
||||
if from == to {
|
||||
@@ -235,7 +235,7 @@ func renameContainer(bundle []byte, from, to string) ([]byte, error) {
|
||||
if bytes.Count(bundle, quoted) == 0 {
|
||||
return nil, fmt.Errorf(
|
||||
"the control plane's container is called %q according to the parsed template, and %s "+
|
||||
"is not in the file. Nothing was renamed, and the substrate would raise a "+
|
||||
"is not in the file. Nothing was renamed, and the foundation would raise a "+
|
||||
"container the module also wants", from, quoted)
|
||||
}
|
||||
return bytes.ReplaceAll(bundle, quoted, []byte(`"`+to+`"`)), nil
|
||||
@@ -257,7 +257,7 @@ func controlPlaneIn(d *declaration.Declaration) (*declaration.Container, error)
|
||||
}
|
||||
return nil, fmt.Errorf(
|
||||
"this bundle names no %q, so there is no control plane to give this machine's image to. "+
|
||||
"A substrate without one raises a store and a broker and no mesh. It declares: %s",
|
||||
"A foundation without one raises a store and a broker and no mesh. It declares: %s",
|
||||
ControlPlaneID, strings.Join(identities(d), ", "))
|
||||
}
|
||||
|
||||
@@ -316,7 +316,7 @@ func sortStrings(values []string) {
|
||||
// writeBundleFile puts the produced bundle where a person can read it, creating the directory it
|
||||
// lives in.
|
||||
//
|
||||
// 0644, and that is deliberate: this file names an image and describes a substrate, and it holds
|
||||
// 0644, and that is deliberate: this file names an image and describes a foundation, and it holds
|
||||
// the bootstrap credentials the template happens to carry — which are the same ones anybody can
|
||||
// read in the template itself. It is meant to be read. What must not be world-readable is the
|
||||
// node's identity, and that lives elsewhere and is written elsewhere (`internal/identity`).
|
||||
|
||||
Reference in New Issue
Block a user