The machine runs one tool runtime, loading every delivered bundle (hq ADR 0175, to-be 38 WP2.3)
Where node-tools is in a node's set, the declaration ends with one process: the runtime module's own bundle, run from its one entrypoint by its language's interpreter, told in MESH_TOOL_MODULES every <module>=<file> the machine's bundles load, where its credential is (the module's own broker secret as this node places it), and — on a machine with an operator account — who the operator is, running as that account so a tool that needs root can escalate as the operator would. Restarted when any bundle it loads or the credential changes. A machine with no account runs it as root without the two operator words; a machine without the runtime is sent nothing new. A bundle says which of its entrypoints the runtime LOADS (`loads`), because one bundle may carry a daemon beside its tools and importing the daemon into the runtime would start it there; absent, a module declaring tools has every entrypoint loaded. And the TypeScript toolchain is rooted at the module, so an entrypoint lands at the path it is named by — the runtime loading bundles by their declared paths is what made the compiler's common-directory default visible.
This commit is contained in:
@@ -73,3 +73,37 @@ func TestAnAccountMayReadItsOwnMembershipAndNoOthers(t *testing.T) {
|
||||
has(t, perms.Publish, "$JS.API.DIRECT.GET.ASSIGNMENTS.mesh.assignment.anchor.postgres")
|
||||
hasNot(t, perms.Subscribe, "mesh.assignment.>")
|
||||
}
|
||||
|
||||
// The runtime arriving on a machine changes nothing about what each module is issued (to-be 38 WP2):
|
||||
// the memberships are composed as before and the runtime reads several of them. What the machine's
|
||||
// user list gains is one runtime principal, and loses nothing but the runtime module's own.
|
||||
func TestTheRuntimeArrivingLeavesEveryMembershipAsItWas(t *testing.T) {
|
||||
filter := Seat{Name: "node-packet-filter", Scope: "node", Serves: []string{"rules", "reload"}}
|
||||
three := []Declared{
|
||||
{Module: "nftables", Holds: []Seat{filter}, Serves: []string{"firewall_rules"}},
|
||||
{Module: "zsh", Serves: []string{"execute"}},
|
||||
{Module: "systemd", Serves: []string{"units"}},
|
||||
}
|
||||
before := Records{Nodes: []string{"anchor"}, Assigned: map[string][]Declared{"anchor": three}}
|
||||
after := Records{Nodes: []string{"anchor"}, Assigned: map[string][]Declared{
|
||||
"anchor": append(append([]Declared{}, three...), Declared{Module: RuntimeModule}),
|
||||
}}
|
||||
for _, d := range three {
|
||||
was := MembershipFor("anchor", d, PlacementsOf(before, nil))
|
||||
is := MembershipFor("anchor", d, PlacementsOf(after, nil))
|
||||
if !reflect.DeepEqual(was, is) {
|
||||
t.Errorf("%s's membership changed when the runtime arrived:\n%+v\n%+v", d.Module, was, is)
|
||||
}
|
||||
}
|
||||
users, err := Users(after)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
kinds := map[Kind]int{}
|
||||
for _, p := range users {
|
||||
kinds[p.Kind]++
|
||||
}
|
||||
if kinds[KindNodeTools] != 1 || kinds[KindModule] != 3 || kinds[KindNode] != 1 || kinds[KindController] != 1 {
|
||||
t.Errorf("the machine's users are %v; one runtime, the three modules, the host and the controller", kinds)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user