diff --git a/modules/mesh-provisioner-client/cmd/mesh-provisioner-client/plan.go b/modules/mesh-provisioner-client/cmd/mesh-provisioner-client/plan.go index f697d7d1..84c07643 100644 --- a/modules/mesh-provisioner-client/cmd/mesh-provisioner-client/plan.go +++ b/modules/mesh-provisioner-client/cmd/mesh-provisioner-client/plan.go @@ -108,6 +108,17 @@ type PlannedProvision struct { // CredentialTool is, for a software-issued offer, the provider's tool the vault asks for the value (issue 928); // the vault acts on it and this client only reads it. CredentialTool string `json:"credential-tool,omitempty"` + // Given is what this module contributes to the provision, composed, and ConsumerAt where its machine is on the + // private network (issue 774): a provider serving from the plans alone (route-proxy) reads them; the client keeps + // them, so the plan reads whole. + Given []PlannedGiven `json:"given,omitempty"` + ConsumerAt string `json:"consumer-at,omitempty"` +} + +// PlannedGiven is one contribution of the module to a provision, composed: its local name among several, and its values. +type PlannedGiven struct { + Local string `json:"local,omitempty"` + Values map[string]any `json:"values"` } // issuedForHolder is whether the entry names a value its provider's software issued for this holder alone (issue diff --git a/modules/mesh-provisioner-client/cmd/mesh-provisioner-client/whole_plan_test.go b/modules/mesh-provisioner-client/cmd/mesh-provisioner-client/whole_plan_test.go index 1c2efa79..0402747f 100644 --- a/modules/mesh-provisioner-client/cmd/mesh-provisioner-client/whole_plan_test.go +++ b/modules/mesh-provisioner-client/cmd/mesh-provisioner-client/whole_plan_test.go @@ -9,8 +9,9 @@ import ( // A plan provision carries everything the controller's PlanProvision writes (issue 954): what the consumer // contributes, where the provider is and who the consumer is at its end (issue 788), the names the mesh calls it -// (issue 792) and, for a software-issued offer, the tool the vault asks (issue 928). The client still refuses a field -// nobody writes. +// (issue 792), for a software-issued offer, the tool the vault asks (issue 928), and what the consumer contributes, +// composed, with where its machine is (issue 774: route-proxy serves its routes from them). The client still refuses a +// field nobody writes. func TestAPlanProvisionWithEveryFieldTheControllerWritesIsRead(t *testing.T) { p, err := json.Marshal(contributor(t, "shell:zsh:normal", "alias nox=mesh-cli")) if err != nil { @@ -18,7 +19,8 @@ func TestAPlanProvisionWithEveryFieldTheControllerWritesIsRead(t *testing.T) { } provision := `"provisions":[{"provision":"route","local":"web","provider":"novox","provider-module":"route-proxy",` + `"credential-form":"pair","contributes":{"label":"git"},"at":"10.10.0.1","from":"novox","as":"gitea",` + - `"names":{"name-web":"git.example.org"}},{"name":"gitea-read","provision":"gitea-read","provider":"novox",` + + `"names":{"name-web":"git.example.org"},"given":[{"local":"web","values":{"name":"git.example.org","port":3000}}],` + + `"consumer-at":"10.10.0.2"},{"name":"gitea-read","provision":"gitea-read","provider":"novox",` + `"provider-module":"gitea","credential-form":"issued","credential-tool":"gitea_agent_token",` + `"path":"/var/lib/claude-code/gitea-read.secret"}],"items":` value := fmt.Sprintf(`{"node":"g14","module":"mesh-cli","provisioning":%s}`, @@ -29,7 +31,8 @@ func TestAPlanProvisionWithEveryFieldTheControllerWritesIsRead(t *testing.T) { } if len(got.Provisions) != 2 || got.Provisions[0].At != "10.10.0.1" || got.Provisions[0].From != "novox" || got.Provisions[0].As != "gitea" || got.Provisions[0].Names["name-web"] != "git.example.org" || - got.Provisions[1].CredentialTool != "gitea_agent_token" { + got.Provisions[1].CredentialTool != "gitea_agent_token" || len(got.Provisions[0].Given) != 1 || + got.Provisions[0].Given[0].Local != "web" || got.Provisions[0].ConsumerAt != "10.10.0.2" { t.Fatalf("the plan's provisions read as %+v", got.Provisions) } spoilt := strings.Replace(value, `"at":`, `"surprise":1,"at":`, 1)