From 778dadf92af837eaefa5aee848cb865693abc18e Mon Sep 17 00:00:00 2001 From: Dominik Schmidle Date: Wed, 25 Nov 2026 16:47:01 +0100 Subject: [PATCH 01/56] feat(helm): add the governance value and render muster's governance configuration governance (trusted, the default, or governed) is the platform's governance mode for tool calls (giantswarm/giantswarm#38902). The meta chart renders it into the muster release as muster.governance (the mode and the servers muster treats as agent-manager and the Platform Manager) from the muster release that reads it (agent-platform.muster.governanceFloor), and holds it back from the connectivity release. An unknown mode or an own muster mode that differs fails the render. The values document muster's mcpserver-editor binding as the connector-admin role. --- helm/agent-platform/templates/_helpers.tpl | 61 ++++++ helm/agent-platform/values.schema.json | 8 + helm/agent-platform/values.yaml | 57 ++++- tests/verify-tool-approval.py | 241 +++++++++++++++++++++ 4 files changed, 359 insertions(+), 8 deletions(-) create mode 100755 tests/verify-tool-approval.py diff --git a/helm/agent-platform/templates/_helpers.tpl b/helm/agent-platform/templates/_helpers.tpl index 66ba92f0..be9a2d72 100644 --- a/helm/agent-platform/templates/_helpers.tpl +++ b/helm/agent-platform/templates/_helpers.tpl @@ -1062,6 +1062,13 @@ repeating the admin groups. */ -}} {{- $muster := get $derived "muster" | default dict -}} {{- $_ := set $derived "muster" (mergeOverwrite $muster (dict "toolsetPresets" .)) -}} {{- end -}} +{{- /* muster's governance configuration from the platform's governance mode +(agent-platform.muster.governance), from the muster floor that reads it. */ -}} +{{- with (include "agent-platform.muster.governance" .root | fromJson) -}} +{{- $muster := get $derived "muster" | default dict -}} +{{- $_ := set $muster "governance" . -}} +{{- $_ := set $derived "muster" $muster -}} +{{- end -}} {{- end -}} {{- if and (eq .name "model-manager") (not (include "agent-platform.componentEnabled" (dict "root" .root "name" "kagent"))) -}} {{- $_ := set $derived "kagent" (dict "disableWiring" true) -}} @@ -4737,6 +4744,60 @@ comment inside the define. */}} {{- define "agent-platform.muster.presetIconsFloor" -}}5.61.0{{- end -}} +{{/* +The first muster release that reads the governance configuration +(muster.governance: the mode and the servers it names per role) and enforces +tool approval (Governing tool calls, slice 2 of giantswarm/giantswarm#38902). +UNRELEASED: a placeholder for the release that carries it; below it the meta +chart forwards no governance block, which an older muster chart's closed +schema would refuse. One line, no comment inside the define. +*/}} +{{- define "agent-platform.muster.governanceFloor" -}}5.65.0{{- end -}} + +{{/* +The platform's governance mode (top-level `governance`: trusted, the default, +or governed), validated: anything else fails the render naming the key. +Usage: include "agent-platform.governance" $root +*/}} +{{- define "agent-platform.governance" -}} +{{- $mode := toString (.Values.governance | default "trusted") -}} +{{- if not (has $mode (list "trusted" "governed")) -}} +{{- fail (printf "governance %q: want trusted or governed (Governing tool calls: trusted lets agents create and start agents freely, governed asks a person first)" $mode) -}} +{{- end -}} +{{- $mode -}} +{{- end -}} + +{{/* +muster's governance configuration (Governing tool calls, +giantswarm/giantswarm#38902), rendered from the platform's governance mode: +`mode` (governance) and `servers`, the MCPServer names muster treats as each +role's: agentManager (agent-manager.muster.mcpServer.name, default +agent-manager) and platformManager (giantswarm-platform-manager, the Platform +Manager's registration). The floors are built into muster; this configuration +only adds the governed entries and tells muster which servers offer the names +it matches. An own muster.muster.governance.servers. stands; an own +mode that differs from `governance` fails (single source). Only from the +muster floor agent-platform.muster.governanceFloor; {} below it. +Usage: include "agent-platform.muster.governance" $root | fromJson +*/}} +{{- define "agent-platform.muster.governance" -}} +{{- $mode := include "agent-platform.governance" . -}} +{{- $out := dict -}} +{{- if include "agent-platform.componentFloorAtLeast" (dict "root" . "name" "muster" "version" (include "agent-platform.muster.governanceFloor" .)) -}} +{{- $own := dig "muster" "governance" dict (.Values.muster | default dict) | default dict -}} +{{- with $own.mode -}} +{{- if ne (toString .) $mode -}} +{{- fail (printf "muster.muster.governance.mode (%v) differs from governance (%s): the platform's governance mode is the top-level governance value; leave muster.muster.governance.mode unset" . $mode) -}} +{{- end -}} +{{- end -}} +{{- $amName := dig "muster" "mcpServer" "name" "agent-manager" (index .Values "agent-manager" | default dict) -}} +{{- $servers := dict "agentManager" (list $amName) "platformManager" (list "giantswarm-platform-manager") -}} +{{- $servers = mergeOverwrite $servers ($own.servers | default dict) -}} +{{- $out = dict "mode" $mode "servers" $servers -}} +{{- end -}} +{{- $out | toJson -}} +{{- end -}} + {{/* Icons of the shipped presets (infrastructure, agent-platform), for each one muster.muster.toolsetPresets still defines and leaves without an icon, while diff --git a/helm/agent-platform/values.schema.json b/helm/agent-platform/values.schema.json index d0af32aa..b7b31465 100644 --- a/helm/agent-platform/values.schema.json +++ b/helm/agent-platform/values.schema.json @@ -2164,6 +2164,14 @@ "type": "object", "additionalProperties": true }, + "governance": { + "type": "string", + "description": "The platform's governance mode: trusted (the default) or governed. It changes no tool approval setting's meaning; it adds asking for agent callers. Governed asks a person before an agent creates an agent (agent-manager's create_agent), changes an agent's tools (update_agent_access), starts another agent (start_session) or pauses a connector, and the Dev Portal's connector wizard pre-selects the Recommended preset (read-only tools run, the rest ask); trusted lets agents do those freely and pre-selects Allow all. In both modes muster's built-in floors ask a person before an agent adds or repoints a connector, changes approval settings, gives an agent an exception or changes muster's own configuration. The meta chart renders muster's governance configuration from it (muster.governance: the mode, and the servers muster treats as agent-manager and the Platform Manager), from the muster release that reads it (agent-platform.muster.governanceFloor); an earlier muster gets none and asks nothing. Only admins switch it, through the Platform Manager with a second person's approval; never an agent. Anything else fails the render. Concept: https://docs.giantswarm.io/overview/agent-platform/governing-tool-calls/", + "enum": [ + "trusted", + "governed" + ] + }, "gpu-operator": { "type": "object", "additionalProperties": true diff --git a/helm/agent-platform/values.yaml b/helm/agent-platform/values.yaml index 847ccb9f..a6c22d0d 100644 --- a/helm/agent-platform/values.yaml +++ b/helm/agent-platform/values.yaml @@ -1815,6 +1815,10 @@ components: # @schema additionalProperties: true # The flux-engine subchart's values are the engine's, not wiring: never # forwarded (Helm coalesces the subchart's defaults into this block). - flux-engine + # The governance mode is read by the meta chart alone: it reaches muster + # as its governance configuration (agent-platform.muster.governance); + # no wiring of the connectivity chart reads it. + - governance # Read by the meta chart alone (merged into the four components' own # scheduling knobs before their releases render, agent-platform.scheduling.apply); # the connectivity chart never sees it. @@ -2724,14 +2728,25 @@ muster: # @schema skipProperties: true; additionalProperties: true crds: install: false # Who may register MCPServers and author Workflows through muster's - # writes-as-caller path. The muster sub-chart defaults both editor - # RoleBindings to system:authenticated (single-team fit); on a shared - # platform MC every registered server and authored workflow is visible to - # and routed through by other users, so the umbrella narrows both bindings - # explicitly to the Giant Swarm admin groups (the same groups the config - # default layer feeds rbac-operator as oidc.giantswarm.write_all_group/ - # _groups). Installations wanting customer self-service widen subjects via - # their gitops values. + # writes-as-caller path. On a shared platform MC every registered server + # and authored workflow is visible to and routed through by other users, + # so the umbrella binds both editor Roles explicitly to the Giant Swarm + # admin groups (the same groups the config default layer feeds + # rbac-operator as oidc.giantswarm.write_all_group/_groups); the meta + # chart appends tenants.platformTeam to both. Installations wanting + # customer self-service widen subjects via their gitops values. + # + # mcpServerEditor is the platform's connector-admin role (Governing tool + # calls, https://docs.giantswarm.io/overview/agent-platform/governing-tool-calls/): + # whoever holds muster's mcpserver-editor Role in muster's namespace edits + # every connector there, sets its tool approval (MCPServer spec.approval: + # Allow, Ask or Block per tool, and the rule new tools follow) and is the + # only one who may let an agent run a tool the connector asks for. Its + # subjects are the connector admins: by default the Giant Swarm admin + # groups plus tenants.platformTeam. The muster chart itself binds nobody by + # default (it bound system:authenticated before), so this list is what + # keeps connector admins on an upgrade; binding system:authenticated makes + # everyone a connector admin. rbac: mcpServerEditor: subjects: @@ -4076,6 +4091,12 @@ kagent: # @schema skipProperties: true; additionalProperties: true # The line the Dev Portal shows under the server's name (the MCPServer's # spec.description, at most 500 characters); empty renders none. description: "Your agent sessions on this installation, as the signed-in person: list them, send one a message, and checkpoint or fork them" + # The connector's tool approval (the MCPServer's spec.approval) is + # approval: its default, the Allow all preset written out for every tool + # of the kagent line, is the connectivity chart's + # (kagent.controllerRoute.mcp.approval there, which says why); set it here + # to tighten a tool (Ask or Block). Governing tool calls: + # https://docs.giantswarm.io/overview/agent-platform/governing-tool-calls/ # The first of the controller's two authentication layers, on by default # (docs/authentication.md, "The kagent controller route"). Renders an # AgentgatewayPolicy on the GRPCRoute (plus a static AgentgatewayBackend for @@ -5777,6 +5798,26 @@ clusterManager: # @schema skipProperties: true; additionalProperties: true # sessions.api.kagent.dev cluster-wide (the ClusterRole # agent-platform:workspace-manager-sessions): the manager lists every creator's # Sessions for the session directories' cleanup, which no tenant role grants. +# === Governance mode (Governing tool calls, giantswarm/giantswarm#38902) === +# -- The platform's governance mode: trusted (the default) or governed. It +# changes no tool approval setting's meaning; it adds asking for agent +# callers. Governed asks a person before an agent creates an agent +# (agent-manager's create_agent), changes an agent's tools +# (update_agent_access), starts another agent (start_session) or pauses a +# connector, and the Dev Portal's connector wizard pre-selects the +# Recommended preset (read-only tools run, the rest ask); trusted lets agents +# do those freely and pre-selects Allow all. In both modes muster's built-in +# floors ask a person before an agent adds or repoints a connector, changes +# approval settings, gives an agent an exception or changes muster's own +# configuration. The meta chart renders muster's governance configuration +# from it (muster.governance: the mode, and the servers muster treats as +# agent-manager and the Platform Manager), from the muster release that reads +# it (agent-platform.muster.governanceFloor); an earlier muster gets none and +# asks nothing. Only admins switch it, through the Platform Manager with a +# second person's approval; never an agent. Anything else fails the render. +# Concept: https://docs.giantswarm.io/overview/agent-platform/governing-tool-calls/ +governance: trusted # @schema enum: [trusted, governed] + tenants: platform: # -- Every signed-in person: bound to agent-platform:platform-user in the diff --git a/tests/verify-tool-approval.py b/tests/verify-tool-approval.py new file mode 100755 index 00000000..644c38f2 --- /dev/null +++ b/tests/verify-tool-approval.py @@ -0,0 +1,241 @@ +#!/usr/bin/env python3 +"""Assert the platform side of Governing tool calls (giantswarm/giantswarm#38902, slice 7). + +- governance: the meta chart renders muster's governance configuration into the + muster release (muster.governance) from the top-level `governance` value, from + the muster floor that reads it (agent-platform.muster.governanceFloor): mode + trusted by default, governed when set; servers agentManager (following + agent-manager.muster.mcpServer.name) and platformManager + (giantswarm-platform-manager); an own servers entry stands; an own mode that + differs fails naming both keys; an unknown mode fails in the schema and, past + it, in the template; below the floor nothing is forwarded. +- connector-admin: muster's mcpserver-editor Role (the platform's + connector-admin role) is bound to the configured groups: the Giant Swarm admin + groups by default, tenants.platformTeam appended, an installation's own list + standing. +- muster-approval-binder: the connectivity release binds muster's Role + muster-approval-binder to agent-manager's ServiceAccount and nothing else (one + subject, its name following agent-manager.serviceAccount.name), in muster's + namespace; none with agent-manager off or muster off. +- approval: every MCPServer the connectivity chart renders carries explicit + settings: mcp-kubernetes the Recommended preset (rule Ask, reads Allow, writes + Ask), kagent's session tools the Allow all preset (rule Allow, every tool + Allow); a per-tool override reaches spec.approval, null renders none, a value + outside the CRD's enums, an unknown key fails naming the key. + +Stdlib only (the CI image has no PyYAML): documents are matched by text. + +Usage: verify-tool-approval.py +""" +from __future__ import annotations + +import os +import subprocess +import sys + +HELM = os.environ.get("HELM", "helm") +FLOOR_RANGE = "components.muster.versionRange=>=5.65.0 <6.0.0-0" +META = ["--set", "components.flux.enabled=false"] +CONN = [ + "--namespace", "agent-platform", + "--set", "ingress.parentRefs[0].name=x", + "--set", "kagent.harness.snapshotLocation=s3://ci-agent-snapshots/agents", + "--set", "kagent.database.postgres.urlFile=/etc/kagent-db/uri", + "--set", "global.domain=ci.example.com", + "--set", "global.identity.issuerUrl=https://dex.ci.example.com", + "--set", "global.identity.clientId=platform", + "--set", "global.identity.existingSecret=platform-oauth", + "--set", "gateway.jwksEgress.enabled=true", + "--set", "components.kagent.enabled=true", + "--set", "components.agentgateway.enabled=true", +] +AGENT_MANAGER = ["--set", "components.agent-manager.enabled=true"] +KAGENT_MCP = ["--set", "kagent.controllerRoute.enabled=true"] +MCPK = ["--set", "components.mcp-kubernetes.enabled=true"] + + +def fail(msg: str) -> None: + sys.exit(f"FAIL: {msg}") + + +def render(chart: str, args: list[str], expect_fail: bool = False) -> str: + r = subprocess.run([HELM, "template", "t", chart, *args], capture_output=True, text=True) + if expect_fail: + if r.returncode == 0: + fail(f"render with {args} succeeded, want a failure") + return r.stderr + if r.returncode != 0: + fail(f"render with {args} failed:\n{r.stderr}") + return r.stdout + + +def docs(out: str) -> list[str]: + return [d for d in ("\n" + out).split("\n---\n") if d.strip()] + + +def doc(out: str, kind: str, name: str) -> str | None: + found = [d for d in docs(out) if f"\nkind: {kind}\n" in "\n" + d and f"\n name: {name}\n" in d] + if len(found) > 1: + fail(f"{len(found)} {kind} {name}, want at most one") + return found[0] if found else None + + +def block(text: str, header: str) -> str: + """The lines of `header` and everything indented deeper below it.""" + lines = text.split("\n") + for i, line in enumerate(lines): + if line.rstrip() == header.rstrip(): + indent = len(line) - len(line.lstrip()) + out = [line] + for nxt in lines[i + 1:]: + if nxt.strip() and len(nxt) - len(nxt.lstrip()) <= indent and not nxt.lstrip().startswith("- "): + break + if nxt.strip() and len(nxt) - len(nxt.lstrip()) < indent: + break + out.append(nxt) + return "\n".join(out) + return "" + + +def muster_release(args: list[str]) -> str: + hr = doc(render_meta(args), "HelmRelease", "muster") + if hr is None: + fail(f"no muster HelmRelease with {args}") + return hr + + +def render_meta(args: list[str]) -> str: + return render(META_DIR, META + args) + + +def governance(meta_args: list[str]) -> str: + return block(muster_release(meta_args), " governance:") + + +def check_governance() -> None: + trusted = governance(["--set", FLOOR_RANGE]) + want = "\n".join([ + " governance:", + " mode: trusted", + " servers:", + " agentManager:", + " - agent-manager", + " platformManager:", + " - giantswarm-platform-manager", + ]) + if trusted.rstrip() != want: + fail(f"default governance, want:\n{want}\ngot:\n{trusted}") + governed = governance(["--set", FLOOR_RANGE, "--set", "governance=governed", "--set", "agent-manager.muster.mcpServer.name=agents"]) + if "mode: governed" not in governed or " - agents" not in governed: + fail(f"governed with a renamed agent-manager server:\n{governed}") + own = governance(["--set", FLOOR_RANGE, "--set", "muster.muster.governance.servers.platformManager[0]=pm"]) + if " - pm" not in own or "giantswarm-platform-manager" in own: + fail(f"an own platformManager entry must stand:\n{own}") + if governance([]): + fail("below the muster floor the muster release must carry no governance block") + err = render(META_DIR, META + ["--set", "governance=open"], expect_fail=True) + if "governance" not in err: + fail(f"an unknown mode must fail in the schema naming governance:\n{err}") + err = render(META_DIR, META + ["--set", "governance=open", "--skip-schema-validation"], expect_fail=True) + if 'governance "open": want trusted or governed' not in err: + fail(f"an unknown mode must fail in the template naming governance:\n{err}") + err = render(META_DIR, META + ["--set", FLOOR_RANGE, "--set", "muster.muster.governance.mode=governed"], expect_fail=True) + if "muster.muster.governance.mode (governed) differs from governance (trusted)" not in err: + fail(f"an own mode that differs must fail naming both keys:\n{err}") + connectivity = doc(render_meta([]), "HelmRelease", "agent-platform-connectivity") + if connectivity and "\n governance:" in connectivity: + fail("governance must not reach the connectivity release (omitKeys)") + print("ok: governance renders muster's governance configuration (trusted by default, governed, servers, own entries), none below the floor, unknown and conflicting modes fail") + + +def check_connector_admin() -> None: + editor = block(muster_release([]), " mcpServerEditor:") + for group in ("giantswarm-ad:giantswarm-admins", "giantswarm-github:giantswarm:giantswarm-admins"): + if f"name: {group}" not in editor: + fail(f"connector admins by default must include {group}:\n{editor}") + if "system:authenticated" in editor: + fail(f"connector admins must not default to everyone:\n{editor}") + team = block(muster_release(["--set", "tenants.platformTeam[0].kind=Group", "--set", "tenants.platformTeam[0].name=customer:platform"]), " mcpServerEditor:") + if "name: customer:platform" not in team or "giantswarm-ad:giantswarm-admins" not in team: + fail(f"tenants.platformTeam must be appended to the connector admins:\n{team}") + own = block(muster_release(["--set", "muster.rbac.mcpServerEditor.subjects[0].kind=Group", "--set", "muster.rbac.mcpServerEditor.subjects[0].name=ops"]), " mcpServerEditor:") + if "name: ops" not in own or "giantswarm-ad:giantswarm-admins" in own: + fail(f"an installation's own connector admins must stand:\n{own}") + print("ok: the connector-admin role (muster's mcpserver-editor) binds the Giant Swarm admin groups plus tenants.platformTeam, an own list standing") + + +def check_binder() -> None: + out = render(CONN_DIR, CONN + AGENT_MANAGER) + rb = doc(out, "RoleBinding", "agent-platform:muster-approval-binder") + if rb is None: + fail("no RoleBinding agent-platform:muster-approval-binder with agent-manager on") + for want in ("\n namespace: agent-platform\n", "\nroleRef:\n apiGroup: rbac.authorization.k8s.io\n kind: Role\n name: muster-approval-binder\n"): + if want not in rb: + fail(f"binder RoleBinding lacks {want!r}:\n{rb}") + subjects = block(rb, "subjects:") + if subjects.count("- kind:") != 1 or "kind: ServiceAccount" not in subjects or "name: agent-manager\n" not in subjects + "\n" or "namespace: agent-platform" not in subjects: + fail(f"binder must bind agent-manager's ServiceAccount only:\n{subjects}") + if "muster-approval-binder" in "".join(d for d in docs(out) if "\nkind: Role\n" in "\n" + d or "\nkind: ClusterRoleBinding\n" in "\n" + d): + fail("the connectivity chart must not ship the binder Role itself (the muster chart does) or bind it cluster-wide") + renamed = doc(render(CONN_DIR, CONN + AGENT_MANAGER + ["--set", "agent-manager.serviceAccount.name=am-sa"]), "RoleBinding", "agent-platform:muster-approval-binder") + if renamed is None or "name: am-sa" not in renamed: + fail(f"binder must follow agent-manager.serviceAccount.name:\n{renamed}") + if doc(render(CONN_DIR, CONN), "RoleBinding", "agent-platform:muster-approval-binder"): + fail("binder RoleBinding with agent-manager off") + off = render(CONN_DIR, CONN + AGENT_MANAGER + ["--set", "components.muster.enabled=false", "--set", "agent-manager.muster.mcpServer.enabled=false"]) + if doc(off, "RoleBinding", "agent-platform:muster-approval-binder"): + fail("binder RoleBinding with muster off") + print("ok: muster-approval-binder is bound to agent-manager's ServiceAccount only, in muster's namespace; none with agent-manager or muster off") + + +def approval_of(out: str, name: str) -> str: + cr = doc(out, "MCPServer", name) + if cr is None: + fail(f"no MCPServer {name}") + return block(cr, " approval:") + + +def check_approval() -> None: + mcpk = approval_of(render(CONN_DIR, CONN + MCPK), "mcp-kubernetes") + if " rule: Ask" not in mcpk: + fail(f"mcp-kubernetes: want the Recommended rule Ask:\n{mcpk}") + for tool in ("get", "list", "describe", "logs", "can_i", "capi_list_clusters"): + if f" {tool}: Allow" not in mcpk: + fail(f"mcp-kubernetes: read-only {tool} must be Allow:\n{mcpk}") + for tool in ("create", "apply", "delete", "patch", "scale", "exec", "port_forward"): + if f" {tool}: Ask" not in mcpk: + fail(f"mcp-kubernetes: mutating {tool} must be Ask:\n{mcpk}") + if "Block" in mcpk: + fail("mcp-kubernetes: the default blocks nothing") + kagent = approval_of(render(CONN_DIR, CONN + KAGENT_MCP), "kagent") + if " rule: Allow" not in kagent or "Ask" in kagent or "Block" in kagent: + fail(f"kagent: want the Allow all preset:\n{kagent}") + for tool in ("list_sessions", "invoke_session", "fork_session", "write_sandbox_file"): + if f" {tool}: Allow" not in kagent: + fail(f"kagent: {tool} must be listed Allow:\n{kagent}") + tightened = approval_of(render(CONN_DIR, CONN + MCPK + ["--set", "mcp-kubernetes.mcpServer.approval.tools.exec=Block", "--set", "mcp-kubernetes.mcpServer.managementCluster=lab"]), "lab-mcp-kubernetes") + if " exec: Block" not in tightened: + fail(f"a per-tool override must reach spec.approval of the family member:\n{tightened}") + cleared = render(CONN_DIR, CONN + MCPK + ["--set-json", "mcp-kubernetes.mcpServer.approval=null"]) + if approval_of(cleared, "mcp-kubernetes"): + fail("approval null must render no spec.approval") + for args, want in ( + (["--set", "mcp-kubernetes.mcpServer.approval.rule=Block"], 'mcp-kubernetes.mcpServer.approval.rule "Block": want Allow or Ask'), + (["--set", "mcp-kubernetes.mcpServer.approval.tools.get=Deny"], 'mcp-kubernetes.mcpServer.approval.tools.get "Deny": want Allow, Ask or Block'), + (["--set", "mcp-kubernetes.mcpServer.approval.preset=recommended"], "mcp-kubernetes.mcpServer.approval.preset: unknown key"), + ): + err = render(CONN_DIR, CONN + MCPK + args, expect_fail=True) + if want not in err: + fail(f"{args}: want {want!r}, got:\n{err}") + err = render(CONN_DIR, CONN + KAGENT_MCP + ["--set", "kagent.controllerRoute.mcp.approval.tools.invoke_session=never"], expect_fail=True) + if "kagent.controllerRoute.mcp.approval.tools.invoke_session" not in err: + fail(f"kagent: an invalid value must fail naming the key:\n{err}") + print("ok: mcp-kubernetes carries the Recommended settings, kagent the Allow all settings, overrides reach spec.approval, null renders none, invalid values fail naming the key") + + +if __name__ == "__main__": + META_DIR, CONN_DIR = sys.argv[1], sys.argv[2] + check_governance() + check_connector_admin() + check_binder() + check_approval() From daaf080ebf64ad6fe2eb4b88da3beca00715b0fa Mon Sep 17 00:00:00 2001 From: Dominik Schmidle Date: Wed, 25 Nov 2026 16:47:01 +0100 Subject: [PATCH 02/56] feat(helm): set explicit tool approval on the connectivity chart's MCPServers mcp-kubernetes ships the Recommended settings (read-only tools Allow, the rest Ask, rule Ask), kagent's session tools Allow all (rule Allow, every tool Allow), each a value (mcp-kubernetes.mcpServer.approval, kagent.controllerRoute.mcp.approval) rendered as spec.approval and validated against the CRD's enums, failing naming the key. --- .../templates/_helpers.tpl | 42 +++++++++++ .../templates/kagent/mcpserver.yaml | 6 +- .../templates/mcp-kubernetes/mcpserver.yaml | 7 +- helm/agent-platform-connectivity/values.yaml | 72 +++++++++++++++++++ 4 files changed, 125 insertions(+), 2 deletions(-) diff --git a/helm/agent-platform-connectivity/templates/_helpers.tpl b/helm/agent-platform-connectivity/templates/_helpers.tpl index ef3d26fe..4c37590d 100644 --- a/helm/agent-platform-connectivity/templates/_helpers.tpl +++ b/helm/agent-platform-connectivity/templates/_helpers.tpl @@ -2558,3 +2558,45 @@ string, so `with` gates a caller's comment). Include with nindent under {{- include "agent-platform.otlpEgressRule" (dict "target" $t "who" "kagent's exporters send to") -}} {{- end }} {{- end -}} + +{{/* +An MCPServer's spec.approval from a values block (Governing tool calls, +giantswarm/giantswarm#38902), validated the way the CRD's CEL rules check it so +a wrong value fails the render naming the key: `rule` Allow or Ask, `tools` a +map of at most 512 tool names to Allow, Ask or Block, nothing else. Renders the +`approval:` block at two spaces of indentation, nothing for an empty or null +block. +Usage: include "agent-platform.mcpServerApproval" (dict "approval" $block "key" "") +*/}} +{{- define "agent-platform.mcpServerApproval" -}} +{{- $a := .approval | default dict -}} +{{- if $a -}} +{{- if not (kindIs "map" $a) -}} +{{- fail (printf "%s: want a map with rule and tools" .key) -}} +{{- end -}} +{{- range $k, $_ := $a -}} +{{- if not (has $k (list "rule" "tools")) -}} +{{- fail (printf "%s.%s: unknown key, want rule or tools" $.key $k) -}} +{{- end -}} +{{- end -}} +{{- if hasKey $a "rule" -}} +{{- if not (has (toString $a.rule) (list "Allow" "Ask")) -}} +{{- fail (printf "%s.rule %q: want Allow or Ask" .key (toString $a.rule)) -}} +{{- end -}} +{{- end -}} +{{- $tools := $a.tools | default dict -}} +{{- if not (kindIs "map" $tools) -}} +{{- fail (printf "%s.tools: want a map of tool name to Allow, Ask or Block" .key) -}} +{{- end -}} +{{- if gt (len $tools) 512 -}} +{{- fail (printf "%s.tools: %d tools, want at most 512 (the MCPServer CRD's maxProperties)" .key (len $tools)) -}} +{{- end -}} +{{- range $tool, $v := $tools -}} +{{- if not (has (toString $v) (list "Allow" "Ask" "Block")) -}} +{{- fail (printf "%s.tools.%s %q: want Allow, Ask or Block" $.key $tool (toString $v)) -}} +{{- end -}} +{{- end }} +approval: + {{- toYaml $a | nindent 2 }} +{{- end -}} +{{- end -}} diff --git a/helm/agent-platform-connectivity/templates/kagent/mcpserver.yaml b/helm/agent-platform-connectivity/templates/kagent/mcpserver.yaml index 3a062bd7..14f1f406 100644 --- a/helm/agent-platform-connectivity/templates/kagent/mcpserver.yaml +++ b/helm/agent-platform-connectivity/templates/kagent/mcpserver.yaml @@ -8,7 +8,8 @@ and the checkpoint and fork tools. Registered, every session whose toolset inclu preset lists and messages the person's other sessions as x_kagent_, and the Dev Portal's MCP servers page lists it in the Agent Platform group, by mcp.displayName (the ui.giantswarm.io/display-name annotation) when set, with -mcp.description (spec.description) under the name when set. +mcp.description (spec.description) under the name when set. mcp.approval is +its tool approval (spec.approval, agent-platform.mcpServerApproval). The path is the data plane's, never the controller's directly: an HTTPRoute at pathPrefix, rewritten to /mcp, on the kagent AgentgatewayBackend @@ -95,4 +96,7 @@ spec: auth: type: oauth forwardToken: true + {{- with include "agent-platform.mcpServerApproval" (dict "approval" $mcp.approval "key" "kagent.controllerRoute.mcp.approval") }} + {{- . | trim | nindent 2 }} + {{- end }} {{- end }} diff --git a/helm/agent-platform-connectivity/templates/mcp-kubernetes/mcpserver.yaml b/helm/agent-platform-connectivity/templates/mcp-kubernetes/mcpserver.yaml index 1a35d518..9ab1848a 100644 --- a/helm/agent-platform-connectivity/templates/mcp-kubernetes/mcpserver.yaml +++ b/helm/agent-platform-connectivity/templates/mcp-kubernetes/mcpserver.yaml @@ -21,7 +21,9 @@ agent-platform, stamped by their charts) and the servers an installation registers (no label). The portal's MCP servers page, the toolset presets and the docs group servers by it; it names the server by mcpServer.displayName (the ui.giantswarm.io/display-name annotation) when set, and shows -mcpServer.description (spec.description) under the name when set. +mcpServer.description (spec.description) under the name when set, and its +tool approval mcpServer.approval as spec.approval (the Recommended preset by +default, as agent-platform-mcps' kubernetes family). mcp-kubernetes.mcpServer picks one of three shapes: - enabled: false renders no CR; the registration is agent-platform-mcps' @@ -83,4 +85,7 @@ spec: name: kubernetes instanceArg: management_cluster {{- end }} + {{- with include "agent-platform.mcpServerApproval" (dict "approval" (dig "approval" dict $reg) "key" "mcp-kubernetes.mcpServer.approval") }} + {{- . | trim | nindent 2 }} + {{- end }} {{- end }} diff --git a/helm/agent-platform-connectivity/values.yaml b/helm/agent-platform-connectivity/values.yaml index 445cbe78..7297940c 100644 --- a/helm/agent-platform-connectivity/values.yaml +++ b/helm/agent-platform-connectivity/values.yaml @@ -1797,6 +1797,39 @@ kagent: # @schema skipProperties: true; additionalProperties: true # The line the Dev Portal shows under the server's name (the MCPServer's # spec.description, at most 500 characters); empty renders none. description: "Your agent sessions on this installation, as the signed-in person: list them, send one a message, and checkpoint or fork them" + # The connector's tool approval (the MCPServer's spec.approval; Governing + # tool calls, https://docs.giantswarm.io/overview/agent-platform/governing-tool-calls/): + # `rule` (Allow | Ask) for a tool without its own entry, new tools + # included, and `tools`, the server's own tool names -> Allow | Ask | + # Block (Block hides the tool), at most 512. Written out for every tool + # of the kagent line as the Allow all preset: the platform's own session + # tools, which every session with the agent-platform preset uses as the + # person who ran the turn and which carry no MCP annotations (Recommended + # would make reads ask too); agent callers are asked by muster's floors + # and the governance mode, not here. An installation tightens a tool + # here; null renders none (the connector runs every tool, not reviewed). + # A muster whose CRD lacks spec.approval drops the field. + approval: + rule: Allow + tools: + list_sessions: Allow + invoke_session: Allow + create_session_checkpoint: Allow + list_session_checkpoints: Allow + fork_session: Allow + list_sandbox_templates: Allow + create_sandbox: Allow + list_sandboxes: Allow + get_sandbox: Allow + suspend_sandbox: Allow + resume_sandbox: Allow + delete_sandbox: Allow + start_sandbox_process: Allow + get_sandbox_process: Allow + kill_sandbox_process: Allow + read_sandbox_outputs: Allow + read_sandbox_file: Allow + write_sandbox_file: Allow # The first of the controller's two authentication layers, on by default # (docs/authentication.md, "The kagent controller route"). Renders an # AgentgatewayPolicy on the GRPCRoute (plus a static AgentgatewayBackend for @@ -3645,6 +3678,45 @@ mcp-kubernetes: # @schema skipProperties: true; additionalProperties: true # What the Dev Portal shows under the name (the MCPServer's # spec.description), at most 500 characters. Empty renders none. description: "Resources, events and pod logs of this installation's cluster, and the health of its workload clusters" + # The connector's tool approval (the MCPServer's spec.approval; Governing + # tool calls, https://docs.giantswarm.io/overview/agent-platform/governing-tool-calls/): + # `rule` (Allow | Ask) for a tool without its own entry, new tools + # included, and `tools`, the server's own tool names -> Allow | Ask | Block + # (Block hides the tool), at most 512. Written out for every tool of + # mcp-kubernetes as the Recommended preset, as agent-platform-mcps' + # kubernetes family: the tools annotated read-only run, every other one + # asks a person (the mutating ones are registered only when the server's + # non-destructive mode is off), new tools ask until listed. An + # installation changes a tool here; null renders none (the connector + # runs every tool, not reviewed). A muster whose CRD lacks spec.approval + # drops the field. + approval: + rule: Ask + tools: + get: Allow + list: Allow + describe: Allow + logs: Allow + api_resources: Allow + cluster_health: Allow + can_i: Allow + context_list: Allow + context_get_current: Allow + list_port_forward_sessions: Allow + capi_list_clusters: Allow + capi_get_cluster: Allow + capi_resolve_cluster: Allow + capi_cluster_health: Allow + context_use: Ask + create: Ask + apply: Ask + delete: Ask + patch: Ask + scale: Ask + exec: Ask + port_forward: Ask + stop_port_forward_session: Ask + stop_all_port_forward_sessions: Ask cloudnative-pg: {} # @schema skipProperties: true; additionalProperties: true # The kagent-crds component's values (kagent main ships its CRDs as their own From 41f06d8dcb3721bcb9a44682053ef769f4331e2c Mon Sep 17 00:00:00 2001 From: Dominik Schmidle Date: Wed, 25 Nov 2026 16:47:01 +0100 Subject: [PATCH 03/56] feat(helm): bind muster-approval-binder to agent-manager's ServiceAccount muster takes an agent's tool settings in a Session binding only from a sender allowed to bind toolapprovals in its namespace. The muster chart ships the Role; the connectivity release binds it to agent-manager's ServiceAccount, and only to it. --- .../agent-manager/muster-approval-binder.yaml | 32 +++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 helm/agent-platform-connectivity/templates/agent-manager/muster-approval-binder.yaml diff --git a/helm/agent-platform-connectivity/templates/agent-manager/muster-approval-binder.yaml b/helm/agent-platform-connectivity/templates/agent-manager/muster-approval-binder.yaml new file mode 100644 index 00000000..002549ae --- /dev/null +++ b/helm/agent-platform-connectivity/templates/agent-manager/muster-approval-binder.yaml @@ -0,0 +1,32 @@ +{{- /* +agent-manager sends a Session's agent tool list (per-entry Allow/Ask/Block, +`default`, grant marks) to muster with its own projected ServiceAccount token +(audience muster) beside the person's. muster takes those settings only from a +sender whose token passes a TokenReview and whose identity a +SubjectAccessReview allows verb `bind` on `toolapprovals` +(muster.giantswarm.io) in muster's namespace (Governing tool calls, +giantswarm/giantswarm#38902). The muster chart ships that permission as the +Role muster-approval-binder, bound to nobody; this RoleBinding grants it to +agent-manager's ServiceAccount, and only to it, in muster's namespace (this +release's, as agent-platform:mcpserver-viewer). Rendered while agent-manager +and muster are on; a muster that does not ship the Role yet leaves it inert. +*/ -}} +{{- if and (include "agent-platform.agentManager.enabled" .) (include "agent-platform.componentEnabled" (dict "root" $ "name" "muster")) }} +{{- $user := include "agent-platform.agentManager.serviceAccountUser" . }} +{{- $parts := splitList ":" $user }} +apiVersion: rbac.authorization.k8s.io/v1 +kind: RoleBinding +metadata: + name: agent-platform:muster-approval-binder + namespace: {{ .Release.Namespace }} + labels: + {{- include "agent-platform.agentManager.labels" . | nindent 4 }} +roleRef: + apiGroup: rbac.authorization.k8s.io + kind: Role + name: muster-approval-binder +subjects: + - kind: ServiceAccount + name: {{ index $parts 3 }} + namespace: {{ index $parts 2 }} +{{- end }} From 7aa7270c9009817987d7324dd91b3fe854f520c2 Mon Sep 17 00:00:00 2001 From: Dominik Schmidle Date: Wed, 25 Nov 2026 16:47:01 +0100 Subject: [PATCH 04/56] test(helm): verify governance, connector admins, the binder and tool approval --- Makefile.custom.mk | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/Makefile.custom.mk b/Makefile.custom.mk index 84ad569e..46e9241a 100644 --- a/Makefile.custom.mk +++ b/Makefile.custom.mk @@ -1478,6 +1478,12 @@ verify-mcp-kubernetes-registration: ## Assert the bundled mcp-kubernetes registr @python3 tests/verify-mcp-kubernetes-registration.py $(CHART_DIR) $(CONNECTIVITY_DIR) @echo "mcp-kubernetes registration shapes verified." +.PHONY: verify-tool-approval +verify-tool-approval: ## Assert the platform side of Governing tool calls (giantswarm/giantswarm#38902): the top-level governance value renders muster's governance configuration into the muster release (muster.governance: mode trusted by default or governed, servers agentManager following agent-manager.muster.mcpServer.name and platformManager giantswarm-platform-manager, an own servers entry standing) from the muster floor agent-platform.muster.governanceFloor, none below it and none to the connectivity release; an unknown mode fails in the schema and the template, an own muster.muster.governance.mode that differs fails naming both keys; the connector-admin role (muster's mcpserver-editor) binds the Giant Swarm admin groups plus tenants.platformTeam, an own list standing; the connectivity release binds muster's Role muster-approval-binder to agent-manager's ServiceAccount only (following agent-manager.serviceAccount.name), in muster's namespace, none with agent-manager or muster off; the MCPServers the connectivity chart renders carry explicit approval settings (mcp-kubernetes the Recommended preset, kagent's session tools Allow all), a per-tool override reaching spec.approval, null rendering none and a value outside the CRD's enums or an unknown key failing naming the key. Stdlib only. HELM selects the binary. + @echo "====> $@ ($(CHART_DIR), $(CONNECTIVITY_DIR))" + @HELM="$(HELM)" python3 tests/verify-tool-approval.py $(CHART_DIR) $(CONNECTIVITY_DIR) + @echo "tool approval verified." + .PHONY: verify-self verify-self: ## Assert self-management's shapes: engine off renders nothing of it; engine on renders the self OCIRepository + suspended HelmRelease, the -6/-5/0 hooks, the identity and the admission policy (CLI day-0 only); engine on with self off (lab, hand-back) renders the -6/-5 hooks at pre-upgrade too and nothing else; the guards and knobs. HELM selects the binary. @echo "====> $@ ($(CHART_DIR))" From b661f0a8b68575207e6c44a466a3cee02ea44aaa Mon Sep 17 00:00:00 2001 From: Dominik Schmidle Date: Wed, 25 Nov 2026 16:47:01 +0100 Subject: [PATCH 05/56] docs: describe tool approval and the governance mode The chart README names governance, the connector-admin role, the binder and each shipped connector's approval value; README and the toolset presets link the Governing tool calls page. --- README.md | 1 + docs/toolset-presets.md | 2 + helm/agent-platform-connectivity/README.md | 44 ++++++++++++++++ helm/agent-platform/README.md | 58 ++++++++++++++++++---- helm/agent-platform/README.md.gotmpl | 36 ++++++++++++++ 5 files changed, 131 insertions(+), 10 deletions(-) diff --git a/README.md b/README.md index 49b95497..87357222 100644 --- a/README.md +++ b/README.md @@ -121,6 +121,7 @@ Then point any MCP client at `https://muster./mcp`. Its traffic cro | [Operator reference](docs/reference.md) | Every component and value: GitOps engine, self-management, serving and runtime slices, network policies, observability, CRD lifecycle | | [Authentication](docs/authentication.md) | The request path, OAuth discovery, token forwarding and exchange, edge JWT validation | | [Toolset presets](docs/toolset-presets.md) | Choosing which tools an agent gets | +| [Governing tool calls](https://docs.giantswarm.io/overview/agent-platform/governing-tool-calls/) | Allow, Ask or Block per connector and tool, the governance mode and who sets what ([chart values](helm/agent-platform/README.md#tool-approval-and-the-governance-mode)) | | [Serving presets](docs/serving-presets.md) | Adding and benchmarking a model recipe | | [ChatGPT login](docs/chatgpt-login.md) | Running codex on each person's own ChatGPT subscription | | [Agent Substrate security](docs/substrate-security.md) | What the agent runtime changes on the cluster, and what protects it | diff --git a/docs/toolset-presets.md b/docs/toolset-presets.md index e794176c..d7ff9346 100644 --- a/docs/toolset-presets.md +++ b/docs/toolset-presets.md @@ -2,6 +2,8 @@ A **toolset** is the selector list an agent declares to say which of the gateway's tools it is composed with: the agent chart's `toolset` value (rendered as the `X-Muster-Toolset` header on the agent's muster tool entry), agent-manager's `toolset` argument, or the `toolset` argument of muster's `filter_tools`. muster evaluates it on every request as one more filter on the caller's own catalogue — it never widens access; the invoking human's identity and the backends' own authorization remain the boundary. The grammar, the built-in presets and the error texts are muster's: [docs/reference/toolsets.md](https://github.com/giantswarm/muster/blob/main/docs/reference/toolsets.md). +With tool approval the toolset becomes the agent's `tools` list: the same selectors, each optionally `Allow`, `Ask` or `Block`, plus a `default` for the list ([Governing tool calls](https://docs.giantswarm.io/overview/agent-platform/governing-tool-calls/)). + A **preset** is a named selection an agent refers to as `preset:`. Presets are muster configuration — `toolsetPresets` in muster's `config.yaml`, which the muster chart renders from its `muster.toolsetPresets` value. This meta-package forwards its `muster:` block to the muster release, so the presets an installation ships live under **`muster.muster.toolsetPresets`** in these values (the first `muster` is the component block, the second is the muster chart's own `muster:` key). ## The presets muster builds in diff --git a/helm/agent-platform-connectivity/README.md b/helm/agent-platform-connectivity/README.md index a2735a5d..d0731cb6 100644 --- a/helm/agent-platform-connectivity/README.md +++ b/helm/agent-platform-connectivity/README.md @@ -1531,6 +1531,25 @@ The kagent block is open in the schema, so the template refuses a key under `kag | kagent.controllerRoute.mcp.timeout | int | `300` | | | kagent.controllerRoute.mcp.displayName | string | `"Kagent"` | | | kagent.controllerRoute.mcp.description | string | `"Your agent sessions on this installation, as the signed-in person: list them, send one a message, and checkpoint or fork them"` | | +| kagent.controllerRoute.mcp.approval.rule | string | `"Allow"` | | +| kagent.controllerRoute.mcp.approval.tools.list_sessions | string | `"Allow"` | | +| kagent.controllerRoute.mcp.approval.tools.invoke_session | string | `"Allow"` | | +| kagent.controllerRoute.mcp.approval.tools.create_session_checkpoint | string | `"Allow"` | | +| kagent.controllerRoute.mcp.approval.tools.list_session_checkpoints | string | `"Allow"` | | +| kagent.controllerRoute.mcp.approval.tools.fork_session | string | `"Allow"` | | +| kagent.controllerRoute.mcp.approval.tools.list_sandbox_templates | string | `"Allow"` | | +| kagent.controllerRoute.mcp.approval.tools.create_sandbox | string | `"Allow"` | | +| kagent.controllerRoute.mcp.approval.tools.list_sandboxes | string | `"Allow"` | | +| kagent.controllerRoute.mcp.approval.tools.get_sandbox | string | `"Allow"` | | +| kagent.controllerRoute.mcp.approval.tools.suspend_sandbox | string | `"Allow"` | | +| kagent.controllerRoute.mcp.approval.tools.resume_sandbox | string | `"Allow"` | | +| kagent.controllerRoute.mcp.approval.tools.delete_sandbox | string | `"Allow"` | | +| kagent.controllerRoute.mcp.approval.tools.start_sandbox_process | string | `"Allow"` | | +| kagent.controllerRoute.mcp.approval.tools.get_sandbox_process | string | `"Allow"` | | +| kagent.controllerRoute.mcp.approval.tools.kill_sandbox_process | string | `"Allow"` | | +| kagent.controllerRoute.mcp.approval.tools.read_sandbox_outputs | string | `"Allow"` | | +| kagent.controllerRoute.mcp.approval.tools.read_sandbox_file | string | `"Allow"` | | +| kagent.controllerRoute.mcp.approval.tools.write_sandbox_file | string | `"Allow"` | | | kagent.controllerRoute.jwtAuthentication.enabled | bool | `true` | | | kagent.controllerRoute.jwtAuthentication.mode | string | `"Strict"` | | | kagent.controllerRoute.jwtAuthentication.issuer | string | `""` | | @@ -1949,6 +1968,31 @@ The kagent block is open in the schema, so the template refuses a key under `kag | mcp-kubernetes.mcpServer.managementCluster | string | `""` | | | mcp-kubernetes.mcpServer.displayName | string | `"Kubernetes"` | | | mcp-kubernetes.mcpServer.description | string | `"Resources, events and pod logs of this installation's cluster, and the health of its workload clusters"` | | +| mcp-kubernetes.mcpServer.approval.rule | string | `"Ask"` | | +| mcp-kubernetes.mcpServer.approval.tools.get | string | `"Allow"` | | +| mcp-kubernetes.mcpServer.approval.tools.list | string | `"Allow"` | | +| mcp-kubernetes.mcpServer.approval.tools.describe | string | `"Allow"` | | +| mcp-kubernetes.mcpServer.approval.tools.logs | string | `"Allow"` | | +| mcp-kubernetes.mcpServer.approval.tools.api_resources | string | `"Allow"` | | +| mcp-kubernetes.mcpServer.approval.tools.cluster_health | string | `"Allow"` | | +| mcp-kubernetes.mcpServer.approval.tools.can_i | string | `"Allow"` | | +| mcp-kubernetes.mcpServer.approval.tools.context_list | string | `"Allow"` | | +| mcp-kubernetes.mcpServer.approval.tools.context_get_current | string | `"Allow"` | | +| mcp-kubernetes.mcpServer.approval.tools.list_port_forward_sessions | string | `"Allow"` | | +| mcp-kubernetes.mcpServer.approval.tools.capi_list_clusters | string | `"Allow"` | | +| mcp-kubernetes.mcpServer.approval.tools.capi_get_cluster | string | `"Allow"` | | +| mcp-kubernetes.mcpServer.approval.tools.capi_resolve_cluster | string | `"Allow"` | | +| mcp-kubernetes.mcpServer.approval.tools.capi_cluster_health | string | `"Allow"` | | +| mcp-kubernetes.mcpServer.approval.tools.context_use | string | `"Ask"` | | +| mcp-kubernetes.mcpServer.approval.tools.create | string | `"Ask"` | | +| mcp-kubernetes.mcpServer.approval.tools.apply | string | `"Ask"` | | +| mcp-kubernetes.mcpServer.approval.tools.delete | string | `"Ask"` | | +| mcp-kubernetes.mcpServer.approval.tools.patch | string | `"Ask"` | | +| mcp-kubernetes.mcpServer.approval.tools.scale | string | `"Ask"` | | +| mcp-kubernetes.mcpServer.approval.tools.exec | string | `"Ask"` | | +| mcp-kubernetes.mcpServer.approval.tools.port_forward | string | `"Ask"` | | +| mcp-kubernetes.mcpServer.approval.tools.stop_port_forward_session | string | `"Ask"` | | +| mcp-kubernetes.mcpServer.approval.tools.stop_all_port_forward_sessions | string | `"Ask"` | | | cloudnative-pg | object | `{}` | | | kagent-crds | object | `{}` | | | substrate.createNamespace | bool | `false` | | diff --git a/helm/agent-platform/README.md b/helm/agent-platform/README.md index 386564aa..7f281dec 100644 --- a/helm/agent-platform/README.md +++ b/helm/agent-platform/README.md @@ -376,6 +376,42 @@ Karpenter relaxes a preferred term and launches the node. An installation's own `podAffinity` stands instead of the derived one (keep the atelet term in it, never required); below `1.3.0` the key is refused. +## Tool approval and the governance mode + +Every tool behind muster is **Allow**, **Ask** (a person confirms the call first) or **Block** +(hidden); the concept, who sets what and the prompts are on +[Governing tool calls](https://docs.giantswarm.io/overview/agent-platform/governing-tool-calls/). What this chart configures: + +- **`governance`** (`trusted`, the default, or `governed`): the platform's governance mode. The meta + chart renders it into muster's governance configuration (`muster.governance`: the mode and the + servers muster treats as agent-manager, `agent-manager.muster.mcpServer.name`, and the Platform + Manager, `giantswarm-platform-manager`; an own `muster.muster.governance.servers.` stands) + from the muster release that reads it (`agent-platform.muster.governanceFloor`); an earlier muster + gets none. Governed asks a person before an agent creates an agent, changes an agent's tools, + starts another agent or pauses a connector; the floors (an agent adding or repointing a + connector, changing approval settings, granting an exception, changing a workflow or muster's + configuration) ask on both. Only admins switch it, through the Platform Manager with a second + person's approval. Anything but the two values fails the render. +- **The `connector-admin` role** is muster's `mcpserver-editor` Role in muster's namespace, bound to + `muster.rbac.mcpServerEditor.subjects` (the Giant Swarm admin groups) plus `tenants.platformTeam`. + Whoever holds it edits the namespace's connectors, sets their tool approval and may let an agent + skip a tool's `Ask`. The muster chart binds nobody by default, so this list is what keeps + connector admins on an upgrade; `system:authenticated` makes everyone one. +- **`muster-approval-binder`**: muster takes an agent's tool settings in a Session binding only from + a sender allowed to `bind` `toolapprovals`. The muster chart ships that Role; the connectivity + release binds it to agent-manager's ServiceAccount, and only to it, in muster's namespace. +- **Explicit settings on every shipped connector** (`spec.approval`): the MCPServers this chart + renders carry them as values — `mcp-kubernetes.mcpServer.approval` (the *Recommended* preset: + read-only tools Allow, the rest Ask, rule Ask) and `kagent.controllerRoute.mcp.approval` (*Allow + all*: kagent's session tools carry no annotations, and agents use them as the person); the + component charts set theirs under `.muster.mcpServer.approval` (*Allow all* for the + managers, whose tools the portal calls as the person) and agent-platform-mcps per family + (`agent-platform-mcps.muster.families..approval`, *Recommended*). An installation tightens + a tool there (`Ask`, `Block`); `null` removes the block (the connector runs everything, shown as + *not reviewed*). A muster whose CRD lacks `spec.approval` drops the field. + +`make verify-tool-approval` asserts all four. + ## Voluntary disruption The platform's core runs as single replicas — the agentgateway data plane, muster, the kagent controller, klaus-gateway, agent-manager — and each carries long-lived streams (MCP sessions, A2A and portal SSE turns, the LLM listener). A voluntary eviction (Karpenter consolidation, a node drain) cuts them mid-turn (giantswarm/agent-platform#431). Two guards, both on by default: @@ -727,16 +763,17 @@ The map is merged into each component's own `nodeSelector` (`muster.nodeSelector | components.agent-platform-connectivity.forwardAllValues | bool | `true` | | | components.agent-platform-connectivity.disableWaitForJobs | bool | `true` | | | components.agent-platform-connectivity.omitKeys[0] | string | `"flux-engine"` | | -| components.agent-platform-connectivity.omitKeys[1] | string | `"scheduling"` | | -| components.agent-platform-connectivity.omitKeys[2] | string | `"gpu-operator"` | | -| components.agent-platform-connectivity.omitKeys[3] | string | `"toolchain-manager"` | | -| components.agent-platform-connectivity.omitKeys[4] | string | `"kserve-runtime-configs"` | | -| components.agent-platform-connectivity.omitKeys[5] | string | `"skills"` | | -| components.agent-platform-connectivity.omitKeys[6] | string | `"skillManager"` | | -| components.agent-platform-connectivity.omitKeys[7] | string | `"skill-manager"` | | -| components.agent-platform-connectivity.omitKeys[8] | string | `"defaultAgent"` | | -| components.agent-platform-connectivity.omitKeys[9] | string | `"agent-platform-operator"` | | -| components.agent-platform-connectivity.omitKeys[10] | string | `"agentPlatformOrganizations.operator"` | | +| components.agent-platform-connectivity.omitKeys[1] | string | `"governance"` | | +| components.agent-platform-connectivity.omitKeys[2] | string | `"scheduling"` | | +| components.agent-platform-connectivity.omitKeys[3] | string | `"gpu-operator"` | | +| components.agent-platform-connectivity.omitKeys[4] | string | `"toolchain-manager"` | | +| components.agent-platform-connectivity.omitKeys[5] | string | `"kserve-runtime-configs"` | | +| components.agent-platform-connectivity.omitKeys[6] | string | `"skills"` | | +| components.agent-platform-connectivity.omitKeys[7] | string | `"skillManager"` | | +| components.agent-platform-connectivity.omitKeys[8] | string | `"skill-manager"` | | +| components.agent-platform-connectivity.omitKeys[9] | string | `"defaultAgent"` | | +| components.agent-platform-connectivity.omitKeys[10] | string | `"agent-platform-operator"` | | +| components.agent-platform-connectivity.omitKeys[11] | string | `"agentPlatformOrganizations.operator"` | | | components.agent-platform-connectivity.dependsOn[0] | string | `"muster"` | | | components.agent-platform-connectivity.dependsOn[1] | string | `"agentgateway"` | | | components.agent-platform-connectivity.dependsOn[2] | string | `"substrate-crds"` | | @@ -1513,6 +1550,7 @@ The map is merged into each component's own `nodeSelector` (`muster.nodeSelector | clusterManager.networkPolicy.workloadClusters.ports[1] | int | `6443` | | | clusterManager.networkPolicy.egress.fqdns | list | `[]` | | | clusterManager.networkPolicy.egress.cidrs | list | `[]` | | +| governance | string | `"trusted"` | The platform's governance mode: trusted (the default) or governed. It changes no tool approval setting's meaning; it adds asking for agent callers. Governed asks a person before an agent creates an agent (agent-manager's create_agent), changes an agent's tools (update_agent_access), starts another agent (start_session) or pauses a connector, and the Dev Portal's connector wizard pre-selects the Recommended preset (read-only tools run, the rest ask); trusted lets agents do those freely and pre-selects Allow all. In both modes muster's built-in floors ask a person before an agent adds or repoints a connector, changes approval settings, gives an agent an exception or changes muster's own configuration. The meta chart renders muster's governance configuration from it (muster.governance: the mode, and the servers muster treats as agent-manager and the Platform Manager), from the muster release that reads it (agent-platform.muster.governanceFloor); an earlier muster gets none and asks nothing. Only admins switch it, through the Platform Manager with a second person's approval; never an agent. Anything else fails the render. Concept: https://docs.giantswarm.io/overview/agent-platform/governing-tool-calls/ | | tenants.platform.users | list | `[{"apiGroup":"rbac.authorization.k8s.io","kind":"Group","name":"system:authenticated"}]` | Every signed-in person: bound to agent-platform:platform-user in the kagent namespace, and, while musterMcpServerViewers is unset, to `list` (with get and watch) on muster's MCPServers in muster's namespace (the servers for everyone). RBAC subjects. The default, system:authenticated, gives this to every user. It also gives it to every ServiceAccount, so every pod in the cluster can read the platform tenant's Agents, RemoteMCPServer URLs and muster's MCPServer specs. To give it to people only, replace the default with an OIDC group that every user belongs to, written as the API server sees it (with the installation's OIDC groups prefix). | | tenants.platform.editors | list | `[{"apiGroup":"rbac.authorization.k8s.io","kind":"Group","name":"giantswarm-ad:giantswarm-admins"},{"apiGroup":"rbac.authorization.k8s.io","kind":"Group","name":"giantswarm-github:giantswarm:giantswarm-admins"}]` | The platform's operators: bound to agent-platform:editor in the kagent namespace. RBAC subjects. The Giant Swarm admin groups, as in muster.rbac.*.subjects. | | tenants.platform.kagentRelease.name | string | `""` | The name of kagent's HelmRelease in the kagent namespace. Empty, the default, admits none. | diff --git a/helm/agent-platform/README.md.gotmpl b/helm/agent-platform/README.md.gotmpl index f648e50f..b00aa1b7 100644 --- a/helm/agent-platform/README.md.gotmpl +++ b/helm/agent-platform/README.md.gotmpl @@ -362,6 +362,42 @@ Karpenter relaxes a preferred term and launches the node. An installation's own `podAffinity` stands instead of the derived one (keep the atelet term in it, never required); below `1.3.0` the key is refused. +## Tool approval and the governance mode + +Every tool behind muster is **Allow**, **Ask** (a person confirms the call first) or **Block** +(hidden); the concept, who sets what and the prompts are on +[Governing tool calls](https://docs.giantswarm.io/overview/agent-platform/governing-tool-calls/). What this chart configures: + +- **`governance`** (`trusted`, the default, or `governed`): the platform's governance mode. The meta + chart renders it into muster's governance configuration (`muster.governance`: the mode and the + servers muster treats as agent-manager, `agent-manager.muster.mcpServer.name`, and the Platform + Manager, `giantswarm-platform-manager`; an own `muster.muster.governance.servers.` stands) + from the muster release that reads it (`agent-platform.muster.governanceFloor`); an earlier muster + gets none. Governed asks a person before an agent creates an agent, changes an agent's tools, + starts another agent or pauses a connector; the floors (an agent adding or repointing a + connector, changing approval settings, granting an exception, changing a workflow or muster's + configuration) ask on both. Only admins switch it, through the Platform Manager with a second + person's approval. Anything but the two values fails the render. +- **The `connector-admin` role** is muster's `mcpserver-editor` Role in muster's namespace, bound to + `muster.rbac.mcpServerEditor.subjects` (the Giant Swarm admin groups) plus `tenants.platformTeam`. + Whoever holds it edits the namespace's connectors, sets their tool approval and may let an agent + skip a tool's `Ask`. The muster chart binds nobody by default, so this list is what keeps + connector admins on an upgrade; `system:authenticated` makes everyone one. +- **`muster-approval-binder`**: muster takes an agent's tool settings in a Session binding only from + a sender allowed to `bind` `toolapprovals`. The muster chart ships that Role; the connectivity + release binds it to agent-manager's ServiceAccount, and only to it, in muster's namespace. +- **Explicit settings on every shipped connector** (`spec.approval`): the MCPServers this chart + renders carry them as values — `mcp-kubernetes.mcpServer.approval` (the *Recommended* preset: + read-only tools Allow, the rest Ask, rule Ask) and `kagent.controllerRoute.mcp.approval` (*Allow + all*: kagent's session tools carry no annotations, and agents use them as the person); the + component charts set theirs under `.muster.mcpServer.approval` (*Allow all* for the + managers, whose tools the portal calls as the person) and agent-platform-mcps per family + (`agent-platform-mcps.muster.families..approval`, *Recommended*). An installation tightens + a tool there (`Ask`, `Block`); `null` removes the block (the connector runs everything, shown as + *not reviewed*). A muster whose CRD lacks `spec.approval` drops the field. + +`make verify-tool-approval` asserts all four. + ## Voluntary disruption The platform's core runs as single replicas — the agentgateway data plane, muster, the kagent controller, klaus-gateway, agent-manager — and each carries long-lived streams (MCP sessions, A2A and portal SSE turns, the LLM listener). A voluntary eviction (Karpenter consolidation, a node drain) cuts them mid-turn (giantswarm/agent-platform#431). Two guards, both on by default: From f63bd4a46fbd1c09a87f3f15d87abab22231862a Mon Sep 17 00:00:00 2001 From: Dominik Schmidle Date: Wed, 25 Nov 2026 16:47:01 +0100 Subject: [PATCH 06/56] docs(skills): teach tool approval in the tools, building-blocks and agent-management skills --- .../agent-platform-agent-management/SKILL.md | 20 ++++++++- .../agent-platform-building-blocks/SKILL.md | 6 ++- skills/agent-platform-tools/SKILL.md | 43 ++++++++++++++++++- 3 files changed, 64 insertions(+), 5 deletions(-) diff --git a/skills/agent-platform-agent-management/SKILL.md b/skills/agent-platform-agent-management/SKILL.md index 7beb6f66..d9294222 100644 --- a/skills/agent-platform-agent-management/SKILL.md +++ b/skills/agent-platform-agent-management/SKILL.md @@ -1,8 +1,8 @@ --- name: agent-platform-agent-management -description: Use when asked to create, change, inspect, troubleshoot, re-pin or delete an agent on the Agent Platform, to choose its model, skills, toolset or egress, or to read or evaluate one of its sessions. +description: Use when asked to create, change, inspect, troubleshoot, re-pin or delete an agent on the Agent Platform, to choose its model, skills, toolset (its tool list and Allow/Ask/Block settings) or egress, or to read or evaluate one of its sessions. metadata: - version: "3.3.0" + version: "3.4.0" --- # Managing agents and their building blocks @@ -123,6 +123,22 @@ never assume an argument. The agent tools drop an unknown key without an error: - **Toolset**: the smallest that does the job; `preset:none` for chat only; the broadest preset only on an explicit request. An own-account (OAuth) connector without `grantScope: subject` needs a sign-in in each of the agent's conversations (`agent-platform-tools`); say so before choosing it. +- **Tool approval** (https://docs.giantswarm.io/overview/agent-platform/governing-tool-calls/): once agent-manager's `create_agent` schema has `tools`, the toolset + becomes the agent's **tool list**: the same selectors, each optionally `Allow`, `Ask` or `Block`, + plus a `default` for every listed tool without its own setting; at most 32 entries; an unlisted + tool is invisible. An agent's settings only tighten its connectors' (the strictest wins) and apply + to everyone who uses the agent. `Allow` over a tool its connector sets to `Ask`, or an allowing + `default`, is an **exception**: only a connector admin of that connector may grant it, and only + through `x_agent-manager_set_agent_approval` (`create_agent` and `update_agent_access` refuse + it); when you, an agent, call it, it asks the person, on every platform. Saving an agent + (`update_agent`, `update_agent_access`, `set_agent_approval`) drops each exception the saver is + not connector admin for, and the tool asks again: say so before saving. The tools split: + `update_agent` (name, description, prompt, model), `update_agent_access` (`tools` and everything + that widens reach: skills, plugins, egress, harness, workspace, toolchains), + `set_agent_approval` (the settings). On a **governed** platform `create_agent`, + `update_agent_access` and `start_session` ask the person when an agent calls them; on a trusted + one (the default) they don't. `muster.requireApproval: true` keeps asking before every call + until agent chart 3.0 moves it to `default: Ask`; never set it together with tool settings. - **An organization's connectors**: a kagent `RemoteMCPServer` in the organization namespace (`x_agent-manager_set_organization_connector`), not a Muster server, so no `toolset` selector reaches it. From agent-manager 3.3.0 (`connectors` in `x_agent-manager_create_agent`'s schema; diff --git a/skills/agent-platform-building-blocks/SKILL.md b/skills/agent-platform-building-blocks/SKILL.md index 5ba3af48..9d707190 100644 --- a/skills/agent-platform-building-blocks/SKILL.md +++ b/skills/agent-platform-building-blocks/SKILL.md @@ -2,7 +2,7 @@ name: agent-platform-building-blocks description: Use when someone new asks what connectors, toolsets, toolchains or workspaces are, how they differ, or which one they need — or when a person's goal needs one they have not set up, so you can suggest it before the mechanics. metadata: - version: "1.0.0" + version: "1.1.0" --- # Connectors, toolsets, toolchains, workspaces @@ -27,6 +27,10 @@ gateway. Every call runs as the person: what they may do in the service is what the agent may do there. Some connectors ask the person to sign in once with their own account; until then their tools are hidden for that person. +Each tool of a connector is **Allow** (runs), **Ask** (a person confirms the call first) or +**Block** (hidden); the strictest of the connector's and the agent's settings wins +(https://docs.giantswarm.io/overview/agent-platform/governing-tool-calls/). + **Suggest one** when the goal needs a system no connector reaches yet ("read our Jira tickets"): someone registers it with **Add connector**. A connector that exists but whose tools are missing for this person usually needs their sign-in. diff --git a/skills/agent-platform-tools/SKILL.md b/skills/agent-platform-tools/SKILL.md index 3f66743c..e54f51e0 100644 --- a/skills/agent-platform-tools/SKILL.md +++ b/skills/agent-platform-tools/SKILL.md @@ -1,8 +1,8 @@ --- name: agent-platform-tools -description: Use when a question is about tools on the Agent Platform — Muster's meta-tools and call_tool, finding or running a tool, what a toolset or preset resolves to, why a tool is missing or refused, connectors and signing in to one, workflows, or model-manager. +description: Use when a question is about tools on the Agent Platform — Muster's meta-tools and call_tool, finding or running a tool, what a toolset or preset resolves to, why a tool is missing, refused or asks for approval, a connector's Allow/Ask/Block settings and presets, connectors and signing in to one, workflows, or model-manager. metadata: - version: "3.3.1" + version: "3.4.0" --- # Tools on the Agent Platform @@ -134,6 +134,43 @@ Tools register live when a server connects. Adding connectors: https://docs.giantswarm.io/tutorials/agent-platform/managing-mcp-servers/ and https://docs.giantswarm.io/tutorials/agent-platform/connecting-custom-mcp-servers/. +## Tool approval: Allow, Ask, Block + +Concept: https://docs.giantswarm.io/overview/agent-platform/governing-tool-calls/. Every tool has one setting, decided by Muster on every call, whoever calls (an +agent, the portal, Slack, Claude Code): + +- **Allow** runs. **Ask**: a person confirms the exact call on Muster's approval page first; the + call then runs once. **Block**: hidden, absent from `filter_tools`, refused as not found. +- A connector carries `spec.approval`: a `rule` (`Allow` or `Ask`) that every tool without its own + entry follows — **new tools follow the rule** — and per-tool entries by the server's own tool + name (no `x__` prefix). A connector without `approval` runs everything and is shown as + *not reviewed*. An agent's settings can only tighten them; the strictest wins. +- `filter_tools` and `describe_tool` report each tool's `approval` (`setting`, `source`: `tool`, + `connector`, `agent`, `agent-exception`, `builtin`, `governance` or `unreviewed`; `new` for a tool + without its own entry) and `connectorAdmin`, whether you may change that connector's settings. +- **Presets** fill in every tool once, on save, from the tools listed at that moment: *Recommended* + (rule Ask, tools annotated read-only Allow, the rest Ask), *Allow all*, *Ask all*. Creating a + connector over MCP (`core_mcpserver_create`) requires `preset` or explicit `approval`; + `core_mcpserver_set_approval` changes them. Only a connector admin (whoever may update + `mcpservers` in its namespace: the `connector-admin` role) may write them, and an agent writing + them always asks a person. The portal's wizard pre-selects *Allow all* on a trusted platform and + *Recommended* on a governed one. The platform's own connectors arrive reviewed: its management + servers (agent-manager, the other managers, kagent's session tools) on *Allow all*, the + infrastructure servers (Kubernetes, Prometheus, Cluster API) on *Recommended*. +- **When a call asks**, you get an approval link (or, in a client without the prompt, an + `approval_required` text with the URL). Give the person the link as is, wait, then call the tool + again with the same arguments: approved, it runs once; declined, you get a declined result — + accept it, never retry another way. A workflow asks once, up front, for all its steps. + Never press *Approve* yourself, and never ask the person to approve something you did not show + them; with no person to open the link the call expires and is refused. +- **Built in, every mode**: an agent is asked before it adds or repoints a connector, changes + approval on a connector or an agent, gives an agent an exception, creates, changes or deletes a + workflow, or changes Muster's configuration (that one asks every caller). A **governed** platform + also asks before an agent creates an agent, changes an agent's tools, starts another agent's + session or pauses a connector; a **trusted** one (the default) lets agents do those freely. +- Missing prerequisites (Muster's Valkey store, its browser sign-in) make every asking call + refused, with the reason; tell the person, it is the installation's to fix. + ## Workflows A `Workflow` resource is a list of tool calls Muster runs server-side, returning one shaped answer; it @@ -209,6 +246,8 @@ clients. Procedure and version prerequisites: grant backend permissions. A successful agent-manager read with `releaseWithheld` is a partial answer, not an error: use the readable Agent data and explain which release details are unavailable. Do not send an authenticated person through sign-in again or blame them for this platform limit. +- `approval_required`, or an approval link instead of a result: the tool's setting is Ask (above). + A tool that `filter_tools` no longer lists may be blocked for you: its connector's admins decide. - "tool `x_…` not found" from the runtime: a backend tool was emitted as a function — go through `call_tool`. - An issuer discovery or TLS error is installation connectivity, not a request for the person to From 43c2ba306278b61efed33f8a609d8f4608e26ad7 Mon Sep 17 00:00:00 2001 From: Dominik Schmidle Date: Wed, 25 Nov 2026 17:16:16 +0100 Subject: [PATCH 07/56] feat(helm): render muster's approval installation and redirect allowlist From the muster floor that reads governance, the meta chart sets muster.approval.installation from backstage.installationName and adds the portal's /sessions and klaus-gateway's /auth/slack/return to muster.oauth.mcpClient.postLoginRedirectAllowlist. Mark the governance floor as one placeholder value. --- helm/agent-platform/README.md | 21 ++++++- helm/agent-platform/README.md.gotmpl | 19 ++++++ helm/agent-platform/templates/_helpers.tpl | 71 +++++++++++++++++++++- helm/agent-platform/values.schema.json | 2 +- helm/agent-platform/values.yaml | 11 +++- 5 files changed, 118 insertions(+), 6 deletions(-) diff --git a/helm/agent-platform/README.md b/helm/agent-platform/README.md index 7f281dec..eee899e8 100644 --- a/helm/agent-platform/README.md +++ b/helm/agent-platform/README.md @@ -392,6 +392,25 @@ Every tool behind muster is **Allow**, **Ask** (a person confirms the call first connector, changing approval settings, granting an exception, changing a workflow or muster's configuration) ask on both. Only admins switch it, through the Platform Manager with a second person's approval. Anything but the two values fails the render. +- **What approval needs, and what this chart renders for it.** Asking calls refuse with the reason + unless muster's shared store is Valkey, muster runs its OAuth server (the browser sign-in through + Dex) and has a public URL on that server's origin. The bundled Valkey and + `muster.muster.oauth.server.storage.type: valkey` are the defaults; the OAuth server is on by + default but needs the installation's `oauth.server.baseUrl`, `dex.issuerUrl`, `dex.clientId` and + `existingSecret`; `muster.muster.oauth.mcpClient.enabled` with `publicUrl` (on the origin of + `oauth.server.baseUrl`) is the installation's to set (muster takes the OAuth server's base URL + when `publicUrl` is empty, but renders the allowlist below only with `mcpClient.enabled`). The + chart does not fail a `governed` render without them: muster refuses each asking call with the + reason and `filter_tools` reports `approval.unavailable`. From the same muster release as + `governance` (`agent-platform.muster.governanceFloor`) the meta chart also renders + `muster.approval.installation` (the name the approval page shows: `backstage.installationName`, + default `agent-platform`; an own `muster.muster.approval.installation` stands) and + `muster.oauth.mcpClient.postLoginRedirectAllowlist`, where muster may send the browser back after + a decision: `https:///sessions` while the portal is on and has a host + (`backstage.hostname`, else `backstage.`) and + `/auth/slack/return` while klaus-gateway is on and names it; an + own list's entries stay. Without an entry the person sees muster's own "answer recorded" page and + answers *Done* in the portal or Slack. - **The `connector-admin` role** is muster's `mcpserver-editor` Role in muster's namespace, bound to `muster.rbac.mcpServerEditor.subjects` (the Giant Swarm admin groups) plus `tenants.platformTeam`. Whoever holds it edits the namespace's connectors, sets their tool approval and may let an agent @@ -1550,7 +1569,7 @@ The map is merged into each component's own `nodeSelector` (`muster.nodeSelector | clusterManager.networkPolicy.workloadClusters.ports[1] | int | `6443` | | | clusterManager.networkPolicy.egress.fqdns | list | `[]` | | | clusterManager.networkPolicy.egress.cidrs | list | `[]` | | -| governance | string | `"trusted"` | The platform's governance mode: trusted (the default) or governed. It changes no tool approval setting's meaning; it adds asking for agent callers. Governed asks a person before an agent creates an agent (agent-manager's create_agent), changes an agent's tools (update_agent_access), starts another agent (start_session) or pauses a connector, and the Dev Portal's connector wizard pre-selects the Recommended preset (read-only tools run, the rest ask); trusted lets agents do those freely and pre-selects Allow all. In both modes muster's built-in floors ask a person before an agent adds or repoints a connector, changes approval settings, gives an agent an exception or changes muster's own configuration. The meta chart renders muster's governance configuration from it (muster.governance: the mode, and the servers muster treats as agent-manager and the Platform Manager), from the muster release that reads it (agent-platform.muster.governanceFloor); an earlier muster gets none and asks nothing. Only admins switch it, through the Platform Manager with a second person's approval; never an agent. Anything else fails the render. Concept: https://docs.giantswarm.io/overview/agent-platform/governing-tool-calls/ | +| governance | string | `"trusted"` | The platform's governance mode: trusted (the default) or governed. It changes no tool approval setting's meaning; it adds asking for agent callers. Governed asks a person before an agent creates an agent (agent-manager's create_agent), changes an agent's tools (update_agent_access), starts another agent (start_session) or pauses a connector, and the Dev Portal's connector wizard pre-selects the Recommended preset (read-only tools run, the rest ask); trusted lets agents do those freely and pre-selects Allow all. In both modes muster's built-in floors ask a person before an agent adds or repoints a connector, changes approval settings, gives an agent an exception or changes muster's own configuration. The meta chart renders muster's governance configuration from it (muster.governance: the mode, and the servers muster treats as agent-manager and the Platform Manager), from the muster release that reads it (agent-platform.muster.governanceFloor); an earlier muster gets none and asks nothing. From that release the meta chart also renders muster.approval.installation (backstage.installationName, the name the approval page shows) and the pages muster may return the browser to after an approval in muster.oauth.mcpClient.postLoginRedirectAllowlist (the portal's /sessions, klausGateway.obo.callbackBaseUrl + /auth/slack/return; an own list's entries stay). Approval itself needs muster's OAuth server with Dex sign-in, Valkey storage (the default) and muster.muster.oauth.mcpClient.publicUrl on the OAuth server's origin with mcpClient.enabled for the allowlist; the chart does not fail without them, muster refuses asking calls with the reason. Only admins switch it, through the Platform Manager with a second person's approval; never an agent. Anything else fails the render. Concept: https://docs.giantswarm.io/overview/agent-platform/governing-tool-calls/ | | tenants.platform.users | list | `[{"apiGroup":"rbac.authorization.k8s.io","kind":"Group","name":"system:authenticated"}]` | Every signed-in person: bound to agent-platform:platform-user in the kagent namespace, and, while musterMcpServerViewers is unset, to `list` (with get and watch) on muster's MCPServers in muster's namespace (the servers for everyone). RBAC subjects. The default, system:authenticated, gives this to every user. It also gives it to every ServiceAccount, so every pod in the cluster can read the platform tenant's Agents, RemoteMCPServer URLs and muster's MCPServer specs. To give it to people only, replace the default with an OIDC group that every user belongs to, written as the API server sees it (with the installation's OIDC groups prefix). | | tenants.platform.editors | list | `[{"apiGroup":"rbac.authorization.k8s.io","kind":"Group","name":"giantswarm-ad:giantswarm-admins"},{"apiGroup":"rbac.authorization.k8s.io","kind":"Group","name":"giantswarm-github:giantswarm:giantswarm-admins"}]` | The platform's operators: bound to agent-platform:editor in the kagent namespace. RBAC subjects. The Giant Swarm admin groups, as in muster.rbac.*.subjects. | | tenants.platform.kagentRelease.name | string | `""` | The name of kagent's HelmRelease in the kagent namespace. Empty, the default, admits none. | diff --git a/helm/agent-platform/README.md.gotmpl b/helm/agent-platform/README.md.gotmpl index b00aa1b7..0b7f053a 100644 --- a/helm/agent-platform/README.md.gotmpl +++ b/helm/agent-platform/README.md.gotmpl @@ -378,6 +378,25 @@ Every tool behind muster is **Allow**, **Ask** (a person confirms the call first connector, changing approval settings, granting an exception, changing a workflow or muster's configuration) ask on both. Only admins switch it, through the Platform Manager with a second person's approval. Anything but the two values fails the render. +- **What approval needs, and what this chart renders for it.** Asking calls refuse with the reason + unless muster's shared store is Valkey, muster runs its OAuth server (the browser sign-in through + Dex) and has a public URL on that server's origin. The bundled Valkey and + `muster.muster.oauth.server.storage.type: valkey` are the defaults; the OAuth server is on by + default but needs the installation's `oauth.server.baseUrl`, `dex.issuerUrl`, `dex.clientId` and + `existingSecret`; `muster.muster.oauth.mcpClient.enabled` with `publicUrl` (on the origin of + `oauth.server.baseUrl`) is the installation's to set (muster takes the OAuth server's base URL + when `publicUrl` is empty, but renders the allowlist below only with `mcpClient.enabled`). The + chart does not fail a `governed` render without them: muster refuses each asking call with the + reason and `filter_tools` reports `approval.unavailable`. From the same muster release as + `governance` (`agent-platform.muster.governanceFloor`) the meta chart also renders + `muster.approval.installation` (the name the approval page shows: `backstage.installationName`, + default `agent-platform`; an own `muster.muster.approval.installation` stands) and + `muster.oauth.mcpClient.postLoginRedirectAllowlist`, where muster may send the browser back after + a decision: `https:///sessions` while the portal is on and has a host + (`backstage.hostname`, else `backstage.`) and + `/auth/slack/return` while klaus-gateway is on and names it; an + own list's entries stay. Without an entry the person sees muster's own "answer recorded" page and + answers *Done* in the portal or Slack. - **The `connector-admin` role** is muster's `mcpserver-editor` Role in muster's namespace, bound to `muster.rbac.mcpServerEditor.subjects` (the Giant Swarm admin groups) plus `tenants.platformTeam`. Whoever holds it edits the namespace's connectors, sets their tool approval and may let an agent diff --git a/helm/agent-platform/templates/_helpers.tpl b/helm/agent-platform/templates/_helpers.tpl index be9a2d72..12cfd96d 100644 --- a/helm/agent-platform/templates/_helpers.tpl +++ b/helm/agent-platform/templates/_helpers.tpl @@ -1069,6 +1069,17 @@ repeating the admin groups. */ -}} {{- $_ := set $muster "governance" . -}} {{- $_ := set $derived "muster" $muster -}} {{- end -}} +{{- /* muster's approval configuration and the pages it may return the +browser to after an approval, from the same muster floor. */ -}} +{{- with (include "agent-platform.muster.approval" .root | fromJson) -}} +{{- $muster := get $derived "muster" | default dict -}} +{{- $_ := set $muster "approval" . -}} +{{- $_ := set $derived "muster" $muster -}} +{{- end -}} +{{- with (include "agent-platform.muster.redirectAllowlist" .root | fromJsonArray) -}} +{{- $muster := get $derived "muster" | default dict -}} +{{- $_ := set $derived "muster" (mergeOverwrite $muster (dict "oauth" (dict "mcpClient" (dict "postLoginRedirectAllowlist" .)))) -}} +{{- end -}} {{- end -}} {{- if and (eq .name "model-manager") (not (include "agent-platform.componentEnabled" (dict "root" .root "name" "kagent"))) -}} {{- $_ := set $derived "kagent" (dict "disableWiring" true) -}} @@ -4748,9 +4759,12 @@ comment inside the define. The first muster release that reads the governance configuration (muster.governance: the mode and the servers it names per role) and enforces tool approval (Governing tool calls, slice 2 of giantswarm/giantswarm#38902). -UNRELEASED: a placeholder for the release that carries it; below it the meta -chart forwards no governance block, which an older muster chart's closed -schema would refuse. One line, no comment inside the define. +UNRELEASED: PLACEHOLDER-GOVERNANCE-FLOOR, the one value to move to the release +that carries it (muster's tool-approval branch, giantswarm/giantswarm#38902); the +same floor gates the approval block and the redirect allowlist entries below +(agent-platform.muster.approval, agent-platform.muster.redirectAllowlist), and +tests/verify-tool-approval.py takes it from here. Below it the meta chart +forwards none of them. One line, no comment inside the define. */}} {{- define "agent-platform.muster.governanceFloor" -}}5.65.0{{- end -}} @@ -4798,6 +4812,57 @@ Usage: include "agent-platform.muster.governance" $root | fromJson {{- $out | toJson -}} {{- end -}} +{{/* +muster's approval configuration (muster.approval, rendered as `approval` into +config.yaml): installation, the name the approval page shows, from +backstage.installationName (the name the portal shows for this platform, +default agent-platform) unless muster.muster.approval.installation names its +own; any other own key (ttl) is kept. Only from the muster floor +agent-platform.muster.governanceFloor; {} below it. +Usage: include "agent-platform.muster.approval" $root | fromJson +*/}} +{{- define "agent-platform.muster.approval" -}} +{{- $out := dict -}} +{{- if include "agent-platform.componentFloorAtLeast" (dict "root" . "name" "muster" "version" (include "agent-platform.muster.governanceFloor" .)) -}} +{{- $own := dig "muster" "approval" dict (.Values.muster | default dict) | default dict -}} +{{- $out = mergeOverwrite (dict "installation" (include "agent-platform.portalInstallationName" .)) $own -}} +{{- end -}} +{{- $out | toJson -}} +{{- end -}} + +{{/* +The pages muster may send the browser back to after an approval +(muster.oauth.mcpClient.postLoginRedirectAllowlist; an entry admits its path +and everything below it at a segment boundary): the portal's Sessions pages, +https:///sessions, while the portal is on and has a host +(backstage.hostname, else backstage.), and klaus-gateway's +return, /auth/slack/return, while +klaus-gateway is on and names its callbackBaseUrl. An own list's entries stay, +first, each entry once. Only from the muster floor +agent-platform.muster.governanceFloor; [] below it. muster renders the list +only while muster.muster.oauth.mcpClient.enabled is on. +Usage: include "agent-platform.muster.redirectAllowlist" $root | fromJsonArray +*/}} +{{- define "agent-platform.muster.redirectAllowlist" -}} +{{- $out := list -}} +{{- if include "agent-platform.componentFloorAtLeast" (dict "root" . "name" "muster" "version" (include "agent-platform.muster.governanceFloor" .)) -}} +{{- $out = dig "muster" "oauth" "mcpClient" "postLoginRedirectAllowlist" list (.Values.muster | default dict) | default list -}} +{{- $derived := list -}} +{{- $backstage := .Values.backstage | default dict -}} +{{- if include "agent-platform.componentEnabled" (dict "root" . "name" "backstage") -}} +{{- $host := dig "hostname" "" $backstage -}} +{{- if and (not $host) .Values.global.domain -}}{{- $host = printf "backstage.%s" .Values.global.domain -}}{{- end -}} +{{- if $host -}}{{- $derived = append $derived (printf "https://%s/sessions" $host) -}}{{- end -}} +{{- end -}} +{{- if include "agent-platform.componentEnabled" (dict "root" . "name" "klaus-gateway") -}} +{{- $base := dig "obo" "callbackBaseUrl" "" (.Values.klausGateway | default dict) | trimSuffix "/" -}} +{{- if $base -}}{{- $derived = append $derived (printf "%s/auth/slack/return" $base) -}}{{- end -}} +{{- end -}} +{{- range $derived -}}{{- if not (has . $out) -}}{{- $out = append $out . -}}{{- end -}}{{- end -}} +{{- end -}} +{{- $out | toJson -}} +{{- end -}} + {{/* Icons of the shipped presets (infrastructure, agent-platform), for each one muster.muster.toolsetPresets still defines and leaves without an icon, while diff --git a/helm/agent-platform/values.schema.json b/helm/agent-platform/values.schema.json index b7b31465..c6df0eee 100644 --- a/helm/agent-platform/values.schema.json +++ b/helm/agent-platform/values.schema.json @@ -2166,7 +2166,7 @@ }, "governance": { "type": "string", - "description": "The platform's governance mode: trusted (the default) or governed. It changes no tool approval setting's meaning; it adds asking for agent callers. Governed asks a person before an agent creates an agent (agent-manager's create_agent), changes an agent's tools (update_agent_access), starts another agent (start_session) or pauses a connector, and the Dev Portal's connector wizard pre-selects the Recommended preset (read-only tools run, the rest ask); trusted lets agents do those freely and pre-selects Allow all. In both modes muster's built-in floors ask a person before an agent adds or repoints a connector, changes approval settings, gives an agent an exception or changes muster's own configuration. The meta chart renders muster's governance configuration from it (muster.governance: the mode, and the servers muster treats as agent-manager and the Platform Manager), from the muster release that reads it (agent-platform.muster.governanceFloor); an earlier muster gets none and asks nothing. Only admins switch it, through the Platform Manager with a second person's approval; never an agent. Anything else fails the render. Concept: https://docs.giantswarm.io/overview/agent-platform/governing-tool-calls/", + "description": "The platform's governance mode: trusted (the default) or governed. It changes no tool approval setting's meaning; it adds asking for agent callers. Governed asks a person before an agent creates an agent (agent-manager's create_agent), changes an agent's tools (update_agent_access), starts another agent (start_session) or pauses a connector, and the Dev Portal's connector wizard pre-selects the Recommended preset (read-only tools run, the rest ask); trusted lets agents do those freely and pre-selects Allow all. In both modes muster's built-in floors ask a person before an agent adds or repoints a connector, changes approval settings, gives an agent an exception or changes muster's own configuration. The meta chart renders muster's governance configuration from it (muster.governance: the mode, and the servers muster treats as agent-manager and the Platform Manager), from the muster release that reads it (agent-platform.muster.governanceFloor); an earlier muster gets none and asks nothing. From that release the meta chart also renders muster.approval.installation (backstage.installationName, the name the approval page shows) and the pages muster may return the browser to after an approval in muster.oauth.mcpClient.postLoginRedirectAllowlist (the portal's /sessions, klausGateway.obo.callbackBaseUrl + /auth/slack/return; an own list's entries stay). Approval itself needs muster's OAuth server with Dex sign-in, Valkey storage (the default) and muster.muster.oauth.mcpClient.publicUrl on the OAuth server's origin with mcpClient.enabled for the allowlist; the chart does not fail without them, muster refuses asking calls with the reason. Only admins switch it, through the Platform Manager with a second person's approval; never an agent. Anything else fails the render. Concept: https://docs.giantswarm.io/overview/agent-platform/governing-tool-calls/", "enum": [ "trusted", "governed" diff --git a/helm/agent-platform/values.yaml b/helm/agent-platform/values.yaml index a6c22d0d..d0a16096 100644 --- a/helm/agent-platform/values.yaml +++ b/helm/agent-platform/values.yaml @@ -5813,7 +5813,16 @@ clusterManager: # @schema skipProperties: true; additionalProperties: true # from it (muster.governance: the mode, and the servers muster treats as # agent-manager and the Platform Manager), from the muster release that reads # it (agent-platform.muster.governanceFloor); an earlier muster gets none and -# asks nothing. Only admins switch it, through the Platform Manager with a +# asks nothing. From that release the meta chart also renders +# muster.approval.installation (backstage.installationName, the name the +# approval page shows) and the pages muster may return the browser to after an approval in +# muster.oauth.mcpClient.postLoginRedirectAllowlist (the portal's /sessions, +# klausGateway.obo.callbackBaseUrl + /auth/slack/return; an own list's entries +# stay). Approval itself needs muster's OAuth server with Dex sign-in, Valkey +# storage (the default) and muster.muster.oauth.mcpClient.publicUrl on the +# OAuth server's origin with mcpClient.enabled for the allowlist; the chart +# does not fail without them, muster refuses asking calls with the reason. +# Only admins switch it, through the Platform Manager with a # second person's approval; never an agent. Anything else fails the render. # Concept: https://docs.giantswarm.io/overview/agent-platform/governing-tool-calls/ governance: trusted # @schema enum: [trusted, governed] From 7839308a3bf5b174aa073f5b694e380ae5802869 Mon Sep 17 00:00:00 2001 From: Dominik Schmidle Date: Wed, 25 Nov 2026 17:16:17 +0100 Subject: [PATCH 08/56] test(helm): verify approval installation, redirect allowlist and the floor marker --- tests/verify-tool-approval.py | 82 ++++++++++++++++++++++++++++++++++- 1 file changed, 81 insertions(+), 1 deletion(-) diff --git a/tests/verify-tool-approval.py b/tests/verify-tool-approval.py index 644c38f2..6b3e8bfa 100755 --- a/tests/verify-tool-approval.py +++ b/tests/verify-tool-approval.py @@ -9,6 +9,16 @@ (giantswarm-platform-manager); an own servers entry stands; an own mode that differs fails naming both keys; an unknown mode fails in the schema and, past it, in the template; below the floor nothing is forwarded. +- approval configuration: from the same floor the muster release carries + muster.approval.installation (backstage.installationName, default + agent-platform; an own value and an own ttl stand) and the redirect allowlist + muster.oauth.mcpClient.postLoginRedirectAllowlist: the portal's + https:///sessions while the portal is on and has a host, and + klaus-gateway's /auth/slack/return while klaus-gateway is + on and names it; own entries stay, first, once each; none below the floor. +- governance floor: one marked placeholder value (PLACEHOLDER-GOVERNANCE-FLOOR in + agent-platform.muster.governanceFloor), which this test reads, so moving it to + the real release needs no other edit. - connector-admin: muster's mcpserver-editor Role (the platform's connector-admin role) is bound to the configured groups: the Giant Swarm admin groups by default, tenants.platformTeam appended, an installation's own list @@ -30,11 +40,12 @@ from __future__ import annotations import os +import re import subprocess import sys HELM = os.environ.get("HELM", "helm") -FLOOR_RANGE = "components.muster.versionRange=>=5.65.0 <6.0.0-0" +FLOOR_RANGE = "" # set in main from agent-platform.muster.governanceFloor META = ["--set", "components.flux.enabled=false"] CONN = [ "--namespace", "agent-platform", @@ -54,6 +65,20 @@ MCPK = ["--set", "components.mcp-kubernetes.enabled=true"] +def governance_floor(meta_dir: str) -> str: + """The value of agent-platform.muster.governanceFloor, and its one marker.""" + text = open(os.path.join(meta_dir, "templates", "_helpers.tpl")).read() + m = re.search(r'define "agent-platform\.muster\.governanceFloor" -\}\}([0-9]+\.[0-9]+\.[0-9]+)\{\{-', text) + if not m: + fail("agent-platform.muster.governanceFloor must be one line holding one X.Y.Z") + if text.count("PLACEHOLDER-GOVERNANCE-FLOOR") != 1: + fail("the governance floor placeholder must be marked exactly once (PLACEHOLDER-GOVERNANCE-FLOOR) next to its define") + values = open(os.path.join(meta_dir, "values.yaml")).read() + if f">={m.group(1)}" in values: + fail(f"values.yaml repeats the governance floor {m.group(1)}: it lives in agent-platform.muster.governanceFloor alone") + return m.group(1) + + def fail(msg: str) -> None: sys.exit(f"FAIL: {msg}") @@ -148,6 +173,59 @@ def check_governance() -> None: print("ok: governance renders muster's governance configuration (trusted by default, governed, servers, own entries), none below the floor, unknown and conflicting modes fail") +def check_approval_config() -> None: + def release(args: list[str]) -> str: + return muster_release(["--set", FLOOR_RANGE, "--set", "global.domain=ci.example.com", *args]) + + default = release([]) + approval = block(default, " approval:") + if approval.rstrip() != " approval:\n installation: agent-platform": + fail(f"default approval, want installation agent-platform:\n{approval}") + named = block(release(["--set", "backstage.installationName=lab-1"]), " approval:") + if "installation: lab-1" not in named: + fail(f"approval.installation must follow backstage.installationName:\n{named}") + own = block(release(["--set", "muster.muster.approval.installation=mine", "--set", "muster.muster.approval.ttl=10m"]), " approval:") + if "installation: mine" not in own or "ttl: 10m" not in own or "agent-platform" in own: + fail(f"an own installation and ttl must stand:\n{own}") + # the allowlist renders only for muster's OAuth client role, as muster's chart does + mc = ["--set", "muster.muster.oauth.mcpClient.enabled=true"] + portal = ["--set", "components.backstage.enabled=true"] + kg = ["--set", "components.klaus-gateway.enabled=true", "--set", "klausGateway.obo.callbackBaseUrl=https://gw.ci.example.com/"] + list_header = " postLoginRedirectAllowlist:" + if block(release(mc), list_header): + fail("with the portal and klaus-gateway off there is nothing to allow: no allowlist expected") + both = block(release(mc + portal + kg), list_header) + want = list_header + "\n - https://backstage.ci.example.com/sessions\n - https://gw.ci.example.com/auth/slack/return" + if both.rstrip() != want: + fail(f"allowlist with the portal and klaus-gateway, want:\n{want}\ngot:\n{both}") + only_portal = block(release(mc + portal + ["--set", "klausGateway.obo.callbackBaseUrl=https://gw.ci.example.com"]), list_header) + if "auth/slack/return" in only_portal: + fail(f"no klaus-gateway entry while klaus-gateway is off:\n{only_portal}") + off = block(release(mc + kg), list_header) + if "sessions" in off or "https://gw.ci.example.com/auth/slack/return" not in off: + fail(f"klaus-gateway alone must give its return and no portal entry:\n{off}") + no_url = block(release(mc + ["--set", "components.klaus-gateway.enabled=true"]), list_header) + if no_url: + fail(f"klaus-gateway without a callbackBaseUrl names nothing to allow:\n{no_url}") + host = block(release(mc + portal + ["--set", "backstage.hostname=portal.example.org"]), list_header) + if "https://portal.example.org/sessions" not in host or "backstage.ci.example.com" in host: + fail(f"backstage.hostname must win over the global.domain derivation:\n{host}") + merged = block(release(mc + portal + kg + [ + "--set", "muster.muster.oauth.mcpClient.postLoginRedirectAllowlist[0]=https://own.example.com/x", + "--set", "muster.muster.oauth.mcpClient.postLoginRedirectAllowlist[1]=https://backstage.ci.example.com/sessions", + ]), list_header) + lines = [l.strip() for l in merged.split("\n")[1:]] + if lines != ["- https://own.example.com/x", "- https://backstage.ci.example.com/sessions", "- https://gw.ci.example.com/auth/slack/return"]: + fail(f"own entries stay first, each entry once:\n{merged}") + below = muster_release(["--set", "global.domain=ci.example.com", *mc, *portal, *kg]) + if block(below, " approval:") or "auth/slack/return" in below or "/sessions" in below: + fail("below the muster floor the muster release must carry neither approval nor derived allowlist entries") + connectivity = doc(render_meta(["--set", FLOOR_RANGE, *portal]), "HelmRelease", "agent-platform-connectivity") + if connectivity and "\n approval:\n installation:" in connectivity: + fail("the approval block must not reach the connectivity release") + print("ok: muster.approval.installation follows backstage.installationName, the redirect allowlist names the portal's /sessions and klaus-gateway's /auth/slack/return where they are on, own values stand, none below the floor") + + def check_connector_admin() -> None: editor = block(muster_release([]), " mcpServerEditor:") for group in ("giantswarm-ad:giantswarm-admins", "giantswarm-github:giantswarm:giantswarm-admins"): @@ -235,7 +313,9 @@ def check_approval() -> None: if __name__ == "__main__": META_DIR, CONN_DIR = sys.argv[1], sys.argv[2] + FLOOR_RANGE = f"components.muster.versionRange=>={governance_floor(META_DIR)} <6.0.0-0" check_governance() + check_approval_config() check_connector_admin() check_binder() check_approval() From 9270b56e6365a16a942ccc39862fbd7c56e0b4ab Mon Sep 17 00:00:00 2001 From: Dominik Schmidle Date: Wed, 25 Nov 2026 17:16:17 +0100 Subject: [PATCH 09/56] docs(skills): name approval's prerequisites and the derived redirect allowlist --- skills/agent-platform-tools/SKILL.md | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/skills/agent-platform-tools/SKILL.md b/skills/agent-platform-tools/SKILL.md index e54f51e0..df62c82e 100644 --- a/skills/agent-platform-tools/SKILL.md +++ b/skills/agent-platform-tools/SKILL.md @@ -2,7 +2,7 @@ name: agent-platform-tools description: Use when a question is about tools on the Agent Platform — Muster's meta-tools and call_tool, finding or running a tool, what a toolset or preset resolves to, why a tool is missing, refused or asks for approval, a connector's Allow/Ask/Block settings and presets, connectors and signing in to one, workflows, or model-manager. metadata: - version: "3.4.0" + version: "3.4.1" --- # Tools on the Agent Platform @@ -168,8 +168,11 @@ agent, the portal, Slack, Claude Code): workflow, or changes Muster's configuration (that one asks every caller). A **governed** platform also asks before an agent creates an agent, changes an agent's tools, starts another agent's session or pauses a connector; a **trusted** one (the default) lets agents do those freely. -- Missing prerequisites (Muster's Valkey store, its browser sign-in) make every asking call - refused, with the reason; tell the person, it is the installation's to fix. +- Missing prerequisites (Muster's Valkey store, its OAuth server with browser sign-in, a public URL + on that server's origin) make every asking call refused with the reason, reported as + `approval.unavailable` on each tool that asks; tell the person, it is the installation's to fix + (the platform chart does not fail a render over it). The approval page returns the browser to the + portal or Slack only where the installation's redirect allowlist names them; the chart derives it. ## Workflows From 11d625fd08327a534ceb6d5216e327dd0c5e3270 Mon Sep 17 00:00:00 2001 From: Dominik Schmidle Date: Wed, 25 Nov 2026 21:24:14 +0100 Subject: [PATCH 10/56] feat(helm): accept Block as the tool approval rule on the connectivity MCPServers muster accepts Block as spec.approval.rule: tools without their own entry, new ones included, are hidden and refused. The comments say what governed platforms ask on kagent and mcp-kubernetes and that the kubernetes aliases follow the rule. --- .../templates/_helpers.tpl | 7 ++-- .../agent-manager/muster-approval-binder.yaml | 32 ------------------- helm/agent-platform-connectivity/values.yaml | 32 +++++++++++++------ 3 files changed, 27 insertions(+), 44 deletions(-) delete mode 100644 helm/agent-platform-connectivity/templates/agent-manager/muster-approval-binder.yaml diff --git a/helm/agent-platform-connectivity/templates/_helpers.tpl b/helm/agent-platform-connectivity/templates/_helpers.tpl index 4c37590d..daabf660 100644 --- a/helm/agent-platform-connectivity/templates/_helpers.tpl +++ b/helm/agent-platform-connectivity/templates/_helpers.tpl @@ -2562,7 +2562,8 @@ string, so `with` gates a caller's comment). Include with nindent under {{/* An MCPServer's spec.approval from a values block (Governing tool calls, giantswarm/giantswarm#38902), validated the way the CRD's CEL rules check it so -a wrong value fails the render naming the key: `rule` Allow or Ask, `tools` a +a wrong value fails the render naming the key: `rule` Allow, Ask or Block (a +Block rule hides and refuses every tool without its own entry), `tools` a map of at most 512 tool names to Allow, Ask or Block, nothing else. Renders the `approval:` block at two spaces of indentation, nothing for an empty or null block. @@ -2580,8 +2581,8 @@ Usage: include "agent-platform.mcpServerApproval" (dict "approval" $block "key" {{- end -}} {{- end -}} {{- if hasKey $a "rule" -}} -{{- if not (has (toString $a.rule) (list "Allow" "Ask")) -}} -{{- fail (printf "%s.rule %q: want Allow or Ask" .key (toString $a.rule)) -}} +{{- if not (has (toString $a.rule) (list "Allow" "Ask" "Block")) -}} +{{- fail (printf "%s.rule %q: want Allow, Ask or Block" .key (toString $a.rule)) -}} {{- end -}} {{- end -}} {{- $tools := $a.tools | default dict -}} diff --git a/helm/agent-platform-connectivity/templates/agent-manager/muster-approval-binder.yaml b/helm/agent-platform-connectivity/templates/agent-manager/muster-approval-binder.yaml deleted file mode 100644 index 002549ae..00000000 --- a/helm/agent-platform-connectivity/templates/agent-manager/muster-approval-binder.yaml +++ /dev/null @@ -1,32 +0,0 @@ -{{- /* -agent-manager sends a Session's agent tool list (per-entry Allow/Ask/Block, -`default`, grant marks) to muster with its own projected ServiceAccount token -(audience muster) beside the person's. muster takes those settings only from a -sender whose token passes a TokenReview and whose identity a -SubjectAccessReview allows verb `bind` on `toolapprovals` -(muster.giantswarm.io) in muster's namespace (Governing tool calls, -giantswarm/giantswarm#38902). The muster chart ships that permission as the -Role muster-approval-binder, bound to nobody; this RoleBinding grants it to -agent-manager's ServiceAccount, and only to it, in muster's namespace (this -release's, as agent-platform:mcpserver-viewer). Rendered while agent-manager -and muster are on; a muster that does not ship the Role yet leaves it inert. -*/ -}} -{{- if and (include "agent-platform.agentManager.enabled" .) (include "agent-platform.componentEnabled" (dict "root" $ "name" "muster")) }} -{{- $user := include "agent-platform.agentManager.serviceAccountUser" . }} -{{- $parts := splitList ":" $user }} -apiVersion: rbac.authorization.k8s.io/v1 -kind: RoleBinding -metadata: - name: agent-platform:muster-approval-binder - namespace: {{ .Release.Namespace }} - labels: - {{- include "agent-platform.agentManager.labels" . | nindent 4 }} -roleRef: - apiGroup: rbac.authorization.k8s.io - kind: Role - name: muster-approval-binder -subjects: - - kind: ServiceAccount - name: {{ index $parts 3 }} - namespace: {{ index $parts 2 }} -{{- end }} diff --git a/helm/agent-platform-connectivity/values.yaml b/helm/agent-platform-connectivity/values.yaml index 7297940c..a36077d3 100644 --- a/helm/agent-platform-connectivity/values.yaml +++ b/helm/agent-platform-connectivity/values.yaml @@ -1799,16 +1799,22 @@ kagent: # @schema skipProperties: true; additionalProperties: true description: "Your agent sessions on this installation, as the signed-in person: list them, send one a message, and checkpoint or fork them" # The connector's tool approval (the MCPServer's spec.approval; Governing # tool calls, https://docs.giantswarm.io/overview/agent-platform/governing-tool-calls/): - # `rule` (Allow | Ask) for a tool without its own entry, new tools - # included, and `tools`, the server's own tool names -> Allow | Ask | + # `rule` (Allow | Ask | Block; a Block rule hides and refuses every + # tool without its own entry, new ones included) for a tool without its + # own entry, and `tools`, the server's own tool names -> Allow | Ask | # Block (Block hides the tool), at most 512. Written out for every tool # of the kagent line as the Allow all preset: the platform's own session # tools, which every session with the agent-platform preset uses as the # person who ran the turn and which carry no MCP annotations (Recommended - # would make reads ask too); agent callers are asked by muster's floors - # and the governance mode, not here. An installation tightens a tool - # here; null renders none (the connector runs every tool, not reviewed). - # A muster whose CRD lacks spec.approval drops the field. + # would make reads ask too). These settings apply on a trusted platform + # (invoke_session and fork_session included: no floor covers them); on a + # governed one muster asks agents before every tool of this server that + # is not on its safe list (the meta chart's governedServers.kagent, role + # sessionManager: the list and read tools), whatever these say. An + # installation tightens a tool here; null renders none (the connector + # runs every tool, not reviewed). A muster whose CRD lacks spec.approval + # drops the field, and muster then refuses the server's tools until the + # CRD is upgraded. approval: rule: Allow tools: @@ -3680,7 +3686,8 @@ mcp-kubernetes: # @schema skipProperties: true; additionalProperties: true description: "Resources, events and pod logs of this installation's cluster, and the health of its workload clusters" # The connector's tool approval (the MCPServer's spec.approval; Governing # tool calls, https://docs.giantswarm.io/overview/agent-platform/governing-tool-calls/): - # `rule` (Allow | Ask) for a tool without its own entry, new tools + # `rule` (Allow | Ask | Block; a Block rule hides and refuses every tool + # without its own entry) for a tool without its own entry, new tools # included, and `tools`, the server's own tool names -> Allow | Ask | Block # (Block hides the tool), at most 512. Written out for every tool of # mcp-kubernetes as the Recommended preset, as agent-platform-mcps' @@ -3688,8 +3695,15 @@ mcp-kubernetes: # @schema skipProperties: true; additionalProperties: true # asks a person (the mutating ones are registered only when the server's # non-destructive mode is off), new tools ask until listed. An # installation changes a tool here; null renders none (the connector - # runs every tool, not reviewed). A muster whose CRD lacks spec.approval - # drops the field. + # runs every tool, not reviewed). The 15 deprecated kubernetes_* aliases + # the server registers beside these are not listed: they follow the rule + # (Ask). This map equals agent-platform-mcps' kubernetes family's (make + # verify-tool-approval compares them where that checkout is beside this + # one). On a governed platform muster asks agents before every tool not on + # the meta chart's governedServers.mcp-kubernetes safe list (role + # infrastructure), whatever these say. A muster whose CRD lacks + # spec.approval drops the field, and muster then refuses the server's + # tools until the CRD is upgraded. approval: rule: Ask tools: From bde1e10a9fc75f495c93cef50c53d361aef3085a Mon Sep 17 00:00:00 2001 From: Dominik Schmidle Date: Wed, 25 Nov 2026 21:24:14 +0100 Subject: [PATCH 11/56] feat(helm): render muster's governed servers with safe lists and bind the approval binder in muster's namespace muster's new governance shape: governance.governedServers {server, role, safe} for every MCPServer the platform ships (top-level governedServers, keyed namespace/name outside muster's namespace), on trusted too so the role floors hold. governed below the muster floor and the earlier servers shape fail the render. muster.rbac.approvalBinder.subjects names agent-manager's ServiceAccount (the muster chart binds it in muster's namespace); the connectivity chart's own RoleBinding is gone, and an unnamed ServiceAccount the chart does not create fails. The redirect allowlist keeps a non-default port (backstage.publicPort, klaus-gateway's callbackBaseUrl as written) and refuses an invalid callbackBaseUrl; NOTES say when mcpClient.enabled is off. README: Block rule, governed servers, MCP-session retry, upgrade notes. --- helm/agent-platform/README.md | 108 ++++++++--- helm/agent-platform/README.md.gotmpl | 106 +++++++--- helm/agent-platform/templates/NOTES.txt | 6 + helm/agent-platform/templates/_helpers.tpl | 215 ++++++++++++++++++--- helm/agent-platform/values.schema.json | 14 +- helm/agent-platform/values.yaml | 126 +++++++++--- 6 files changed, 469 insertions(+), 106 deletions(-) diff --git a/helm/agent-platform/README.md b/helm/agent-platform/README.md index eee899e8..11271e07 100644 --- a/helm/agent-platform/README.md +++ b/helm/agent-platform/README.md @@ -379,19 +379,31 @@ required); below `1.3.0` the key is refused. ## Tool approval and the governance mode Every tool behind muster is **Allow**, **Ask** (a person confirms the call first) or **Block** -(hidden); the concept, who sets what and the prompts are on +(hidden and refused); a connector's `rule` (Allow, Ask or Block) is what a tool without its own +entry gets, new tools included, so a Block rule lets nobody add an unreviewed tool. The concept, +who sets what and the prompts are on [Governing tool calls](https://docs.giantswarm.io/overview/agent-platform/governing-tool-calls/). What this chart configures: -- **`governance`** (`trusted`, the default, or `governed`): the platform's governance mode. The meta - chart renders it into muster's governance configuration (`muster.governance`: the mode and the - servers muster treats as agent-manager, `agent-manager.muster.mcpServer.name`, and the Platform - Manager, `giantswarm-platform-manager`; an own `muster.muster.governance.servers.` stands) - from the muster release that reads it (`agent-platform.muster.governanceFloor`); an earlier muster - gets none. Governed asks a person before an agent creates an agent, changes an agent's tools, - starts another agent or pauses a connector; the floors (an agent adding or repointing a - connector, changing approval settings, granting an exception, changing a workflow or muster's - configuration) ask on both. Only admins switch it, through the Platform Manager with a second - person's approval. Anything but the two values fails the render. +- **`governance`** (`trusted`, the default, or `governed`) and **`governedServers`**: the meta + chart renders muster's governance configuration (`muster.governance`: `mode` and + `governedServers`, one `{server, role, safe}` per MCPServer the platform ships while it renders) + from the muster release that reads it (`agent-platform.muster.governanceFloor`). On governed, + muster asks a person before an agent runs any tool of a governed server that is not on that + server's safe list (new and renamed tools too) and any of muster's own tools but its reads; the + safe lists are the read tools (`governedServers..safe`). A role's floors (granting access, + adding a model, egress origin, credential or backend, approving an action or a toolchain source, + adding or repointing a connector, changing approval settings) ask agents in both modes, on the + governed server of that role, so the servers are named on trusted as well. Sources: the manager + components (their `muster.mcpServer.name` in their namespace), `kagent` (the connectivity chart's + session tools), `mcp-kubernetes` (the connectivity chart's and every agent-platform-mcps + kubernetes entry) and `giantswarm-platform-manager`; a server outside muster's namespace is keyed + `namespace/name`. `null` drops a source; `governanceExempt` names the shipped sources that are + deliberately not governed (prometheus, capi: reads only). An own + `muster.muster.governance.governedServers` entry stands for its server; the earlier + `muster.muster.governance.servers.` shape fails the render, as does `governed` below the + muster floor (it would ask nothing). Persons get the connector settings only. Only admins switch + the mode, through the Platform Manager with a second person's approval. Anything but the two + values fails the render. - **What approval needs, and what this chart renders for it.** Asking calls refuse with the reason unless muster's shared store is Valkey, muster runs its OAuth server (the browser sign-in through Dex) and has a public URL on that server's origin. The bundled Valkey and @@ -399,37 +411,73 @@ Every tool behind muster is **Allow**, **Ask** (a person confirms the call first default but needs the installation's `oauth.server.baseUrl`, `dex.issuerUrl`, `dex.clientId` and `existingSecret`; `muster.muster.oauth.mcpClient.enabled` with `publicUrl` (on the origin of `oauth.server.baseUrl`) is the installation's to set (muster takes the OAuth server's base URL - when `publicUrl` is empty, but renders the allowlist below only with `mcpClient.enabled`). The - chart does not fail a `governed` render without them: muster refuses each asking call with the - reason and `filter_tools` reports `approval.unavailable`. From the same muster release as - `governance` (`agent-platform.muster.governanceFloor`) the meta chart also renders + when `publicUrl` is empty, but renders the allowlist below only with `mcpClient.enabled`; the + release notes say so while it is off). The chart does not fail a `governed` render without them: + muster refuses each asking call with the reason and `filter_tools` reports + `approval.unavailable`. From the same muster release the meta chart also renders `muster.approval.installation` (the name the approval page shows: `backstage.installationName`, default `agent-platform`; an own `muster.muster.approval.installation` stands) and `muster.oauth.mcpClient.postLoginRedirectAllowlist`, where muster may send the browser back after - a decision: `https:///sessions` while the portal is on and has a host - (`backstage.hostname`, else `backstage.`) and - `/auth/slack/return` while klaus-gateway is on and names it; an - own list's entries stay. Without an entry the person sees muster's own "answer recorded" page and - answers *Done* in the portal or Slack. + a decision (scheme, host and port must match exactly): `https://[:]/sessions` + while the portal is on and has a host (`backstage.hostname`, else `backstage.`; + the port from `backstage.publicPort` when it is not 443) and + `/auth/slack/return` (its port kept; anything but an http(s) + URL with a host fails) while klaus-gateway is on and names it; an own list's entries stay. + Without an entry the person sees muster's own "answer recorded" page and answers *Done* in the + portal or Slack. +- **Retry over the same MCP session.** muster binds a pending approval to the client's MCP session + (`Mcp-Session-Id`) within muster's session: after the person decides, the client retries over the + connection that got the prompt; another connection of the same person asks anew. At most 3 + pending approvals per MCP connection and 10 per person. - **The `connector-admin` role** is muster's `mcpserver-editor` Role in muster's namespace, bound to `muster.rbac.mcpServerEditor.subjects` (the Giant Swarm admin groups) plus `tenants.platformTeam`. Whoever holds it edits the namespace's connectors, sets their tool approval and may let an agent - skip a tool's `Ask`. The muster chart binds nobody by default, so this list is what keeps - connector admins on an upgrade; `system:authenticated` makes everyone one. + skip a tool's `Ask`. The muster chart no longer binds `system:authenticated` and fails an upgrade + with an empty list while its old binding exists; this list is never empty by default, so the + upgrade passes and the editors become the admin groups (`system:authenticated` makes everyone one + again). - **`muster-approval-binder`**: muster takes an agent's tool settings in a Session binding only from - a sender allowed to `bind` `toolapprovals`. The muster chart ships that Role; the connectivity - release binds it to agent-manager's ServiceAccount, and only to it, in muster's namespace. + a sender allowed to `bind` `toolapprovals` in muster's namespace. The muster chart ships that Role + and binds it there, to `muster.rbac.approvalBinder.subjects`, which the meta chart sets to + agent-manager's ServiceAccount (its name and namespace), and only it; an own list stands, and an + agent-manager ServiceAccount the chart does not create must be named. muster reviews the sender + with its own `tokenreviews` ClusterRole and a `localsubjectaccessreviews` Role in its namespace + (`muster.rbac.approvalBinder.reviews`, on by default), not `system:auth-delegator`. - **Explicit settings on every shipped connector** (`spec.approval`): the MCPServers this chart renders carry them as values — `mcp-kubernetes.mcpServer.approval` (the *Recommended* preset: read-only tools Allow, the rest Ask, rule Ask) and `kagent.controllerRoute.mcp.approval` (*Allow all*: kagent's session tools carry no annotations, and agents use them as the person); the component charts set theirs under `.muster.mcpServer.approval` (*Allow all* for the managers, whose tools the portal calls as the person) and agent-platform-mcps per family - (`agent-platform-mcps.muster.families..approval`, *Recommended*). An installation tightens - a tool there (`Ask`, `Block`); `null` removes the block (the connector runs everything, shown as - *not reviewed*). A muster whose CRD lacks `spec.approval` drops the field. + (`agent-platform-mcps.muster.families..approval`, *Recommended*). These are what trusted + platforms and persons get; governed platforms ask agents by the safe lists above. An + installation tightens a tool there (`Ask`, `Block`) or the rule (`Block`); `null` removes the + block (the connector runs everything, shown as *not reviewed*). -`make verify-tool-approval` asserts all four. +### Upgrading to tool approval + +- Move `components.muster.versionRange` to the muster release that carries tool approval + (`agent-platform.muster.governanceFloor`) together with this chart: below it nothing is + forwarded and `governed` fails the render. muster's CRDs upgrade with the muster release + (`CreateReplace`) and every consumer of them `dependsOn` muster. +- While the served MCPServer CRD lacks `spec.approval`, muster refuses every server tool + (`approval_unavailable`) rather than run them unreviewed. A release applied while the old CRD + was served lost its `spec.approval` (the API server prunes unknown fields) and Helm does not + re-apply an unchanged release: after the CRD upgrade, reconcile the connectivity, agent-platform-mcps and + manager releases with `flux reconcile helmrelease --force`, then check + `kubectl get mcpservers -A -o custom-columns=NAME:.metadata.name,RULE:.spec.approval.rule`. +- `muster.rbac.mcpServerEditor.subjects` must stay non-empty (the default) or the muster chart + fails the upgrade while the old `system:authenticated` binding exists + (`muster.rbac.mcpServerEditor.allowRemovingBinding: true` drops it deliberately). +- The connectivity release no longer renders `agent-platform:muster-approval-binder` (Helm deletes + it); the muster release binds `muster-approval-binder` in muster's namespace instead. +- On a lab or any edge not on 443, set `backstage.publicPort` and drop a hand-written portal entry + from `muster.muster.oauth.mcpClient.postLoginRedirectAllowlist`. +- Clients retry an approved call over the same MCP session (see above). + +`make verify-tool-approval` asserts the governance configuration and its coverage (every shipped +MCPServer governed or exempt, no floor safe, every safe entry a tool of its server), the +allowlist, the connector admins, the binder and the connectors' settings. ## Voluntary disruption @@ -1569,7 +1617,9 @@ The map is merged into each component's own `nodeSelector` (`muster.nodeSelector | clusterManager.networkPolicy.workloadClusters.ports[1] | int | `6443` | | | clusterManager.networkPolicy.egress.fqdns | list | `[]` | | | clusterManager.networkPolicy.egress.cidrs | list | `[]` | | -| governance | string | `"trusted"` | The platform's governance mode: trusted (the default) or governed. It changes no tool approval setting's meaning; it adds asking for agent callers. Governed asks a person before an agent creates an agent (agent-manager's create_agent), changes an agent's tools (update_agent_access), starts another agent (start_session) or pauses a connector, and the Dev Portal's connector wizard pre-selects the Recommended preset (read-only tools run, the rest ask); trusted lets agents do those freely and pre-selects Allow all. In both modes muster's built-in floors ask a person before an agent adds or repoints a connector, changes approval settings, gives an agent an exception or changes muster's own configuration. The meta chart renders muster's governance configuration from it (muster.governance: the mode, and the servers muster treats as agent-manager and the Platform Manager), from the muster release that reads it (agent-platform.muster.governanceFloor); an earlier muster gets none and asks nothing. From that release the meta chart also renders muster.approval.installation (backstage.installationName, the name the approval page shows) and the pages muster may return the browser to after an approval in muster.oauth.mcpClient.postLoginRedirectAllowlist (the portal's /sessions, klausGateway.obo.callbackBaseUrl + /auth/slack/return; an own list's entries stay). Approval itself needs muster's OAuth server with Dex sign-in, Valkey storage (the default) and muster.muster.oauth.mcpClient.publicUrl on the OAuth server's origin with mcpClient.enabled for the allowlist; the chart does not fail without them, muster refuses asking calls with the reason. Only admins switch it, through the Platform Manager with a second person's approval; never an agent. Anything else fails the render. Concept: https://docs.giantswarm.io/overview/agent-platform/governing-tool-calls/ | +| governance | string | `"trusted"` | The platform's governance mode: trusted (the default) or governed. It changes no tool approval setting's meaning; it adds asking for agent callers. Governed asks a person before an agent runs any tool of a governed server (governedServers below) that is not on that server's safe list (new and renamed tools too), and before any of muster's own tools but its reads; the Dev Portal's connector wizard pre-selects the Recommended preset (read-only tools run, the rest ask). Trusted lets agents run what the connectors' own settings allow and pre-selects Allow all. In both modes muster's built-in floors ask a person before an agent adds or repoints a connector, changes approval settings, grants access, adds a model, egress origin, credential or backend, approves an action or a toolchain source, or changes muster's own configuration; the role floors hold on the governed servers of that role, so governedServers names them in both modes. The meta chart renders muster's governance configuration from it (muster.governance: the mode and governedServers), from the muster release that reads it (agent-platform.muster.governanceFloor); below it `governed` fails the render and trusted renders nothing. From that release the meta chart also renders muster.approval.installation (backstage.installationName, the name the approval page shows), muster-approval-binder's subject (agent-manager's ServiceAccount, muster.rbac.approvalBinder.subjects) and the pages muster may return the browser to after an approval in muster.oauth.mcpClient.postLoginRedirectAllowlist (the portal's /sessions with backstage.publicPort, klausGateway.obo.callbackBaseUrl + /auth/slack/return; an own list's entries stay). Approval itself needs muster's OAuth server with Dex sign-in, Valkey storage (the default) and muster.muster.oauth.mcpClient.publicUrl on the OAuth server's origin with mcpClient.enabled for the allowlist; the chart does not fail without them, muster refuses asking calls with the reason. Only admins switch it, through the Platform Manager with a second person's approval; never an agent. Anything else fails the render. Concept: https://docs.giantswarm.io/overview/agent-platform/governing-tool-calls/ | +| governanceExempt | object | `{"prometheus":"agent-platform-mcps' prometheus family (mcp-prometheus): every tool reads","capi":"agent-platform-mcps' capi family (mcp-kubernetes' CAPI tools): every tool reads"}` | MCPServer sources the platform ships that muster deliberately does not govern, each with its reason (make verify-tool-approval wants every shipped source in governedServers or here). Read by the meta chart's tests only. | +| governedServers | object | `{"agent-manager":{"role":"agentManager","safe":["get_info","list_agents","get_agent","get_agent_status","validate_agent","list_model_configs","list_egress_policies","list_skills","list_sessions","get_session","get_session_turn","toolchain_users","list_organizations","get_organization","list_organization_members","list_organization_connectors"]},"kagent":{"role":"sessionManager","safe":["list_sessions","list_session_checkpoints","list_sandbox_templates","list_sandboxes","get_sandbox","get_sandbox_process","read_sandbox_outputs","read_sandbox_file"]},"model-manager":{"role":"modelManager","safe":["get_info","get_backend","list_backends","list_models","get_model","list_loaded_models","list_presets","search_models","check_fit","list_nodes","list_jobs","get_job"]},"cluster-manager":{"role":"clusterManager","safe":["get_info","list_clusters","list_releases","list_node_pools"]},"vm-manager":{"role":"vmManager","safe":["get_info","get_host","list_images","get_image","list_networks","get_network","list_vms","get_vm","get_vm_metrics","get_vm_attestation"]},"toolchain-manager":{"role":"toolchainManager","safe":["list_sources","list_toolchains","describe_toolchain","toolchain_build_status","search_packages"]},"workspace-manager":{"role":"workspaceManager","safe":["list_providers","list_owners","list_workspaces","get_workspace","list_repositories","preview_workspace"]},"skill-manager":{"role":"skillManager","safe":["list_skill_sources","list_skills","resolve_skills","get_skill","get_skill_file"]},"mcp-kubernetes":{"role":"infrastructure","safe":["logs","list_port_forward_sessions","context_list","context_get_current","can_i","api_resources","cluster_health","capi_list_clusters","capi_get_cluster","capi_resolve_cluster","capi_cluster_health","get","list","describe"]},"giantswarm-platform-manager":{"role":"platformManager","safe":[]}}` | The servers muster governs (muster.governance.governedServers), per source the platform ships: `role` (which of muster's role floors hold on it: agentManager, platformManager, connectorManager, sessionManager, modelManager, clusterManager, vmManager, workspaceManager, toolchainManager, skillManager, infrastructure) and `safe`, the server's own tool names agents call unasked on governed (reads only; a floor never, muster refuses to start on one). Every other tool of a governed server asks agents on governed. A source renders one entry per MCPServer it ships while that renders (agent-platform.muster.governedKeys): a manager component's .muster.mcpServer.name in its namespace; kagent the connectivity chart's kagent server; mcp-kubernetes the connectivity chart's and every agent-platform-mcps kubernetes entry; any other key is a muster server key itself (giantswarm-platform-manager). null drops a source (then list it in governanceExempt with the reason). make verify-tool-approval fails on a shipped MCPServer that is neither here nor in governanceExempt, and on a safe entry that names a floor or no tool of its server. Safe lists: tool-approval governed-safe-list-proposal (giantswarm/giantswarm#38902). | | tenants.platform.users | list | `[{"apiGroup":"rbac.authorization.k8s.io","kind":"Group","name":"system:authenticated"}]` | Every signed-in person: bound to agent-platform:platform-user in the kagent namespace, and, while musterMcpServerViewers is unset, to `list` (with get and watch) on muster's MCPServers in muster's namespace (the servers for everyone). RBAC subjects. The default, system:authenticated, gives this to every user. It also gives it to every ServiceAccount, so every pod in the cluster can read the platform tenant's Agents, RemoteMCPServer URLs and muster's MCPServer specs. To give it to people only, replace the default with an OIDC group that every user belongs to, written as the API server sees it (with the installation's OIDC groups prefix). | | tenants.platform.editors | list | `[{"apiGroup":"rbac.authorization.k8s.io","kind":"Group","name":"giantswarm-ad:giantswarm-admins"},{"apiGroup":"rbac.authorization.k8s.io","kind":"Group","name":"giantswarm-github:giantswarm:giantswarm-admins"}]` | The platform's operators: bound to agent-platform:editor in the kagent namespace. RBAC subjects. The Giant Swarm admin groups, as in muster.rbac.*.subjects. | | tenants.platform.kagentRelease.name | string | `""` | The name of kagent's HelmRelease in the kagent namespace. Empty, the default, admits none. | diff --git a/helm/agent-platform/README.md.gotmpl b/helm/agent-platform/README.md.gotmpl index 0b7f053a..8acfba46 100644 --- a/helm/agent-platform/README.md.gotmpl +++ b/helm/agent-platform/README.md.gotmpl @@ -365,19 +365,31 @@ required); below `1.3.0` the key is refused. ## Tool approval and the governance mode Every tool behind muster is **Allow**, **Ask** (a person confirms the call first) or **Block** -(hidden); the concept, who sets what and the prompts are on +(hidden and refused); a connector's `rule` (Allow, Ask or Block) is what a tool without its own +entry gets, new tools included, so a Block rule lets nobody add an unreviewed tool. The concept, +who sets what and the prompts are on [Governing tool calls](https://docs.giantswarm.io/overview/agent-platform/governing-tool-calls/). What this chart configures: -- **`governance`** (`trusted`, the default, or `governed`): the platform's governance mode. The meta - chart renders it into muster's governance configuration (`muster.governance`: the mode and the - servers muster treats as agent-manager, `agent-manager.muster.mcpServer.name`, and the Platform - Manager, `giantswarm-platform-manager`; an own `muster.muster.governance.servers.` stands) - from the muster release that reads it (`agent-platform.muster.governanceFloor`); an earlier muster - gets none. Governed asks a person before an agent creates an agent, changes an agent's tools, - starts another agent or pauses a connector; the floors (an agent adding or repointing a - connector, changing approval settings, granting an exception, changing a workflow or muster's - configuration) ask on both. Only admins switch it, through the Platform Manager with a second - person's approval. Anything but the two values fails the render. +- **`governance`** (`trusted`, the default, or `governed`) and **`governedServers`**: the meta + chart renders muster's governance configuration (`muster.governance`: `mode` and + `governedServers`, one `{server, role, safe}` per MCPServer the platform ships while it renders) + from the muster release that reads it (`agent-platform.muster.governanceFloor`). On governed, + muster asks a person before an agent runs any tool of a governed server that is not on that + server's safe list (new and renamed tools too) and any of muster's own tools but its reads; the + safe lists are the read tools (`governedServers..safe`). A role's floors (granting access, + adding a model, egress origin, credential or backend, approving an action or a toolchain source, + adding or repointing a connector, changing approval settings) ask agents in both modes, on the + governed server of that role, so the servers are named on trusted as well. Sources: the manager + components (their `muster.mcpServer.name` in their namespace), `kagent` (the connectivity chart's + session tools), `mcp-kubernetes` (the connectivity chart's and every agent-platform-mcps + kubernetes entry) and `giantswarm-platform-manager`; a server outside muster's namespace is keyed + `namespace/name`. `null` drops a source; `governanceExempt` names the shipped sources that are + deliberately not governed (prometheus, capi: reads only). An own + `muster.muster.governance.governedServers` entry stands for its server; the earlier + `muster.muster.governance.servers.` shape fails the render, as does `governed` below the + muster floor (it would ask nothing). Persons get the connector settings only. Only admins switch + the mode, through the Platform Manager with a second person's approval. Anything but the two + values fails the render. - **What approval needs, and what this chart renders for it.** Asking calls refuse with the reason unless muster's shared store is Valkey, muster runs its OAuth server (the browser sign-in through Dex) and has a public URL on that server's origin. The bundled Valkey and @@ -385,37 +397,73 @@ Every tool behind muster is **Allow**, **Ask** (a person confirms the call first default but needs the installation's `oauth.server.baseUrl`, `dex.issuerUrl`, `dex.clientId` and `existingSecret`; `muster.muster.oauth.mcpClient.enabled` with `publicUrl` (on the origin of `oauth.server.baseUrl`) is the installation's to set (muster takes the OAuth server's base URL - when `publicUrl` is empty, but renders the allowlist below only with `mcpClient.enabled`). The - chart does not fail a `governed` render without them: muster refuses each asking call with the - reason and `filter_tools` reports `approval.unavailable`. From the same muster release as - `governance` (`agent-platform.muster.governanceFloor`) the meta chart also renders + when `publicUrl` is empty, but renders the allowlist below only with `mcpClient.enabled`; the + release notes say so while it is off). The chart does not fail a `governed` render without them: + muster refuses each asking call with the reason and `filter_tools` reports + `approval.unavailable`. From the same muster release the meta chart also renders `muster.approval.installation` (the name the approval page shows: `backstage.installationName`, default `agent-platform`; an own `muster.muster.approval.installation` stands) and `muster.oauth.mcpClient.postLoginRedirectAllowlist`, where muster may send the browser back after - a decision: `https:///sessions` while the portal is on and has a host - (`backstage.hostname`, else `backstage.`) and - `/auth/slack/return` while klaus-gateway is on and names it; an - own list's entries stay. Without an entry the person sees muster's own "answer recorded" page and - answers *Done* in the portal or Slack. + a decision (scheme, host and port must match exactly): `https://[:]/sessions` + while the portal is on and has a host (`backstage.hostname`, else `backstage.`; + the port from `backstage.publicPort` when it is not 443) and + `/auth/slack/return` (its port kept; anything but an http(s) + URL with a host fails) while klaus-gateway is on and names it; an own list's entries stay. + Without an entry the person sees muster's own "answer recorded" page and answers *Done* in the + portal or Slack. +- **Retry over the same MCP session.** muster binds a pending approval to the client's MCP session + (`Mcp-Session-Id`) within muster's session: after the person decides, the client retries over the + connection that got the prompt; another connection of the same person asks anew. At most 3 + pending approvals per MCP connection and 10 per person. - **The `connector-admin` role** is muster's `mcpserver-editor` Role in muster's namespace, bound to `muster.rbac.mcpServerEditor.subjects` (the Giant Swarm admin groups) plus `tenants.platformTeam`. Whoever holds it edits the namespace's connectors, sets their tool approval and may let an agent - skip a tool's `Ask`. The muster chart binds nobody by default, so this list is what keeps - connector admins on an upgrade; `system:authenticated` makes everyone one. + skip a tool's `Ask`. The muster chart no longer binds `system:authenticated` and fails an upgrade + with an empty list while its old binding exists; this list is never empty by default, so the + upgrade passes and the editors become the admin groups (`system:authenticated` makes everyone one + again). - **`muster-approval-binder`**: muster takes an agent's tool settings in a Session binding only from - a sender allowed to `bind` `toolapprovals`. The muster chart ships that Role; the connectivity - release binds it to agent-manager's ServiceAccount, and only to it, in muster's namespace. + a sender allowed to `bind` `toolapprovals` in muster's namespace. The muster chart ships that Role + and binds it there, to `muster.rbac.approvalBinder.subjects`, which the meta chart sets to + agent-manager's ServiceAccount (its name and namespace), and only it; an own list stands, and an + agent-manager ServiceAccount the chart does not create must be named. muster reviews the sender + with its own `tokenreviews` ClusterRole and a `localsubjectaccessreviews` Role in its namespace + (`muster.rbac.approvalBinder.reviews`, on by default), not `system:auth-delegator`. - **Explicit settings on every shipped connector** (`spec.approval`): the MCPServers this chart renders carry them as values — `mcp-kubernetes.mcpServer.approval` (the *Recommended* preset: read-only tools Allow, the rest Ask, rule Ask) and `kagent.controllerRoute.mcp.approval` (*Allow all*: kagent's session tools carry no annotations, and agents use them as the person); the component charts set theirs under `.muster.mcpServer.approval` (*Allow all* for the managers, whose tools the portal calls as the person) and agent-platform-mcps per family - (`agent-platform-mcps.muster.families..approval`, *Recommended*). An installation tightens - a tool there (`Ask`, `Block`); `null` removes the block (the connector runs everything, shown as - *not reviewed*). A muster whose CRD lacks `spec.approval` drops the field. - -`make verify-tool-approval` asserts all four. + (`agent-platform-mcps.muster.families..approval`, *Recommended*). These are what trusted + platforms and persons get; governed platforms ask agents by the safe lists above. An + installation tightens a tool there (`Ask`, `Block`) or the rule (`Block`); `null` removes the + block (the connector runs everything, shown as *not reviewed*). + +### Upgrading to tool approval + +- Move `components.muster.versionRange` to the muster release that carries tool approval + (`agent-platform.muster.governanceFloor`) together with this chart: below it nothing is + forwarded and `governed` fails the render. muster's CRDs upgrade with the muster release + (`CreateReplace`) and every consumer of them `dependsOn` muster. +- While the served MCPServer CRD lacks `spec.approval`, muster refuses every server tool + (`approval_unavailable`) rather than run them unreviewed. A release applied while the old CRD + was served lost its `spec.approval` (the API server prunes unknown fields) and Helm does not + re-apply an unchanged release: after the CRD upgrade, reconcile the connectivity, agent-platform-mcps and + manager releases with `flux reconcile helmrelease --force`, then check + `kubectl get mcpservers -A -o custom-columns=NAME:.metadata.name,RULE:.spec.approval.rule`. +- `muster.rbac.mcpServerEditor.subjects` must stay non-empty (the default) or the muster chart + fails the upgrade while the old `system:authenticated` binding exists + (`muster.rbac.mcpServerEditor.allowRemovingBinding: true` drops it deliberately). +- The connectivity release no longer renders `agent-platform:muster-approval-binder` (Helm deletes + it); the muster release binds `muster-approval-binder` in muster's namespace instead. +- On a lab or any edge not on 443, set `backstage.publicPort` and drop a hand-written portal entry + from `muster.muster.oauth.mcpClient.postLoginRedirectAllowlist`. +- Clients retry an approved call over the same MCP session (see above). + +`make verify-tool-approval` asserts the governance configuration and its coverage (every shipped +MCPServer governed or exempt, no floor safe, every safe entry a tool of its server), the +allowlist, the connector admins, the binder and the connectors' settings. ## Voluntary disruption diff --git a/helm/agent-platform/templates/NOTES.txt b/helm/agent-platform/templates/NOTES.txt index 220062a8..f8e6fb42 100644 --- a/helm/agent-platform/templates/NOTES.txt +++ b/helm/agent-platform/templates/NOTES.txt @@ -107,3 +107,9 @@ Workspaces, base URL {{ $wmBase }} (routed: /.well-known/jwks.json): {{- end }} {{- end }} {{- end }} +{{- with (include "agent-platform.muster.redirectAllowlist" . | fromJsonArray) }} +{{- if not (dig "muster" "oauth" "mcpClient" "enabled" false ($.Values.muster | default dict)) }} + +Tool approval: muster renders its redirect allowlist ({{ join ", " . }}) only with muster.muster.oauth.mcpClient.enabled on, which is off. Until it is, the approval page records an answer but never sends the browser back to the portal or Slack: the person returns by hand (Done in the portal, or Slack). +{{- end }} +{{- end }} diff --git a/helm/agent-platform/templates/_helpers.tpl b/helm/agent-platform/templates/_helpers.tpl index 12cfd96d..e36bff90 100644 --- a/helm/agent-platform/templates/_helpers.tpl +++ b/helm/agent-platform/templates/_helpers.tpl @@ -1076,6 +1076,13 @@ browser to after an approval, from the same muster floor. */ -}} {{- $_ := set $muster "approval" . -}} {{- $_ := set $derived "muster" $muster -}} {{- end -}} +{{- /* agent-manager's ServiceAccount, the one sender of approval settings, +bound to muster-approval-binder by the muster chart in muster's namespace. */ -}} +{{- with (include "agent-platform.muster.approvalBinderSubjects" .root | fromJsonArray) -}} +{{- $rbac := get $derived "rbac" | default dict -}} +{{- $_ := set $rbac "approvalBinder" (dict "subjects" .) -}} +{{- $_ := set $derived "rbac" $rbac -}} +{{- end -}} {{- with (include "agent-platform.muster.redirectAllowlist" .root | fromJsonArray) -}} {{- $muster := get $derived "muster" | default dict -}} {{- $_ := set $derived "muster" (mergeOverwrite $muster (dict "oauth" (dict "mcpClient" (dict "postLoginRedirectAllowlist" .)))) -}} @@ -4781,33 +4788,179 @@ Usage: include "agent-platform.governance" $root {{- $mode -}} {{- end -}} +{{/* +The namespace a component's release installs its workloads (and its muster +MCPServer) into, as components.yaml places it: the kagent namespace with +components..inKagentNamespace, else components..targetNamespace, +else the platform's (agent-platform.targetNamespace). +Usage: include "agent-platform.componentNamespace" (dict "root" $ "name" "model-manager") +*/}} +{{- define "agent-platform.componentNamespace" -}} +{{- $c := index (.root.Values.components | default dict) .name | default dict -}} +{{- if $c.inKagentNamespace -}} +{{- include "agent-platform.kagent.namespace" .root -}} +{{- else -}} +{{- $c.targetNamespace | default (include "agent-platform.targetNamespace" .root) -}} +{{- end -}} +{{- end -}} + +{{/* +muster's key for an MCPServer (muster's api.MCPServerKey): the name for a +server in muster's own namespace (muster.muster.namespace, else the muster +release's), namespace/name for one outside it. +Usage: include "agent-platform.muster.serverKey" (dict "root" $ "namespace" $ns "name" $name) +*/}} +{{- define "agent-platform.muster.serverKey" -}} +{{- $musterNs := dig "muster" "namespace" "" (.root.Values.muster | default dict) | default (include "agent-platform.muster.namespace" .root) -}} +{{- if or (not .namespace) (eq .namespace $musterNs) -}}{{- .name -}}{{- else -}}{{- printf "%s/%s" .namespace .name -}}{{- end -}} +{{- end -}} + +{{/* +The muster server keys of a governedServers source (top-level +governedServers.), as a JSON list: the MCPServers the platform ships +for it while they render. + - the manager components (agent-manager, model-manager, vm-manager, + cluster-manager, workspace-manager, toolchain-manager, skill-manager): + .muster.mcpServer.name (default the component's name) in the + component's namespace, while the component is on; + - kagent: the connectivity chart's MCPServer kagent (kagent's session and + sandbox tools), while the kagent component is on; + - mcp-kubernetes: the connectivity chart's [-]mcp-kubernetes + while the mcp-kubernetes component and mcp-kubernetes.mcpServer.enabled are + on, and every agent-platform-mcps.mcpServers entry of group kubernetes + (its name, else -mcp-kubernetes, in its namespace, else the + component's); + - any other source is a server key itself (giantswarm-platform-manager, the + Platform Manager's registration, or an installation's own server). +Usage: include "agent-platform.muster.governedKeys" (dict "root" $ "source" $source) | fromJsonArray +*/}} +{{- define "agent-platform.muster.governedKeys" -}} +{{- $root := .root -}} +{{- $keys := list -}} +{{- $managers := list "agent-manager" "model-manager" "vm-manager" "cluster-manager" "workspace-manager" "toolchain-manager" "skill-manager" -}} +{{- $connNs := dig "agent-platform-connectivity" "targetNamespace" "" ($root.Values.components | default dict) | default (include "agent-platform.targetNamespace" $root) -}} +{{- if has .source $managers -}} +{{- if and (include "agent-platform.componentEnabled" (dict "root" $root "name" .source)) (dig "muster" "mcpServer" "enabled" true (index $root.Values .source | default dict)) -}} +{{- $name := dig "muster" "mcpServer" "name" .source (index $root.Values .source | default dict) -}} +{{- $keys = append $keys (include "agent-platform.muster.serverKey" (dict "root" $root "namespace" (include "agent-platform.componentNamespace" (dict "root" $root "name" .source)) "name" $name)) -}} +{{- end -}} +{{- else if eq .source "kagent" -}} +{{- if include "agent-platform.componentEnabled" (dict "root" $root "name" "kagent") -}} +{{- $keys = append $keys (include "agent-platform.muster.serverKey" (dict "root" $root "namespace" $connNs "name" "kagent")) -}} +{{- end -}} +{{- else if eq .source "mcp-kubernetes" -}} +{{- $mcpk := index $root.Values "mcp-kubernetes" | default dict -}} +{{- if and (include "agent-platform.componentEnabled" (dict "root" $root "name" "mcp-kubernetes")) (dig "mcpServer" "enabled" true $mcpk) -}} +{{- $cluster := dig "mcpServer" "managementCluster" "" $mcpk -}} +{{- $keys = append $keys (include "agent-platform.muster.serverKey" (dict "root" $root "namespace" $connNs "name" (printf "%smcp-kubernetes" (ternary (printf "%s-" $cluster) "" (ne $cluster ""))))) -}} +{{- end -}} +{{- if include "agent-platform.componentEnabled" (dict "root" $root "name" "agent-platform-mcps") -}} +{{- $mcpsNs := include "agent-platform.componentNamespace" (dict "root" $root "name" "agent-platform-mcps") -}} +{{- range (dig "mcpServers" list (index $root.Values "agent-platform-mcps" | default dict)) -}} +{{- if eq (toString .group) "kubernetes" -}} +{{- $name := .name | default (printf "%s-mcp-%s" .cluster .group) -}} +{{- $key := include "agent-platform.muster.serverKey" (dict "root" $root "namespace" (.namespace | default $mcpsNs) "name" $name) -}} +{{- if not (has $key $keys) -}}{{- $keys = append $keys $key -}}{{- end -}} +{{- end -}} +{{- end -}} +{{- end -}} +{{- else -}} +{{- $keys = append $keys .source -}} +{{- end -}} +{{- $keys | toJson -}} +{{- end -}} + {{/* muster's governance configuration (Governing tool calls, giantswarm/giantswarm#38902), rendered from the platform's governance mode: -`mode` (governance) and `servers`, the MCPServer names muster treats as each -role's: agentManager (agent-manager.muster.mcpServer.name, default -agent-manager) and platformManager (giantswarm-platform-manager, the Platform -Manager's registration). The floors are built into muster; this configuration -only adds the governed entries and tells muster which servers offer the names -it matches. An own muster.muster.governance.servers. stands; an own -mode that differs from `governance` fails (single source). Only from the -muster floor agent-platform.muster.governanceFloor; {} below it. +`mode` (governance) and `governedServers`, one entry {server, role, safe} per +MCPServer the platform ships for each source of the top-level governedServers +(agent-platform.muster.governedKeys): its role names the floors muster asks +agents for in both modes, its safe list the tools agents call unasked on +governed (every other tool of a governed server asks agents there, new and +renamed ones too). A source set to null governs nothing (the coverage test, +tests/verify-tool-approval.py, then wants it in governanceExempt). An own +muster.muster.governance.governedServers entry stands for its server key, +first; an own mode that differs from `governance` fails (single source), and +so does an own muster.muster.governance.servers (the earlier shape, which +muster refuses beside governedServers). Only from the muster floor +agent-platform.muster.governanceFloor; {} below it, where `governed` fails the +render rather than silently asking nothing. Usage: include "agent-platform.muster.governance" $root | fromJson */}} {{- define "agent-platform.muster.governance" -}} +{{- $root := . -}} {{- $mode := include "agent-platform.governance" . -}} {{- $out := dict -}} -{{- if include "agent-platform.componentFloorAtLeast" (dict "root" . "name" "muster" "version" (include "agent-platform.muster.governanceFloor" .)) -}} +{{- $floor := include "agent-platform.muster.governanceFloor" . -}} +{{- if include "agent-platform.componentFloorAtLeast" (dict "root" . "name" "muster" "version" $floor) -}} {{- $own := dig "muster" "governance" dict (.Values.muster | default dict) | default dict -}} {{- with $own.mode -}} {{- if ne (toString .) $mode -}} {{- fail (printf "muster.muster.governance.mode (%v) differs from governance (%s): the platform's governance mode is the top-level governance value; leave muster.muster.governance.mode unset" . $mode) -}} {{- end -}} {{- end -}} -{{- $amName := dig "muster" "mcpServer" "name" "agent-manager" (index .Values "agent-manager" | default dict) -}} -{{- $servers := dict "agentManager" (list $amName) "platformManager" (list "giantswarm-platform-manager") -}} -{{- $servers = mergeOverwrite $servers ($own.servers | default dict) -}} -{{- $out = dict "mode" $mode "servers" $servers -}} +{{- if $own.servers -}} +{{- fail "muster.muster.governance.servers is the earlier governance shape, which muster does not read beside governedServers: name a server's role and safe list in the top-level governedServers (or muster.muster.governance.governedServers entries {server, role, safe})" -}} +{{- end -}} +{{- $servers := list -}} +{{- $seen := list -}} +{{- range ($own.governedServers | default list) -}} +{{- $servers = append $servers . -}} +{{- $seen = append $seen (toString .server) -}} +{{- end -}} +{{- range $source, $entry := (.Values.governedServers | default dict) -}} +{{- if $entry -}} +{{- if not (kindIs "map" $entry) -}} +{{- fail (printf "governedServers.%s: want {role, safe} or null, got %v" $source $entry) -}} +{{- end -}} +{{- range $k, $_ := $entry -}} +{{- if not (has $k (list "role" "safe")) -}} +{{- fail (printf "governedServers.%s.%s: unknown key (want role and safe)" $source $k) -}} +{{- end -}} +{{- end -}} +{{- range (include "agent-platform.muster.governedKeys" (dict "root" $root "source" $source) | fromJsonArray) -}} +{{- if not (has . $seen) -}} +{{- $server := dict "server" . "safe" ($entry.safe | default list) -}} +{{- with $entry.role -}}{{- $_ := set $server "role" . -}}{{- end -}} +{{- $servers = append $servers $server -}} +{{- $seen = append $seen . -}} +{{- end -}} +{{- end -}} +{{- end -}} +{{- end -}} +{{- $out = dict "mode" $mode "governedServers" $servers -}} +{{- else if ne $mode "trusted" -}} +{{- fail (printf "governance %s needs muster %s or later (the first release that reads the governance configuration), but components.muster.versionRange %q allows earlier releases: below it nothing would ask agents. Move components.muster.versionRange to >=%s, or keep governance trusted" $mode $floor (dig "muster" "versionRange" "" .Values.components) $floor) -}} +{{- end -}} +{{- $out | toJson -}} +{{- end -}} + +{{/* +muster's approval-binder subjects (muster.rbac.approvalBinder.subjects): the +muster chart ships the Role muster-approval-binder and binds it, in muster's +namespace where muster's sender review asks, to these subjects. The platform +binds agent-manager's ServiceAccount and nothing else, while agent-manager is +on: agent-manager.serviceAccount.name, else agent-manager.fullnameOverride, +in agent-manager's namespace. A ServiceAccount the chart does not create +needs its name (the namespace's `default` would let every pod using it send +approval settings). An own muster.rbac.approvalBinder.subjects stands. Only +from the muster floor agent-platform.muster.governanceFloor; [] below it. +Usage: include "agent-platform.muster.approvalBinderSubjects" $root | fromJsonArray +*/}} +{{- define "agent-platform.muster.approvalBinderSubjects" -}} +{{- $out := list -}} +{{- if and (include "agent-platform.componentFloorAtLeast" (dict "root" . "name" "muster" "version" (include "agent-platform.muster.governanceFloor" .))) (include "agent-platform.componentEnabled" (dict "root" . "name" "agent-manager")) (not (dig "rbac" "approvalBinder" "subjects" list (.Values.muster | default dict))) -}} +{{- $am := index .Values "agent-manager" | default dict -}} +{{- $name := dig "serviceAccount" "name" "" $am -}} +{{- if not (dig "serviceAccount" "create" true $am) -}} +{{- if not $name -}} +{{- fail "agent-manager.serviceAccount.create is false without agent-manager.serviceAccount.name: muster-approval-binder would bind the namespace's default ServiceAccount, so every pod using it could send approval settings; name agent-manager's ServiceAccount" -}} +{{- end -}} +{{- else -}} +{{- $name = $name | default (required "agent-manager.fullnameOverride must be set" (dig "fullnameOverride" "" $am)) -}} +{{- end -}} +{{- $out = list (dict "kind" "ServiceAccount" "name" $name "namespace" (include "agent-platform.componentNamespace" (dict "root" . "name" "agent-manager"))) -}} {{- end -}} {{- $out | toJson -}} {{- end -}} @@ -4832,15 +4985,19 @@ Usage: include "agent-platform.muster.approval" $root | fromJson {{/* The pages muster may send the browser back to after an approval -(muster.oauth.mcpClient.postLoginRedirectAllowlist; an entry admits its path -and everything below it at a segment boundary): the portal's Sessions pages, -https:///sessions, while the portal is on and has a host -(backstage.hostname, else backstage.), and klaus-gateway's -return, /auth/slack/return, while -klaus-gateway is on and names its callbackBaseUrl. An own list's entries stay, -first, each entry once. Only from the muster floor -agent-platform.muster.governanceFloor; [] below it. muster renders the list -only while muster.muster.oauth.mcpClient.enabled is on. +(muster.oauth.mcpClient.postLoginRedirectAllowlist; muster compares scheme and +host with its port exactly, and an entry admits its path and everything below +it at a segment boundary): the portal's Sessions pages, +https://[:]/sessions, while the portal is on +and has a host (backstage.hostname, else backstage.; the port +only when backstage.publicPort is set and not 443, as on a lab edge on 8443), +and klaus-gateway's return, /auth/slack/return +(scheme, host and port as written; an http(s) URL with a host, else the +render fails naming the key), while klaus-gateway is on and names its +callbackBaseUrl. An own list's entries stay, first, each entry once. Only +from the muster floor agent-platform.muster.governanceFloor; [] below it. +muster renders the list only while muster.muster.oauth.mcpClient.enabled is +on (NOTES.txt says so when the list is not empty and it is off). Usage: include "agent-platform.muster.redirectAllowlist" $root | fromJsonArray */}} {{- define "agent-platform.muster.redirectAllowlist" -}} @@ -4852,11 +5009,21 @@ Usage: include "agent-platform.muster.redirectAllowlist" $root | fromJsonArray {{- if include "agent-platform.componentEnabled" (dict "root" . "name" "backstage") -}} {{- $host := dig "hostname" "" $backstage -}} {{- if and (not $host) .Values.global.domain -}}{{- $host = printf "backstage.%s" .Values.global.domain -}}{{- end -}} -{{- if $host -}}{{- $derived = append $derived (printf "https://%s/sessions" $host) -}}{{- end -}} +{{- $port := toString (dig "publicPort" "" $backstage | default "") -}} +{{- if and $port (not (regexMatch "^[1-9][0-9]{0,4}$" $port)) -}} +{{- fail (printf "backstage.publicPort %q: want the port the portal's public URL carries (1-65535), or empty for 443" $port) -}} +{{- end -}} +{{- if $host -}}{{- $derived = append $derived (printf "https://%s%s/sessions" $host (ternary (printf ":%s" $port) "" (and (ne $port "") (ne $port "443")))) -}}{{- end -}} {{- end -}} {{- if include "agent-platform.componentEnabled" (dict "root" . "name" "klaus-gateway") -}} {{- $base := dig "obo" "callbackBaseUrl" "" (.Values.klausGateway | default dict) | trimSuffix "/" -}} -{{- if $base -}}{{- $derived = append $derived (printf "%s/auth/slack/return" $base) -}}{{- end -}} +{{- if $base -}} +{{- $u := urlParse $base -}} +{{- if or (not (has $u.scheme (list "http" "https"))) (not $u.host) $u.userinfo $u.query $u.fragment -}} +{{- fail (printf "klausGateway.obo.callbackBaseUrl %q: want an http(s) URL with a host (and port, if not the scheme's default), no user, query or fragment, e.g. https://gw.example.com" $base) -}} +{{- end -}} +{{- $derived = append $derived (printf "%s/auth/slack/return" $base) -}} +{{- end -}} {{- end -}} {{- range $derived -}}{{- if not (has . $out) -}}{{- $out = append $out . -}}{{- end -}}{{- end -}} {{- end -}} diff --git a/helm/agent-platform/values.schema.json b/helm/agent-platform/values.schema.json index c6df0eee..4bfe2ebd 100644 --- a/helm/agent-platform/values.schema.json +++ b/helm/agent-platform/values.schema.json @@ -2166,12 +2166,24 @@ }, "governance": { "type": "string", - "description": "The platform's governance mode: trusted (the default) or governed. It changes no tool approval setting's meaning; it adds asking for agent callers. Governed asks a person before an agent creates an agent (agent-manager's create_agent), changes an agent's tools (update_agent_access), starts another agent (start_session) or pauses a connector, and the Dev Portal's connector wizard pre-selects the Recommended preset (read-only tools run, the rest ask); trusted lets agents do those freely and pre-selects Allow all. In both modes muster's built-in floors ask a person before an agent adds or repoints a connector, changes approval settings, gives an agent an exception or changes muster's own configuration. The meta chart renders muster's governance configuration from it (muster.governance: the mode, and the servers muster treats as agent-manager and the Platform Manager), from the muster release that reads it (agent-platform.muster.governanceFloor); an earlier muster gets none and asks nothing. From that release the meta chart also renders muster.approval.installation (backstage.installationName, the name the approval page shows) and the pages muster may return the browser to after an approval in muster.oauth.mcpClient.postLoginRedirectAllowlist (the portal's /sessions, klausGateway.obo.callbackBaseUrl + /auth/slack/return; an own list's entries stay). Approval itself needs muster's OAuth server with Dex sign-in, Valkey storage (the default) and muster.muster.oauth.mcpClient.publicUrl on the OAuth server's origin with mcpClient.enabled for the allowlist; the chart does not fail without them, muster refuses asking calls with the reason. Only admins switch it, through the Platform Manager with a second person's approval; never an agent. Anything else fails the render. Concept: https://docs.giantswarm.io/overview/agent-platform/governing-tool-calls/", + "description": "The platform's governance mode: trusted (the default) or governed. It changes no tool approval setting's meaning; it adds asking for agent callers. Governed asks a person before an agent runs any tool of a governed server (governedServers below) that is not on that server's safe list (new and renamed tools too), and before any of muster's own tools but its reads; the Dev Portal's connector wizard pre-selects the Recommended preset (read-only tools run, the rest ask). Trusted lets agents run what the connectors' own settings allow and pre-selects Allow all. In both modes muster's built-in floors ask a person before an agent adds or repoints a connector, changes approval settings, grants access, adds a model, egress origin, credential or backend, approves an action or a toolchain source, or changes muster's own configuration; the role floors hold on the governed servers of that role, so governedServers names them in both modes. The meta chart renders muster's governance configuration from it (muster.governance: the mode and governedServers), from the muster release that reads it (agent-platform.muster.governanceFloor); below it `governed` fails the render and trusted renders nothing. From that release the meta chart also renders muster.approval.installation (backstage.installationName, the name the approval page shows), muster-approval-binder's subject (agent-manager's ServiceAccount, muster.rbac.approvalBinder.subjects) and the pages muster may return the browser to after an approval in muster.oauth.mcpClient.postLoginRedirectAllowlist (the portal's /sessions with backstage.publicPort, klausGateway.obo.callbackBaseUrl + /auth/slack/return; an own list's entries stay). Approval itself needs muster's OAuth server with Dex sign-in, Valkey storage (the default) and muster.muster.oauth.mcpClient.publicUrl on the OAuth server's origin with mcpClient.enabled for the allowlist; the chart does not fail without them, muster refuses asking calls with the reason. Only admins switch it, through the Platform Manager with a second person's approval; never an agent. Anything else fails the render. Concept: https://docs.giantswarm.io/overview/agent-platform/governing-tool-calls/", "enum": [ "trusted", "governed" ] }, + "governedServers": { + "type": "object", + "description": "The servers muster governs (muster.governance.governedServers), per source the platform ships: `role` (which of muster's role floors hold on it: agentManager, platformManager, connectorManager, sessionManager, modelManager, clusterManager, vmManager, workspaceManager, toolchainManager, skillManager, infrastructure) and `safe`, the server's own tool names agents call unasked on governed (reads only; a floor never, muster refuses to start on one). Every other tool of a governed server asks agents on governed. A source renders one entry per MCPServer it ships while that renders (agent-platform.muster.governedKeys): a manager component's .muster.mcpServer.name in its namespace; kagent the connectivity chart's kagent server; mcp-kubernetes the connectivity chart's and every agent-platform-mcps kubernetes entry; any other key is a muster server key itself (giantswarm-platform-manager). null drops a source (then list it in governanceExempt with the reason). make verify-tool-approval fails on a shipped MCPServer that is neither here nor in governanceExempt, and on a safe entry that names a floor or no tool of its server. Safe lists: tool-approval governed-safe-list-proposal (giantswarm/giantswarm#38902).", + "additionalProperties": true + }, + "governanceExempt": { + "type": "object", + "description": "MCPServer sources the platform ships that muster deliberately does not govern, each with its reason (make verify-tool-approval wants every shipped source in governedServers or here). Read by the meta chart's tests only.", + "additionalProperties": { + "type": "string" + } + }, "gpu-operator": { "type": "object", "additionalProperties": true diff --git a/helm/agent-platform/values.yaml b/helm/agent-platform/values.yaml index d0a16096..19c51143 100644 --- a/helm/agent-platform/values.yaml +++ b/helm/agent-platform/values.yaml @@ -1521,6 +1521,7 @@ components: # @schema additionalProperties: true # top-level block and are dropped on the way out, the kagent shape. omitKeys: - hostname + - publicPort - parentRefs - installationName - extraScopes @@ -1819,6 +1820,10 @@ components: # @schema additionalProperties: true # as its governance configuration (agent-platform.muster.governance); # no wiring of the connectivity chart reads it. - governance + # The governed servers and the exempt list are the meta chart's too + # (muster.governance.governedServers and its coverage test). + - governedServers + - governanceExempt # Read by the meta chart alone (merged into the four components' own # scheduling knobs before their releases render, agent-platform.scheduling.apply); # the connectivity chart never sees it. @@ -5801,32 +5806,101 @@ clusterManager: # @schema skipProperties: true; additionalProperties: true # === Governance mode (Governing tool calls, giantswarm/giantswarm#38902) === # -- The platform's governance mode: trusted (the default) or governed. It # changes no tool approval setting's meaning; it adds asking for agent -# callers. Governed asks a person before an agent creates an agent -# (agent-manager's create_agent), changes an agent's tools -# (update_agent_access), starts another agent (start_session) or pauses a -# connector, and the Dev Portal's connector wizard pre-selects the -# Recommended preset (read-only tools run, the rest ask); trusted lets agents -# do those freely and pre-selects Allow all. In both modes muster's built-in -# floors ask a person before an agent adds or repoints a connector, changes -# approval settings, gives an agent an exception or changes muster's own -# configuration. The meta chart renders muster's governance configuration -# from it (muster.governance: the mode, and the servers muster treats as -# agent-manager and the Platform Manager), from the muster release that reads -# it (agent-platform.muster.governanceFloor); an earlier muster gets none and -# asks nothing. From that release the meta chart also renders -# muster.approval.installation (backstage.installationName, the name the -# approval page shows) and the pages muster may return the browser to after an approval in -# muster.oauth.mcpClient.postLoginRedirectAllowlist (the portal's /sessions, -# klausGateway.obo.callbackBaseUrl + /auth/slack/return; an own list's entries -# stay). Approval itself needs muster's OAuth server with Dex sign-in, Valkey -# storage (the default) and muster.muster.oauth.mcpClient.publicUrl on the -# OAuth server's origin with mcpClient.enabled for the allowlist; the chart -# does not fail without them, muster refuses asking calls with the reason. -# Only admins switch it, through the Platform Manager with a -# second person's approval; never an agent. Anything else fails the render. +# callers. Governed asks a person before an agent runs any tool of a governed +# server (governedServers below) that is not on that server's safe list (new +# and renamed tools too), and before any of muster's own tools but its reads; +# the Dev Portal's connector wizard pre-selects the Recommended preset +# (read-only tools run, the rest ask). Trusted lets agents run what the +# connectors' own settings allow and pre-selects Allow all. In both modes +# muster's built-in floors ask a person before an agent adds or repoints a +# connector, changes approval settings, grants access, adds a model, egress +# origin, credential or backend, approves an action or a toolchain source, or +# changes muster's own configuration; the role floors hold on the governed +# servers of that role, so governedServers names them in both modes. The meta +# chart renders muster's governance configuration from it +# (muster.governance: the mode and governedServers), from the muster release +# that reads it (agent-platform.muster.governanceFloor); below it `governed` +# fails the render and trusted renders nothing. From that release the meta +# chart also renders muster.approval.installation (backstage.installationName, +# the name the approval page shows), muster-approval-binder's subject +# (agent-manager's ServiceAccount, muster.rbac.approvalBinder.subjects) and +# the pages muster may return the browser to after an approval in +# muster.oauth.mcpClient.postLoginRedirectAllowlist (the portal's /sessions +# with backstage.publicPort, klausGateway.obo.callbackBaseUrl + +# /auth/slack/return; an own list's entries stay). Approval itself needs +# muster's OAuth server with Dex sign-in, Valkey storage (the default) and +# muster.muster.oauth.mcpClient.publicUrl on the OAuth server's origin with +# mcpClient.enabled for the allowlist; the chart does not fail without them, +# muster refuses asking calls with the reason. Only admins switch it, through +# the Platform Manager with a second person's approval; never an agent. +# Anything else fails the render. # Concept: https://docs.giantswarm.io/overview/agent-platform/governing-tool-calls/ governance: trusted # @schema enum: [trusted, governed] +# -- The servers muster governs (muster.governance.governedServers), per +# source the platform ships: `role` (which of muster's role floors hold on +# it: agentManager, platformManager, connectorManager, sessionManager, +# modelManager, clusterManager, vmManager, workspaceManager, +# toolchainManager, skillManager, infrastructure) and `safe`, the server's +# own tool names agents call unasked on governed (reads only; a floor never, +# muster refuses to start on one). Every other tool of a governed server asks +# agents on governed. A source renders one entry per MCPServer it ships +# while that renders (agent-platform.muster.governedKeys): a manager +# component's .muster.mcpServer.name in its namespace; kagent the +# connectivity chart's kagent server; mcp-kubernetes the connectivity chart's +# and every agent-platform-mcps kubernetes entry; any other key is a muster +# server key itself (giantswarm-platform-manager). null drops a source (then +# list it in governanceExempt with the reason). make verify-tool-approval +# fails on a shipped MCPServer that is neither here nor in governanceExempt, +# and on a safe entry that names a floor or no tool of its server. Safe +# lists: tool-approval governed-safe-list-proposal (giantswarm/giantswarm#38902). +governedServers: # @schema additionalProperties: true + agent-manager: + role: agentManager + safe: [get_info, list_agents, get_agent, get_agent_status, validate_agent, list_model_configs, list_egress_policies, list_skills, list_sessions, get_session, get_session_turn, toolchain_users, list_organizations, get_organization, list_organization_members, list_organization_connectors] + kagent: + role: sessionManager + safe: [list_sessions, list_session_checkpoints, list_sandbox_templates, list_sandboxes, get_sandbox, get_sandbox_process, read_sandbox_outputs, read_sandbox_file] + model-manager: + role: modelManager + safe: [get_info, get_backend, list_backends, list_models, get_model, list_loaded_models, list_presets, search_models, check_fit, list_nodes, list_jobs, get_job] + cluster-manager: + role: clusterManager + safe: [get_info, list_clusters, list_releases, list_node_pools] + vm-manager: + role: vmManager + # get_vm_console is left off: a console can carry secrets. + safe: [get_info, get_host, list_images, get_image, list_networks, get_network, list_vms, get_vm, get_vm_metrics, get_vm_attestation] + toolchain-manager: + role: toolchainManager + # add_packages, add_binary and init_source write nothing but render files + # an agent could feed elsewhere: they ask until their asks prove noisy. + safe: [list_sources, list_toolchains, describe_toolchain, toolchain_build_status, search_packages] + workspace-manager: + role: workspaceManager + # authorize_workspace returns a repository grant for start_session. + safe: [list_providers, list_owners, list_workspaces, get_workspace, list_repositories, preview_workspace] + skill-manager: + role: skillManager + safe: [list_skill_sources, list_skills, resolve_skills, get_skill, get_skill_file] + mcp-kubernetes: + role: infrastructure + # The write tools (create, apply, delete, patch, scale, exec, + # port_forward, context_use, the stop tools) and the deprecated + # kubernetes_* aliases ask agents on governed. + safe: [logs, list_port_forward_sessions, context_list, context_get_current, can_i, api_resources, cluster_health, capi_list_clusters, capi_get_cluster, capi_resolve_cluster, capi_cluster_health, get, list, describe] + giantswarm-platform-manager: + role: platformManager + # Not inventoried yet: every tool but the floors' asks agents on governed. + safe: [] + +# -- MCPServer sources the platform ships that muster deliberately does not +# govern, each with its reason (make verify-tool-approval wants every shipped +# source in governedServers or here). Read by the meta chart's tests only. +governanceExempt: # @schema additionalProperties: {type: string} + prometheus: "agent-platform-mcps' prometheus family (mcp-prometheus): every tool reads" + capi: "agent-platform-mcps' capi family (mcp-kubernetes' CAPI tools): every tool reads" + tenants: platform: # -- Every signed-in person: bound to agent-platform:platform-user in the @@ -6781,6 +6855,12 @@ backstage: # @schema skipProperties: true; additionalProperties: true # --- Wiring (read by the connectivity chart, not passed to the backstage chart) --- # Public hostname; empty derives backstage.. hostname: "" + # publicPort: the port of the portal's public URL when it is not 443 (a + # lab edge on 8443): read by the meta chart alone, for the portal entry of + # muster's redirect allowlist (https://:/sessions; + # muster compares the port exactly). Unset or 443 writes none. Unset by + # default (it is no key of the backstage chart: components.backstage.omitKeys). + # publicPort: 8443 # Gateway of the Backstage route; empty follows the platform default (the # chart-owned edge, else global.gatewayApi.parentRefs). parentRefs: [] From e083c768fea0358cf41d8874ae5f7760fd0f20fd Mon Sep 17 00:00:00 2001 From: Dominik Schmidle Date: Wed, 25 Nov 2026 21:24:14 +0100 Subject: [PATCH 12/56] test(helm): cover governed servers, their coverage, the binder and ported redirect entries verify-tool-approval fails on a shipped MCPServer that is neither governed nor in governanceExempt, a floor on a safe list, a safe entry naming no tool of its server and differing kubernetes maps; it asserts a non-default port in both redirect entries (M1-1), invalid ports and URLs, the binder subjects, meta-to-connectivity overrides and the Block rule. The governance floor placeholder marker is now optional. --- Makefile.custom.mk | 2 +- tests/verify-tool-approval.py | 386 ++++++++++++++++++++++++++++------ 2 files changed, 320 insertions(+), 68 deletions(-) diff --git a/Makefile.custom.mk b/Makefile.custom.mk index 46e9241a..ac24fd0d 100644 --- a/Makefile.custom.mk +++ b/Makefile.custom.mk @@ -1479,7 +1479,7 @@ verify-mcp-kubernetes-registration: ## Assert the bundled mcp-kubernetes registr @echo "mcp-kubernetes registration shapes verified." .PHONY: verify-tool-approval -verify-tool-approval: ## Assert the platform side of Governing tool calls (giantswarm/giantswarm#38902): the top-level governance value renders muster's governance configuration into the muster release (muster.governance: mode trusted by default or governed, servers agentManager following agent-manager.muster.mcpServer.name and platformManager giantswarm-platform-manager, an own servers entry standing) from the muster floor agent-platform.muster.governanceFloor, none below it and none to the connectivity release; an unknown mode fails in the schema and the template, an own muster.muster.governance.mode that differs fails naming both keys; the connector-admin role (muster's mcpserver-editor) binds the Giant Swarm admin groups plus tenants.platformTeam, an own list standing; the connectivity release binds muster's Role muster-approval-binder to agent-manager's ServiceAccount only (following agent-manager.serviceAccount.name), in muster's namespace, none with agent-manager or muster off; the MCPServers the connectivity chart renders carry explicit approval settings (mcp-kubernetes the Recommended preset, kagent's session tools Allow all), a per-tool override reaching spec.approval, null rendering none and a value outside the CRD's enums or an unknown key failing naming the key. Stdlib only. HELM selects the binary. +verify-tool-approval: ## Assert the platform side of Governing tool calls (giantswarm/giantswarm#38902): the top-level governance and governedServers values render muster's governance configuration into the muster release (muster.governance: mode, governedServers {server, role, safe} per shipped MCPServer, keyed namespace/name outside muster's namespace, an own entry standing) from the muster floor agent-platform.muster.governanceFloor, none below it, governed below it, the earlier servers shape, unknown keys and conflicting or unknown modes failing; coverage: every shipped MCPServer source (meta releases carrying muster.mcpServer, the connectivity chart's MCPServers, agent-platform-mcps' families, and the component charts beside this checkout, COMPONENT_CHECKOUTS) is governed or in governanceExempt, no floor is safe, every safe entry names a tool of its server, the two kubernetes maps agree; the redirect allowlist (portal /sessions with backstage.publicPort, klaus-gateway's return with its port, invalid ports and URLs failing); the connector-admin role binds the Giant Swarm admin groups plus tenants.platformTeam; muster-approval-binder's subjects are agent-manager's ServiceAccount only (muster.rbac.approvalBinder.subjects), none from the connectivity chart; the connectivity MCPServers carry explicit approval settings (a Block rule renders, overrides reach spec.approval also from the meta chart, null renders none, invalid values fail naming the key). Stdlib only. HELM selects the binary. @echo "====> $@ ($(CHART_DIR), $(CONNECTIVITY_DIR))" @HELM="$(HELM)" python3 tests/verify-tool-approval.py $(CHART_DIR) $(CONNECTIVITY_DIR) @echo "tool approval verified." diff --git a/tests/verify-tool-approval.py b/tests/verify-tool-approval.py index 6b3e8bfa..72a3169d 100755 --- a/tests/verify-tool-approval.py +++ b/tests/verify-tool-approval.py @@ -2,40 +2,57 @@ """Assert the platform side of Governing tool calls (giantswarm/giantswarm#38902, slice 7). - governance: the meta chart renders muster's governance configuration into the - muster release (muster.governance) from the top-level `governance` value, from - the muster floor that reads it (agent-platform.muster.governanceFloor): mode - trusted by default, governed when set; servers agentManager (following - agent-manager.muster.mcpServer.name) and platformManager - (giantswarm-platform-manager); an own servers entry stands; an own mode that - differs fails naming both keys; an unknown mode fails in the schema and, past - it, in the template; below the floor nothing is forwarded. + muster release (muster.governance: mode and governedServers {server, role, + safe}) from the top-level `governance` and `governedServers` values, from the + muster floor that reads it (agent-platform.muster.governanceFloor): mode + trusted by default, governed when set; one entry per MCPServer a source ships + while it renders, keyed as muster keys servers (name in muster's namespace, + namespace/name outside it); an own governedServers entry stands; the earlier + servers. shape, an own mode that differs, an unknown key or an unknown + mode fail; below the floor nothing is forwarded and `governed` fails. +- coverage: every MCPServer source the platform ships (the manager components + whose release values carry muster.mcpServer, the connectivity chart's + MCPServers, agent-platform-mcps' families and, where the component checkouts + sit beside this repository, every chart that renders an MCPServer) is in + governedServers or in governanceExempt; no safe entry is a floor; every safe + entry names a tool of its server (the connectivity chart's approval maps + here, the component charts' where their checkouts are beside this one); the + connectivity and agent-platform-mcps kubernetes maps are equal. - approval configuration: from the same floor the muster release carries muster.approval.installation (backstage.installationName, default agent-platform; an own value and an own ttl stand) and the redirect allowlist muster.oauth.mcpClient.postLoginRedirectAllowlist: the portal's - https:///sessions while the portal is on and has a host, and - klaus-gateway's /auth/slack/return while klaus-gateway is - on and names it; own entries stay, first, once each; none below the floor. -- governance floor: one marked placeholder value (PLACEHOLDER-GOVERNANCE-FLOOR in - agent-platform.muster.governanceFloor), which this test reads, so moving it to - the real release needs no other edit. + https://[:]/sessions while the portal is on + and has a host (no port for 443), and klaus-gateway's + /auth/slack/return with its port while klaus-gateway is + on and names it; invalid ports and URLs fail; own entries stay, first, once + each; none below the floor. +- governance floor: agent-platform.muster.governanceFloor is one X.Y.Z; its + PLACEHOLDER-GOVERNANCE-FLOOR marker, while it is still there, appears once. - connector-admin: muster's mcpserver-editor Role (the platform's connector-admin role) is bound to the configured groups: the Giant Swarm admin - groups by default, tenants.platformTeam appended, an installation's own list - standing. -- muster-approval-binder: the connectivity release binds muster's Role - muster-approval-binder to agent-manager's ServiceAccount and nothing else (one - subject, its name following agent-manager.serviceAccount.name), in muster's - namespace; none with agent-manager off or muster off. + groups by default (never empty, so muster's upgrade guard passes), + tenants.platformTeam appended, an installation's own list standing. +- muster-approval-binder: the muster release binds muster's Role + muster-approval-binder (in muster's namespace, the muster chart's) to + agent-manager's ServiceAccount and nothing else + (muster.rbac.approvalBinder.subjects, its name and namespace following + agent-manager's); an own list stands; a ServiceAccount the chart does not + create needs a name; none with agent-manager off or below the floor; the + connectivity chart ships no binding of its own. - approval: every MCPServer the connectivity chart renders carries explicit settings: mcp-kubernetes the Recommended preset (rule Ask, reads Allow, writes Ask), kagent's session tools the Allow all preset (rule Allow, every tool - Allow); a per-tool override reaches spec.approval, null renders none, a value - outside the CRD's enums, an unknown key fails naming the key. + Allow); a rule Block renders, a per-tool override reaches spec.approval (also + from the meta chart's values), null renders none, a value outside the CRD's + enums or an unknown key fails naming the key. Stdlib only (the CI image has no PyYAML): documents are matched by text. Usage: verify-tool-approval.py +Environment: HELM selects the binary; COMPONENT_CHECKOUTS (default: the +directory holding this repository) is where the component repositories are +looked for; the checks that need them say when they are skipped. """ from __future__ import annotations @@ -71,8 +88,11 @@ def governance_floor(meta_dir: str) -> str: m = re.search(r'define "agent-platform\.muster\.governanceFloor" -\}\}([0-9]+\.[0-9]+\.[0-9]+)\{\{-', text) if not m: fail("agent-platform.muster.governanceFloor must be one line holding one X.Y.Z") - if text.count("PLACEHOLDER-GOVERNANCE-FLOOR") != 1: - fail("the governance floor placeholder must be marked exactly once (PLACEHOLDER-GOVERNANCE-FLOOR) next to its define") + markers = text.count("PLACEHOLDER-GOVERNANCE-FLOOR") + if markers > 1: + fail("the governance floor placeholder must be marked at most once (PLACEHOLDER-GOVERNANCE-FLOOR) next to its define") + if markers: + print(f"note: the governance floor {m.group(1)} is still a placeholder (PLACEHOLDER-GOVERNANCE-FLOOR): move it to the muster release that carries tool approval before releasing") values = open(os.path.join(meta_dir, "values.yaml")).read() if f">={m.group(1)}" in values: fail(f"values.yaml repeats the governance floor {m.group(1)}: it lives in agent-platform.muster.governanceFloor alone") @@ -137,27 +157,78 @@ def governance(meta_args: list[str]) -> str: return block(muster_release(meta_args), " governance:") +def governed_entries(gov: str) -> dict[str, dict]: + """server key -> {"role": str, "safe": [str]} of a rendered governance block.""" + out: dict[str, dict] = {} + cur: dict = {} + field = "" + for line in gov.split("\n"): + st = line.strip() + if st.startswith("- role: ") or st.startswith("- safe:") or st.startswith("- server: "): + cur = {"role": "", "safe": [], "server": ""} + st = st[2:] + if st.startswith("role: "): + cur["role"] = st[len("role: "):] + elif st.startswith("safe:"): + field = "safe" + elif st.startswith("server: "): + cur["server"] = st[len("server: "):] + out[cur["server"]] = cur + elif st.startswith("- ") and field == "safe" and cur is not None and line.startswith(" - "): + cur["safe"].append(st[2:]) + return out + + +FULL = [ + "--namespace", "agent-platform", + "--set", "global.domain=example.com", + "--set", "global.identity.issuerUrl=https://dex.example.com", + "--set", "global.identity.clientId=agent-platform", + "--set", "global.identity.existingSecret=agent-platform-idp", + "--set", "global.gatewayApi.parentRefs[0].name=giantswarm-default", + "--set", "model-manager.ollama.endpoint=http://ollama.example.com:11434", + "--set", "kagent.harness.snapshotLocation=s3://ci-agent-snapshots/agents", + "--set", "kagent.database.postgres.urlFile=/etc/kagent-db/uri", + "--set", "postgres.enabled=true", + "--set", "components.kagent.enabled=true", + "--set", "components.agent-manager.enabled=true", +] + + def check_governance() -> None: trusted = governance(["--set", FLOOR_RANGE]) - want = "\n".join([ - " governance:", - " mode: trusted", - " servers:", - " agentManager:", - " - agent-manager", - " platformManager:", - " - giantswarm-platform-manager", - ]) - if trusted.rstrip() != want: - fail(f"default governance, want:\n{want}\ngot:\n{trusted}") - governed = governance(["--set", FLOOR_RANGE, "--set", "governance=governed", "--set", "agent-manager.muster.mcpServer.name=agents"]) - if "mode: governed" not in governed or " - agents" not in governed: - fail(f"governed with a renamed agent-manager server:\n{governed}") - own = governance(["--set", FLOOR_RANGE, "--set", "muster.muster.governance.servers.platformManager[0]=pm"]) - if " - pm" not in own or "giantswarm-platform-manager" in own: - fail(f"an own platformManager entry must stand:\n{own}") + entries = governed_entries(trusted) + if " mode: trusted" not in trusted: + fail(f"default governance, want mode trusted:\n{trusted}") + for key, role in (("giantswarm-platform-manager", "platformManager"), ("model-manager", "modelManager")): + if entries.get(key, {}).get("role") != role: + fail(f"default governance must govern {key} as {role}:\n{trusted}") + if "agent-manager" in entries or "vm-manager" in entries: + fail(f"components that are off ship no server to govern:\n{trusted}") + governed = governed_entries(governance(["--set", FLOOR_RANGE, "--set", "governance=governed", "--set", "components.agent-manager.enabled=true", "--set", "agent-manager.muster.mcpServer.name=agents"])) + am = governed.get("agents") + if not am or am["role"] != "agentManager" or "list_agents" not in am["safe"] or "update_agent" in am["safe"]: + fail(f"governed with a renamed agent-manager server: want agents as agentManager with its reads safe, got {governed}") + if "mode: governed" not in governance(["--set", FLOOR_RANGE, "--set", "governance=governed"]): + fail("governance=governed must render mode governed") + apart = governed_entries(governance(["--set", FLOOR_RANGE, "--set", "components.muster.targetNamespace=muster", "--set", "components.vm-manager.enabled=true"])) + if not any(k.endswith("/vm-manager") for k in apart): + fail(f"a server outside muster's namespace is keyed namespace/name: {sorted(apart)}") + own = governance(["--set", FLOOR_RANGE, + "--set", "muster.muster.governance.governedServers[0].server=model-manager", + "--set", "muster.muster.governance.governedServers[0].role=modelManager", + "--set", "muster.muster.governance.governedServers[0].safe[0]=list_models"]) + mm = governed_entries(own)["model-manager"] + if mm["safe"] != ["list_models"] or own.count("server: model-manager") != 1: + fail(f"an own governedServers entry must stand for its server, once:\n{own}") + dropped = governed_entries(governance(["--set", FLOOR_RANGE, "--set-json", "governedServers.model-manager=null"])) + if "model-manager" in dropped: + fail("a source set to null governs nothing") if governance([]): fail("below the muster floor the muster release must carry no governance block") + err = render(META_DIR, META + ["--set", "governance=governed"], expect_fail=True) + if "governance governed needs muster" not in err or "components.muster.versionRange" not in err: + fail(f"governed below the floor must fail naming governance and components.muster.versionRange:\n{err}") err = render(META_DIR, META + ["--set", "governance=open"], expect_fail=True) if "governance" not in err: fail(f"an unknown mode must fail in the schema naming governance:\n{err}") @@ -167,10 +238,159 @@ def check_governance() -> None: err = render(META_DIR, META + ["--set", FLOOR_RANGE, "--set", "muster.muster.governance.mode=governed"], expect_fail=True) if "muster.muster.governance.mode (governed) differs from governance (trusted)" not in err: fail(f"an own mode that differs must fail naming both keys:\n{err}") + err = render(META_DIR, META + ["--set", FLOOR_RANGE, "--set", "muster.muster.governance.servers.platformManager[0]=pm"], expect_fail=True) + if "muster.muster.governance.servers is the earlier governance shape" not in err: + fail(f"the earlier servers shape must fail:\n{err}") + err = render(META_DIR, META + ["--set", FLOOR_RANGE, "--set", "governedServers.model-manager.safe_list[0]=x"], expect_fail=True) + if "governedServers.model-manager.safe_list: unknown key" not in err: + fail(f"an unknown key of a source must fail naming it:\n{err}") connectivity = doc(render_meta([]), "HelmRelease", "agent-platform-connectivity") - if connectivity and "\n governance:" in connectivity: - fail("governance must not reach the connectivity release (omitKeys)") - print("ok: governance renders muster's governance configuration (trusted by default, governed, servers, own entries), none below the floor, unknown and conflicting modes fail") + if connectivity and ("\n governance:" in connectivity or "governedServers" in connectivity or "governanceExempt" in connectivity): + fail("governance, governedServers and governanceExempt must not reach the connectivity release (omitKeys)") + print("ok: governance renders muster's governance configuration (mode, governedServers per shipped server, keys, own entries, null sources), none below the floor, governed below the floor, the earlier shape, unknown keys and conflicting modes fail") + + +# muster's floors (muster internal/api/governance.go roleFloors): never safe. +FLOORS = { + "agentManager": {"set_agent_approval", "set_organization_connector", "add_organization_member", "set_organization_model", "set_organization_egress_policy", "replace_organization_credential"}, + "platformManager": {"approve_action", "merge_action"}, + "connectorManager": {"mcpserver_create", "mcpserver_connect", "mcpserver_set_approval"}, + "toolchainManager": {"approve_source"}, + "modelManager": {"add_backend"}, +} +MANAGERS = ["agent-manager", "model-manager", "vm-manager", "cluster-manager", "workspace-manager", "toolchain-manager", "skill-manager"] + + +def values_block(text: str, key: str) -> list[str]: + """The lines of a top-level values.yaml block.""" + lines = text.split("\n") + start = next(i for i, l in enumerate(lines) if l.startswith(f"{key}:")) + out = [] + for l in lines[start + 1:]: + if l and not l.startswith(" ") and not l.startswith("#"): + break + out.append(l) + return out + + +def sources(meta_dir: str) -> tuple[dict[str, str], dict[str, str]]: + """governedServers source -> role ('' for null) and governanceExempt source -> reason, from values.yaml.""" + text = open(os.path.join(meta_dir, "values.yaml")).read() + governed: dict[str, str] = {} + cur = None + for l in values_block(text, "governedServers"): + m = re.match(r"^ ([a-z0-9-]+):\s*(null)?\s*$", l) + if m: + cur = m.group(1) + governed[cur] = "" + continue + m = re.match(r"^ role: (\S+)", l) + if m and cur: + governed[cur] = m.group(1) + exempt = {} + for l in values_block(text, "governanceExempt"): + m = re.match(r'^ ([a-z0-9-]+): "(.+)"$', l) + if m: + exempt[m.group(1)] = m.group(2) + return governed, exempt + + +def tools_map(text: str, header: re.Pattern[str]) -> dict[str, str]: + """tool -> setting of the approval block whose `approval:` line follows the first match of header.""" + lines = text.split("\n") + i = next(n for n, l in enumerate(lines) if header.search(l)) + i = next(n for n in range(i, len(lines)) if lines[n].strip().startswith("approval:")) + t = next(n for n in range(i, len(lines)) if lines[n].strip().startswith("tools:")) + indent = len(lines[t]) - len(lines[t].lstrip()) + out = {} + for l in lines[t + 1:]: + if l.strip().startswith("#"): + continue + if not l.strip() or len(l) - len(l.lstrip()) <= indent: + break + m = re.match(r"^\s+([A-Za-z0-9_.-]+): (Allow|Ask|Block)\b", l) + if m: + out[m.group(1)] = m.group(2) + return out + + +def check_coverage() -> None: + governed, exempt = sources(META_DIR) + covered = {k for k, role in governed.items() if role} | set(exempt) + for k in set(governed) & set(exempt): + fail(f"{k} is both governed and exempt") + # 1. The meta chart's own picture, everything on. + meta = render_meta(FULL + ["--set", FLOOR_RANGE, "--set", "components.mcp-kubernetes.enabled=true", + *[a for m in MANAGERS if m != "workspace-manager" for a in ("--set", f"components.{m}.enabled=true")], + "--set", "workspaces.enabled=true", + "--set", "muster.muster.credentialProvider.releasable.github=https://github.com/apps/ci-agents", + *[a for i, g in enumerate(("kubernetes", "prometheus", "capi")) for a in ( + "--set", f"agent-platform-mcps.mcpServers[{i}].cluster=mc{i}", + "--set", f"agent-platform-mcps.mcpServers[{i}].group={g}", + "--set", f"agent-platform-mcps.mcpServers[{i}].url=https://mc{i}.example.com/mcp")]]) + shipped = {} + for d in docs(meta): + m = re.search(r"\nkind: HelmRelease\nmetadata:\n name: (\S+)\n", "\n" + d) + if m and re.search(r"\n muster:\n( .*\n)*? mcpServer:\n", d + "\n"): + shipped[m.group(1)] = "meta release values carry muster.mcpServer" + conn = render(CONN_DIR, CONN + AGENT_MANAGER + KAGENT_MCP + MCPK) + for d in docs(conn): + m = re.search(r"\nkind: MCPServer\nmetadata:\n name: (\S+)\n", "\n" + d) + if m: + shipped[{"kagent": "kagent", "mcp-kubernetes": "mcp-kubernetes"}.get(m.group(1), m.group(1))] = "connectivity chart MCPServer" + for g in ("kubernetes", "prometheus", "capi"): + shipped[{"kubernetes": "mcp-kubernetes"}.get(g, g)] = "agent-platform-mcps family" + # 2. The component charts beside this repository. + siblings = os.environ.get("COMPONENT_CHECKOUTS") or os.path.dirname(os.path.abspath(os.path.join(META_DIR, "..", ".."))) + seen_siblings = [] + for repo in sorted(os.listdir(siblings)) if os.path.isdir(siblings) else []: + tdir = os.path.join(siblings, repo, "helm", repo, "templates") + if repo == "agent-platform" or not os.path.isdir(tdir): + continue + if any("kind: MCPServer" in open(os.path.join(tdir, f)).read() for f in os.listdir(tdir) if f.endswith((".yaml", ".tpl"))): + seen_siblings.append(repo) + if repo != "agent-platform-mcps": + shipped[repo] = "component chart renders an MCPServer" + for src, why in sorted(shipped.items()): + if src not in covered: + fail(f"{src} ({why}) ships an MCPServer that is neither in governedServers nor in governanceExempt: govern it with its reads safe, or exempt it with the reason") + # 3. The rendered entries: every governed shipped source rendered, no floor is safe. + rendered = governed_entries(block(doc(meta, "HelmRelease", "muster") or "", " governance:")) + for key, e in rendered.items(): + bad = set(e["safe"]) & FLOORS.get(e["role"], set()) + if bad: + fail(f"{key}: floors {sorted(bad)} of role {e['role']} on its safe list (muster refuses to start)") + for src in [s for s in shipped if s in governed and governed[s]]: + if not any(k == src or k.endswith("/" + src) or k.endswith("-" + src) for k in rendered): + fail(f"{src} is governed but no entry rendered for it with every component on: {sorted(rendered)}") + # 4. Safe entries name tools of their server. + conn_values = open(os.path.join(CONN_DIR, "values.yaml")).read() + maps = { + "kagent": tools_map(conn_values, re.compile(r"^ description: \"Your agent sessions")), + "mcp-kubernetes": tools_map(conn_values, re.compile(r"^ description: \"Resources, events and pod logs of this installation")), + } + for repo in seen_siblings: + text = open(os.path.join(siblings, repo, "helm", repo, "values.yaml")).read() + if repo == "agent-platform-mcps": + fam = tools_map(text, re.compile(r"^ kubernetes:\s*$")) + if fam != maps["mcp-kubernetes"]: + fail(f"agent-platform-mcps' kubernetes family map differs from the connectivity chart's mcp-kubernetes map: {sorted(set(fam.items()) ^ set(maps['mcp-kubernetes'].items()))}") + else: + maps[repo] = tools_map(text, re.compile(r"^ mcpServer:\s*$")) + vtext = open(os.path.join(META_DIR, "values.yaml")).read() + for src, role in governed.items(): + if not role or src not in maps: + continue + m = re.search(rf"\n {re.escape(src)}:\n role: \S+\n(?: #.*\n)* safe: \[(.*)\]\n", vtext) + if not m: + fail(f"governedServers.{src}: want role then safe as a one-line list") + safe = [t.strip() for t in m.group(1).split(",") if t.strip()] + unknown = [t for t in safe if t not in maps[src]] + if unknown: + fail(f"governedServers.{src}.safe names no tool of its server: {unknown} (muster counts them in muster_governance_safe_list_unmatched)") + missing = sorted(set(MANAGERS) - set(seen_siblings)) + note = f"; component checkouts not found for {missing}, their safe lists not checked against their tools" if missing else "" + print(f"ok: every shipped MCPServer source ({len(shipped)}) is governed or exempt, no floor is safe, safe entries name tools of their server ({len(maps)} maps), the two kubernetes maps agree" + note) def check_approval_config() -> None: @@ -217,13 +437,26 @@ def release(args: list[str]) -> str: lines = [l.strip() for l in merged.split("\n")[1:]] if lines != ["- https://own.example.com/x", "- https://backstage.ci.example.com/sessions", "- https://gw.ci.example.com/auth/slack/return"]: fail(f"own entries stay first, each entry once:\n{merged}") + ported = block(release(mc + portal + ["--set", "backstage.publicPort=8443", "--set", "components.klaus-gateway.enabled=true", "--set", "klausGateway.obo.callbackBaseUrl=https://gw.ci.example.com:8443/"]), list_header) + if [l.strip() for l in ported.split("\n")[1:]] != ["- https://backstage.ci.example.com:8443/sessions", "- https://gw.ci.example.com:8443/auth/slack/return"]: + fail(f"a non-default port must stay in both entries (M1-1):\n{ported}") + default_port = block(release(mc + portal + ["--set", "backstage.publicPort=443"]), list_header) + if "- https://backstage.ci.example.com/sessions" not in default_port: + fail(f"port 443 writes no port:\n{default_port}") + for args, want in ( + (["--set", "backstage.publicPort=84a3"], 'backstage.publicPort "84a3"'), + (["--set", "components.klaus-gateway.enabled=true", "--set", "klausGateway.obo.callbackBaseUrl=gw.ci.example.com"], 'klausGateway.obo.callbackBaseUrl "gw.ci.example.com": want an http(s) URL'), + ): + err = render(META_DIR, META + ["--set", FLOOR_RANGE, "--set", "global.domain=ci.example.com", *mc, *portal, *args], expect_fail=True) + if want not in err: + fail(f"{args}: want {want!r}, got:\n{err}") below = muster_release(["--set", "global.domain=ci.example.com", *mc, *portal, *kg]) if block(below, " approval:") or "auth/slack/return" in below or "/sessions" in below: fail("below the muster floor the muster release must carry neither approval nor derived allowlist entries") connectivity = doc(render_meta(["--set", FLOOR_RANGE, *portal]), "HelmRelease", "agent-platform-connectivity") if connectivity and "\n approval:\n installation:" in connectivity: fail("the approval block must not reach the connectivity release") - print("ok: muster.approval.installation follows backstage.installationName, the redirect allowlist names the portal's /sessions and klaus-gateway's /auth/slack/return where they are on, own values stand, none below the floor") + print("ok: muster.approval.installation follows backstage.installationName, the redirect allowlist names the portal's /sessions and klaus-gateway's /auth/slack/return where they are on, with a non-default port, invalid ports and URLs fail, own values stand, none below the floor") def check_connector_admin() -> None: @@ -243,27 +476,39 @@ def check_connector_admin() -> None: def check_binder() -> None: - out = render(CONN_DIR, CONN + AGENT_MANAGER) - rb = doc(out, "RoleBinding", "agent-platform:muster-approval-binder") - if rb is None: - fail("no RoleBinding agent-platform:muster-approval-binder with agent-manager on") - for want in ("\n namespace: agent-platform\n", "\nroleRef:\n apiGroup: rbac.authorization.k8s.io\n kind: Role\n name: muster-approval-binder\n"): - if want not in rb: - fail(f"binder RoleBinding lacks {want!r}:\n{rb}") - subjects = block(rb, "subjects:") - if subjects.count("- kind:") != 1 or "kind: ServiceAccount" not in subjects or "name: agent-manager\n" not in subjects + "\n" or "namespace: agent-platform" not in subjects: - fail(f"binder must bind agent-manager's ServiceAccount only:\n{subjects}") - if "muster-approval-binder" in "".join(d for d in docs(out) if "\nkind: Role\n" in "\n" + d or "\nkind: ClusterRoleBinding\n" in "\n" + d): - fail("the connectivity chart must not ship the binder Role itself (the muster chart does) or bind it cluster-wide") - renamed = doc(render(CONN_DIR, CONN + AGENT_MANAGER + ["--set", "agent-manager.serviceAccount.name=am-sa"]), "RoleBinding", "agent-platform:muster-approval-binder") - if renamed is None or "name: am-sa" not in renamed: - fail(f"binder must follow agent-manager.serviceAccount.name:\n{renamed}") - if doc(render(CONN_DIR, CONN), "RoleBinding", "agent-platform:muster-approval-binder"): - fail("binder RoleBinding with agent-manager off") - off = render(CONN_DIR, CONN + AGENT_MANAGER + ["--set", "components.muster.enabled=false", "--set", "agent-manager.muster.mcpServer.enabled=false"]) - if doc(off, "RoleBinding", "agent-platform:muster-approval-binder"): - fail("binder RoleBinding with muster off") - print("ok: muster-approval-binder is bound to agent-manager's ServiceAccount only, in muster's namespace; none with agent-manager or muster off") + def binder(args: list[str]) -> str: + return block(muster_release(["--set", FLOOR_RANGE, *args]), " approvalBinder:") + + on = ["--set", "components.agent-manager.enabled=true"] + got = binder(on) + want = "\n".join([ + " approvalBinder:", + " subjects:", + " - kind: ServiceAccount", + " name: agent-manager", + " namespace: default", + ]) + if got.rstrip() != want: + fail(f"muster-approval-binder must bind agent-manager's ServiceAccount only, want:\n{want}\ngot:\n{got}") + moved = binder(on + ["--set", "components.agent-manager.targetNamespace=am", "--set", "agent-manager.serviceAccount.name=am-sa", "--set", "components.muster.targetNamespace=muster"]) + if "name: am-sa" not in moved or "namespace: am" not in moved: + fail(f"the subject must follow agent-manager's ServiceAccount name and namespace:\n{moved}") + own = binder(on + ["--set", "muster.rbac.approvalBinder.subjects[0].kind=ServiceAccount", "--set", "muster.rbac.approvalBinder.subjects[0].name=other", "--set", "muster.rbac.approvalBinder.subjects[0].namespace=x"]) + if "name: other" not in own or "name: agent-manager" in own: + fail(f"an own approvalBinder list must stand:\n{own}") + err = render(META_DIR, META + ["--set", FLOOR_RANGE, *on, "--set", "agent-manager.serviceAccount.create=false"], expect_fail=True) + if "agent-manager.serviceAccount.create is false without agent-manager.serviceAccount.name" not in err: + fail(f"a ServiceAccount the chart does not create must be named:\n{err}") + if "name: am-sa" not in binder(on + ["--set", "agent-manager.serviceAccount.create=false", "--set", "agent-manager.serviceAccount.name=am-sa"]): + fail("an own ServiceAccount with a name must be bound") + if binder([]): + fail("no approvalBinder subjects with agent-manager off") + if block(muster_release(on), " approvalBinder:"): + fail("no approvalBinder subjects below the muster floor") + conn = render(CONN_DIR, CONN + AGENT_MANAGER) + if "muster-approval-binder" in conn: + fail("the connectivity chart must ship no muster-approval-binder binding (the muster chart binds it in muster's namespace)") + print("ok: muster-approval-binder is bound by the muster chart to agent-manager's ServiceAccount only (name and namespace following agent-manager), an own list stands, an unnamed external ServiceAccount fails, none with agent-manager off or below the floor, none in the connectivity chart") def approval_of(out: str, name: str) -> str: @@ -294,11 +539,17 @@ def check_approval() -> None: tightened = approval_of(render(CONN_DIR, CONN + MCPK + ["--set", "mcp-kubernetes.mcpServer.approval.tools.exec=Block", "--set", "mcp-kubernetes.mcpServer.managementCluster=lab"]), "lab-mcp-kubernetes") if " exec: Block" not in tightened: fail(f"a per-tool override must reach spec.approval of the family member:\n{tightened}") + blocked = approval_of(render(CONN_DIR, CONN + MCPK + ["--set", "mcp-kubernetes.mcpServer.approval.rule=Block"]), "mcp-kubernetes") + if " rule: Block" not in blocked: + fail(f"a rule Block must render:\n{blocked}") + forwarded = doc(render_meta(["--set", "mcp-kubernetes.mcpServer.approval.tools.exec=Block", "--set", "kagent.controllerRoute.mcp.approval.tools.invoke_session=Ask"]), "HelmRelease", "agent-platform-connectivity") + if forwarded is None or "exec: Block" not in forwarded or "invoke_session: Ask" not in forwarded: + fail("per-connector overrides in the meta chart's values must reach the connectivity release (M1-AP-12)") cleared = render(CONN_DIR, CONN + MCPK + ["--set-json", "mcp-kubernetes.mcpServer.approval=null"]) if approval_of(cleared, "mcp-kubernetes"): fail("approval null must render no spec.approval") for args, want in ( - (["--set", "mcp-kubernetes.mcpServer.approval.rule=Block"], 'mcp-kubernetes.mcpServer.approval.rule "Block": want Allow or Ask'), + (["--set", "mcp-kubernetes.mcpServer.approval.rule=Deny"], 'mcp-kubernetes.mcpServer.approval.rule "Deny": want Allow, Ask or Block'), (["--set", "mcp-kubernetes.mcpServer.approval.tools.get=Deny"], 'mcp-kubernetes.mcpServer.approval.tools.get "Deny": want Allow, Ask or Block'), (["--set", "mcp-kubernetes.mcpServer.approval.preset=recommended"], "mcp-kubernetes.mcpServer.approval.preset: unknown key"), ): @@ -308,13 +559,14 @@ def check_approval() -> None: err = render(CONN_DIR, CONN + KAGENT_MCP + ["--set", "kagent.controllerRoute.mcp.approval.tools.invoke_session=never"], expect_fail=True) if "kagent.controllerRoute.mcp.approval.tools.invoke_session" not in err: fail(f"kagent: an invalid value must fail naming the key:\n{err}") - print("ok: mcp-kubernetes carries the Recommended settings, kagent the Allow all settings, overrides reach spec.approval, null renders none, invalid values fail naming the key") + print("ok: mcp-kubernetes carries the Recommended settings, kagent the Allow all settings, a Block rule renders, overrides reach spec.approval (also from the meta chart), null renders none, invalid values fail naming the key") if __name__ == "__main__": META_DIR, CONN_DIR = sys.argv[1], sys.argv[2] FLOOR_RANGE = f"components.muster.versionRange=>={governance_floor(META_DIR)} <6.0.0-0" check_governance() + check_coverage() check_approval_config() check_connector_admin() check_binder() From 5d6e6f3739e1205f75919433c844fe90554b7433 Mon Sep 17 00:00:00 2001 From: Dominik Schmidle Date: Wed, 25 Nov 2026 21:25:02 +0100 Subject: [PATCH 13/56] docs(skills): describe the Block rule, the governed default, retry over the same MCP session and the upgrade The skills no longer present agent-manager's per-agent tool lists (update_agent_access, set_agent_approval, tools on create_agent) as shipped: they apply once its schema has them. approval.source lists what muster reports (unavailable included). UPGRADE.md names the operator actions for tool approval. --- UPGRADE.md | 14 ++++ docs/toolset-presets.md | 2 +- .../agent-platform-agent-management/SKILL.md | 36 +++++----- .../agent-platform-building-blocks/SKILL.md | 4 +- skills/agent-platform-tools/SKILL.md | 65 ++++++++++++------- 5 files changed, 79 insertions(+), 42 deletions(-) diff --git a/UPGRADE.md b/UPGRADE.md index 1b58e5b8..69e66834 100644 --- a/UPGRADE.md +++ b/UPGRADE.md @@ -15,6 +15,20 @@ Every component ships its own CRDs and upgrades them with its release; there is A CRD version change that needs more than an apply (a stored version dropped, as with kagent's `v1alpha2`) has its own entry below, with the hook that does it. +## \ → \ (tool approval and the governance mode) + +giantswarm/giantswarm#38902: muster decides Allow, Ask or Block for every tool call, and the chart renders muster's governance configuration (`governance`, `governedServers`: per shipped MCPServer its role and its safe list of reads), the approval page's installation name, the redirect allowlist and the approval binder ([chart README, "Tool approval and the governance mode"](helm/agent-platform/README.md#tool-approval-and-the-governance-mode)). None of it reaches a muster below `agent-platform.muster.governanceFloor`. + +### Operator action + +- Move `components.muster.versionRange` to the muster release that carries tool approval with this chart. `governance: governed` below it fails the render. +- After muster's CRD upgrade, force a reconcile of the releases that render MCPServers (connectivity, agent-platform-mcps, the managers) if any of them was applied while the old CRD was served (its `spec.approval` was pruned): `flux reconcile helmrelease -n --force`. Until the CRD knows `spec.approval`, muster refuses every server tool. +- Keep `muster.rbac.mcpServerEditor.subjects` non-empty (the chart's default, the Giant Swarm admin groups and `tenants.platformTeam`): muster's chart no longer binds `system:authenticated` and fails the upgrade with an empty list while the old binding exists (`muster.rbac.mcpServerEditor.allowRemovingBinding: true` drops it). +- Replace an own `muster.muster.governance.servers.` with `governedServers` entries (the render fails on the earlier shape). +- An edge not on 443: set `backstage.publicPort`, and remove a hand-written portal entry from `muster.muster.oauth.mcpClient.postLoginRedirectAllowlist`. The allowlist reaches muster only with `muster.muster.oauth.mcpClient.enabled`. +- An agent-manager ServiceAccount the chart does not create (`agent-manager.serviceAccount.create: false`) needs `agent-manager.serviceAccount.name`. +- Clients (portal, klaus-gateway, kagent) retry an approved call over the same MCP session; another connection asks anew. + ## \ → \ (forge CLI configuration from the Harness only) The kagent and kagent-crds ranges select the 1.33 line. Its runtimes no longer generate git, gh or glab configuration in a workspace turn: no credential helper, no placeholder `GH_TOKEN` or `GITLAB_TOKEN` and no `GLAB_CONFIG_DIR`. The chart declares those inert values in `Harness.spec.env` with `workspaces.enabled`, and the Go ADK passes declared values to its shell tools while it still withholds every undeclared runtime variable. Session grants and gateway bindings keep deciding access; the values grant nothing. diff --git a/docs/toolset-presets.md b/docs/toolset-presets.md index d7ff9346..cdbe8478 100644 --- a/docs/toolset-presets.md +++ b/docs/toolset-presets.md @@ -2,7 +2,7 @@ A **toolset** is the selector list an agent declares to say which of the gateway's tools it is composed with: the agent chart's `toolset` value (rendered as the `X-Muster-Toolset` header on the agent's muster tool entry), agent-manager's `toolset` argument, or the `toolset` argument of muster's `filter_tools`. muster evaluates it on every request as one more filter on the caller's own catalogue — it never widens access; the invoking human's identity and the backends' own authorization remain the boundary. The grammar, the built-in presets and the error texts are muster's: [docs/reference/toolsets.md](https://github.com/giantswarm/muster/blob/main/docs/reference/toolsets.md). -With tool approval the toolset becomes the agent's `tools` list: the same selectors, each optionally `Allow`, `Ask` or `Block`, plus a `default` for the list ([Governing tool calls](https://docs.giantswarm.io/overview/agent-platform/governing-tool-calls/)). +A toolset selects tools; whether a selected tool runs, asks a person or is hidden is its connector's tool approval setting (`Allow`, `Ask`, `Block`, and a connector-wide `rule`), and on a governed platform agents are also asked before every non-read tool of the platform's own servers ([Governing tool calls](https://docs.giantswarm.io/overview/agent-platform/governing-tool-calls/)). Once agent-manager ships per-agent tool lists (its `create_agent` schema has `tools`), the toolset becomes the agent's `tools` list: the same selectors, each optionally `Allow`, `Ask` or `Block`, plus a `default` for the list. A **preset** is a named selection an agent refers to as `preset:`. Presets are muster configuration — `toolsetPresets` in muster's `config.yaml`, which the muster chart renders from its `muster.toolsetPresets` value. This meta-package forwards its `muster:` block to the muster release, so the presets an installation ships live under **`muster.muster.toolsetPresets`** in these values (the first `muster` is the component block, the second is the muster chart's own `muster:` key). diff --git a/skills/agent-platform-agent-management/SKILL.md b/skills/agent-platform-agent-management/SKILL.md index d9294222..97baa9c5 100644 --- a/skills/agent-platform-agent-management/SKILL.md +++ b/skills/agent-platform-agent-management/SKILL.md @@ -123,22 +123,26 @@ never assume an argument. The agent tools drop an unknown key without an error: - **Toolset**: the smallest that does the job; `preset:none` for chat only; the broadest preset only on an explicit request. An own-account (OAuth) connector without `grantScope: subject` needs a sign-in in each of the agent's conversations (`agent-platform-tools`); say so before choosing it. -- **Tool approval** (https://docs.giantswarm.io/overview/agent-platform/governing-tool-calls/): once agent-manager's `create_agent` schema has `tools`, the toolset - becomes the agent's **tool list**: the same selectors, each optionally `Allow`, `Ask` or `Block`, - plus a `default` for every listed tool without its own setting; at most 32 entries; an unlisted - tool is invisible. An agent's settings only tighten its connectors' (the strictest wins) and apply - to everyone who uses the agent. `Allow` over a tool its connector sets to `Ask`, or an allowing - `default`, is an **exception**: only a connector admin of that connector may grant it, and only - through `x_agent-manager_set_agent_approval` (`create_agent` and `update_agent_access` refuse - it); when you, an agent, call it, it asks the person, on every platform. Saving an agent - (`update_agent`, `update_agent_access`, `set_agent_approval`) drops each exception the saver is - not connector admin for, and the tool asks again: say so before saving. The tools split: - `update_agent` (name, description, prompt, model), `update_agent_access` (`tools` and everything - that widens reach: skills, plugins, egress, harness, workspace, toolchains), - `set_agent_approval` (the settings). On a **governed** platform `create_agent`, - `update_agent_access` and `start_session` ask the person when an agent calls them; on a trusted - one (the default) they don't. `muster.requireApproval: true` keeps asking before every call - until agent chart 3.0 moves it to `default: Ask`; never set it together with tool settings. +- **Tool approval** (https://docs.giantswarm.io/overview/agent-platform/governing-tool-calls/): + today an agent's toolset only selects tools; their Allow/Ask/Block settings are the connectors' + (`agent-platform-tools`). On a **governed** platform every agent-manager tool that is not a read + (`create_agent`, `update_agent`, `delete_agent`, `start_session`, `delete_session`, the + organization writes) asks the person when an agent calls it; on a trusted one (the default) they + run, except the floors that ask in both modes (`set_organization_connector`, + `add_organization_member`, `set_organization_model`, `set_organization_egress_policy`, + `replace_organization_credential`). Check the `filter_tools` `approval` of the tool before you + promise an outcome. **Only once agent-manager ships per-agent tool lists** (its `create_agent` + schema has `tools`, and `x_agent-manager_update_agent_access` and + `x_agent-manager_set_agent_approval` exist; describe them first): the toolset becomes the agent's + **tool list**, the same selectors each optionally `Allow`, `Ask` or `Block` plus a `default`, at + most 32 entries, an unlisted tool invisible; an agent's settings only tighten its connectors' + (the strictest wins); `Allow` over a connector's `Ask` is an **exception** only a connector admin + of that connector grants, through `set_agent_approval`, which asks the person whenever an agent + calls it, and a save drops the exceptions the saver is not connector admin for (say so before + saving). Until then `update_agent` still takes `toolset`, skills, plugins and egress. A governed + platform's asks cannot be lifted per agent. `muster.requireApproval: true` keeps asking before + every call until agent chart 3.0 moves it to `default: Ask`; never set it together with tool + settings. - **An organization's connectors**: a kagent `RemoteMCPServer` in the organization namespace (`x_agent-manager_set_organization_connector`), not a Muster server, so no `toolset` selector reaches it. From agent-manager 3.3.0 (`connectors` in `x_agent-manager_create_agent`'s schema; diff --git a/skills/agent-platform-building-blocks/SKILL.md b/skills/agent-platform-building-blocks/SKILL.md index 9d707190..2c2e0fbf 100644 --- a/skills/agent-platform-building-blocks/SKILL.md +++ b/skills/agent-platform-building-blocks/SKILL.md @@ -28,7 +28,9 @@ person: what they may do in the service is what the agent may do there. Some con person to sign in once with their own account; until then their tools are hidden for that person. Each tool of a connector is **Allow** (runs), **Ask** (a person confirms the call first) or -**Block** (hidden); the strictest of the connector's and the agent's settings wins +**Block** (hidden); a connector's rule decides for tools nobody has set yet, new ones included, and +the strictest setting wins. A governed platform also asks before an agent changes anything through +the platform's own connectors (https://docs.giantswarm.io/overview/agent-platform/governing-tool-calls/). **Suggest one** when the goal needs a system no connector reaches yet ("read our Jira tickets"): diff --git a/skills/agent-platform-tools/SKILL.md b/skills/agent-platform-tools/SKILL.md index df62c82e..f20d018a 100644 --- a/skills/agent-platform-tools/SKILL.md +++ b/skills/agent-platform-tools/SKILL.md @@ -141,38 +141,55 @@ agent, the portal, Slack, Claude Code): - **Allow** runs. **Ask**: a person confirms the exact call on Muster's approval page first; the call then runs once. **Block**: hidden, absent from `filter_tools`, refused as not found. -- A connector carries `spec.approval`: a `rule` (`Allow` or `Ask`) that every tool without its own - entry follows — **new tools follow the rule** — and per-tool entries by the server's own tool - name (no `x__` prefix). A connector without `approval` runs everything and is shown as - *not reviewed*. An agent's settings can only tighten them; the strictest wins. -- `filter_tools` and `describe_tool` report each tool's `approval` (`setting`, `source`: `tool`, - `connector`, `agent`, `agent-exception`, `builtin`, `governance` or `unreviewed`; `new` for a tool - without its own entry) and `connectorAdmin`, whether you may change that connector's settings. +- A connector carries `spec.approval`: a `rule` (`Allow`, `Ask` or `Block`) that every tool without + its own entry follows — **new tools follow the rule**, so a `Block` rule hides every tool nobody + has reviewed yet — and per-tool entries by the server's own tool name (no `x__` prefix). + A connector without `approval` runs everything and is shown as *not reviewed*. An agent's + settings can only tighten them (agent-manager's tool lists, when its schema has `tools`); the + strictest wins. +- `filter_tools` and `describe_tool` report each tool's `approval` (`setting`; `source`: `tool`, + `connector`, `unreviewed`, `builtin`, `governance`, `unavailable`, and with agent tool lists + `agent`, `agent-exception`; `new` for a tool without its own entry; `unavailable` with the reason + when asking calls are refused here) for **you**, the caller, and `connectorAdmin`, whether you + may change that connector's settings. The `filter_tools` result's `governance` field says + whether the platform is `trusted` or `governed`. - **Presets** fill in every tool once, on save, from the tools listed at that moment: *Recommended* (rule Ask, tools annotated read-only Allow, the rest Ask), *Allow all*, *Ask all*. Creating a connector over MCP (`core_mcpserver_create`) requires `preset` or explicit `approval`; - `core_mcpserver_set_approval` changes them. Only a connector admin (whoever may update - `mcpservers` in its namespace: the `connector-admin` role) may write them, and an agent writing - them always asks a person. The portal's wizard pre-selects *Allow all* on a trusted platform and - *Recommended* on a governed one. The platform's own connectors arrive reviewed: its management - servers (agent-manager, the other managers, kagent's session tools) on *Allow all*, the - infrastructure servers (Kubernetes, Prometheus, Cluster API) on *Recommended*. + `core_mcpserver_set_approval` changes them (pass the `generation` from `core_mcpserver_get` as + `expectedGeneration`; a conflict means someone changed it: read again). Only a connector admin + (whoever may update `mcpservers` in its namespace: the `connector-admin` role) may write them, + and an agent writing them always asks a person. The portal's wizard pre-selects *Allow all* on a + trusted platform and *Recommended* on a governed one. The platform's own connectors arrive + reviewed: its management servers (agent-manager, the other managers, kagent's session tools) on + *Allow all*, the infrastructure servers (Kubernetes, Prometheus, Cluster API) on *Recommended*. - **When a call asks**, you get an approval link (or, in a client without the prompt, an `approval_required` text with the URL). Give the person the link as is, wait, then call the tool - again with the same arguments: approved, it runs once; declined, you get a declined result — - accept it, never retry another way. A workflow asks once, up front, for all its steps. - Never press *Approve* yourself, and never ask the person to approve something you did not show - them; with no person to open the link the call expires and is refused. -- **Built in, every mode**: an agent is asked before it adds or repoints a connector, changes - approval on a connector or an agent, gives an agent an exception, creates, changes or deletes a - workflow, or changes Muster's configuration (that one asks every caller). A **governed** platform - also asks before an agent creates an agent, changes an agent's tools, starts another agent's - session or pauses a connector; a **trusted** one (the default) lets agents do those freely. + again with the same arguments **over the same connection** (the same MCP session): approved, it + runs once; declined, you get a declined result — accept it, never retry another way. A retry + from another connection asks anew. A workflow asks once, up front, for all its steps. At most 3 + calls of one connection (10 of one person) wait for a decision at a time. Never press *Approve* + yourself, and never ask the person to approve something you did not show them; with no person + to open the link the call expires and is refused. +- **Built in, every mode** (agents only): an agent is asked before it adds or repoints a connector, + changes approval settings, creates, changes or deletes a workflow, grants or changes access + (organization members, connectors, models, egress, credentials), adds a model backend, approves + an action or a toolchain source, or changes Muster's configuration (that one asks every caller). + A **governed** platform also asks an agent before **every tool of the platform's own servers that + is not a read on their safe list** (creating, changing, starting or deleting agents and sessions, + VMs, clusters, models, workspaces, toolchains, Kubernetes writes, new tools too) and before + Muster's own tools other than its reads (pausing, deleting, starting or stopping a connector). + A **trusted** one (the default) leaves those to the connectors' settings. A person is never asked + by the mode, only by the connectors' settings. - Missing prerequisites (Muster's Valkey store, its OAuth server with browser sign-in, a public URL on that server's origin) make every asking call refused with the reason, reported as `approval.unavailable` on each tool that asks; tell the person, it is the installation's to fix - (the platform chart does not fail a render over it). The approval page returns the browser to the - portal or Slack only where the installation's redirect allowlist names them; the chart derives it. + (the platform chart does not fail a render over it). So does a cluster whose MCPServer CRD does + not know `spec.approval` yet (every server tool refused until it is upgraded). The approval page + returns the browser to the portal or Slack only where the installation's redirect allowlist names + them: the chart derives the entries (with the portal's port, `backstage.publicPort`), and Muster + renders them only with `muster.muster.oauth.mcpClient.enabled`; otherwise the person returns by + hand. ## Workflows From fbbc912c9e2c79925cd80f8b4a75d66c487832df Mon Sep 17 00:00:00 2001 From: Dominik Schmidle Date: Wed, 25 Nov 2026 21:29:37 +0100 Subject: [PATCH 14/56] docs: bind tool approvals to the calling client, not the MCP session --- UPGRADE.md | 2 +- helm/agent-platform/README.md | 11 ++++++----- helm/agent-platform/README.md.gotmpl | 11 ++++++----- skills/agent-platform-tools/SKILL.md | 8 ++++---- 4 files changed, 17 insertions(+), 15 deletions(-) diff --git a/UPGRADE.md b/UPGRADE.md index 69e66834..4fb36507 100644 --- a/UPGRADE.md +++ b/UPGRADE.md @@ -27,7 +27,7 @@ giantswarm/giantswarm#38902: muster decides Allow, Ask or Block for every tool c - Replace an own `muster.muster.governance.servers.` with `governedServers` entries (the render fails on the earlier shape). - An edge not on 443: set `backstage.publicPort`, and remove a hand-written portal entry from `muster.muster.oauth.mcpClient.postLoginRedirectAllowlist`. The allowlist reaches muster only with `muster.muster.oauth.mcpClient.enabled`. - An agent-manager ServiceAccount the chart does not create (`agent-manager.serviceAccount.create: false`) needs `agent-manager.serviceAccount.name`. -- Clients (portal, klaus-gateway, kagent) retry an approved call over the same MCP session; another connection asks anew. +- Clients (portal, klaus-gateway, kagent) retry an approved call as the same client of the same person (any MCP session of it); another client of the person asks anew. ## \ → \ (forge CLI configuration from the Harness only) diff --git a/helm/agent-platform/README.md b/helm/agent-platform/README.md index 11271e07..7bb94ac7 100644 --- a/helm/agent-platform/README.md +++ b/helm/agent-platform/README.md @@ -425,10 +425,11 @@ who sets what and the prompts are on URL with a host fails) while klaus-gateway is on and names it; an own list's entries stay. Without an entry the person sees muster's own "answer recorded" page and answers *Done* in the portal or Slack. -- **Retry over the same MCP session.** muster binds a pending approval to the client's MCP session - (`Mcp-Session-Id`) within muster's session: after the person decides, the client retries over the - connection that got the prompt; another connection of the same person asks anew. At most 3 - pending approvals per MCP connection and 10 per person. +- **Retry as the same client.** muster binds a pending approval to the person and the calling + client (the OAuth client id `azp` of a person's client, the acting party of a delegated token, + or the agent's own Session for an actor JWT), not to the MCP session: after the person decides, + the same client retries, over any MCP session; another client of the same person asks anew. + At most 3 pending approvals per client and 10 per person. - **The `connector-admin` role** is muster's `mcpserver-editor` Role in muster's namespace, bound to `muster.rbac.mcpServerEditor.subjects` (the Giant Swarm admin groups) plus `tenants.platformTeam`. Whoever holds it edits the namespace's connectors, sets their tool approval and may let an agent @@ -473,7 +474,7 @@ who sets what and the prompts are on it); the muster release binds `muster-approval-binder` in muster's namespace instead. - On a lab or any edge not on 443, set `backstage.publicPort` and drop a hand-written portal entry from `muster.muster.oauth.mcpClient.postLoginRedirectAllowlist`. -- Clients retry an approved call over the same MCP session (see above). +- Clients retry an approved call as the same client (see above). `make verify-tool-approval` asserts the governance configuration and its coverage (every shipped MCPServer governed or exempt, no floor safe, every safe entry a tool of its server), the diff --git a/helm/agent-platform/README.md.gotmpl b/helm/agent-platform/README.md.gotmpl index 8acfba46..2526f253 100644 --- a/helm/agent-platform/README.md.gotmpl +++ b/helm/agent-platform/README.md.gotmpl @@ -411,10 +411,11 @@ who sets what and the prompts are on URL with a host fails) while klaus-gateway is on and names it; an own list's entries stay. Without an entry the person sees muster's own "answer recorded" page and answers *Done* in the portal or Slack. -- **Retry over the same MCP session.** muster binds a pending approval to the client's MCP session - (`Mcp-Session-Id`) within muster's session: after the person decides, the client retries over the - connection that got the prompt; another connection of the same person asks anew. At most 3 - pending approvals per MCP connection and 10 per person. +- **Retry as the same client.** muster binds a pending approval to the person and the calling + client (the OAuth client id `azp` of a person's client, the acting party of a delegated token, + or the agent's own Session for an actor JWT), not to the MCP session: after the person decides, + the same client retries, over any MCP session; another client of the same person asks anew. + At most 3 pending approvals per client and 10 per person. - **The `connector-admin` role** is muster's `mcpserver-editor` Role in muster's namespace, bound to `muster.rbac.mcpServerEditor.subjects` (the Giant Swarm admin groups) plus `tenants.platformTeam`. Whoever holds it edits the namespace's connectors, sets their tool approval and may let an agent @@ -459,7 +460,7 @@ who sets what and the prompts are on it); the muster release binds `muster-approval-binder` in muster's namespace instead. - On a lab or any edge not on 443, set `backstage.publicPort` and drop a hand-written portal entry from `muster.muster.oauth.mcpClient.postLoginRedirectAllowlist`. -- Clients retry an approved call over the same MCP session (see above). +- Clients retry an approved call as the same client (see above). `make verify-tool-approval` asserts the governance configuration and its coverage (every shipped MCPServer governed or exempt, no floor safe, every safe entry a tool of its server), the diff --git a/skills/agent-platform-tools/SKILL.md b/skills/agent-platform-tools/SKILL.md index f20d018a..d62ca3df 100644 --- a/skills/agent-platform-tools/SKILL.md +++ b/skills/agent-platform-tools/SKILL.md @@ -165,10 +165,10 @@ agent, the portal, Slack, Claude Code): *Allow all*, the infrastructure servers (Kubernetes, Prometheus, Cluster API) on *Recommended*. - **When a call asks**, you get an approval link (or, in a client without the prompt, an `approval_required` text with the URL). Give the person the link as is, wait, then call the tool - again with the same arguments **over the same connection** (the same MCP session): approved, it - runs once; declined, you get a declined result — accept it, never retry another way. A retry - from another connection asks anew. A workflow asks once, up front, for all its steps. At most 3 - calls of one connection (10 of one person) wait for a decision at a time. Never press *Approve* + again with the same arguments **as the same client** (any MCP session of it will do): approved, + it runs once; declined, you get a declined result — accept it, never retry another way. A retry + from another client of the person asks anew. A workflow asks once, up front, for all its steps. At + most 3 calls of one client (10 of one person) wait for a decision at a time. Never press *Approve* yourself, and never ask the person to approve something you did not show them; with no person to open the link the call expires and is refused. - **Built in, every mode** (agents only): an agent is asked before it adds or repoints a connector, From 7b252d983315870ddc87903e3df1e0d417b79755 Mon Sep 17 00:00:00 2001 From: Dominik Schmidle Date: Wed, 25 Nov 2026 23:20:33 +0100 Subject: [PATCH 15/56] fix(helm): refuse a backstage.publicPort above 65535 --- helm/agent-platform/templates/_helpers.tpl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/helm/agent-platform/templates/_helpers.tpl b/helm/agent-platform/templates/_helpers.tpl index e36bff90..1d4bc08c 100644 --- a/helm/agent-platform/templates/_helpers.tpl +++ b/helm/agent-platform/templates/_helpers.tpl @@ -5010,7 +5010,7 @@ Usage: include "agent-platform.muster.redirectAllowlist" $root | fromJsonArray {{- $host := dig "hostname" "" $backstage -}} {{- if and (not $host) .Values.global.domain -}}{{- $host = printf "backstage.%s" .Values.global.domain -}}{{- end -}} {{- $port := toString (dig "publicPort" "" $backstage | default "") -}} -{{- if and $port (not (regexMatch "^[1-9][0-9]{0,4}$" $port)) -}} +{{- if and $port (or (not (regexMatch "^[1-9][0-9]{0,4}$" $port)) (gt (atoi $port) 65535)) -}} {{- fail (printf "backstage.publicPort %q: want the port the portal's public URL carries (1-65535), or empty for 443" $port) -}} {{- end -}} {{- if $host -}}{{- $derived = append $derived (printf "https://%s%s/sessions" $host (ternary (printf ":%s" $port) "" (and (ne $port "") (ne $port "443")))) -}}{{- end -}} From 694b80d1f4210b556b93bedac8de688846e94804 Mon Sep 17 00:00:00 2001 From: Dominik Schmidle Date: Wed, 25 Nov 2026 23:20:33 +0100 Subject: [PATCH 16/56] test(helm): refuse safe-list entries that look like writes unless annotated A safe entry whose name starts with a write verb (create, delete, exec, set, approve, ...) fails verify-tool-approval unless a '# safe-write: : ' comment above safe: says why it reads. Also covers publicPort 65535, 65536 and 99999. --- helm/agent-platform/README.md | 2 +- helm/agent-platform/values.schema.json | 2 +- helm/agent-platform/values.yaml | 5 ++- tests/verify-tool-approval.py | 46 ++++++++++++++++++++++++++ 4 files changed, 52 insertions(+), 3 deletions(-) diff --git a/helm/agent-platform/README.md b/helm/agent-platform/README.md index 7bb94ac7..27482163 100644 --- a/helm/agent-platform/README.md +++ b/helm/agent-platform/README.md @@ -1620,7 +1620,7 @@ The map is merged into each component's own `nodeSelector` (`muster.nodeSelector | clusterManager.networkPolicy.egress.cidrs | list | `[]` | | | governance | string | `"trusted"` | The platform's governance mode: trusted (the default) or governed. It changes no tool approval setting's meaning; it adds asking for agent callers. Governed asks a person before an agent runs any tool of a governed server (governedServers below) that is not on that server's safe list (new and renamed tools too), and before any of muster's own tools but its reads; the Dev Portal's connector wizard pre-selects the Recommended preset (read-only tools run, the rest ask). Trusted lets agents run what the connectors' own settings allow and pre-selects Allow all. In both modes muster's built-in floors ask a person before an agent adds or repoints a connector, changes approval settings, grants access, adds a model, egress origin, credential or backend, approves an action or a toolchain source, or changes muster's own configuration; the role floors hold on the governed servers of that role, so governedServers names them in both modes. The meta chart renders muster's governance configuration from it (muster.governance: the mode and governedServers), from the muster release that reads it (agent-platform.muster.governanceFloor); below it `governed` fails the render and trusted renders nothing. From that release the meta chart also renders muster.approval.installation (backstage.installationName, the name the approval page shows), muster-approval-binder's subject (agent-manager's ServiceAccount, muster.rbac.approvalBinder.subjects) and the pages muster may return the browser to after an approval in muster.oauth.mcpClient.postLoginRedirectAllowlist (the portal's /sessions with backstage.publicPort, klausGateway.obo.callbackBaseUrl + /auth/slack/return; an own list's entries stay). Approval itself needs muster's OAuth server with Dex sign-in, Valkey storage (the default) and muster.muster.oauth.mcpClient.publicUrl on the OAuth server's origin with mcpClient.enabled for the allowlist; the chart does not fail without them, muster refuses asking calls with the reason. Only admins switch it, through the Platform Manager with a second person's approval; never an agent. Anything else fails the render. Concept: https://docs.giantswarm.io/overview/agent-platform/governing-tool-calls/ | | governanceExempt | object | `{"prometheus":"agent-platform-mcps' prometheus family (mcp-prometheus): every tool reads","capi":"agent-platform-mcps' capi family (mcp-kubernetes' CAPI tools): every tool reads"}` | MCPServer sources the platform ships that muster deliberately does not govern, each with its reason (make verify-tool-approval wants every shipped source in governedServers or here). Read by the meta chart's tests only. | -| governedServers | object | `{"agent-manager":{"role":"agentManager","safe":["get_info","list_agents","get_agent","get_agent_status","validate_agent","list_model_configs","list_egress_policies","list_skills","list_sessions","get_session","get_session_turn","toolchain_users","list_organizations","get_organization","list_organization_members","list_organization_connectors"]},"kagent":{"role":"sessionManager","safe":["list_sessions","list_session_checkpoints","list_sandbox_templates","list_sandboxes","get_sandbox","get_sandbox_process","read_sandbox_outputs","read_sandbox_file"]},"model-manager":{"role":"modelManager","safe":["get_info","get_backend","list_backends","list_models","get_model","list_loaded_models","list_presets","search_models","check_fit","list_nodes","list_jobs","get_job"]},"cluster-manager":{"role":"clusterManager","safe":["get_info","list_clusters","list_releases","list_node_pools"]},"vm-manager":{"role":"vmManager","safe":["get_info","get_host","list_images","get_image","list_networks","get_network","list_vms","get_vm","get_vm_metrics","get_vm_attestation"]},"toolchain-manager":{"role":"toolchainManager","safe":["list_sources","list_toolchains","describe_toolchain","toolchain_build_status","search_packages"]},"workspace-manager":{"role":"workspaceManager","safe":["list_providers","list_owners","list_workspaces","get_workspace","list_repositories","preview_workspace"]},"skill-manager":{"role":"skillManager","safe":["list_skill_sources","list_skills","resolve_skills","get_skill","get_skill_file"]},"mcp-kubernetes":{"role":"infrastructure","safe":["logs","list_port_forward_sessions","context_list","context_get_current","can_i","api_resources","cluster_health","capi_list_clusters","capi_get_cluster","capi_resolve_cluster","capi_cluster_health","get","list","describe"]},"giantswarm-platform-manager":{"role":"platformManager","safe":[]}}` | The servers muster governs (muster.governance.governedServers), per source the platform ships: `role` (which of muster's role floors hold on it: agentManager, platformManager, connectorManager, sessionManager, modelManager, clusterManager, vmManager, workspaceManager, toolchainManager, skillManager, infrastructure) and `safe`, the server's own tool names agents call unasked on governed (reads only; a floor never, muster refuses to start on one). Every other tool of a governed server asks agents on governed. A source renders one entry per MCPServer it ships while that renders (agent-platform.muster.governedKeys): a manager component's .muster.mcpServer.name in its namespace; kagent the connectivity chart's kagent server; mcp-kubernetes the connectivity chart's and every agent-platform-mcps kubernetes entry; any other key is a muster server key itself (giantswarm-platform-manager). null drops a source (then list it in governanceExempt with the reason). make verify-tool-approval fails on a shipped MCPServer that is neither here nor in governanceExempt, and on a safe entry that names a floor or no tool of its server. Safe lists: tool-approval governed-safe-list-proposal (giantswarm/giantswarm#38902). | +| governedServers | object | `{"agent-manager":{"role":"agentManager","safe":["get_info","list_agents","get_agent","get_agent_status","validate_agent","list_model_configs","list_egress_policies","list_skills","list_sessions","get_session","get_session_turn","toolchain_users","list_organizations","get_organization","list_organization_members","list_organization_connectors"]},"kagent":{"role":"sessionManager","safe":["list_sessions","list_session_checkpoints","list_sandbox_templates","list_sandboxes","get_sandbox","get_sandbox_process","read_sandbox_outputs","read_sandbox_file"]},"model-manager":{"role":"modelManager","safe":["get_info","get_backend","list_backends","list_models","get_model","list_loaded_models","list_presets","search_models","check_fit","list_nodes","list_jobs","get_job"]},"cluster-manager":{"role":"clusterManager","safe":["get_info","list_clusters","list_releases","list_node_pools"]},"vm-manager":{"role":"vmManager","safe":["get_info","get_host","list_images","get_image","list_networks","get_network","list_vms","get_vm","get_vm_metrics","get_vm_attestation"]},"toolchain-manager":{"role":"toolchainManager","safe":["list_sources","list_toolchains","describe_toolchain","toolchain_build_status","search_packages"]},"workspace-manager":{"role":"workspaceManager","safe":["list_providers","list_owners","list_workspaces","get_workspace","list_repositories","preview_workspace"]},"skill-manager":{"role":"skillManager","safe":["list_skill_sources","list_skills","resolve_skills","get_skill","get_skill_file"]},"mcp-kubernetes":{"role":"infrastructure","safe":["logs","list_port_forward_sessions","context_list","context_get_current","can_i","api_resources","cluster_health","capi_list_clusters","capi_get_cluster","capi_resolve_cluster","capi_cluster_health","get","list","describe"]},"giantswarm-platform-manager":{"role":"platformManager","safe":[]}}` | The servers muster governs (muster.governance.governedServers), per source the platform ships: `role` (which of muster's role floors hold on it: agentManager, platformManager, connectorManager, sessionManager, modelManager, clusterManager, vmManager, workspaceManager, toolchainManager, skillManager, infrastructure) and `safe`, the server's own tool names agents call unasked on governed (reads only; a floor never, muster refuses to start on one). Every other tool of a governed server asks agents on governed. A source renders one entry per MCPServer it ships while that renders (agent-platform.muster.governedKeys): a manager component's .muster.mcpServer.name in its namespace; kagent the connectivity chart's kagent server; mcp-kubernetes the connectivity chart's and every agent-platform-mcps kubernetes entry; any other key is a muster server key itself (giantswarm-platform-manager). null drops a source (then list it in governanceExempt with the reason). make verify-tool-approval fails on a shipped MCPServer that is neither here nor in governanceExempt, and on a safe entry that names a floor or no tool of its server, or whose name starts with a write verb (create, delete, exec, set, approve, ...) unless a `# safe-write: : ` comment above `safe:` says why it reads. Safe lists: tool-approval governed-safe-list-proposal (giantswarm/giantswarm#38902). | | tenants.platform.users | list | `[{"apiGroup":"rbac.authorization.k8s.io","kind":"Group","name":"system:authenticated"}]` | Every signed-in person: bound to agent-platform:platform-user in the kagent namespace, and, while musterMcpServerViewers is unset, to `list` (with get and watch) on muster's MCPServers in muster's namespace (the servers for everyone). RBAC subjects. The default, system:authenticated, gives this to every user. It also gives it to every ServiceAccount, so every pod in the cluster can read the platform tenant's Agents, RemoteMCPServer URLs and muster's MCPServer specs. To give it to people only, replace the default with an OIDC group that every user belongs to, written as the API server sees it (with the installation's OIDC groups prefix). | | tenants.platform.editors | list | `[{"apiGroup":"rbac.authorization.k8s.io","kind":"Group","name":"giantswarm-ad:giantswarm-admins"},{"apiGroup":"rbac.authorization.k8s.io","kind":"Group","name":"giantswarm-github:giantswarm:giantswarm-admins"}]` | The platform's operators: bound to agent-platform:editor in the kagent namespace. RBAC subjects. The Giant Swarm admin groups, as in muster.rbac.*.subjects. | | tenants.platform.kagentRelease.name | string | `""` | The name of kagent's HelmRelease in the kagent namespace. Empty, the default, admits none. | diff --git a/helm/agent-platform/values.schema.json b/helm/agent-platform/values.schema.json index 4bfe2ebd..6fe83947 100644 --- a/helm/agent-platform/values.schema.json +++ b/helm/agent-platform/values.schema.json @@ -2174,7 +2174,7 @@ }, "governedServers": { "type": "object", - "description": "The servers muster governs (muster.governance.governedServers), per source the platform ships: `role` (which of muster's role floors hold on it: agentManager, platformManager, connectorManager, sessionManager, modelManager, clusterManager, vmManager, workspaceManager, toolchainManager, skillManager, infrastructure) and `safe`, the server's own tool names agents call unasked on governed (reads only; a floor never, muster refuses to start on one). Every other tool of a governed server asks agents on governed. A source renders one entry per MCPServer it ships while that renders (agent-platform.muster.governedKeys): a manager component's .muster.mcpServer.name in its namespace; kagent the connectivity chart's kagent server; mcp-kubernetes the connectivity chart's and every agent-platform-mcps kubernetes entry; any other key is a muster server key itself (giantswarm-platform-manager). null drops a source (then list it in governanceExempt with the reason). make verify-tool-approval fails on a shipped MCPServer that is neither here nor in governanceExempt, and on a safe entry that names a floor or no tool of its server. Safe lists: tool-approval governed-safe-list-proposal (giantswarm/giantswarm#38902).", + "description": "The servers muster governs (muster.governance.governedServers), per source the platform ships: `role` (which of muster's role floors hold on it: agentManager, platformManager, connectorManager, sessionManager, modelManager, clusterManager, vmManager, workspaceManager, toolchainManager, skillManager, infrastructure) and `safe`, the server's own tool names agents call unasked on governed (reads only; a floor never, muster refuses to start on one). Every other tool of a governed server asks agents on governed. A source renders one entry per MCPServer it ships while that renders (agent-platform.muster.governedKeys): a manager component's .muster.mcpServer.name in its namespace; kagent the connectivity chart's kagent server; mcp-kubernetes the connectivity chart's and every agent-platform-mcps kubernetes entry; any other key is a muster server key itself (giantswarm-platform-manager). null drops a source (then list it in governanceExempt with the reason). make verify-tool-approval fails on a shipped MCPServer that is neither here nor in governanceExempt, and on a safe entry that names a floor or no tool of its server, or whose name starts with a write verb (create, delete, exec, set, approve, ...) unless a `# safe-write: : ` comment above `safe:` says why it reads. Safe lists: tool-approval governed-safe-list-proposal (giantswarm/giantswarm#38902).", "additionalProperties": true }, "governanceExempt": { diff --git a/helm/agent-platform/values.yaml b/helm/agent-platform/values.yaml index 19c51143..82fba0a5 100644 --- a/helm/agent-platform/values.yaml +++ b/helm/agent-platform/values.yaml @@ -5852,7 +5852,10 @@ governance: trusted # @schema enum: [trusted, governed] # server key itself (giantswarm-platform-manager). null drops a source (then # list it in governanceExempt with the reason). make verify-tool-approval # fails on a shipped MCPServer that is neither here nor in governanceExempt, -# and on a safe entry that names a floor or no tool of its server. Safe +# and on a safe entry that names a floor or no tool of its server, or whose +# name starts with a write verb (create, delete, exec, set, approve, ...) +# unless a `# safe-write: : ` comment above `safe:` says why +# it reads. Safe # lists: tool-approval governed-safe-list-proposal (giantswarm/giantswarm#38902). governedServers: # @schema additionalProperties: true agent-manager: diff --git a/tests/verify-tool-approval.py b/tests/verify-tool-approval.py index 72a3169d..42d54c26 100755 --- a/tests/verify-tool-approval.py +++ b/tests/verify-tool-approval.py @@ -314,6 +314,44 @@ def tools_map(text: str, header: re.Pattern[str]) -> dict[str, str]: return out +# A safe entry whose name starts with one of these verbs looks like a write: +# refused unless the source's block says why it is a read with a comment +# `# safe-write: : `. +WRITE_VERBS = { + "create", "update", "delete", "patch", "apply", "scale", "exec", "set", "add", "remove", "approve", + "grant", "revoke", "write", "start", "stop", "kill", "invoke", "fork", "merge", "deprecate", + "authorize", "sync", "wire", "unwire", "load", "unload", "pull", "push", "cancel", "replace", + "suspend", "resume", "reboot", "run", "send", "mint", "init", "enable", "disable", "port", + "forward", "rename", "move", "restart", "upgrade", "install", "uninstall", "edit", "import", +} + + +def write_like_safe(vtext: str) -> dict[str, str]: + """source -> why, for safe entries that look like writes and carry no safe-write annotation.""" + out = {} + for m in re.finditer(r"\n ([a-z0-9-]+):\n role: \S+\n((?: #.*\n)*) safe: \[(.*)\]\n", "\n" + "\n".join(values_block(vtext, "governedServers")) + "\n"): + src, comments, listed = m.group(1), m.group(2), m.group(3) + annotated = set(re.findall(r"# safe-write: ([A-Za-z0-9_]+): \S", comments)) + for tool in (t.strip() for t in listed.split(",") if t.strip()): + tokens = tool.lower().split("_") + if (tokens[0] in WRITE_VERBS or tool.lower() in WRITE_VERBS) and tool not in annotated: + out[src] = f"{tool} looks like a write ({tokens[0]}): take it off the safe list, or say why it is a read in a `# safe-write: {tool}: ` comment above `safe:`" + return out + + +def check_write_like() -> None: + base = "governedServers:\n mcp-kubernetes:\n role: infrastructure\n{c} safe: [get, {t}, list]\nnext: x\n" + for tool in ("delete", "authorize_workspace", "create_vm", "exec"): + if not write_like_safe(base.format(c="", t=tool)): + fail(f"{tool} on a safe list must be refused as write-like") + if write_like_safe(base.format(c=f" # safe-write: delete: dry run only here\n", t="delete")): + fail("an annotated write-like entry must pass") + for tool in ("list_port_forward_sessions", "get_vm_console", "read_sandbox_file", "toolchain_users", "can_i"): + if write_like_safe(base.format(c="", t=tool)): + fail(f"{tool} is a read and must pass") + print("ok: safe entries that look like writes (delete, authorize_workspace, create_vm, exec) are refused unless annotated with safe-write; reads pass") + + def check_coverage() -> None: governed, exempt = sources(META_DIR) covered = {k for k, role in governed.items() if role} | set(exempt) @@ -378,6 +416,8 @@ def check_coverage() -> None: else: maps[repo] = tools_map(text, re.compile(r"^ mcpServer:\s*$")) vtext = open(os.path.join(META_DIR, "values.yaml")).read() + for src, why in write_like_safe(vtext).items(): + fail(f"governedServers.{src}.safe: {why}") for src, role in governed.items(): if not role or src not in maps: continue @@ -441,10 +481,15 @@ def release(args: list[str]) -> str: if [l.strip() for l in ported.split("\n")[1:]] != ["- https://backstage.ci.example.com:8443/sessions", "- https://gw.ci.example.com:8443/auth/slack/return"]: fail(f"a non-default port must stay in both entries (M1-1):\n{ported}") default_port = block(release(mc + portal + ["--set", "backstage.publicPort=443"]), list_header) + top = block(release(mc + portal + ["--set", "backstage.publicPort=65535"]), list_header) + if "- https://backstage.ci.example.com:65535/sessions" not in top: + fail(f"port 65535 is a port:\n{top}") if "- https://backstage.ci.example.com/sessions" not in default_port: fail(f"port 443 writes no port:\n{default_port}") for args, want in ( (["--set", "backstage.publicPort=84a3"], 'backstage.publicPort "84a3"'), + (["--set", "backstage.publicPort=65536"], 'backstage.publicPort "65536"'), + (["--set", "backstage.publicPort=99999"], 'backstage.publicPort "99999"'), (["--set", "components.klaus-gateway.enabled=true", "--set", "klausGateway.obo.callbackBaseUrl=gw.ci.example.com"], 'klausGateway.obo.callbackBaseUrl "gw.ci.example.com": want an http(s) URL'), ): err = render(META_DIR, META + ["--set", FLOOR_RANGE, "--set", "global.domain=ci.example.com", *mc, *portal, *args], expect_fail=True) @@ -566,6 +611,7 @@ def check_approval() -> None: META_DIR, CONN_DIR = sys.argv[1], sys.argv[2] FLOOR_RANGE = f"components.muster.versionRange=>={governance_floor(META_DIR)} <6.0.0-0" check_governance() + check_write_like() check_coverage() check_approval_config() check_connector_admin() From 3b68924956568bfd602432fef95941fa402742a8 Mon Sep 17 00:00:00 2001 From: Dominik Schmidle Date: Thu, 26 Nov 2026 01:01:01 +0100 Subject: [PATCH 17/56] docs(skills): describe agent-manager's split update tools and set_agent_approval --- skills/agent-platform-agent-management/SKILL.md | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/skills/agent-platform-agent-management/SKILL.md b/skills/agent-platform-agent-management/SKILL.md index 97baa9c5..06380989 100644 --- a/skills/agent-platform-agent-management/SKILL.md +++ b/skills/agent-platform-agent-management/SKILL.md @@ -94,7 +94,10 @@ never assume an argument. The agent tools drop an unknown key without an error: status about every 30 s for up to about five minutes; still `progressing`, tell the person its summary and call it again at the start of your next turn. 3. `x_agent-manager_update_agent` for follow-ups: only the fields passed change; `skills`, `plugins`, - `egress` and `toolset` replace their whole list. `refreshSkills: true` re-pins every git skill and + `egress` and `toolset` replace their whole list. Where `x_agent-manager_update_agent_access` + exists, `update_agent` takes only name, description, prompt, model, tags, icon, labels and + annotations; the tool list, skills, plugins, egress, connectors, Harness and toolchains go to + `update_agent_access`, and settings to `set_agent_approval`. `refreshSkills: true` re-pins every git skill and plugin to the head of its ref, as you: it fails when you cannot read one of the agent's repositories. @@ -139,7 +142,11 @@ never assume an argument. The agent tools drop an unknown key without an error: (the strictest wins); `Allow` over a connector's `Ask` is an **exception** only a connector admin of that connector grants, through `set_agent_approval`, which asks the person whenever an agent calls it, and a save drops the exceptions the saver is not connector admin for (say so before - saving). Until then `update_agent` still takes `toolset`, skills, plugins and egress. A governed + saving). `set_agent_approval` takes `settings` (`{"": "Allow"|"Ask"|"Block"|""}` for + entries already in `tools`) and `default`; `create_agent` and `update_agent_access` refuse an + `Allow` over a connector's `Ask` and any `default: Allow`. `get_agent` and `list_agents` return + `tools`, `defaultApproval` and `grants` (with `grantedBy`); `filter_tools` with `agentTools` + shows how a list resolves before you save it. Until then `update_agent` still takes `toolset`, skills, plugins and egress. A governed platform's asks cannot be lifted per agent. `muster.requireApproval: true` keeps asking before every call until agent chart 3.0 moves it to `default: Ask`; never set it together with tool settings. From 0d059eed3862205e38123af02c5bac7fb864b2a9 Mon Sep 17 00:00:00 2001 From: Dominik Schmidle Date: Thu, 26 Nov 2026 01:36:09 +0100 Subject: [PATCH 18/56] feat(helm): turn on agent-manager's tool approval from the floors that bind it agent-manager's muster.toolApproval.enabled follows muster: on from the agent-manager floor whose chart takes the key and muster's agent approval floor (both placeholders until released), off below muster's, an own value standing. The agent-management skill names toolSettings, list_approval_grants and update_agent_access for connectors, and drops a leftover sentence. --- Makefile.custom.mk | 2 +- helm/agent-platform/templates/_helpers.tpl | 22 +++++++++++++++++++ .../agent-platform-agent-management/SKILL.md | 15 ++++++++----- tests/verify-tool-approval.py | 22 +++++++++++++++++++ 4 files changed, 55 insertions(+), 6 deletions(-) diff --git a/Makefile.custom.mk b/Makefile.custom.mk index ac24fd0d..3573f3c1 100644 --- a/Makefile.custom.mk +++ b/Makefile.custom.mk @@ -1479,7 +1479,7 @@ verify-mcp-kubernetes-registration: ## Assert the bundled mcp-kubernetes registr @echo "mcp-kubernetes registration shapes verified." .PHONY: verify-tool-approval -verify-tool-approval: ## Assert the platform side of Governing tool calls (giantswarm/giantswarm#38902): the top-level governance and governedServers values render muster's governance configuration into the muster release (muster.governance: mode, governedServers {server, role, safe} per shipped MCPServer, keyed namespace/name outside muster's namespace, an own entry standing) from the muster floor agent-platform.muster.governanceFloor, none below it, governed below it, the earlier servers shape, unknown keys and conflicting or unknown modes failing; coverage: every shipped MCPServer source (meta releases carrying muster.mcpServer, the connectivity chart's MCPServers, agent-platform-mcps' families, and the component charts beside this checkout, COMPONENT_CHECKOUTS) is governed or in governanceExempt, no floor is safe, every safe entry names a tool of its server, the two kubernetes maps agree; the redirect allowlist (portal /sessions with backstage.publicPort, klaus-gateway's return with its port, invalid ports and URLs failing); the connector-admin role binds the Giant Swarm admin groups plus tenants.platformTeam; muster-approval-binder's subjects are agent-manager's ServiceAccount only (muster.rbac.approvalBinder.subjects), none from the connectivity chart; the connectivity MCPServers carry explicit approval settings (a Block rule renders, overrides reach spec.approval also from the meta chart, null renders none, invalid values fail naming the key). Stdlib only. HELM selects the binary. +verify-tool-approval: ## Assert the platform side of Governing tool calls (giantswarm/giantswarm#38902): the top-level governance and governedServers values render muster's governance configuration into the muster release (muster.governance: mode, governedServers {server, role, safe} per shipped MCPServer, keyed namespace/name outside muster's namespace, an own entry standing) from the muster floor agent-platform.muster.governanceFloor, none below it, governed below it, the earlier servers shape, unknown keys and conflicting or unknown modes failing; coverage: every shipped MCPServer source (meta releases carrying muster.mcpServer, the connectivity chart's MCPServers, agent-platform-mcps' families, and the component charts beside this checkout, COMPONENT_CHECKOUTS) is governed or in governanceExempt, no floor is safe, every safe entry names a tool of its server, the two kubernetes maps agree; the redirect allowlist (portal /sessions with backstage.publicPort, klaus-gateway's return with its port, invalid ports and URLs failing); the connector-admin role binds the Giant Swarm admin groups plus tenants.platformTeam; muster-approval-binder's subjects are agent-manager's ServiceAccount only (muster.rbac.approvalBinder.subjects), none from the connectivity chart; agent-manager's muster.toolApproval.enabled on from its floor and muster's agent approval floor, off below muster's, absent below its own, an own value standing; the connectivity MCPServers carry explicit approval settings (a Block rule renders, overrides reach spec.approval also from the meta chart, null renders none, invalid values fail naming the key). Stdlib only. HELM selects the binary. @echo "====> $@ ($(CHART_DIR), $(CONNECTIVITY_DIR))" @HELM="$(HELM)" python3 tests/verify-tool-approval.py $(CHART_DIR) $(CONNECTIVITY_DIR) @echo "tool approval verified." diff --git a/helm/agent-platform/templates/_helpers.tpl b/helm/agent-platform/templates/_helpers.tpl index 1d4bc08c..a435348c 100644 --- a/helm/agent-platform/templates/_helpers.tpl +++ b/helm/agent-platform/templates/_helpers.tpl @@ -526,6 +526,19 @@ takes the key (agent-platform.agentManager.toolchainsFloor). */ -}} {{- $_ := set $musterValues "toolchainsToolsPrefix" $prefix -}} {{- end -}} {{- end -}} +{{- /* Tool approval per agent (giantswarm/giantswarm#38902, slice 3): +agent-manager binds an agent's approval settings with every Session and +refuses settings while it does not. On while muster takes them, from the +floors agent-platform.muster.agentApprovalFloor and +agent-platform.agentManager.toolApprovalFloor (below the agent-manager floor +its chart has no such key); an own value stands. */ -}} +{{- if include "agent-platform.componentFloorAtLeast" (dict "root" .root "name" "agent-manager" "version" (include "agent-platform.agentManager.toolApprovalFloor" .root)) -}} +{{- $ownTa := dig "muster" "toolApproval" "enabled" nil (index .root.Values "agent-manager" | default dict) -}} +{{- if kindIs "invalid" $ownTa -}} +{{- $musterTakes := and (include "agent-platform.componentEnabled" (dict "root" .root "name" "muster")) (include "agent-platform.componentFloorAtLeast" (dict "root" .root "name" "muster" "version" (include "agent-platform.muster.agentApprovalFloor" .root))) -}} +{{- $_ := set $musterValues "toolApproval" (dict "enabled" (ternary true false (not (empty $musterTakes)))) -}} +{{- end -}} +{{- end -}} {{- $_ := set $derived "muster" $musterValues -}} {{- /* The installation's toolchains, while the toolchain-manager is on: toolchains.repository the first source's registry (an own value stands), and @@ -2102,6 +2115,15 @@ earlier muster refuses such a binding, so a Session would not start. One line each, no comment inside the define. */}} {{- define "agent-platform.agentManager.toolsetBindingFloor" -}}2.9.0{{- end -}} + +{{/* +The floors of tool approval per agent (slice 3): the first agent-manager +whose chart takes muster.toolApproval, and the first muster that takes an +agent's approval settings with a Session binding. Placeholders until those +releases exist. One line each, no comment inside the define. +*/}} +{{- define "agent-platform.agentManager.toolApprovalFloor" -}}3.6.0{{- end -}} +{{- define "agent-platform.muster.agentApprovalFloor" -}}5.66.0{{- end -}} {{- define "agent-platform.muster.toolsetBindingFloor" -}}5.49.0{{- end -}} {{/* diff --git a/skills/agent-platform-agent-management/SKILL.md b/skills/agent-platform-agent-management/SKILL.md index 06380989..e5c1b247 100644 --- a/skills/agent-platform-agent-management/SKILL.md +++ b/skills/agent-platform-agent-management/SKILL.md @@ -145,9 +145,13 @@ never assume an argument. The agent tools drop an unknown key without an error: saving). `set_agent_approval` takes `settings` (`{"": "Allow"|"Ask"|"Block"|""}` for entries already in `tools`) and `default`; `create_agent` and `update_agent_access` refuse an `Allow` over a connector's `Ask` and any `default: Allow`. `get_agent` and `list_agents` return - `tools`, `defaultApproval` and `grants` (with `grantedBy`); `filter_tools` with `agentTools` - shows how a list resolves before you save it. Until then `update_agent` still takes `toolset`, skills, plugins and egress. A governed - platform's asks cannot be lifted per agent. `muster.requireApproval: true` keeps asking before + the list as `toolSettings` (their `tools` stays the kagent MCP bindings), with `defaultApproval`, + `grants` (with `grantedBy`) and `approvalSettings` (false: this installation does not bind + settings and refuses them); `x_agent-manager_list_approval_grants` lists a namespace's grants, per + connector with `server`; `filter_tools` with `agentTools` shows how a list resolves before you + save it. A save's `sessionsUpdated: false` and `warnings` mean running sessions still carry a + dropped exception until agent-manager tells muster again: say so. A governed platform's asks + cannot be lifted per agent. `muster.requireApproval: true` keeps asking before every call until agent chart 3.0 moves it to `default: Ask`; never set it together with tool settings. - **An organization's connectors**: a kagent `RemoteMCPServer` in the organization namespace @@ -155,7 +159,8 @@ never assume an argument. The agent tools drop an unknown key without an error: reaches it. From agent-manager 3.3.0 (`connectors` in `x_agent-manager_create_agent`'s schema; without it the agent takes none), pass the names of the connectors that `x_agent-manager_list_organization_connectors` gives as `connectors` to `create_agent`, - `validate_agent` or `update_agent`: each name alone, once. On update the list replaces the + `validate_agent` or `update_agent_access` (`update_agent` before agent-manager split its update + tools): each name alone, once. On update the list replaces the agent's connectors, `[]` removes them, and an absent argument keeps them; `get_agent` and `list_agents` return them. The agent calls the connector itself with the connector's credential; its host needs no `EgressPolicy`. Choose only a usable one (`agent-platform-tools`). Refused: a @@ -163,7 +168,7 @@ never assume an argument. The agent tools drop an unknown key without an error: workload cluster, and an agent's binding to Muster: the `RemoteMCPServer` that one HelmRelease renders with an agent of its name, which the list marks `musterBindingOf` from agent-manager 3.3.4 (how to tell it without the field: `agent-platform-tools`). From agent-manager 3.3.4, - `update_agent` and `validate_agent` refuse `connectors`, `[]` too, on an agent whose HelmRelease + the update tool and `validate_agent` refuse `connectors`, `[]` too, on an agent whose HelmRelease has `spec.valuesFrom` (the message names it): tell the person that this agent's connectors are set where its `valuesFrom` values are managed, not through the tool. - **Toolchains and workspace**: `defaultToolchains` and `defaultWorkspace`, the smallest set the job diff --git a/tests/verify-tool-approval.py b/tests/verify-tool-approval.py index 42d54c26..2bba870d 100755 --- a/tests/verify-tool-approval.py +++ b/tests/verify-tool-approval.py @@ -556,6 +556,27 @@ def binder(args: list[str]) -> str: print("ok: muster-approval-binder is bound by the muster chart to agent-manager's ServiceAccount only (name and namespace following agent-manager), an own list stands, an unnamed external ServiceAccount fails, none with agent-manager off or below the floor, none in the connectivity chart") +def check_agent_manager_tool_approval() -> None: + def release(args: list[str]) -> str: + hr = doc(render_meta(["--set", "components.agent-manager.enabled=true", *args]), "HelmRelease", "agent-manager") + if hr is None: + fail(f"no agent-manager HelmRelease with {args}") + return block(hr, " toolApproval:") + + am = "components.agent-manager.versionRange=>=3.6.0 <4.0.0-0" + if release(["--set", am]).split() != ["toolApproval:", "enabled:", "false"]: + fail(f"below muster's agent approval floor agent-manager must bind no settings (toolApproval.enabled false):\n{release(['--set', am])}") + on = release(["--set", am, "--set", "components.muster.versionRange=>=5.66.0 <6.0.0-0"]) + if on.split() != ["toolApproval:", "enabled:", "true"]: + fail(f"from both floors agent-manager must bind approval settings:\n{on}") + if release([]): + fail("below agent-manager's tool approval floor its chart takes no muster.toolApproval") + own = release(["--set", am, "--set", "components.muster.versionRange=>=5.66.0 <6.0.0-0", "--set", "agent-manager.muster.toolApproval.enabled=false"]) + if "true" in own: + fail(f"an own agent-manager.muster.toolApproval.enabled must stand:\n{own}") + print("ok: agent-manager's muster.toolApproval.enabled is on from its floor and muster's, off below muster's, absent below its own, an own value stands") + + def approval_of(out: str, name: str) -> str: cr = doc(out, "MCPServer", name) if cr is None: @@ -616,4 +637,5 @@ def check_approval() -> None: check_approval_config() check_connector_admin() check_binder() + check_agent_manager_tool_approval() check_approval() From 390e795e789555497985d5cb8605f4ed74082e78 Mon Sep 17 00:00:00 2001 From: Dominik Schmidle Date: Thu, 26 Nov 2026 09:28:52 +0100 Subject: [PATCH 19/56] feat(helm): call muster's session bindings API on its own port, admitting agent-manager alone From muster's session bindings floor, the meta chart moves muster's session bindings API off the aggregator port (sessionBindings.onMainPort false), lets muster's network policy admit agent-manager's pods alone to its port, points agent-manager's muster.bindingsUrl at it and opens agent-manager's egress to it in both policy flavors. Own values stand. verify-tool-approval covers the derivation. --- helm/agent-platform-connectivity/README.md | 1 + .../templates/agent-manager/netpol.yaml | 23 ++++++++++ .../values.schema.json | 3 ++ helm/agent-platform-connectivity/values.yaml | 6 +++ helm/agent-platform/templates/_helpers.tpl | 45 +++++++++++++++++++ tests/verify-tool-approval.py | 39 ++++++++++++++++ 6 files changed, 117 insertions(+) diff --git a/helm/agent-platform-connectivity/README.md b/helm/agent-platform-connectivity/README.md index d0731cb6..efbf17e0 100644 --- a/helm/agent-platform-connectivity/README.md +++ b/helm/agent-platform-connectivity/README.md @@ -1279,6 +1279,7 @@ The kagent block is open in the schema, so the template refuses a key under `kag | networkPolicy.substrate.egressGateway.privateCIDRs | list | `[]` | | | networkPolicy.musterInClusterMcpPorts[0] | int | `8080` | | | networkPolicy.musterInClusterMcpPorts[1] | int | `8443` | | +| networkPolicy.musterSessionBindingsPort | int | `0` | | | networkPolicy.mcpBackends | object | `{}` | | | networkPolicy.mcpBackendScrapers[0].namespace | string | `"kube-system"` | | | networkPolicy.mcpBackendScrapers[0].matchLabels."app.kubernetes.io/instance" | string | `"alloy-metrics"` | | diff --git a/helm/agent-platform-connectivity/templates/agent-manager/netpol.yaml b/helm/agent-platform-connectivity/templates/agent-manager/netpol.yaml index f6a406dc..0adab985 100644 --- a/helm/agent-platform-connectivity/templates/agent-manager/netpol.yaml +++ b/helm/agent-platform-connectivity/templates/agent-manager/netpol.yaml @@ -182,6 +182,18 @@ spec: - port: {{ $musterPort | quote }} protocol: TCP {{- end }} + {{- with .Values.networkPolicy.musterSessionBindingsPort }} + # muster's session bindings API on its own port (start_session's binds, + # grant drops), which muster admits from agent-manager alone. + - toEndpoints: + - matchLabels: + app.kubernetes.io/name: muster + io.kubernetes.pod.namespace: {{ $.Release.Namespace }} + toPorts: + - ports: + - port: {{ . | quote }} + protocol: TCP + {{- end }} {{- if $oauthOn }} {{- include "agent-platform.idpEgress.cilium" (dict "ctx" $ "provider" (include "agent-platform.agentManager.oauthProvider" .) "issuerUrl" (include "agent-platform.agentManager.issuerUrl" .)) | trim | nindent 4 }} {{- end }} @@ -402,6 +414,17 @@ spec: - port: {{ $musterPort | int }} protocol: TCP {{- end }} + {{- with .Values.networkPolicy.musterSessionBindingsPort }} + # muster's session bindings API on its own port (start_session's binds, + # grant drops), which muster admits from agent-manager alone. + - to: + - podSelector: + matchLabels: + app.kubernetes.io/name: muster + ports: + - port: {{ . | int }} + protocol: TCP + {{- end }} {{- include "agent-platform.agentManager.chartSourcesEgress.kubernetes" . | nindent 4 }} {{- with $broker }} # Native NetworkPolicy cannot select a DNS origin. Private DNS origins diff --git a/helm/agent-platform-connectivity/values.schema.json b/helm/agent-platform-connectivity/values.schema.json index c688751f..174458c4 100644 --- a/helm/agent-platform-connectivity/values.schema.json +++ b/helm/agent-platform-connectivity/values.schema.json @@ -1711,6 +1711,9 @@ "type": "integer" } }, + "musterSessionBindingsPort": { + "type": "integer" + }, "substrate": { "type": "object", "additionalProperties": false, diff --git a/helm/agent-platform-connectivity/values.yaml b/helm/agent-platform-connectivity/values.yaml index a36077d3..a4760ccc 100644 --- a/helm/agent-platform-connectivity/values.yaml +++ b/helm/agent-platform-connectivity/values.yaml @@ -810,6 +810,12 @@ networkPolicy: musterInClusterMcpPorts: - 8080 - 8443 + # Port of muster's session bindings API, which agent-manager calls on its + # own port (start_session's binds, grant drops) and muster admits from + # agent-manager alone; set by the meta chart from muster's floor. 0 (the + # default) opens no egress for it: agent-manager then binds on muster's + # aggregator port. + musterSessionBindingsPort: 0 # In-cluster MCP backends an installation registers with muster (its own # MCPServer entries, e.g. through agent-platform-mcps). A ClusterIP Service # without a policy admits every pod on the cluster, and a direct call skips diff --git a/helm/agent-platform/templates/_helpers.tpl b/helm/agent-platform/templates/_helpers.tpl index a435348c..94f45869 100644 --- a/helm/agent-platform/templates/_helpers.tpl +++ b/helm/agent-platform/templates/_helpers.tpl @@ -499,6 +499,13 @@ schema refuses the key. An installation's own rbac.namespaces stays. */ -}} {{- fail (printf "agent-manager.muster.url (%s) differs from the platform's muster MCP URL (%s): agent-manager composes every agent's RemoteMCPServer against the muster this chart installs — the URL follows muster.fullnameOverride and muster.service.port; leave agent-manager.muster.url unset" $ownUrl $url) -}} {{- end -}} {{- $musterValues := dict "url" $url -}} +{{- /* agent-manager calls muster's session bindings API on its own port +(agent-platform.muster.sessionBindings); an own bindingsUrl stands. */ -}} +{{- with (include "agent-platform.muster.sessionBindings" .root | fromJson).url -}} +{{- if not (dig "muster" "bindingsUrl" "" (index $.root.Values "agent-manager" | default dict)) -}} +{{- $_ := set $musterValues "bindingsUrl" . -}} +{{- end -}} +{{- end -}} {{- /* muster trusts a bound Session's actor JWT: every Session start_session binds carries the agent's toolset, and agent-manager reports it as bound to each session at its start (agent-manager 2.9.0, giantswarm/agent-manager#228). */ -}} @@ -627,6 +634,13 @@ renders (networkPolicy.mcpBackends). */ -}} {{- with $mcpBackends -}} {{- $_ := set $derived "networkPolicy" (dict "mcpBackends" .) -}} {{- end -}} +{{- /* agent-manager's egress to muster's session bindings port +(agent-platform.muster.sessionBindings). */ -}} +{{- with (include "agent-platform.muster.sessionBindings" .root | fromJson).sessionBindings -}} +{{- $np := get $derived "networkPolicy" | default dict -}} +{{- $_ := set $np "musterSessionBindingsPort" (int (dig "port" 8091 .)) -}} +{{- $_ := set $derived "networkPolicy" $np -}} +{{- end -}} {{- /* agent-manager's migrate run pins through the skill-manager too: its URL, its namespace and the service token's Secret, which the connectivity release generates (agent-platform.skillManager.serviceToken). */ -}} @@ -1035,6 +1049,9 @@ workspaces on and no releasable instance agent-platform.validateWorkspaceAuth has failed the render. */ -}} {{- $provider := include "agent-platform.muster.credentialProvider" .root | fromJson -}} {{- if or $provider.releasable (dig "actorBearer" "enabled" false $provider) -}} +{{- with (include "agent-platform.muster.sessionBindings" .root | fromJson).sessionBindings -}} +{{- $_ := set $provider "sessionBindings" . -}} +{{- end -}} {{- $muster := get $derived "muster" | default dict -}} {{- $_ := set $muster "credentialProvider" $provider -}} {{- $_ := set $derived "muster" $muster -}} @@ -2124,6 +2141,34 @@ releases exist. One line each, no comment inside the define. */}} {{- define "agent-platform.agentManager.toolApprovalFloor" -}}3.6.0{{- end -}} {{- define "agent-platform.muster.agentApprovalFloor" -}}5.66.0{{- end -}} +{{- /* The first muster serving the session bindings API on its own port +(muster.credentialProvider.sessionBindings, decision #88). */ -}} +{{- define "agent-platform.muster.sessionBindingsPortFloor" -}}5.66.0{{- end -}} + +{{/* +The session bindings API muster serves agent-manager alone (decision #88): +from agent-platform.muster.sessionBindingsPortFloor, while muster runs its +credential provider, on its own port and no longer on the aggregator port, +its network policy admitting agent-manager's pods only. Emits JSON: +{sessionBindings, url} -- muster's credentialProvider.sessionBindings and +agent-manager's muster.bindingsUrl -- or {} below the floor or without the +provider. An own muster.muster.credentialProvider.sessionBindings key stands. +Usage: include "agent-platform.muster.sessionBindings" . | fromJson +*/}} +{{- define "agent-platform.muster.sessionBindings" -}} +{{- $out := dict -}} +{{- $provider := include "agent-platform.muster.credentialProvider" . | fromJson -}} +{{- if and $provider.enabled (include "agent-platform.componentFloorAtLeast" (dict "root" . "name" "muster" "version" (include "agent-platform.muster.sessionBindingsPortFloor" .))) -}} +{{- $own := dig "muster" "credentialProvider" "sessionBindings" dict (.Values.muster | default dict) | default dict -}} +{{- $amNs := dig "agent-manager" "targetNamespace" "" .Values.components | default (include "agent-platform.targetNamespace" .) -}} +{{- $amName := dig "nameOverride" "agent-manager" (index .Values "agent-manager" | default dict) -}} +{{- $sb := dict "onMainPort" false "allowedFrom" (list (dict "namespace" $amNs "podLabels" (dict "app.kubernetes.io/name" $amName))) -}} +{{- range $k, $v := $own -}}{{- $_ := set $sb $k $v -}}{{- end -}} +{{- $port := dig "port" 8091 $sb -}} +{{- $out = dict "sessionBindings" $sb "url" (printf "http://%s.%s.svc.cluster.local:%v/session-bindings" (include "agent-platform.musterFullname" .) (include "agent-platform.muster.namespace" .) $port) -}} +{{- end -}} +{{- $out | toJson -}} +{{- end -}} {{- define "agent-platform.muster.toolsetBindingFloor" -}}5.49.0{{- end -}} {{/* diff --git a/tests/verify-tool-approval.py b/tests/verify-tool-approval.py index 2bba870d..d78abb57 100755 --- a/tests/verify-tool-approval.py +++ b/tests/verify-tool-approval.py @@ -577,6 +577,44 @@ def release(args: list[str]) -> str: print("ok: agent-manager's muster.toolApproval.enabled is on from its floor and muster's, off below muster's, absent below its own, an own value stands") +def check_session_bindings() -> None: + base = [ + "--set", "global.identity.issuerUrl=https://dex.ci.example.com", + "--set", "components.kagent.enabled=true", + "--set", "components.agent-manager.enabled=true", + "--set", "kagent.harness.snapshotLocation=s3://ci-agent-snapshots/agents", + "--set", "kagent.database.postgres.urlFile=/etc/kagent-db/uri", + "--set", "muster.muster.oauth.server.baseUrl=https://muster.ci.example.com", + ] + floor = ["--set", "components.muster.versionRange=>=5.66.0 <6.0.0-0"] + + def releases(args: list[str]) -> tuple[str, str]: + out = render_meta([*base, *args]) + muster, am = doc(out, "HelmRelease", "muster"), doc(out, "HelmRelease", "agent-manager") + if muster is None or am is None: + fail(f"no muster or agent-manager HelmRelease with {args}") + return block(muster, " sessionBindings:"), am + + conn = doc(render_meta([*base, *floor]), "HelmRelease", "agent-platform-connectivity") or "" + if "musterSessionBindingsPort: 8091" not in conn: + fail("from the floor the connectivity release must open agent-manager's egress to the session bindings port (networkPolicy.musterSessionBindingsPort)") + sb, am = releases(floor) + if "onMainPort: false" not in sb or "namespace:" not in sb or "app.kubernetes.io/name: agent-manager" not in sb: + fail(f"from muster's session bindings floor muster must serve the API on its own port, off the aggregator port, admitting agent-manager's pods alone:\n{sb}") + if not re.search(r"bindingsUrl: http://muster\.[^.]+\.svc\.cluster\.local:8091/session-bindings", am): + fail(f"from the floor agent-manager must call the session bindings port:\n{am}") + sb, am = releases([]) + if sb or "bindingsUrl:" in am: + fail(f"below the floor neither the port nor the URL are derived:\n{sb}") + sb, _ = releases([*floor, "--set", "muster.muster.credentialProvider.sessionBindings.onMainPort=true"]) + if "onMainPort: true" not in sb: + fail(f"an own sessionBindings.onMainPort must stand:\n{sb}") + _, am = releases([*floor, "--set", "agent-manager.muster.bindingsUrl=https://bindings.example.com/session-bindings"]) + if "bindingsUrl: https://bindings.example.com/session-bindings" not in am or ":8091/session-bindings" in am: + fail(f"an own agent-manager.muster.bindingsUrl must stand:\n{am}") + print("ok: from muster's session bindings floor muster serves the session bindings API on its own port, off the aggregator port, its network policy admitting agent-manager's pods alone, and agent-manager's bindingsUrl names that port; none below the floor; own values stand") + + def approval_of(out: str, name: str) -> str: cr = doc(out, "MCPServer", name) if cr is None: @@ -638,4 +676,5 @@ def check_approval() -> None: check_connector_admin() check_binder() check_agent_manager_tool_approval() + check_session_bindings() check_approval() From 51edf53e63afefd106279f7070facaf342bbebcd Mon Sep 17 00:00:00 2001 From: Dominik Schmidle Date: Thu, 26 Nov 2026 09:46:12 +0100 Subject: [PATCH 20/56] feat(helm): move the agent chart line to 3.x only with agent-manager's migrate hop and muster's approval floor Agent chart 3.0 removes muster.requireApproval. agent-manager.agentChart.semver reaches agent-manager, its migrate run and the agent-platform-operator, which moves every organization's chart source at once, so a 3.x line now renders only with agent-manager at the release whose migrate rewrites requireApproval to default: Ask, muster at the release that enforces it, agent-manager's tool approval on and the default agent on the same major; a range spanning 2.x and 3.x fails. make verify-agent-chart-line asserts it. --- Makefile.custom.mk | 5 + .../templates/kagent/migrate-cronjob.yaml | 9 +- helm/agent-platform/README.md | 47 +++---- helm/agent-platform/templates/_helpers.tpl | 72 +++++++++++ helm/agent-platform/templates/components.yaml | 1 + helm/agent-platform/values.yaml | 15 ++- tests/verify-agent-chart-line.py | 118 ++++++++++++++++++ 7 files changed, 241 insertions(+), 26 deletions(-) create mode 100755 tests/verify-agent-chart-line.py diff --git a/Makefile.custom.mk b/Makefile.custom.mk index 3573f3c1..a953ecba 100644 --- a/Makefile.custom.mk +++ b/Makefile.custom.mk @@ -1478,6 +1478,11 @@ verify-mcp-kubernetes-registration: ## Assert the bundled mcp-kubernetes registr @python3 tests/verify-mcp-kubernetes-registration.py $(CHART_DIR) $(CONNECTIVITY_DIR) @echo "mcp-kubernetes registration shapes verified." +.PHONY: verify-agent-chart-line +verify-agent-chart-line: ## Assert that agent-manager.agentChart.semver moves to agent chart 3.x only together with agent-manager at agent-platform.agentManager.agentChartV3Floor (its migrate rewrites muster.requireApproval to default: Ask), muster at agent-platform.muster.agentApprovalFloor (enforces it), agent-manager's tool approval on and the default agent's range on the same major; a range spanning 2.x and 3.x fails; the 3.x line reaches agent-manager, the migrate run's connectivity release and the default agent's source (giantswarm/giantswarm#38902, slice 8). Stdlib only. HELM selects the binary. + @echo "====> $@ ($(CHART_DIR))" + @HELM="$(HELM)" python3 tests/verify-agent-chart-line.py $(CHART_DIR) + .PHONY: verify-tool-approval verify-tool-approval: ## Assert the platform side of Governing tool calls (giantswarm/giantswarm#38902): the top-level governance and governedServers values render muster's governance configuration into the muster release (muster.governance: mode, governedServers {server, role, safe} per shipped MCPServer, keyed namespace/name outside muster's namespace, an own entry standing) from the muster floor agent-platform.muster.governanceFloor, none below it, governed below it, the earlier servers shape, unknown keys and conflicting or unknown modes failing; coverage: every shipped MCPServer source (meta releases carrying muster.mcpServer, the connectivity chart's MCPServers, agent-platform-mcps' families, and the component charts beside this checkout, COMPONENT_CHECKOUTS) is governed or in governanceExempt, no floor is safe, every safe entry names a tool of its server, the two kubernetes maps agree; the redirect allowlist (portal /sessions with backstage.publicPort, klaus-gateway's return with its port, invalid ports and URLs failing); the connector-admin role binds the Giant Swarm admin groups plus tenants.platformTeam; muster-approval-binder's subjects are agent-manager's ServiceAccount only (muster.rbac.approvalBinder.subjects), none from the connectivity chart; agent-manager's muster.toolApproval.enabled on from its floor and muster's agent approval floor, off below muster's, absent below its own, an own value standing; the connectivity MCPServers carry explicit approval settings (a Block rule renders, overrides reach spec.approval also from the meta chart, null renders none, invalid values fail naming the key). Stdlib only. HELM selects the binary. @echo "====> $@ ($(CHART_DIR), $(CONNECTIVITY_DIR))" diff --git a/helm/agent-platform-connectivity/templates/kagent/migrate-cronjob.yaml b/helm/agent-platform-connectivity/templates/kagent/migrate-cronjob.yaml index 5dabbdd3..5727a1d1 100644 --- a/helm/agent-platform-connectivity/templates/kagent/migrate-cronjob.yaml +++ b/helm/agent-platform-connectivity/templates/kagent/migrate-cronjob.yaml @@ -3,8 +3,13 @@ The cut-over of one installation's agents to the api.kagent.dev line (giantswarm/agent-platform#346 for the shape; bumblebee-plans#51 D11, expand–contract): `agent-manager migrate`, run once per pod template, in the kagent namespace, as the ServiceAccount of the migration's own name -(migrate-rbac.yaml), never the agents' Flux identity. The 2.x range of -agent-manager.agentChart.semver picks the 1.x -> 2.x +(migrate-rbac.yaml), never the agents' Flux identity. The major of +agent-manager.agentChart.semver picks the path. A 3.x range picks 2.x -> 3.x +(agent chart 3.0, giantswarm/giantswarm#38902 slice 8): the command rewrites +muster.requireApproval: true to default: Ask and spells out the 2.x +modelConfig.name default, before it moves a namespace's OCIRepository to 3.x, +and emits the same as a diff for a GitOps-owned release; both lines render +the same Agent, so nothing is deleted. A 2.x range picks the 1.x -> 2.x path: the command validates every Generic-chart release against the chart 2.x schema, rewrites the portal-created ones (sub-agent bindings `agent` -> `subAgent`, the 1.x Harness admission label -> agent.harness) and moves the diff --git a/helm/agent-platform/README.md b/helm/agent-platform/README.md index 27482163..f6e84654 100644 --- a/helm/agent-platform/README.md +++ b/helm/agent-platform/README.md @@ -752,16 +752,17 @@ The map is merged into each component's own `nodeSelector` (`muster.nodeSelector | components.backstage.versionRange | string | `">=2.68.0 <4.0.0"` | | | components.backstage.valuesFrom | string | `"backstage"` | | | components.backstage.omitKeys[0] | string | `"hostname"` | | -| components.backstage.omitKeys[1] | string | `"parentRefs"` | | -| components.backstage.omitKeys[2] | string | `"installationName"` | | -| components.backstage.omitKeys[3] | string | `"extraScopes"` | | -| components.backstage.omitKeys[4] | string | `"startUrlSearchParams"` | | -| components.backstage.omitKeys[5] | string | `"enabledExtensions"` | | -| components.backstage.omitKeys[6] | string | `"disabledExtensions"` | | -| components.backstage.omitKeys[7] | string | `"skillsRepositories"` | | -| components.backstage.omitKeys[8] | string | `"skillPullRequests"` | | -| components.backstage.omitKeys[9] | string | `"metaAgents"` | | -| components.backstage.omitKeys[10] | string | `"configReload"` | | +| components.backstage.omitKeys[1] | string | `"publicPort"` | | +| components.backstage.omitKeys[2] | string | `"parentRefs"` | | +| components.backstage.omitKeys[3] | string | `"installationName"` | | +| components.backstage.omitKeys[4] | string | `"extraScopes"` | | +| components.backstage.omitKeys[5] | string | `"startUrlSearchParams"` | | +| components.backstage.omitKeys[6] | string | `"enabledExtensions"` | | +| components.backstage.omitKeys[7] | string | `"disabledExtensions"` | | +| components.backstage.omitKeys[8] | string | `"skillsRepositories"` | | +| components.backstage.omitKeys[9] | string | `"skillPullRequests"` | | +| components.backstage.omitKeys[10] | string | `"metaAgents"` | | +| components.backstage.omitKeys[11] | string | `"configReload"` | | | components.backstage.enabled | bool | `false` | | | components.backstage.dependsOn[0] | string | `"cloudnative-pg"` | | | components.backstage.dependsOn[1] | string | `"agent-platform-connectivity"` | | @@ -832,16 +833,18 @@ The map is merged into each component's own `nodeSelector` (`muster.nodeSelector | components.agent-platform-connectivity.disableWaitForJobs | bool | `true` | | | components.agent-platform-connectivity.omitKeys[0] | string | `"flux-engine"` | | | components.agent-platform-connectivity.omitKeys[1] | string | `"governance"` | | -| components.agent-platform-connectivity.omitKeys[2] | string | `"scheduling"` | | -| components.agent-platform-connectivity.omitKeys[3] | string | `"gpu-operator"` | | -| components.agent-platform-connectivity.omitKeys[4] | string | `"toolchain-manager"` | | -| components.agent-platform-connectivity.omitKeys[5] | string | `"kserve-runtime-configs"` | | -| components.agent-platform-connectivity.omitKeys[6] | string | `"skills"` | | -| components.agent-platform-connectivity.omitKeys[7] | string | `"skillManager"` | | -| components.agent-platform-connectivity.omitKeys[8] | string | `"skill-manager"` | | -| components.agent-platform-connectivity.omitKeys[9] | string | `"defaultAgent"` | | -| components.agent-platform-connectivity.omitKeys[10] | string | `"agent-platform-operator"` | | -| components.agent-platform-connectivity.omitKeys[11] | string | `"agentPlatformOrganizations.operator"` | | +| components.agent-platform-connectivity.omitKeys[2] | string | `"governedServers"` | | +| components.agent-platform-connectivity.omitKeys[3] | string | `"governanceExempt"` | | +| components.agent-platform-connectivity.omitKeys[4] | string | `"scheduling"` | | +| components.agent-platform-connectivity.omitKeys[5] | string | `"gpu-operator"` | | +| components.agent-platform-connectivity.omitKeys[6] | string | `"toolchain-manager"` | | +| components.agent-platform-connectivity.omitKeys[7] | string | `"kserve-runtime-configs"` | | +| components.agent-platform-connectivity.omitKeys[8] | string | `"skills"` | | +| components.agent-platform-connectivity.omitKeys[9] | string | `"skillManager"` | | +| components.agent-platform-connectivity.omitKeys[10] | string | `"skill-manager"` | | +| components.agent-platform-connectivity.omitKeys[11] | string | `"defaultAgent"` | | +| components.agent-platform-connectivity.omitKeys[12] | string | `"agent-platform-operator"` | | +| components.agent-platform-connectivity.omitKeys[13] | string | `"agentPlatformOrganizations.operator"` | | | components.agent-platform-connectivity.dependsOn[0] | string | `"muster"` | | | components.agent-platform-connectivity.dependsOn[1] | string | `"agentgateway"` | | | components.agent-platform-connectivity.dependsOn[2] | string | `"substrate-crds"` | | @@ -1619,8 +1622,8 @@ The map is merged into each component's own `nodeSelector` (`muster.nodeSelector | clusterManager.networkPolicy.egress.fqdns | list | `[]` | | | clusterManager.networkPolicy.egress.cidrs | list | `[]` | | | governance | string | `"trusted"` | The platform's governance mode: trusted (the default) or governed. It changes no tool approval setting's meaning; it adds asking for agent callers. Governed asks a person before an agent runs any tool of a governed server (governedServers below) that is not on that server's safe list (new and renamed tools too), and before any of muster's own tools but its reads; the Dev Portal's connector wizard pre-selects the Recommended preset (read-only tools run, the rest ask). Trusted lets agents run what the connectors' own settings allow and pre-selects Allow all. In both modes muster's built-in floors ask a person before an agent adds or repoints a connector, changes approval settings, grants access, adds a model, egress origin, credential or backend, approves an action or a toolchain source, or changes muster's own configuration; the role floors hold on the governed servers of that role, so governedServers names them in both modes. The meta chart renders muster's governance configuration from it (muster.governance: the mode and governedServers), from the muster release that reads it (agent-platform.muster.governanceFloor); below it `governed` fails the render and trusted renders nothing. From that release the meta chart also renders muster.approval.installation (backstage.installationName, the name the approval page shows), muster-approval-binder's subject (agent-manager's ServiceAccount, muster.rbac.approvalBinder.subjects) and the pages muster may return the browser to after an approval in muster.oauth.mcpClient.postLoginRedirectAllowlist (the portal's /sessions with backstage.publicPort, klausGateway.obo.callbackBaseUrl + /auth/slack/return; an own list's entries stay). Approval itself needs muster's OAuth server with Dex sign-in, Valkey storage (the default) and muster.muster.oauth.mcpClient.publicUrl on the OAuth server's origin with mcpClient.enabled for the allowlist; the chart does not fail without them, muster refuses asking calls with the reason. Only admins switch it, through the Platform Manager with a second person's approval; never an agent. Anything else fails the render. Concept: https://docs.giantswarm.io/overview/agent-platform/governing-tool-calls/ | -| governanceExempt | object | `{"prometheus":"agent-platform-mcps' prometheus family (mcp-prometheus): every tool reads","capi":"agent-platform-mcps' capi family (mcp-kubernetes' CAPI tools): every tool reads"}` | MCPServer sources the platform ships that muster deliberately does not govern, each with its reason (make verify-tool-approval wants every shipped source in governedServers or here). Read by the meta chart's tests only. | -| governedServers | object | `{"agent-manager":{"role":"agentManager","safe":["get_info","list_agents","get_agent","get_agent_status","validate_agent","list_model_configs","list_egress_policies","list_skills","list_sessions","get_session","get_session_turn","toolchain_users","list_organizations","get_organization","list_organization_members","list_organization_connectors"]},"kagent":{"role":"sessionManager","safe":["list_sessions","list_session_checkpoints","list_sandbox_templates","list_sandboxes","get_sandbox","get_sandbox_process","read_sandbox_outputs","read_sandbox_file"]},"model-manager":{"role":"modelManager","safe":["get_info","get_backend","list_backends","list_models","get_model","list_loaded_models","list_presets","search_models","check_fit","list_nodes","list_jobs","get_job"]},"cluster-manager":{"role":"clusterManager","safe":["get_info","list_clusters","list_releases","list_node_pools"]},"vm-manager":{"role":"vmManager","safe":["get_info","get_host","list_images","get_image","list_networks","get_network","list_vms","get_vm","get_vm_metrics","get_vm_attestation"]},"toolchain-manager":{"role":"toolchainManager","safe":["list_sources","list_toolchains","describe_toolchain","toolchain_build_status","search_packages"]},"workspace-manager":{"role":"workspaceManager","safe":["list_providers","list_owners","list_workspaces","get_workspace","list_repositories","preview_workspace"]},"skill-manager":{"role":"skillManager","safe":["list_skill_sources","list_skills","resolve_skills","get_skill","get_skill_file"]},"mcp-kubernetes":{"role":"infrastructure","safe":["logs","list_port_forward_sessions","context_list","context_get_current","can_i","api_resources","cluster_health","capi_list_clusters","capi_get_cluster","capi_resolve_cluster","capi_cluster_health","get","list","describe"]},"giantswarm-platform-manager":{"role":"platformManager","safe":[]}}` | The servers muster governs (muster.governance.governedServers), per source the platform ships: `role` (which of muster's role floors hold on it: agentManager, platformManager, connectorManager, sessionManager, modelManager, clusterManager, vmManager, workspaceManager, toolchainManager, skillManager, infrastructure) and `safe`, the server's own tool names agents call unasked on governed (reads only; a floor never, muster refuses to start on one). Every other tool of a governed server asks agents on governed. A source renders one entry per MCPServer it ships while that renders (agent-platform.muster.governedKeys): a manager component's .muster.mcpServer.name in its namespace; kagent the connectivity chart's kagent server; mcp-kubernetes the connectivity chart's and every agent-platform-mcps kubernetes entry; any other key is a muster server key itself (giantswarm-platform-manager). null drops a source (then list it in governanceExempt with the reason). make verify-tool-approval fails on a shipped MCPServer that is neither here nor in governanceExempt, and on a safe entry that names a floor or no tool of its server, or whose name starts with a write verb (create, delete, exec, set, approve, ...) unless a `# safe-write: : ` comment above `safe:` says why it reads. Safe lists: tool-approval governed-safe-list-proposal (giantswarm/giantswarm#38902). | +| governedServers | object | `{"agent-manager":{"role":"agentManager","safe":["get_info","list_agents","get_agent","get_agent_status","validate_agent","list_model_configs","list_egress_policies","list_skills","list_sessions","get_session","get_session_turn","toolchain_users","list_organizations","get_organization","list_organization_members","list_organization_connectors"]},"cluster-manager":{"role":"clusterManager","safe":["get_info","list_clusters","list_releases","list_node_pools"]},"giantswarm-platform-manager":{"role":"platformManager","safe":[]},"kagent":{"role":"sessionManager","safe":["list_sessions","list_session_checkpoints","list_sandbox_templates","list_sandboxes","get_sandbox","get_sandbox_process","read_sandbox_outputs","read_sandbox_file"]},"mcp-kubernetes":{"role":"infrastructure","safe":["logs","list_port_forward_sessions","context_list","context_get_current","can_i","api_resources","cluster_health","capi_list_clusters","capi_get_cluster","capi_resolve_cluster","capi_cluster_health","get","list","describe"]},"model-manager":{"role":"modelManager","safe":["get_info","get_backend","list_backends","list_models","get_model","list_loaded_models","list_presets","search_models","check_fit","list_nodes","list_jobs","get_job"]},"skill-manager":{"role":"skillManager","safe":["list_skill_sources","list_skills","resolve_skills","get_skill","get_skill_file"]},"toolchain-manager":{"role":"toolchainManager","safe":["list_sources","list_toolchains","describe_toolchain","toolchain_build_status","search_packages"]},"vm-manager":{"role":"vmManager","safe":["get_info","get_host","list_images","get_image","list_networks","get_network","list_vms","get_vm","get_vm_metrics","get_vm_attestation"]},"workspace-manager":{"role":"workspaceManager","safe":["list_providers","list_owners","list_workspaces","get_workspace","list_repositories","preview_workspace"]}}` | The servers muster governs (muster.governance.governedServers), per source the platform ships: `role` (which of muster's role floors hold on it: agentManager, platformManager, connectorManager, sessionManager, modelManager, clusterManager, vmManager, workspaceManager, toolchainManager, skillManager, infrastructure) and `safe`, the server's own tool names agents call unasked on governed (reads only; a floor never, muster refuses to start on one). Every other tool of a governed server asks agents on governed. A source renders one entry per MCPServer it ships while that renders (agent-platform.muster.governedKeys): a manager component's .muster.mcpServer.name in its namespace; kagent the connectivity chart's kagent server; mcp-kubernetes the connectivity chart's and every agent-platform-mcps kubernetes entry; any other key is a muster server key itself (giantswarm-platform-manager). null drops a source (then list it in governanceExempt with the reason). make verify-tool-approval fails on a shipped MCPServer that is neither here nor in governanceExempt, and on a safe entry that names a floor or no tool of its server, or whose name starts with a write verb (create, delete, exec, set, approve, ...) unless a `# safe-write: : ` comment above `safe:` says why it reads. Safe lists: tool-approval governed-safe-list-proposal (giantswarm/giantswarm#38902). | +| governanceExempt | object | `{"capi":"agent-platform-mcps' capi family (mcp-kubernetes' CAPI tools): every tool reads","prometheus":"agent-platform-mcps' prometheus family (mcp-prometheus): every tool reads"}` | MCPServer sources the platform ships that muster deliberately does not govern, each with its reason (make verify-tool-approval wants every shipped source in governedServers or here). Read by the meta chart's tests only. | | tenants.platform.users | list | `[{"apiGroup":"rbac.authorization.k8s.io","kind":"Group","name":"system:authenticated"}]` | Every signed-in person: bound to agent-platform:platform-user in the kagent namespace, and, while musterMcpServerViewers is unset, to `list` (with get and watch) on muster's MCPServers in muster's namespace (the servers for everyone). RBAC subjects. The default, system:authenticated, gives this to every user. It also gives it to every ServiceAccount, so every pod in the cluster can read the platform tenant's Agents, RemoteMCPServer URLs and muster's MCPServer specs. To give it to people only, replace the default with an OIDC group that every user belongs to, written as the API server sees it (with the installation's OIDC groups prefix). | | tenants.platform.editors | list | `[{"apiGroup":"rbac.authorization.k8s.io","kind":"Group","name":"giantswarm-ad:giantswarm-admins"},{"apiGroup":"rbac.authorization.k8s.io","kind":"Group","name":"giantswarm-github:giantswarm:giantswarm-admins"}]` | The platform's operators: bound to agent-platform:editor in the kagent namespace. RBAC subjects. The Giant Swarm admin groups, as in muster.rbac.*.subjects. | | tenants.platform.kagentRelease.name | string | `""` | The name of kagent's HelmRelease in the kagent namespace. Empty, the default, admits none. | diff --git a/helm/agent-platform/templates/_helpers.tpl b/helm/agent-platform/templates/_helpers.tpl index 94f45869..da6c2971 100644 --- a/helm/agent-platform/templates/_helpers.tpl +++ b/helm/agent-platform/templates/_helpers.tpl @@ -2171,6 +2171,78 @@ Usage: include "agent-platform.muster.sessionBindings" . | fromJson {{- end -}} {{- define "agent-platform.muster.toolsetBindingFloor" -}}5.49.0{{- end -}} +{{/* +The first agent-manager whose migrate has the Generic chart 2.x -> 3.x hop +(giantswarm/giantswarm#38902, slice 8): agent chart 3.0 removes +muster.requireApproval, and that migrate rewrites it to default: Ask before +it moves a namespace's chart source. The same release as +agent-platform.agentManager.toolApprovalFloor; a placeholder until it exists. +One line, no comment inside the define. +*/}} +{{- define "agent-platform.agentManager.agentChartV3Floor" -}}3.6.0{{- end -}} + +{{/* +The majors a range admits among 2 and 3, as a JSON list of strings: probed with each +major's first, a middle and a late release version, which covers the forms +the agent chart line takes (x-ranges, bounds, carets, tildes). +Usage: include "agent-platform.agentChart.majors" "" | fromJsonArray +*/}} +{{- define "agent-platform.agentChart.majors" -}} +{{- $range := toString . -}} +{{- $out := list -}} +{{- range $m := list 2 3 -}} +{{- $hit := false -}} +{{- range $v := list (printf "%d.0.0" $m) (printf "%d.6.0" $m) (printf "%d.999.999" $m) -}} +{{- if semverCompare $range $v -}}{{- $hit = true -}}{{- end -}} +{{- end -}} +{{- if $hit -}}{{- $out = append $out (toString $m) -}}{{- end -}} +{{- end -}} +{{- $out | toJson -}} +{{- end -}} + +{{/* +The agent chart line (agent-manager.agentChart.semver) moves to 3.x only +together with what makes that safe (slice 8): agent chart 3.0 removes +muster.requireApproval, which agent-manager's migrate rewrites to +`default: Ask` from agent-platform.agentManager.agentChartV3Floor, and muster +enforces `default: Ask` from agent-platform.muster.agentApprovalFloor with +agent-manager binding it (agent-manager.muster.toolApproval, derived on from +those floors). The same range reaches the agent-platform-operator, which moves +every organization's chart source at once, and the migrate run; the default +agent's range (components.default-agent.versionRange) moves with it. A range +spanning 2.x and 3.x is refused: migrate moves releases to one major. Emits +nothing; fails naming the key and the fix. +*/}} +{{- define "agent-platform.validateAgentChartLine" -}} +{{- $am := index .Values "agent-manager" | default dict -}} +{{- $range := dig "agentChart" "semver" "2.x" $am | toString -}} +{{- $majors := include "agent-platform.agentChart.majors" $range | fromJsonArray -}} +{{- if gt (len $majors) 1 -}} +{{- fail (printf "agent-manager.agentChart.semver %q admits agent chart 2.x and 3.x: agent-manager's migrate moves an installation's agents to exactly one major; use \">=3.0.0 <4.0.0\" (or a 2.x range)" $range) -}} +{{- end -}} +{{- $v3 := has "3" $majors -}} +{{- if and $v3 (include "agent-platform.componentEnabled" (dict "root" . "name" "agent-manager")) -}} +{{- $amFloor := include "agent-platform.agentManager.agentChartV3Floor" . -}} +{{- if not (include "agent-platform.componentFloorAtLeast" (dict "root" . "name" "agent-manager" "version" $amFloor)) -}} +{{- fail (printf "agent-manager.agentChart.semver %q moves the agents to agent chart 3.x, but components.agent-manager.versionRange %q admits a release below %s: agent chart 3.0 removes muster.requireApproval, and only agent-manager %s's migrate rewrites it to default: Ask before it moves a namespace's chart source; move components.agent-manager.versionRange to %s or later in the same change" $range (dig "agent-manager" "versionRange" "" .Values.components) $amFloor $amFloor $amFloor) -}} +{{- end -}} +{{- $musterFloor := include "agent-platform.muster.agentApprovalFloor" . -}} +{{- if not (and (include "agent-platform.componentEnabled" (dict "root" . "name" "muster")) (include "agent-platform.componentFloorAtLeast" (dict "root" . "name" "muster" "version" $musterFloor))) -}} +{{- fail (printf "agent-manager.agentChart.semver %q moves the agents to agent chart 3.x, but muster is off or components.muster.versionRange %q admits a release below %s: chart 3.0 replaces muster.requireApproval with default: Ask, which only muster %s enforces; move components.muster.versionRange to %s or later in the same change" $range (dig "muster" "versionRange" "" .Values.components) $musterFloor $musterFloor $musterFloor) -}} +{{- end -}} +{{- $ownTa := dig "muster" "toolApproval" "enabled" nil $am -}} +{{- if and (not (kindIs "invalid" $ownTa)) (not $ownTa) -}} +{{- fail (printf "agent-manager.agentChart.semver %q moves the agents to agent chart 3.x, but agent-manager.muster.toolApproval.enabled is false: an agent migrated from muster.requireApproval to default: Ask would start no Session (agent-manager refuses settings it does not bind); leave the key unset" $range) -}} +{{- end -}} +{{- end -}} +{{- if include "agent-platform.componentEnabled" (dict "root" . "name" "default-agent") -}} +{{- $da := dig "default-agent" "versionRange" "" .Values.components | toString -}} +{{- if and $da (ne (has "3" (include "agent-platform.agentChart.majors" $da | fromJsonArray)) $v3) -}} +{{- fail (printf "components.default-agent.versionRange %q and agent-manager.agentChart.semver %q select different agent chart majors: the default agent is a release of the same chart and moves with the line (\">=3.0.0 <4.0.0\" for both, or a 2.x range for both)" $da $range) -}} +{{- end -}} +{{- end -}} +{{- end -}} + {{/* While muster trusts the actor JWT, agent-manager is told so (muster.actorBearer) and binds every Session with the agent's toolset: the diff --git a/helm/agent-platform/templates/components.yaml b/helm/agent-platform/templates/components.yaml index a7067743..cdc6f8b0 100644 --- a/helm/agent-platform/templates/components.yaml +++ b/helm/agent-platform/templates/components.yaml @@ -267,6 +267,7 @@ knowledge: {{- include "agent-platform.validateInlineSecrets" . -}} {{- include "agent-platform.validatePinnedLoginConnector" . -}} {{- include "agent-platform.validateToolsetPresets" . -}} +{{- include "agent-platform.validateAgentChartLine" . -}} {{- $root := . -}} {{- $g := .Values.gitops -}} {{- /* Flux is the only render engine. Agents are Flux objects on every path diff --git a/helm/agent-platform/values.yaml b/helm/agent-platform/values.yaml index 82fba0a5..fb3638c5 100644 --- a/helm/agent-platform/values.yaml +++ b/helm/agent-platform/values.yaml @@ -1230,7 +1230,8 @@ components: # @schema additionalProperties: true chart: agent repository: oci://gsoci.azurecr.io/charts/giantswarm # The agent chart line, moved with agent-manager.agentChart.semver - # (make verify-default-agent). The floor is 2.6.0, whose empty + # (make verify-default-agent; another major fails the render, + # agent-platform.validateAgentChartLine). The floor is 2.6.0, whose empty # modelConfig.name renders no model (giantswarm/agent#130). versionRange: ">=2.6.0 <3.0.0" valuesFile: agents/default-agent/values.yaml @@ -5357,7 +5358,17 @@ agent-manager: # @schema skipProperties: true; additionalProperties: true # the v1alpha2 Agent of kagent 0.10. A range, so patch and minor releases # of the line reach the agents on their own; the major is the API boundary # and moves only with this chart. The floor moves with components.kagent - # and components.default-agent.versionRange. + # and components.default-agent.versionRange. The same range reaches + # agent-manager's migrate run and the agent-platform-operator, which moves + # every organization's chart source at once. 3.x (chart 3.0 removes + # muster.requireApproval, giantswarm/giantswarm#38902) renders only with + # components.agent-manager.versionRange at + # agent-platform.agentManager.agentChartV3Floor (its migrate rewrites + # requireApproval to default: Ask before it moves a namespace's source), + # components.muster.versionRange at agent-platform.muster.agentApprovalFloor + # (muster enforces default: Ask), agent-manager's tool approval on and the + # default agent's range on 3.x: move all of them in one change + # (agent-platform.validateAgentChartLine, make verify-agent-chart-line). semver: ">=2.6.0 <3.0.0" # Deprecated: set skillManager.sources. Read only while agent-manager does # not pin through the skill-manager (components.skill-manager off, or diff --git a/tests/verify-agent-chart-line.py b/tests/verify-agent-chart-line.py new file mode 100755 index 00000000..d3458b0c --- /dev/null +++ b/tests/verify-agent-chart-line.py @@ -0,0 +1,118 @@ +#!/usr/bin/env python3 +"""Assert that the agent chart line moves to 3.x only with what makes it safe +(giantswarm/giantswarm#38902, slice 8). + +Agent chart 3.0 removes muster.requireApproval; agent-manager's migrate +rewrites it to `default: Ask` from agent-platform.agentManager.agentChartV3Floor, +and muster enforces `default: Ask` from agent-platform.muster.agentApprovalFloor. +agent-manager.agentChart.semver feeds agent-manager, its migrate run and the +agent-platform-operator (every organization's chart source), so: + +- the default renders on the 2.x line; +- a 3.x line with agent-manager and muster at their floors and the default + agent's range on 3.x renders, and the range reaches agent-manager's release, + the connectivity release (the migrate run's input) and the default agent's + source; +- a 3.x line is refused with agent-manager below its floor, with muster below + its floor, with agent-manager.muster.toolApproval.enabled false, with the + default agent's range on the other major, and a range spanning both majors + is refused; the default agent on 3.x with the line on 2.x is refused too; +- agentChartV3Floor is the tool approval floor's release (one X.Y.Z each). + +Stdlib only: documents are matched by text. +Usage: verify-agent-chart-line.py +Environment: HELM selects the binary. +""" +from __future__ import annotations + +import os +import re +import subprocess +import sys + +META = sys.argv[1] +HELM = os.environ.get("HELM") or "helm" +BASE = [ + "--namespace", "agent-platform", + "--set", "global.domain=example.com", + "--set", "global.identity.issuerUrl=https://dex.example.com", + "--set", "global.identity.clientId=agent-platform", + "--set", "global.identity.existingSecret=agent-platform-idp", + "--set", "global.gatewayApi.parentRefs[0].name=giantswarm-default", + "--set", "model-manager.ollama.endpoint=http://ollama.example.com:11434", + "--set", "kagent.harness.snapshotLocation=s3://ci-agent-snapshots/agents", + "--set", "kagent.database.postgres.urlFile=/etc/kagent-db/uri", + "--set", "postgres.enabled=true", + "--set", "components.kagent.enabled=true", + "--set", "components.agent-manager.enabled=true", +] +V3 = ">=3.0.0 <4.0.0" +LINE = ["--set", f"agent-manager.agentChart.semver={V3}"] +AM = ["--set", "components.agent-manager.versionRange=>={floor}-rc.1 <4.0.0-0"] +MUSTER = ["--set", "components.muster.versionRange=>={floor} <6.0.0"] +DEFAULT_AGENT = ["--set", f"components.default-agent.versionRange={V3}"] + +failures: list[str] = [] + + +def fail(msg: str) -> None: + failures.append(msg) + + +def run(*args: str) -> subprocess.CompletedProcess: + return subprocess.run([HELM, "template", "ap", META, *BASE, *args], capture_output=True, text=True) + + +def renders(what: str, *args: str) -> str: + r = run(*args) + if r.returncode != 0: + fail(f"{what}: render failed:\n{r.stderr}") + return "" + return r.stdout + + +def refused(what: str, needle: str, *args: str) -> None: + r = run(*args) + if r.returncode == 0 or needle not in r.stderr: + fail(f"{what}: not refused with {needle!r}:\n{r.stderr[-600:]}") + + +def floor(name: str) -> str: + text = open(os.path.join(META, "templates", "_helpers.tpl"), encoding="utf-8").read() + m = re.search(r'\{\{- define "agent-platform\.' + re.escape(name) + r'" -\}\}([^{]*)\{\{- end -\}\}', text) + if not m or not re.fullmatch(r"\d+\.\d+\.\d+", m.group(1)): + fail(f"agent-platform.{name} is not one X.Y.Z") + return "0.0.0" + return m.group(1) + + +am_floor = floor("agentManager.agentChartV3Floor") +muster_floor = floor("muster.agentApprovalFloor") +if am_floor != floor("agentManager.toolApprovalFloor"): + fail(f"agentManager.agentChartV3Floor {am_floor} is not the tool approval floor's release") +am = [a.replace("{floor}", am_floor) for a in AM] +muster = [a.replace("{floor}", muster_floor) for a in MUSTER] + +out = renders("default") +if V3 in out: + fail("the default render carries the 3.x line") +if "'>=2.6.0 <3.0.0'" not in out and '">=2.6.0 <3.0.0"' not in out: + fail("the default render does not carry the 2.x line") + +out = renders("3.x line with its floors", *LINE, *am, *muster, *DEFAULT_AGENT) +if out.count(V3) < 3: + fail(f"the 3.x line reaches {out.count(V3)} places; want agent-manager's release, the connectivity release and the default agent's source") + +refused("3.x line, agent-manager below its floor", f"admits a release below {am_floor}", *LINE, *muster, *DEFAULT_AGENT) +refused("3.x line, muster below its floor", f"admits a release below {muster_floor}", *LINE, *am, *DEFAULT_AGENT) +refused("3.x line, tool approval off", "agent-manager.muster.toolApproval.enabled is false", + *LINE, *am, *muster, *DEFAULT_AGENT, "--set", "agent-manager.muster.toolApproval.enabled=false") +refused("3.x line, default agent on 2.x", "select different agent chart majors", *LINE, *am, *muster) +refused("2.x line, default agent on 3.x", "select different agent chart majors", *DEFAULT_AGENT) +refused("range spanning both majors", "admits agent chart 2.x and 3.x", "--set", "agent-manager.agentChart.semver=>=2.6.0") + +if failures: + for f in failures: + print(f"FAIL: {f}", file=sys.stderr) + sys.exit(1) +print("agent chart line verified.") From ee774984ca01c2687fcfa4e8b4a0b71603f4ea93 Mon Sep 17 00:00:00 2001 From: Dominik Schmidle Date: Thu, 26 Nov 2026 09:46:12 +0100 Subject: [PATCH 21/56] docs: upgrade notes and skill for agent chart 3.0's default: Ask --- UPGRADE.md | 13 +++++++++++++ skills/agent-platform-agent-management/SKILL.md | 7 ++++--- 2 files changed, 17 insertions(+), 3 deletions(-) diff --git a/UPGRADE.md b/UPGRADE.md index 4fb36507..41b14c92 100644 --- a/UPGRADE.md +++ b/UPGRADE.md @@ -15,6 +15,19 @@ Every component ships its own CRDs and upgrades them with its release; there is A CRD version change that needs more than an apply (a stored version dropped, as with kagent's `v1alpha2`) has its own entry below, with the hook that does it. +## \ → \ (agent chart 3.0: `muster.requireApproval` becomes `default: Ask`) + +giantswarm/giantswarm#38902, slice 8: agent chart 3.0 removes `muster.requireApproval` (kagent's flag that paused an agent before every tool call) and the default of `modelConfig.name`. `default: Ask` replaces `requireApproval: true`: muster asks a person before every tool call the agent makes through it, from every client, and nothing asks twice. `agent-manager.agentChart.semver` moves the agents of the whole installation: agent-manager composes new agents on it, its migrate run (the connectivity release's start hook) moves the existing ones, and the agent-platform-operator moves every organization's chart source at once. + +The render allows the 3.x line only together with what makes it safe (`make verify-agent-chart-line`): agent-manager at `agent-platform.agentManager.agentChartV3Floor`, whose migrate has the 2.x → 3.x hop, muster at `agent-platform.muster.agentApprovalFloor`, which enforces `default: Ask`, agent-manager's tool approval on (`agent-manager.muster.toolApproval.enabled` unset) and the default agent's range on the same major. The migrate run writes each release's 3.x values (`muster.requireApproval: true` → `default: Ask` where the muster binding renders, the key dropped, an unset `modelConfig.name` spelled out as the 2.x default `default-model-config`) before it moves the namespace's source, and only once a 3.x chart is published. + +### Operator action + +- Move these in one change: `agent-manager.agentChart.semver` and `components.default-agent.versionRange` to `>=3.0.0 <4.0.0`, `components.agent-manager.versionRange` and `components.muster.versionRange` to the floors above or later. Any one alone fails the render. +- Tool approval's prerequisites must hold (muster's OAuth server with Dex sign-in, Valkey storage; the entry below): without them muster refuses every call that asks, so an agent migrated to `default: Ask` cannot call its tools until they hold. It never runs them unasked. +- Before the upgrade, find the releases the migrate run cannot rewrite, the ones owned by git (a GitOps-owned release in a managed namespace gets its rewrite as a diff in the report ConfigMap `agent-manager-migrate-report`) and any agent release in an organization namespace written outside agent-manager: `kubectl get helmreleases -A -o json | jq -r '.items[] | select(.spec.values.muster.requireApproval != null or .spec.values.modelConfig.name == null) | "\(.metadata.namespace)/\(.metadata.name)"'`. In git, replace `muster.requireApproval: true` with `default: Ask`, drop `requireApproval: false`, and set `modelConfig.name` where it is unset, together with the move of that release's chart source to 3.x. An organization's source moves with the platform release: a release there that still carries `muster.requireApproval` fails its 3.x render and stays on its 2.x revision, still asking through kagent, until its values change; one without `modelConfig.name` renders without a model. +- Read the report after the run: `kubectl -n get configmap agent-manager-migrate-report -o jsonpath='{.data.report\.yaml}'`; each rewritten release lists `changes.removed` and `changes.set`. A release carrying `requireApproval: true` beside tool approval settings is reported failed (that combination never rendered) and holds its chart source; set its settings by hand. + ## \ → \ (tool approval and the governance mode) giantswarm/giantswarm#38902: muster decides Allow, Ask or Block for every tool call, and the chart renders muster's governance configuration (`governance`, `governedServers`: per shipped MCPServer its role and its safe list of reads), the approval page's installation name, the redirect allowlist and the approval binder ([chart README, "Tool approval and the governance mode"](helm/agent-platform/README.md#tool-approval-and-the-governance-mode)). None of it reaches a muster below `agent-platform.muster.governanceFloor`. diff --git a/skills/agent-platform-agent-management/SKILL.md b/skills/agent-platform-agent-management/SKILL.md index e5c1b247..ab430746 100644 --- a/skills/agent-platform-agent-management/SKILL.md +++ b/skills/agent-platform-agent-management/SKILL.md @@ -151,9 +151,10 @@ never assume an argument. The agent tools drop an unknown key without an error: connector with `server`; `filter_tools` with `agentTools` shows how a list resolves before you save it. A save's `sessionsUpdated: false` and `warnings` mean running sessions still carry a dropped exception until agent-manager tells muster again: say so. A governed platform's asks - cannot be lifted per agent. `muster.requireApproval: true` keeps asking before - every call until agent chart 3.0 moves it to `default: Ask`; never set it together with tool - settings. + cannot be lifted per agent. To make an agent ask before every call, set `default: Ask` + (`set_agent_approval`). Agent chart 3.0 removed `muster.requireApproval`: agent-manager's + migrate rewrote `true` to `default: Ask`, and a release that still carries the key fails its 3.x + render and stays on its 2.x revision; never write it. - **An organization's connectors**: a kagent `RemoteMCPServer` in the organization namespace (`x_agent-manager_set_organization_connector`), not a Muster server, so no `toolset` selector reaches it. From agent-manager 3.3.0 (`connectors` in `x_agent-manager_create_agent`'s schema; From 0a5dd8f5fbff921ea8dcbe7830388ef383c5cb2f Mon Sep 17 00:00:00 2001 From: Dominik Schmidle Date: Thu, 26 Nov 2026 09:47:58 +0100 Subject: [PATCH 22/56] chore(helm): regenerate schema for tool-approval values --- helm/agent-platform/values.schema.json | 167 ++++++++++++++++++++++++- 1 file changed, 162 insertions(+), 5 deletions(-) diff --git a/helm/agent-platform/values.schema.json b/helm/agent-platform/values.schema.json index 6fe83947..925cb299 100644 --- a/helm/agent-platform/values.schema.json +++ b/helm/agent-platform/values.schema.json @@ -2172,18 +2172,175 @@ "governed" ] }, - "governedServers": { - "type": "object", - "description": "The servers muster governs (muster.governance.governedServers), per source the platform ships: `role` (which of muster's role floors hold on it: agentManager, platformManager, connectorManager, sessionManager, modelManager, clusterManager, vmManager, workspaceManager, toolchainManager, skillManager, infrastructure) and `safe`, the server's own tool names agents call unasked on governed (reads only; a floor never, muster refuses to start on one). Every other tool of a governed server asks agents on governed. A source renders one entry per MCPServer it ships while that renders (agent-platform.muster.governedKeys): a manager component's .muster.mcpServer.name in its namespace; kagent the connectivity chart's kagent server; mcp-kubernetes the connectivity chart's and every agent-platform-mcps kubernetes entry; any other key is a muster server key itself (giantswarm-platform-manager). null drops a source (then list it in governanceExempt with the reason). make verify-tool-approval fails on a shipped MCPServer that is neither here nor in governanceExempt, and on a safe entry that names a floor or no tool of its server, or whose name starts with a write verb (create, delete, exec, set, approve, ...) unless a `# safe-write: : ` comment above `safe:` says why it reads. Safe lists: tool-approval governed-safe-list-proposal (giantswarm/giantswarm#38902).", - "additionalProperties": true - }, "governanceExempt": { "type": "object", "description": "MCPServer sources the platform ships that muster deliberately does not govern, each with its reason (make verify-tool-approval wants every shipped source in governedServers or here). Read by the meta chart's tests only.", + "properties": { + "capi": { + "type": "string" + }, + "prometheus": { + "type": "string" + } + }, "additionalProperties": { "type": "string" } }, + "governedServers": { + "type": "object", + "description": "The servers muster governs (muster.governance.governedServers), per source the platform ships: `role` (which of muster's role floors hold on it: agentManager, platformManager, connectorManager, sessionManager, modelManager, clusterManager, vmManager, workspaceManager, toolchainManager, skillManager, infrastructure) and `safe`, the server's own tool names agents call unasked on governed (reads only; a floor never, muster refuses to start on one). Every other tool of a governed server asks agents on governed. A source renders one entry per MCPServer it ships while that renders (agent-platform.muster.governedKeys): a manager component's .muster.mcpServer.name in its namespace; kagent the connectivity chart's kagent server; mcp-kubernetes the connectivity chart's and every agent-platform-mcps kubernetes entry; any other key is a muster server key itself (giantswarm-platform-manager). null drops a source (then list it in governanceExempt with the reason). make verify-tool-approval fails on a shipped MCPServer that is neither here nor in governanceExempt, and on a safe entry that names a floor or no tool of its server, or whose name starts with a write verb (create, delete, exec, set, approve, ...) unless a `# safe-write: : ` comment above `safe:` says why it reads. Safe lists: tool-approval governed-safe-list-proposal (giantswarm/giantswarm#38902).", + "additionalProperties": true, + "properties": { + "agent-manager": { + "type": "object", + "additionalProperties": false, + "properties": { + "role": { + "type": "string" + }, + "safe": { + "type": "array", + "items": { + "type": "string" + } + } + } + }, + "cluster-manager": { + "type": "object", + "additionalProperties": false, + "properties": { + "role": { + "type": "string" + }, + "safe": { + "type": "array", + "items": { + "type": "string" + } + } + } + }, + "giantswarm-platform-manager": { + "type": "object", + "additionalProperties": false, + "properties": { + "role": { + "type": "string" + }, + "safe": { + "type": "array" + } + } + }, + "kagent": { + "type": "object", + "additionalProperties": false, + "properties": { + "role": { + "type": "string" + }, + "safe": { + "type": "array", + "items": { + "type": "string" + } + } + } + }, + "mcp-kubernetes": { + "type": "object", + "additionalProperties": false, + "properties": { + "role": { + "type": "string" + }, + "safe": { + "type": "array", + "items": { + "type": "string" + } + } + } + }, + "model-manager": { + "type": "object", + "additionalProperties": false, + "properties": { + "role": { + "type": "string" + }, + "safe": { + "type": "array", + "items": { + "type": "string" + } + } + } + }, + "skill-manager": { + "type": "object", + "additionalProperties": false, + "properties": { + "role": { + "type": "string" + }, + "safe": { + "type": "array", + "items": { + "type": "string" + } + } + } + }, + "toolchain-manager": { + "type": "object", + "additionalProperties": false, + "properties": { + "role": { + "type": "string" + }, + "safe": { + "type": "array", + "items": { + "type": "string" + } + } + } + }, + "vm-manager": { + "type": "object", + "additionalProperties": false, + "properties": { + "role": { + "type": "string" + }, + "safe": { + "type": "array", + "items": { + "type": "string" + } + } + } + }, + "workspace-manager": { + "type": "object", + "additionalProperties": false, + "properties": { + "role": { + "type": "string" + }, + "safe": { + "type": "array", + "items": { + "type": "string" + } + } + } + } + } + }, "gpu-operator": { "type": "object", "additionalProperties": true From f9ebf7aeabe57b8016de04dbf044a1e5e7ccd450 Mon Sep 17 00:00:00 2001 From: Dominik Schmidle Date: Thu, 26 Nov 2026 10:06:51 +0100 Subject: [PATCH 23/56] chore(helm): mirror tool-approval defaults in the meta chart, regenerate schema, README and goldens --- helm/agent-platform/README.md | 20 ++++++++++++++++++++ helm/agent-platform/values.schema.json | 3 +++ helm/agent-platform/values.yaml | 26 ++++++++++++++++++++++++++ tests/golden/meta-ci-engine-off.yaml | 22 ++++++++++++++++++++++ tests/golden/meta-default.yaml | 22 ++++++++++++++++++++++ 5 files changed, 93 insertions(+) diff --git a/helm/agent-platform/README.md b/helm/agent-platform/README.md index f6e84654..8c2f8bdd 100644 --- a/helm/agent-platform/README.md +++ b/helm/agent-platform/README.md @@ -960,6 +960,7 @@ The map is merged into each component's own `nodeSelector` (`muster.nodeSelector | networkPolicy.substrate.egressGateway.privateCIDRs | list | `[]` | | | networkPolicy.musterInClusterMcpPorts[0] | int | `8080` | | | networkPolicy.musterInClusterMcpPorts[1] | int | `8443` | | +| networkPolicy.musterSessionBindingsPort | int | `0` | | | networkPolicy.mcpBackends | object | `{}` | | | networkPolicy.mcpBackendScrapers[0].namespace | string | `"kube-system"` | | | networkPolicy.mcpBackendScrapers[0].matchLabels."app.kubernetes.io/instance" | string | `"alloy-metrics"` | | @@ -1266,6 +1267,25 @@ The map is merged into each component's own `nodeSelector` (`muster.nodeSelector | kagent.controllerRoute.mcp.timeout | int | `300` | | | kagent.controllerRoute.mcp.displayName | string | `"Kagent"` | | | kagent.controllerRoute.mcp.description | string | `"Your agent sessions on this installation, as the signed-in person: list them, send one a message, and checkpoint or fork them"` | | +| kagent.controllerRoute.mcp.approval.rule | string | `"Allow"` | | +| kagent.controllerRoute.mcp.approval.tools.list_sessions | string | `"Allow"` | | +| kagent.controllerRoute.mcp.approval.tools.invoke_session | string | `"Allow"` | | +| kagent.controllerRoute.mcp.approval.tools.create_session_checkpoint | string | `"Allow"` | | +| kagent.controllerRoute.mcp.approval.tools.list_session_checkpoints | string | `"Allow"` | | +| kagent.controllerRoute.mcp.approval.tools.fork_session | string | `"Allow"` | | +| kagent.controllerRoute.mcp.approval.tools.list_sandbox_templates | string | `"Allow"` | | +| kagent.controllerRoute.mcp.approval.tools.create_sandbox | string | `"Allow"` | | +| kagent.controllerRoute.mcp.approval.tools.list_sandboxes | string | `"Allow"` | | +| kagent.controllerRoute.mcp.approval.tools.get_sandbox | string | `"Allow"` | | +| kagent.controllerRoute.mcp.approval.tools.suspend_sandbox | string | `"Allow"` | | +| kagent.controllerRoute.mcp.approval.tools.resume_sandbox | string | `"Allow"` | | +| kagent.controllerRoute.mcp.approval.tools.delete_sandbox | string | `"Allow"` | | +| kagent.controllerRoute.mcp.approval.tools.start_sandbox_process | string | `"Allow"` | | +| kagent.controllerRoute.mcp.approval.tools.get_sandbox_process | string | `"Allow"` | | +| kagent.controllerRoute.mcp.approval.tools.kill_sandbox_process | string | `"Allow"` | | +| kagent.controllerRoute.mcp.approval.tools.read_sandbox_outputs | string | `"Allow"` | | +| kagent.controllerRoute.mcp.approval.tools.read_sandbox_file | string | `"Allow"` | | +| kagent.controllerRoute.mcp.approval.tools.write_sandbox_file | string | `"Allow"` | | | kagent.controllerRoute.jwtAuthentication.enabled | bool | `true` | | | kagent.controllerRoute.jwtAuthentication.mode | string | `"Strict"` | | | kagent.controllerRoute.jwtAuthentication.issuer | string | `""` | | diff --git a/helm/agent-platform/values.schema.json b/helm/agent-platform/values.schema.json index 925cb299..0a6c7d16 100644 --- a/helm/agent-platform/values.schema.json +++ b/helm/agent-platform/values.schema.json @@ -2984,6 +2984,9 @@ "type": "integer" } }, + "musterSessionBindingsPort": { + "type": "integer" + }, "substrate": { "type": "object", "additionalProperties": false, diff --git a/helm/agent-platform/values.yaml b/helm/agent-platform/values.yaml index fb3638c5..7c31204b 100644 --- a/helm/agent-platform/values.yaml +++ b/helm/agent-platform/values.yaml @@ -2543,6 +2543,11 @@ networkPolicy: musterInClusterMcpPorts: - 8080 - 8443 + # Port of muster's session bindings API, which agent-manager calls on its + # own port and muster admits from agent-manager alone; the chart sets it + # from muster's floor. 0 (the default) opens no egress for it: agent-manager + # then binds on muster's aggregator port. + musterSessionBindingsPort: 0 # In-cluster MCP backends an installation registers with muster (its own # MCPServer entries, e.g. through agent-platform-mcps). A ClusterIP Service # without a policy admits every pod on the cluster, and a direct call skips @@ -4103,6 +4108,27 @@ kagent: # @schema skipProperties: true; additionalProperties: true # (kagent.controllerRoute.mcp.approval there, which says why); set it here # to tighten a tool (Ask or Block). Governing tool calls: # https://docs.giantswarm.io/overview/agent-platform/governing-tool-calls/ + approval: + rule: Allow + tools: + list_sessions: Allow + invoke_session: Allow + create_session_checkpoint: Allow + list_session_checkpoints: Allow + fork_session: Allow + list_sandbox_templates: Allow + create_sandbox: Allow + list_sandboxes: Allow + get_sandbox: Allow + suspend_sandbox: Allow + resume_sandbox: Allow + delete_sandbox: Allow + start_sandbox_process: Allow + get_sandbox_process: Allow + kill_sandbox_process: Allow + read_sandbox_outputs: Allow + read_sandbox_file: Allow + write_sandbox_file: Allow # The first of the controller's two authentication layers, on by default # (docs/authentication.md, "The kagent controller route"). Renders an # AgentgatewayPolicy on the GRPCRoute (plus a static AgentgatewayBackend for diff --git a/tests/golden/meta-ci-engine-off.yaml b/tests/golden/meta-ci-engine-off.yaml index c008d30e..cd2e5b4b 100644 --- a/tests/golden/meta-ci-engine-off.yaml +++ b/tests/golden/meta-ci-engine-off.yaml @@ -716,6 +716,27 @@ spec: enabled: false mode: Strict mcp: + approval: + rule: Allow + tools: + create_sandbox: Allow + create_session_checkpoint: Allow + delete_sandbox: Allow + fork_session: Allow + get_sandbox: Allow + get_sandbox_process: Allow + invoke_session: Allow + kill_sandbox_process: Allow + list_sandbox_templates: Allow + list_sandboxes: Allow + list_session_checkpoints: Allow + list_sessions: Allow + read_sandbox_file: Allow + read_sandbox_outputs: Allow + resume_sandbox: Allow + start_sandbox_process: Allow + suspend_sandbox: Allow + write_sandbox_file: Allow description: 'Your agent sessions on this installation, as the signed-in person: list them, send one a message, and checkpoint or fork them' displayName: Kagent @@ -1264,6 +1285,7 @@ spec: musterInClusterMcpPorts: - 8080 - 8443 + musterSessionBindingsPort: 0 substrate: credentialProvider: egressFQDNs: [] diff --git a/tests/golden/meta-default.yaml b/tests/golden/meta-default.yaml index c2b8e05b..d51e162b 100644 --- a/tests/golden/meta-default.yaml +++ b/tests/golden/meta-default.yaml @@ -891,6 +891,27 @@ spec: enabled: false mode: Strict mcp: + approval: + rule: Allow + tools: + create_sandbox: Allow + create_session_checkpoint: Allow + delete_sandbox: Allow + fork_session: Allow + get_sandbox: Allow + get_sandbox_process: Allow + invoke_session: Allow + kill_sandbox_process: Allow + list_sandbox_templates: Allow + list_sandboxes: Allow + list_session_checkpoints: Allow + list_sessions: Allow + read_sandbox_file: Allow + read_sandbox_outputs: Allow + resume_sandbox: Allow + start_sandbox_process: Allow + suspend_sandbox: Allow + write_sandbox_file: Allow description: 'Your agent sessions on this installation, as the signed-in person: list them, send one a message, and checkpoint or fork them' displayName: Kagent @@ -1429,6 +1450,7 @@ spec: musterInClusterMcpPorts: - 8080 - 8443 + musterSessionBindingsPort: 0 substrate: credentialProvider: egressFQDNs: [] From 1d75eb462484f776b83915bf4f045246fb97b847 Mon Sep 17 00:00:00 2001 From: Dominik Schmidle Date: Thu, 26 Nov 2026 10:06:51 +0100 Subject: [PATCH 24/56] test(helm): check the unknown governedServers key in the schema and the template --- tests/verify-tool-approval.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/tests/verify-tool-approval.py b/tests/verify-tool-approval.py index d78abb57..5b4d8fd7 100755 --- a/tests/verify-tool-approval.py +++ b/tests/verify-tool-approval.py @@ -242,6 +242,9 @@ def check_governance() -> None: if "muster.muster.governance.servers is the earlier governance shape" not in err: fail(f"the earlier servers shape must fail:\n{err}") err = render(META_DIR, META + ["--set", FLOOR_RANGE, "--set", "governedServers.model-manager.safe_list[0]=x"], expect_fail=True) + if "governedServers" not in err or "safe_list" not in err: + fail(f"an unknown key of a source must fail in the schema naming it:\n{err}") + err = render(META_DIR, META + ["--set", FLOOR_RANGE, "--set", "governedServers.model-manager.safe_list[0]=x", "--skip-schema-validation"], expect_fail=True) if "governedServers.model-manager.safe_list: unknown key" not in err: fail(f"an unknown key of a source must fail naming it:\n{err}") connectivity = doc(render_meta([]), "HelmRelease", "agent-platform-connectivity") From 5ad19d1b4ed7b7ab910e9450f0951704dec7b32e Mon Sep 17 00:00:00 2001 From: Dominik Schmidle Date: Thu, 26 Nov 2026 10:11:40 +0100 Subject: [PATCH 25/56] fix(helm): keep the tool approval floors unset until their releases exist and read the agent chart line as migrate does A placeholder floor admitted released musters that do not enforce default: Ask, so a 3.x agent chart line could pass the render against them. The tool approval, agent approval, governance, session bindings and 2.x -> 3.x migrate floors are now unset: a floor without a release admits nothing, what it gates stays off, governed fails and every 3.x line is refused, until the platform release that pins those versions sets them. The line's major is decided as agent-manager's migrate decides it, so ~3.2, 3.1.x and bounded ranges count as 3.x, and a range spanning majors or admitting only pre-releases fails; the check runs with agent-manager off too. The verify scripts exercise the gated paths on a chart copy with test floors. --- Makefile.custom.mk | 6 +- helm/agent-platform/templates/_helpers.tpl | 87 ++++++++----- helm/agent-platform/values.yaml | 2 + tests/verify-agent-chart-line.py | 138 +++++++++++++++++---- tests/verify-tool-approval.py | 66 +++++++++- 5 files changed, 241 insertions(+), 58 deletions(-) diff --git a/Makefile.custom.mk b/Makefile.custom.mk index a953ecba..84949681 100644 --- a/Makefile.custom.mk +++ b/Makefile.custom.mk @@ -1479,9 +1479,9 @@ verify-mcp-kubernetes-registration: ## Assert the bundled mcp-kubernetes registr @echo "mcp-kubernetes registration shapes verified." .PHONY: verify-agent-chart-line -verify-agent-chart-line: ## Assert that agent-manager.agentChart.semver moves to agent chart 3.x only together with agent-manager at agent-platform.agentManager.agentChartV3Floor (its migrate rewrites muster.requireApproval to default: Ask), muster at agent-platform.muster.agentApprovalFloor (enforces it), agent-manager's tool approval on and the default agent's range on the same major; a range spanning 2.x and 3.x fails; the 3.x line reaches agent-manager, the migrate run's connectivity release and the default agent's source (giantswarm/giantswarm#38902, slice 8). Stdlib only. HELM selects the binary. - @echo "====> $@ ($(CHART_DIR))" - @HELM="$(HELM)" python3 tests/verify-agent-chart-line.py $(CHART_DIR) +verify-agent-chart-line: ## Assert that agent-manager.agentChart.semver moves to agent chart 3.x only together with agent-manager at agent-platform.agentManager.agentChartV3Floor (its migrate rewrites muster.requireApproval to default: Ask), muster at agent-platform.muster.agentApprovalFloor (enforces it), agent-manager's tool approval on and the default agent's range on the same major; a range is read as agent-manager's migrate reads it (spanning majors or only pre-releases fails, ~3.2 and bounded forms count as 3.x); the placeholder floors are unset (every 3.x line refused) or above the last release without the feature, and the gated paths run on a chart copy with test floors; the 3.x line reaches agent-manager, the migrate run's connectivity release and the default agent's source; the migrate run may list namespaces and, with organizations on, read releases, sources and Agents cluster-wide, never write them (giantswarm/giantswarm#38902, slice 8). Stdlib only. HELM selects the binary. + @echo "====> $@ ($(CHART_DIR), $(CONNECTIVITY_DIR))" + @HELM="$(HELM)" python3 tests/verify-agent-chart-line.py $(CHART_DIR) $(CONNECTIVITY_DIR) .PHONY: verify-tool-approval verify-tool-approval: ## Assert the platform side of Governing tool calls (giantswarm/giantswarm#38902): the top-level governance and governedServers values render muster's governance configuration into the muster release (muster.governance: mode, governedServers {server, role, safe} per shipped MCPServer, keyed namespace/name outside muster's namespace, an own entry standing) from the muster floor agent-platform.muster.governanceFloor, none below it, governed below it, the earlier servers shape, unknown keys and conflicting or unknown modes failing; coverage: every shipped MCPServer source (meta releases carrying muster.mcpServer, the connectivity chart's MCPServers, agent-platform-mcps' families, and the component charts beside this checkout, COMPONENT_CHECKOUTS) is governed or in governanceExempt, no floor is safe, every safe entry names a tool of its server, the two kubernetes maps agree; the redirect allowlist (portal /sessions with backstage.publicPort, klaus-gateway's return with its port, invalid ports and URLs failing); the connector-admin role binds the Giant Swarm admin groups plus tenants.platformTeam; muster-approval-binder's subjects are agent-manager's ServiceAccount only (muster.rbac.approvalBinder.subjects), none from the connectivity chart; agent-manager's muster.toolApproval.enabled on from its floor and muster's agent approval floor, off below muster's, absent below its own, an own value standing; the connectivity MCPServers carry explicit approval settings (a Block rule renders, overrides reach spec.approval also from the meta chart, null renders none, invalid values fail naming the key). Stdlib only. HELM selects the binary. diff --git a/helm/agent-platform/templates/_helpers.tpl b/helm/agent-platform/templates/_helpers.tpl index da6c2971..46721670 100644 --- a/helm/agent-platform/templates/_helpers.tpl +++ b/helm/agent-platform/templates/_helpers.tpl @@ -1702,12 +1702,13 @@ Usage: include "agent-platform.agentManager.installationModelsFloor" $root {{/* Whether the floor of components..versionRange is at least version, a release candidate of it included: "true", else empty (a range without a floor -too). +too, and an empty version: a floor whose release does not exist yet admits +nothing, so what it gates stays off). Usage: include "agent-platform.componentFloorAtLeast" (dict "root" $root "name" "" "version" "X.Y.Z") */}} {{- define "agent-platform.componentFloorAtLeast" -}} {{- $floor := regexReplaceAll "-.*$" (include "agent-platform.semverRangeFloor" (dig .name "versionRange" "" .root.Values.components)) "" -}} -{{- if and $floor (ge ((semver $floor).Compare (semver .version)) 0) -}}true{{- end -}} +{{- if and $floor .version (ge ((semver $floor).Compare (semver .version)) 0) -}}true{{- end -}} {{- end -}} {{/* @@ -2136,14 +2137,20 @@ each, no comment inside the define. {{/* The floors of tool approval per agent (slice 3): the first agent-manager whose chart takes muster.toolApproval, and the first muster that takes an -agent's approval settings with a Session binding. Placeholders until those -releases exist. One line each, no comment inside the define. +agent's approval settings with a Session binding. UNSET until those releases +exist (giantswarm/giantswarm#38902 decision #89): an empty floor admits no +release, so what it gates stays off and the agent chart line cannot move to +3.x; the platform release that pins those versions sets them. A guess would +switch the wiring on against released versions without the feature (muster +5.66.x and 5.67.0-rc.1 have no agent approval). One line each, no comment +inside the define. */}} -{{- define "agent-platform.agentManager.toolApprovalFloor" -}}3.6.0{{- end -}} -{{- define "agent-platform.muster.agentApprovalFloor" -}}5.66.0{{- end -}} +{{- define "agent-platform.agentManager.toolApprovalFloor" -}}{{- end -}} +{{- define "agent-platform.muster.agentApprovalFloor" -}}{{- end -}} {{- /* The first muster serving the session bindings API on its own port -(muster.credentialProvider.sessionBindings, decision #88). */ -}} -{{- define "agent-platform.muster.sessionBindingsPortFloor" -}}5.66.0{{- end -}} +(muster.credentialProvider.sessionBindings, decision #88); UNSET until it +exists (#89). */ -}} +{{- define "agent-platform.muster.sessionBindingsPortFloor" -}}{{- end -}} {{/* The session bindings API muster serves agent-manager alone (decision #88): @@ -2176,24 +2183,29 @@ The first agent-manager whose migrate has the Generic chart 2.x -> 3.x hop (giantswarm/giantswarm#38902, slice 8): agent chart 3.0 removes muster.requireApproval, and that migrate rewrites it to default: Ask before it moves a namespace's chart source. The same release as -agent-platform.agentManager.toolApprovalFloor; a placeholder until it exists. -One line, no comment inside the define. +agent-platform.agentManager.toolApprovalFloor; UNSET until it exists (#89), +which keeps every 3.x line refused. One line, no comment inside the define. */}} -{{- define "agent-platform.agentManager.agentChartV3Floor" -}}3.6.0{{- end -}} +{{- define "agent-platform.agentManager.agentChartV3Floor" -}}{{- end -}} {{/* -The majors a range admits among 2 and 3, as a JSON list of strings: probed with each -major's first, a middle and a late release version, which covers the forms -the agent chart line takes (x-ranges, bounds, carets, tildes). +The release majors a range admits among 0-5 and 99, as a JSON list of +strings, decided as agent-manager's migrate decides its target major +(TargetMajor): every minor 0-199 probed with its first and a late patch, and a +late minor, so x-ranges, carets, tildes and bounds all count. A range that +admits only pre-releases admits no major. Release versions only, as Flux's +semver admits them without a pre-release comparator. Usage: include "agent-platform.agentChart.majors" "" | fromJsonArray */}} {{- define "agent-platform.agentChart.majors" -}} {{- $range := toString . -}} {{- $out := list -}} -{{- range $m := list 2 3 -}} -{{- $hit := false -}} -{{- range $v := list (printf "%d.0.0" $m) (printf "%d.6.0" $m) (printf "%d.999.999" $m) -}} -{{- if semverCompare $range $v -}}{{- $hit = true -}}{{- end -}} +{{- range $m := list 0 1 2 3 4 5 99 -}} +{{- $hit := semverCompare $range (printf "%d.999999.999999" $m) -}} +{{- if not $hit -}} +{{- range $n := until 200 -}} +{{- if and (not $hit) (or (semverCompare $range (printf "%d.%d.0" $m $n)) (semverCompare $range (printf "%d.%d.999999" $m $n))) -}}{{- $hit = true -}}{{- end -}} +{{- end -}} {{- end -}} {{- if $hit -}}{{- $out = append $out (toString $m) -}}{{- end -}} {{- end -}} @@ -2210,23 +2222,35 @@ agent-manager binding it (agent-manager.muster.toolApproval, derived on from those floors). The same range reaches the agent-platform-operator, which moves every organization's chart source at once, and the migrate run; the default agent's range (components.default-agent.versionRange) moves with it. A range -spanning 2.x and 3.x is refused: migrate moves releases to one major. Emits -nothing; fails naming the key and the fix. +spanning majors, or admitting no release version, is refused, decided as +migrate decides it (agent-platform.agentChart.majors); while the two floors +are unset (#89) every 3.x line is refused. Checked whether or not agent-manager +is on: the range reaches the operator either way. Emits nothing; fails naming +the key and the fix. */}} {{- define "agent-platform.validateAgentChartLine" -}} {{- $am := index .Values "agent-manager" | default dict -}} {{- $range := dig "agentChart" "semver" "2.x" $am | toString -}} {{- $majors := include "agent-platform.agentChart.majors" $range | fromJsonArray -}} +{{- if not $majors -}} +{{- fail (printf "agent-manager.agentChart.semver %q admits no release version of the agent chart: name the line as a range of one major (\">=2.6.0 <3.0.0\"; \">=3.0.0 <4.0.0\" once it may move), never a pre-release alone" $range) -}} +{{- end -}} {{- if gt (len $majors) 1 -}} -{{- fail (printf "agent-manager.agentChart.semver %q admits agent chart 2.x and 3.x: agent-manager's migrate moves an installation's agents to exactly one major; use \">=3.0.0 <4.0.0\" (or a 2.x range)" $range) -}} +{{- fail (printf "agent-manager.agentChart.semver %q admits agent chart majors %s: agent-manager's migrate moves an installation's agents to exactly one major; bound the range below the next major (\">=3.0.0 <4.0.0\", or a 2.x range)" $range (join ", " $majors)) -}} +{{- end -}} +{{- $major := first $majors -}} +{{- if not (has $major (list "2" "3")) -}} +{{- fail (printf "agent-manager.agentChart.semver %q selects agent chart %s.x: this chart renders agents of the 2.x and 3.x lines only" $range $major) -}} {{- end -}} -{{- $v3 := has "3" $majors -}} -{{- if and $v3 (include "agent-platform.componentEnabled" (dict "root" . "name" "agent-manager")) -}} +{{- if eq $major "3" -}} {{- $amFloor := include "agent-platform.agentManager.agentChartV3Floor" . -}} +{{- $musterFloor := include "agent-platform.muster.agentApprovalFloor" . -}} +{{- if not (and $amFloor $musterFloor) -}} +{{- fail (printf "agent-manager.agentChart.semver %q moves the agents to agent chart 3.x, which removes muster.requireApproval: this chart does not know yet which releases make that safe — the agent-manager whose migrate rewrites requireApproval to default: Ask (agent-platform.agentManager.agentChartV3Floor) and the muster that enforces default: Ask (agent-platform.muster.agentApprovalFloor) are unset; keep the 2.x line until a platform release sets them" $range) -}} +{{- end -}} {{- if not (include "agent-platform.componentFloorAtLeast" (dict "root" . "name" "agent-manager" "version" $amFloor)) -}} {{- fail (printf "agent-manager.agentChart.semver %q moves the agents to agent chart 3.x, but components.agent-manager.versionRange %q admits a release below %s: agent chart 3.0 removes muster.requireApproval, and only agent-manager %s's migrate rewrites it to default: Ask before it moves a namespace's chart source; move components.agent-manager.versionRange to %s or later in the same change" $range (dig "agent-manager" "versionRange" "" .Values.components) $amFloor $amFloor $amFloor) -}} {{- end -}} -{{- $musterFloor := include "agent-platform.muster.agentApprovalFloor" . -}} {{- if not (and (include "agent-platform.componentEnabled" (dict "root" . "name" "muster")) (include "agent-platform.componentFloorAtLeast" (dict "root" . "name" "muster" "version" $musterFloor))) -}} {{- fail (printf "agent-manager.agentChart.semver %q moves the agents to agent chart 3.x, but muster is off or components.muster.versionRange %q admits a release below %s: chart 3.0 replaces muster.requireApproval with default: Ask, which only muster %s enforces; move components.muster.versionRange to %s or later in the same change" $range (dig "muster" "versionRange" "" .Values.components) $musterFloor $musterFloor $musterFloor) -}} {{- end -}} @@ -2237,8 +2261,11 @@ nothing; fails naming the key and the fix. {{- end -}} {{- if include "agent-platform.componentEnabled" (dict "root" . "name" "default-agent") -}} {{- $da := dig "default-agent" "versionRange" "" .Values.components | toString -}} -{{- if and $da (ne (has "3" (include "agent-platform.agentChart.majors" $da | fromJsonArray)) $v3) -}} -{{- fail (printf "components.default-agent.versionRange %q and agent-manager.agentChart.semver %q select different agent chart majors: the default agent is a release of the same chart and moves with the line (\">=3.0.0 <4.0.0\" for both, or a 2.x range for both)" $da $range) -}} +{{- if $da -}} +{{- $daMajors := include "agent-platform.agentChart.majors" $da | fromJsonArray -}} +{{- if ne (toJson $daMajors) (toJson $majors) -}} +{{- fail (printf "components.default-agent.versionRange %q and agent-manager.agentChart.semver %q select different agent chart majors (%s and %s): the default agent is a release of the same chart and moves with the line (\">=3.0.0 <4.0.0\" for both, or a 2.x range for both)" $da $range (join ", " $daMajors) $major) -}} +{{- end -}} {{- end -}} {{- end -}} {{- end -}} @@ -4905,14 +4932,16 @@ comment inside the define. The first muster release that reads the governance configuration (muster.governance: the mode and the servers it names per role) and enforces tool approval (Governing tool calls, slice 2 of giantswarm/giantswarm#38902). -UNRELEASED: PLACEHOLDER-GOVERNANCE-FLOOR, the one value to move to the release -that carries it (muster's tool-approval branch, giantswarm/giantswarm#38902); the +UNRELEASED: PLACEHOLDER-GOVERNANCE-FLOOR, UNSET until the release that carries +it exists (muster's tool-approval branch, giantswarm/giantswarm#38902 decision +#89: a guessed floor would render the configuration for a muster that ignores +it, so a `governed` platform would not be governed); the same floor gates the approval block and the redirect allowlist entries below (agent-platform.muster.approval, agent-platform.muster.redirectAllowlist), and tests/verify-tool-approval.py takes it from here. Below it the meta chart forwards none of them. One line, no comment inside the define. */}} -{{- define "agent-platform.muster.governanceFloor" -}}5.65.0{{- end -}} +{{- define "agent-platform.muster.governanceFloor" -}}{{- end -}} {{/* The platform's governance mode (top-level `governance`: trusted, the default, diff --git a/helm/agent-platform/values.yaml b/helm/agent-platform/values.yaml index 7c31204b..18dc6f35 100644 --- a/helm/agent-platform/values.yaml +++ b/helm/agent-platform/values.yaml @@ -5395,6 +5395,8 @@ agent-manager: # @schema skipProperties: true; additionalProperties: true # (muster enforces default: Ask), agent-manager's tool approval on and the # default agent's range on 3.x: move all of them in one change # (agent-platform.validateAgentChartLine, make verify-agent-chart-line). + # Both floors are unset until those releases exist, so every 3.x range is + # refused for now (UPGRADE.md). semver: ">=2.6.0 <3.0.0" # Deprecated: set skillManager.sources. Read only while agent-manager does # not pin through the skill-manager (components.skill-manager off, or diff --git a/tests/verify-agent-chart-line.py b/tests/verify-agent-chart-line.py index d3458b0c..75754e3b 100755 --- a/tests/verify-agent-chart-line.py +++ b/tests/verify-agent-chart-line.py @@ -17,7 +17,12 @@ its floor, with agent-manager.muster.toolApproval.enabled false, with the default agent's range on the other major, and a range spanning both majors is refused; the default agent on 3.x with the line on 2.x is refused too; -- agentChartV3Floor is the tool approval floor's release (one X.Y.Z each). +- the placeholder floors (agent approval, the hop, governance, session + bindings) are unset or above the last release without the feature; while + the hop's or muster's floor is unset every 3.x range is refused, whatever + its form (~3.2, 3.1.x, bounds), a pre-release alone and >=3.0.0 (spans + majors, as migrate says) too; the gated paths run on a copy of the chart + with test floors. Stdlib only: documents are matched by text. Usage: verify-agent-chart-line.py @@ -27,10 +32,13 @@ import os import re +import shutil import subprocess import sys +import tempfile META = sys.argv[1] +CONN = sys.argv[2] if len(sys.argv) > 2 else "" HELM = os.environ.get("HELM") or "helm" BASE = [ "--namespace", "agent-platform", @@ -77,21 +85,54 @@ def refused(what: str, needle: str, *args: str) -> None: fail(f"{what}: not refused with {needle!r}:\n{r.stderr[-600:]}") -def floor(name: str) -> str: - text = open(os.path.join(META, "templates", "_helpers.tpl"), encoding="utf-8").read() +# The releases that do not carry what the 3.x line needs: a floor at or below +# them would let a 3.x line through against a muster that ignores default: Ask +# or an agent-manager whose migrate has no 2.x -> 3.x hop (M3-S8-01). +LAST_WITHOUT = {"muster.agentApprovalFloor": (5, 67, 0), "agentManager.agentChartV3Floor": (3, 5, 8), + "agentManager.toolApprovalFloor": (3, 5, 8), "muster.governanceFloor": (5, 67, 0), + "muster.sessionBindingsPortFloor": (5, 67, 0)} +PLACEHOLDERS = list(LAST_WITHOUT) +# Test values for the floors in a copy of the chart, so the paths they gate +# are exercised while the chart itself keeps them unset. +TEST_FLOORS = {"muster.agentApprovalFloor": "5.68.0", "agentManager.agentChartV3Floor": "3.6.0", + "agentManager.toolApprovalFloor": "3.6.0", "muster.governanceFloor": "5.68.0", + "muster.sessionBindingsPortFloor": "5.68.0"} +BYPASS = ["~3.2", "3.1.x", ">=3.1.0 <3.6.0", "3.0.0-rc.6", ">=3.0.0", "3.x", V3] + + +def floor_value(chart: str, name: str) -> str | None: + text = open(os.path.join(chart, "templates", "_helpers.tpl"), encoding="utf-8").read() m = re.search(r'\{\{- define "agent-platform\.' + re.escape(name) + r'" -\}\}([^{]*)\{\{- end -\}\}', text) - if not m or not re.fullmatch(r"\d+\.\d+\.\d+", m.group(1)): - fail(f"agent-platform.{name} is not one X.Y.Z") - return "0.0.0" + if not m: + fail(f"agent-platform.{name}: no one-line define") + return None return m.group(1) -am_floor = floor("agentManager.agentChartV3Floor") -muster_floor = floor("muster.agentApprovalFloor") -if am_floor != floor("agentManager.toolApprovalFloor"): - fail(f"agentManager.agentChartV3Floor {am_floor} is not the tool approval floor's release") -am = [a.replace("{floor}", am_floor) for a in AM] -muster = [a.replace("{floor}", muster_floor) for a in MUSTER] +def with_floors(dst: str) -> str: + chart = os.path.join(dst, "agent-platform") + shutil.copytree(META, chart) + path = os.path.join(chart, "templates", "_helpers.tpl") + text = open(path, encoding="utf-8").read() + for name, v in TEST_FLOORS.items(): + text, n = re.subn(r'(\{\{- define "agent-platform\.' + re.escape(name) + r'" -\}\})[^{]*(\{\{- end -\}\})', r"\g<1>" + v + r"\g<2>", text) + if n != 1: + fail(f"agent-platform.{name}: cannot set the test floor") + open(path, "w", encoding="utf-8").write(text) + return chart + + +# The chart's own floors: unset until the releases exist, else above the last +# release without the feature. +for name in PLACEHOLDERS: + v = floor_value(META, name) + if v is None or v == "": + continue + if not re.fullmatch(r"\d+\.\d+\.\d+", v): + fail(f"agent-platform.{name} {v!r} is neither unset nor one X.Y.Z") + elif tuple(map(int, v.split("."))) <= LAST_WITHOUT[name]: + fail(f"agent-platform.{name} {v} admits a release without the feature (last without it: {'.'.join(map(str, LAST_WITHOUT[name]))})") +unset = not floor_value(META, "agentManager.agentChartV3Floor") or not floor_value(META, "muster.agentApprovalFloor") out = renders("default") if V3 in out: @@ -99,17 +140,68 @@ def floor(name: str) -> str: if "'>=2.6.0 <3.0.0'" not in out and '">=2.6.0 <3.0.0"' not in out: fail("the default render does not carry the 2.x line") -out = renders("3.x line with its floors", *LINE, *am, *muster, *DEFAULT_AGENT) -if out.count(V3) < 3: - fail(f"the 3.x line reaches {out.count(V3)} places; want agent-manager's release, the connectivity release and the default agent's source") - -refused("3.x line, agent-manager below its floor", f"admits a release below {am_floor}", *LINE, *muster, *DEFAULT_AGENT) -refused("3.x line, muster below its floor", f"admits a release below {muster_floor}", *LINE, *am, *DEFAULT_AGENT) -refused("3.x line, tool approval off", "agent-manager.muster.toolApproval.enabled is false", - *LINE, *am, *muster, *DEFAULT_AGENT, "--set", "agent-manager.muster.toolApproval.enabled=false") -refused("3.x line, default agent on 2.x", "select different agent chart majors", *LINE, *am, *muster) -refused("2.x line, default agent on 3.x", "select different agent chart majors", *DEFAULT_AGENT) -refused("range spanning both majors", "admits agent chart 2.x and 3.x", "--set", "agent-manager.agentChart.semver=>=2.6.0") +# Ranges the guard must read as migrate does, on the chart as it is. +for r in ["~3.2", "3.1.x", ">=3.1.0 <3.6.0", "3.x", V3]: + if unset: + refused(f"{r} while the floors are unset", "are unset; keep the 2.x line", "--set", f"agent-manager.agentChart.semver={r}") + else: + refused(f"{r} below the floors", "admits a release below", "--set", f"agent-manager.agentChart.semver={r}") +refused("a pre-release alone", "admits no release version", "--set", "agent-manager.agentChart.semver=3.0.0-rc.6") +refused(">=3.0.0 spans majors as for migrate", "admits agent chart majors 3, 4, 5, 99", "--set", "agent-manager.agentChart.semver=>=3.0.0") +refused("range spanning 2.x and 3.x", "admits agent chart majors 2, 3", "--set", "agent-manager.agentChart.semver=>=2.6.0") +refused("3.x with agent-manager off: the operator still gets the range", "keep the 2.x line" if unset else "admits a release below", + "--set", "components.agent-manager.enabled=false", "--set", f"agent-manager.agentChart.semver={V3}") + +# With the floors set (a copy of the chart), the gated paths. +with tempfile.TemporaryDirectory() as tmp: + META = with_floors(tmp) + am = [a.replace("{floor}", TEST_FLOORS["agentManager.agentChartV3Floor"]) for a in AM] + muster = [a.replace("{floor}", TEST_FLOORS["muster.agentApprovalFloor"]) for a in MUSTER] + out = renders("3.x line with its floors", *LINE, *am, *muster, *DEFAULT_AGENT) + if out.count(V3) < 3: + fail(f"the 3.x line reaches {out.count(V3)} places; want agent-manager's release, the connectivity release and the default agent's source") + for r in ["~3.2", "3.1.x", ">=3.1.0 <3.6.0"]: + renders(f"{r} with its floors", "--set", f"agent-manager.agentChart.semver={r}", *am, *muster, "--set", f"components.default-agent.versionRange={r}") + refused(f"{r}, muster below its floor", "admits a release below 5.68.0", "--set", f"agent-manager.agentChart.semver={r}", *am, "--set", f"components.default-agent.versionRange={r}") + refused("3.x line, agent-manager below its floor", "admits a release below 3.6.0", *LINE, *muster, *DEFAULT_AGENT) + refused("3.x line, muster below its floor", "admits a release below 5.68.0", *LINE, *am, *DEFAULT_AGENT) + refused("3.x line, tool approval off", "agent-manager.muster.toolApproval.enabled is false", + *LINE, *am, *muster, *DEFAULT_AGENT, "--set", "agent-manager.muster.toolApproval.enabled=false") + refused("3.x line, default agent on 2.x", "select different agent chart majors", *LINE, *am, *muster) + refused("2.x line, default agent on 3.x", "select different agent chart majors", *DEFAULT_AGENT) + +# The migrate run reads organization namespaces on the 3.x path (M3-S8-06): +# list on namespaces always, cluster-wide reads of releases, sources and Agents +# with organizations on, no write anywhere outside its own namespaces. +if CONN: + conn_base = [HELM, "template", "t", CONN, "-n", "agent-platform", "-f", f"{CONN}/ci/test-substrate-values.yaml", + "-f", f"{CONN}/ci/test-llm-routing-values.yaml", "-f", os.path.join(os.path.dirname(__file__), "fixtures", "organizations-operator-values.yaml"), + "--set", "kagent.fluxServiceAccountName=kagent-flux", "--set", "global.domain=ci.example.com", + "--set", "components.agent-manager.enabled=true", "--set", "global.identity.issuerUrl=https://dex.ci.example.com", + "--set", "global.identity.clientId=platform", "--set", "global.identity.existingSecret=platform-oauth", + "--api-versions", "admissionregistration.k8s.io/v1/MutatingAdmissionPolicy"] + + def migrate_cluster_rules(*args: str) -> str: + r = subprocess.run([*conn_base, *args], capture_output=True, text=True) + if r.returncode != 0: + fail(f"connectivity render {args} failed:\n{r.stderr[-600:]}") + return "" + found = [d for d in r.stdout.split("\n---\n") if "\nkind: ClusterRole\n" in "\n" + d and "-agent-manager-migrate-crds\n" in d] + return found[0] if found else "" + + off = migrate_cluster_rules() + on = migrate_cluster_rules("--set", "agentPlatformOrganizations.enabled=true") + if 'resources: ["namespaces"]\n verbs: ["list"]' not in off or 'resources: ["namespaces"]\n verbs: ["list"]' not in on: + fail("the migrate run may not list namespaces (it must see the organization namespaces on the 3.x path)") + if "helm.toolkit.fluxcd.io" in off: + fail("without organizations the migrate run needs no cluster-wide release read") + for want in ('resources: ["helmreleases"]\n verbs: ["get", "list"]', 'resources: ["ocirepositories"]\n verbs: ["get", "list"]', 'resources: ["agents"]\n verbs: ["get", "list"]'): + if want not in on: + fail(f"with organizations the migrate run's ClusterRole lacks {want!r}") + for verb in ("create", "update", "patch", "delete"): + rules = on.split("Organization namespaces", 1)[-1] + if f'"{verb}"' in rules: + fail(f"the migrate run's organization reads carry {verb}") if failures: for f in failures: diff --git a/tests/verify-tool-approval.py b/tests/verify-tool-approval.py index 5b4d8fd7..d1070093 100755 --- a/tests/verify-tool-approval.py +++ b/tests/verify-tool-approval.py @@ -56,10 +56,13 @@ """ from __future__ import annotations +import atexit import os import re +import shutil import subprocess import sys +import tempfile HELM = os.environ.get("HELM", "helm") FLOOR_RANGE = "" # set in main from agent-platform.muster.governanceFloor @@ -85,13 +88,16 @@ def governance_floor(meta_dir: str) -> str: """The value of agent-platform.muster.governanceFloor, and its one marker.""" text = open(os.path.join(meta_dir, "templates", "_helpers.tpl")).read() - m = re.search(r'define "agent-platform\.muster\.governanceFloor" -\}\}([0-9]+\.[0-9]+\.[0-9]+)\{\{-', text) + m = re.search(r'define "agent-platform\.muster\.governanceFloor" -\}\}((?:[0-9]+\.[0-9]+\.[0-9]+)?)\{\{-', text) if not m: - fail("agent-platform.muster.governanceFloor must be one line holding one X.Y.Z") + fail("agent-platform.muster.governanceFloor must be one line holding one X.Y.Z, or nothing while its release does not exist") + if not m.group(1): + print("note: the governance floor is unset (PLACEHOLDER-GOVERNANCE-FLOOR): nothing it gates renders; set it in the platform release that pins the muster release carrying tool approval") + return "" markers = text.count("PLACEHOLDER-GOVERNANCE-FLOOR") if markers > 1: fail("the governance floor placeholder must be marked at most once (PLACEHOLDER-GOVERNANCE-FLOOR) next to its define") - if markers: + if markers and m.group(1): print(f"note: the governance floor {m.group(1)} is still a placeholder (PLACEHOLDER-GOVERNANCE-FLOOR): move it to the muster release that carries tool approval before releasing") values = open(os.path.join(meta_dir, "values.yaml")).read() if f">={m.group(1)}" in values: @@ -669,8 +675,62 @@ def check_approval() -> None: print("ok: mcp-kubernetes carries the Recommended settings, kagent the Allow all settings, a Block rule renders, overrides reach spec.approval (also from the meta chart), null renders none, invalid values fail naming the key") +# Test values for the floors this file's checks need, set in a copy of the +# chart while the chart keeps them unset until their releases exist +# (giantswarm/giantswarm#38902 decision #89). +TEST_FLOORS = {"muster.governanceFloor": "5.65.0", "muster.agentApprovalFloor": "5.66.0", + "agentManager.toolApprovalFloor": "3.6.0", "muster.sessionBindingsPortFloor": "5.66.0"} + + +def with_test_floors(meta_dir: str, dst: str) -> str: + """A copy of the meta chart with every unset floor of TEST_FLOORS set.""" + chart = os.path.join(dst, "agent-platform") + shutil.copytree(meta_dir, chart) + path = os.path.join(chart, "templates", "_helpers.tpl") + text = open(path).read() + for name, v in TEST_FLOORS.items(): + text, n = re.subn(r'(\{\{- define "agent-platform\.' + re.escape(name) + r'" -\}\})(\{\{- end -\}\})', r"\g<1>" + v + r"\g<2>", text) + if n == 0 and f'define "agent-platform.{name}" -}}}}{{{{- end' not in text and not re.search(r'define "agent-platform\.' + re.escape(name) + r'" -\}\}[0-9]', text): + fail(f"agent-platform.{name}: no one-line define") + open(path, "w").write(text) + return chart + + +def check_unset_floors_keep_everything_off() -> None: + """On the chart as it is: a floor whose release does not exist gates its + wiring off whatever the component ranges say (M3-S8-01).""" + high = ["--set", "components.muster.versionRange=>=5.99.0 <6.0.0-0", "--set", "components.agent-manager.versionRange=>=3.99.0 <4.0.0-0", + "--set", "components.agent-manager.enabled=true"] + text = open(os.path.join(META_DIR, "templates", "_helpers.tpl")).read() + unset = [n for n in TEST_FLOORS if re.search(r'define "agent-platform\.' + re.escape(n) + r'" -\}\}\{\{- end', text)] + if not unset: + return + out = render_meta(high) + muster, am = doc(out, "HelmRelease", "muster"), doc(out, "HelmRelease", "agent-manager") + if "muster.governanceFloor" in unset: + if block(muster, " governance:"): + fail("with the governance floor unset the muster release must carry no governance configuration") + err = render_meta_fail(high + ["--set", "governance=governed"]) + if "governed" not in err: + fail(f"with the governance floor unset `governed` must fail:\n{err}") + if "muster.agentApprovalFloor" in unset and "enabled: true" in block(am, " toolApproval:"): + fail("with muster's agent approval floor unset agent-manager must bind no settings") + if "muster.sessionBindingsPortFloor" in unset and block(muster, " sessionBindings:"): + fail("with the session bindings floor unset muster must keep its earlier bindings wiring") + print(f"ok: unset floors ({', '.join(unset)}) keep what they gate off for any muster and agent-manager range; `governed` fails") + + +def render_meta_fail(args: list[str]) -> str: + return render(META_DIR, META + args, expect_fail=True) + + if __name__ == "__main__": META_DIR, CONN_DIR = sys.argv[1], sys.argv[2] + governance_floor(META_DIR) + check_unset_floors_keep_everything_off() + _tmp = tempfile.mkdtemp(prefix="verify-tool-approval-") + atexit.register(shutil.rmtree, _tmp, True) + META_DIR = with_test_floors(META_DIR, _tmp) FLOOR_RANGE = f"components.muster.versionRange=>={governance_floor(META_DIR)} <6.0.0-0" check_governance() check_write_like() From 27c0db1b881c986f0e97fb854632b110b9cee736 Mon Sep 17 00:00:00 2001 From: Dominik Schmidle Date: Thu, 26 Nov 2026 10:11:40 +0100 Subject: [PATCH 26/56] feat(helm): let the migrate run read organization namespaces On the agent chart 2.x -> 3.x path agent-manager's migrate lists the organization namespaces and reports their releases before the agent-platform-operator moves their sources. Its identity may list namespaces and, with organizations on, read HelmReleases, OCIRepositories and Agents cluster-wide; it writes none of them. --- .../templates/kagent/migrate-rbac.yaml | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/helm/agent-platform-connectivity/templates/kagent/migrate-rbac.yaml b/helm/agent-platform-connectivity/templates/kagent/migrate-rbac.yaml index b600b11b..ab91b168 100644 --- a/helm/agent-platform-connectivity/templates/kagent/migrate-rbac.yaml +++ b/helm/agent-platform-connectivity/templates/kagent/migrate-rbac.yaml @@ -106,6 +106,25 @@ rules: - apiGroups: ["kagent.dev"] resources: {{ $legacyCRDs | toJson }} verbs: ["list"] + # Organization namespaces (giantswarm/giantswarm#38902, slice 8): on the + # agent chart 2.x -> 3.x path the run lists the namespaces labelled as an + # organization's and fails when it may not; it reads their releases, chart + # sources and Agents, never writes them, and reports what needs changing + # before the agent-platform-operator moves their sources. + - apiGroups: [""] + resources: ["namespaces"] + verbs: ["list"] + {{- if include "agent-platform.organizations.enabled" . }} + - apiGroups: ["helm.toolkit.fluxcd.io"] + resources: ["helmreleases"] + verbs: ["get", "list"] + - apiGroups: ["source.toolkit.fluxcd.io"] + resources: ["ocirepositories"] + verbs: ["get", "list"] + - apiGroups: ["api.kagent.dev"] + resources: ["agents"] + verbs: ["get", "list"] + {{- end }} --- apiVersion: rbac.authorization.k8s.io/v1 kind: ClusterRoleBinding From e5bee96e9c93071fa4620cb9787417ffedbb85e3 Mon Sep 17 00:00:00 2001 From: Dominik Schmidle Date: Thu, 26 Nov 2026 10:11:40 +0100 Subject: [PATCH 27/56] docs: upgrade notes for unset floors, mandatory migrate check and running sessions on agent chart 3.0 --- UPGRADE.md | 12 ++++++++---- skills/agent-platform-agent-management/SKILL.md | 8 +++++--- 2 files changed, 13 insertions(+), 7 deletions(-) diff --git a/UPGRADE.md b/UPGRADE.md index 41b14c92..a9ab1bd2 100644 --- a/UPGRADE.md +++ b/UPGRADE.md @@ -19,14 +19,18 @@ A CRD version change that needs more than an apply (a stored version dropped, as giantswarm/giantswarm#38902, slice 8: agent chart 3.0 removes `muster.requireApproval` (kagent's flag that paused an agent before every tool call) and the default of `modelConfig.name`. `default: Ask` replaces `requireApproval: true`: muster asks a person before every tool call the agent makes through it, from every client, and nothing asks twice. `agent-manager.agentChart.semver` moves the agents of the whole installation: agent-manager composes new agents on it, its migrate run (the connectivity release's start hook) moves the existing ones, and the agent-platform-operator moves every organization's chart source at once. -The render allows the 3.x line only together with what makes it safe (`make verify-agent-chart-line`): agent-manager at `agent-platform.agentManager.agentChartV3Floor`, whose migrate has the 2.x → 3.x hop, muster at `agent-platform.muster.agentApprovalFloor`, which enforces `default: Ask`, agent-manager's tool approval on (`agent-manager.muster.toolApproval.enabled` unset) and the default agent's range on the same major. The migrate run writes each release's 3.x values (`muster.requireApproval: true` → `default: Ask` where the muster binding renders, the key dropped, an unset `modelConfig.name` spelled out as the 2.x default `default-model-config`) before it moves the namespace's source, and only once a 3.x chart is published. +The render allows the 3.x line only together with what makes it safe (`make verify-agent-chart-line`): agent-manager at `agent-platform.agentManager.agentChartV3Floor`, whose migrate has the 2.x → 3.x hop, muster at `agent-platform.muster.agentApprovalFloor`, which enforces `default: Ask`, agent-manager's tool approval on (`agent-manager.muster.toolApproval.enabled` unset) and the default agent's range on the same major. **Both floors are unset in this chart** until the muster and agent-manager releases carrying tool approval exist, so every 3.x range is refused for now, whatever its form (`3.x`, `~3.2`, `>=3.1.0 <3.6.0`); the platform release that pins those versions sets them. The same goes for the other floors of tool approval (`agent-platform.agentManager.toolApprovalFloor`, `agent-platform.muster.governanceFloor`, `agent-platform.muster.sessionBindingsPortFloor`): unset, what they gate stays off and `governance: governed` fails. The range is read as agent-manager's migrate reads it: a range admitting two majors (`>=3.0.0`) or only pre-releases fails. + +The migrate run writes each release's 3.x values (`muster.requireApproval: true` → `default: Ask` where the muster binding renders, the key dropped, an unset `modelConfig.name` spelled out as the 2.x default `default-model-config`) only once a 3.x chart is published and only where it moves the namespace's source in the same run. It writes no release with `spec.valuesFrom` (reported `failed` with what to change), none whose source it cannot move (pinned, owned by git, the platform's: `pending` with the diff), and nothing in organization namespaces, whose releases it reports with diffs; any of them keeps the report in the expand phase. ### Operator action -- Move these in one change: `agent-manager.agentChart.semver` and `components.default-agent.versionRange` to `>=3.0.0 <4.0.0`, `components.agent-manager.versionRange` and `components.muster.versionRange` to the floors above or later. Any one alone fails the render. +- Once the floors are set: move `agent-manager.agentChart.semver` and `components.default-agent.versionRange` to `>=3.0.0 <4.0.0` together with `components.agent-manager.versionRange` and `components.muster.versionRange` at or above the floors. The render refuses the line without the two component floors, without tool approval, or with the default agent on the other major; moving the component ranges alone renders. - Tool approval's prerequisites must hold (muster's OAuth server with Dex sign-in, Valkey storage; the entry below): without them muster refuses every call that asks, so an agent migrated to `default: Ask` cannot call its tools until they hold. It never runs them unasked. -- Before the upgrade, find the releases the migrate run cannot rewrite, the ones owned by git (a GitOps-owned release in a managed namespace gets its rewrite as a diff in the report ConfigMap `agent-manager-migrate-report`) and any agent release in an organization namespace written outside agent-manager: `kubectl get helmreleases -A -o json | jq -r '.items[] | select(.spec.values.muster.requireApproval != null or .spec.values.modelConfig.name == null) | "\(.metadata.namespace)/\(.metadata.name)"'`. In git, replace `muster.requireApproval: true` with `default: Ask`, drop `requireApproval: false`, and set `modelConfig.name` where it is unset, together with the move of that release's chart source to 3.x. An organization's source moves with the platform release: a release there that still carries `muster.requireApproval` fails its 3.x render and stays on its 2.x revision, still asking through kagent, until its values change; one without `modelConfig.name` renders without a model. -- Read the report after the run: `kubectl -n get configmap agent-manager-migrate-report -o jsonpath='{.data.report\.yaml}'`; each rewritten release lists `changes.removed` and `changes.set`. A release carrying `requireApproval: true` beside tool approval settings is reported failed (that combination never rendered) and holds its chart source; set its settings by hand. +- **Mandatory before the upgrade:** run `agent-manager migrate --dry-run` against the target range (or read the report of the platform release that carries agent-manager's floor) and fix every release it lists. The agent-platform-operator moves every organization's chart source at once with the range, and nothing holds it: a release there that still carries `muster.requireApproval` fails its 3.x render and stays on its 2.x revision, still asking through kagent, until fixed; one without `modelConfig.name` renders without a model. Also check releases whose values come from `valuesFrom`: `kubectl get helmreleases -A -o json | jq -r '.items[] | select(.spec.values.muster.requireApproval != null or .spec.values.modelConfig.name == null or (.spec.valuesFrom // [] | length > 0)) | "\(.metadata.namespace)/\(.metadata.name)"'` and the ConfigMaps or Secrets they name. +- The repair is always **replace `muster.requireApproval: true` with `default: Ask`**, never just delete the key (that turns the agent's asks off); drop `requireApproval: false` and `null`; set `modelConfig.name` where it is unset. In git, apply it together with the move of that release's chart source to 3.x; for `valuesFrom`, move the settings into `spec.values` (agent-manager binds settings only from there). +- Running Sessions: agent-manager binds a Session of an agent on `muster.requireApproval: true` with `default: Ask` already on 2.x (such an agent is asked twice there, by kagent and by muster, until it is migrated), so Sessions running across the upgrade keep asking. A Session started by an agent-manager below `agent-platform.agentManager.toolApprovalFloor` carries no settings and muster applies the agent's re-rendered `X-Muster-Tool-Approval: default=Ask`. +- Read the report after the run: `kubectl -n get configmap agent-manager-migrate-report -o jsonpath='{.data.report\.yaml}'`; each rewritten release lists `changes.removed` and `changes.set`. A release carrying `requireApproval: true` beside tool approval settings is reported failed (no released chart renders that combination) and holds its chart source; set its settings by hand. The run needs list on namespaces and read access in organization namespaces; without them it fails and changes nothing (`--organization-namespaces none` skips them, leaving them unchecked). ## \ → \ (tool approval and the governance mode) diff --git a/skills/agent-platform-agent-management/SKILL.md b/skills/agent-platform-agent-management/SKILL.md index ab430746..e2d51206 100644 --- a/skills/agent-platform-agent-management/SKILL.md +++ b/skills/agent-platform-agent-management/SKILL.md @@ -152,9 +152,11 @@ never assume an argument. The agent tools drop an unknown key without an error: save it. A save's `sessionsUpdated: false` and `warnings` mean running sessions still carry a dropped exception until agent-manager tells muster again: say so. A governed platform's asks cannot be lifted per agent. To make an agent ask before every call, set `default: Ask` - (`set_agent_approval`). Agent chart 3.0 removed `muster.requireApproval`: agent-manager's - migrate rewrote `true` to `default: Ask`, and a release that still carries the key fails its 3.x - render and stays on its 2.x revision; never write it. + (`set_agent_approval`). Agent chart 3.0 removes `muster.requireApproval`: agent-manager's + migrate rewrites `true` to `default: Ask` in the releases it owns and reports the others + (GitOps, `valuesFrom`, organization namespaces) in its report: check it. A release that still + carries the key fails its 3.x render and stays on its 2.x revision; the fix is replacing it with + `default: Ask`, never deleting it. Never write the key. - **An organization's connectors**: a kagent `RemoteMCPServer` in the organization namespace (`x_agent-manager_set_organization_connector`), not a Muster server, so no `toolset` selector reaches it. From agent-manager 3.3.0 (`connectors` in `x_agent-manager_create_agent`'s schema; From 56c776a2f69a97ee740d3b55151c0ef383d69097 Mon Sep 17 00:00:00 2001 From: Dominik Schmidle Date: Thu, 26 Nov 2026 10:31:09 +0100 Subject: [PATCH 28/56] fix(helm): tighten the agent chart line guard, scope the migrate reads to a 3.x line and refuse muster's own governance below the floor The guard refuses a range whose bound admits a pre-release of the next major (Flux would serve it), probes majors 0-99 as migrate does, and names a value that is no semver range. A component range with || is held to its lowest alternative's floor. The migrate identity lists namespaces and reads organization releases, sources and Agents only while the line is 3.x, and lists Agents rather than getting them. With the governance floor unset an own muster.muster.governance fails, and governed says why without an empty floor in the message. --- .../templates/kagent/_migrate.tpl | 17 +++++ .../templates/kagent/migrate-rbac.yaml | 15 ++++- helm/agent-platform/templates/_helpers.tpl | 66 +++++++++++++++---- tests/verify-agent-chart-line.py | 57 ++++++++++++---- tests/verify-tool-approval.py | 8 ++- 5 files changed, 132 insertions(+), 31 deletions(-) diff --git a/helm/agent-platform-connectivity/templates/kagent/_migrate.tpl b/helm/agent-platform-connectivity/templates/kagent/_migrate.tpl index 9e8f714b..fc830585 100644 --- a/helm/agent-platform-connectivity/templates/kagent/_migrate.tpl +++ b/helm/agent-platform-connectivity/templates/kagent/_migrate.tpl @@ -127,3 +127,20 @@ fi kubectl -n {{ .namespace }} create job {{ .job }} --from=cronjob/{{ .cronJob }} echo "{{ .job }} started; its outcome: kubectl -n {{ .namespace }} get job {{ .job }}, the ConfigMap agent-manager-migrate-report" {{- end -}} + +{{/* +Truthy when agent-manager.agentChart.semver (as the migrate run takes it) is a +3.x line: the run then takes the 2.x -> 3.x path and reads the organization +namespaces (migrate-rbac.yaml). Probes 3.x as agent-manager's migrate does. +*/}} +{{- define "agent-platform.kagent.migration.v3Line" -}} +{{- $am := include "agent-platform.agentManager.chartValues" . | fromJson -}} +{{- $range := dig "agentChart" "semver" "2.x" $am | toString -}} +{{- if and (regexMatch "[0-9]" $range) (not (regexMatch "(^|[\\s|,<>=~^])[A-Za-uwyzA-WYZ]" $range)) -}} +{{- $hit := or (semverCompare $range "3.0.0") (semverCompare $range "3.999999.999999") -}} +{{- range $n := until 200 -}} +{{- if and (not $hit) (or (semverCompare $range (printf "3.%d.0" $n)) (semverCompare $range (printf "3.%d.999999" $n))) -}}{{- $hit = true -}}{{- end -}} +{{- end -}} +{{- if $hit -}}true{{- end -}} +{{- end -}} +{{- end -}} diff --git a/helm/agent-platform-connectivity/templates/kagent/migrate-rbac.yaml b/helm/agent-platform-connectivity/templates/kagent/migrate-rbac.yaml index ab91b168..8fb11dca 100644 --- a/helm/agent-platform-connectivity/templates/kagent/migrate-rbac.yaml +++ b/helm/agent-platform-connectivity/templates/kagent/migrate-rbac.yaml @@ -17,7 +17,16 @@ ClusterRoleBinding to this ServiceAccount, holds exactly that: get and delete on customresourcedefinitions confined by resourceNames to those nine CRDs, and a cluster-wide list on their kagent.dev resources, which proves a CRD empty before it goes. verify-flux-identity asserts these rights and no other -cluster-scoped binding of the identity. +cluster-scoped binding of the identity on the 2.x line. + +Only while agent-manager.agentChart.semver is a 3.x line (the 2.x -> 3.x path, +giantswarm/giantswarm#38902 slice 8) the same ClusterRole also lets the run +list namespaces (it finds the organization namespaces by label and fails when +it may not) and, with agentPlatformOrganizations.enabled, list and get the +HelmReleases and OCIRepositories and list the Agents it reads there, never +writing them (agent-platform.kagent.migration.v3Line). The operator mirrors no +binding of this identity into organization namespaces, so the reads are +cluster-wide; they exist only for the cut-over run. Per namespace in agentManager.migration.gitopsNamespaces (the fleet: flux-giantswarm, where the GitOps-owned agents' HelmReleases and @@ -111,6 +120,7 @@ rules: # organization's and fails when it may not; it reads their releases, chart # sources and Agents, never writes them, and reports what needs changing # before the agent-platform-operator moves their sources. + {{- if include "agent-platform.kagent.migration.v3Line" . }} - apiGroups: [""] resources: ["namespaces"] verbs: ["list"] @@ -123,7 +133,8 @@ rules: verbs: ["get", "list"] - apiGroups: ["api.kagent.dev"] resources: ["agents"] - verbs: ["get", "list"] + verbs: ["list"] + {{- end }} {{- end }} --- apiVersion: rbac.authorization.k8s.io/v1 diff --git a/helm/agent-platform/templates/_helpers.tpl b/helm/agent-platform/templates/_helpers.tpl index 46721670..9484e082 100644 --- a/helm/agent-platform/templates/_helpers.tpl +++ b/helm/agent-platform/templates/_helpers.tpl @@ -2189,20 +2189,20 @@ which keeps every 3.x line refused. One line, no comment inside the define. {{- define "agent-platform.agentManager.agentChartV3Floor" -}}{{- end -}} {{/* -The release majors a range admits among 0-5 and 99, as a JSON list of -strings, decided as agent-manager's migrate decides its target major -(TargetMajor): every minor 0-199 probed with its first and a late patch, and a -late minor, so x-ranges, carets, tildes and bounds all count. A range that -admits only pre-releases admits no major. Release versions only, as Flux's -semver admits them without a pre-release comparator. +The release majors a range admits, as a JSON list of strings, decided as +agent-manager's migrate decides its target major (TargetMajor): majors 0-99, +each probed with its first and a very late version, majors 0-9 also with every +minor 0-199 (first and late patch), so x-ranges, carets, tildes and bounds all +count. A range that admits only pre-releases admits no major. Release versions +only, as Flux's semver admits them without a pre-release comparator. Usage: include "agent-platform.agentChart.majors" "" | fromJsonArray */}} {{- define "agent-platform.agentChart.majors" -}} {{- $range := toString . -}} {{- $out := list -}} -{{- range $m := list 0 1 2 3 4 5 99 -}} -{{- $hit := semverCompare $range (printf "%d.999999.999999" $m) -}} -{{- if not $hit -}} +{{- range $m := until 100 -}} +{{- $hit := or (semverCompare $range (printf "%d.0.0" $m)) (semverCompare $range (printf "%d.999999.999999" $m)) -}} +{{- if and (not $hit) (lt $m 10) -}} {{- range $n := until 200 -}} {{- if and (not $hit) (or (semverCompare $range (printf "%d.%d.0" $m $n)) (semverCompare $range (printf "%d.%d.999999" $m $n))) -}}{{- $hit = true -}}{{- end -}} {{- end -}} @@ -2212,6 +2212,21 @@ Usage: include "agent-platform.agentChart.majors" "" | fromJsonArray {{- $out | toJson -}} {{- end -}} +{{/* +The first pre-release of the next major a range admits (e.g. 3.0.0-rc.1 under +">=2.6.0 <=3.0.0-rc.1"), or empty: Flux would serve that chart under a range +read as the lower major. Takes a dict: range, major (the one major found). +*/}} +{{- define "agent-platform.agentChart.nextMajorPreRelease" -}} +{{- $next := add1 (atoi .major) -}} +{{- $found := "" -}} +{{- range $pre := list "0" "alpha.0" "rc.1" "rc.999" -}} +{{- $v := printf "%d.0.0-%s" $next $pre -}} +{{- if and (not $found) (semverCompare $.range $v) -}}{{- $found = $v -}}{{- end -}} +{{- end -}} +{{- $found -}} +{{- end -}} + {{/* The agent chart line (agent-manager.agentChart.semver) moves to 3.x only together with what makes that safe (slice 8): agent chart 3.0 removes @@ -2231,14 +2246,22 @@ the key and the fix. {{- define "agent-platform.validateAgentChartLine" -}} {{- $am := index .Values "agent-manager" | default dict -}} {{- $range := dig "agentChart" "semver" "2.x" $am | toString -}} +{{- if not (and (regexMatch "^[\\s0-9A-Za-z.<>=!~^*|,+-]+$" $range) (regexMatch "[0-9]" $range) (not (regexMatch "(^|[\\s|,<>=~^])[A-Za-uwyzA-WYZ]" $range))) -}} +{{- fail (printf "agent-manager.agentChart.semver %q is not a semver range: name the line as a range of one major (\">=2.6.0 <3.0.0\")" $range) -}} +{{- end -}} {{- $majors := include "agent-platform.agentChart.majors" $range | fromJsonArray -}} {{- if not $majors -}} {{- fail (printf "agent-manager.agentChart.semver %q admits no release version of the agent chart: name the line as a range of one major (\">=2.6.0 <3.0.0\"; \">=3.0.0 <4.0.0\" once it may move), never a pre-release alone" $range) -}} {{- end -}} {{- if gt (len $majors) 1 -}} -{{- fail (printf "agent-manager.agentChart.semver %q admits agent chart majors %s: agent-manager's migrate moves an installation's agents to exactly one major; bound the range below the next major (\">=3.0.0 <4.0.0\", or a 2.x range)" $range (join ", " $majors)) -}} +{{- $shown := join ", " $majors -}} +{{- if gt (len $majors) 5 -}}{{- $shown = printf "%s, …" (join ", " (slice $majors 0 5)) -}}{{- end -}} +{{- fail (printf "agent-manager.agentChart.semver %q admits agent chart majors %s: agent-manager's migrate moves an installation's agents to exactly one major; bound the range below the next major (\">=3.0.0 <4.0.0\", or a 2.x range)" $range $shown) -}} {{- end -}} {{- $major := first $majors -}} +{{- with include "agent-platform.agentChart.nextMajorPreRelease" (dict "range" $range "major" $major) -}} +{{- fail (printf "agent-manager.agentChart.semver %q admits %s, a pre-release of the next agent chart major: Flux would serve it under a range read as %s.x; bound it below %d.0.0-0" $range . $major (add1 (atoi $major))) -}} +{{- end -}} {{- if not (has $major (list "2" "3")) -}} {{- fail (printf "agent-manager.agentChart.semver %q selects agent chart %s.x: this chart renders agents of the 2.x and 3.x lines only" $range $major) -}} {{- end -}} @@ -2820,8 +2843,11 @@ source-controller uses). Usage: include "agent-platform.semverRangeFloor" "" */}} {{- define "agent-platform.semverRangeFloor" -}} +{{- $lowest := "" -}} +{{- $open := false -}} +{{- range $alt := splitList "||" (toString .) -}} {{- $floor := "" -}} -{{- range splitList " " (. | replace "," " " | trim) -}} +{{- range splitList " " ($alt | replace "," " " | trim) -}} {{- $term := trim . -}} {{- if and (not $floor) $term (not (hasPrefix "<" $term)) -}} {{- $v := $term | trimPrefix ">=" | trimPrefix ">" | trimPrefix "^" | trimPrefix "~" | trimPrefix "=" | trimPrefix "v" -}} @@ -2830,7 +2856,13 @@ Usage: include "agent-platform.semverRangeFloor" "" {{- end -}} {{- end -}} {{- end -}} -{{- $floor -}} +{{- if not $floor -}} +{{- $open = true -}} +{{- else if or (not $lowest) (lt ((semver $floor).Compare (semver $lowest)) 0) -}} +{{- $lowest = $floor -}} +{{- end -}} +{{- end -}} +{{- if not $open -}}{{- $lowest -}}{{- end -}} {{- end -}} {{/* @@ -5098,9 +5130,17 @@ Usage: include "agent-platform.muster.governance" $root | fromJson {{- end -}} {{- end -}} {{- $out = dict "mode" $mode "governedServers" $servers -}} -{{- else if ne $mode "trusted" -}} +{{- else -}} +{{- if dig "muster" "governance" nil (.Values.muster | default dict) -}} +{{- fail "muster.muster.governance is set, but this chart renders muster's governance configuration only from the muster release that reads it (agent-platform.muster.governanceFloor), and none is pinned: a mode passed to muster directly would claim a governed platform that governs nothing. Remove muster.muster.governance; the platform's mode is the top-level governance value" -}} +{{- end -}} +{{- if ne $mode "trusted" -}} +{{- if not $floor -}} +{{- fail (printf "governance %s: no muster release this chart knows reads the governance configuration yet (agent-platform.muster.governanceFloor is unset until one is released and pinned), so nothing would ask agents; keep governance trusted" $mode) -}} +{{- end -}} {{- fail (printf "governance %s needs muster %s or later (the first release that reads the governance configuration), but components.muster.versionRange %q allows earlier releases: below it nothing would ask agents. Move components.muster.versionRange to >=%s, or keep governance trusted" $mode $floor (dig "muster" "versionRange" "" .Values.components) $floor) -}} {{- end -}} +{{- end -}} {{- $out | toJson -}} {{- end -}} diff --git a/tests/verify-agent-chart-line.py b/tests/verify-agent-chart-line.py index 75754e3b..cc6fc55e 100755 --- a/tests/verify-agent-chart-line.py +++ b/tests/verify-agent-chart-line.py @@ -37,7 +37,7 @@ import sys import tempfile -META = sys.argv[1] +META = META_ORIG = sys.argv[1] CONN = sys.argv[2] if len(sys.argv) > 2 else "" HELM = os.environ.get("HELM") or "helm" BASE = [ @@ -111,7 +111,7 @@ def floor_value(chart: str, name: str) -> str | None: def with_floors(dst: str) -> str: chart = os.path.join(dst, "agent-platform") - shutil.copytree(META, chart) + shutil.copytree(META_ORIG, chart) path = os.path.join(chart, "templates", "_helpers.tpl") text = open(path, encoding="utf-8").read() for name, v in TEST_FLOORS.items(): @@ -147,7 +147,7 @@ def with_floors(dst: str) -> str: else: refused(f"{r} below the floors", "admits a release below", "--set", f"agent-manager.agentChart.semver={r}") refused("a pre-release alone", "admits no release version", "--set", "agent-manager.agentChart.semver=3.0.0-rc.6") -refused(">=3.0.0 spans majors as for migrate", "admits agent chart majors 3, 4, 5, 99", "--set", "agent-manager.agentChart.semver=>=3.0.0") +refused(">=3.0.0 spans majors as for migrate", "admits agent chart majors 3, 4, 5, 6, 7, …", "--set", "agent-manager.agentChart.semver=>=3.0.0") refused("range spanning 2.x and 3.x", "admits agent chart majors 2, 3", "--set", "agent-manager.agentChart.semver=>=2.6.0") refused("3.x with agent-manager off: the operator still gets the range", "keep the 2.x line" if unset else "admits a release below", "--set", "components.agent-manager.enabled=false", "--set", f"agent-manager.agentChart.semver={V3}") @@ -170,6 +170,8 @@ def with_floors(dst: str) -> str: refused("3.x line, default agent on 2.x", "select different agent chart majors", *LINE, *am, *muster) refused("2.x line, default agent on 3.x", "select different agent chart majors", *DEFAULT_AGENT) +META = META_ORIG + # The migrate run reads organization namespaces on the 3.x path (M3-S8-06): # list on namespaces always, cluster-wide reads of releases, sources and Agents # with organizations on, no write anywhere outside its own namespaces. @@ -189,19 +191,46 @@ def migrate_cluster_rules(*args: str) -> str: found = [d for d in r.stdout.split("\n---\n") if "\nkind: ClusterRole\n" in "\n" + d and "-agent-manager-migrate-crds\n" in d] return found[0] if found else "" - off = migrate_cluster_rules() - on = migrate_cluster_rules("--set", "agentPlatformOrganizations.enabled=true") - if 'resources: ["namespaces"]\n verbs: ["list"]' not in off or 'resources: ["namespaces"]\n verbs: ["list"]' not in on: - fail("the migrate run may not list namespaces (it must see the organization namespaces on the 3.x path)") - if "helm.toolkit.fluxcd.io" in off: - fail("without organizations the migrate run needs no cluster-wide release read") - for want in ('resources: ["helmreleases"]\n verbs: ["get", "list"]', 'resources: ["ocirepositories"]\n verbs: ["get", "list"]', 'resources: ["agents"]\n verbs: ["get", "list"]'): - if want not in on: - fail(f"with organizations the migrate run's ClusterRole lacks {want!r}") - for verb in ("create", "update", "patch", "delete"): - rules = on.split("Organization namespaces", 1)[-1] + v3 = ("--set", f"agent-manager.agentChart.semver={V3}") + ns_rule = 'resources: ["namespaces"]\n verbs: ["list"]' + two = migrate_cluster_rules() + two_orgs = migrate_cluster_rules("--set", "agentPlatformOrganizations.enabled=true") + three = migrate_cluster_rules(*v3) + three_orgs = migrate_cluster_rules(*v3, "--set", "agentPlatformOrganizations.enabled=true") + for what, text in (("2.x line", two), ("2.x line with organizations", two_orgs)): + if ns_rule in text or "helm.toolkit.fluxcd.io" in text: + fail(f"{what}: the migrate run reads no organization namespace, so its identity gets no namespace list and no cluster-wide release read") + if ns_rule not in three or "helm.toolkit.fluxcd.io" in three: + fail("3.x line without organizations: the run lists namespaces (and finds none) and reads no release cluster-wide") + for want in ('resources: ["helmreleases"]\n verbs: ["get", "list"]', 'resources: ["ocirepositories"]\n verbs: ["get", "list"]', 'resources: ["agents"]\n verbs: ["list"]', ns_rule): + if want not in three_orgs: + fail(f"3.x line with organizations: the migrate run's ClusterRole lacks {want!r}") + rules = three_orgs.split("cluster-wide list on their kagent.dev", 1)[-1].split('resources: ["namespaces"]', 1)[-1] + for verb in ("create", "update", "patch", "delete", "watch"): if f'"{verb}"' in rules: fail(f"the migrate run's organization reads carry {verb}") + if '"get", "list"]\n' in rules.split('resources: ["agents"]', 1)[-1][:40]: + fail("the run lists Agents in organization namespaces, it gets none") + +# A bound that admits a pre-release of the next major (M3-S8-R-05), and range +# shapes that are no semver range. +refused("<=3.0.0-rc.1 bound", "admits 3.0.0-0, a pre-release of the next agent chart major", "--set", "agent-manager.agentChart.semver=>=2.6.0 <=3.0.0-rc.1") +refused("<3.0.0-rc.1 bound", "a pre-release of the next agent chart major", "--set", "agent-manager.agentChart.semver=>=2.6.0 <3.0.0-rc.1") +refused("majors beyond 5", "admits agent chart majors 3, 6", "--set", "agent-manager.agentChart.semver=>=3.0.0 <4.0.0 || 6.x") +refused("latest", "is not a semver range", "--set", "agent-manager.agentChart.semver=latest") +refused("empty", "is not a semver range", "--set-string", "agent-manager.agentChart.semver=") +renders("prerelease-widened 2.x line", "--set", "agent-manager.agentChart.semver=>=2.6.0-0 <3.0.0-0") + +# An || range is held to its lowest alternative's floor (M3-S8-R-08). +with tempfile.TemporaryDirectory() as tmp: + META = with_floors(tmp) + am = [a.replace("{floor}", TEST_FLOORS["agentManager.agentChartV3Floor"]) for a in AM] + muster = [a.replace("{floor}", TEST_FLOORS["muster.agentApprovalFloor"]) for a in MUSTER] + for what, args in (("muster", ["--set", "components.muster.versionRange=>=5.68.0 <6.0.0 || >=5.0.0", *am]), + ("muster, exact alternatives", ["--set", "components.muster.versionRange=5.68.0 || 5.66.2", *am]), + ("agent-manager", ["--set", "components.agent-manager.versionRange=>=3.6.0 || >=3.5.0", *muster])): + refused(f"|| range of {what} below its floor", "admits a release below", *LINE, *DEFAULT_AGENT, *args) +META = META_ORIG if failures: for f in failures: diff --git a/tests/verify-tool-approval.py b/tests/verify-tool-approval.py index d1070093..c61e7af8 100755 --- a/tests/verify-tool-approval.py +++ b/tests/verify-tool-approval.py @@ -711,8 +711,12 @@ def check_unset_floors_keep_everything_off() -> None: if block(muster, " governance:"): fail("with the governance floor unset the muster release must carry no governance configuration") err = render_meta_fail(high + ["--set", "governance=governed"]) - if "governed" not in err: - fail(f"with the governance floor unset `governed` must fail:\n{err}") + if "no muster release this chart knows reads the governance configuration yet" not in err or ">= " in err or "muster or" in err: + fail(f"with the governance floor unset `governed` must fail naming why, with no empty floor:\n{err}") + for own in (["--set", "muster.muster.governance.mode=governed"], ["--set", "muster.muster.governance.servers.platformManager[0]=pm"]): + err = render_meta_fail(high + own) + if "muster.muster.governance is set" not in err: + fail(f"with the governance floor unset an own {own[1]} must fail (governed, governing nothing):\n{err}") if "muster.agentApprovalFloor" in unset and "enabled: true" in block(am, " toolApproval:"): fail("with muster's agent approval floor unset agent-manager must bind no settings") if "muster.sessionBindingsPortFloor" in unset and block(muster, " sessionBindings:"): From ffeb04c87de8ce88f852a43bd9452d9393a55e6f Mon Sep 17 00:00:00 2001 From: Dominik Schmidle Date: Thu, 26 Nov 2026 10:31:09 +0100 Subject: [PATCH 29/56] docs: running sessions need approval prerequisites once tool approval is on, and the refused range forms --- UPGRADE.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/UPGRADE.md b/UPGRADE.md index a9ab1bd2..57db63cc 100644 --- a/UPGRADE.md +++ b/UPGRADE.md @@ -17,7 +17,7 @@ A CRD version change that needs more than an apply (a stored version dropped, as ## \ → \ (agent chart 3.0: `muster.requireApproval` becomes `default: Ask`) -giantswarm/giantswarm#38902, slice 8: agent chart 3.0 removes `muster.requireApproval` (kagent's flag that paused an agent before every tool call) and the default of `modelConfig.name`. `default: Ask` replaces `requireApproval: true`: muster asks a person before every tool call the agent makes through it, from every client, and nothing asks twice. `agent-manager.agentChart.semver` moves the agents of the whole installation: agent-manager composes new agents on it, its migrate run (the connectivity release's start hook) moves the existing ones, and the agent-platform-operator moves every organization's chart source at once. +giantswarm/giantswarm#38902, slice 8: agent chart 3.0 removes `muster.requireApproval` (kagent's flag that paused an agent before every tool call) and the default of `modelConfig.name`. `default: Ask` replaces `requireApproval: true`: muster asks a person before every tool call the agent makes through it, from every client; once migrated, nothing asks twice (until then see *Running Sessions* below). `agent-manager.agentChart.semver` moves the agents of the whole installation: agent-manager composes new agents on it, its migrate run (the connectivity release's start hook) moves the existing ones, and the agent-platform-operator moves every organization's chart source at once. The render allows the 3.x line only together with what makes it safe (`make verify-agent-chart-line`): agent-manager at `agent-platform.agentManager.agentChartV3Floor`, whose migrate has the 2.x → 3.x hop, muster at `agent-platform.muster.agentApprovalFloor`, which enforces `default: Ask`, agent-manager's tool approval on (`agent-manager.muster.toolApproval.enabled` unset) and the default agent's range on the same major. **Both floors are unset in this chart** until the muster and agent-manager releases carrying tool approval exist, so every 3.x range is refused for now, whatever its form (`3.x`, `~3.2`, `>=3.1.0 <3.6.0`); the platform release that pins those versions sets them. The same goes for the other floors of tool approval (`agent-platform.agentManager.toolApprovalFloor`, `agent-platform.muster.governanceFloor`, `agent-platform.muster.sessionBindingsPortFloor`): unset, what they gate stays off and `governance: governed` fails. The range is read as agent-manager's migrate reads it: a range admitting two majors (`>=3.0.0`) or only pre-releases fails. @@ -29,8 +29,8 @@ The migrate run writes each release's 3.x values (`muster.requireApproval: true` - Tool approval's prerequisites must hold (muster's OAuth server with Dex sign-in, Valkey storage; the entry below): without them muster refuses every call that asks, so an agent migrated to `default: Ask` cannot call its tools until they hold. It never runs them unasked. - **Mandatory before the upgrade:** run `agent-manager migrate --dry-run` against the target range (or read the report of the platform release that carries agent-manager's floor) and fix every release it lists. The agent-platform-operator moves every organization's chart source at once with the range, and nothing holds it: a release there that still carries `muster.requireApproval` fails its 3.x render and stays on its 2.x revision, still asking through kagent, until fixed; one without `modelConfig.name` renders without a model. Also check releases whose values come from `valuesFrom`: `kubectl get helmreleases -A -o json | jq -r '.items[] | select(.spec.values.muster.requireApproval != null or .spec.values.modelConfig.name == null or (.spec.valuesFrom // [] | length > 0)) | "\(.metadata.namespace)/\(.metadata.name)"'` and the ConfigMaps or Secrets they name. - The repair is always **replace `muster.requireApproval: true` with `default: Ask`**, never just delete the key (that turns the agent's asks off); drop `requireApproval: false` and `null`; set `modelConfig.name` where it is unset. In git, apply it together with the move of that release's chart source to 3.x; for `valuesFrom`, move the settings into `spec.values` (agent-manager binds settings only from there). -- Running Sessions: agent-manager binds a Session of an agent on `muster.requireApproval: true` with `default: Ask` already on 2.x (such an agent is asked twice there, by kagent and by muster, until it is migrated), so Sessions running across the upgrade keep asking. A Session started by an agent-manager below `agent-platform.agentManager.toolApprovalFloor` carries no settings and muster applies the agent's re-rendered `X-Muster-Tool-Approval: default=Ask`. -- Read the report after the run: `kubectl -n get configmap agent-manager-migrate-report -o jsonpath='{.data.report\.yaml}'`; each rewritten release lists `changes.removed` and `changes.set`. A release carrying `requireApproval: true` beside tool approval settings is reported failed (no released chart renders that combination) and holds its chart source; set its settings by hand. The run needs list on namespaces and read access in organization namespaces; without them it fails and changes nothing (`--organization-namespaces none` skips them, leaving them unchecked). +- Running Sessions: with tool approval on (agent-manager at `agent-platform.agentManager.toolApprovalFloor`), agent-manager binds a Session of an agent on `muster.requireApproval: true` with `default: Ask` already on 2.x, so such an agent needs muster's approval prerequisites from then on, not only on 3.x; (such an agent is asked twice there, by kagent and by muster, until it is migrated), so Sessions running across the upgrade keep asking. A Session started by an agent-manager below `agent-platform.agentManager.toolApprovalFloor` carries no settings and muster applies the agent's re-rendered `X-Muster-Tool-Approval: default=Ask`. +- Read the report after the run: `kubectl -n get configmap agent-manager-migrate-report -o jsonpath='{.data.report\.yaml}'`; each rewritten release lists `changes.removed` and `changes.set`. A release carrying `requireApproval: true` beside tool approval settings is reported failed (no released chart renders that combination) and holds its chart source; set its settings by hand. The run needs list on namespaces and read access in organization namespaces (the chart grants them only on a 3.x line); without them it fails before it writes anything (`--organization-namespaces none` skips them, leaving them unchecked). ## \ → \ (tool approval and the governance mode) From e3441ce5f67077e96f961c84fb0b978b38600662 Mon Sep 17 00:00:00 2001 From: Dominik Schmidle Date: Thu, 26 Nov 2026 10:49:46 +0100 Subject: [PATCH 30/56] feat(helm): let agents call the Platform Manager's reads unasked on governed governedServers.giantswarm-platform-manager.safe lists get_info, list_installations, list_actions, get_action and verify_capability. Three of them bring Action records up to date with GitHub as the caller and may post those facts to the review thread or the standup channel; none decides anything. The dry runs share their tools with the commits and keep asking, as do verify_installation, watch_action, deny_action and the floors. --- helm/agent-platform/README.md | 2 +- helm/agent-platform/values.schema.json | 5 ++++- helm/agent-platform/values.yaml | 9 +++++++-- 3 files changed, 12 insertions(+), 4 deletions(-) diff --git a/helm/agent-platform/README.md b/helm/agent-platform/README.md index 8c2f8bdd..69744fc3 100644 --- a/helm/agent-platform/README.md +++ b/helm/agent-platform/README.md @@ -1642,7 +1642,7 @@ The map is merged into each component's own `nodeSelector` (`muster.nodeSelector | clusterManager.networkPolicy.egress.fqdns | list | `[]` | | | clusterManager.networkPolicy.egress.cidrs | list | `[]` | | | governance | string | `"trusted"` | The platform's governance mode: trusted (the default) or governed. It changes no tool approval setting's meaning; it adds asking for agent callers. Governed asks a person before an agent runs any tool of a governed server (governedServers below) that is not on that server's safe list (new and renamed tools too), and before any of muster's own tools but its reads; the Dev Portal's connector wizard pre-selects the Recommended preset (read-only tools run, the rest ask). Trusted lets agents run what the connectors' own settings allow and pre-selects Allow all. In both modes muster's built-in floors ask a person before an agent adds or repoints a connector, changes approval settings, grants access, adds a model, egress origin, credential or backend, approves an action or a toolchain source, or changes muster's own configuration; the role floors hold on the governed servers of that role, so governedServers names them in both modes. The meta chart renders muster's governance configuration from it (muster.governance: the mode and governedServers), from the muster release that reads it (agent-platform.muster.governanceFloor); below it `governed` fails the render and trusted renders nothing. From that release the meta chart also renders muster.approval.installation (backstage.installationName, the name the approval page shows), muster-approval-binder's subject (agent-manager's ServiceAccount, muster.rbac.approvalBinder.subjects) and the pages muster may return the browser to after an approval in muster.oauth.mcpClient.postLoginRedirectAllowlist (the portal's /sessions with backstage.publicPort, klausGateway.obo.callbackBaseUrl + /auth/slack/return; an own list's entries stay). Approval itself needs muster's OAuth server with Dex sign-in, Valkey storage (the default) and muster.muster.oauth.mcpClient.publicUrl on the OAuth server's origin with mcpClient.enabled for the allowlist; the chart does not fail without them, muster refuses asking calls with the reason. Only admins switch it, through the Platform Manager with a second person's approval; never an agent. Anything else fails the render. Concept: https://docs.giantswarm.io/overview/agent-platform/governing-tool-calls/ | -| governedServers | object | `{"agent-manager":{"role":"agentManager","safe":["get_info","list_agents","get_agent","get_agent_status","validate_agent","list_model_configs","list_egress_policies","list_skills","list_sessions","get_session","get_session_turn","toolchain_users","list_organizations","get_organization","list_organization_members","list_organization_connectors"]},"cluster-manager":{"role":"clusterManager","safe":["get_info","list_clusters","list_releases","list_node_pools"]},"giantswarm-platform-manager":{"role":"platformManager","safe":[]},"kagent":{"role":"sessionManager","safe":["list_sessions","list_session_checkpoints","list_sandbox_templates","list_sandboxes","get_sandbox","get_sandbox_process","read_sandbox_outputs","read_sandbox_file"]},"mcp-kubernetes":{"role":"infrastructure","safe":["logs","list_port_forward_sessions","context_list","context_get_current","can_i","api_resources","cluster_health","capi_list_clusters","capi_get_cluster","capi_resolve_cluster","capi_cluster_health","get","list","describe"]},"model-manager":{"role":"modelManager","safe":["get_info","get_backend","list_backends","list_models","get_model","list_loaded_models","list_presets","search_models","check_fit","list_nodes","list_jobs","get_job"]},"skill-manager":{"role":"skillManager","safe":["list_skill_sources","list_skills","resolve_skills","get_skill","get_skill_file"]},"toolchain-manager":{"role":"toolchainManager","safe":["list_sources","list_toolchains","describe_toolchain","toolchain_build_status","search_packages"]},"vm-manager":{"role":"vmManager","safe":["get_info","get_host","list_images","get_image","list_networks","get_network","list_vms","get_vm","get_vm_metrics","get_vm_attestation"]},"workspace-manager":{"role":"workspaceManager","safe":["list_providers","list_owners","list_workspaces","get_workspace","list_repositories","preview_workspace"]}}` | The servers muster governs (muster.governance.governedServers), per source the platform ships: `role` (which of muster's role floors hold on it: agentManager, platformManager, connectorManager, sessionManager, modelManager, clusterManager, vmManager, workspaceManager, toolchainManager, skillManager, infrastructure) and `safe`, the server's own tool names agents call unasked on governed (reads only; a floor never, muster refuses to start on one). Every other tool of a governed server asks agents on governed. A source renders one entry per MCPServer it ships while that renders (agent-platform.muster.governedKeys): a manager component's .muster.mcpServer.name in its namespace; kagent the connectivity chart's kagent server; mcp-kubernetes the connectivity chart's and every agent-platform-mcps kubernetes entry; any other key is a muster server key itself (giantswarm-platform-manager). null drops a source (then list it in governanceExempt with the reason). make verify-tool-approval fails on a shipped MCPServer that is neither here nor in governanceExempt, and on a safe entry that names a floor or no tool of its server, or whose name starts with a write verb (create, delete, exec, set, approve, ...) unless a `# safe-write: : ` comment above `safe:` says why it reads. Safe lists: tool-approval governed-safe-list-proposal (giantswarm/giantswarm#38902). | +| governedServers | object | `{"agent-manager":{"role":"agentManager","safe":["get_info","list_agents","get_agent","get_agent_status","validate_agent","list_model_configs","list_egress_policies","list_skills","list_sessions","get_session","get_session_turn","toolchain_users","list_organizations","get_organization","list_organization_members","list_organization_connectors"]},"cluster-manager":{"role":"clusterManager","safe":["get_info","list_clusters","list_releases","list_node_pools"]},"giantswarm-platform-manager":{"role":"platformManager","safe":["get_info","list_installations","list_actions","get_action","verify_capability"]},"kagent":{"role":"sessionManager","safe":["list_sessions","list_session_checkpoints","list_sandbox_templates","list_sandboxes","get_sandbox","get_sandbox_process","read_sandbox_outputs","read_sandbox_file"]},"mcp-kubernetes":{"role":"infrastructure","safe":["logs","list_port_forward_sessions","context_list","context_get_current","can_i","api_resources","cluster_health","capi_list_clusters","capi_get_cluster","capi_resolve_cluster","capi_cluster_health","get","list","describe"]},"model-manager":{"role":"modelManager","safe":["get_info","get_backend","list_backends","list_models","get_model","list_loaded_models","list_presets","search_models","check_fit","list_nodes","list_jobs","get_job"]},"skill-manager":{"role":"skillManager","safe":["list_skill_sources","list_skills","resolve_skills","get_skill","get_skill_file"]},"toolchain-manager":{"role":"toolchainManager","safe":["list_sources","list_toolchains","describe_toolchain","toolchain_build_status","search_packages"]},"vm-manager":{"role":"vmManager","safe":["get_info","get_host","list_images","get_image","list_networks","get_network","list_vms","get_vm","get_vm_metrics","get_vm_attestation"]},"workspace-manager":{"role":"workspaceManager","safe":["list_providers","list_owners","list_workspaces","get_workspace","list_repositories","preview_workspace"]}}` | The servers muster governs (muster.governance.governedServers), per source the platform ships: `role` (which of muster's role floors hold on it: agentManager, platformManager, connectorManager, sessionManager, modelManager, clusterManager, vmManager, workspaceManager, toolchainManager, skillManager, infrastructure) and `safe`, the server's own tool names agents call unasked on governed (reads only; a floor never, muster refuses to start on one). Every other tool of a governed server asks agents on governed. A source renders one entry per MCPServer it ships while that renders (agent-platform.muster.governedKeys): a manager component's .muster.mcpServer.name in its namespace; kagent the connectivity chart's kagent server; mcp-kubernetes the connectivity chart's and every agent-platform-mcps kubernetes entry; any other key is a muster server key itself (giantswarm-platform-manager). null drops a source (then list it in governanceExempt with the reason). make verify-tool-approval fails on a shipped MCPServer that is neither here nor in governanceExempt, and on a safe entry that names a floor or no tool of its server, or whose name starts with a write verb (create, delete, exec, set, approve, ...) unless a `# safe-write: : ` comment above `safe:` says why it reads. Safe lists: tool-approval governed-safe-list-proposal (giantswarm/giantswarm#38902). | | governanceExempt | object | `{"capi":"agent-platform-mcps' capi family (mcp-kubernetes' CAPI tools): every tool reads","prometheus":"agent-platform-mcps' prometheus family (mcp-prometheus): every tool reads"}` | MCPServer sources the platform ships that muster deliberately does not govern, each with its reason (make verify-tool-approval wants every shipped source in governedServers or here). Read by the meta chart's tests only. | | tenants.platform.users | list | `[{"apiGroup":"rbac.authorization.k8s.io","kind":"Group","name":"system:authenticated"}]` | Every signed-in person: bound to agent-platform:platform-user in the kagent namespace, and, while musterMcpServerViewers is unset, to `list` (with get and watch) on muster's MCPServers in muster's namespace (the servers for everyone). RBAC subjects. The default, system:authenticated, gives this to every user. It also gives it to every ServiceAccount, so every pod in the cluster can read the platform tenant's Agents, RemoteMCPServer URLs and muster's MCPServer specs. To give it to people only, replace the default with an OIDC group that every user belongs to, written as the API server sees it (with the installation's OIDC groups prefix). | | tenants.platform.editors | list | `[{"apiGroup":"rbac.authorization.k8s.io","kind":"Group","name":"giantswarm-ad:giantswarm-admins"},{"apiGroup":"rbac.authorization.k8s.io","kind":"Group","name":"giantswarm-github:giantswarm:giantswarm-admins"}]` | The platform's operators: bound to agent-platform:editor in the kagent namespace. RBAC subjects. The Giant Swarm admin groups, as in muster.rbac.*.subjects. | diff --git a/helm/agent-platform/values.schema.json b/helm/agent-platform/values.schema.json index 0a6c7d16..d93a5b41 100644 --- a/helm/agent-platform/values.schema.json +++ b/helm/agent-platform/values.schema.json @@ -2230,7 +2230,10 @@ "type": "string" }, "safe": { - "type": "array" + "type": "array", + "items": { + "type": "string" + } } } }, diff --git a/helm/agent-platform/values.yaml b/helm/agent-platform/values.yaml index 18dc6f35..423070c7 100644 --- a/helm/agent-platform/values.yaml +++ b/helm/agent-platform/values.yaml @@ -5933,8 +5933,13 @@ governedServers: # @schema additionalProperties: true safe: [logs, list_port_forward_sessions, context_list, context_get_current, can_i, api_resources, cluster_health, capi_list_clusters, capi_get_cluster, capi_resolve_cluster, capi_cluster_health, get, list, describe] giantswarm-platform-manager: role: platformManager - # Not inventoried yet: every tool but the floors' asks agents on governed. - safe: [] + # Its reads (giantswarm-platform-manager docs/governance.md). get_action, + # list_actions and list_installations bring Action records up to date + # with GitHub as the caller and may post the facts to the review thread + # or the standup channel; they decide nothing. The dry runs share their + # tools with the commits (enable, reconcile, disable_capability) and ask, + # as do verify_installation, watch_action, deny_action and the floors. + safe: [get_info, list_installations, list_actions, get_action, verify_capability] # -- MCPServer sources the platform ships that muster deliberately does not # govern, each with its reason (make verify-tool-approval wants every shipped From 624f1b8a9f6ed7c5895482e27511eb12ae70ae5c Mon Sep 17 00:00:00 2001 From: Dominik Schmidle Date: Thu, 26 Nov 2026 11:03:42 +0100 Subject: [PATCH 31/56] feat(helm): add a migrate preflight that dry-runs the 3.x path before the agent chart line moves The mandatory dry run could not run as the migration's identity on the 2.x line: the namespace list and organization reads rendered only on a 3.x line. agentManager.migration.preflightSemver renders a never-started CronJob -preflight running migrate --dry-run against that range, and a 3.x preflight range grants the identity the same read-only access the 3.x path needs. Unset, nothing changes. --- helm/agent-platform-connectivity/README.md | 1 + .../templates/kagent/_migrate.tpl | 21 ++++++++---- .../templates/kagent/migrate-cronjob.yaml | 34 +++++++++++++++++++ helm/agent-platform-connectivity/values.yaml | 10 ++++++ helm/agent-platform/values.yaml | 3 ++ tests/verify-agent-chart-line.py | 21 ++++++++++++ 6 files changed, 84 insertions(+), 6 deletions(-) diff --git a/helm/agent-platform-connectivity/README.md b/helm/agent-platform-connectivity/README.md index efbf17e0..e871b181 100644 --- a/helm/agent-platform-connectivity/README.md +++ b/helm/agent-platform-connectivity/README.md @@ -1811,6 +1811,7 @@ The kagent block is open in the schema, so the template refuses a key under `kag | agentManager.migration.image.repository | string | `"giantswarm/agent-manager"` | | | agentManager.migration.image.tag | string | `"3.5.6"` | | | agentManager.migration.dryRun | bool | `false` | dry-run: the report and the diffs, nothing written — a rehearsal of one installation's cut-over before the real run. | +| agentManager.migration.preflightSemver | string | `""` | | | agentManager.migration.gitopsNamespaces | list | `[]` | | | cluster-manager.fullnameOverride | string | `"cluster-manager"` | | | cluster-manager.installation.name | string | `""` | | diff --git a/helm/agent-platform-connectivity/templates/kagent/_migrate.tpl b/helm/agent-platform-connectivity/templates/kagent/_migrate.tpl index fc830585..8df05fc8 100644 --- a/helm/agent-platform-connectivity/templates/kagent/_migrate.tpl +++ b/helm/agent-platform-connectivity/templates/kagent/_migrate.tpl @@ -129,13 +129,11 @@ echo "{{ .job }} started; its outcome: kubectl -n {{ .namespace }} get job {{ .j {{- end -}} {{/* -Truthy when agent-manager.agentChart.semver (as the migrate run takes it) is a -3.x line: the run then takes the 2.x -> 3.x path and reads the organization -namespaces (migrate-rbac.yaml). Probes 3.x as agent-manager's migrate does. +Truthy when a range (the argument) is a 3.x line, probed as agent-manager's +migrate probes it. */}} -{{- define "agent-platform.kagent.migration.v3Line" -}} -{{- $am := include "agent-platform.agentManager.chartValues" . | fromJson -}} -{{- $range := dig "agentChart" "semver" "2.x" $am | toString -}} +{{- define "agent-platform.kagent.migration.isV3" -}} +{{- $range := toString . -}} {{- if and (regexMatch "[0-9]" $range) (not (regexMatch "(^|[\\s|,<>=~^])[A-Za-uwyzA-WYZ]" $range)) -}} {{- $hit := or (semverCompare $range "3.0.0") (semverCompare $range "3.999999.999999") -}} {{- range $n := until 200 -}} @@ -144,3 +142,14 @@ namespaces (migrate-rbac.yaml). Probes 3.x as agent-manager's migrate does. {{- if $hit -}}true{{- end -}} {{- end -}} {{- end -}} + +{{/* +Truthy when a run of the migration takes the 2.x -> 3.x path and reads the +organization namespaces (migrate-rbac.yaml): agent-manager.agentChart.semver +(as the run takes it) is a 3.x line, or agentManager.migration.preflightSemver +is, for the dry run before the line moves (M3I-1). +*/}} +{{- define "agent-platform.kagent.migration.v3Line" -}} +{{- $am := include "agent-platform.agentManager.chartValues" . | fromJson -}} +{{- if or (include "agent-platform.kagent.migration.isV3" (dig "agentChart" "semver" "2.x" $am)) (include "agent-platform.kagent.migration.isV3" (dig "migration" "preflightSemver" "" (.Values.agentManager | default dict))) -}}true{{- end -}} +{{- end -}} diff --git a/helm/agent-platform-connectivity/templates/kagent/migrate-cronjob.yaml b/helm/agent-platform-connectivity/templates/kagent/migrate-cronjob.yaml index 5727a1d1..55a6a581 100644 --- a/helm/agent-platform-connectivity/templates/kagent/migrate-cronjob.yaml +++ b/helm/agent-platform-connectivity/templates/kagent/migrate-cronjob.yaml @@ -164,6 +164,40 @@ spec: ttlSecondsAfterFinished: 86400 template: {{- $template | nindent 8 }} +{{- with $m.preflightSemver }} +{{- /* The preflight (M3I-1): the same run, dry, against preflightSemver, +never started by the hook: `kubectl create job --from=cronjob/` before +the agent chart line moves, as UPGRADE.md says. */ -}} +{{- $pre := list }} +{{- range $env }} +{{- if eq .name "AGENT_CHART_SEMVER" }}{{- $pre = append $pre (dict "name" "AGENT_CHART_SEMVER" "value" (toString $.Values.agentManager.migration.preflightSemver)) }}{{- else if ne .name "AGENT_CHART_SEMVER_FILTER" }}{{- $pre = append $pre . }}{{- end }} +{{- end }} +{{- $preTemplate := include "agent-platform.kagent.migration.podTemplate" (dict "root" $ "serviceAccountName" $sa "image" $image "args" (list "migrate" "--dry-run") "env" $pre) }} +--- +apiVersion: batch/v1 +kind: CronJob +metadata: + name: {{ include "agent-platform.kagent.migration.name" $ }}-preflight + namespace: {{ $kagentNs }} + labels: + {{- include "agent-platform.kagent.migration.labels" $ | nindent 4 }} + annotations: + agent-platform.giantswarm.io/about: {{ printf "agent-manager migrate --dry-run against %s (agentManager.migration.preflightSemver): run it with kubectl create job --from=cronjob/ and read the report in its log; it writes nothing (UPGRADE.md)" (toString .) | quote }} +spec: + suspend: true + schedule: "0 0 31 2 *" + concurrencyPolicy: Forbid + jobTemplate: + metadata: + labels: + {{- include "agent-platform.kagent.migration.labels" $ | nindent 8 }} + spec: + backoffLimit: 0 + activeDeadlineSeconds: 900 + ttlSecondsAfterFinished: 86400 + template: + {{- $preTemplate | nindent 8 }} +{{- end }} --- {{ include "agent-platform.hooks.job" (dict "root" . diff --git a/helm/agent-platform-connectivity/values.yaml b/helm/agent-platform-connectivity/values.yaml index a4760ccc..49690efb 100644 --- a/helm/agent-platform-connectivity/values.yaml +++ b/helm/agent-platform-connectivity/values.yaml @@ -2965,6 +2965,16 @@ agentManager: # @schema skipProperties: true; additionalProperties: true # --dry-run: the report and the diffs, nothing written — a rehearsal of # one installation's cut-over before the real run. dryRun: false + # A second, never-started CronJob -preflight that runs + # `migrate --dry-run` against this range instead of the line's, e.g. + # ">=3.0.0 <4.0.0" before the agent chart line moves to 3.x: the mandatory + # check of UPGRADE.md, run as the migration's identity with + # `kubectl create job --from=cronjob/-preflight`, reading its + # report from the run's log (a dry run writes nothing). A 3.x range here + # also grants the identity the read-only access the 3.x path needs (list + # namespaces; with organizations, read their releases, sources and Agents); + # empty (the default) renders neither. + preflightSemver: "" # Namespaces the GitOps-owned agents' HelmReleases and OCIRepositories live # in (a HelmRelease with targetNamespace: kagent applied from elsewhere — # the fleet's flux-giantswarm): the Job reads them there (get, list; a Role diff --git a/helm/agent-platform/values.yaml b/helm/agent-platform/values.yaml index 423070c7..0e49afe4 100644 --- a/helm/agent-platform/values.yaml +++ b/helm/agent-platform/values.yaml @@ -5566,6 +5566,9 @@ agentManager: # @schema skipProperties: true; additionalProperties: true repository: giantswarm/agent-manager tag: 3.5.6 dryRun: false + # preflightSemver (unset): forwarded when set, the connectivity chart's + # values.yaml documents it (UPGRADE.md, the dry run before the agent chart + # line moves to 3.x). gitopsNamespaces: [] # === Skill repositories === diff --git a/tests/verify-agent-chart-line.py b/tests/verify-agent-chart-line.py index cc6fc55e..4a674de6 100755 --- a/tests/verify-agent-chart-line.py +++ b/tests/verify-agent-chart-line.py @@ -140,6 +140,12 @@ def with_floors(dst: str) -> str: if "'>=2.6.0 <3.0.0'" not in out and '">=2.6.0 <3.0.0"' not in out: fail("the default render does not carry the 2.x line") +# The preflight range reaches the connectivity release and is not the line: +# no guard refuses it (M3I-1). +out = renders("preflight on the 2.x line", "--set", f"agentManager.migration.preflightSemver={V3}") +if f"preflightSemver: '{V3}'" not in out: + fail("agentManager.migration.preflightSemver does not reach the connectivity release") + # Ranges the guard must read as migrate does, on the chart as it is. for r in ["~3.2", "3.1.x", ">=3.1.0 <3.6.0", "3.x", V3]: if unset: @@ -200,6 +206,21 @@ def migrate_cluster_rules(*args: str) -> str: for what, text in (("2.x line", two), ("2.x line with organizations", two_orgs)): if ns_rule in text or "helm.toolkit.fluxcd.io" in text: fail(f"{what}: the migrate run reads no organization namespace, so its identity gets no namespace list and no cluster-wide release read") + pre = ("--set", f"agentManager.migration.preflightSemver={V3}") + pre_orgs = migrate_cluster_rules(*pre, "--set", "agentPlatformOrganizations.enabled=true") + if ns_rule not in pre_orgs or 'resources: ["helmreleases"]\n verbs: ["get", "list"]' not in pre_orgs: + fail("a 3.x preflight range on the 2.x line grants the reads its dry run needs (M3I-1)") + r = subprocess.run([*conn_base, *pre], capture_output=True, text=True) + cron = [d for d in r.stdout.split("\n---\n") if "\nkind: CronJob\n" in "\n" + d and "-agent-manager-migrate-preflight\n" in d] + if len(cron) != 1: + fail("a preflight range renders one CronJob -preflight") + else: + body = cron[0] + if "suspend: true" not in body or "- --dry-run" not in body or f"value: '{V3}'" not in body or "AGENT_CHART_SEMVER_FILTER" in body: + fail(f"the preflight CronJob is suspended, runs migrate --dry-run against the preflight range, without the line's filter:\n{body}") + r = subprocess.run([*conn_base], capture_output=True, text=True) + if "-agent-manager-migrate-preflight" in r.stdout: + fail("without a preflight range no preflight CronJob renders") if ns_rule not in three or "helm.toolkit.fluxcd.io" in three: fail("3.x line without organizations: the run lists namespaces (and finds none) and reads no release cluster-wide") for want in ('resources: ["helmreleases"]\n verbs: ["get", "list"]', 'resources: ["ocirepositories"]\n verbs: ["get", "list"]', 'resources: ["agents"]\n verbs: ["list"]', ns_rule): From 8e2f0b400f974d3f5145f8076d02e48046315c6d Mon Sep 17 00:00:00 2001 From: Dominik Schmidle Date: Thu, 26 Nov 2026 11:03:42 +0100 Subject: [PATCH 32/56] docs: run the mandatory 3.x dry run through the migrate preflight, and why the floors are not values --- UPGRADE.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/UPGRADE.md b/UPGRADE.md index 57db63cc..6d7e4199 100644 --- a/UPGRADE.md +++ b/UPGRADE.md @@ -19,7 +19,7 @@ A CRD version change that needs more than an apply (a stored version dropped, as giantswarm/giantswarm#38902, slice 8: agent chart 3.0 removes `muster.requireApproval` (kagent's flag that paused an agent before every tool call) and the default of `modelConfig.name`. `default: Ask` replaces `requireApproval: true`: muster asks a person before every tool call the agent makes through it, from every client; once migrated, nothing asks twice (until then see *Running Sessions* below). `agent-manager.agentChart.semver` moves the agents of the whole installation: agent-manager composes new agents on it, its migrate run (the connectivity release's start hook) moves the existing ones, and the agent-platform-operator moves every organization's chart source at once. -The render allows the 3.x line only together with what makes it safe (`make verify-agent-chart-line`): agent-manager at `agent-platform.agentManager.agentChartV3Floor`, whose migrate has the 2.x → 3.x hop, muster at `agent-platform.muster.agentApprovalFloor`, which enforces `default: Ask`, agent-manager's tool approval on (`agent-manager.muster.toolApproval.enabled` unset) and the default agent's range on the same major. **Both floors are unset in this chart** until the muster and agent-manager releases carrying tool approval exist, so every 3.x range is refused for now, whatever its form (`3.x`, `~3.2`, `>=3.1.0 <3.6.0`); the platform release that pins those versions sets them. The same goes for the other floors of tool approval (`agent-platform.agentManager.toolApprovalFloor`, `agent-platform.muster.governanceFloor`, `agent-platform.muster.sessionBindingsPortFloor`): unset, what they gate stays off and `governance: governed` fails. The range is read as agent-manager's migrate reads it: a range admitting two majors (`>=3.0.0`) or only pre-releases fails. +The render allows the 3.x line only together with what makes it safe (`make verify-agent-chart-line`): agent-manager at `agent-platform.agentManager.agentChartV3Floor`, whose migrate has the 2.x → 3.x hop, muster at `agent-platform.muster.agentApprovalFloor`, which enforces `default: Ask`, agent-manager's tool approval on (`agent-manager.muster.toolApproval.enabled` unset) and the default agent's range on the same major. **Both floors are unset in this chart** until the muster and agent-manager releases carrying tool approval exist, so every 3.x range is refused for now, whatever its form (`3.x`, `~3.2`, `>=3.1.0 <3.6.0`); the platform release that pins those versions sets them. They are chart code, not values, on purpose: a floor states which released version carries a feature, and a value would let one installation's configuration claim it for a release that lacks it (a lab tests a branch build on a copy of the chart, as the verify scripts do). The same goes for the other floors of tool approval (`agent-platform.agentManager.toolApprovalFloor`, `agent-platform.muster.governanceFloor`, `agent-platform.muster.sessionBindingsPortFloor`): unset, what they gate stays off and `governance: governed` fails. The range is read as agent-manager's migrate reads it: a range admitting two majors (`>=3.0.0`) or only pre-releases fails. The migrate run writes each release's 3.x values (`muster.requireApproval: true` → `default: Ask` where the muster binding renders, the key dropped, an unset `modelConfig.name` spelled out as the 2.x default `default-model-config`) only once a 3.x chart is published and only where it moves the namespace's source in the same run. It writes no release with `spec.valuesFrom` (reported `failed` with what to change), none whose source it cannot move (pinned, owned by git, the platform's: `pending` with the diff), and nothing in organization namespaces, whose releases it reports with diffs; any of them keeps the report in the expand phase. @@ -27,7 +27,7 @@ The migrate run writes each release's 3.x values (`muster.requireApproval: true` - Once the floors are set: move `agent-manager.agentChart.semver` and `components.default-agent.versionRange` to `>=3.0.0 <4.0.0` together with `components.agent-manager.versionRange` and `components.muster.versionRange` at or above the floors. The render refuses the line without the two component floors, without tool approval, or with the default agent on the other major; moving the component ranges alone renders. - Tool approval's prerequisites must hold (muster's OAuth server with Dex sign-in, Valkey storage; the entry below): without them muster refuses every call that asks, so an agent migrated to `default: Ask` cannot call its tools until they hold. It never runs them unasked. -- **Mandatory before the upgrade:** run `agent-manager migrate --dry-run` against the target range (or read the report of the platform release that carries agent-manager's floor) and fix every release it lists. The agent-platform-operator moves every organization's chart source at once with the range, and nothing holds it: a release there that still carries `muster.requireApproval` fails its 3.x render and stays on its 2.x revision, still asking through kagent, until fixed; one without `modelConfig.name` renders without a model. Also check releases whose values come from `valuesFrom`: `kubectl get helmreleases -A -o json | jq -r '.items[] | select(.spec.values.muster.requireApproval != null or .spec.values.modelConfig.name == null or (.spec.valuesFrom // [] | length > 0)) | "\(.metadata.namespace)/\(.metadata.name)"'` and the ConfigMaps or Secrets they name. +- **Mandatory before the upgrade:** with the line still on 2.x, set `agentManager.migration.preflightSemver: ">=3.0.0 <4.0.0"` (it renders the never-started CronJob `-agent-manager-migrate-preflight` and grants the migration's identity the read-only access the 3.x path needs: list namespaces; with organizations, read their HelmReleases, OCIRepositories and Agents), then run `kubectl -n create job --from=cronjob/-agent-manager-migrate-preflight preflight-1` and read the report in `kubectl -n logs job/preflight-1` (a dry run writes no ConfigMap). Fix every release it lists, including those in organization namespaces, before moving the line; unset `preflightSemver` afterwards to drop the extra reads. The agent-platform-operator moves every organization's chart source at once with the range, and nothing holds it: a release there that still carries `muster.requireApproval` fails its 3.x render and stays on its 2.x revision, still asking through kagent, until fixed; one without `modelConfig.name` renders without a model. Also check releases whose values come from `valuesFrom`: `kubectl get helmreleases -A -o json | jq -r '.items[] | select(.spec.values.muster.requireApproval != null or .spec.values.modelConfig.name == null or (.spec.valuesFrom // [] | length > 0)) | "\(.metadata.namespace)/\(.metadata.name)"'` and the ConfigMaps or Secrets they name. - The repair is always **replace `muster.requireApproval: true` with `default: Ask`**, never just delete the key (that turns the agent's asks off); drop `requireApproval: false` and `null`; set `modelConfig.name` where it is unset. In git, apply it together with the move of that release's chart source to 3.x; for `valuesFrom`, move the settings into `spec.values` (agent-manager binds settings only from there). - Running Sessions: with tool approval on (agent-manager at `agent-platform.agentManager.toolApprovalFloor`), agent-manager binds a Session of an agent on `muster.requireApproval: true` with `default: Ask` already on 2.x, so such an agent needs muster's approval prerequisites from then on, not only on 3.x; (such an agent is asked twice there, by kagent and by muster, until it is migrated), so Sessions running across the upgrade keep asking. A Session started by an agent-manager below `agent-platform.agentManager.toolApprovalFloor` carries no settings and muster applies the agent's re-rendered `X-Muster-Tool-Approval: default=Ask`. - Read the report after the run: `kubectl -n get configmap agent-manager-migrate-report -o jsonpath='{.data.report\.yaml}'`; each rewritten release lists `changes.removed` and `changes.set`. A release carrying `requireApproval: true` beside tool approval settings is reported failed (no released chart renders that combination) and holds its chart source; set its settings by hand. The run needs list on namespaces and read access in organization namespaces (the chart grants them only on a 3.x line); without them it fails before it writes anything (`--organization-namespaces none` skips them, leaving them unchecked). From e48616a07c5a7c1b39f4b4e2589ebdaa7abb74c0 Mon Sep 17 00:00:00 2001 From: Dominik Schmidle Date: Thu, 26 Nov 2026 11:51:11 +0100 Subject: [PATCH 33/56] feat(helm): make governance a map with roleFloors and drop installation-specific defaults governance mirrors muster's governance configuration: {mode: trusted | governed, roleFloors: {role: [tools]}}; roleFloors renders as muster.governance.roleFloors (added to muster's built-in floors) and a role declared there is a valid governedServers role. A string fails the render with a hint. The default governedServers entry for a vendor's own server and the vendor admin groups as connector-admin and workflow-editor subjects are gone: the editors default to placeholder groups nobody belongs to, and an installation names its own. Tests use generic fixtures, the agent chart line check reads an exact version pin as its major, and private references are removed from templates and tests. --- .../templates/_helpers.tpl | 4 +- .../templates/kagent/_migrate.tpl | 2 +- .../templates/kagent/migrate-cronjob.yaml | 4 +- .../templates/kagent/migrate-rbac.yaml | 6 +- helm/agent-platform-connectivity/values.yaml | 8 +- helm/agent-platform/README.md | 63 ++++++---- helm/agent-platform/README.md.gotmpl | 45 ++++--- helm/agent-platform/templates/_helpers.tpl | 84 +++++++++---- helm/agent-platform/values.schema.json | 48 ++++---- helm/agent-platform/values.yaml | 114 +++++++++--------- tests/golden/meta-ci-engine-off.yaml | 20 +-- tests/golden/meta-default.yaml | 20 +-- tests/verify-agent-chart-line.py | 18 +-- tests/verify-prereleases.py | 10 +- tests/verify-tenant-rbac.py | 11 +- tests/verify-tool-approval.py | 86 ++++++++----- 16 files changed, 309 insertions(+), 234 deletions(-) diff --git a/helm/agent-platform-connectivity/templates/_helpers.tpl b/helm/agent-platform-connectivity/templates/_helpers.tpl index daabf660..ee5c289c 100644 --- a/helm/agent-platform-connectivity/templates/_helpers.tpl +++ b/helm/agent-platform-connectivity/templates/_helpers.tpl @@ -2560,8 +2560,8 @@ string, so `with` gates a caller's comment). Include with nindent under {{- end -}} {{/* -An MCPServer's spec.approval from a values block (Governing tool calls, -giantswarm/giantswarm#38902), validated the way the CRD's CEL rules check it so +An MCPServer's spec.approval from a values block (Governing tool calls), +validated the way the CRD's CEL rules check it so a wrong value fails the render naming the key: `rule` Allow, Ask or Block (a Block rule hides and refuses every tool without its own entry), `tools` a map of at most 512 tool names to Allow, Ask or Block, nothing else. Renders the diff --git a/helm/agent-platform-connectivity/templates/kagent/_migrate.tpl b/helm/agent-platform-connectivity/templates/kagent/_migrate.tpl index 8df05fc8..7a510708 100644 --- a/helm/agent-platform-connectivity/templates/kagent/_migrate.tpl +++ b/helm/agent-platform-connectivity/templates/kagent/_migrate.tpl @@ -147,7 +147,7 @@ migrate probes it. Truthy when a run of the migration takes the 2.x -> 3.x path and reads the organization namespaces (migrate-rbac.yaml): agent-manager.agentChart.semver (as the run takes it) is a 3.x line, or agentManager.migration.preflightSemver -is, for the dry run before the line moves (M3I-1). +is, for the dry run before the line moves. */}} {{- define "agent-platform.kagent.migration.v3Line" -}} {{- $am := include "agent-platform.agentManager.chartValues" . | fromJson -}} diff --git a/helm/agent-platform-connectivity/templates/kagent/migrate-cronjob.yaml b/helm/agent-platform-connectivity/templates/kagent/migrate-cronjob.yaml index 55a6a581..e2490722 100644 --- a/helm/agent-platform-connectivity/templates/kagent/migrate-cronjob.yaml +++ b/helm/agent-platform-connectivity/templates/kagent/migrate-cronjob.yaml @@ -5,7 +5,7 @@ expand–contract): `agent-manager migrate`, run once per pod template, in the kagent namespace, as the ServiceAccount of the migration's own name (migrate-rbac.yaml), never the agents' Flux identity. The major of agent-manager.agentChart.semver picks the path. A 3.x range picks 2.x -> 3.x -(agent chart 3.0, giantswarm/giantswarm#38902 slice 8): the command rewrites +(agent chart 3.0): the command rewrites muster.requireApproval: true to default: Ask and spells out the 2.x modelConfig.name default, before it moves a namespace's OCIRepository to 3.x, and emits the same as a diff for a GitOps-owned release; both lines render @@ -165,7 +165,7 @@ spec: template: {{- $template | nindent 8 }} {{- with $m.preflightSemver }} -{{- /* The preflight (M3I-1): the same run, dry, against preflightSemver, +{{- /* The preflight: the same run, dry, against preflightSemver, never started by the hook: `kubectl create job --from=cronjob/` before the agent chart line moves, as UPGRADE.md says. */ -}} {{- $pre := list }} diff --git a/helm/agent-platform-connectivity/templates/kagent/migrate-rbac.yaml b/helm/agent-platform-connectivity/templates/kagent/migrate-rbac.yaml index 8fb11dca..9c29b766 100644 --- a/helm/agent-platform-connectivity/templates/kagent/migrate-rbac.yaml +++ b/helm/agent-platform-connectivity/templates/kagent/migrate-rbac.yaml @@ -19,8 +19,8 @@ a cluster-wide list on their kagent.dev resources, which proves a CRD empty before it goes. verify-flux-identity asserts these rights and no other cluster-scoped binding of the identity on the 2.x line. -Only while agent-manager.agentChart.semver is a 3.x line (the 2.x -> 3.x path, -giantswarm/giantswarm#38902 slice 8) the same ClusterRole also lets the run +Only while agent-manager.agentChart.semver is a 3.x line (the 2.x -> 3.x path) +the same ClusterRole also lets the run list namespaces (it finds the organization namespaces by label and fails when it may not) and, with agentPlatformOrganizations.enabled, list and get the HelmReleases and OCIRepositories and list the Agents it reads there, never @@ -115,7 +115,7 @@ rules: - apiGroups: ["kagent.dev"] resources: {{ $legacyCRDs | toJson }} verbs: ["list"] - # Organization namespaces (giantswarm/giantswarm#38902, slice 8): on the + # Organization namespaces: on the # agent chart 2.x -> 3.x path the run lists the namespaces labelled as an # organization's and fails when it may not; it reads their releases, chart # sources and Agents, never writes them, and reports what needs changing diff --git a/helm/agent-platform-connectivity/values.yaml b/helm/agent-platform-connectivity/values.yaml index 49690efb..44c86a66 100644 --- a/helm/agent-platform-connectivity/values.yaml +++ b/helm/agent-platform-connectivity/values.yaml @@ -1803,8 +1803,8 @@ kagent: # @schema skipProperties: true; additionalProperties: true # The line the Dev Portal shows under the server's name (the MCPServer's # spec.description, at most 500 characters); empty renders none. description: "Your agent sessions on this installation, as the signed-in person: list them, send one a message, and checkpoint or fork them" - # The connector's tool approval (the MCPServer's spec.approval; Governing - # tool calls, https://docs.giantswarm.io/overview/agent-platform/governing-tool-calls/): + # The connector's tool approval (the MCPServer's spec.approval; further + # reading, optional: https://docs.giantswarm.io/overview/agent-platform/governing-tool-calls/): # `rule` (Allow | Ask | Block; a Block rule hides and refuses every # tool without its own entry, new ones included) for a tool without its # own entry, and `tools`, the server's own tool names -> Allow | Ask | @@ -3700,8 +3700,8 @@ mcp-kubernetes: # @schema skipProperties: true; additionalProperties: true # What the Dev Portal shows under the name (the MCPServer's # spec.description), at most 500 characters. Empty renders none. description: "Resources, events and pod logs of this installation's cluster, and the health of its workload clusters" - # The connector's tool approval (the MCPServer's spec.approval; Governing - # tool calls, https://docs.giantswarm.io/overview/agent-platform/governing-tool-calls/): + # The connector's tool approval (the MCPServer's spec.approval; further + # reading, optional: https://docs.giantswarm.io/overview/agent-platform/governing-tool-calls/): # `rule` (Allow | Ask | Block; a Block rule hides and refuses every tool # without its own entry) for a tool without its own entry, new tools # included, and `tools`, the server's own tool names -> Allow | Ask | Block diff --git a/helm/agent-platform/README.md b/helm/agent-platform/README.md index 69744fc3..d71c5b16 100644 --- a/helm/agent-platform/README.md +++ b/helm/agent-platform/README.md @@ -380,11 +380,11 @@ required); below `1.3.0` the key is refused. Every tool behind muster is **Allow**, **Ask** (a person confirms the call first) or **Block** (hidden and refused); a connector's `rule` (Allow, Ask or Block) is what a tool without its own -entry gets, new tools included, so a Block rule lets nobody add an unreviewed tool. The concept, -who sets what and the prompts are on +entry gets, new tools included, so a Block rule lets nobody add an unreviewed tool. muster's +documentation describes the settings and the prompts; further reading (optional): [Governing tool calls](https://docs.giantswarm.io/overview/agent-platform/governing-tool-calls/). What this chart configures: -- **`governance`** (`trusted`, the default, or `governed`) and **`governedServers`**: the meta +- **`governance.mode`** (`trusted`, the default, or `governed`) and **`governedServers`**: the meta chart renders muster's governance configuration (`muster.governance`: `mode` and `governedServers`, one `{server, role, safe}` per MCPServer the platform ships while it renders) from the muster release that reads it (`agent-platform.muster.governanceFloor`). On governed, @@ -396,14 +396,28 @@ who sets what and the prompts are on governed server of that role, so the servers are named on trusted as well. Sources: the manager components (their `muster.mcpServer.name` in their namespace), `kagent` (the connectivity chart's session tools), `mcp-kubernetes` (the connectivity chart's and every agent-platform-mcps - kubernetes entry) and `giantswarm-platform-manager`; a server outside muster's namespace is keyed - `namespace/name`. `null` drops a source; `governanceExempt` names the shipped sources that are + kubernetes entry), and any other key as a muster server key itself (a server the installation + registers); a server outside muster's namespace is keyed `namespace/name`. `null` drops a source; `governanceExempt` names the shipped sources that are deliberately not governed (prometheus, capi: reads only). An own `muster.muster.governance.governedServers` entry stands for its server; the earlier `muster.muster.governance.servers.` shape fails the render, as does `governed` below the - muster floor (it would ask nothing). Persons get the connector settings only. Only admins switch - the mode, through the Platform Manager with a second person's approval. Anything but the two - values fails the render. + muster floor (it would ask nothing). Persons get the connector settings only. The mode is set + with this chart value; no agent tool changes it. `governance` mirrors muster's own governance + configuration (`{mode, roleFloors}`); a string there fails the render. Anything but the two values fails the render. +- **`governance.roleFloors`** (default `{}`): role name to the server's own tool names that ask agents + in both modes on the governed servers of that role, rendered as `muster.governance.roleFloors` and + added to muster's built-in floors (config never removes one). A role declared here is a valid + `role` in `governedServers`, so an installation governs a server of its own: + + ```yaml + governance: + roleFloors: + exampleManager: [approve_change, merge_change] + governedServers: + example-manager: + role: exampleManager + safe: [get_info, list_changes] + ``` - **What approval needs, and what this chart renders for it.** Asking calls refuse with the reason unless muster's shared store is Valkey, muster runs its OAuth server (the browser sign-in through Dex) and has a public URL on that server's origin. The bundled Valkey and @@ -431,12 +445,15 @@ who sets what and the prompts are on the same client retries, over any MCP session; another client of the same person asks anew. At most 3 pending approvals per client and 10 per person. - **The `connector-admin` role** is muster's `mcpserver-editor` Role in muster's namespace, bound to - `muster.rbac.mcpServerEditor.subjects` (the Giant Swarm admin groups) plus `tenants.platformTeam`. - Whoever holds it edits the namespace's connectors, sets their tool approval and may let an agent - skip a tool's `Ask`. The muster chart no longer binds `system:authenticated` and fails an upgrade - with an empty list while its old binding exists; this list is never empty by default, so the - upgrade passes and the editors become the admin groups (`system:authenticated` makes everyone one - again). + `muster.rbac.mcpServerEditor.subjects` plus `tenants.platformTeam`. Whoever holds it edits the + namespace's connectors, sets their tool approval and may let an agent skip a tool's `Ask`. The + default is a placeholder group nobody belongs to unless the identity provider says so + (`agent-platform:connector-admins`; `muster.rbac.workflowEditor.subjects` likewise + `agent-platform:workflow-editors`): until the installation names its admin groups (as the API + server sees them, with the OIDC groups prefix), only cluster admins edit connectors. The muster + chart no longer binds `system:authenticated` and fails an upgrade with an empty list while its + old binding exists; the placeholder keeps the list non-empty (`system:authenticated` makes + everyone a connector admin). - **`muster-approval-binder`**: muster takes an agent's tool settings in a Session binding only from a sender allowed to `bind` `toolapprovals` in muster's namespace. The muster chart ships that Role and binds it there, to `muster.rbac.approvalBinder.subjects`, which the meta chart sets to @@ -996,16 +1013,10 @@ The map is merged into each component's own `nodeSelector` (`muster.nodeSelector | muster.crds.install | bool | `false` | | | muster.rbac.mcpServerEditor.subjects[0].apiGroup | string | `"rbac.authorization.k8s.io"` | | | muster.rbac.mcpServerEditor.subjects[0].kind | string | `"Group"` | | -| muster.rbac.mcpServerEditor.subjects[0].name | string | `"giantswarm-ad:giantswarm-admins"` | | -| muster.rbac.mcpServerEditor.subjects[1].apiGroup | string | `"rbac.authorization.k8s.io"` | | -| muster.rbac.mcpServerEditor.subjects[1].kind | string | `"Group"` | | -| muster.rbac.mcpServerEditor.subjects[1].name | string | `"giantswarm-github:giantswarm:giantswarm-admins"` | | +| muster.rbac.mcpServerEditor.subjects[0].name | string | `"agent-platform:connector-admins"` | | | muster.rbac.workflowEditor.subjects[0].apiGroup | string | `"rbac.authorization.k8s.io"` | | | muster.rbac.workflowEditor.subjects[0].kind | string | `"Group"` | | -| muster.rbac.workflowEditor.subjects[0].name | string | `"giantswarm-ad:giantswarm-admins"` | | -| muster.rbac.workflowEditor.subjects[1].apiGroup | string | `"rbac.authorization.k8s.io"` | | -| muster.rbac.workflowEditor.subjects[1].kind | string | `"Group"` | | -| muster.rbac.workflowEditor.subjects[1].name | string | `"giantswarm-github:giantswarm:giantswarm-admins"` | | +| muster.rbac.workflowEditor.subjects[0].name | string | `"agent-platform:workflow-editors"` | | | muster.networkPolicy.enabled | bool | `true` | | | muster.networkPolicy.flavor | string | `"auto"` | | | muster.networkPolicy.cilium.allowClusterIngress | bool | `true` | | @@ -1641,11 +1652,13 @@ The map is merged into each component's own `nodeSelector` (`muster.nodeSelector | clusterManager.networkPolicy.workloadClusters.ports[1] | int | `6443` | | | clusterManager.networkPolicy.egress.fqdns | list | `[]` | | | clusterManager.networkPolicy.egress.cidrs | list | `[]` | | -| governance | string | `"trusted"` | The platform's governance mode: trusted (the default) or governed. It changes no tool approval setting's meaning; it adds asking for agent callers. Governed asks a person before an agent runs any tool of a governed server (governedServers below) that is not on that server's safe list (new and renamed tools too), and before any of muster's own tools but its reads; the Dev Portal's connector wizard pre-selects the Recommended preset (read-only tools run, the rest ask). Trusted lets agents run what the connectors' own settings allow and pre-selects Allow all. In both modes muster's built-in floors ask a person before an agent adds or repoints a connector, changes approval settings, grants access, adds a model, egress origin, credential or backend, approves an action or a toolchain source, or changes muster's own configuration; the role floors hold on the governed servers of that role, so governedServers names them in both modes. The meta chart renders muster's governance configuration from it (muster.governance: the mode and governedServers), from the muster release that reads it (agent-platform.muster.governanceFloor); below it `governed` fails the render and trusted renders nothing. From that release the meta chart also renders muster.approval.installation (backstage.installationName, the name the approval page shows), muster-approval-binder's subject (agent-manager's ServiceAccount, muster.rbac.approvalBinder.subjects) and the pages muster may return the browser to after an approval in muster.oauth.mcpClient.postLoginRedirectAllowlist (the portal's /sessions with backstage.publicPort, klausGateway.obo.callbackBaseUrl + /auth/slack/return; an own list's entries stay). Approval itself needs muster's OAuth server with Dex sign-in, Valkey storage (the default) and muster.muster.oauth.mcpClient.publicUrl on the OAuth server's origin with mcpClient.enabled for the allowlist; the chart does not fail without them, muster refuses asking calls with the reason. Only admins switch it, through the Platform Manager with a second person's approval; never an agent. Anything else fails the render. Concept: https://docs.giantswarm.io/overview/agent-platform/governing-tool-calls/ | -| governedServers | object | `{"agent-manager":{"role":"agentManager","safe":["get_info","list_agents","get_agent","get_agent_status","validate_agent","list_model_configs","list_egress_policies","list_skills","list_sessions","get_session","get_session_turn","toolchain_users","list_organizations","get_organization","list_organization_members","list_organization_connectors"]},"cluster-manager":{"role":"clusterManager","safe":["get_info","list_clusters","list_releases","list_node_pools"]},"giantswarm-platform-manager":{"role":"platformManager","safe":["get_info","list_installations","list_actions","get_action","verify_capability"]},"kagent":{"role":"sessionManager","safe":["list_sessions","list_session_checkpoints","list_sandbox_templates","list_sandboxes","get_sandbox","get_sandbox_process","read_sandbox_outputs","read_sandbox_file"]},"mcp-kubernetes":{"role":"infrastructure","safe":["logs","list_port_forward_sessions","context_list","context_get_current","can_i","api_resources","cluster_health","capi_list_clusters","capi_get_cluster","capi_resolve_cluster","capi_cluster_health","get","list","describe"]},"model-manager":{"role":"modelManager","safe":["get_info","get_backend","list_backends","list_models","get_model","list_loaded_models","list_presets","search_models","check_fit","list_nodes","list_jobs","get_job"]},"skill-manager":{"role":"skillManager","safe":["list_skill_sources","list_skills","resolve_skills","get_skill","get_skill_file"]},"toolchain-manager":{"role":"toolchainManager","safe":["list_sources","list_toolchains","describe_toolchain","toolchain_build_status","search_packages"]},"vm-manager":{"role":"vmManager","safe":["get_info","get_host","list_images","get_image","list_networks","get_network","list_vms","get_vm","get_vm_metrics","get_vm_attestation"]},"workspace-manager":{"role":"workspaceManager","safe":["list_providers","list_owners","list_workspaces","get_workspace","list_repositories","preview_workspace"]}}` | The servers muster governs (muster.governance.governedServers), per source the platform ships: `role` (which of muster's role floors hold on it: agentManager, platformManager, connectorManager, sessionManager, modelManager, clusterManager, vmManager, workspaceManager, toolchainManager, skillManager, infrastructure) and `safe`, the server's own tool names agents call unasked on governed (reads only; a floor never, muster refuses to start on one). Every other tool of a governed server asks agents on governed. A source renders one entry per MCPServer it ships while that renders (agent-platform.muster.governedKeys): a manager component's .muster.mcpServer.name in its namespace; kagent the connectivity chart's kagent server; mcp-kubernetes the connectivity chart's and every agent-platform-mcps kubernetes entry; any other key is a muster server key itself (giantswarm-platform-manager). null drops a source (then list it in governanceExempt with the reason). make verify-tool-approval fails on a shipped MCPServer that is neither here nor in governanceExempt, and on a safe entry that names a floor or no tool of its server, or whose name starts with a write verb (create, delete, exec, set, approve, ...) unless a `# safe-write: : ` comment above `safe:` says why it reads. Safe lists: tool-approval governed-safe-list-proposal (giantswarm/giantswarm#38902). | +| governance | object | `{"mode":"trusted","roleFloors":{}}` | The platform's governance (mode and role floors). The mode, trusted (the default) or governed, changes no tool approval setting's meaning; it adds asking for agent callers. Governed asks a person before an agent runs any tool of a governed server (governedServers below) that is not on that server's safe list (new and renamed tools too), and before any of muster's own tools but its reads; the Dev Portal's connector wizard pre-selects the Recommended preset (read-only tools run, the rest ask). Trusted lets agents run what the connectors' own settings allow and pre-selects Allow all. In both modes muster's built-in floors ask a person before an agent adds or repoints a connector, changes approval settings, grants access, adds a model, egress origin, credential or backend, approves an action or a toolchain source, or changes muster's own configuration; the role floors hold on the governed servers of that role, so governedServers names them in both modes. The meta chart renders muster's governance configuration from it (muster.governance: the mode and governedServers), from the muster release that reads it (agent-platform.muster.governanceFloor); below it `governed` fails the render and trusted renders nothing. From that release the meta chart also renders muster.approval.installation (backstage.installationName, the name the approval page shows), muster-approval-binder's subject (agent-manager's ServiceAccount, muster.rbac.approvalBinder.subjects) and the pages muster may return the browser to after an approval in muster.oauth.mcpClient.postLoginRedirectAllowlist (the portal's /sessions with backstage.publicPort, klausGateway.obo.callbackBaseUrl + /auth/slack/return; an own list's entries stay). Approval itself needs muster's OAuth server with Dex sign-in, Valkey storage (the default) and muster.muster.oauth.mcpClient.publicUrl on the OAuth server's origin with mcpClient.enabled for the allowlist; the chart does not fail without them, muster refuses asking calls with the reason. The mode is set with this chart value (no agent tool changes it). The block mirrors muster's own governance configuration; a string here (the earlier scalar) fails the render. Further reading (optional): https://docs.giantswarm.io/overview/agent-platform/governing-tool-calls/ | +| governance.mode | string | `"trusted"` | trusted (the default) or governed; anything else fails the render. | +| governance.roleFloors | object | `{}` | Floors per governance role (muster.governance.roleFloors): role -> the server's own tool names that ask agents in both modes on the governed servers of that role, added to muster's built-in floors (config can only add: a built-in floor is never removed). A role named here is a valid `role` of governedServers. For a server the installation registers itself, e.g.: governance: roleFloors: exampleManager: [approve_change, merge_change] governedServers: example-manager: role: exampleManager safe: [get_info, list_changes] Rendered from the muster release that reads the governance configuration (agent-platform.muster.governanceFloor), like governedServers. | +| governedServers | object | `{"agent-manager":{"role":"agentManager","safe":["get_info","list_agents","get_agent","get_agent_status","validate_agent","list_model_configs","list_egress_policies","list_skills","list_sessions","get_session","get_session_turn","toolchain_users","list_organizations","get_organization","list_organization_members","list_organization_connectors"]},"cluster-manager":{"role":"clusterManager","safe":["get_info","list_clusters","list_releases","list_node_pools"]},"kagent":{"role":"sessionManager","safe":["list_sessions","list_session_checkpoints","list_sandbox_templates","list_sandboxes","get_sandbox","get_sandbox_process","read_sandbox_outputs","read_sandbox_file"]},"mcp-kubernetes":{"role":"infrastructure","safe":["logs","list_port_forward_sessions","context_list","context_get_current","can_i","api_resources","cluster_health","capi_list_clusters","capi_get_cluster","capi_resolve_cluster","capi_cluster_health","get","list","describe"]},"model-manager":{"role":"modelManager","safe":["get_info","get_backend","list_backends","list_models","get_model","list_loaded_models","list_presets","search_models","check_fit","list_nodes","list_jobs","get_job"]},"skill-manager":{"role":"skillManager","safe":["list_skill_sources","list_skills","resolve_skills","get_skill","get_skill_file"]},"toolchain-manager":{"role":"toolchainManager","safe":["list_sources","list_toolchains","describe_toolchain","toolchain_build_status","search_packages"]},"vm-manager":{"role":"vmManager","safe":["get_info","get_host","list_images","get_image","list_networks","get_network","list_vms","get_vm","get_vm_metrics","get_vm_attestation"]},"workspace-manager":{"role":"workspaceManager","safe":["list_providers","list_owners","list_workspaces","get_workspace","list_repositories","preview_workspace"]}}` | The servers muster governs (muster.governance.governedServers), per source the platform ships: `role` (which of muster's role floors hold on it: agentManager, connectorManager, sessionManager, modelManager, clusterManager, vmManager, workspaceManager, toolchainManager, skillManager, infrastructure, or a role governance.roleFloors declares) and `safe`, the server's own tool names agents call unasked on governed (reads only; a floor never, muster refuses to start on one). Every other tool of a governed server asks agents on governed. A source renders one entry per MCPServer it ships while that renders (agent-platform.muster.governedKeys): a manager component's .muster.mcpServer.name in its namespace; kagent the connectivity chart's kagent server; mcp-kubernetes the connectivity chart's and every agent-platform-mcps kubernetes entry; any other key is a muster server key itself (a server the installation registers, e.g. example-manager). null drops a source (then list it in governanceExempt with the reason). make verify-tool-approval fails on a shipped MCPServer that is neither here nor in governanceExempt, and on a safe entry that names a floor or no tool of its server, or whose name starts with a write verb (create, delete, exec, set, approve, ...) unless a `# safe-write: : ` comment above `safe:` says why it reads. | | governanceExempt | object | `{"capi":"agent-platform-mcps' capi family (mcp-kubernetes' CAPI tools): every tool reads","prometheus":"agent-platform-mcps' prometheus family (mcp-prometheus): every tool reads"}` | MCPServer sources the platform ships that muster deliberately does not govern, each with its reason (make verify-tool-approval wants every shipped source in governedServers or here). Read by the meta chart's tests only. | | tenants.platform.users | list | `[{"apiGroup":"rbac.authorization.k8s.io","kind":"Group","name":"system:authenticated"}]` | Every signed-in person: bound to agent-platform:platform-user in the kagent namespace, and, while musterMcpServerViewers is unset, to `list` (with get and watch) on muster's MCPServers in muster's namespace (the servers for everyone). RBAC subjects. The default, system:authenticated, gives this to every user. It also gives it to every ServiceAccount, so every pod in the cluster can read the platform tenant's Agents, RemoteMCPServer URLs and muster's MCPServer specs. To give it to people only, replace the default with an OIDC group that every user belongs to, written as the API server sees it (with the installation's OIDC groups prefix). | -| tenants.platform.editors | list | `[{"apiGroup":"rbac.authorization.k8s.io","kind":"Group","name":"giantswarm-ad:giantswarm-admins"},{"apiGroup":"rbac.authorization.k8s.io","kind":"Group","name":"giantswarm-github:giantswarm:giantswarm-admins"}]` | The platform's operators: bound to agent-platform:editor in the kagent namespace. RBAC subjects. The Giant Swarm admin groups, as in muster.rbac.*.subjects. | +| tenants.platform.editors | list | `[{"apiGroup":"rbac.authorization.k8s.io","kind":"Group","name":"giantswarm-ad:giantswarm-admins"},{"apiGroup":"rbac.authorization.k8s.io","kind":"Group","name":"giantswarm-github:giantswarm:giantswarm-admins"}]` | The platform's operators: bound to agent-platform:editor in the kagent namespace. RBAC subjects. | | tenants.platform.kagentRelease.name | string | `""` | The name of kagent's HelmRelease in the kagent namespace. Empty, the default, admits none. | | tenants.platform.kagentRelease.writers | list | `[]` | The identities that write it: RBAC-style subjects of kind User, Group or ServiceAccount (with its namespace), as the API server sees them (a kubeconfig's user or group, a Flux ServiceAccount). | | tenants.platformTeam | list | `[]` | The customer's platform team, per installation: RBAC subjects bound to agent-platform:editor in the kagent namespace beside `platform.editors`, and added to muster's mcpserver-editor and workflow-editor subjects beside muster.rbac.*.subjects (the meta chart appends them to the muster release's values). Empty by default. A group is written as the API server sees it (with the OIDC groups prefix of the installation). | diff --git a/helm/agent-platform/README.md.gotmpl b/helm/agent-platform/README.md.gotmpl index 2526f253..761f9468 100644 --- a/helm/agent-platform/README.md.gotmpl +++ b/helm/agent-platform/README.md.gotmpl @@ -366,11 +366,11 @@ required); below `1.3.0` the key is refused. Every tool behind muster is **Allow**, **Ask** (a person confirms the call first) or **Block** (hidden and refused); a connector's `rule` (Allow, Ask or Block) is what a tool without its own -entry gets, new tools included, so a Block rule lets nobody add an unreviewed tool. The concept, -who sets what and the prompts are on +entry gets, new tools included, so a Block rule lets nobody add an unreviewed tool. muster's +documentation describes the settings and the prompts; further reading (optional): [Governing tool calls](https://docs.giantswarm.io/overview/agent-platform/governing-tool-calls/). What this chart configures: -- **`governance`** (`trusted`, the default, or `governed`) and **`governedServers`**: the meta +- **`governance.mode`** (`trusted`, the default, or `governed`) and **`governedServers`**: the meta chart renders muster's governance configuration (`muster.governance`: `mode` and `governedServers`, one `{server, role, safe}` per MCPServer the platform ships while it renders) from the muster release that reads it (`agent-platform.muster.governanceFloor`). On governed, @@ -382,14 +382,28 @@ who sets what and the prompts are on governed server of that role, so the servers are named on trusted as well. Sources: the manager components (their `muster.mcpServer.name` in their namespace), `kagent` (the connectivity chart's session tools), `mcp-kubernetes` (the connectivity chart's and every agent-platform-mcps - kubernetes entry) and `giantswarm-platform-manager`; a server outside muster's namespace is keyed - `namespace/name`. `null` drops a source; `governanceExempt` names the shipped sources that are + kubernetes entry), and any other key as a muster server key itself (a server the installation + registers); a server outside muster's namespace is keyed `namespace/name`. `null` drops a source; `governanceExempt` names the shipped sources that are deliberately not governed (prometheus, capi: reads only). An own `muster.muster.governance.governedServers` entry stands for its server; the earlier `muster.muster.governance.servers.` shape fails the render, as does `governed` below the - muster floor (it would ask nothing). Persons get the connector settings only. Only admins switch - the mode, through the Platform Manager with a second person's approval. Anything but the two - values fails the render. + muster floor (it would ask nothing). Persons get the connector settings only. The mode is set + with this chart value; no agent tool changes it. `governance` mirrors muster's own governance + configuration (`{mode, roleFloors}`); a string there fails the render. Anything but the two values fails the render. +- **`governance.roleFloors`** (default `{}`): role name to the server's own tool names that ask agents + in both modes on the governed servers of that role, rendered as `muster.governance.roleFloors` and + added to muster's built-in floors (config never removes one). A role declared here is a valid + `role` in `governedServers`, so an installation governs a server of its own: + + ```yaml + governance: + roleFloors: + exampleManager: [approve_change, merge_change] + governedServers: + example-manager: + role: exampleManager + safe: [get_info, list_changes] + ``` - **What approval needs, and what this chart renders for it.** Asking calls refuse with the reason unless muster's shared store is Valkey, muster runs its OAuth server (the browser sign-in through Dex) and has a public URL on that server's origin. The bundled Valkey and @@ -417,12 +431,15 @@ who sets what and the prompts are on the same client retries, over any MCP session; another client of the same person asks anew. At most 3 pending approvals per client and 10 per person. - **The `connector-admin` role** is muster's `mcpserver-editor` Role in muster's namespace, bound to - `muster.rbac.mcpServerEditor.subjects` (the Giant Swarm admin groups) plus `tenants.platformTeam`. - Whoever holds it edits the namespace's connectors, sets their tool approval and may let an agent - skip a tool's `Ask`. The muster chart no longer binds `system:authenticated` and fails an upgrade - with an empty list while its old binding exists; this list is never empty by default, so the - upgrade passes and the editors become the admin groups (`system:authenticated` makes everyone one - again). + `muster.rbac.mcpServerEditor.subjects` plus `tenants.platformTeam`. Whoever holds it edits the + namespace's connectors, sets their tool approval and may let an agent skip a tool's `Ask`. The + default is a placeholder group nobody belongs to unless the identity provider says so + (`agent-platform:connector-admins`; `muster.rbac.workflowEditor.subjects` likewise + `agent-platform:workflow-editors`): until the installation names its admin groups (as the API + server sees them, with the OIDC groups prefix), only cluster admins edit connectors. The muster + chart no longer binds `system:authenticated` and fails an upgrade with an empty list while its + old binding exists; the placeholder keeps the list non-empty (`system:authenticated` makes + everyone a connector admin). - **`muster-approval-binder`**: muster takes an agent's tool settings in a Session binding only from a sender allowed to `bind` `toolapprovals` in muster's namespace. The muster chart ships that Role and binds it there, to `muster.rbac.approvalBinder.subjects`, which the meta chart sets to diff --git a/helm/agent-platform/templates/_helpers.tpl b/helm/agent-platform/templates/_helpers.tpl index 9484e082..ee507938 100644 --- a/helm/agent-platform/templates/_helpers.tpl +++ b/helm/agent-platform/templates/_helpers.tpl @@ -533,7 +533,7 @@ takes the key (agent-platform.agentManager.toolchainsFloor). */ -}} {{- $_ := set $musterValues "toolchainsToolsPrefix" $prefix -}} {{- end -}} {{- end -}} -{{- /* Tool approval per agent (giantswarm/giantswarm#38902, slice 3): +{{- /* Tool approval per agent: agent-manager binds an agent's approval settings with every Session and refuses settings while it does not. On while muster takes them, from the floors agent-platform.muster.agentApprovalFloor and @@ -1074,7 +1074,7 @@ installation keeps its own (agent-platform.chatgpt.personalLogin). */ -}} {{- $_ := set $derived "muster" $muster -}} {{- end -}} {{- /* The customer's platform team writes the servers and workflows of -muster's namespace beside the Giant Swarm admin groups +muster's namespace beside the configured editor groups (giantswarm/agent-platform#706): tenants.platformTeam is appended to both editor bindings' subjects, so an installation names its team without repeating the admin groups. */ -}} @@ -2135,10 +2135,10 @@ each, no comment inside the define. {{- define "agent-platform.agentManager.toolsetBindingFloor" -}}2.9.0{{- end -}} {{/* -The floors of tool approval per agent (slice 3): the first agent-manager +The floors of tool approval per agent: the first agent-manager whose chart takes muster.toolApproval, and the first muster that takes an agent's approval settings with a Session binding. UNSET until those releases -exist (giantswarm/giantswarm#38902 decision #89): an empty floor admits no +exist: an empty floor admits no release, so what it gates stays off and the agent chart line cannot move to 3.x; the platform release that pins those versions sets them. A guess would switch the wiring on against released versions without the feature (muster @@ -2148,12 +2148,12 @@ inside the define. {{- define "agent-platform.agentManager.toolApprovalFloor" -}}{{- end -}} {{- define "agent-platform.muster.agentApprovalFloor" -}}{{- end -}} {{- /* The first muster serving the session bindings API on its own port -(muster.credentialProvider.sessionBindings, decision #88); UNSET until it -exists (#89). */ -}} +(muster.credentialProvider.sessionBindings); UNSET until it +exists. */ -}} {{- define "agent-platform.muster.sessionBindingsPortFloor" -}}{{- end -}} {{/* -The session bindings API muster serves agent-manager alone (decision #88): +The session bindings API muster serves agent-manager alone: from agent-platform.muster.sessionBindingsPortFloor, while muster runs its credential provider, on its own port and no longer on the aggregator port, its network policy admitting agent-manager's pods only. Emits JSON: @@ -2180,10 +2180,10 @@ Usage: include "agent-platform.muster.sessionBindings" . | fromJson {{/* The first agent-manager whose migrate has the Generic chart 2.x -> 3.x hop -(giantswarm/giantswarm#38902, slice 8): agent chart 3.0 removes +: agent chart 3.0 removes muster.requireApproval, and that migrate rewrites it to default: Ask before it moves a namespace's chart source. The same release as -agent-platform.agentManager.toolApprovalFloor; UNSET until it exists (#89), +agent-platform.agentManager.toolApprovalFloor; UNSET until it exists, which keeps every 3.x line refused. One line, no comment inside the define. */}} {{- define "agent-platform.agentManager.agentChartV3Floor" -}}{{- end -}} @@ -2200,8 +2200,9 @@ Usage: include "agent-platform.agentChart.majors" "" | fromJsonArray {{- define "agent-platform.agentChart.majors" -}} {{- $range := toString . -}} {{- $out := list -}} +{{- $exact := regexFind "^\\s*=?v?[0-9]+\\.[0-9]+\\.[0-9]+\\s*$" $range | trim | trimPrefix "=" | trimPrefix "v" -}} {{- range $m := until 100 -}} -{{- $hit := or (semverCompare $range (printf "%d.0.0" $m)) (semverCompare $range (printf "%d.999999.999999" $m)) -}} +{{- $hit := or (and $exact (eq (toString (semver $exact).Major) (toString $m))) (semverCompare $range (printf "%d.0.0" $m)) (semverCompare $range (printf "%d.999999.999999" $m)) -}} {{- if and (not $hit) (lt $m 10) -}} {{- range $n := until 200 -}} {{- if and (not $hit) (or (semverCompare $range (printf "%d.%d.0" $m $n)) (semverCompare $range (printf "%d.%d.999999" $m $n))) -}}{{- $hit = true -}}{{- end -}} @@ -2229,7 +2230,7 @@ read as the lower major. Takes a dict: range, major (the one major found). {{/* The agent chart line (agent-manager.agentChart.semver) moves to 3.x only -together with what makes that safe (slice 8): agent chart 3.0 removes +together with what makes that safe: agent chart 3.0 removes muster.requireApproval, which agent-manager's migrate rewrites to `default: Ask` from agent-platform.agentManager.agentChartV3Floor, and muster enforces `default: Ask` from agent-platform.muster.agentApprovalFloor with @@ -2239,7 +2240,7 @@ every organization's chart source at once, and the migrate run; the default agent's range (components.default-agent.versionRange) moves with it. A range spanning majors, or admitting no release version, is refused, decided as migrate decides it (agent-platform.agentChart.majors); while the two floors -are unset (#89) every 3.x line is refused. Checked whether or not agent-manager +are unset every 3.x line is refused. Checked whether or not agent-manager is on: the range reaches the operator either way. Emits nothing; fails naming the key and the fix. */}} @@ -4963,10 +4964,9 @@ comment inside the define. {{/* The first muster release that reads the governance configuration (muster.governance: the mode and the servers it names per role) and enforces -tool approval (Governing tool calls, slice 2 of giantswarm/giantswarm#38902). +tool approval (Governing tool calls). UNRELEASED: PLACEHOLDER-GOVERNANCE-FLOOR, UNSET until the release that carries -it exists (muster's tool-approval branch, giantswarm/giantswarm#38902 decision -#89: a guessed floor would render the configuration for a muster that ignores +it exists (a guessed floor would render the configuration for a muster that ignores it, so a `governed` platform would not be governed); the same floor gates the approval block and the redirect allowlist entries below (agent-platform.muster.approval, agent-platform.muster.redirectAllowlist), and @@ -4981,9 +4981,18 @@ or governed), validated: anything else fails the render naming the key. Usage: include "agent-platform.governance" $root */}} {{- define "agent-platform.governance" -}} -{{- $mode := toString (.Values.governance | default "trusted") -}} +{{- $g := .Values.governance | default dict -}} +{{- if not (kindIs "map" $g) -}} +{{- fail (printf "governance %q: governance is a map mirroring muster's governance configuration, {mode: trusted|governed, roleFloors: {role: [tools]}}: set governance.mode: %v" (toString $g) (toString $g)) -}} +{{- end -}} +{{- range $k, $_ := $g -}} +{{- if not (has $k (list "mode" "roleFloors")) -}} +{{- fail (printf "governance.%s: unknown key (want mode and roleFloors)" $k) -}} +{{- end -}} +{{- end -}} +{{- $mode := toString ($g.mode | default "trusted") -}} {{- if not (has $mode (list "trusted" "governed")) -}} -{{- fail (printf "governance %q: want trusted or governed (Governing tool calls: trusted lets agents create and start agents freely, governed asks a person first)" $mode) -}} +{{- fail (printf "governance.mode %q: want trusted or governed (Governing tool calls: trusted lets agents create and start agents freely, governed asks a person first)" $mode) -}} {{- end -}} {{- $mode -}} {{- end -}} @@ -5030,8 +5039,7 @@ for it while they render. on, and every agent-platform-mcps.mcpServers entry of group kubernetes (its name, else -mcp-kubernetes, in its namespace, else the component's); - - any other source is a server key itself (giantswarm-platform-manager, the - Platform Manager's registration, or an installation's own server). + - any other source is a server key itself (an installation's own server). Usage: include "agent-platform.muster.governedKeys" (dict "root" $ "source" $source) | fromJsonArray */}} {{- define "agent-platform.muster.governedKeys" -}} @@ -5071,9 +5079,10 @@ Usage: include "agent-platform.muster.governedKeys" (dict "root" $ "source" $sou {{- end -}} {{/* -muster's governance configuration (Governing tool calls, -giantswarm/giantswarm#38902), rendered from the platform's governance mode: -`mode` (governance) and `governedServers`, one entry {server, role, safe} per +muster's governance configuration (Governing tool calls), rendered from the +platform's governance mode: `mode` (governance), `roleFloors` +(governance.roleFloors, when it names a role: role -> tool names muster adds to +its built-in floors) and `governedServers`, one entry {server, role, safe} per MCPServer the platform ships for each source of the top-level governedServers (agent-platform.muster.governedKeys): its role names the floors muster asks agents for in both modes, its safe list the tools agents call unasked on @@ -5097,7 +5106,7 @@ Usage: include "agent-platform.muster.governance" $root | fromJson {{- $own := dig "muster" "governance" dict (.Values.muster | default dict) | default dict -}} {{- with $own.mode -}} {{- if ne (toString .) $mode -}} -{{- fail (printf "muster.muster.governance.mode (%v) differs from governance (%s): the platform's governance mode is the top-level governance value; leave muster.muster.governance.mode unset" . $mode) -}} +{{- fail (printf "muster.muster.governance.mode (%v) differs from governance.mode (%s): the platform's governance mode is governance.mode; leave muster.muster.governance.mode unset" . $mode) -}} {{- end -}} {{- end -}} {{- if $own.servers -}} @@ -5130,15 +5139,38 @@ Usage: include "agent-platform.muster.governance" $root | fromJson {{- end -}} {{- end -}} {{- $out = dict "mode" $mode "governedServers" $servers -}} +{{- $floors := dig "roleFloors" dict (.Values.governance | default dict) | default dict -}} +{{- if not (kindIs "map" $floors) -}} +{{- fail "governance.roleFloors: want a map of role names to lists of tool names" -}} +{{- end -}} +{{- range $role, $tools := $floors -}} +{{- if not (regexMatch "^[a-z][A-Za-z0-9]*$" $role) -}} +{{- fail (printf "governance.roleFloors: role %q: want a camelCase name (e.g. exampleManager)" $role) -}} +{{- end -}} +{{- if not (kindIs "slice" $tools) -}} +{{- fail (printf "governance.roleFloors.%s: want a list of the server's own tool names" $role) -}} +{{- end -}} +{{- range $tools -}} +{{- if not (and (kindIs "string" .) (regexMatch "^[A-Za-z0-9_.-]+$" .)) -}} +{{- fail (printf "governance.roleFloors.%s: %v is not a tool name" $role .) -}} +{{- end -}} +{{- end -}} +{{- end -}} +{{- if $floors -}} +{{- with $own.roleFloors -}} +{{- fail "muster.muster.governance.roleFloors and governance.roleFloors are both set: name role floors in governance.roleFloors only" -}} +{{- end -}} +{{- $_ := set $out "roleFloors" $floors -}} +{{- end -}} {{- else -}} {{- if dig "muster" "governance" nil (.Values.muster | default dict) -}} -{{- fail "muster.muster.governance is set, but this chart renders muster's governance configuration only from the muster release that reads it (agent-platform.muster.governanceFloor), and none is pinned: a mode passed to muster directly would claim a governed platform that governs nothing. Remove muster.muster.governance; the platform's mode is the top-level governance value" -}} +{{- fail "muster.muster.governance is set, but this chart renders muster's governance configuration only from the muster release that reads it (agent-platform.muster.governanceFloor), and none is pinned: a mode passed to muster directly would claim a governed platform that governs nothing. Remove muster.muster.governance; the platform's governance is the governance value (mode, roleFloors)" -}} {{- end -}} {{- if ne $mode "trusted" -}} {{- if not $floor -}} -{{- fail (printf "governance %s: no muster release this chart knows reads the governance configuration yet (agent-platform.muster.governanceFloor is unset until one is released and pinned), so nothing would ask agents; keep governance trusted" $mode) -}} +{{- fail (printf "governance.mode %s: no muster release this chart knows reads the governance configuration yet (agent-platform.muster.governanceFloor is unset until one is released and pinned), so nothing would ask agents; keep governance.mode trusted" $mode) -}} {{- end -}} -{{- fail (printf "governance %s needs muster %s or later (the first release that reads the governance configuration), but components.muster.versionRange %q allows earlier releases: below it nothing would ask agents. Move components.muster.versionRange to >=%s, or keep governance trusted" $mode $floor (dig "muster" "versionRange" "" .Values.components) $floor) -}} +{{- fail (printf "governance.mode %s needs muster %s or later (the first release that reads the governance configuration), but components.muster.versionRange %q allows earlier releases: below it nothing would ask agents. Move components.muster.versionRange to >=%s, or keep governance.mode trusted" $mode $floor (dig "muster" "versionRange" "" .Values.components) $floor) -}} {{- end -}} {{- end -}} {{- $out | toJson -}} diff --git a/helm/agent-platform/values.schema.json b/helm/agent-platform/values.schema.json index d93a5b41..d18d8e5b 100644 --- a/helm/agent-platform/values.schema.json +++ b/helm/agent-platform/values.schema.json @@ -2165,12 +2165,29 @@ "additionalProperties": true }, "governance": { - "type": "string", - "description": "The platform's governance mode: trusted (the default) or governed. It changes no tool approval setting's meaning; it adds asking for agent callers. Governed asks a person before an agent runs any tool of a governed server (governedServers below) that is not on that server's safe list (new and renamed tools too), and before any of muster's own tools but its reads; the Dev Portal's connector wizard pre-selects the Recommended preset (read-only tools run, the rest ask). Trusted lets agents run what the connectors' own settings allow and pre-selects Allow all. In both modes muster's built-in floors ask a person before an agent adds or repoints a connector, changes approval settings, grants access, adds a model, egress origin, credential or backend, approves an action or a toolchain source, or changes muster's own configuration; the role floors hold on the governed servers of that role, so governedServers names them in both modes. The meta chart renders muster's governance configuration from it (muster.governance: the mode and governedServers), from the muster release that reads it (agent-platform.muster.governanceFloor); below it `governed` fails the render and trusted renders nothing. From that release the meta chart also renders muster.approval.installation (backstage.installationName, the name the approval page shows), muster-approval-binder's subject (agent-manager's ServiceAccount, muster.rbac.approvalBinder.subjects) and the pages muster may return the browser to after an approval in muster.oauth.mcpClient.postLoginRedirectAllowlist (the portal's /sessions with backstage.publicPort, klausGateway.obo.callbackBaseUrl + /auth/slack/return; an own list's entries stay). Approval itself needs muster's OAuth server with Dex sign-in, Valkey storage (the default) and muster.muster.oauth.mcpClient.publicUrl on the OAuth server's origin with mcpClient.enabled for the allowlist; the chart does not fail without them, muster refuses asking calls with the reason. Only admins switch it, through the Platform Manager with a second person's approval; never an agent. Anything else fails the render. Concept: https://docs.giantswarm.io/overview/agent-platform/governing-tool-calls/", - "enum": [ - "trusted", - "governed" - ] + "type": "object", + "description": "The platform's governance (mode and role floors). The mode, trusted (the default) or governed, changes no tool approval setting's meaning; it adds asking for agent callers. Governed asks a person before an agent runs any tool of a governed server (governedServers below) that is not on that server's safe list (new and renamed tools too), and before any of muster's own tools but its reads; the Dev Portal's connector wizard pre-selects the Recommended preset (read-only tools run, the rest ask). Trusted lets agents run what the connectors' own settings allow and pre-selects Allow all. In both modes muster's built-in floors ask a person before an agent adds or repoints a connector, changes approval settings, grants access, adds a model, egress origin, credential or backend, approves an action or a toolchain source, or changes muster's own configuration; the role floors hold on the governed servers of that role, so governedServers names them in both modes. The meta chart renders muster's governance configuration from it (muster.governance: the mode and governedServers), from the muster release that reads it (agent-platform.muster.governanceFloor); below it `governed` fails the render and trusted renders nothing. From that release the meta chart also renders muster.approval.installation (backstage.installationName, the name the approval page shows), muster-approval-binder's subject (agent-manager's ServiceAccount, muster.rbac.approvalBinder.subjects) and the pages muster may return the browser to after an approval in muster.oauth.mcpClient.postLoginRedirectAllowlist (the portal's /sessions with backstage.publicPort, klausGateway.obo.callbackBaseUrl + /auth/slack/return; an own list's entries stay). Approval itself needs muster's OAuth server with Dex sign-in, Valkey storage (the default) and muster.muster.oauth.mcpClient.publicUrl on the OAuth server's origin with mcpClient.enabled for the allowlist; the chart does not fail without them, muster refuses asking calls with the reason. The mode is set with this chart value (no agent tool changes it). The block mirrors muster's own governance configuration; a string here (the earlier scalar) fails the render. Further reading (optional): https://docs.giantswarm.io/overview/agent-platform/governing-tool-calls/", + "additionalProperties": false, + "properties": { + "mode": { + "type": "string", + "description": "trusted (the default) or governed; anything else fails the render.", + "enum": [ + "trusted", + "governed" + ] + }, + "roleFloors": { + "type": "object", + "description": "Floors per governance role (muster.governance.roleFloors): role -> the server's own tool names that ask agents in both modes on the governed servers of that role, added to muster's built-in floors (config can only add: a built-in floor is never removed). A role named here is a valid `role` of governedServers. For a server the installation registers itself, e.g.: governance: roleFloors: exampleManager: [approve_change, merge_change] governedServers: example-manager: role: exampleManager safe: [get_info, list_changes] Rendered from the muster release that reads the governance configuration (agent-platform.muster.governanceFloor), like governedServers.", + "additionalProperties": { + "type": "array", + "items": { + "type": "string" + } + } + } + } }, "governanceExempt": { "type": "object", @@ -2189,7 +2206,7 @@ }, "governedServers": { "type": "object", - "description": "The servers muster governs (muster.governance.governedServers), per source the platform ships: `role` (which of muster's role floors hold on it: agentManager, platformManager, connectorManager, sessionManager, modelManager, clusterManager, vmManager, workspaceManager, toolchainManager, skillManager, infrastructure) and `safe`, the server's own tool names agents call unasked on governed (reads only; a floor never, muster refuses to start on one). Every other tool of a governed server asks agents on governed. A source renders one entry per MCPServer it ships while that renders (agent-platform.muster.governedKeys): a manager component's .muster.mcpServer.name in its namespace; kagent the connectivity chart's kagent server; mcp-kubernetes the connectivity chart's and every agent-platform-mcps kubernetes entry; any other key is a muster server key itself (giantswarm-platform-manager). null drops a source (then list it in governanceExempt with the reason). make verify-tool-approval fails on a shipped MCPServer that is neither here nor in governanceExempt, and on a safe entry that names a floor or no tool of its server, or whose name starts with a write verb (create, delete, exec, set, approve, ...) unless a `# safe-write: : ` comment above `safe:` says why it reads. Safe lists: tool-approval governed-safe-list-proposal (giantswarm/giantswarm#38902).", + "description": "The servers muster governs (muster.governance.governedServers), per source the platform ships: `role` (which of muster's role floors hold on it: agentManager, connectorManager, sessionManager, modelManager, clusterManager, vmManager, workspaceManager, toolchainManager, skillManager, infrastructure, or a role governance.roleFloors declares) and `safe`, the server's own tool names agents call unasked on governed (reads only; a floor never, muster refuses to start on one). Every other tool of a governed server asks agents on governed. A source renders one entry per MCPServer it ships while that renders (agent-platform.muster.governedKeys): a manager component's .muster.mcpServer.name in its namespace; kagent the connectivity chart's kagent server; mcp-kubernetes the connectivity chart's and every agent-platform-mcps kubernetes entry; any other key is a muster server key itself (a server the installation registers, e.g. example-manager). null drops a source (then list it in governanceExempt with the reason). make verify-tool-approval fails on a shipped MCPServer that is neither here nor in governanceExempt, and on a safe entry that names a floor or no tool of its server, or whose name starts with a write verb (create, delete, exec, set, approve, ...) unless a `# safe-write: : ` comment above `safe:` says why it reads.", "additionalProperties": true, "properties": { "agent-manager": { @@ -2222,21 +2239,6 @@ } } }, - "giantswarm-platform-manager": { - "type": "object", - "additionalProperties": false, - "properties": { - "role": { - "type": "string" - }, - "safe": { - "type": "array", - "items": { - "type": "string" - } - } - } - }, "kagent": { "type": "object", "additionalProperties": false, @@ -3594,7 +3596,7 @@ "properties": { "editors": { "type": "array", - "description": "The platform's operators: bound to agent-platform:editor in the kagent namespace. RBAC subjects. The Giant Swarm admin groups, as in muster.rbac.*.subjects.", + "description": "The platform's operators: bound to agent-platform:editor in the kagent namespace. RBAC subjects.", "items": { "type": "object", "required": [ diff --git a/helm/agent-platform/values.yaml b/helm/agent-platform/values.yaml index 0e49afe4..f70ae6d6 100644 --- a/helm/agent-platform/values.yaml +++ b/helm/agent-platform/values.yaml @@ -417,8 +417,8 @@ components: # @schema additionalProperties: true # token-family session ID still wins and the change is a no-op there. # # v5.1.0 (muster#1079) also FAILS the render on an explicitly emptied - # rbac.mcpServerEditor/workflowEditor.subjects. Both are bound to the - # Giant Swarm admin groups below, so the guard is satisfied. + # rbac.mcpServerEditor/workflowEditor.subjects. Both are bound to + # placeholder groups below, so the guard is satisfied. # # The muster values below define toolsetPresets that select by the # tool-group label (`label:` rules, muster#1168), and a muster before @@ -2739,42 +2739,37 @@ muster: # @schema skipProperties: true; additionalProperties: true crds: install: false # Who may register MCPServers and author Workflows through muster's - # writes-as-caller path. On a shared platform MC every registered server - # and authored workflow is visible to and routed through by other users, - # so the umbrella binds both editor Roles explicitly to the Giant Swarm - # admin groups (the same groups the config default layer feeds - # rbac-operator as oidc.giantswarm.write_all_group/_groups); the meta - # chart appends tenants.platformTeam to both. Installations wanting - # customer self-service widen subjects via their gitops values. + # writes-as-caller path. Every registered server and authored workflow is + # visible to and routed through by other users, so the chart binds both + # editor Roles explicitly. The defaults are placeholder groups + # (agent-platform:connector-admins, agent-platform:workflow-editors) that + # nobody belongs to unless the installation's identity provider puts them + # there: until an installation names its own groups, nobody but a cluster + # admin registers servers, authors workflows or changes tool approval. Set + # the subjects to the installation's admin groups, written as the API server + # sees them (with the OIDC groups prefix); the meta chart appends + # tenants.platformTeam to both. An empty list fails muster's render. # - # mcpServerEditor is the platform's connector-admin role (Governing tool - # calls, https://docs.giantswarm.io/overview/agent-platform/governing-tool-calls/): - # whoever holds muster's mcpserver-editor Role in muster's namespace edits - # every connector there, sets its tool approval (MCPServer spec.approval: - # Allow, Ask or Block per tool, and the rule new tools follow) and is the - # only one who may let an agent run a tool the connector asks for. Its - # subjects are the connector admins: by default the Giant Swarm admin - # groups plus tenants.platformTeam. The muster chart itself binds nobody by - # default (it bound system:authenticated before), so this list is what - # keeps connector admins on an upgrade; binding system:authenticated makes - # everyone a connector admin. + # mcpServerEditor is the platform's connector-admin role: whoever holds + # muster's mcpserver-editor Role in muster's namespace edits every connector + # there, sets its tool approval (MCPServer spec.approval: Allow, Ask or + # Block per tool, and the rule new tools follow) and is the only one who may + # let an agent run a tool the connector asks for. The muster chart itself + # binds nobody by default (it bound system:authenticated before), so this + # list is what keeps connector admins on an upgrade; binding + # system:authenticated makes everyone a connector admin. Further reading + # (optional): https://docs.giantswarm.io/overview/agent-platform/governing-tool-calls/ rbac: mcpServerEditor: subjects: - apiGroup: rbac.authorization.k8s.io kind: Group - name: giantswarm-ad:giantswarm-admins - - apiGroup: rbac.authorization.k8s.io - kind: Group - name: giantswarm-github:giantswarm:giantswarm-admins + name: agent-platform:connector-admins workflowEditor: subjects: - apiGroup: rbac.authorization.k8s.io kind: Group - name: giantswarm-ad:giantswarm-admins - - apiGroup: rbac.authorization.k8s.io - kind: Group - name: giantswarm-github:giantswarm:giantswarm-admins + name: agent-platform:workflow-editors # Muster's NetworkPolicy mirrors the umbrella's flavor split (`cilium` vs # `kubernetes`). `auto` (the default) is replaced by the resolved top-level # `networkPolicy.flavor` before the block is forwarded, so muster and the @@ -4106,7 +4101,7 @@ kagent: # @schema skipProperties: true; additionalProperties: true # approval: its default, the Allow all preset written out for every tool # of the kagent line, is the connectivity chart's # (kagent.controllerRoute.mcp.approval there, which says why); set it here - # to tighten a tool (Ask or Block). Governing tool calls: + # to tighten a tool (Ask or Block). Further reading (optional): # https://docs.giantswarm.io/overview/agent-platform/governing-tool-calls/ approval: rule: Allow @@ -5387,7 +5382,7 @@ agent-manager: # @schema skipProperties: true; additionalProperties: true # and components.default-agent.versionRange. The same range reaches # agent-manager's migrate run and the agent-platform-operator, which moves # every organization's chart source at once. 3.x (chart 3.0 removes - # muster.requireApproval, giantswarm/giantswarm#38902) renders only with + # muster.requireApproval) renders only with # components.agent-manager.versionRange at # agent-platform.agentManager.agentChartV3Floor (its migrate rewrites # requireApproval to default: Ask before it moves a namespace's source), @@ -5845,9 +5840,9 @@ clusterManager: # @schema skipProperties: true; additionalProperties: true # sessions.api.kagent.dev cluster-wide (the ClusterRole # agent-platform:workspace-manager-sessions): the manager lists every creator's # Sessions for the session directories' cleanup, which no tenant role grants. -# === Governance mode (Governing tool calls, giantswarm/giantswarm#38902) === -# -- The platform's governance mode: trusted (the default) or governed. It -# changes no tool approval setting's meaning; it adds asking for agent +# === Governance mode (Governing tool calls) === +# -- The platform's governance (mode and role floors). The mode, trusted (the +# default) or governed, changes no tool approval setting's meaning; it adds asking for agent # callers. Governed asks a person before an agent runs any tool of a governed # server (governedServers below) that is not on that server's safe list (new # and renamed tools too), and before any of muster's own tools but its reads; @@ -5873,17 +5868,36 @@ clusterManager: # @schema skipProperties: true; additionalProperties: true # muster's OAuth server with Dex sign-in, Valkey storage (the default) and # muster.muster.oauth.mcpClient.publicUrl on the OAuth server's origin with # mcpClient.enabled for the allowlist; the chart does not fail without them, -# muster refuses asking calls with the reason. Only admins switch it, through -# the Platform Manager with a second person's approval; never an agent. -# Anything else fails the render. -# Concept: https://docs.giantswarm.io/overview/agent-platform/governing-tool-calls/ -governance: trusted # @schema enum: [trusted, governed] +# muster refuses asking calls with the reason. The mode is set with this chart +# value (no agent tool changes it). The block mirrors muster's own governance +# configuration; a string here (the earlier scalar) fails the render. Further +# reading (optional): https://docs.giantswarm.io/overview/agent-platform/governing-tool-calls/ +governance: # @schema additionalProperties: false + # -- trusted (the default) or governed; anything else fails the render. + mode: trusted # @schema enum: [trusted, governed] + # -- Floors per governance role (muster.governance.roleFloors): role -> the + # server's own tool names that ask agents in both modes on the governed + # servers of that role, added to muster's built-in floors (config can only + # add: a built-in floor is never removed). A role named here is a valid + # `role` of governedServers. For a server the installation registers + # itself, e.g.: + # governance: + # roleFloors: + # exampleManager: [approve_change, merge_change] + # governedServers: + # example-manager: + # role: exampleManager + # safe: [get_info, list_changes] + # Rendered from the muster release that reads the governance configuration + # (agent-platform.muster.governanceFloor), like governedServers. + roleFloors: {} # @schema additionalProperties: {type: array, items: {type: string}} # -- The servers muster governs (muster.governance.governedServers), per # source the platform ships: `role` (which of muster's role floors hold on -# it: agentManager, platformManager, connectorManager, sessionManager, -# modelManager, clusterManager, vmManager, workspaceManager, -# toolchainManager, skillManager, infrastructure) and `safe`, the server's +# it: agentManager, connectorManager, sessionManager, modelManager, +# clusterManager, vmManager, workspaceManager, toolchainManager, +# skillManager, infrastructure, or a role governance.roleFloors declares) and +# `safe`, the server's # own tool names agents call unasked on governed (reads only; a floor never, # muster refuses to start on one). Every other tool of a governed server asks # agents on governed. A source renders one entry per MCPServer it ships @@ -5891,14 +5905,14 @@ governance: trusted # @schema enum: [trusted, governed] # component's .muster.mcpServer.name in its namespace; kagent the # connectivity chart's kagent server; mcp-kubernetes the connectivity chart's # and every agent-platform-mcps kubernetes entry; any other key is a muster -# server key itself (giantswarm-platform-manager). null drops a source (then +# server key itself (a server the installation registers, e.g. +# example-manager). null drops a source (then # list it in governanceExempt with the reason). make verify-tool-approval # fails on a shipped MCPServer that is neither here nor in governanceExempt, # and on a safe entry that names a floor or no tool of its server, or whose # name starts with a write verb (create, delete, exec, set, approve, ...) # unless a `# safe-write: : ` comment above `safe:` says why -# it reads. Safe -# lists: tool-approval governed-safe-list-proposal (giantswarm/giantswarm#38902). +# it reads. governedServers: # @schema additionalProperties: true agent-manager: role: agentManager @@ -5934,15 +5948,6 @@ governedServers: # @schema additionalProperties: true # port_forward, context_use, the stop tools) and the deprecated # kubernetes_* aliases ask agents on governed. safe: [logs, list_port_forward_sessions, context_list, context_get_current, can_i, api_resources, cluster_health, capi_list_clusters, capi_get_cluster, capi_resolve_cluster, capi_cluster_health, get, list, describe] - giantswarm-platform-manager: - role: platformManager - # Its reads (giantswarm-platform-manager docs/governance.md). get_action, - # list_actions and list_installations bring Action records up to date - # with GitHub as the caller and may post the facts to the review thread - # or the standup channel; they decide nothing. The dry runs share their - # tools with the commits (enable, reconcile, disable_capability) and ask, - # as do verify_installation, watch_action, deny_action and the floors. - safe: [get_info, list_installations, list_actions, get_action, verify_capability] # -- MCPServer sources the platform ships that muster deliberately does not # govern, each with its reason (make verify-tool-approval wants every shipped @@ -5968,8 +5973,7 @@ tenants: kind: Group name: system:authenticated # -- The platform's operators: bound to agent-platform:editor in the - # kagent namespace. RBAC subjects. The Giant Swarm admin groups, as in - # muster.rbac.*.subjects. + # kagent namespace. RBAC subjects. editors: # @schema item: object; itemRequired: [kind, name]; itemProperties: {"apiGroup": {"type": "string"}, "kind": {"type": "string"}, "name": {"type": "string"}, "namespace": {"type": "string"}} - apiGroup: rbac.authorization.k8s.io kind: Group diff --git a/tests/golden/meta-ci-engine-off.yaml b/tests/golden/meta-ci-engine-off.yaml index cd2e5b4b..6283d3b5 100644 --- a/tests/golden/meta-ci-engine-off.yaml +++ b/tests/golden/meta-ci-engine-off.yaml @@ -1235,18 +1235,12 @@ spec: subjects: - apiGroup: rbac.authorization.k8s.io kind: Group - name: giantswarm-ad:giantswarm-admins - - apiGroup: rbac.authorization.k8s.io - kind: Group - name: giantswarm-github:giantswarm:giantswarm-admins + name: agent-platform:connector-admins workflowEditor: subjects: - apiGroup: rbac.authorization.k8s.io kind: Group - name: giantswarm-ad:giantswarm-admins - - apiGroup: rbac.authorization.k8s.io - kind: Group - name: giantswarm-github:giantswarm:giantswarm-admins + name: agent-platform:workflow-editors replicaCount: 2 musterMcpServerViewers: null networkPolicy: @@ -2723,18 +2717,12 @@ spec: subjects: - apiGroup: rbac.authorization.k8s.io kind: Group - name: giantswarm-ad:giantswarm-admins - - apiGroup: rbac.authorization.k8s.io - kind: Group - name: giantswarm-github:giantswarm:giantswarm-admins + name: agent-platform:connector-admins workflowEditor: subjects: - apiGroup: rbac.authorization.k8s.io kind: Group - name: giantswarm-ad:giantswarm-admins - - apiGroup: rbac.authorization.k8s.io - kind: Group - name: giantswarm-github:giantswarm:giantswarm-admins + name: agent-platform:workflow-editors replicaCount: 2 --- # Source: agent-platform/templates/components.yaml diff --git a/tests/golden/meta-default.yaml b/tests/golden/meta-default.yaml index d51e162b..52fedd42 100644 --- a/tests/golden/meta-default.yaml +++ b/tests/golden/meta-default.yaml @@ -1409,18 +1409,12 @@ spec: subjects: - apiGroup: rbac.authorization.k8s.io kind: Group - name: giantswarm-ad:giantswarm-admins - - apiGroup: rbac.authorization.k8s.io - kind: Group - name: giantswarm-github:giantswarm:giantswarm-admins + name: agent-platform:connector-admins workflowEditor: subjects: - apiGroup: rbac.authorization.k8s.io kind: Group - name: giantswarm-ad:giantswarm-admins - - apiGroup: rbac.authorization.k8s.io - kind: Group - name: giantswarm-github:giantswarm:giantswarm-admins + name: agent-platform:workflow-editors replicaCount: 2 musterMcpServerViewers: null networkPolicy: @@ -2200,18 +2194,12 @@ spec: subjects: - apiGroup: rbac.authorization.k8s.io kind: Group - name: giantswarm-ad:giantswarm-admins - - apiGroup: rbac.authorization.k8s.io - kind: Group - name: giantswarm-github:giantswarm:giantswarm-admins + name: agent-platform:connector-admins workflowEditor: subjects: - apiGroup: rbac.authorization.k8s.io kind: Group - name: giantswarm-ad:giantswarm-admins - - apiGroup: rbac.authorization.k8s.io - kind: Group - name: giantswarm-github:giantswarm:giantswarm-admins + name: agent-platform:workflow-editors replicaCount: 2 --- # Source: agent-platform/templates/components.yaml diff --git a/tests/verify-agent-chart-line.py b/tests/verify-agent-chart-line.py index 4a674de6..3753bcce 100755 --- a/tests/verify-agent-chart-line.py +++ b/tests/verify-agent-chart-line.py @@ -1,6 +1,6 @@ #!/usr/bin/env python3 """Assert that the agent chart line moves to 3.x only with what makes it safe -(giantswarm/giantswarm#38902, slice 8). +. Agent chart 3.0 removes muster.requireApproval; agent-manager's migrate rewrites it to `default: Ask` from agent-platform.agentManager.agentChartV3Floor, @@ -46,7 +46,7 @@ "--set", "global.identity.issuerUrl=https://dex.example.com", "--set", "global.identity.clientId=agent-platform", "--set", "global.identity.existingSecret=agent-platform-idp", - "--set", "global.gatewayApi.parentRefs[0].name=giantswarm-default", + "--set", "global.gatewayApi.parentRefs[0].name=example-gateway", "--set", "model-manager.ollama.endpoint=http://ollama.example.com:11434", "--set", "kagent.harness.snapshotLocation=s3://ci-agent-snapshots/agents", "--set", "kagent.database.postgres.urlFile=/etc/kagent-db/uri", @@ -87,7 +87,7 @@ def refused(what: str, needle: str, *args: str) -> None: # The releases that do not carry what the 3.x line needs: a floor at or below # them would let a 3.x line through against a muster that ignores default: Ask -# or an agent-manager whose migrate has no 2.x -> 3.x hop (M3-S8-01). +# or an agent-manager whose migrate has no 2.x -> 3.x hop. LAST_WITHOUT = {"muster.agentApprovalFloor": (5, 67, 0), "agentManager.agentChartV3Floor": (3, 5, 8), "agentManager.toolApprovalFloor": (3, 5, 8), "muster.governanceFloor": (5, 67, 0), "muster.sessionBindingsPortFloor": (5, 67, 0)} @@ -141,7 +141,7 @@ def with_floors(dst: str) -> str: fail("the default render does not carry the 2.x line") # The preflight range reaches the connectivity release and is not the line: -# no guard refuses it (M3I-1). +# no guard refuses it. out = renders("preflight on the 2.x line", "--set", f"agentManager.migration.preflightSemver={V3}") if f"preflightSemver: '{V3}'" not in out: fail("agentManager.migration.preflightSemver does not reach the connectivity release") @@ -178,7 +178,7 @@ def with_floors(dst: str) -> str: META = META_ORIG -# The migrate run reads organization namespaces on the 3.x path (M3-S8-06): +# The migrate run reads organization namespaces on the 3.x path: # list on namespaces always, cluster-wide reads of releases, sources and Agents # with organizations on, no write anywhere outside its own namespaces. if CONN: @@ -209,7 +209,7 @@ def migrate_cluster_rules(*args: str) -> str: pre = ("--set", f"agentManager.migration.preflightSemver={V3}") pre_orgs = migrate_cluster_rules(*pre, "--set", "agentPlatformOrganizations.enabled=true") if ns_rule not in pre_orgs or 'resources: ["helmreleases"]\n verbs: ["get", "list"]' not in pre_orgs: - fail("a 3.x preflight range on the 2.x line grants the reads its dry run needs (M3I-1)") + fail("a 3.x preflight range on the 2.x line grants the reads its dry run needs") r = subprocess.run([*conn_base, *pre], capture_output=True, text=True) cron = [d for d in r.stdout.split("\n---\n") if "\nkind: CronJob\n" in "\n" + d and "-agent-manager-migrate-preflight\n" in d] if len(cron) != 1: @@ -233,16 +233,18 @@ def migrate_cluster_rules(*args: str) -> str: if '"get", "list"]\n' in rules.split('resources: ["agents"]', 1)[-1][:40]: fail("the run lists Agents in organization namespaces, it gets none") -# A bound that admits a pre-release of the next major (M3-S8-R-05), and range +# A bound that admits a pre-release of the next major, and range # shapes that are no semver range. refused("<=3.0.0-rc.1 bound", "admits 3.0.0-0, a pre-release of the next agent chart major", "--set", "agent-manager.agentChart.semver=>=2.6.0 <=3.0.0-rc.1") refused("<3.0.0-rc.1 bound", "a pre-release of the next agent chart major", "--set", "agent-manager.agentChart.semver=>=2.6.0 <3.0.0-rc.1") refused("majors beyond 5", "admits agent chart majors 3, 6", "--set", "agent-manager.agentChart.semver=>=3.0.0 <4.0.0 || 6.x") refused("latest", "is not a semver range", "--set", "agent-manager.agentChart.semver=latest") refused("empty", "is not a semver range", "--set-string", "agent-manager.agentChart.semver=") +renders("an exact 2.x pin", "--set-string", "agent-manager.agentChart.semver=2.6.1") +refused("an exact 3.x pin", "keep the 2.x line" if unset else "admits a release below", "--set-string", "agent-manager.agentChart.semver=3.0.0") renders("prerelease-widened 2.x line", "--set", "agent-manager.agentChart.semver=>=2.6.0-0 <3.0.0-0") -# An || range is held to its lowest alternative's floor (M3-S8-R-08). +# An || range is held to its lowest alternative's floor. with tempfile.TemporaryDirectory() as tmp: META = with_floors(tmp) am = [a.replace("{floor}", TEST_FLOORS["agentManager.agentChartV3Floor"]) for a in AM] diff --git a/tests/verify-prereleases.py b/tests/verify-prereleases.py index fadb21a2..9056bf2a 100755 --- a/tests/verify-prereleases.py +++ b/tests/verify-prereleases.py @@ -214,12 +214,12 @@ def main() -> None: fail(f"{release}: agentChart.semver {on_semver!r} does not admit {rc}") if not on_flt or any(re.search(on_flt, t) for t in TAGS_REFUSED) or not all(re.search(on_flt, t) for t in TAGS_ADMITTED): fail(f"{release}: agentChart.semverFilter {on_flt!r} is not the release tag filter") - own = agent_charts(helm(chart, [*ON, "--set", "agent-manager.agentChart.semver=1.x", "--set", "agent-manager.agentChart.semverFilter=^1[.]x$"])) - if set(own.values()) != {("1.x", "^1[.]x$")}: + own = agent_charts(helm(chart, [*ON, "--set", "agent-manager.agentChart.semver=2.x", "--set", "agent-manager.agentChart.semverFilter=^2[.]x$"])) + if set(own.values()) != {("2.x", "^2[.]x$")}: fail(f"an agentChart with its own semverFilter: {own}, want it as written") - pinned = agent_charts(helm(chart, [*ON, "--set-string", "agent-manager.agentChart.semver=1.5.0"])) - if set(pinned.values()) != {("1.5.0", "")}: - fail(f"an agentChart pinned to 1.5.0: {pinned}, want the pin as written and no filter") + pinned = agent_charts(helm(chart, [*ON, "--set-string", "agent-manager.agentChart.semver=2.6.1"])) + if set(pinned.values()) != {("2.6.1", "")}: + fail(f"an agentChart pinned to 2.6.1: {pinned}, want the pin as written and no filter") # An exact pin and an exclusion stay as written: `-0` would turn 1.2.3 # into a version that does not exist and stop != from excluding. A range # of those only admits no pre-release, so it gets no filter. A range that diff --git a/tests/verify-tenant-rbac.py b/tests/verify-tenant-rbac.py index d09c7060..888be21a 100755 --- a/tests/verify-tenant-rbac.py +++ b/tests/verify-tenant-rbac.py @@ -379,13 +379,14 @@ def muster_rbac(args): if d.get("kind") == "HelmRelease" and d["metadata"]["name"] == "muster": return d["spec"]["values"].get("rbac", {}) fail("no muster HelmRelease in the meta render") - for role in ("mcpServerEditor", "workflowEditor"): - if subject_names(muster_rbac([])[role]) != ADMINS: + defaults = {"mcpServerEditor": ["agent-platform:connector-admins"], "workflowEditor": ["agent-platform:workflow-editors"]} + for role, want in defaults.items(): + if subject_names(muster_rbac([])[role]) != want: fail(f"muster.rbac.{role} changed without tenants.platformTeam") rbac = muster_rbac(TEAM) - for role in ("mcpServerEditor", "workflowEditor"): - if subject_names(rbac[role]) != ADMINS + ["acme:platform"]: - fail(f"muster.rbac.{role}.subjects are {subject_names(rbac[role])}, want the admin groups and acme:platform once") + for role, want in defaults.items(): + if subject_names(rbac[role]) != want + ["acme:platform", "giantswarm-ad:giantswarm-admins"]: + fail(f"muster.rbac.{role}.subjects are {subject_names(rbac[role])}, want the placeholder group and the platform team once each") ok("the meta chart appends tenants.platformTeam to muster's two editor bindings, each subject once") diff --git a/tests/verify-tool-approval.py b/tests/verify-tool-approval.py index c61e7af8..a72af3c6 100755 --- a/tests/verify-tool-approval.py +++ b/tests/verify-tool-approval.py @@ -1,5 +1,5 @@ #!/usr/bin/env python3 -"""Assert the platform side of Governing tool calls (giantswarm/giantswarm#38902, slice 7). +"""Assert the platform side of Governing tool calls. - governance: the meta chart renders muster's governance configuration into the muster release (muster.governance: mode and governedServers {server, role, @@ -30,9 +30,15 @@ - governance floor: agent-platform.muster.governanceFloor is one X.Y.Z; its PLACEHOLDER-GOVERNANCE-FLOOR marker, while it is still there, appears once. - connector-admin: muster's mcpserver-editor Role (the platform's - connector-admin role) is bound to the configured groups: the Giant Swarm admin - groups by default (never empty, so muster's upgrade guard passes), - tenants.platformTeam appended, an installation's own list standing. + connector-admin role) is bound to the configured groups: a placeholder group + nobody belongs to by default (agent-platform:connector-admins; never empty, + so muster's upgrade guard passes, never everyone), tenants.platformTeam + appended, an installation's own list standing. +- role floors: governance.roleFloors renders muster.governance.roleFloors (a + role an installation declares for its own server, usable in + governedServers); malformed values and a second definition in + muster.muster.governance.roleFloors fail; the default ships no server or + role outside the platform's own components. - muster-approval-binder: the muster release binds muster's Role muster-approval-binder (in muster's namespace, the muster chart's) to agent-manager's ServiceAccount and nothing else @@ -191,7 +197,7 @@ def governed_entries(gov: str) -> dict[str, dict]: "--set", "global.identity.issuerUrl=https://dex.example.com", "--set", "global.identity.clientId=agent-platform", "--set", "global.identity.existingSecret=agent-platform-idp", - "--set", "global.gatewayApi.parentRefs[0].name=giantswarm-default", + "--set", "global.gatewayApi.parentRefs[0].name=example-gateway", "--set", "model-manager.ollama.endpoint=http://ollama.example.com:11434", "--set", "kagent.harness.snapshotLocation=s3://ci-agent-snapshots/agents", "--set", "kagent.database.postgres.urlFile=/etc/kagent-db/uri", @@ -206,17 +212,35 @@ def check_governance() -> None: entries = governed_entries(trusted) if " mode: trusted" not in trusted: fail(f"default governance, want mode trusted:\n{trusted}") - for key, role in (("giantswarm-platform-manager", "platformManager"), ("model-manager", "modelManager")): - if entries.get(key, {}).get("role") != role: - fail(f"default governance must govern {key} as {role}:\n{trusted}") + if entries.get("model-manager", {}).get("role") != "modelManager": + fail(f"default governance must govern model-manager as modelManager:\n{trusted}") + roles = {e.get("role") for e in entries.values()} + if not roles <= {"agentManager", "sessionManager", "modelManager", "clusterManager", "vmManager", "toolchainManager", "workspaceManager", "skillManager", "infrastructure"}: + fail(f"the default governs only the platform's own components: {sorted(roles)}") + if "roleFloors" in trusted: + fail(f"the default declares no role floors:\n{trusted}") + # An installation's own server and role. + own_role = governance(["--set", FLOOR_RANGE, "--set-json", 'governance.roleFloors={"exampleManager":["approve_change","merge_change"]}', + "--set", "governedServers.example-manager.role=exampleManager", "--set", "governedServers.example-manager.safe[0]=get_info"]) + if "roleFloors:\n exampleManager:\n - approve_change\n - merge_change" not in own_role: + fail(f"governance.roleFloors must render as muster.governance.roleFloors:\n{own_role}") + if governed_entries(own_role).get("example-manager", {}).get("role") != "exampleManager": + fail(f"an installation's own server key governs with its declared role:\n{own_role}") + for args, want in ((["--set-json", 'governance.roleFloors={"Bad Role":["x"]}', "--skip-schema-validation"], 'role "Bad Role": want a camelCase name'), + (["--set-json", 'governance.roleFloors={"exampleManager":"x"}', "--skip-schema-validation"], "governance.roleFloors.exampleManager: want a list"), + (["--set-json", 'governance.roleFloors={"exampleManager":["a b"]}', "--skip-schema-validation"], "is not a tool name"), + (["--set-json", 'governance.roleFloors={"exampleManager":["x"]}', "--set-json", 'muster.muster.governance.roleFloors={"exampleManager":["y"]}'], "are both set")): + err = render(META_DIR, META + ["--set", FLOOR_RANGE, *args], expect_fail=True) + if want not in err: + fail(f"{args}: want {want!r}, got:\n{err}") if "agent-manager" in entries or "vm-manager" in entries: fail(f"components that are off ship no server to govern:\n{trusted}") - governed = governed_entries(governance(["--set", FLOOR_RANGE, "--set", "governance=governed", "--set", "components.agent-manager.enabled=true", "--set", "agent-manager.muster.mcpServer.name=agents"])) + governed = governed_entries(governance(["--set", FLOOR_RANGE, "--set", "governance.mode=governed", "--set", "components.agent-manager.enabled=true", "--set", "agent-manager.muster.mcpServer.name=agents"])) am = governed.get("agents") if not am or am["role"] != "agentManager" or "list_agents" not in am["safe"] or "update_agent" in am["safe"]: fail(f"governed with a renamed agent-manager server: want agents as agentManager with its reads safe, got {governed}") - if "mode: governed" not in governance(["--set", FLOOR_RANGE, "--set", "governance=governed"]): - fail("governance=governed must render mode governed") + if "mode: governed" not in governance(["--set", FLOOR_RANGE, "--set", "governance.mode=governed"]): + fail("governance.mode=governed must render mode governed") apart = governed_entries(governance(["--set", FLOOR_RANGE, "--set", "components.muster.targetNamespace=muster", "--set", "components.vm-manager.enabled=true"])) if not any(k.endswith("/vm-manager") for k in apart): fail(f"a server outside muster's namespace is keyed namespace/name: {sorted(apart)}") @@ -232,19 +256,25 @@ def check_governance() -> None: fail("a source set to null governs nothing") if governance([]): fail("below the muster floor the muster release must carry no governance block") - err = render(META_DIR, META + ["--set", "governance=governed"], expect_fail=True) - if "governance governed needs muster" not in err or "components.muster.versionRange" not in err: + err = render(META_DIR, META + ["--set", "governance.mode=governed"], expect_fail=True) + if "governance.mode governed needs muster" not in err or "components.muster.versionRange" not in err: fail(f"governed below the floor must fail naming governance and components.muster.versionRange:\n{err}") - err = render(META_DIR, META + ["--set", "governance=open"], expect_fail=True) + err = render(META_DIR, META + ["--set", "governance.mode=open"], expect_fail=True) if "governance" not in err: fail(f"an unknown mode must fail in the schema naming governance:\n{err}") - err = render(META_DIR, META + ["--set", "governance=open", "--skip-schema-validation"], expect_fail=True) - if 'governance "open": want trusted or governed' not in err: + err = render(META_DIR, META + ["--set", "governance.mode=open", "--skip-schema-validation"], expect_fail=True) + if 'governance.mode "open": want trusted or governed' not in err: fail(f"an unknown mode must fail in the template naming governance:\n{err}") + for args, want in ((["--set", "governance=governed"], "governance"), + (["--set", "governance=governed", "--skip-schema-validation"], "governance is a map mirroring muster's governance configuration"), + (["--set", "governance.policy=x", "--skip-schema-validation"], "governance.policy: unknown key")): + err = render(META_DIR, META + args, expect_fail=True) + if want not in err: + fail(f"{args}: want {want!r}, got:\n{err}") err = render(META_DIR, META + ["--set", FLOOR_RANGE, "--set", "muster.muster.governance.mode=governed"], expect_fail=True) - if "muster.muster.governance.mode (governed) differs from governance (trusted)" not in err: + if "muster.muster.governance.mode (governed) differs from governance.mode (trusted)" not in err: fail(f"an own mode that differs must fail naming both keys:\n{err}") - err = render(META_DIR, META + ["--set", FLOOR_RANGE, "--set", "muster.muster.governance.servers.platformManager[0]=pm"], expect_fail=True) + err = render(META_DIR, META + ["--set", FLOOR_RANGE, "--set", "muster.muster.governance.servers.agentManager[0]=am"], expect_fail=True) if "muster.muster.governance.servers is the earlier governance shape" not in err: fail(f"the earlier servers shape must fail:\n{err}") err = render(META_DIR, META + ["--set", FLOOR_RANGE, "--set", "governedServers.model-manager.safe_list[0]=x"], expect_fail=True) @@ -262,7 +292,6 @@ def check_governance() -> None: # muster's floors (muster internal/api/governance.go roleFloors): never safe. FLOORS = { "agentManager": {"set_agent_approval", "set_organization_connector", "add_organization_member", "set_organization_model", "set_organization_egress_policy", "replace_organization_credential"}, - "platformManager": {"approve_action", "merge_action"}, "connectorManager": {"mcpserver_create", "mcpserver_connect", "mcpserver_set_approval"}, "toolchainManager": {"approve_source"}, "modelManager": {"add_backend"}, @@ -515,18 +544,17 @@ def release(args: list[str]) -> str: def check_connector_admin() -> None: editor = block(muster_release([]), " mcpServerEditor:") - for group in ("giantswarm-ad:giantswarm-admins", "giantswarm-github:giantswarm:giantswarm-admins"): - if f"name: {group}" not in editor: - fail(f"connector admins by default must include {group}:\n{editor}") + if "name: agent-platform:connector-admins" not in editor or editor.count("name: ") != 1: + fail(f"connector admins by default are the placeholder group agent-platform:connector-admins alone:\n{editor}") if "system:authenticated" in editor: fail(f"connector admins must not default to everyone:\n{editor}") team = block(muster_release(["--set", "tenants.platformTeam[0].kind=Group", "--set", "tenants.platformTeam[0].name=customer:platform"]), " mcpServerEditor:") - if "name: customer:platform" not in team or "giantswarm-ad:giantswarm-admins" not in team: + if "name: customer:platform" not in team or "agent-platform:connector-admins" not in team: fail(f"tenants.platformTeam must be appended to the connector admins:\n{team}") own = block(muster_release(["--set", "muster.rbac.mcpServerEditor.subjects[0].kind=Group", "--set", "muster.rbac.mcpServerEditor.subjects[0].name=ops"]), " mcpServerEditor:") - if "name: ops" not in own or "giantswarm-ad:giantswarm-admins" in own: + if "name: ops" not in own or "agent-platform:connector-admins" in own: fail(f"an installation's own connector admins must stand:\n{own}") - print("ok: the connector-admin role (muster's mcpserver-editor) binds the Giant Swarm admin groups plus tenants.platformTeam, an own list standing") + print("ok: the connector-admin role (muster's mcpserver-editor) binds a placeholder group nobody is in by default plus tenants.platformTeam, an own list standing") def check_binder() -> None: @@ -677,7 +705,7 @@ def check_approval() -> None: # Test values for the floors this file's checks need, set in a copy of the # chart while the chart keeps them unset until their releases exist -# (giantswarm/giantswarm#38902 decision #89). +#. TEST_FLOORS = {"muster.governanceFloor": "5.65.0", "muster.agentApprovalFloor": "5.66.0", "agentManager.toolApprovalFloor": "3.6.0", "muster.sessionBindingsPortFloor": "5.66.0"} @@ -698,7 +726,7 @@ def with_test_floors(meta_dir: str, dst: str) -> str: def check_unset_floors_keep_everything_off() -> None: """On the chart as it is: a floor whose release does not exist gates its - wiring off whatever the component ranges say (M3-S8-01).""" + wiring off whatever the component ranges say.""" high = ["--set", "components.muster.versionRange=>=5.99.0 <6.0.0-0", "--set", "components.agent-manager.versionRange=>=3.99.0 <4.0.0-0", "--set", "components.agent-manager.enabled=true"] text = open(os.path.join(META_DIR, "templates", "_helpers.tpl")).read() @@ -710,10 +738,10 @@ def check_unset_floors_keep_everything_off() -> None: if "muster.governanceFloor" in unset: if block(muster, " governance:"): fail("with the governance floor unset the muster release must carry no governance configuration") - err = render_meta_fail(high + ["--set", "governance=governed"]) + err = render_meta_fail(high + ["--set", "governance.mode=governed"]) if "no muster release this chart knows reads the governance configuration yet" not in err or ">= " in err or "muster or" in err: fail(f"with the governance floor unset `governed` must fail naming why, with no empty floor:\n{err}") - for own in (["--set", "muster.muster.governance.mode=governed"], ["--set", "muster.muster.governance.servers.platformManager[0]=pm"]): + for own in (["--set", "muster.muster.governance.mode=governed"], ["--set", "muster.muster.governance.servers.agentManager[0]=am"]): err = render_meta_fail(high + own) if "muster.muster.governance is set" not in err: fail(f"with the governance floor unset an own {own[1]} must fail (governed, governing nothing):\n{err}") From b39fe67776073c5f12b33fe2687ff4d9013ee915 Mon Sep 17 00:00:00 2001 From: Dominik Schmidle Date: Thu, 26 Nov 2026 11:51:11 +0100 Subject: [PATCH 34/56] docs: describe governance as a map, the editor placeholders and how an installation adds its own governed servers --- Makefile.custom.mk | 4 ++-- UPGRADE.md | 20 +++++++++++++++---- docs/toolset-presets.md | 2 +- .../agent-platform-agent-management/SKILL.md | 2 +- .../agent-platform-building-blocks/SKILL.md | 4 ++-- skills/agent-platform-tools/SKILL.md | 2 +- 6 files changed, 23 insertions(+), 11 deletions(-) diff --git a/Makefile.custom.mk b/Makefile.custom.mk index 84949681..2019c203 100644 --- a/Makefile.custom.mk +++ b/Makefile.custom.mk @@ -1479,12 +1479,12 @@ verify-mcp-kubernetes-registration: ## Assert the bundled mcp-kubernetes registr @echo "mcp-kubernetes registration shapes verified." .PHONY: verify-agent-chart-line -verify-agent-chart-line: ## Assert that agent-manager.agentChart.semver moves to agent chart 3.x only together with agent-manager at agent-platform.agentManager.agentChartV3Floor (its migrate rewrites muster.requireApproval to default: Ask), muster at agent-platform.muster.agentApprovalFloor (enforces it), agent-manager's tool approval on and the default agent's range on the same major; a range is read as agent-manager's migrate reads it (spanning majors or only pre-releases fails, ~3.2 and bounded forms count as 3.x); the placeholder floors are unset (every 3.x line refused) or above the last release without the feature, and the gated paths run on a chart copy with test floors; the 3.x line reaches agent-manager, the migrate run's connectivity release and the default agent's source; the migrate run may list namespaces and, with organizations on, read releases, sources and Agents cluster-wide, never write them (giantswarm/giantswarm#38902, slice 8). Stdlib only. HELM selects the binary. +verify-agent-chart-line: ## Assert that agent-manager.agentChart.semver moves to agent chart 3.x only together with agent-manager at agent-platform.agentManager.agentChartV3Floor (its migrate rewrites muster.requireApproval to default: Ask), muster at agent-platform.muster.agentApprovalFloor (enforces it), agent-manager's tool approval on and the default agent's range on the same major; a range is read as agent-manager's migrate reads it (spanning majors or only pre-releases fails, ~3.2 and bounded forms count as 3.x); the placeholder floors are unset (every 3.x line refused) or above the last release without the feature, and the gated paths run on a chart copy with test floors; the 3.x line reaches agent-manager, the migrate run's connectivity release and the default agent's source; the migrate run may list namespaces and, with organizations on, read releases, sources and Agents cluster-wide, never write them. Stdlib only. HELM selects the binary. @echo "====> $@ ($(CHART_DIR), $(CONNECTIVITY_DIR))" @HELM="$(HELM)" python3 tests/verify-agent-chart-line.py $(CHART_DIR) $(CONNECTIVITY_DIR) .PHONY: verify-tool-approval -verify-tool-approval: ## Assert the platform side of Governing tool calls (giantswarm/giantswarm#38902): the top-level governance and governedServers values render muster's governance configuration into the muster release (muster.governance: mode, governedServers {server, role, safe} per shipped MCPServer, keyed namespace/name outside muster's namespace, an own entry standing) from the muster floor agent-platform.muster.governanceFloor, none below it, governed below it, the earlier servers shape, unknown keys and conflicting or unknown modes failing; coverage: every shipped MCPServer source (meta releases carrying muster.mcpServer, the connectivity chart's MCPServers, agent-platform-mcps' families, and the component charts beside this checkout, COMPONENT_CHECKOUTS) is governed or in governanceExempt, no floor is safe, every safe entry names a tool of its server, the two kubernetes maps agree; the redirect allowlist (portal /sessions with backstage.publicPort, klaus-gateway's return with its port, invalid ports and URLs failing); the connector-admin role binds the Giant Swarm admin groups plus tenants.platformTeam; muster-approval-binder's subjects are agent-manager's ServiceAccount only (muster.rbac.approvalBinder.subjects), none from the connectivity chart; agent-manager's muster.toolApproval.enabled on from its floor and muster's agent approval floor, off below muster's, absent below its own, an own value standing; the connectivity MCPServers carry explicit approval settings (a Block rule renders, overrides reach spec.approval also from the meta chart, null renders none, invalid values fail naming the key). Stdlib only. HELM selects the binary. +verify-tool-approval: ## Assert the platform side of Governing tool calls: the top-level governance and governedServers values render muster's governance configuration into the muster release (muster.governance: mode, governedServers {server, role, safe} per shipped MCPServer, keyed namespace/name outside muster's namespace, an own entry standing) from the muster floor agent-platform.muster.governanceFloor, none below it, governed below it, the earlier servers shape, unknown keys and conflicting or unknown modes failing; coverage: every shipped MCPServer source (meta releases carrying muster.mcpServer, the connectivity chart's MCPServers, agent-platform-mcps' families, and the component charts beside this checkout, COMPONENT_CHECKOUTS) is governed or in governanceExempt, no floor is safe, every safe entry names a tool of its server, the two kubernetes maps agree; the redirect allowlist (portal /sessions with backstage.publicPort, klaus-gateway's return with its port, invalid ports and URLs failing); the connector-admin role binds the Giant Swarm admin groups plus tenants.platformTeam; muster-approval-binder's subjects are agent-manager's ServiceAccount only (muster.rbac.approvalBinder.subjects), none from the connectivity chart; agent-manager's muster.toolApproval.enabled on from its floor and muster's agent approval floor, off below muster's, absent below its own, an own value standing; the connectivity MCPServers carry explicit approval settings (a Block rule renders, overrides reach spec.approval also from the meta chart, null renders none, invalid values fail naming the key). Stdlib only. HELM selects the binary. @echo "====> $@ ($(CHART_DIR), $(CONNECTIVITY_DIR))" @HELM="$(HELM)" python3 tests/verify-tool-approval.py $(CHART_DIR) $(CONNECTIVITY_DIR) @echo "tool approval verified." diff --git a/UPGRADE.md b/UPGRADE.md index 6d7e4199..56120300 100644 --- a/UPGRADE.md +++ b/UPGRADE.md @@ -17,7 +17,7 @@ A CRD version change that needs more than an apply (a stored version dropped, as ## \ → \ (agent chart 3.0: `muster.requireApproval` becomes `default: Ask`) -giantswarm/giantswarm#38902, slice 8: agent chart 3.0 removes `muster.requireApproval` (kagent's flag that paused an agent before every tool call) and the default of `modelConfig.name`. `default: Ask` replaces `requireApproval: true`: muster asks a person before every tool call the agent makes through it, from every client; once migrated, nothing asks twice (until then see *Running Sessions* below). `agent-manager.agentChart.semver` moves the agents of the whole installation: agent-manager composes new agents on it, its migrate run (the connectivity release's start hook) moves the existing ones, and the agent-platform-operator moves every organization's chart source at once. +agent chart 3.0 removes `muster.requireApproval` (kagent's flag that paused an agent before every tool call) and the default of `modelConfig.name`. `default: Ask` replaces `requireApproval: true`: muster asks a person before every tool call the agent makes through it, from every client; once migrated, nothing asks twice (until then see *Running Sessions* below). `agent-manager.agentChart.semver` moves the agents of the whole installation: agent-manager composes new agents on it, its migrate run (the connectivity release's start hook) moves the existing ones, and the agent-platform-operator moves every organization's chart source at once. The render allows the 3.x line only together with what makes it safe (`make verify-agent-chart-line`): agent-manager at `agent-platform.agentManager.agentChartV3Floor`, whose migrate has the 2.x → 3.x hop, muster at `agent-platform.muster.agentApprovalFloor`, which enforces `default: Ask`, agent-manager's tool approval on (`agent-manager.muster.toolApproval.enabled` unset) and the default agent's range on the same major. **Both floors are unset in this chart** until the muster and agent-manager releases carrying tool approval exist, so every 3.x range is refused for now, whatever its form (`3.x`, `~3.2`, `>=3.1.0 <3.6.0`); the platform release that pins those versions sets them. They are chart code, not values, on purpose: a floor states which released version carries a feature, and a value would let one installation's configuration claim it for a release that lacks it (a lab tests a branch build on a copy of the chart, as the verify scripts do). The same goes for the other floors of tool approval (`agent-platform.agentManager.toolApprovalFloor`, `agent-platform.muster.governanceFloor`, `agent-platform.muster.sessionBindingsPortFloor`): unset, what they gate stays off and `governance: governed` fails. The range is read as agent-manager's migrate reads it: a range admitting two majors (`>=3.0.0`) or only pre-releases fails. @@ -34,13 +34,25 @@ The migrate run writes each release's 3.x values (`muster.requireApproval: true` ## \ → \ (tool approval and the governance mode) -giantswarm/giantswarm#38902: muster decides Allow, Ask or Block for every tool call, and the chart renders muster's governance configuration (`governance`, `governedServers`: per shipped MCPServer its role and its safe list of reads), the approval page's installation name, the redirect allowlist and the approval binder ([chart README, "Tool approval and the governance mode"](helm/agent-platform/README.md#tool-approval-and-the-governance-mode)). None of it reaches a muster below `agent-platform.muster.governanceFloor`. +muster decides Allow, Ask or Block for every tool call, and the chart renders muster's governance configuration (`governance` — `{mode, roleFloors}` —, `governedServers`: per shipped MCPServer its role and its safe list of reads), the approval page's installation name, the redirect allowlist and the approval binder ([chart README, "Tool approval and the governance mode"](helm/agent-platform/README.md#tool-approval-and-the-governance-mode)). None of it reaches a muster below `agent-platform.muster.governanceFloor`. ### Operator action -- Move `components.muster.versionRange` to the muster release that carries tool approval with this chart. `governance: governed` below it fails the render. +- Move `components.muster.versionRange` to the muster release that carries tool approval with this chart. `governance.mode: governed` below it fails the render. - After muster's CRD upgrade, force a reconcile of the releases that render MCPServers (connectivity, agent-platform-mcps, the managers) if any of them was applied while the old CRD was served (its `spec.approval` was pruned): `flux reconcile helmrelease -n --force`. Until the CRD knows `spec.approval`, muster refuses every server tool. -- Keep `muster.rbac.mcpServerEditor.subjects` non-empty (the chart's default, the Giant Swarm admin groups and `tenants.platformTeam`): muster's chart no longer binds `system:authenticated` and fails the upgrade with an empty list while the old binding exists (`muster.rbac.mcpServerEditor.allowRemovingBinding: true` drops it). +- **Editor defaults changed.** `muster.rbac.mcpServerEditor.subjects` (the connector admins) and `muster.rbac.workflowEditor.subjects` default to placeholder groups nobody belongs to (`agent-platform:connector-admins`, `agent-platform:workflow-editors`); they were two Giant Swarm admin groups. Set both to your admin groups in the installation's values (as the API server sees them, with the OIDC groups prefix); `tenants.platformTeam` is still appended. Until then only cluster admins register servers, author workflows or change tool approval. Keep the lists non-empty: muster's chart no longer binds `system:authenticated` and fails the upgrade with an empty list while the old binding exists (`muster.rbac.mcpServerEditor.allowRemovingBinding: true` drops it). +- **`governance` is a map** mirroring muster's governance configuration: `governance: {mode: trusted|governed, roleFloors: {}}`. Write `governance.mode: governed` where you wrote `governance: governed`; a string fails the render with that hint. +- **No server outside the platform's components is governed by default.** The default `governedServers` entry for `giantswarm-platform-manager` is gone, and role floors beyond muster's built-in ones come from `governance.roleFloors`. An installation that registers a server of its own (for example `giantswarm-platform-manager`) names it with its role and safe list in `governedServers` and its floors in `governance.roleFloors`, in the installation's values: + + ```yaml + governance: + roleFloors: + platformManager: [approve_action, merge_action] + governedServers: + giantswarm-platform-manager: + role: platformManager + safe: [get_info, list_installations, list_actions, get_action, verify_capability] + ``` - Replace an own `muster.muster.governance.servers.` with `governedServers` entries (the render fails on the earlier shape). - An edge not on 443: set `backstage.publicPort`, and remove a hand-written portal entry from `muster.muster.oauth.mcpClient.postLoginRedirectAllowlist`. The allowlist reaches muster only with `muster.muster.oauth.mcpClient.enabled`. - An agent-manager ServiceAccount the chart does not create (`agent-manager.serviceAccount.create: false`) needs `agent-manager.serviceAccount.name`. diff --git a/docs/toolset-presets.md b/docs/toolset-presets.md index cdbe8478..e4177ec7 100644 --- a/docs/toolset-presets.md +++ b/docs/toolset-presets.md @@ -2,7 +2,7 @@ A **toolset** is the selector list an agent declares to say which of the gateway's tools it is composed with: the agent chart's `toolset` value (rendered as the `X-Muster-Toolset` header on the agent's muster tool entry), agent-manager's `toolset` argument, or the `toolset` argument of muster's `filter_tools`. muster evaluates it on every request as one more filter on the caller's own catalogue — it never widens access; the invoking human's identity and the backends' own authorization remain the boundary. The grammar, the built-in presets and the error texts are muster's: [docs/reference/toolsets.md](https://github.com/giantswarm/muster/blob/main/docs/reference/toolsets.md). -A toolset selects tools; whether a selected tool runs, asks a person or is hidden is its connector's tool approval setting (`Allow`, `Ask`, `Block`, and a connector-wide `rule`), and on a governed platform agents are also asked before every non-read tool of the platform's own servers ([Governing tool calls](https://docs.giantswarm.io/overview/agent-platform/governing-tool-calls/)). Once agent-manager ships per-agent tool lists (its `create_agent` schema has `tools`), the toolset becomes the agent's `tools` list: the same selectors, each optionally `Allow`, `Ask` or `Block`, plus a `default` for the list. +A toolset selects tools; whether a selected tool runs, asks a person or is hidden is its connector's tool approval setting (`Allow`, `Ask`, `Block`, and a connector-wide `rule`), and on a governed platform agents are also asked before every non-read tool of the platform's own servers (the agent-platform chart's README, "Tool approval and the governance mode"; further reading, optional: [Governing tool calls](https://docs.giantswarm.io/overview/agent-platform/governing-tool-calls/)). Once agent-manager ships per-agent tool lists (its `create_agent` schema has `tools`), the toolset becomes the agent's `tools` list: the same selectors, each optionally `Allow`, `Ask` or `Block`, plus a `default` for the list. A **preset** is a named selection an agent refers to as `preset:`. Presets are muster configuration — `toolsetPresets` in muster's `config.yaml`, which the muster chart renders from its `muster.toolsetPresets` value. This meta-package forwards its `muster:` block to the muster release, so the presets an installation ships live under **`muster.muster.toolsetPresets`** in these values (the first `muster` is the component block, the second is the muster chart's own `muster:` key). diff --git a/skills/agent-platform-agent-management/SKILL.md b/skills/agent-platform-agent-management/SKILL.md index e2d51206..c5344adb 100644 --- a/skills/agent-platform-agent-management/SKILL.md +++ b/skills/agent-platform-agent-management/SKILL.md @@ -126,7 +126,7 @@ never assume an argument. The agent tools drop an unknown key without an error: - **Toolset**: the smallest that does the job; `preset:none` for chat only; the broadest preset only on an explicit request. An own-account (OAuth) connector without `grantScope: subject` needs a sign-in in each of the agent's conversations (`agent-platform-tools`); say so before choosing it. -- **Tool approval** (https://docs.giantswarm.io/overview/agent-platform/governing-tool-calls/): +- **Tool approval** (further reading, optional: https://docs.giantswarm.io/overview/agent-platform/governing-tool-calls/): today an agent's toolset only selects tools; their Allow/Ask/Block settings are the connectors' (`agent-platform-tools`). On a **governed** platform every agent-manager tool that is not a read (`create_agent`, `update_agent`, `delete_agent`, `start_session`, `delete_session`, the diff --git a/skills/agent-platform-building-blocks/SKILL.md b/skills/agent-platform-building-blocks/SKILL.md index 2c2e0fbf..b7683b62 100644 --- a/skills/agent-platform-building-blocks/SKILL.md +++ b/skills/agent-platform-building-blocks/SKILL.md @@ -30,8 +30,8 @@ person to sign in once with their own account; until then their tools are hidden Each tool of a connector is **Allow** (runs), **Ask** (a person confirms the call first) or **Block** (hidden); a connector's rule decides for tools nobody has set yet, new ones included, and the strictest setting wins. A governed platform also asks before an agent changes anything through -the platform's own connectors -(https://docs.giantswarm.io/overview/agent-platform/governing-tool-calls/). +the platform's own connectors (further reading, optional: +https://docs.giantswarm.io/overview/agent-platform/governing-tool-calls/). **Suggest one** when the goal needs a system no connector reaches yet ("read our Jira tickets"): someone registers it with **Add connector**. A connector that exists but whose tools are missing diff --git a/skills/agent-platform-tools/SKILL.md b/skills/agent-platform-tools/SKILL.md index d62ca3df..0b3b5b88 100644 --- a/skills/agent-platform-tools/SKILL.md +++ b/skills/agent-platform-tools/SKILL.md @@ -136,7 +136,7 @@ https://docs.giantswarm.io/tutorials/agent-platform/connecting-custom-mcp-server ## Tool approval: Allow, Ask, Block -Concept: https://docs.giantswarm.io/overview/agent-platform/governing-tool-calls/. Every tool has one setting, decided by Muster on every call, whoever calls (an +Further reading (optional): https://docs.giantswarm.io/overview/agent-platform/governing-tool-calls/. Every tool has one setting, decided by Muster on every call, whoever calls (an agent, the portal, Slack, Claude Code): - **Allow** runs. **Ask**: a person confirms the exact call on Muster's approval page first; the From 379a59987d4f964b85fdf68fa2a9c1e8edd8b10d Mon Sep 17 00:00:00 2001 From: Dominik Schmidle Date: Thu, 26 Nov 2026 12:11:35 +0100 Subject: [PATCH 35/56] fix(helm): default the muster editors to subjects no identity provider can issue, and refuse roleFloors the chart would drop The placeholder editor groups had the org:team shape a Dex GitHub connector emits, so with no groups prefix a real group could match them. The defaults are now ServiceAccount subjects the chart never creates (kube-system/agent-platform-unset-connector-admins and -workflow-editors): nobody holds the Roles until an installation names its own subjects. A non-empty governance.roleFloors below the muster governance floor fails the render instead of being dropped. Tests drop an internal finding id and derive the platform team's names from their fixture. --- helm/agent-platform/README.md | 24 ++++++++-------- helm/agent-platform/README.md.gotmpl | 10 ++++--- helm/agent-platform/templates/_helpers.tpl | 3 ++ helm/agent-platform/values.schema.json | 2 +- helm/agent-platform/values.yaml | 33 ++++++++++++---------- tests/golden/meta-ci-engine-off.yaml | 24 ++++++++-------- tests/golden/meta-default.yaml | 24 ++++++++-------- tests/verify-target.py | 5 +++- tests/verify-tenant-rbac.py | 7 +++-- tests/verify-tool-approval.py | 22 +++++++++------ 10 files changed, 86 insertions(+), 68 deletions(-) diff --git a/helm/agent-platform/README.md b/helm/agent-platform/README.md index d71c5b16..559b6708 100644 --- a/helm/agent-platform/README.md +++ b/helm/agent-platform/README.md @@ -406,7 +406,8 @@ documentation describes the settings and the prompts; further reading (optional) configuration (`{mode, roleFloors}`); a string there fails the render. Anything but the two values fails the render. - **`governance.roleFloors`** (default `{}`): role name to the server's own tool names that ask agents in both modes on the governed servers of that role, rendered as `muster.governance.roleFloors` and - added to muster's built-in floors (config never removes one). A role declared here is a valid + added to muster's built-in floors (config never removes one). Set while the chart renders no + governance configuration (below the muster governance floor) it fails the render. A role declared here is a valid `role` in `governedServers`, so an installation governs a server of its own: ```yaml @@ -447,9 +448,10 @@ documentation describes the settings and the prompts; further reading (optional) - **The `connector-admin` role** is muster's `mcpserver-editor` Role in muster's namespace, bound to `muster.rbac.mcpServerEditor.subjects` plus `tenants.platformTeam`. Whoever holds it edits the namespace's connectors, sets their tool approval and may let an agent skip a tool's `Ask`. The - default is a placeholder group nobody belongs to unless the identity provider says so - (`agent-platform:connector-admins`; `muster.rbac.workflowEditor.subjects` likewise - `agent-platform:workflow-editors`): until the installation names its admin groups (as the API + default binds no person: a ServiceAccount subject the chart never creates and no identity provider + can issue a token for (`kube-system/agent-platform-unset-connector-admins`; + `muster.rbac.workflowEditor.subjects` likewise `agent-platform-unset-workflow-editors`), so a + real IdP group can never match it. Until the installation names its admin groups (as the API server sees them, with the OIDC groups prefix), only cluster admins edit connectors. The muster chart no longer binds `system:authenticated` and fails an upgrade with an empty list while its old binding exists; the placeholder keeps the list non-empty (`system:authenticated` makes @@ -1011,12 +1013,12 @@ The map is merged into each component's own `nodeSelector` (`muster.nodeSelector | muster.image.registry | string | `"gsoci.azurecr.io"` | | | muster.fullnameOverride | string | `"muster"` | | | muster.crds.install | bool | `false` | | -| muster.rbac.mcpServerEditor.subjects[0].apiGroup | string | `"rbac.authorization.k8s.io"` | | -| muster.rbac.mcpServerEditor.subjects[0].kind | string | `"Group"` | | -| muster.rbac.mcpServerEditor.subjects[0].name | string | `"agent-platform:connector-admins"` | | -| muster.rbac.workflowEditor.subjects[0].apiGroup | string | `"rbac.authorization.k8s.io"` | | -| muster.rbac.workflowEditor.subjects[0].kind | string | `"Group"` | | -| muster.rbac.workflowEditor.subjects[0].name | string | `"agent-platform:workflow-editors"` | | +| muster.rbac.mcpServerEditor.subjects[0].kind | string | `"ServiceAccount"` | | +| muster.rbac.mcpServerEditor.subjects[0].name | string | `"agent-platform-unset-connector-admins"` | | +| muster.rbac.mcpServerEditor.subjects[0].namespace | string | `"kube-system"` | | +| muster.rbac.workflowEditor.subjects[0].kind | string | `"ServiceAccount"` | | +| muster.rbac.workflowEditor.subjects[0].name | string | `"agent-platform-unset-workflow-editors"` | | +| muster.rbac.workflowEditor.subjects[0].namespace | string | `"kube-system"` | | | muster.networkPolicy.enabled | bool | `true` | | | muster.networkPolicy.flavor | string | `"auto"` | | | muster.networkPolicy.cilium.allowClusterIngress | bool | `true` | | @@ -1658,7 +1660,7 @@ The map is merged into each component's own `nodeSelector` (`muster.nodeSelector | governedServers | object | `{"agent-manager":{"role":"agentManager","safe":["get_info","list_agents","get_agent","get_agent_status","validate_agent","list_model_configs","list_egress_policies","list_skills","list_sessions","get_session","get_session_turn","toolchain_users","list_organizations","get_organization","list_organization_members","list_organization_connectors"]},"cluster-manager":{"role":"clusterManager","safe":["get_info","list_clusters","list_releases","list_node_pools"]},"kagent":{"role":"sessionManager","safe":["list_sessions","list_session_checkpoints","list_sandbox_templates","list_sandboxes","get_sandbox","get_sandbox_process","read_sandbox_outputs","read_sandbox_file"]},"mcp-kubernetes":{"role":"infrastructure","safe":["logs","list_port_forward_sessions","context_list","context_get_current","can_i","api_resources","cluster_health","capi_list_clusters","capi_get_cluster","capi_resolve_cluster","capi_cluster_health","get","list","describe"]},"model-manager":{"role":"modelManager","safe":["get_info","get_backend","list_backends","list_models","get_model","list_loaded_models","list_presets","search_models","check_fit","list_nodes","list_jobs","get_job"]},"skill-manager":{"role":"skillManager","safe":["list_skill_sources","list_skills","resolve_skills","get_skill","get_skill_file"]},"toolchain-manager":{"role":"toolchainManager","safe":["list_sources","list_toolchains","describe_toolchain","toolchain_build_status","search_packages"]},"vm-manager":{"role":"vmManager","safe":["get_info","get_host","list_images","get_image","list_networks","get_network","list_vms","get_vm","get_vm_metrics","get_vm_attestation"]},"workspace-manager":{"role":"workspaceManager","safe":["list_providers","list_owners","list_workspaces","get_workspace","list_repositories","preview_workspace"]}}` | The servers muster governs (muster.governance.governedServers), per source the platform ships: `role` (which of muster's role floors hold on it: agentManager, connectorManager, sessionManager, modelManager, clusterManager, vmManager, workspaceManager, toolchainManager, skillManager, infrastructure, or a role governance.roleFloors declares) and `safe`, the server's own tool names agents call unasked on governed (reads only; a floor never, muster refuses to start on one). Every other tool of a governed server asks agents on governed. A source renders one entry per MCPServer it ships while that renders (agent-platform.muster.governedKeys): a manager component's .muster.mcpServer.name in its namespace; kagent the connectivity chart's kagent server; mcp-kubernetes the connectivity chart's and every agent-platform-mcps kubernetes entry; any other key is a muster server key itself (a server the installation registers, e.g. example-manager). null drops a source (then list it in governanceExempt with the reason). make verify-tool-approval fails on a shipped MCPServer that is neither here nor in governanceExempt, and on a safe entry that names a floor or no tool of its server, or whose name starts with a write verb (create, delete, exec, set, approve, ...) unless a `# safe-write: : ` comment above `safe:` says why it reads. | | governanceExempt | object | `{"capi":"agent-platform-mcps' capi family (mcp-kubernetes' CAPI tools): every tool reads","prometheus":"agent-platform-mcps' prometheus family (mcp-prometheus): every tool reads"}` | MCPServer sources the platform ships that muster deliberately does not govern, each with its reason (make verify-tool-approval wants every shipped source in governedServers or here). Read by the meta chart's tests only. | | tenants.platform.users | list | `[{"apiGroup":"rbac.authorization.k8s.io","kind":"Group","name":"system:authenticated"}]` | Every signed-in person: bound to agent-platform:platform-user in the kagent namespace, and, while musterMcpServerViewers is unset, to `list` (with get and watch) on muster's MCPServers in muster's namespace (the servers for everyone). RBAC subjects. The default, system:authenticated, gives this to every user. It also gives it to every ServiceAccount, so every pod in the cluster can read the platform tenant's Agents, RemoteMCPServer URLs and muster's MCPServer specs. To give it to people only, replace the default with an OIDC group that every user belongs to, written as the API server sees it (with the installation's OIDC groups prefix). | -| tenants.platform.editors | list | `[{"apiGroup":"rbac.authorization.k8s.io","kind":"Group","name":"giantswarm-ad:giantswarm-admins"},{"apiGroup":"rbac.authorization.k8s.io","kind":"Group","name":"giantswarm-github:giantswarm:giantswarm-admins"}]` | The platform's operators: bound to agent-platform:editor in the kagent namespace. RBAC subjects. | +| tenants.platform.editors | list | `[{"apiGroup":"rbac.authorization.k8s.io","kind":"Group","name":"giantswarm-ad:giantswarm-admins"},{"apiGroup":"rbac.authorization.k8s.io","kind":"Group","name":"giantswarm-github:giantswarm:giantswarm-admins"}]` | The platform's operators: bound to agent-platform:editor in the kagent namespace. RBAC subjects. The default names two admin groups of the chart's original deployment, kept from before tool approval: replace them with the installation's own. | | tenants.platform.kagentRelease.name | string | `""` | The name of kagent's HelmRelease in the kagent namespace. Empty, the default, admits none. | | tenants.platform.kagentRelease.writers | list | `[]` | The identities that write it: RBAC-style subjects of kind User, Group or ServiceAccount (with its namespace), as the API server sees them (a kubeconfig's user or group, a Flux ServiceAccount). | | tenants.platformTeam | list | `[]` | The customer's platform team, per installation: RBAC subjects bound to agent-platform:editor in the kagent namespace beside `platform.editors`, and added to muster's mcpserver-editor and workflow-editor subjects beside muster.rbac.*.subjects (the meta chart appends them to the muster release's values). Empty by default. A group is written as the API server sees it (with the OIDC groups prefix of the installation). | diff --git a/helm/agent-platform/README.md.gotmpl b/helm/agent-platform/README.md.gotmpl index 761f9468..f18c9bbe 100644 --- a/helm/agent-platform/README.md.gotmpl +++ b/helm/agent-platform/README.md.gotmpl @@ -392,7 +392,8 @@ documentation describes the settings and the prompts; further reading (optional) configuration (`{mode, roleFloors}`); a string there fails the render. Anything but the two values fails the render. - **`governance.roleFloors`** (default `{}`): role name to the server's own tool names that ask agents in both modes on the governed servers of that role, rendered as `muster.governance.roleFloors` and - added to muster's built-in floors (config never removes one). A role declared here is a valid + added to muster's built-in floors (config never removes one). Set while the chart renders no + governance configuration (below the muster governance floor) it fails the render. A role declared here is a valid `role` in `governedServers`, so an installation governs a server of its own: ```yaml @@ -433,9 +434,10 @@ documentation describes the settings and the prompts; further reading (optional) - **The `connector-admin` role** is muster's `mcpserver-editor` Role in muster's namespace, bound to `muster.rbac.mcpServerEditor.subjects` plus `tenants.platformTeam`. Whoever holds it edits the namespace's connectors, sets their tool approval and may let an agent skip a tool's `Ask`. The - default is a placeholder group nobody belongs to unless the identity provider says so - (`agent-platform:connector-admins`; `muster.rbac.workflowEditor.subjects` likewise - `agent-platform:workflow-editors`): until the installation names its admin groups (as the API + default binds no person: a ServiceAccount subject the chart never creates and no identity provider + can issue a token for (`kube-system/agent-platform-unset-connector-admins`; + `muster.rbac.workflowEditor.subjects` likewise `agent-platform-unset-workflow-editors`), so a + real IdP group can never match it. Until the installation names its admin groups (as the API server sees them, with the OIDC groups prefix), only cluster admins edit connectors. The muster chart no longer binds `system:authenticated` and fails an upgrade with an empty list while its old binding exists; the placeholder keeps the list non-empty (`system:authenticated` makes diff --git a/helm/agent-platform/templates/_helpers.tpl b/helm/agent-platform/templates/_helpers.tpl index ee507938..13d36df6 100644 --- a/helm/agent-platform/templates/_helpers.tpl +++ b/helm/agent-platform/templates/_helpers.tpl @@ -5163,6 +5163,9 @@ Usage: include "agent-platform.muster.governance" $root | fromJson {{- $_ := set $out "roleFloors" $floors -}} {{- end -}} {{- else -}} +{{- if dig "roleFloors" nil (.Values.governance | default dict) -}} +{{- fail (printf "governance.roleFloors is set, but this chart renders muster's governance configuration only from the muster release that reads it (agent-platform.muster.governanceFloor%s), so the floors would be dropped and the servers of those roles would not ask: remove governance.roleFloors until then" (ternary ", unset in this chart" (printf " %s, above components.muster.versionRange" $floor) (not $floor))) -}} +{{- end -}} {{- if dig "muster" "governance" nil (.Values.muster | default dict) -}} {{- fail "muster.muster.governance is set, but this chart renders muster's governance configuration only from the muster release that reads it (agent-platform.muster.governanceFloor), and none is pinned: a mode passed to muster directly would claim a governed platform that governs nothing. Remove muster.muster.governance; the platform's governance is the governance value (mode, roleFloors)" -}} {{- end -}} diff --git a/helm/agent-platform/values.schema.json b/helm/agent-platform/values.schema.json index d18d8e5b..1f2cf151 100644 --- a/helm/agent-platform/values.schema.json +++ b/helm/agent-platform/values.schema.json @@ -3596,7 +3596,7 @@ "properties": { "editors": { "type": "array", - "description": "The platform's operators: bound to agent-platform:editor in the kagent namespace. RBAC subjects.", + "description": "The platform's operators: bound to agent-platform:editor in the kagent namespace. RBAC subjects. The default names two admin groups of the chart's original deployment, kept from before tool approval: replace them with the installation's own.", "items": { "type": "object", "required": [ diff --git a/helm/agent-platform/values.yaml b/helm/agent-platform/values.yaml index f70ae6d6..397c3abc 100644 --- a/helm/agent-platform/values.yaml +++ b/helm/agent-platform/values.yaml @@ -2741,14 +2741,15 @@ muster: # @schema skipProperties: true; additionalProperties: true # Who may register MCPServers and author Workflows through muster's # writes-as-caller path. Every registered server and authored workflow is # visible to and routed through by other users, so the chart binds both - # editor Roles explicitly. The defaults are placeholder groups - # (agent-platform:connector-admins, agent-platform:workflow-editors) that - # nobody belongs to unless the installation's identity provider puts them - # there: until an installation names its own groups, nobody but a cluster - # admin registers servers, authors workflows or changes tool approval. Set - # the subjects to the installation's admin groups, written as the API server - # sees them (with the OIDC groups prefix); the meta chart appends - # tenants.platformTeam to both. An empty list fails muster's render. + # editor Roles explicitly. The defaults bind no person: a ServiceAccount + # subject (agent-platform-unset-connector-admins, + # agent-platform-unset-workflow-editors in kube-system) that the chart never + # creates and no identity provider can issue a token for (a group name could + # be matched by a real IdP group). Until an installation names its own + # subjects, nobody but a cluster admin registers servers, authors workflows + # or changes tool approval: fail closed. Replace them with the + # installation's admin groups, written as the API server sees them (with the + # OIDC groups prefix); the meta chart appends tenants.platformTeam to both. An empty list fails muster's render. # # mcpServerEditor is the platform's connector-admin role: whoever holds # muster's mcpserver-editor Role in muster's namespace edits every connector @@ -2762,14 +2763,14 @@ muster: # @schema skipProperties: true; additionalProperties: true rbac: mcpServerEditor: subjects: - - apiGroup: rbac.authorization.k8s.io - kind: Group - name: agent-platform:connector-admins + - kind: ServiceAccount + name: agent-platform-unset-connector-admins + namespace: kube-system workflowEditor: subjects: - - apiGroup: rbac.authorization.k8s.io - kind: Group - name: agent-platform:workflow-editors + - kind: ServiceAccount + name: agent-platform-unset-workflow-editors + namespace: kube-system # Muster's NetworkPolicy mirrors the umbrella's flavor split (`cilium` vs # `kubernetes`). `auto` (the default) is replaced by the resolved top-level # `networkPolicy.flavor` before the block is forwarded, so muster and the @@ -5973,7 +5974,9 @@ tenants: kind: Group name: system:authenticated # -- The platform's operators: bound to agent-platform:editor in the - # kagent namespace. RBAC subjects. + # kagent namespace. RBAC subjects. The default names two admin groups of + # the chart's original deployment, kept from before tool approval: replace + # them with the installation's own. editors: # @schema item: object; itemRequired: [kind, name]; itemProperties: {"apiGroup": {"type": "string"}, "kind": {"type": "string"}, "name": {"type": "string"}, "namespace": {"type": "string"}} - apiGroup: rbac.authorization.k8s.io kind: Group diff --git a/tests/golden/meta-ci-engine-off.yaml b/tests/golden/meta-ci-engine-off.yaml index 6283d3b5..e306463b 100644 --- a/tests/golden/meta-ci-engine-off.yaml +++ b/tests/golden/meta-ci-engine-off.yaml @@ -1233,14 +1233,14 @@ spec: rbac: mcpServerEditor: subjects: - - apiGroup: rbac.authorization.k8s.io - kind: Group - name: agent-platform:connector-admins + - kind: ServiceAccount + name: agent-platform-unset-connector-admins + namespace: kube-system workflowEditor: subjects: - - apiGroup: rbac.authorization.k8s.io - kind: Group - name: agent-platform:workflow-editors + - kind: ServiceAccount + name: agent-platform-unset-workflow-editors + namespace: kube-system replicaCount: 2 musterMcpServerViewers: null networkPolicy: @@ -2715,14 +2715,14 @@ spec: rbac: mcpServerEditor: subjects: - - apiGroup: rbac.authorization.k8s.io - kind: Group - name: agent-platform:connector-admins + - kind: ServiceAccount + name: agent-platform-unset-connector-admins + namespace: kube-system workflowEditor: subjects: - - apiGroup: rbac.authorization.k8s.io - kind: Group - name: agent-platform:workflow-editors + - kind: ServiceAccount + name: agent-platform-unset-workflow-editors + namespace: kube-system replicaCount: 2 --- # Source: agent-platform/templates/components.yaml diff --git a/tests/golden/meta-default.yaml b/tests/golden/meta-default.yaml index 52fedd42..c92c836b 100644 --- a/tests/golden/meta-default.yaml +++ b/tests/golden/meta-default.yaml @@ -1407,14 +1407,14 @@ spec: rbac: mcpServerEditor: subjects: - - apiGroup: rbac.authorization.k8s.io - kind: Group - name: agent-platform:connector-admins + - kind: ServiceAccount + name: agent-platform-unset-connector-admins + namespace: kube-system workflowEditor: subjects: - - apiGroup: rbac.authorization.k8s.io - kind: Group - name: agent-platform:workflow-editors + - kind: ServiceAccount + name: agent-platform-unset-workflow-editors + namespace: kube-system replicaCount: 2 musterMcpServerViewers: null networkPolicy: @@ -2192,14 +2192,14 @@ spec: rbac: mcpServerEditor: subjects: - - apiGroup: rbac.authorization.k8s.io - kind: Group - name: agent-platform:connector-admins + - kind: ServiceAccount + name: agent-platform-unset-connector-admins + namespace: kube-system workflowEditor: subjects: - - apiGroup: rbac.authorization.k8s.io - kind: Group - name: agent-platform:workflow-editors + - kind: ServiceAccount + name: agent-platform-unset-workflow-editors + namespace: kube-system replicaCount: 2 --- # Source: agent-platform/templates/components.yaml diff --git a/tests/verify-target.py b/tests/verify-target.py index 073ec156..301e74cc 100755 --- a/tests/verify-target.py +++ b/tests/verify-target.py @@ -393,7 +393,10 @@ def check_hooks(meta: str) -> None: if jobs(helm(meta, runtime)): sys.exit("FAIL: the runtime shape (engine off) renders a hook Job; a cluster's own Flux gets no hook of the kagent line") with_knob = helm(meta, [*runtime, "-f", f"{meta}/ci/test-target-values.yaml"]) - if jobs(with_knob) or "kind: ServiceAccount" in with_knob: + # A ServiceAccount object (a document), not a subject named in a + # release's values (muster's editor placeholders are ServiceAccount + # subjects). + if jobs(with_knob) or any(kind == "ServiceAccount" for kind, _ in documents(with_knob)): sys.exit("FAIL: a hook Job or its identity renders with the target knob; hooks run on the installation, not on the target") ok("no hook Job renders with the target knob, none without it on the runtime shape") diff --git a/tests/verify-tenant-rbac.py b/tests/verify-tenant-rbac.py index 888be21a..fe4d1fef 100755 --- a/tests/verify-tenant-rbac.py +++ b/tests/verify-tenant-rbac.py @@ -379,14 +379,15 @@ def muster_rbac(args): if d.get("kind") == "HelmRelease" and d["metadata"]["name"] == "muster": return d["spec"]["values"].get("rbac", {}) fail("no muster HelmRelease in the meta render") - defaults = {"mcpServerEditor": ["agent-platform:connector-admins"], "workflowEditor": ["agent-platform:workflow-editors"]} + defaults = {"mcpServerEditor": ["agent-platform-unset-connector-admins"], "workflowEditor": ["agent-platform-unset-workflow-editors"]} + team_names = [a.split("=", 1)[1] for a in TEAM if a.startswith("tenants.platformTeam[") and ".name=" in a] for role, want in defaults.items(): if subject_names(muster_rbac([])[role]) != want: fail(f"muster.rbac.{role} changed without tenants.platformTeam") rbac = muster_rbac(TEAM) for role, want in defaults.items(): - if subject_names(rbac[role]) != want + ["acme:platform", "giantswarm-ad:giantswarm-admins"]: - fail(f"muster.rbac.{role}.subjects are {subject_names(rbac[role])}, want the placeholder group and the platform team once each") + if subject_names(rbac[role]) != want + team_names: + fail(f"muster.rbac.{role}.subjects are {subject_names(rbac[role])}, want the placeholder subject and the platform team once each") ok("the meta chart appends tenants.platformTeam to muster's two editor bindings, each subject once") diff --git a/tests/verify-tool-approval.py b/tests/verify-tool-approval.py index a72af3c6..e940d4ed 100755 --- a/tests/verify-tool-approval.py +++ b/tests/verify-tool-approval.py @@ -30,9 +30,10 @@ - governance floor: agent-platform.muster.governanceFloor is one X.Y.Z; its PLACEHOLDER-GOVERNANCE-FLOOR marker, while it is still there, appears once. - connector-admin: muster's mcpserver-editor Role (the platform's - connector-admin role) is bound to the configured groups: a placeholder group - nobody belongs to by default (agent-platform:connector-admins; never empty, - so muster's upgrade guard passes, never everyone), tenants.platformTeam + connector-admin role) is bound to the configured groups: by default a + ServiceAccount subject no identity provider can issue a token for + (kube-system/agent-platform-unset-connector-admins; never empty, so muster's + upgrade guard passes, never everyone, never a group name), tenants.platformTeam appended, an installation's own list standing. - role floors: governance.roleFloors renders muster.governance.roleFloors (a role an installation declares for its own server, usable in @@ -544,17 +545,17 @@ def release(args: list[str]) -> str: def check_connector_admin() -> None: editor = block(muster_release([]), " mcpServerEditor:") - if "name: agent-platform:connector-admins" not in editor or editor.count("name: ") != 1: - fail(f"connector admins by default are the placeholder group agent-platform:connector-admins alone:\n{editor}") + if "kind: ServiceAccount" not in editor or "name: agent-platform-unset-connector-admins" not in editor or "namespace: kube-system" not in editor or editor.count("name: ") != 1 or "kind: Group" in editor: + fail(f"connector admins by default are the unissuable ServiceAccount subject agent-platform-unset-connector-admins alone (no group an IdP could emit):\n{editor}") if "system:authenticated" in editor: fail(f"connector admins must not default to everyone:\n{editor}") team = block(muster_release(["--set", "tenants.platformTeam[0].kind=Group", "--set", "tenants.platformTeam[0].name=customer:platform"]), " mcpServerEditor:") - if "name: customer:platform" not in team or "agent-platform:connector-admins" not in team: + if "name: customer:platform" not in team or "agent-platform-unset-connector-admins" not in team: fail(f"tenants.platformTeam must be appended to the connector admins:\n{team}") own = block(muster_release(["--set", "muster.rbac.mcpServerEditor.subjects[0].kind=Group", "--set", "muster.rbac.mcpServerEditor.subjects[0].name=ops"]), " mcpServerEditor:") - if "name: ops" not in own or "agent-platform:connector-admins" in own: + if "name: ops" not in own or "agent-platform-unset-connector-admins" in own: fail(f"an installation's own connector admins must stand:\n{own}") - print("ok: the connector-admin role (muster's mcpserver-editor) binds a placeholder group nobody is in by default plus tenants.platformTeam, an own list standing") + print("ok: the connector-admin role (muster's mcpserver-editor) binds a ServiceAccount nobody holds by default plus tenants.platformTeam, an own list standing") def check_binder() -> None: @@ -685,7 +686,7 @@ def check_approval() -> None: fail(f"a rule Block must render:\n{blocked}") forwarded = doc(render_meta(["--set", "mcp-kubernetes.mcpServer.approval.tools.exec=Block", "--set", "kagent.controllerRoute.mcp.approval.tools.invoke_session=Ask"]), "HelmRelease", "agent-platform-connectivity") if forwarded is None or "exec: Block" not in forwarded or "invoke_session: Ask" not in forwarded: - fail("per-connector overrides in the meta chart's values must reach the connectivity release (M1-AP-12)") + fail("per-connector overrides in the meta chart's values must reach the connectivity release") cleared = render(CONN_DIR, CONN + MCPK + ["--set-json", "mcp-kubernetes.mcpServer.approval=null"]) if approval_of(cleared, "mcp-kubernetes"): fail("approval null must render no spec.approval") @@ -741,6 +742,9 @@ def check_unset_floors_keep_everything_off() -> None: err = render_meta_fail(high + ["--set", "governance.mode=governed"]) if "no muster release this chart knows reads the governance configuration yet" not in err or ">= " in err or "muster or" in err: fail(f"with the governance floor unset `governed` must fail naming why, with no empty floor:\n{err}") + err = render_meta_fail(high + ["--set-json", 'governance.roleFloors={"exampleManager":["approve_change"]}']) + if "governance.roleFloors is set, but this chart renders muster's governance configuration only from" not in err: + fail(f"with the governance floor unset governance.roleFloors must fail, not be dropped:\n{err}") for own in (["--set", "muster.muster.governance.mode=governed"], ["--set", "muster.muster.governance.servers.agentManager[0]=am"]): err = render_meta_fail(high + own) if "muster.muster.governance is set" not in err: From 0d6218b3bb611152621051d88f86751ee67bfac1 Mon Sep 17 00:00:00 2001 From: Dominik Schmidle Date: Thu, 26 Nov 2026 12:11:35 +0100 Subject: [PATCH 36/56] docs: neutral governed-server example and the fail-closed editor defaults in UPGRADE.md --- UPGRADE.md | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/UPGRADE.md b/UPGRADE.md index 56120300..6f4a13de 100644 --- a/UPGRADE.md +++ b/UPGRADE.md @@ -40,18 +40,18 @@ muster decides Allow, Ask or Block for every tool call, and the chart renders mu - Move `components.muster.versionRange` to the muster release that carries tool approval with this chart. `governance.mode: governed` below it fails the render. - After muster's CRD upgrade, force a reconcile of the releases that render MCPServers (connectivity, agent-platform-mcps, the managers) if any of them was applied while the old CRD was served (its `spec.approval` was pruned): `flux reconcile helmrelease -n --force`. Until the CRD knows `spec.approval`, muster refuses every server tool. -- **Editor defaults changed.** `muster.rbac.mcpServerEditor.subjects` (the connector admins) and `muster.rbac.workflowEditor.subjects` default to placeholder groups nobody belongs to (`agent-platform:connector-admins`, `agent-platform:workflow-editors`); they were two Giant Swarm admin groups. Set both to your admin groups in the installation's values (as the API server sees them, with the OIDC groups prefix); `tenants.platformTeam` is still appended. Until then only cluster admins register servers, author workflows or change tool approval. Keep the lists non-empty: muster's chart no longer binds `system:authenticated` and fails the upgrade with an empty list while the old binding exists (`muster.rbac.mcpServerEditor.allowRemovingBinding: true` drops it). +- **Editor defaults changed.** `muster.rbac.mcpServerEditor.subjects` (the connector admins) and `muster.rbac.workflowEditor.subjects` default to a ServiceAccount subject the chart never creates and no identity provider can issue a token for (`kube-system/agent-platform-unset-connector-admins`, `kube-system/agent-platform-unset-workflow-editors`); before, they named two fixed admin groups. Set both to your admin groups in the installation's values (as the API server sees them, with the OIDC groups prefix); `tenants.platformTeam` is still appended. Until then only cluster admins register servers, author workflows or change tool approval (fail closed). Keep the lists non-empty: muster's chart no longer binds `system:authenticated` and fails the upgrade with an empty list while the old binding exists (`muster.rbac.mcpServerEditor.allowRemovingBinding: true` drops it). `tenants.platform.editors` keeps its earlier default admin groups: replace them too. - **`governance` is a map** mirroring muster's governance configuration: `governance: {mode: trusted|governed, roleFloors: {}}`. Write `governance.mode: governed` where you wrote `governance: governed`; a string fails the render with that hint. -- **No server outside the platform's components is governed by default.** The default `governedServers` entry for `giantswarm-platform-manager` is gone, and role floors beyond muster's built-in ones come from `governance.roleFloors`. An installation that registers a server of its own (for example `giantswarm-platform-manager`) names it with its role and safe list in `governedServers` and its floors in `governance.roleFloors`, in the installation's values: +- **No server outside the platform's components is governed by default.** The earlier default `governedServers` entry for a vendor's own manager is gone, and role floors beyond muster's built-in ones come from `governance.roleFloors` (set below the muster governance floor, it fails the render instead of being dropped). An installation that registers a server of its own names it with its role and safe list in `governedServers` and its floors in `governance.roleFloors`, in the installation's values (a vendor documents its own server's entry): ```yaml governance: roleFloors: - platformManager: [approve_action, merge_action] + exampleManager: [approve_change, merge_change] governedServers: - giantswarm-platform-manager: - role: platformManager - safe: [get_info, list_installations, list_actions, get_action, verify_capability] + example-manager: + role: exampleManager + safe: [get_info, list_changes] ``` - Replace an own `muster.muster.governance.servers.` with `governedServers` entries (the render fails on the earlier shape). - An edge not on 443: set `backstage.publicPort`, and remove a hand-written portal entry from `muster.muster.oauth.mcpClient.postLoginRedirectAllowlist`. The allowlist reaches muster only with `muster.muster.oauth.mcpClient.enabled`. From 2739b10d96f28c5b7f1c22bed35fcbeca78e6d2a Mon Sep 17 00:00:00 2001 From: Dominik Schmidle Date: Thu, 26 Nov 2026 12:21:53 +0100 Subject: [PATCH 37/56] fix(helm): read a next-major pre-release upper bound as written for Helm releases whose semver skips pre-releases --- helm/agent-platform/templates/_helpers.tpl | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/helm/agent-platform/templates/_helpers.tpl b/helm/agent-platform/templates/_helpers.tpl index 13d36df6..5cb18b5c 100644 --- a/helm/agent-platform/templates/_helpers.tpl +++ b/helm/agent-platform/templates/_helpers.tpl @@ -2225,6 +2225,12 @@ read as the lower major. Takes a dict: range, major (the one major found). {{- $v := printf "%d.0.0-%s" $next $pre -}} {{- if and (not $found) (semverCompare $.range $v) -}}{{- $found = $v -}}{{- end -}} {{- end -}} +{{- /* Helm 3.17 bundles a semver library that never matches a pre-release against a range whose lower bound names none, so the probes above see nothing there; read the upper bounds as written too: `<=` or `<` naming a pre-release of the next major other than ` Date: Thu, 26 Nov 2026 12:45:25 +0100 Subject: [PATCH 38/56] fix(helm): refuse floors that need the governance wiring while its floor is unset, select muster's own namespace for the session bindings egress, refuse governed mode with muster off - a floor of tool approval, agent approval, the session bindings port or the agent chart 3.x line set while agent-platform.muster.governanceFloor is unset fails the render naming both - networkPolicy.musterSessionBindingsNamespace (set from muster's namespace) selects muster in both policy flavours - governance.mode governed or governance.roleFloors with components.muster off fails the render - verify-agent-chart-line also runs the pre-release bound cases under Helm 3.17 where .bin/ holds it --- Makefile.custom.mk | 2 +- helm/agent-platform-connectivity/README.md | 1 + .../templates/agent-manager/netpol.yaml | 7 +- .../values.schema.json | 3 + helm/agent-platform-connectivity/values.yaml | 4 ++ helm/agent-platform/README.md | 1 + helm/agent-platform/templates/_helpers.tpl | 32 +++++++++ helm/agent-platform/templates/components.yaml | 1 + helm/agent-platform/values.schema.json | 3 + helm/agent-platform/values.yaml | 4 ++ tests/golden/meta-ci-engine-off.yaml | 1 + tests/golden/meta-default.yaml | 1 + tests/verify-agent-chart-line.py | 50 +++++++++++-- tests/verify-tool-approval.py | 70 +++++++++++++++++++ 14 files changed, 171 insertions(+), 9 deletions(-) diff --git a/Makefile.custom.mk b/Makefile.custom.mk index 2019c203..3cff133c 100644 --- a/Makefile.custom.mk +++ b/Makefile.custom.mk @@ -1481,7 +1481,7 @@ verify-mcp-kubernetes-registration: ## Assert the bundled mcp-kubernetes registr .PHONY: verify-agent-chart-line verify-agent-chart-line: ## Assert that agent-manager.agentChart.semver moves to agent chart 3.x only together with agent-manager at agent-platform.agentManager.agentChartV3Floor (its migrate rewrites muster.requireApproval to default: Ask), muster at agent-platform.muster.agentApprovalFloor (enforces it), agent-manager's tool approval on and the default agent's range on the same major; a range is read as agent-manager's migrate reads it (spanning majors or only pre-releases fails, ~3.2 and bounded forms count as 3.x); the placeholder floors are unset (every 3.x line refused) or above the last release without the feature, and the gated paths run on a chart copy with test floors; the 3.x line reaches agent-manager, the migrate run's connectivity release and the default agent's source; the migrate run may list namespaces and, with organizations on, read releases, sources and Agents cluster-wide, never write them. Stdlib only. HELM selects the binary. @echo "====> $@ ($(CHART_DIR), $(CONNECTIVITY_DIR))" - @HELM="$(HELM)" python3 tests/verify-agent-chart-line.py $(CHART_DIR) $(CONNECTIVITY_DIR) + @HELM="$(HELM)" HELM_LEGACY="$(if $(filter-out $(HELM_PINNED_VERSION)+%,$(HELM_VERSION)),$(wildcard $(HELM_PINNED)))" python3 tests/verify-agent-chart-line.py $(CHART_DIR) $(CONNECTIVITY_DIR) .PHONY: verify-tool-approval verify-tool-approval: ## Assert the platform side of Governing tool calls: the top-level governance and governedServers values render muster's governance configuration into the muster release (muster.governance: mode, governedServers {server, role, safe} per shipped MCPServer, keyed namespace/name outside muster's namespace, an own entry standing) from the muster floor agent-platform.muster.governanceFloor, none below it, governed below it, the earlier servers shape, unknown keys and conflicting or unknown modes failing; coverage: every shipped MCPServer source (meta releases carrying muster.mcpServer, the connectivity chart's MCPServers, agent-platform-mcps' families, and the component charts beside this checkout, COMPONENT_CHECKOUTS) is governed or in governanceExempt, no floor is safe, every safe entry names a tool of its server, the two kubernetes maps agree; the redirect allowlist (portal /sessions with backstage.publicPort, klaus-gateway's return with its port, invalid ports and URLs failing); the connector-admin role binds the Giant Swarm admin groups plus tenants.platformTeam; muster-approval-binder's subjects are agent-manager's ServiceAccount only (muster.rbac.approvalBinder.subjects), none from the connectivity chart; agent-manager's muster.toolApproval.enabled on from its floor and muster's agent approval floor, off below muster's, absent below its own, an own value standing; the connectivity MCPServers carry explicit approval settings (a Block rule renders, overrides reach spec.approval also from the meta chart, null renders none, invalid values fail naming the key). Stdlib only. HELM selects the binary. diff --git a/helm/agent-platform-connectivity/README.md b/helm/agent-platform-connectivity/README.md index e871b181..a43e5cc8 100644 --- a/helm/agent-platform-connectivity/README.md +++ b/helm/agent-platform-connectivity/README.md @@ -1280,6 +1280,7 @@ The kagent block is open in the schema, so the template refuses a key under `kag | networkPolicy.musterInClusterMcpPorts[0] | int | `8080` | | | networkPolicy.musterInClusterMcpPorts[1] | int | `8443` | | | networkPolicy.musterSessionBindingsPort | int | `0` | | +| networkPolicy.musterSessionBindingsNamespace | string | `""` | | | networkPolicy.mcpBackends | object | `{}` | | | networkPolicy.mcpBackendScrapers[0].namespace | string | `"kube-system"` | | | networkPolicy.mcpBackendScrapers[0].matchLabels."app.kubernetes.io/instance" | string | `"alloy-metrics"` | | diff --git a/helm/agent-platform-connectivity/templates/agent-manager/netpol.yaml b/helm/agent-platform-connectivity/templates/agent-manager/netpol.yaml index 0adab985..b6187859 100644 --- a/helm/agent-platform-connectivity/templates/agent-manager/netpol.yaml +++ b/helm/agent-platform-connectivity/templates/agent-manager/netpol.yaml @@ -188,7 +188,7 @@ spec: - toEndpoints: - matchLabels: app.kubernetes.io/name: muster - io.kubernetes.pod.namespace: {{ $.Release.Namespace }} + io.kubernetes.pod.namespace: {{ $.Values.networkPolicy.musterSessionBindingsNamespace | default $.Release.Namespace }} toPorts: - ports: - port: {{ . | quote }} @@ -418,7 +418,10 @@ spec: # muster's session bindings API on its own port (start_session's binds, # grant drops), which muster admits from agent-manager alone. - to: - - podSelector: + - namespaceSelector: + matchLabels: + kubernetes.io/metadata.name: {{ $.Values.networkPolicy.musterSessionBindingsNamespace | default $.Release.Namespace }} + podSelector: matchLabels: app.kubernetes.io/name: muster ports: diff --git a/helm/agent-platform-connectivity/values.schema.json b/helm/agent-platform-connectivity/values.schema.json index 174458c4..0cf37271 100644 --- a/helm/agent-platform-connectivity/values.schema.json +++ b/helm/agent-platform-connectivity/values.schema.json @@ -1711,6 +1711,9 @@ "type": "integer" } }, + "musterSessionBindingsNamespace": { + "type": "string" + }, "musterSessionBindingsPort": { "type": "integer" }, diff --git a/helm/agent-platform-connectivity/values.yaml b/helm/agent-platform-connectivity/values.yaml index 44c86a66..e6b9c699 100644 --- a/helm/agent-platform-connectivity/values.yaml +++ b/helm/agent-platform-connectivity/values.yaml @@ -816,6 +816,10 @@ networkPolicy: # default) opens no egress for it: agent-manager then binds on muster's # aggregator port. musterSessionBindingsPort: 0 + # Namespace muster runs in, for that egress rule; set by the meta chart from + # muster's namespace (components.muster.targetNamespace). Empty selects the + # release's own namespace. + musterSessionBindingsNamespace: "" # In-cluster MCP backends an installation registers with muster (its own # MCPServer entries, e.g. through agent-platform-mcps). A ClusterIP Service # without a policy admits every pod on the cluster, and a direct call skips diff --git a/helm/agent-platform/README.md b/helm/agent-platform/README.md index 559b6708..474e1d42 100644 --- a/helm/agent-platform/README.md +++ b/helm/agent-platform/README.md @@ -980,6 +980,7 @@ The map is merged into each component's own `nodeSelector` (`muster.nodeSelector | networkPolicy.musterInClusterMcpPorts[0] | int | `8080` | | | networkPolicy.musterInClusterMcpPorts[1] | int | `8443` | | | networkPolicy.musterSessionBindingsPort | int | `0` | | +| networkPolicy.musterSessionBindingsNamespace | string | `""` | | | networkPolicy.mcpBackends | object | `{}` | | | networkPolicy.mcpBackendScrapers[0].namespace | string | `"kube-system"` | | | networkPolicy.mcpBackendScrapers[0].matchLabels."app.kubernetes.io/instance" | string | `"alloy-metrics"` | | diff --git a/helm/agent-platform/templates/_helpers.tpl b/helm/agent-platform/templates/_helpers.tpl index 5cb18b5c..c87e828e 100644 --- a/helm/agent-platform/templates/_helpers.tpl +++ b/helm/agent-platform/templates/_helpers.tpl @@ -639,6 +639,7 @@ renders (networkPolicy.mcpBackends). */ -}} {{- with (include "agent-platform.muster.sessionBindings" .root | fromJson).sessionBindings -}} {{- $np := get $derived "networkPolicy" | default dict -}} {{- $_ := set $np "musterSessionBindingsPort" (int (dig "port" 8091 .)) -}} +{{- $_ := set $np "musterSessionBindingsNamespace" (include "agent-platform.muster.namespace" $.root) -}} {{- $_ := set $derived "networkPolicy" $np -}} {{- end -}} {{- /* agent-manager's migrate run pins through the skill-manager too: its @@ -2188,6 +2189,37 @@ which keeps every 3.x line refused. One line, no comment inside the define. */}} {{- define "agent-platform.agentManager.agentChartV3Floor" -}}{{- end -}} +{{/* +The release floors depend on one another: the governance floor +(agent-platform.muster.governanceFloor) gates the binder, the approval block +and the redirect allowlist that muster's approval enforcement needs, and the +floors of tool approval per agent, of the session bindings port and of the +agent chart 3.x line each make agent-manager bind settings muster refuses +without them. A floor set while the governance floor is unset (a release that +sets them in two steps) renders agent-manager against a muster wired for none +of it: no Session starts. Fails naming the floor that is set and the one that +is missing. Governance itself (governance.mode governed, governance.roleFloors) +needs muster as a component of this release: with muster off (an external one) +nothing here would enforce it, so it fails too. Emits nothing. +*/}} +{{- define "agent-platform.validateReleaseFloors" -}} +{{- if not (include "agent-platform.muster.governanceFloor" .) -}} +{{- range $name := list "agentManager.toolApprovalFloor" "muster.agentApprovalFloor" "muster.sessionBindingsPortFloor" "agentManager.agentChartV3Floor" -}} +{{- if include (printf "agent-platform.%s" $name) $ -}} +{{- fail (printf "agent-platform.%s is set while agent-platform.muster.governanceFloor is unset: the muster approval binder, approval block and redirect allowlist render only from the governance floor, so agent-manager would bind settings that muster refuses from it and no Session would start; set agent-platform.muster.governanceFloor in the same release" $name) -}} +{{- end -}} +{{- end -}} +{{- end -}} +{{- if not (include "agent-platform.componentEnabled" (dict "root" . "name" "muster")) -}} +{{- if ne (include "agent-platform.governance" .) "trusted" -}} +{{- fail (printf "governance.mode %s needs muster as a component of this release (components.muster.enabled): with muster off nothing here enforces governance, so the platform would claim a governed state it does not have; enable components.muster, or keep governance.mode trusted" (include "agent-platform.governance" .)) -}} +{{- end -}} +{{- if dig "roleFloors" nil (.Values.governance | default dict) -}} +{{- fail "governance.roleFloors is set while muster is off (components.muster.enabled): the role floors are rendered into muster's governance configuration, so they would be dropped and the servers of those roles would not ask; enable components.muster, or remove governance.roleFloors" -}} +{{- end -}} +{{- end -}} +{{- end -}} + {{/* The release majors a range admits, as a JSON list of strings, decided as agent-manager's migrate decides its target major (TargetMajor): majors 0-99, diff --git a/helm/agent-platform/templates/components.yaml b/helm/agent-platform/templates/components.yaml index cdc6f8b0..8a0999bb 100644 --- a/helm/agent-platform/templates/components.yaml +++ b/helm/agent-platform/templates/components.yaml @@ -267,6 +267,7 @@ knowledge: {{- include "agent-platform.validateInlineSecrets" . -}} {{- include "agent-platform.validatePinnedLoginConnector" . -}} {{- include "agent-platform.validateToolsetPresets" . -}} +{{- include "agent-platform.validateReleaseFloors" . -}} {{- include "agent-platform.validateAgentChartLine" . -}} {{- $root := . -}} {{- $g := .Values.gitops -}} diff --git a/helm/agent-platform/values.schema.json b/helm/agent-platform/values.schema.json index 1f2cf151..03f832b8 100644 --- a/helm/agent-platform/values.schema.json +++ b/helm/agent-platform/values.schema.json @@ -2989,6 +2989,9 @@ "type": "integer" } }, + "musterSessionBindingsNamespace": { + "type": "string" + }, "musterSessionBindingsPort": { "type": "integer" }, diff --git a/helm/agent-platform/values.yaml b/helm/agent-platform/values.yaml index 397c3abc..8acf331e 100644 --- a/helm/agent-platform/values.yaml +++ b/helm/agent-platform/values.yaml @@ -2548,6 +2548,10 @@ networkPolicy: # from muster's floor. 0 (the default) opens no egress for it: agent-manager # then binds on muster's aggregator port. musterSessionBindingsPort: 0 + # Namespace muster runs in, for that egress rule; set by the meta chart from + # muster's namespace (components.muster.targetNamespace). Empty selects the + # release's own namespace. + musterSessionBindingsNamespace: "" # In-cluster MCP backends an installation registers with muster (its own # MCPServer entries, e.g. through agent-platform-mcps). A ClusterIP Service # without a policy admits every pod on the cluster, and a direct call skips diff --git a/tests/golden/meta-ci-engine-off.yaml b/tests/golden/meta-ci-engine-off.yaml index e306463b..5d740c71 100644 --- a/tests/golden/meta-ci-engine-off.yaml +++ b/tests/golden/meta-ci-engine-off.yaml @@ -1279,6 +1279,7 @@ spec: musterInClusterMcpPorts: - 8080 - 8443 + musterSessionBindingsNamespace: "" musterSessionBindingsPort: 0 substrate: credentialProvider: diff --git a/tests/golden/meta-default.yaml b/tests/golden/meta-default.yaml index c92c836b..b39c70e6 100644 --- a/tests/golden/meta-default.yaml +++ b/tests/golden/meta-default.yaml @@ -1444,6 +1444,7 @@ spec: musterInClusterMcpPorts: - 8080 - 8443 + musterSessionBindingsNamespace: "" musterSessionBindingsPort: 0 substrate: credentialProvider: diff --git a/tests/verify-agent-chart-line.py b/tests/verify-agent-chart-line.py index 3753bcce..7e14cec8 100755 --- a/tests/verify-agent-chart-line.py +++ b/tests/verify-agent-chart-line.py @@ -22,7 +22,15 @@ the hop's or muster's floor is unset every 3.x range is refused, whatever its form (~3.2, 3.1.x, bounds), a pre-release alone and >=3.0.0 (spans majors, as migrate says) too; the gated paths run on a copy of the chart - with test floors. + with test floors; +- a floor that needs the governance wiring (agent approval, the hop, tool + approval, session bindings) set while the governance floor is unset fails + the render naming both, 3.x line or not; +- the bounds that admit a pre-release of the next major: the probes serve + Helm 4 and the textual read of the upper bounds Helm 3.17 (whose semver + never matches a pre-release against a range with no pre-release lower + bound); HELM_LEGACY, the Helm 3.17 binary, runs the bound cases once more + under it (`make` passes the one in .bin/ when it is there). Stdlib only: documents are matched by text. Usage: verify-agent-chart-line.py @@ -109,12 +117,12 @@ def floor_value(chart: str, name: str) -> str | None: return m.group(1) -def with_floors(dst: str) -> str: +def with_floors(dst: str, floors: dict[str, str] | None = None) -> str: chart = os.path.join(dst, "agent-platform") shutil.copytree(META_ORIG, chart) path = os.path.join(chart, "templates", "_helpers.tpl") text = open(path, encoding="utf-8").read() - for name, v in TEST_FLOORS.items(): + for name, v in (TEST_FLOORS if floors is None else floors).items(): text, n = re.subn(r'(\{\{- define "agent-platform\.' + re.escape(name) + r'" -\}\})[^{]*(\{\{- end -\}\})', r"\g<1>" + v + r"\g<2>", text) if n != 1: fail(f"agent-platform.{name}: cannot set the test floor") @@ -233,10 +241,40 @@ def migrate_cluster_rules(*args: str) -> str: if '"get", "list"]\n' in rules.split('resources: ["agents"]', 1)[-1][:40]: fail("the run lists Agents in organization namespaces, it gets none") +# A floor that needs the governance wiring, set while the governance floor is +# unset (a release that sets its floors in two steps): the render fails naming +# both, not an agent-manager that binds what muster refuses. +for dependent in ("muster.agentApprovalFloor", "agentManager.agentChartV3Floor", "agentManager.toolApprovalFloor", "muster.sessionBindingsPortFloor"): + with tempfile.TemporaryDirectory() as tmp: + META = with_floors(tmp, {dependent: TEST_FLOORS[dependent]} | {"muster.governanceFloor": ""}) + refused(f"{dependent} set, governance floor unset", f"agent-platform.{dependent} is set while agent-platform.muster.governanceFloor is unset") + refused(f"{dependent} set, governance floor unset, 2.x line", "agent-platform.muster.governanceFloor is unset", "--set", "agent-manager.agentChart.semver=2.6.1") +META = META_ORIG +with tempfile.TemporaryDirectory() as tmp: + META = with_floors(tmp, {n: v for n, v in TEST_FLOORS.items() if n != "muster.governanceFloor"} | {"muster.governanceFloor": ""}) + refused("every floor but the governance floor set", "agent-platform.muster.governanceFloor is unset", *LINE, "--set", "components.default-agent.versionRange=" + V3) +META = META_ORIG + + # A bound that admits a pre-release of the next major, and range -# shapes that are no semver range. -refused("<=3.0.0-rc.1 bound", "admits 3.0.0-0, a pre-release of the next agent chart major", "--set", "agent-manager.agentChart.semver=>=2.6.0 <=3.0.0-rc.1") -refused("<3.0.0-rc.1 bound", "a pre-release of the next agent chart major", "--set", "agent-manager.agentChart.semver=>=2.6.0 <3.0.0-rc.1") +# shapes that are no semver range. Run under the Helm of the run, and once more +# under Helm 3.17 (HELM_LEGACY), whose semver library never matches a +# pre-release against a range with no pre-release lower bound, so only the +# textual read of the upper bounds (nextMajorPreRelease) can see them there. +def bound_cases() -> None: + refused("<=3.0.0-rc.1 bound", "admits 3.0.0-0, a pre-release of the next agent chart major", "--set", "agent-manager.agentChart.semver=>=2.6.0 <=3.0.0-rc.1") + refused("<3.0.0-rc.1 bound", "a pre-release of the next agent chart major", "--set", "agent-manager.agentChart.semver=>=2.6.0 <3.0.0-rc.1") + refused("<3.0.0-0.1 bound (not the -0 exception)", "a pre-release of the next agent chart major", "--set", "agent-manager.agentChart.semver=>=2.6.0 <3.0.0-0.1") + renders("<3.0.0-0 bound (the exception)", "--set", "agent-manager.agentChart.semver=>=2.6.0 <3.0.0-0") + + +bound_cases() +if os.environ.get("HELM_LEGACY"): + HELM = os.environ["HELM_LEGACY"] + bound_cases() + HELM = os.environ.get("HELM") or "helm" +elif not failures: + print("note: HELM_LEGACY (Helm 3.17) is not set: the textual read of pre-release upper bounds ran only where the probes find them", file=sys.stderr) refused("majors beyond 5", "admits agent chart majors 3, 6", "--set", "agent-manager.agentChart.semver=>=3.0.0 <4.0.0 || 6.x") refused("latest", "is not a semver range", "--set", "agent-manager.agentChart.semver=latest") refused("empty", "is not a semver range", "--set-string", "agent-manager.agentChart.semver=") diff --git a/tests/verify-tool-approval.py b/tests/verify-tool-approval.py index e940d4ed..db7e7ac8 100755 --- a/tests/verify-tool-approval.py +++ b/tests/verify-tool-approval.py @@ -650,6 +650,27 @@ def releases(args: list[str]) -> tuple[str, str]: _, am = releases([*floor, "--set", "agent-manager.muster.bindingsUrl=https://bindings.example.com/session-bindings"]) if "bindingsUrl: https://bindings.example.com/session-bindings" not in am or ":8091/session-bindings" in am: fail(f"an own agent-manager.muster.bindingsUrl must stand:\n{am}") + # muster in a namespace of its own: the egress rule selects that namespace, + # in both policy flavours, not the connectivity release's. + ns_args = [*floor, "--set", "components.muster.targetNamespace=muster-only"] + out = render_meta([*base, *ns_args]) + conn = doc(out, "HelmRelease", "agent-platform-connectivity") or "" + if "musterSessionBindingsNamespace: muster-only" not in conn: + fail(f"the connectivity release must carry muster's namespace for the session bindings egress rule:\n{conn}") + _, am = releases(ns_args) + if "muster.muster-only.svc.cluster.local:8091/session-bindings" not in am: + fail(f"agent-manager's bindingsUrl must name muster's namespace:\n{am}") + for flavor, want in (("cilium", "io.kubernetes.pod.namespace: muster-only"), ("kubernetes", "kubernetes.io/metadata.name: muster-only")): + for ns_value, expect in (("muster-only", want), ("", "")): + rendered = render(CONN_DIR, CONN + AGENT_MANAGER + ["--set", f"networkPolicy.flavor={flavor}", "--set", "networkPolicy.musterSessionBindingsPort=8091", "--set", f"networkPolicy.musterSessionBindingsNamespace={ns_value}"]) + rule = rendered.split("session bindings API on its own port", 1) + if len(rule) != 2: + fail(f"{flavor}: no session bindings egress rule rendered") + snippet = rule[1][:400] + if expect and expect not in snippet: + fail(f"{flavor}: the session bindings egress rule must select muster's namespace ({expect}):\n{snippet}") + if not expect and ("muster-only" in snippet or ("metadata.name" not in snippet and flavor == "kubernetes") or ("io.kubernetes.pod.namespace: agent-platform" not in snippet and flavor == "cilium")): + fail(f"{flavor}: without a namespace the rule must select the release's own (agent-platform):\n{snippet}") print("ok: from muster's session bindings floor muster serves the session bindings API on its own port, off the aggregator port, its network policy admitting agent-manager's pods alone, and agent-manager's bindingsUrl names that port; none below the floor; own values stand") @@ -725,6 +746,54 @@ def with_test_floors(meta_dir: str, dst: str) -> str: return chart +def chart_with_floors(meta_dir: str, dst: str, floors: dict[str, str]) -> str: + """A copy of the meta chart with exactly these floors set; every other + floor of TEST_FLOORS unset.""" + chart = os.path.join(dst, "agent-platform") + shutil.copytree(meta_dir, chart) + path = os.path.join(chart, "templates", "_helpers.tpl") + text = open(path).read() + for name in list(TEST_FLOORS) + ["agentManager.agentChartV3Floor"]: + text, n = re.subn(r'(\{\{- define "agent-platform\.' + re.escape(name) + r'" -\}\})[^{]*(\{\{- end -\}\})', r"\g<1>" + floors.get(name, "") + r"\g<2>", text) + if n != 1: + fail(f"agent-platform.{name}: no one-line define") + open(path, "w").write(text) + return chart + + +def check_floor_dependencies() -> None: + """The floors that need the governance wiring fail the render while the + governance floor is unset, whichever of them is set; governed mode and role + floors fail with muster off.""" + dependent = ["agentManager.toolApprovalFloor", "muster.agentApprovalFloor", "muster.sessionBindingsPortFloor", "agentManager.agentChartV3Floor"] + values = {**TEST_FLOORS, "agentManager.agentChartV3Floor": "3.6.0"} + with tempfile.TemporaryDirectory(prefix="verify-floor-deps-") as tmp: + for i, name in enumerate(dependent): + os.makedirs(os.path.join(tmp, str(i))) + chart = chart_with_floors(META_DIR, os.path.join(tmp, str(i)), {name: values[name]}) + err = render(chart, META, expect_fail=True) + want = f"agent-platform.{name} is set while agent-platform.muster.governanceFloor is unset" + if want not in err: + fail(f"floor {name} set with the governance floor unset must fail the render naming both:\n{err}") + os.makedirs(os.path.join(tmp, "all")) + chart = chart_with_floors(META_DIR, os.path.join(tmp, "all"), {n: v for n, v in values.items() if n != "muster.governanceFloor"}) + err = render(chart, META, expect_fail=True) + if "agent-platform.muster.governanceFloor is unset" not in err: + fail(f"every floor but the governance floor set must fail naming it:\n{err}") + os.makedirs(os.path.join(tmp, "ok")) + chart = chart_with_floors(META_DIR, os.path.join(tmp, "ok"), values) + render(chart, META) + for args, want in ( + (["--set", "components.muster.enabled=false", "--set", "governance.mode=governed"], "governance.mode governed needs muster as a component of this release"), + (["--set", "components.muster.enabled=false", "--set-json", 'governance.roleFloors={"exampleManager":["approve_change"]}'], "governance.roleFloors is set while muster is off"), + ): + err = render(chart, META + args, expect_fail=True) + if want not in err: + fail(f"{args}: want {want!r}, got:\n{err}") + render(chart, META + ["--set", "components.muster.enabled=false"]) + print("ok: a floor that needs the governance wiring fails the render while the governance floor is unset, naming both; governed mode and role floors fail with muster off, trusted renders") + + def check_unset_floors_keep_everything_off() -> None: """On the chart as it is: a floor whose release does not exist gates its wiring off whatever the component ranges say.""" @@ -764,6 +833,7 @@ def render_meta_fail(args: list[str]) -> str: META_DIR, CONN_DIR = sys.argv[1], sys.argv[2] governance_floor(META_DIR) check_unset_floors_keep_everything_off() + check_floor_dependencies() _tmp = tempfile.mkdtemp(prefix="verify-tool-approval-") atexit.register(shutil.rmtree, _tmp, True) META_DIR = with_test_floors(META_DIR, _tmp) From 86671d612bed4997a570b97dc5efbec2cab54c3f Mon Sep 17 00:00:00 2001 From: Dominik Schmidle Date: Thu, 26 Nov 2026 14:04:57 +0100 Subject: [PATCH 39/56] fix(helm): let migrate rewrite organization releases on the 3.x line under a scope policy, and read every alternative of a range On the 3.x line itself (not a preflight range) with organizations on, the migrate identity may update HelmReleases and write its report ConfigMap cluster-wide, so it rewrites the organization releases agent-manager owns and marks each organization ready for the agent-platform-operator's move of its chart source. The ValidatingAdmissionPolicy agent-platform-organization-migrate-scope holds those writes to organization namespaces and the kagent namespace, to spec.values of an organization's HelmRelease and to the report's name. The agent chart line guard and the connectivity chart's 3.x probe also probe every version a range names, with its next patch and minor, as migrate and the operator do: 3.0.1 || 2.6.0 spans two majors and is refused. UPGRADE.md describes the per-organization cut-over and its hand step. --- Makefile.custom.mk | 2 +- UPGRADE.md | 11 +-- .../templates/kagent/_migrate.tpl | 28 ++++++- .../templates/kagent/migrate-rbac.yaml | 35 +++++++-- .../organizations/migrate-scope.yaml | 73 +++++++++++++++++++ helm/agent-platform/templates/_helpers.tpl | 28 +++++-- tests/verify-agent-chart-line.py | 46 +++++++++++- tests/verify-organization-namespaces.py | 55 ++++++++++++++ 8 files changed, 255 insertions(+), 23 deletions(-) create mode 100644 helm/agent-platform-connectivity/templates/organizations/migrate-scope.yaml diff --git a/Makefile.custom.mk b/Makefile.custom.mk index 3cff133c..6d549ef8 100644 --- a/Makefile.custom.mk +++ b/Makefile.custom.mk @@ -1479,7 +1479,7 @@ verify-mcp-kubernetes-registration: ## Assert the bundled mcp-kubernetes registr @echo "mcp-kubernetes registration shapes verified." .PHONY: verify-agent-chart-line -verify-agent-chart-line: ## Assert that agent-manager.agentChart.semver moves to agent chart 3.x only together with agent-manager at agent-platform.agentManager.agentChartV3Floor (its migrate rewrites muster.requireApproval to default: Ask), muster at agent-platform.muster.agentApprovalFloor (enforces it), agent-manager's tool approval on and the default agent's range on the same major; a range is read as agent-manager's migrate reads it (spanning majors or only pre-releases fails, ~3.2 and bounded forms count as 3.x); the placeholder floors are unset (every 3.x line refused) or above the last release without the feature, and the gated paths run on a chart copy with test floors; the 3.x line reaches agent-manager, the migrate run's connectivity release and the default agent's source; the migrate run may list namespaces and, with organizations on, read releases, sources and Agents cluster-wide, never write them. Stdlib only. HELM selects the binary. +verify-agent-chart-line: ## Assert that agent-manager.agentChart.semver moves to agent chart 3.x only together with agent-manager at agent-platform.agentManager.agentChartV3Floor (its migrate rewrites muster.requireApproval to default: Ask), muster at agent-platform.muster.agentApprovalFloor (enforces it), agent-manager's tool approval on and the default agent's range on the same major; a range is read as agent-manager's migrate reads it (spanning majors or only pre-releases fails, ~3.2 and bounded forms count as 3.x); the placeholder floors are unset (every 3.x line refused) or above the last release without the feature, and the gated paths run on a chart copy with test floors; the 3.x line reaches agent-manager, the migrate run's connectivity release and the default agent's source; the migrate run may list namespaces and, with organizations on, read releases, sources and Agents cluster-wide, and only on the 3.x line itself (not a preflight) update HelmReleases and write its report ConfigMap, held by agent-platform-organization-migrate-scope; every alternative of a || range and every version a range names count (3.0.1 || 2.6.0 spans two majors). Stdlib only. HELM selects the binary. @echo "====> $@ ($(CHART_DIR), $(CONNECTIVITY_DIR))" @HELM="$(HELM)" HELM_LEGACY="$(if $(filter-out $(HELM_PINNED_VERSION)+%,$(HELM_VERSION)),$(wildcard $(HELM_PINNED)))" python3 tests/verify-agent-chart-line.py $(CHART_DIR) $(CONNECTIVITY_DIR) diff --git a/UPGRADE.md b/UPGRADE.md index 6f4a13de..d56c6cea 100644 --- a/UPGRADE.md +++ b/UPGRADE.md @@ -17,20 +17,21 @@ A CRD version change that needs more than an apply (a stored version dropped, as ## \ → \ (agent chart 3.0: `muster.requireApproval` becomes `default: Ask`) -agent chart 3.0 removes `muster.requireApproval` (kagent's flag that paused an agent before every tool call) and the default of `modelConfig.name`. `default: Ask` replaces `requireApproval: true`: muster asks a person before every tool call the agent makes through it, from every client; once migrated, nothing asks twice (until then see *Running Sessions* below). `agent-manager.agentChart.semver` moves the agents of the whole installation: agent-manager composes new agents on it, its migrate run (the connectivity release's start hook) moves the existing ones, and the agent-platform-operator moves every organization's chart source at once. +agent chart 3.0 removes `muster.requireApproval` (kagent's flag that paused an agent before every tool call) and the default of `modelConfig.name`. `default: Ask` replaces `requireApproval: true`: muster asks a person before every tool call the agent makes through it, from every client; once migrated, nothing asks twice (until then see *Running Sessions* below). `agent-manager.agentChart.semver` moves the agents of the whole installation: agent-manager composes new agents on it, its migrate run (the connectivity release's start hook) moves the existing ones, and the agent-platform-operator moves each organization's chart source once migrate marks that organization ready (agent-platform-operator from the release carrying `agentChart.migrationReport`). -The render allows the 3.x line only together with what makes it safe (`make verify-agent-chart-line`): agent-manager at `agent-platform.agentManager.agentChartV3Floor`, whose migrate has the 2.x → 3.x hop, muster at `agent-platform.muster.agentApprovalFloor`, which enforces `default: Ask`, agent-manager's tool approval on (`agent-manager.muster.toolApproval.enabled` unset) and the default agent's range on the same major. **Both floors are unset in this chart** until the muster and agent-manager releases carrying tool approval exist, so every 3.x range is refused for now, whatever its form (`3.x`, `~3.2`, `>=3.1.0 <3.6.0`); the platform release that pins those versions sets them. They are chart code, not values, on purpose: a floor states which released version carries a feature, and a value would let one installation's configuration claim it for a release that lacks it (a lab tests a branch build on a copy of the chart, as the verify scripts do). The same goes for the other floors of tool approval (`agent-platform.agentManager.toolApprovalFloor`, `agent-platform.muster.governanceFloor`, `agent-platform.muster.sessionBindingsPortFloor`): unset, what they gate stays off and `governance: governed` fails. The range is read as agent-manager's migrate reads it: a range admitting two majors (`>=3.0.0`) or only pre-releases fails. +The render allows the 3.x line only together with what makes it safe (`make verify-agent-chart-line`): agent-manager at `agent-platform.agentManager.agentChartV3Floor`, whose migrate has the 2.x → 3.x hop, muster at `agent-platform.muster.agentApprovalFloor`, which enforces `default: Ask`, agent-manager's tool approval on (`agent-manager.muster.toolApproval.enabled` unset) and the default agent's range on the same major. **Both floors are unset in this chart** until the muster and agent-manager releases carrying tool approval exist, so every 3.x range is refused for now, whatever its form (`3.x`, `~3.2`, `>=3.1.0 <3.6.0`); the platform release that pins those versions sets them. They are chart code, not values, on purpose: a floor states which released version carries a feature, and a value would let one installation's configuration claim it for a release that lacks it (a lab tests a branch build on a copy of the chart, as the verify scripts do). The same goes for the other floors of tool approval (`agent-platform.agentManager.toolApprovalFloor`, `agent-platform.muster.governanceFloor`, `agent-platform.muster.sessionBindingsPortFloor`): unset, what they gate stays off and `governance: governed` fails. The range is read as agent-manager's migrate and the agent-platform-operator read it: every version it names and every alternative of a `||` range count, so a range admitting two majors (`>=3.0.0`, `3.0.1 || 2.6.0`) or only pre-releases fails. -The migrate run writes each release's 3.x values (`muster.requireApproval: true` → `default: Ask` where the muster binding renders, the key dropped, an unset `modelConfig.name` spelled out as the 2.x default `default-model-config`) only once a 3.x chart is published and only where it moves the namespace's source in the same run. It writes no release with `spec.valuesFrom` (reported `failed` with what to change), none whose source it cannot move (pinned, owned by git, the platform's: `pending` with the diff), and nothing in organization namespaces, whose releases it reports with diffs; any of them keeps the report in the expand phase. +The migrate run writes each release's 3.x values (`muster.requireApproval: true` → `default: Ask` where the muster binding renders, the key dropped, an unset `modelConfig.name` spelled out as the 2.x default `default-model-config`) only once a 3.x chart is published and only where it moves the namespace's source in the same run. It writes no release with `spec.valuesFrom` (reported `failed` with what to change), none whose source it cannot move (pinned, owned by git, the platform's: `pending` with the diff); any of them keeps the report in the expand phase. In organization namespaces it applies the same rules but for the source, which stays the operator's: it rewrites the releases agent-manager owns, gives a GitOps-owned one its diff (holding its siblings), writes its report in each organization namespace and annotates it `agent-platform.giantswarm.io/agent-chart-ready-major: "3"` once every release there is on 3.x values. The operator moves an organization's source to 3.x only on that annotation (or when no HelmRelease there uses the source); until then the organization is `Ready=False` with reason `ChartSourceHeld`, and its releases stay on 2.x, still asking. Between the run's write and the operator's move (within `agentChart.migrationPoll`, 1m) a rewritten release's 2.x upgrade fails and it keeps its deployed revision, which still asks. ### Operator action - Once the floors are set: move `agent-manager.agentChart.semver` and `components.default-agent.versionRange` to `>=3.0.0 <4.0.0` together with `components.agent-manager.versionRange` and `components.muster.versionRange` at or above the floors. The render refuses the line without the two component floors, without tool approval, or with the default agent on the other major; moving the component ranges alone renders. - Tool approval's prerequisites must hold (muster's OAuth server with Dex sign-in, Valkey storage; the entry below): without them muster refuses every call that asks, so an agent migrated to `default: Ask` cannot call its tools until they hold. It never runs them unasked. -- **Mandatory before the upgrade:** with the line still on 2.x, set `agentManager.migration.preflightSemver: ">=3.0.0 <4.0.0"` (it renders the never-started CronJob `-agent-manager-migrate-preflight` and grants the migration's identity the read-only access the 3.x path needs: list namespaces; with organizations, read their HelmReleases, OCIRepositories and Agents), then run `kubectl -n create job --from=cronjob/-agent-manager-migrate-preflight preflight-1` and read the report in `kubectl -n logs job/preflight-1` (a dry run writes no ConfigMap). Fix every release it lists, including those in organization namespaces, before moving the line; unset `preflightSemver` afterwards to drop the extra reads. The agent-platform-operator moves every organization's chart source at once with the range, and nothing holds it: a release there that still carries `muster.requireApproval` fails its 3.x render and stays on its 2.x revision, still asking through kagent, until fixed; one without `modelConfig.name` renders without a model. Also check releases whose values come from `valuesFrom`: `kubectl get helmreleases -A -o json | jq -r '.items[] | select(.spec.values.muster.requireApproval != null or .spec.values.modelConfig.name == null or (.spec.valuesFrom // [] | length > 0)) | "\(.metadata.namespace)/\(.metadata.name)"'` and the ConfigMaps or Secrets they name. +- **Mandatory before the upgrade:** with the line still on 2.x, set `agentManager.migration.preflightSemver: ">=3.0.0 <4.0.0"` (it renders the never-started CronJob `-agent-manager-migrate-preflight` and grants the migration's identity the read-only access the 3.x path needs: list namespaces; with organizations, read their HelmReleases, OCIRepositories and Agents), then run `kubectl -n create job --from=cronjob/-agent-manager-migrate-preflight preflight-1` and read the report in `kubectl -n logs job/preflight-1` (a dry run writes no ConfigMap). Fix every release it lists that the run will not write (`failed`, and `diff` ones you own in git), including those in organization namespaces, before moving the line; unset `preflightSemver` afterwards to drop the extra reads. Also check releases whose values come from `valuesFrom`: `kubectl get helmreleases -A -o json | jq -r '.items[] | select(.spec.values.muster.requireApproval != null or .spec.values.modelConfig.name == null or (.spec.valuesFrom // [] | length > 0)) | "\(.metadata.namespace)/\(.metadata.name)"'` and the ConfigMaps or Secrets they name. - The repair is always **replace `muster.requireApproval: true` with `default: Ask`**, never just delete the key (that turns the agent's asks off); drop `requireApproval: false` and `null`; set `modelConfig.name` where it is unset. In git, apply it together with the move of that release's chart source to 3.x; for `valuesFrom`, move the settings into `spec.values` (agent-manager binds settings only from there). - Running Sessions: with tool approval on (agent-manager at `agent-platform.agentManager.toolApprovalFloor`), agent-manager binds a Session of an agent on `muster.requireApproval: true` with `default: Ask` already on 2.x, so such an agent needs muster's approval prerequisites from then on, not only on 3.x; (such an agent is asked twice there, by kagent and by muster, until it is migrated), so Sessions running across the upgrade keep asking. A Session started by an agent-manager below `agent-platform.agentManager.toolApprovalFloor` carries no settings and muster applies the agent's re-rendered `X-Muster-Tool-Approval: default=Ask`. -- Read the report after the run: `kubectl -n get configmap agent-manager-migrate-report -o jsonpath='{.data.report\.yaml}'`; each rewritten release lists `changes.removed` and `changes.set`. A release carrying `requireApproval: true` beside tool approval settings is reported failed (no released chart renders that combination) and holds its chart source; set its settings by hand. The run needs list on namespaces and read access in organization namespaces (the chart grants them only on a 3.x line); without them it fails before it writes anything (`--organization-namespaces none` skips them, leaving them unchecked). +- Read the report after the run: `kubectl -n get configmap agent-manager-migrate-report -o jsonpath='{.data.report\.yaml}'`; each rewritten release lists `changes.removed` and `changes.set`. A release carrying `requireApproval: true` beside tool approval settings is reported failed (no released chart renders that combination) and holds its chart source; set its settings by hand. The run needs list on namespaces, read access in organization namespaces and, there, update on HelmReleases and its report ConfigMap (the chart grants the reads only on a 3.x line or preflight range and the writes only on the 3.x line, held by the ValidatingAdmissionPolicy `agent-platform-organization-migrate-scope` to organization namespaces and the kagent namespace, to `spec.values` and to the report's name); without them it fails before it writes anything (`--organization-namespaces none` skips them, leaving them unchecked and their sources held). +- **Per organization:** `kubectl get agentplatformorganizations -A -o json | jq -r '.items[] | select(any(.status.conditions[]?; .reason == "ChartSourceHeld")) | "\(.metadata.namespace)/\(.metadata.name)"'` lists the organizations still on 2.x; the report in each one's namespace (`kubectl -n get configmap agent-manager-migrate-report -o jsonpath='{.data.report\.yaml}'`) names the releases that hold it. Apply each diff in the organization's repository (`default: Ask` in place of `requireApproval: true`), then run migrate again: `kubectl -n create job --from=cronjob/-agent-manager-migrate migrate-2`. ## \ → \ (tool approval and the governance mode) diff --git a/helm/agent-platform-connectivity/templates/kagent/_migrate.tpl b/helm/agent-platform-connectivity/templates/kagent/_migrate.tpl index 7a510708..218c9a75 100644 --- a/helm/agent-platform-connectivity/templates/kagent/_migrate.tpl +++ b/helm/agent-platform-connectivity/templates/kagent/_migrate.tpl @@ -129,13 +129,26 @@ echo "{{ .job }} started; its outcome: kubectl -n {{ .namespace }} get job {{ .j {{- end -}} {{/* -Truthy when a range (the argument) is a 3.x line, probed as agent-manager's -migrate probes it. +Truthy when a range (the argument) admits a 3.x release, probed as +agent-manager's migrate probes it (agent-platform.agentChart.majors in the +meta chart): every version the range names with its next patch and minor, so +each alternative of a `||` range counts, and 3.0.0, a late 3.x and the first +and a late patch of every minor below 200. */}} {{- define "agent-platform.kagent.migration.isV3" -}} {{- $range := toString . -}} {{- if and (regexMatch "[0-9]" $range) (not (regexMatch "(^|[\\s|,<>=~^])[A-Za-uwyzA-WYZ]" $range)) -}} {{- $hit := or (semverCompare $range "3.0.0") (semverCompare $range "3.999999.999999") -}} +{{- range $lit := regexFindAll "[0-9]+(\\.[0-9]+)?(\\.[0-9]+)?" $range -1 -}} +{{- $p := splitList "." $lit -}} +{{- if eq (index $p 0) "3" -}} +{{- $min := 0 -}}{{- if gt (len $p) 1 -}}{{- $min = atoi (index $p 1) -}}{{- end -}} +{{- $pat := 0 -}}{{- if gt (len $p) 2 -}}{{- $pat = atoi (index $p 2) -}}{{- end -}} +{{- range $v := list (printf "3.%d.%d" $min $pat) (printf "3.%d.%d" $min (add1 $pat)) (printf "3.%d.0" (add1 $min)) -}} +{{- if and (not $hit) (semverCompare $range $v) -}}{{- $hit = true -}}{{- end -}} +{{- end -}} +{{- end -}} +{{- end -}} {{- range $n := until 200 -}} {{- if and (not $hit) (or (semverCompare $range (printf "3.%d.0" $n)) (semverCompare $range (printf "3.%d.999999" $n))) -}}{{- $hit = true -}}{{- end -}} {{- end -}} @@ -153,3 +166,14 @@ is, for the dry run before the line moves. {{- $am := include "agent-platform.agentManager.chartValues" . | fromJson -}} {{- if or (include "agent-platform.kagent.migration.isV3" (dig "agentChart" "semver" "2.x" $am)) (include "agent-platform.kagent.migration.isV3" (dig "migration" "preflightSemver" "" (.Values.agentManager | default dict))) -}}true{{- end -}} {{- end -}} + +{{/* +Truthy when the run itself (not the preflight dry run) takes the 2.x -> 3.x +path with organizations on: agent-manager.agentChart.semver is a 3.x line. +Only then the run writes organization releases and its report there +(migrate-rbac.yaml, organizations/migrate-scope.yaml). +*/}} +{{- define "agent-platform.kagent.migration.v3Writes" -}} +{{- $am := include "agent-platform.agentManager.chartValues" . | fromJson -}} +{{- if and (include "agent-platform.organizations.enabled" .) (include "agent-platform.kagent.migration" .) (include "agent-platform.kagent.migration.isV3" (dig "agentChart" "semver" "2.x" $am)) -}}true{{- end -}} +{{- end -}} diff --git a/helm/agent-platform-connectivity/templates/kagent/migrate-rbac.yaml b/helm/agent-platform-connectivity/templates/kagent/migrate-rbac.yaml index 9c29b766..043ce2e3 100644 --- a/helm/agent-platform-connectivity/templates/kagent/migrate-rbac.yaml +++ b/helm/agent-platform-connectivity/templates/kagent/migrate-rbac.yaml @@ -23,10 +23,19 @@ Only while agent-manager.agentChart.semver is a 3.x line (the 2.x -> 3.x path) the same ClusterRole also lets the run list namespaces (it finds the organization namespaces by label and fails when it may not) and, with agentPlatformOrganizations.enabled, list and get the -HelmReleases and OCIRepositories and list the Agents it reads there, never -writing them (agent-platform.kagent.migration.v3Line). The operator mirrors no -binding of this identity into organization namespaces, so the reads are -cluster-wide; they exist only for the cut-over run. +HelmReleases and OCIRepositories and list the Agents it reads there +(agent-platform.kagent.migration.v3Line; a 3.x preflight range on the 2.x +line too, for its dry run). Only while the line itself is 3.x +(agent-platform.kagent.migration.v3Writes) the run also updates the +organization releases agent-manager owns (their values to 3.x) and writes its +report ConfigMap agent-manager-migrate-report there, which the +agent-platform-operator reads before it moves the organization's chart source +to 3.x; it never writes an organization's OCIRepository. The operator mirrors +no binding of this identity into organization namespaces, so these rights are +cluster-wide; they exist only for the cut-over run, and +agent-platform-organization-migrate-scope (organizations/migrate-scope.yaml) +holds the writes to organization namespaces (and the kagent namespace), to +spec.values of a HelmRelease and to the report's name. Per namespace in agentManager.migration.gitopsNamespaces (the fleet: flux-giantswarm, where the GitOps-owned agents' HelmReleases and @@ -118,8 +127,9 @@ rules: # Organization namespaces: on the # agent chart 2.x -> 3.x path the run lists the namespaces labelled as an # organization's and fails when it may not; it reads their releases, chart - # sources and Agents, never writes them, and reports what needs changing - # before the agent-platform-operator moves their sources. + # sources and Agents, rewrites the releases agent-manager owns and marks + # each namespace in its report once every release there is on 3.x values; + # the agent-platform-operator moves an organization's source only then. {{- if include "agent-platform.kagent.migration.v3Line" . }} - apiGroups: [""] resources: ["namespaces"] @@ -135,6 +145,19 @@ rules: resources: ["agents"] verbs: ["list"] {{- end }} + {{- if include "agent-platform.kagent.migration.v3Writes" . }} + - apiGroups: ["helm.toolkit.fluxcd.io"] + resources: ["helmreleases"] + verbs: ["update"] + # RBAC cannot name the object of a create. + - apiGroups: [""] + resources: ["configmaps"] + verbs: ["create"] + - apiGroups: [""] + resources: ["configmaps"] + resourceNames: ["agent-manager-migrate-report"] + verbs: ["get", "update"] + {{- end }} {{- end }} --- apiVersion: rbac.authorization.k8s.io/v1 diff --git a/helm/agent-platform-connectivity/templates/organizations/migrate-scope.yaml b/helm/agent-platform-connectivity/templates/organizations/migrate-scope.yaml new file mode 100644 index 00000000..fb77b154 --- /dev/null +++ b/helm/agent-platform-connectivity/templates/organizations/migrate-scope.yaml @@ -0,0 +1,73 @@ +{{- /* +agent-platform-organization-migrate-scope: what agent-manager's migrate run +(the ServiceAccount of agent-platform.kagent.migration.name in the kagent +namespace) writes with the cluster-wide rights it holds during the 2.x -> 3.x +cut-over (kagent/migrate-rbac.yaml, agent-platform.kagent.migration.v3Writes): +RBAC cannot select namespaces by label, so this policy holds them to + + * organization namespaces (labelled agent-platform.giantswarm.io/organization) + and the kagent namespace, where its Role writes anyway; + * in an organization namespace, a HelmRelease update that changes + spec.values only (migrate rewrites muster.requireApproval to + default: Ask and spells out modelConfig.name; it never changes the chart, + the identity a release runs as or anything else of it); + * a ConfigMap of the report's name, agent-manager-migrate-report. + +A bug or a leaked token of the run then cannot rewrite the platform's own +HelmReleases or another namespace's ConfigMaps. Rendered with those rights +only. +*/ -}} +{{- if include "agent-platform.kagent.migration.v3Writes" . }} +{{- $label := include "agent-platform.organizations.label" . }} +{{- $kagentNs := .Values.kagent.namespaceOverride | default .Release.Namespace }} +{{- $user := printf "system:serviceaccount:%s:%s" $kagentNs (include "agent-platform.kagent.migration.name" .) }} +--- +apiVersion: admissionregistration.k8s.io/v1 +kind: ValidatingAdmissionPolicy +metadata: + name: agent-platform-organization-migrate-scope + labels: + {{- include "labels.common" . | nindent 4 }} +spec: + failurePolicy: Fail + matchConstraints: + resourceRules: + - apiGroups: ["helm.toolkit.fluxcd.io"] + apiVersions: ["*"] + operations: ["CREATE", "UPDATE", "DELETE"] + resources: ["helmreleases"] + - apiGroups: [""] + apiVersions: ["v1"] + operations: ["CREATE", "UPDATE", "DELETE"] + resources: ["configmaps"] + matchConditions: + - name: migrate + expression: {{ printf "request.userInfo.username == '%s'" $user | quote }} + variables: + - name: organizationNamespace + expression: {{ printf "has(namespaceObject.metadata.labels) && '%s' in namespaceObject.metadata.labels" $label | quote }} + validations: + - expression: {{ printf "request.namespace == '%s' || variables.organizationNamespace" $kagentNs | quote }} + reason: Forbidden + messageExpression: "'agent-manager migrate writes ' + request.resource.resource + ' only in organization namespaces and its own; refused in ' + request.namespace" + - expression: "request.resource.resource != 'configmaps' || request.name == 'agent-manager-migrate-report'" + reason: Forbidden + messageExpression: "'agent-manager migrate writes no ConfigMap but its report agent-manager-migrate-report; refused: ' + request.name" + - expression: >- + request.resource.resource != 'helmreleases' || !variables.organizationNamespace || + (request.operation == 'UPDATE' && + object.spec.all(k, k == 'values' || (k in oldObject.spec && oldObject.spec[k] == object.spec[k])) && + oldObject.spec.all(k, k == 'values' || k in object.spec)) + reason: Forbidden + messageExpression: "'agent-manager migrate changes only spec.values of a HelmRelease in an organization namespace; refused for ' + request.namespace + '/' + request.name" +--- +apiVersion: admissionregistration.k8s.io/v1 +kind: ValidatingAdmissionPolicyBinding +metadata: + name: agent-platform-organization-migrate-scope + labels: + {{- include "labels.common" . | nindent 4 }} +spec: + policyName: agent-platform-organization-migrate-scope + validationActions: [Deny] +{{- end }} diff --git a/helm/agent-platform/templates/_helpers.tpl b/helm/agent-platform/templates/_helpers.tpl index c87e828e..8a92beba 100644 --- a/helm/agent-platform/templates/_helpers.tpl +++ b/helm/agent-platform/templates/_helpers.tpl @@ -2222,19 +2222,33 @@ nothing here would enforce it, so it fails too. Emits nothing. {{/* The release majors a range admits, as a JSON list of strings, decided as -agent-manager's migrate decides its target major (TargetMajor): majors 0-99, -each probed with its first and a very late version, majors 0-9 also with every -minor 0-199 (first and late patch), so x-ranges, carets, tildes and bounds all -count. A range that admits only pre-releases admits no major. Release versions -only, as Flux's semver admits them without a pre-release comparator. +agent-manager's migrate decides its target major (TargetMajor) and the +agent-platform-operator the major of a chart source move: every version the +range names, with its next patch and next minor (so an exact pin, a narrow +bound, ~2.250 and each alternative of a `||` range count: `3.0.1 || 2.6.0` +admits 2 and 3); and majors 0-99, each probed with its first and a very late +version, majors 0-9 also with every minor 0-199 (first and late patch), so +x-ranges, carets, tildes and bounds all count. A probe counts only when the +range admits it. A range that admits only pre-releases admits no major. +Release versions only, as Flux's semver admits them without a pre-release +comparator. Usage: include "agent-platform.agentChart.majors" "" | fromJsonArray */}} {{- define "agent-platform.agentChart.majors" -}} {{- $range := toString . -}} +{{- $named := list -}} +{{- range $lit := regexFindAll "[0-9]+(\\.[0-9]+)?(\\.[0-9]+)?" $range -1 -}} +{{- $p := splitList "." $lit -}} +{{- $maj := atoi (index $p 0) -}} +{{- $min := 0 -}}{{- if gt (len $p) 1 -}}{{- $min = atoi (index $p 1) -}}{{- end -}} +{{- $pat := 0 -}}{{- if gt (len $p) 2 -}}{{- $pat = atoi (index $p 2) -}}{{- end -}} +{{- range $v := list (printf "%d.%d.%d" $maj $min $pat) (printf "%d.%d.%d" $maj $min (add1 $pat)) (printf "%d.%d.0" $maj (add1 $min)) -}} +{{- if semverCompare $range $v -}}{{- $named = append $named (toString $maj) -}}{{- end -}} +{{- end -}} +{{- end -}} {{- $out := list -}} -{{- $exact := regexFind "^\\s*=?v?[0-9]+\\.[0-9]+\\.[0-9]+\\s*$" $range | trim | trimPrefix "=" | trimPrefix "v" -}} {{- range $m := until 100 -}} -{{- $hit := or (and $exact (eq (toString (semver $exact).Major) (toString $m))) (semverCompare $range (printf "%d.0.0" $m)) (semverCompare $range (printf "%d.999999.999999" $m)) -}} +{{- $hit := or (has (toString $m) $named) (semverCompare $range (printf "%d.0.0" $m)) (semverCompare $range (printf "%d.999999.999999" $m)) -}} {{- if and (not $hit) (lt $m 10) -}} {{- range $n := until 200 -}} {{- if and (not $hit) (or (semverCompare $range (printf "%d.%d.0" $m $n)) (semverCompare $range (printf "%d.%d.999999" $m $n))) -}}{{- $hit = true -}}{{- end -}} diff --git a/tests/verify-agent-chart-line.py b/tests/verify-agent-chart-line.py index 7e14cec8..19368cb0 100755 --- a/tests/verify-agent-chart-line.py +++ b/tests/verify-agent-chart-line.py @@ -234,13 +234,55 @@ def migrate_cluster_rules(*args: str) -> str: for want in ('resources: ["helmreleases"]\n verbs: ["get", "list"]', 'resources: ["ocirepositories"]\n verbs: ["get", "list"]', 'resources: ["agents"]\n verbs: ["list"]', ns_rule): if want not in three_orgs: fail(f"3.x line with organizations: the migrate run's ClusterRole lacks {want!r}") - rules = three_orgs.split("cluster-wide list on their kagent.dev", 1)[-1].split('resources: ["namespaces"]', 1)[-1] + # D-GO-03: on the 3.x line itself (not a preflight) the run rewrites the + # organization releases agent-manager owns and writes its report there: + # update on HelmReleases, the report ConfigMap; nothing else, and the + # scope policy holds those writes to organization namespaces and the + # kagent namespace, spec.values only, the report's name only. + def org_rules(text: str) -> str: + return text.split("cluster-wide list on their kagent.dev", 1)[-1].split('resources: ["namespaces"]', 1)[-1] + writes = ('resources: ["helmreleases"]\n verbs: ["update"]', 'resources: ["configmaps"]\n verbs: ["create"]', + 'resources: ["configmaps"]\n resourceNames: ["agent-manager-migrate-report"]\n verbs: ["get", "update"]') + for want in writes: + if want not in three_orgs: + fail(f"3.x line with organizations: the migrate run's ClusterRole lacks {want!r}") + rules = org_rules(three_orgs) + for w in writes: + rules = rules.replace(w, "") for verb in ("create", "update", "patch", "delete", "watch"): if f'"{verb}"' in rules: - fail(f"the migrate run's organization reads carry {verb}") + fail(f"the migrate run's organization rights carry {verb} beyond the release update and its report") + for what, text in (("a 3.x preflight on the 2.x line", pre_orgs), ("3.x line without organizations", three)): + for verb in ("create", "update", "patch", "delete", "watch"): + if f'"{verb}"' in org_rules(text): + fail(f"{what}: the migrate run's cluster-wide rights carry {verb}; only the 3.x line with organizations writes") if '"get", "list"]\n' in rules.split('resources: ["agents"]', 1)[-1][:40]: fail("the run lists Agents in organization namespaces, it gets none") + def scope_policy(*args: str) -> str: + r = subprocess.run([*conn_base, *args], capture_output=True, text=True) + found = [d for d in r.stdout.split("\n---\n") if "\nkind: ValidatingAdmissionPolicy\n" in "\n" + d and "name: agent-platform-organization-migrate-scope\n" in d] + return found[0] if found else "" + policy = scope_policy(*v3, "--set", "agentPlatformOrganizations.enabled=true") + if not policy: + fail("3.x line with organizations: no agent-platform-organization-migrate-scope policy holds the run's writes") + else: + for want in ("system:serviceaccount:", "-agent-manager-migrate'", "request.name == 'agent-manager-migrate-report'", + "k == 'values'", "variables.organizationNamespace", 'resources: ["helmreleases"]', 'resources: ["configmaps"]'): + if want not in policy: + fail(f"the migrate scope policy lacks {want!r}:\n{policy}") + for what, args in (("2.x line", ("--set", "agentPlatformOrganizations.enabled=true")), ("preflight", (*pre, "--set", "agentPlatformOrganizations.enabled=true")), ("3.x without organizations", v3)): + if scope_policy(*args): + fail(f"{what}: the migrate scope policy renders without the writes it holds") + + # D-GO-08: every alternative of a || range and every version a range + # names counts, here as in migrate and the agent-platform-operator. + refused("an alternative on another major", "admits agent chart majors 2, 3", "--set", "agent-manager.agentChart.semver=3.0.1 || 2.6.0") + for r in (">=2.6.1 <2.6.9", "= 2.6.1", "~2.250", "2.6.1 - 2.6.5"): + renders(f"{r} reads as 2.x", "--set", f"agent-manager.agentChart.semver={r}") + if not scope_policy("--set", "agent-manager.agentChart.semver=3.0.1 || 3.2.0", "--set", "agentPlatformOrganizations.enabled=true"): + fail("the connectivity chart reads 3.0.1 || 3.2.0 as a 3.x line") + # A floor that needs the governance wiring, set while the governance floor is # unset (a release that sets its floors in two steps): the render fails naming # both, not an agent-manager that binds what muster refuses. diff --git a/tests/verify-organization-namespaces.py b/tests/verify-organization-namespaces.py index 346bd9fb..2da232a5 100755 --- a/tests/verify-organization-namespaces.py +++ b/tests/verify-organization-namespaces.py @@ -849,6 +849,60 @@ def prove_operator_scope(): case("the operator deletes an organization's Agent", kubectl(["delete", "agent", "probe", "-n", ORG_NS, "--dry-run=server", "--wait=false"], None, op)) +HELMRELEASE_CRD = { + "apiVersion": "apiextensions.k8s.io/v1", "kind": "CustomResourceDefinition", + "metadata": {"name": "helmreleases.helm.toolkit.fluxcd.io"}, + "spec": {"group": "helm.toolkit.fluxcd.io", "scope": "Namespaced", + "names": {"plural": "helmreleases", "singular": "helmrelease", "kind": "HelmRelease", "listKind": "HelmReleaseList"}, + "versions": [{"name": "v2", "served": True, "storage": True, + "schema": {"openAPIV3Schema": {"type": "object", "properties": { + "spec": {"type": "object", "x-kubernetes-preserve-unknown-fields": True}}}}}]}, +} + + +def prove_migrate_scope(chart): + """agent-platform-organization-migrate-scope (D-GO-03): on the 3.x line + the migrate run may update HelmReleases and write its report cluster-wide; + the policy holds it to organization namespaces and the kagent namespace, + to spec.values of an organization's HelmRelease, and to the report's + name.""" + r = connectivity(chart, "kubernetes", "--set", "components.agent-manager.enabled=true", + "--set", "global.identity.issuerUrl=https://dex.ci.example.com", "--set", "global.identity.clientId=platform", + "--set", "global.identity.existingSecret=platform-oauth", "--set", "agent-manager.agentChart.semver=>=3.0.0 <4.0.0") + if r.returncode != 0: + fail(f"connectivity render on the 3.x line:\n{r.stderr[-800:]}") + docs_ = [d for d in yaml.safe_load_all(r.stdout) if d and d.get("metadata", {}).get("name") == "agent-platform-organization-migrate-scope"] + if len(docs_) != 2: + fail(f"the 3.x line renders the migrate scope policy and its binding, got {len(docs_)} objects") + return + policy = next(d for d in docs_ if d["kind"] == "ValidatingAdmissionPolicy") + user = re.search(r"username == '([^']+)'", policy["spec"]["matchConditions"][0]["expression"]).group(1) + must(kubectl(["apply", "--server-side", "-f", "-"], yaml.safe_dump(HELMRELEASE_CRD)), "install the HelmRelease CRD") + must(kubectl(["wait", "--for=condition=Established", "crd/helmreleases.helm.toolkit.fluxcd.io", "--timeout=60s"]), "wait for the HelmRelease CRD") + for d in docs_: + must(kubectl(["apply", "--server-side", "-f", "-"], yaml.safe_dump(d)), f"apply {d['kind']} {d['metadata']['name']}") + API.settle(docs_) + + def hr(ns, values, interval="10m"): + return {"apiVersion": "helm.toolkit.fluxcd.io/v2", "kind": "HelmRelease", "metadata": {"name": "triage", "namespace": ns}, + "spec": {"interval": interval, "serviceAccountName": "kagent-flux", "chartRef": {"kind": "OCIRepository", "name": "agent"}, "values": values}} + old = {"muster": {"requireApproval": True}} + for ns in (ORG_NS, PLAIN_NS): + must(create(hr(ns, old), dry=False), f"create a HelmRelease in {ns}") + + def replace(obj): + return kubectl(["replace", "-f", "-", "--dry-run=server"], yaml.safe_dump(obj), user) + case("migrate rewrites an organization release's values", replace(hr(ORG_NS, {"default": "Ask"}))) + case("migrate changes more than an organization release's values", replace(hr(ORG_NS, {"default": "Ask"}, "20m")), "agent-platform-organization-migrate-scope") + case(f"migrate rewrites a release in {PLAIN_NS}", replace(hr(PLAIN_NS, {"default": "Ask"})), "agent-platform-organization-migrate-scope") + report = lambda ns, name="agent-manager-migrate-report": {"apiVersion": "v1", "kind": "ConfigMap", "metadata": {"name": name, "namespace": ns}} + case("migrate writes its report in an organization namespace", create(report(ORG_NS), as_=user)) + case("migrate writes its report in the kagent namespace", create(report("kagent"), as_=user)) + case("migrate writes its report in kube-system", create(report("kube-system"), as_=user), "agent-platform-organization-migrate-scope") + case("migrate writes another ConfigMap in an organization namespace", create(report(ORG_NS, "settings"), as_=user), "agent-platform-organization-migrate-scope") + case("a person's ConfigMap is not the migrate policy's business", create(report(ORG_NS, "settings"), as_=PERSON)) + + def prove_worker_access(): """CONNECT and the ephemeralcontainers subresource are admitted before the API server looks for the pod's node, so a Pending pod is enough.""" @@ -964,6 +1018,7 @@ def main(): prove_label(meta_chart, k8s) prove_netpol(k8s) prove_operator_scope() + prove_migrate_scope(chart) prove_worker_access() prove_render_check(chart) prove_model_manager(chart) From 775a52aaa9db6799d2474741d3a1df07e1c2ac55 Mon Sep 17 00:00:00 2001 From: Dominik Schmidle Date: Thu, 26 Nov 2026 14:05:11 +0100 Subject: [PATCH 40/56] docs(skills): organizations wait at chart 2.x until migrate marks them ready --- skills/agent-platform-agent-management/SKILL.md | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/skills/agent-platform-agent-management/SKILL.md b/skills/agent-platform-agent-management/SKILL.md index c5344adb..8dbf496d 100644 --- a/skills/agent-platform-agent-management/SKILL.md +++ b/skills/agent-platform-agent-management/SKILL.md @@ -153,10 +153,11 @@ never assume an argument. The agent tools drop an unknown key without an error: dropped exception until agent-manager tells muster again: say so. A governed platform's asks cannot be lifted per agent. To make an agent ask before every call, set `default: Ask` (`set_agent_approval`). Agent chart 3.0 removes `muster.requireApproval`: agent-manager's - migrate rewrites `true` to `default: Ask` in the releases it owns and reports the others - (GitOps, `valuesFrom`, organization namespaces) in its report: check it. A release that still - carries the key fails its 3.x render and stays on its 2.x revision; the fix is replacing it with - `default: Ask`, never deleting it. Never write the key. + migrate rewrites `true` to `default: Ask` in the releases it owns, organization namespaces + included, and reports the others (GitOps, `valuesFrom`) in its report: check it. An + organization stays on chart 2.x (`Ready=False`, `ChartSourceHeld`) until every release there is + on 3.x values and migrate ran again; the fix is replacing the key with `default: Ask`, never + deleting it. Never write the key. - **An organization's connectors**: a kagent `RemoteMCPServer` in the organization namespace (`x_agent-manager_set_organization_connector`), not a Muster server, so no `toolset` selector reaches it. From agent-manager 3.3.0 (`connectors` in `x_agent-manager_create_agent`'s schema; From be00ba2f158445cd8e1bdf25d14dca132be93836 Mon Sep 17 00:00:00 2001 From: Dominik Schmidle Date: Thu, 26 Nov 2026 14:39:35 +0100 Subject: [PATCH 41/56] fix(helm): grant migrate's organization writes only during the cut-over and hold their metadata The migrate identity's update on HelmReleases and its report ConfigMap in organization namespaces now render only while agentManager.migration.cutover is set on a 3.x line, which UPGRADE.md says to unset once no organization is held. agent-platform-organization-migrate-scope also refuses a change of an organization release's labels, annotations, ownerReferences or finalizers. verify-agent-chart-line pins the connectivity chart's own 3.x probe (an exact pin, a || alternative), and UPGRADE.md states the window up to the operator's rollout, the releases created after a run and the re-run. --- UPGRADE.md | 8 ++--- helm/agent-platform-connectivity/README.md | 1 + .../templates/kagent/_migrate.tpl | 11 ++++--- .../templates/kagent/migrate-rbac.yaml | 6 ++-- .../organizations/migrate-scope.yaml | 20 ++++++++--- helm/agent-platform-connectivity/values.yaml | 9 +++++ helm/agent-platform/values.yaml | 3 ++ tests/verify-agent-chart-line.py | 33 +++++++++++++------ tests/verify-organization-namespaces.py | 28 ++++++++++++---- 9 files changed, 88 insertions(+), 31 deletions(-) diff --git a/UPGRADE.md b/UPGRADE.md index d56c6cea..3a13364a 100644 --- a/UPGRADE.md +++ b/UPGRADE.md @@ -21,17 +21,17 @@ agent chart 3.0 removes `muster.requireApproval` (kagent's flag that paused an a The render allows the 3.x line only together with what makes it safe (`make verify-agent-chart-line`): agent-manager at `agent-platform.agentManager.agentChartV3Floor`, whose migrate has the 2.x → 3.x hop, muster at `agent-platform.muster.agentApprovalFloor`, which enforces `default: Ask`, agent-manager's tool approval on (`agent-manager.muster.toolApproval.enabled` unset) and the default agent's range on the same major. **Both floors are unset in this chart** until the muster and agent-manager releases carrying tool approval exist, so every 3.x range is refused for now, whatever its form (`3.x`, `~3.2`, `>=3.1.0 <3.6.0`); the platform release that pins those versions sets them. They are chart code, not values, on purpose: a floor states which released version carries a feature, and a value would let one installation's configuration claim it for a release that lacks it (a lab tests a branch build on a copy of the chart, as the verify scripts do). The same goes for the other floors of tool approval (`agent-platform.agentManager.toolApprovalFloor`, `agent-platform.muster.governanceFloor`, `agent-platform.muster.sessionBindingsPortFloor`): unset, what they gate stays off and `governance: governed` fails. The range is read as agent-manager's migrate and the agent-platform-operator read it: every version it names and every alternative of a `||` range count, so a range admitting two majors (`>=3.0.0`, `3.0.1 || 2.6.0`) or only pre-releases fails. -The migrate run writes each release's 3.x values (`muster.requireApproval: true` → `default: Ask` where the muster binding renders, the key dropped, an unset `modelConfig.name` spelled out as the 2.x default `default-model-config`) only once a 3.x chart is published and only where it moves the namespace's source in the same run. It writes no release with `spec.valuesFrom` (reported `failed` with what to change), none whose source it cannot move (pinned, owned by git, the platform's: `pending` with the diff); any of them keeps the report in the expand phase. In organization namespaces it applies the same rules but for the source, which stays the operator's: it rewrites the releases agent-manager owns, gives a GitOps-owned one its diff (holding its siblings), writes its report in each organization namespace and annotates it `agent-platform.giantswarm.io/agent-chart-ready-major: "3"` once every release there is on 3.x values. The operator moves an organization's source to 3.x only on that annotation (or when no HelmRelease there uses the source); until then the organization is `Ready=False` with reason `ChartSourceHeld`, and its releases stay on 2.x, still asking. Between the run's write and the operator's move (within `agentChart.migrationPoll`, 1m) a rewritten release's 2.x upgrade fails and it keeps its deployed revision, which still asks. +The migrate run writes each release's 3.x values (`muster.requireApproval: true` → `default: Ask` where the muster binding renders, the key dropped, an unset `modelConfig.name` spelled out as the 2.x default `default-model-config`) only once a 3.x chart is published and only where it moves the namespace's source in the same run. It writes no release with `spec.valuesFrom` (reported `failed` with what to change), none whose source it cannot move (pinned, owned by git, the platform's: `pending` with the diff); any of them keeps the report in the expand phase. In organization namespaces it applies the same rules but for the source, which stays the operator's: it rewrites the releases agent-manager owns, gives a GitOps-owned one its diff (holding its siblings), writes its report in each organization namespace and annotates it `agent-platform.giantswarm.io/agent-chart-ready-major: "3"` once every release there is on 3.x values. The operator moves an organization's source to 3.x only on that annotation (or when no HelmRelease there uses the source); until then the organization is `Ready=False` with reason `ChartSourceHeld`, and its releases stay on 2.x, still asking. The mark also names the releases it covers (`agent-platform.giantswarm.io/agent-chart-ready-releases`); a release created on the 2.x source after the run read the namespace is not covered, and the operator holds the source, naming it, until migrate runs again. A missing source is recreated on the same terms when a release there last deployed 2.x, and a range of several majors or of none moves and creates no source (`ChartRangeInvalid`). The window in which a rewritten organization release's 2.x upgrade fails (it keeps its deployed revision, which still asks): from the run's write until the operator runs with the 3.x range (its release follows the connectivity release whose hook runs migrate, so the operator's rollout bounds it first), then until its next look (`agentChart.migrationPoll`, 1m). A run that failed a write after others succeeded leaves the namespace unmarked with rewritten releases under the 2.x source until migrate runs again. ### Operator action -- Once the floors are set: move `agent-manager.agentChart.semver` and `components.default-agent.versionRange` to `>=3.0.0 <4.0.0` together with `components.agent-manager.versionRange` and `components.muster.versionRange` at or above the floors. The render refuses the line without the two component floors, without tool approval, or with the default agent on the other major; moving the component ranges alone renders. +- Once the floors are set: move `agent-manager.agentChart.semver` and `components.default-agent.versionRange` to `>=3.0.0 <4.0.0` together with `components.agent-manager.versionRange` and `components.muster.versionRange` at or above the floors, and with organizations on set `agentManager.migration.cutover: true` in the same change (without it the run may read the organizations but not rewrite them, so their sources stay held). The render refuses the line without the two component floors, without tool approval, or with the default agent on the other major; moving the component ranges alone renders. - Tool approval's prerequisites must hold (muster's OAuth server with Dex sign-in, Valkey storage; the entry below): without them muster refuses every call that asks, so an agent migrated to `default: Ask` cannot call its tools until they hold. It never runs them unasked. - **Mandatory before the upgrade:** with the line still on 2.x, set `agentManager.migration.preflightSemver: ">=3.0.0 <4.0.0"` (it renders the never-started CronJob `-agent-manager-migrate-preflight` and grants the migration's identity the read-only access the 3.x path needs: list namespaces; with organizations, read their HelmReleases, OCIRepositories and Agents), then run `kubectl -n create job --from=cronjob/-agent-manager-migrate-preflight preflight-1` and read the report in `kubectl -n logs job/preflight-1` (a dry run writes no ConfigMap). Fix every release it lists that the run will not write (`failed`, and `diff` ones you own in git), including those in organization namespaces, before moving the line; unset `preflightSemver` afterwards to drop the extra reads. Also check releases whose values come from `valuesFrom`: `kubectl get helmreleases -A -o json | jq -r '.items[] | select(.spec.values.muster.requireApproval != null or .spec.values.modelConfig.name == null or (.spec.valuesFrom // [] | length > 0)) | "\(.metadata.namespace)/\(.metadata.name)"'` and the ConfigMaps or Secrets they name. - The repair is always **replace `muster.requireApproval: true` with `default: Ask`**, never just delete the key (that turns the agent's asks off); drop `requireApproval: false` and `null`; set `modelConfig.name` where it is unset. In git, apply it together with the move of that release's chart source to 3.x; for `valuesFrom`, move the settings into `spec.values` (agent-manager binds settings only from there). - Running Sessions: with tool approval on (agent-manager at `agent-platform.agentManager.toolApprovalFloor`), agent-manager binds a Session of an agent on `muster.requireApproval: true` with `default: Ask` already on 2.x, so such an agent needs muster's approval prerequisites from then on, not only on 3.x; (such an agent is asked twice there, by kagent and by muster, until it is migrated), so Sessions running across the upgrade keep asking. A Session started by an agent-manager below `agent-platform.agentManager.toolApprovalFloor` carries no settings and muster applies the agent's re-rendered `X-Muster-Tool-Approval: default=Ask`. -- Read the report after the run: `kubectl -n get configmap agent-manager-migrate-report -o jsonpath='{.data.report\.yaml}'`; each rewritten release lists `changes.removed` and `changes.set`. A release carrying `requireApproval: true` beside tool approval settings is reported failed (no released chart renders that combination) and holds its chart source; set its settings by hand. The run needs list on namespaces, read access in organization namespaces and, there, update on HelmReleases and its report ConfigMap (the chart grants the reads only on a 3.x line or preflight range and the writes only on the 3.x line, held by the ValidatingAdmissionPolicy `agent-platform-organization-migrate-scope` to organization namespaces and the kagent namespace, to `spec.values` and to the report's name); without them it fails before it writes anything (`--organization-namespaces none` skips them, leaving them unchecked and their sources held). -- **Per organization:** `kubectl get agentplatformorganizations -A -o json | jq -r '.items[] | select(any(.status.conditions[]?; .reason == "ChartSourceHeld")) | "\(.metadata.namespace)/\(.metadata.name)"'` lists the organizations still on 2.x; the report in each one's namespace (`kubectl -n get configmap agent-manager-migrate-report -o jsonpath='{.data.report\.yaml}'`) names the releases that hold it. Apply each diff in the organization's repository (`default: Ask` in place of `requireApproval: true`), then run migrate again: `kubectl -n create job --from=cronjob/-agent-manager-migrate migrate-2`. +- Read the report after the run: `kubectl -n get configmap agent-manager-migrate-report -o jsonpath='{.data.report\.yaml}'`; each rewritten release lists `changes.removed` and `changes.set`. A release carrying `requireApproval: true` beside tool approval settings is reported failed (no released chart renders that combination) and holds its chart source; set its settings by hand. The run needs list on namespaces, read access in organization namespaces and, there, update on HelmReleases and its report ConfigMap (the chart grants the reads only on a 3.x line or preflight range and the writes only on the 3.x line with `agentManager.migration.cutover`, held by the ValidatingAdmissionPolicy `agent-platform-organization-migrate-scope` to organization namespaces and the kagent namespace, to `spec.values` and to the report's name); without them it fails before it writes anything (`--organization-namespaces none` skips them, leaving them unchecked and their sources held). +- **Per organization:** `kubectl get agentplatformorganizations -A -o json | jq -r '.items[] | select(any(.status.conditions[]?; .reason == "ChartSourceHeld")) | "\(.metadata.namespace)/\(.metadata.name)"'` lists the organizations still on 2.x; the report in each one's namespace (`kubectl -n get configmap agent-manager-migrate-report -o jsonpath='{.data.report\.yaml}'`) names the releases that hold it. Apply each diff in the organization's repository (`default: Ask` in place of `requireApproval: true`), then run migrate again: `kubectl -n create job --from=cronjob/-agent-manager-migrate migrate-2` (also after a run that failed a write, and when the condition names releases created after the run). Once none is held, unset `agentManager.migration.cutover`: the migration's identity then keeps its reads on the 3.x line and loses its writes in organization namespaces. ## \ → \ (tool approval and the governance mode) diff --git a/helm/agent-platform-connectivity/README.md b/helm/agent-platform-connectivity/README.md index a43e5cc8..d0f9d6f9 100644 --- a/helm/agent-platform-connectivity/README.md +++ b/helm/agent-platform-connectivity/README.md @@ -1813,6 +1813,7 @@ The kagent block is open in the schema, so the template refuses a key under `kag | agentManager.migration.image.tag | string | `"3.5.6"` | | | agentManager.migration.dryRun | bool | `false` | dry-run: the report and the diffs, nothing written — a rehearsal of one installation's cut-over before the real run. | | agentManager.migration.preflightSemver | string | `""` | | +| agentManager.migration.cutover | bool | `false` | | | agentManager.migration.gitopsNamespaces | list | `[]` | | | cluster-manager.fullnameOverride | string | `"cluster-manager"` | | | cluster-manager.installation.name | string | `""` | | diff --git a/helm/agent-platform-connectivity/templates/kagent/_migrate.tpl b/helm/agent-platform-connectivity/templates/kagent/_migrate.tpl index 218c9a75..114a7713 100644 --- a/helm/agent-platform-connectivity/templates/kagent/_migrate.tpl +++ b/helm/agent-platform-connectivity/templates/kagent/_migrate.tpl @@ -168,12 +168,13 @@ is, for the dry run before the line moves. {{- end -}} {{/* -Truthy when the run itself (not the preflight dry run) takes the 2.x -> 3.x -path with organizations on: agent-manager.agentChart.semver is a 3.x line. -Only then the run writes organization releases and its report there -(migrate-rbac.yaml, organizations/migrate-scope.yaml). +Truthy while the organizations' cut-over runs: agentManager.migration.cutover +set, agent-manager.agentChart.semver a 3.x line (not the preflight dry run) +and organizations on. Only then the run writes organization releases and its +report there (migrate-rbac.yaml, organizations/migrate-scope.yaml); unset +afterwards, the identity keeps its reads on the 3.x line and no write there. */}} {{- define "agent-platform.kagent.migration.v3Writes" -}} {{- $am := include "agent-platform.agentManager.chartValues" . | fromJson -}} -{{- if and (include "agent-platform.organizations.enabled" .) (include "agent-platform.kagent.migration" .) (include "agent-platform.kagent.migration.isV3" (dig "agentChart" "semver" "2.x" $am)) -}}true{{- end -}} +{{- if and (dig "migration" "cutover" false (.Values.agentManager | default dict)) (include "agent-platform.organizations.enabled" .) (include "agent-platform.kagent.migration" .) (include "agent-platform.kagent.migration.isV3" (dig "agentChart" "semver" "2.x" $am)) -}}true{{- end -}} {{- end -}} diff --git a/helm/agent-platform-connectivity/templates/kagent/migrate-rbac.yaml b/helm/agent-platform-connectivity/templates/kagent/migrate-rbac.yaml index 043ce2e3..c70ced67 100644 --- a/helm/agent-platform-connectivity/templates/kagent/migrate-rbac.yaml +++ b/helm/agent-platform-connectivity/templates/kagent/migrate-rbac.yaml @@ -25,8 +25,10 @@ list namespaces (it finds the organization namespaces by label and fails when it may not) and, with agentPlatformOrganizations.enabled, list and get the HelmReleases and OCIRepositories and list the Agents it reads there (agent-platform.kagent.migration.v3Line; a 3.x preflight range on the 2.x -line too, for its dry run). Only while the line itself is 3.x -(agent-platform.kagent.migration.v3Writes) the run also updates the +line too, for its dry run). Only while the line itself is 3.x and +agentManager.migration.cutover is set (agent-platform.kagent.migration.v3Writes; +UPGRADE.md says to unset it once every organization moved) the run also +updates the organization releases agent-manager owns (their values to 3.x) and writes its report ConfigMap agent-manager-migrate-report there, which the agent-platform-operator reads before it moves the organization's chart source diff --git a/helm/agent-platform-connectivity/templates/organizations/migrate-scope.yaml b/helm/agent-platform-connectivity/templates/organizations/migrate-scope.yaml index fb77b154..ebcdc042 100644 --- a/helm/agent-platform-connectivity/templates/organizations/migrate-scope.yaml +++ b/helm/agent-platform-connectivity/templates/organizations/migrate-scope.yaml @@ -10,12 +10,16 @@ RBAC cannot select namespaces by label, so this policy holds them to * in an organization namespace, a HelmRelease update that changes spec.values only (migrate rewrites muster.requireApproval to default: Ask and spells out modelConfig.name; it never changes the chart, - the identity a release runs as or anything else of it); + the identity a release runs as or anything else of it), its labels, + annotations, ownerReferences and finalizers as they were (no owner the + garbage collector would delete it for, no GitOps label that changes who + owns it, no Flux reconcile request); * a ConfigMap of the report's name, agent-manager-migrate-report. A bug or a leaked token of the run then cannot rewrite the platform's own HelmReleases or another namespace's ConfigMaps. Rendered with those rights -only. +only: while agentManager.migration.cutover is set +(agent-platform.kagent.migration.v3Writes). */ -}} {{- if include "agent-platform.kagent.migration.v3Writes" . }} {{- $label := include "agent-platform.organizations.label" . }} @@ -44,6 +48,13 @@ spec: - name: migrate expression: {{ printf "request.userInfo.username == '%s'" $user | quote }} variables: + - name: sameMetadata + expression: >- + request.operation != 'UPDATE' || + (object.metadata.?labels.orValue({}) == oldObject.metadata.?labels.orValue({}) && + object.metadata.?annotations.orValue({}) == oldObject.metadata.?annotations.orValue({}) && + object.metadata.?ownerReferences.orValue([]) == oldObject.metadata.?ownerReferences.orValue([]) && + object.metadata.?finalizers.orValue([]) == oldObject.metadata.?finalizers.orValue([])) - name: organizationNamespace expression: {{ printf "has(namespaceObject.metadata.labels) && '%s' in namespaceObject.metadata.labels" $label | quote }} validations: @@ -57,9 +68,10 @@ spec: request.resource.resource != 'helmreleases' || !variables.organizationNamespace || (request.operation == 'UPDATE' && object.spec.all(k, k == 'values' || (k in oldObject.spec && oldObject.spec[k] == object.spec[k])) && - oldObject.spec.all(k, k == 'values' || k in object.spec)) + oldObject.spec.all(k, k == 'values' || k in object.spec) && + variables.sameMetadata) reason: Forbidden - messageExpression: "'agent-manager migrate changes only spec.values of a HelmRelease in an organization namespace; refused for ' + request.namespace + '/' + request.name" + messageExpression: "'agent-manager migrate changes only spec.values of a HelmRelease in an organization namespace, never its spec otherwise, labels, annotations, ownerReferences or finalizers; refused for ' + request.namespace + '/' + request.name" --- apiVersion: admissionregistration.k8s.io/v1 kind: ValidatingAdmissionPolicyBinding diff --git a/helm/agent-platform-connectivity/values.yaml b/helm/agent-platform-connectivity/values.yaml index e6b9c699..43d9834d 100644 --- a/helm/agent-platform-connectivity/values.yaml +++ b/helm/agent-platform-connectivity/values.yaml @@ -2979,6 +2979,15 @@ agentManager: # @schema skipProperties: true; additionalProperties: true # namespaces; with organizations, read their releases, sources and Agents); # empty (the default) renders neither. preflightSemver: "" + # true while the 2.x -> 3.x cut-over of the organizations runs: only then, + # and only with agent-manager.agentChart.semver on a 3.x line and + # agentPlatformOrganizations.enabled, the migration's identity may update + # the organizations' HelmReleases (spec.values only) and write its report + # there, held by the ValidatingAdmissionPolicy + # agent-platform-organization-migrate-scope. Set it in the change that + # moves the line; unset it once no organization is Ready=False with reason + # ChartSourceHeld (UPGRADE.md). + cutover: false # Namespaces the GitOps-owned agents' HelmReleases and OCIRepositories live # in (a HelmRelease with targetNamespace: kagent applied from elsewhere — # the fleet's flux-giantswarm): the Job reads them there (get, list; a Role diff --git a/helm/agent-platform/values.yaml b/helm/agent-platform/values.yaml index 8acf331e..7af818f6 100644 --- a/helm/agent-platform/values.yaml +++ b/helm/agent-platform/values.yaml @@ -5569,6 +5569,9 @@ agentManager: # @schema skipProperties: true; additionalProperties: true # preflightSemver (unset): forwarded when set, the connectivity chart's # values.yaml documents it (UPGRADE.md, the dry run before the agent chart # line moves to 3.x). + # cutover (unset): forwarded when set; true only while the organizations' + # 2.x -> 3.x cut-over runs (the connectivity chart's values.yaml, + # UPGRADE.md). gitopsNamespaces: [] # === Skill repositories === diff --git a/tests/verify-agent-chart-line.py b/tests/verify-agent-chart-line.py index 19368cb0..6dde2fa6 100755 --- a/tests/verify-agent-chart-line.py +++ b/tests/verify-agent-chart-line.py @@ -211,6 +211,8 @@ def migrate_cluster_rules(*args: str) -> str: two_orgs = migrate_cluster_rules("--set", "agentPlatformOrganizations.enabled=true") three = migrate_cluster_rules(*v3) three_orgs = migrate_cluster_rules(*v3, "--set", "agentPlatformOrganizations.enabled=true") + cutover = ("--set", "agentManager.migration.cutover=true") + three_cut = migrate_cluster_rules(*v3, *cutover, "--set", "agentPlatformOrganizations.enabled=true") for what, text in (("2.x line", two), ("2.x line with organizations", two_orgs)): if ns_rule in text or "helm.toolkit.fluxcd.io" in text: fail(f"{what}: the migrate run reads no organization namespace, so its identity gets no namespace list and no cluster-wide release read") @@ -234,7 +236,8 @@ def migrate_cluster_rules(*args: str) -> str: for want in ('resources: ["helmreleases"]\n verbs: ["get", "list"]', 'resources: ["ocirepositories"]\n verbs: ["get", "list"]', 'resources: ["agents"]\n verbs: ["list"]', ns_rule): if want not in three_orgs: fail(f"3.x line with organizations: the migrate run's ClusterRole lacks {want!r}") - # D-GO-03: on the 3.x line itself (not a preflight) the run rewrites the + # D-GO-03, D-GO-27: on the 3.x line itself (not a preflight) and only + # while agentManager.migration.cutover is set, the run rewrites the # organization releases agent-manager owns and writes its report there: # update on HelmReleases, the report ConfigMap; nothing else, and the # scope policy holds those writes to organization namespaces and the @@ -244,15 +247,17 @@ def org_rules(text: str) -> str: writes = ('resources: ["helmreleases"]\n verbs: ["update"]', 'resources: ["configmaps"]\n verbs: ["create"]', 'resources: ["configmaps"]\n resourceNames: ["agent-manager-migrate-report"]\n verbs: ["get", "update"]') for want in writes: - if want not in three_orgs: - fail(f"3.x line with organizations: the migrate run's ClusterRole lacks {want!r}") - rules = org_rules(three_orgs) + if want not in three_cut: + fail(f"3.x line with organizations during the cut-over: the migrate run's ClusterRole lacks {want!r}") + rules = org_rules(three_cut) for w in writes: rules = rules.replace(w, "") for verb in ("create", "update", "patch", "delete", "watch"): if f'"{verb}"' in rules: fail(f"the migrate run's organization rights carry {verb} beyond the release update and its report") - for what, text in (("a 3.x preflight on the 2.x line", pre_orgs), ("3.x line without organizations", three)): + pre_cut = migrate_cluster_rules(*pre, *cutover, "--set", "agentPlatformOrganizations.enabled=true") + for what, text in (("a 3.x preflight on the 2.x line", pre_orgs), ("a 3.x preflight with cutover set", pre_cut), + ("3.x line without organizations", three), ("3.x line with organizations, cutover unset", three_orgs)): for verb in ("create", "update", "patch", "delete", "watch"): if f'"{verb}"' in org_rules(text): fail(f"{what}: the migrate run's cluster-wide rights carry {verb}; only the 3.x line with organizations writes") @@ -263,15 +268,17 @@ def scope_policy(*args: str) -> str: r = subprocess.run([*conn_base, *args], capture_output=True, text=True) found = [d for d in r.stdout.split("\n---\n") if "\nkind: ValidatingAdmissionPolicy\n" in "\n" + d and "name: agent-platform-organization-migrate-scope\n" in d] return found[0] if found else "" - policy = scope_policy(*v3, "--set", "agentPlatformOrganizations.enabled=true") + policy = scope_policy(*v3, *cutover, "--set", "agentPlatformOrganizations.enabled=true") if not policy: fail("3.x line with organizations: no agent-platform-organization-migrate-scope policy holds the run's writes") else: for want in ("system:serviceaccount:", "-agent-manager-migrate'", "request.name == 'agent-manager-migrate-report'", - "k == 'values'", "variables.organizationNamespace", 'resources: ["helmreleases"]', 'resources: ["configmaps"]'): + "k == 'values'", "variables.organizationNamespace", 'resources: ["helmreleases"]', 'resources: ["configmaps"]', + "variables.sameMetadata", "ownerReferences", "finalizers"): if want not in policy: fail(f"the migrate scope policy lacks {want!r}:\n{policy}") - for what, args in (("2.x line", ("--set", "agentPlatformOrganizations.enabled=true")), ("preflight", (*pre, "--set", "agentPlatformOrganizations.enabled=true")), ("3.x without organizations", v3)): + for what, args in (("2.x line", (*cutover, "--set", "agentPlatformOrganizations.enabled=true")), ("preflight", (*pre, *cutover, "--set", "agentPlatformOrganizations.enabled=true")), + ("3.x without organizations", (*v3, *cutover)), ("3.x, cutover unset", (*v3, "--set", "agentPlatformOrganizations.enabled=true"))): if scope_policy(*args): fail(f"{what}: the migrate scope policy renders without the writes it holds") @@ -280,8 +287,14 @@ def scope_policy(*args: str) -> str: refused("an alternative on another major", "admits agent chart majors 2, 3", "--set", "agent-manager.agentChart.semver=3.0.1 || 2.6.0") for r in (">=2.6.1 <2.6.9", "= 2.6.1", "~2.250", "2.6.1 - 2.6.5"): renders(f"{r} reads as 2.x", "--set", f"agent-manager.agentChart.semver={r}") - if not scope_policy("--set", "agent-manager.agentChart.semver=3.0.1 || 3.2.0", "--set", "agentPlatformOrganizations.enabled=true"): - fail("the connectivity chart reads 3.0.1 || 3.2.0 as a 3.x line") + # The connectivity chart's own probe (isV3): an exact pin and an + # alternative only the named-version probes see (D-GO-08, D-GO-31). + for r in ("3.0.1", "=3.0.1", "2.6.0 || 3.0.1", "3.0.1 || 3.2.0"): + if ns_rule not in migrate_cluster_rules("--set", f"agent-manager.agentChart.semver={r}"): + fail(f"the connectivity chart does not read {r} as a 3.x line") + for r in ("2.6.1", ">=2.6.1 <2.6.9", "~2.250"): + if ns_rule in migrate_cluster_rules("--set", f"agent-manager.agentChart.semver={r}"): + fail(f"the connectivity chart reads {r} as a 3.x line") # A floor that needs the governance wiring, set while the governance floor is # unset (a release that sets its floors in two steps): the render fails naming diff --git a/tests/verify-organization-namespaces.py b/tests/verify-organization-namespaces.py index 2da232a5..184b4d78 100755 --- a/tests/verify-organization-namespaces.py +++ b/tests/verify-organization-namespaces.py @@ -861,14 +861,16 @@ def prove_operator_scope(): def prove_migrate_scope(chart): - """agent-platform-organization-migrate-scope (D-GO-03): on the 3.x line - the migrate run may update HelmReleases and write its report cluster-wide; - the policy holds it to organization namespaces and the kagent namespace, - to spec.values of an organization's HelmRelease, and to the report's - name.""" + """agent-platform-organization-migrate-scope (D-GO-03, D-GO-27): during + the cut-over on the 3.x line the migrate run may update HelmReleases and + write its report cluster-wide; the policy holds it to organization + namespaces and the kagent namespace, to spec.values of an organization's + HelmRelease (its labels, annotations, ownerReferences and finalizers as + they were), and to the report's name.""" r = connectivity(chart, "kubernetes", "--set", "components.agent-manager.enabled=true", "--set", "global.identity.issuerUrl=https://dex.ci.example.com", "--set", "global.identity.clientId=platform", - "--set", "global.identity.existingSecret=platform-oauth", "--set", "agent-manager.agentChart.semver=>=3.0.0 <4.0.0") + "--set", "global.identity.existingSecret=platform-oauth", "--set", "agent-manager.agentChart.semver=>=3.0.0 <4.0.0", + "--set", "agentManager.migration.cutover=true") if r.returncode != 0: fail(f"connectivity render on the 3.x line:\n{r.stderr[-800:]}") docs_ = [d for d in yaml.safe_load_all(r.stdout) if d and d.get("metadata", {}).get("name") == "agent-platform-organization-migrate-scope"] @@ -892,11 +894,25 @@ def hr(ns, values, interval="10m"): def replace(obj): return kubectl(["replace", "-f", "-", "--dry-run=server"], yaml.safe_dump(obj), user) + + def with_meta(**meta): + obj = hr(ORG_NS, {"default": "Ask"}) + obj["metadata"].update(meta) + return obj + owner = [{"apiVersion": "v1", "kind": "ConfigMap", "name": "gone", "uid": "00000000-0000-0000-0000-000000000000"}] + for what, meta in (("a label", {"labels": {"kustomize.toolkit.fluxcd.io/name": "flux"}}), + ("an annotation", {"annotations": {"reconcile.fluxcd.io/forceAt": "now"}}), + ("an owner", {"ownerReferences": owner}), + ("a finalizer", {"finalizers": ["example.com/hold"]})): + case(f"migrate adds {what} to an organization release", replace(with_meta(**meta)), "agent-platform-organization-migrate-scope") case("migrate rewrites an organization release's values", replace(hr(ORG_NS, {"default": "Ask"}))) case("migrate changes more than an organization release's values", replace(hr(ORG_NS, {"default": "Ask"}, "20m")), "agent-platform-organization-migrate-scope") case(f"migrate rewrites a release in {PLAIN_NS}", replace(hr(PLAIN_NS, {"default": "Ask"})), "agent-platform-organization-migrate-scope") report = lambda ns, name="agent-manager-migrate-report": {"apiVersion": "v1", "kind": "ConfigMap", "metadata": {"name": name, "namespace": ns}} case("migrate writes its report in an organization namespace", create(report(ORG_NS), as_=user)) + marked = report(ORG_NS) | {"metadata": {"name": "agent-manager-migrate-report", "namespace": ORG_NS, + "annotations": {"agent-platform.giantswarm.io/agent-chart-ready-major": "3"}}} + case("migrate marks its report in an organization namespace", create(marked, as_=user)) case("migrate writes its report in the kagent namespace", create(report("kagent"), as_=user)) case("migrate writes its report in kube-system", create(report("kube-system"), as_=user), "agent-platform-organization-migrate-scope") case("migrate writes another ConfigMap in an organization namespace", create(report(ORG_NS, "settings"), as_=user), "agent-platform-organization-migrate-scope") From 4098230f87f76a2f674b99d31c0cbef7261bccd6 Mon Sep 17 00:00:00 2001 From: Dominik Schmidle Date: Thu, 26 Nov 2026 15:32:56 +0100 Subject: [PATCH 42/56] fix(connectivity): accept only a boolean true as migration cutover agentManager.migration.cutover was read by truthiness, so the string "false" granted the migration its organization writes. A string now fails the render; verify-agent-chart-line asserts it. --- UPGRADE.md | 2 +- .../templates/kagent/_migrate.tpl | 9 +++++++-- tests/verify-agent-chart-line.py | 13 +++++++++++++ 3 files changed, 21 insertions(+), 3 deletions(-) diff --git a/UPGRADE.md b/UPGRADE.md index 3a13364a..398bc486 100644 --- a/UPGRADE.md +++ b/UPGRADE.md @@ -25,7 +25,7 @@ The migrate run writes each release's 3.x values (`muster.requireApproval: true` ### Operator action -- Once the floors are set: move `agent-manager.agentChart.semver` and `components.default-agent.versionRange` to `>=3.0.0 <4.0.0` together with `components.agent-manager.versionRange` and `components.muster.versionRange` at or above the floors, and with organizations on set `agentManager.migration.cutover: true` in the same change (without it the run may read the organizations but not rewrite them, so their sources stay held). The render refuses the line without the two component floors, without tool approval, or with the default agent on the other major; moving the component ranges alone renders. +- Once the floors are set: move `agent-manager.agentChart.semver` and `components.default-agent.versionRange` to `>=3.0.0 <4.0.0` together with `components.agent-manager.versionRange` and `components.muster.versionRange` at or above the floors, and with organizations on set `agentManager.migration.cutover: true` in the same change (a boolean: a string, also `"false"`, fails the render; without it the run may read the organizations but not rewrite them, so their sources stay held). The render refuses the line without the two component floors, without tool approval, or with the default agent on the other major; moving the component ranges alone renders. - Tool approval's prerequisites must hold (muster's OAuth server with Dex sign-in, Valkey storage; the entry below): without them muster refuses every call that asks, so an agent migrated to `default: Ask` cannot call its tools until they hold. It never runs them unasked. - **Mandatory before the upgrade:** with the line still on 2.x, set `agentManager.migration.preflightSemver: ">=3.0.0 <4.0.0"` (it renders the never-started CronJob `-agent-manager-migrate-preflight` and grants the migration's identity the read-only access the 3.x path needs: list namespaces; with organizations, read their HelmReleases, OCIRepositories and Agents), then run `kubectl -n create job --from=cronjob/-agent-manager-migrate-preflight preflight-1` and read the report in `kubectl -n logs job/preflight-1` (a dry run writes no ConfigMap). Fix every release it lists that the run will not write (`failed`, and `diff` ones you own in git), including those in organization namespaces, before moving the line; unset `preflightSemver` afterwards to drop the extra reads. Also check releases whose values come from `valuesFrom`: `kubectl get helmreleases -A -o json | jq -r '.items[] | select(.spec.values.muster.requireApproval != null or .spec.values.modelConfig.name == null or (.spec.valuesFrom // [] | length > 0)) | "\(.metadata.namespace)/\(.metadata.name)"'` and the ConfigMaps or Secrets they name. - The repair is always **replace `muster.requireApproval: true` with `default: Ask`**, never just delete the key (that turns the agent's asks off); drop `requireApproval: false` and `null`; set `modelConfig.name` where it is unset. In git, apply it together with the move of that release's chart source to 3.x; for `valuesFrom`, move the settings into `spec.values` (agent-manager binds settings only from there). diff --git a/helm/agent-platform-connectivity/templates/kagent/_migrate.tpl b/helm/agent-platform-connectivity/templates/kagent/_migrate.tpl index 114a7713..2793a5e6 100644 --- a/helm/agent-platform-connectivity/templates/kagent/_migrate.tpl +++ b/helm/agent-platform-connectivity/templates/kagent/_migrate.tpl @@ -169,12 +169,17 @@ is, for the dry run before the line moves. {{/* Truthy while the organizations' cut-over runs: agentManager.migration.cutover -set, agent-manager.agentChart.semver a 3.x line (not the preflight dry run) +true (a boolean: a string such as "false" fails the render, it would read as +set), agent-manager.agentChart.semver a 3.x line (not the preflight dry run) and organizations on. Only then the run writes organization releases and its report there (migrate-rbac.yaml, organizations/migrate-scope.yaml); unset afterwards, the identity keeps its reads on the 3.x line and no write there. */}} {{- define "agent-platform.kagent.migration.v3Writes" -}} {{- $am := include "agent-platform.agentManager.chartValues" . | fromJson -}} -{{- if and (dig "migration" "cutover" false (.Values.agentManager | default dict)) (include "agent-platform.organizations.enabled" .) (include "agent-platform.kagent.migration" .) (include "agent-platform.kagent.migration.isV3" (dig "agentChart" "semver" "2.x" $am)) -}}true{{- end -}} +{{- $cutover := dig "migration" "cutover" false (.Values.agentManager | default dict) -}} +{{- if not (or (kindIs "bool" $cutover) (kindIs "invalid" $cutover)) -}} +{{- fail (printf "agentManager.migration.cutover must be the boolean true or false, got the %s %q: only a boolean true grants the migration its organization writes" (kindOf $cutover) (toString $cutover)) -}} +{{- end -}} +{{- if and (eq (toString $cutover) "true") (include "agent-platform.organizations.enabled" .) (include "agent-platform.kagent.migration" .) (include "agent-platform.kagent.migration.isV3" (dig "agentChart" "semver" "2.x" $am)) -}}true{{- end -}} {{- end -}} diff --git a/tests/verify-agent-chart-line.py b/tests/verify-agent-chart-line.py index 6dde2fa6..2b013e3a 100755 --- a/tests/verify-agent-chart-line.py +++ b/tests/verify-agent-chart-line.py @@ -282,6 +282,19 @@ def scope_policy(*args: str) -> str: if scope_policy(*args): fail(f"{what}: the migrate scope policy renders without the writes it holds") + # D-GO-38: only a boolean true grants the writes. A string, also "false", + # fails the render naming the key; a boolean false and an unset value + # grant none. + for text in ("false", "true", "no", ""): + r = subprocess.run([*conn_base, *v3, "--set-string", f"agentManager.migration.cutover={text}", "--set", "agentPlatformOrganizations.enabled=true"], + capture_output=True, text=True) + if r.returncode == 0 or "agentManager.migration.cutover must be the boolean" not in r.stderr: + fail(f"agentManager.migration.cutover as the string {text!r} is not refused:\n{r.stderr[-400:]}") + if scope_policy(*v3, "--set", "agentManager.migration.cutover=false", "--set", "agentPlatformOrganizations.enabled=true"): + fail("a boolean false cutover renders the migrate scope policy") + if not scope_policy(*v3, "--set-json", "agentManager.migration.cutover=true", "--set", "agentPlatformOrganizations.enabled=true"): + fail("a boolean true cutover (set as JSON) renders no migrate scope policy") + # D-GO-08: every alternative of a || range and every version a range # names counts, here as in migrate and the agent-platform-operator. refused("an alternative on another major", "admits agent chart majors 2, 3", "--set", "agent-manager.agentChart.semver=3.0.1 || 2.6.0") From 03a17f49f2520a9ff87baa3dad6f267b0ddc2c80 Mon Sep 17 00:00:00 2001 From: Dominik Schmidle Date: Thu, 26 Nov 2026 15:43:53 +0100 Subject: [PATCH 43/56] fix(helm): let agent-manager read the default agent's release for its tool approval settings The default agent's release lives in the chart's Flux namespace, not in the kagent namespace agent-manager manages, so a session of the default agent could not read its settings. From agent-manager's tool approval floor the chart derives agent-manager.muster.toolApproval.platformReleases [/default-agent], which grants get on that release by name; verify-tool-approval asserts it. --- helm/agent-platform/templates/_helpers.tpl | 11 +++++ tests/verify-tool-approval.py | 49 ++++++++++++++++++++++ 2 files changed, 60 insertions(+) diff --git a/helm/agent-platform/templates/_helpers.tpl b/helm/agent-platform/templates/_helpers.tpl index 8a92beba..d3a5ee16 100644 --- a/helm/agent-platform/templates/_helpers.tpl +++ b/helm/agent-platform/templates/_helpers.tpl @@ -545,6 +545,17 @@ its chart has no such key); an own value stands. */ -}} {{- $musterTakes := and (include "agent-platform.componentEnabled" (dict "root" .root "name" "muster")) (include "agent-platform.componentFloorAtLeast" (dict "root" .root "name" "muster" "version" (include "agent-platform.muster.agentApprovalFloor" .root))) -}} {{- $_ := set $musterValues "toolApproval" (dict "enabled" (ternary true false (not (empty $musterTakes)))) -}} {{- end -}} +{{- /* The default agent's settings live in its release, which this chart +renders in its own Flux namespace, not in the kagent namespace agent-manager +manages: agent-manager reads it by the Agent's Flux labels and gets get on +it by name (muster.toolApproval.platformReleases), so every person who may +start a session with the default agent can. Not with a remote target: the +release is on this cluster, agent-manager on the target. */ -}} +{{- if and (include "agent-platform.componentEnabled" (dict "root" .root "name" "default-agent")) (not (include "agent-platform.targetSecretName" .root)) -}} +{{- $ta := get $musterValues "toolApproval" | default dict -}} +{{- $_ := set $ta "platformReleases" (list (dict "namespace" (dig "namespace" "" (.root.Values.gitops | default dict) | default .root.Release.Namespace) "name" (include "agent-platform.childName" (dict "root" .root "name" "default-agent")))) -}} +{{- $_ := set $musterValues "toolApproval" $ta -}} +{{- end -}} {{- end -}} {{- $_ := set $derived "muster" $musterValues -}} {{- /* The installation's toolchains, while the toolchain-manager is on: diff --git a/tests/verify-tool-approval.py b/tests/verify-tool-approval.py index db7e7ac8..b6bfdd48 100755 --- a/tests/verify-tool-approval.py +++ b/tests/verify-tool-approval.py @@ -825,6 +825,54 @@ def check_unset_floors_keep_everything_off() -> None: print(f"ok: unset floors ({', '.join(unset)}) keep what they gate off for any muster and agent-manager range; `governed` fails") +# The default agent: kagent, muster and agent-manager on (componentEnabled). +DEFAULT_AGENT_ON = [ + "--namespace", "agent-platform", + "--set", "global.domain=example.com", + "--set", "global.identity.issuerUrl=https://dex.example.com", + "--set", "global.identity.clientId=agent-platform", + "--set", "global.identity.existingSecret=agent-platform-idp", + "--set", "global.gatewayApi.parentRefs[0].name=example-gateway", + "--set", "model-manager.ollama.endpoint=http://ollama.example.com:11434", + "--set", "kagent.harness.snapshotLocation=s3://ci-agent-snapshots/agents", + "--set", "kagent.database.postgres.urlFile=/etc/kagent-db/uri", + "--set", "postgres.enabled=true", + "--set", "components.kagent.enabled=true", + "--set", "components.agent-manager.enabled=true", +] + + +def check_default_agent_release_readable() -> None: + """The default agent's release lives in the chart's Flux namespace, not in + the kagent namespace agent-manager manages: agent-manager gets get on it + by name (muster.toolApproval.platformReleases), so a session of the + default agent can read its tool approval settings for every person.""" + am = "components.agent-manager.versionRange=>=3.6.0 <4.0.0-0" + musters = "components.muster.versionRange=>=5.66.0 <6.0.0-0" + + def releases(args: list[str]) -> str: + out = render_meta([*DEFAULT_AGENT_ON, *args]) + hr = doc(out, "HelmRelease", "agent-manager") + if hr is None: + fail(f"no agent-manager HelmRelease with {args}") + return block(hr, " platformReleases:") + + def items(text: str) -> list[str]: + return [line.strip().lstrip("- ").strip() for line in text.split("\n")[1:] if line.strip()] + + got = releases(["--set", am, "--set", musters]) + if sorted(items(got)) != ["name: default-agent", "namespace: agent-platform"]: + fail(f"agent-manager must be granted the default agent's release agent-platform/default-agent:\n{got}") + got = releases(["--set", am, "--set", musters, "--set", "gitops.namespace=flux-giantswarm"]) + if "namespace: flux-giantswarm" not in got: + fail(f"the default agent's release lives in gitops.namespace:\n{got}") + if releases(["--set", am, "--set", musters, "--set", "components.default-agent.enabled=false"]): + fail("no default agent, no platform release to read") + if releases([]): + fail("below agent-manager's tool approval floor its chart takes no muster.toolApproval") + print("ok: agent-manager may get the default agent's release (muster.toolApproval.platformReleases: /default-agent) from its tool approval floor, none without the default agent or below the floor") + + def render_meta_fail(args: list[str]) -> str: return render(META_DIR, META + args, expect_fail=True) @@ -845,5 +893,6 @@ def render_meta_fail(args: list[str]) -> str: check_connector_admin() check_binder() check_agent_manager_tool_approval() + check_default_agent_release_readable() check_session_bindings() check_approval() From d6423abb2bcabb0244bac2ac7c534935a0a42c4e Mon Sep 17 00:00:00 2001 From: Dominik Schmidle Date: Thu, 26 Nov 2026 16:03:01 +0100 Subject: [PATCH 44/56] fix(helm): pass the default agent's approval values to agent-manager on a remote target With gitops.target.kubeConfig agent-manager runs on the target cluster and cannot read the default agent's HelmRelease, which stays on the management cluster, so every default-agent session was refused. The chart now renders agent-manager.muster.toolApproval.platformAgents there instead of platformReleases: the Agent kagent/default-agent, the release its Flux labels name (/-default-agent) and the release's tools, toolset, default and muster.requireApproval, taken from the values the release is rendered with (agent-platform.defaultAgent.approval). verify-tool-approval asserts it. Without a target nothing changes. --- helm/agent-platform/templates/_helpers.tpl | 48 ++++++++++++++++++++-- tests/verify-tool-approval.py | 40 ++++++++++++++++++ 2 files changed, 84 insertions(+), 4 deletions(-) diff --git a/helm/agent-platform/templates/_helpers.tpl b/helm/agent-platform/templates/_helpers.tpl index d3a5ee16..6950816f 100644 --- a/helm/agent-platform/templates/_helpers.tpl +++ b/helm/agent-platform/templates/_helpers.tpl @@ -549,11 +549,21 @@ its chart has no such key); an own value stands. */ -}} renders in its own Flux namespace, not in the kagent namespace agent-manager manages: agent-manager reads it by the Agent's Flux labels and gets get on it by name (muster.toolApproval.platformReleases), so every person who may -start a session with the default agent can. Not with a remote target: the -release is on this cluster, agent-manager on the target. */ -}} -{{- if and (include "agent-platform.componentEnabled" (dict "root" .root "name" "default-agent")) (not (include "agent-platform.targetSecretName" .root)) -}} +start a session with the default agent can. With a remote target the release +is on this cluster and agent-manager on the target, where it cannot read it: +agent-manager gets the release's approval values instead +(muster.toolApproval.platformAgents, agent-platform.defaultAgent.approval), +rendered here from the values the release is rendered with, so only whoever +may change the release may change them; agent-manager checks them against +the Agent's Flux labels and the agent chart's X-Muster-Tool-Approval header. */ -}} +{{- if include "agent-platform.componentEnabled" (dict "root" .root "name" "default-agent") -}} {{- $ta := get $musterValues "toolApproval" | default dict -}} -{{- $_ := set $ta "platformReleases" (list (dict "namespace" (dig "namespace" "" (.root.Values.gitops | default dict) | default .root.Release.Namespace) "name" (include "agent-platform.childName" (dict "root" .root "name" "default-agent")))) -}} +{{- $release := dict "namespace" (dig "namespace" "" (.root.Values.gitops | default dict) | default .root.Release.Namespace) "name" (include "agent-platform.childName" (dict "root" .root "name" "default-agent")) -}} +{{- if include "agent-platform.targetSecretName" .root -}} +{{- $_ := set $ta "platformAgents" (list (include "agent-platform.defaultAgent.approval" (dict "root" .root "release" $release) | fromJson)) -}} +{{- else -}} +{{- $_ := set $ta "platformReleases" (list $release) -}} +{{- end -}} {{- $_ := set $musterValues "toolApproval" $ta -}} {{- end -}} {{- end -}} @@ -5804,6 +5814,36 @@ Usage: include "agent-platform.defaultAgent.derived" $ | fromJson {{- $out | toJson -}} {{- end -}} +{{/* +The default agent as agent-manager's muster.toolApproval.platformAgents entry, +for a remote target (gitops.target.kubeConfig), where agent-manager runs on +the target and cannot read the release on this cluster: the Agent (kagent +namespace, values agent.name else the release name default-agent), the +release its Flux labels name (.release: {namespace, name}) and the approval +values of the release's spec.values — tools, toolset, default and +muster.requireApproval / muster.enabled — taken from the values the release +is rendered with (components.default-agent.valuesFile under +agent-platform.defaultAgent.derived, as components.yaml merges them). +Usage: include "agent-platform.defaultAgent.approval" (dict "root" $ "release" $release) | fromJson +*/}} +{{- define "agent-platform.defaultAgent.approval" -}} +{{- $c := index .root.Values.components "default-agent" -}} +{{- $vals := include "agent-platform.componentValuesFile" (dict "root" .root "path" $c.valuesFile) | fromJson -}} +{{- $vals = mergeOverwrite (deepCopy $vals) (include "agent-platform.defaultAgent.derived" .root | fromJson) -}} +{{- $approval := dict -}} +{{- range $key := list "tools" "toolset" "default" -}} +{{- if hasKey $vals $key -}}{{- $_ := set $approval $key (get $vals $key) -}}{{- end -}} +{{- end -}} +{{- $muster := dict -}} +{{- range $key := list "requireApproval" "enabled" -}} +{{- if hasKey ($vals.muster | default dict) $key -}}{{- $_ := set $muster $key (get $vals.muster $key) -}}{{- end -}} +{{- end -}} +{{- with $muster -}}{{- $_ := set $approval "muster" . -}}{{- end -}} +{{- $out := dict "namespace" (include "agent-platform.kagent.namespace" .root) "name" (dig "agent" "name" "default-agent" $vals) "release" .release -}} +{{- with $approval -}}{{- $_ := set $out "values" . -}}{{- end -}} +{{- $out | toJson -}} +{{- end -}} + {{/* A component's values file (components..valuesFile, a path in this chart), as JSON. The release pipeline stamps the tag's commit over the `[[ .SHA ]]` diff --git a/tests/verify-tool-approval.py b/tests/verify-tool-approval.py index b6bfdd48..f346bbc7 100755 --- a/tests/verify-tool-approval.py +++ b/tests/verify-tool-approval.py @@ -873,6 +873,45 @@ def items(text: str) -> list[str]: print("ok: agent-manager may get the default agent's release (muster.toolApproval.platformReleases: /default-agent) from its tool approval floor, none without the default agent or below the floor") +def check_default_agent_on_remote_target() -> None: + """With a remote target (gitops.target.kubeConfig) agent-manager runs on + the target and cannot read the default agent's release on this cluster: + it gets the release's approval values instead + (muster.toolApproval.platformAgents), the Agent, the release its Flux + labels name (/-default-agent) and the + release's own tools/toolset/default, and no platformReleases.""" + am = "components.agent-manager.versionRange=>=3.6.0 <4.0.0-0" + musters = "components.muster.versionRange=>=5.66.0 <6.0.0-0" + target = ["--set", "gitops.target.kubeConfig.secretRef.name=wc1-kubeconfig", "--set", "gitops.target.name=wc1", + "--set", "gitops.namespace=flux-giantswarm"] + + def releases(args: list[str]) -> tuple[str, str, str]: + out = render_meta([*DEFAULT_AGENT_ON, "--set", am, "--set", musters, *target, *args]) + hr = doc(out, "HelmRelease", "wc1-agent-manager") + if hr is None: + fail(f"no wc1-agent-manager HelmRelease with {args}") + da = doc(out, "HelmRelease", "wc1-default-agent") or "" + return block(hr, " platformAgents:"), block(hr, " platformReleases:"), da + + agents, plain, da = releases([]) + if plain: + fail(f"with a remote target agent-manager cannot read the release: no platformReleases, got\n{plain}") + lines = [line.strip().lstrip("- ").strip() for line in agents.split("\n")[1:] if line.strip()] + for want in ["name: default-agent", "namespace: kagent", "release:", "name: wc1-default-agent", "namespace: flux-giantswarm", + "values:", "toolset:", "preset:full"]: + if want not in lines: + fail(f"platformAgents must carry the default agent kagent/default-agent, its release flux-giantswarm/wc1-default-agent and its toolset; missing {want!r}:\n{agents}") + for key in ["tools:", "default:", "requireApproval:"]: + if (key in lines) != (("\n " + key) in da or ("\n " + key) in da): + fail(f"platformAgents' {key} must match the default agent's release values:\n{agents}\n{da}") + if "toolset:\n - preset:full" not in da: + fail(f"the default agent's release carries toolset [preset:full]:\n{da}") + agents, plain, _ = releases(["--set", "components.default-agent.enabled=false"]) + if agents or plain: + fail("no default agent, no platform agent") + print("ok: with a remote target agent-manager gets the default agent's approval values (muster.toolApproval.platformAgents: kagent/default-agent, release /-default-agent, the release's toolset) instead of platformReleases; none without the default agent") + + def render_meta_fail(args: list[str]) -> str: return render(META_DIR, META + args, expect_fail=True) @@ -894,5 +933,6 @@ def render_meta_fail(args: list[str]) -> str: check_binder() check_agent_manager_tool_approval() check_default_agent_release_readable() + check_default_agent_on_remote_target() check_session_bindings() check_approval() From 5d705d144c45466f7b6fa515a76aa117c1be3011 Mon Sep 17 00:00:00 2001 From: Dominik Schmidle Date: Thu, 26 Nov 2026 16:53:26 +0100 Subject: [PATCH 45/56] fix(approval): tell agent-manager which Agent the default agent's release renders muster.toolApproval.platformReleases now maps the release to the Agent it renders, so agent-manager binds the default agent through that release only and refuses an Agent whose Flux labels name another or none. --- helm/agent-platform/templates/_helpers.tpl | 9 ++++++--- tests/verify-tool-approval.py | 15 +++++++++------ 2 files changed, 15 insertions(+), 9 deletions(-) diff --git a/helm/agent-platform/templates/_helpers.tpl b/helm/agent-platform/templates/_helpers.tpl index 6950816f..713be5cd 100644 --- a/helm/agent-platform/templates/_helpers.tpl +++ b/helm/agent-platform/templates/_helpers.tpl @@ -548,7 +548,9 @@ its chart has no such key); an own value stands. */ -}} {{- /* The default agent's settings live in its release, which this chart renders in its own Flux namespace, not in the kagent namespace agent-manager manages: agent-manager reads it by the Agent's Flux labels and gets get on -it by name (muster.toolApproval.platformReleases), so every person who may +it by name (muster.toolApproval.platformReleases, with the Agent it renders: +an agent-manager that reads the release only for the listed agent, and refuses +it when the Agent's labels name another release), so every person who may start a session with the default agent can. With a remote target the release is on this cluster and agent-manager on the target, where it cannot read it: agent-manager gets the release's approval values instead @@ -559,10 +561,11 @@ the Agent's Flux labels and the agent chart's X-Muster-Tool-Approval header. */ {{- if include "agent-platform.componentEnabled" (dict "root" .root "name" "default-agent") -}} {{- $ta := get $musterValues "toolApproval" | default dict -}} {{- $release := dict "namespace" (dig "namespace" "" (.root.Values.gitops | default dict) | default .root.Release.Namespace) "name" (include "agent-platform.childName" (dict "root" .root "name" "default-agent")) -}} +{{- $agent := include "agent-platform.defaultAgent.approval" (dict "root" .root "release" $release) | fromJson -}} {{- if include "agent-platform.targetSecretName" .root -}} -{{- $_ := set $ta "platformAgents" (list (include "agent-platform.defaultAgent.approval" (dict "root" .root "release" $release) | fromJson)) -}} +{{- $_ := set $ta "platformAgents" (list $agent) -}} {{- else -}} -{{- $_ := set $ta "platformReleases" (list $release) -}} +{{- $_ := set $ta "platformReleases" (list (dict "namespace" $release.namespace "name" $release.name "agent" (dict "namespace" $agent.namespace "name" $agent.name))) -}} {{- end -}} {{- $_ := set $musterValues "toolApproval" $ta -}} {{- end -}} diff --git a/tests/verify-tool-approval.py b/tests/verify-tool-approval.py index f346bbc7..79c2b3a0 100755 --- a/tests/verify-tool-approval.py +++ b/tests/verify-tool-approval.py @@ -857,20 +857,23 @@ def releases(args: list[str]) -> str: fail(f"no agent-manager HelmRelease with {args}") return block(hr, " platformReleases:") - def items(text: str) -> list[str]: - return [line.strip().lstrip("- ").strip() for line in text.split("\n")[1:] if line.strip()] + def entries(text: str) -> list[str]: + return [line.strip() for line in text.split("\n")[1:] if line.strip()] + # The release, and the Agent it renders: the only release the Agent's Flux + # labels may name (agent-manager refuses any other, and a missing one). + want = ["- agent:", "name: default-agent", "namespace: kagent", "name: default-agent", "namespace: agent-platform"] got = releases(["--set", am, "--set", musters]) - if sorted(items(got)) != ["name: default-agent", "namespace: agent-platform"]: - fail(f"agent-manager must be granted the default agent's release agent-platform/default-agent:\n{got}") + if entries(got) != want: + fail(f"agent-manager must be granted the default agent's release agent-platform/default-agent, and be told it renders the Agent kagent/default-agent (the only release its Agent's labels may name):\n{got}") got = releases(["--set", am, "--set", musters, "--set", "gitops.namespace=flux-giantswarm"]) - if "namespace: flux-giantswarm" not in got: + if entries(got) != [*want[:-1], "namespace: flux-giantswarm"]: fail(f"the default agent's release lives in gitops.namespace:\n{got}") if releases(["--set", am, "--set", musters, "--set", "components.default-agent.enabled=false"]): fail("no default agent, no platform release to read") if releases([]): fail("below agent-manager's tool approval floor its chart takes no muster.toolApproval") - print("ok: agent-manager may get the default agent's release (muster.toolApproval.platformReleases: /default-agent) from its tool approval floor, none without the default agent or below the floor") + print("ok: agent-manager may get the default agent's release (muster.toolApproval.platformReleases: /default-agent, with the Agent kagent/default-agent it renders) from its tool approval floor, none without the default agent or below the floor") def check_default_agent_on_remote_target() -> None: From b430dbf4ba57c6a99f1c1132a30b7e04523e2062 Mon Sep 17 00:00:00 2001 From: Dominik Schmidle Date: Thu, 26 Nov 2026 18:53:46 +0100 Subject: [PATCH 46/56] feat(approval): sign the portal in with its own OAuth client and trust only it for muster's sign-in handoff backstage.oidcClientId gives the portal a client of its own at the platform's issuer (secret: portal-dex-client-secret of global.identity.existingSecret, mounted optional as AGENT_PLATFORM_PORTAL_OIDC_CLIENT_SECRET). The portal then also requests the platform client's audience, so muster, the managers and the API server accept its tokens as before; their azp names the portal's client. With such a dedicated client and backstage.signInHandoff on (the default), the meta chart lists that client, and only that one, in muster's approval.handoffClients from agent-platform.muster.handoffFloor (unset until the muster release exists): a click on Open in portal chat then opens muster's approval page or connector sign-in signed in. The shared client is never listed; an own handoffClients naming it fails the render, since agents' delegations and CLIs hold its tokens. The trade-off (a holder of a person's portal token can open that person's approval page without a browser sign-in; the decision still takes the click on muster's page) is documented in docs/authentication.md. --- docs/authentication.md | 10 ++ helm/agent-platform-connectivity/README.md | 1 + .../templates/backstage/app-config.yaml | 22 ++++- helm/agent-platform-connectivity/values.yaml | 10 ++ helm/agent-platform/README.md | 14 ++- helm/agent-platform/templates/_helpers.tpl | 40 +++++++- helm/agent-platform/values.schema.json | 2 +- helm/agent-platform/values.yaml | 39 +++++++- tests/golden/meta-ci-engine-off.yaml | 8 ++ tests/golden/meta-default.yaml | 8 ++ tests/verify-tool-approval.py | 96 ++++++++++++++++++- 11 files changed, 239 insertions(+), 11 deletions(-) diff --git a/docs/authentication.md b/docs/authentication.md index ec841e29..624f4368 100644 --- a/docs/authentication.md +++ b/docs/authentication.md @@ -44,6 +44,16 @@ muster aggregates many MCP servers behind `/mcp`. Each server entry in `agent-pl muster signs no tokens of its own: every downstream server validates against Dex. A kagent agent acts as the person who started its Session: agent-manager binds the Session's Actor to that person at muster, and the egress gateway puts the Actor's JWT on every call to muster, which serves it as the bound person. The runtime never holds or forwards the person's token: the Harness sets no `KAGENT_PROPAGATE_TOKEN`, so no MCP server receives it, and muster refuses a Session nobody bound. model-manager, agent-manager and mcp-kubernetes receive the person's token with the audience `dex-k8s-authenticator` and act on the cluster with that person's RBAC (install.md, [The identity provider](install.md#the-identity-provider)). +### The portal's own client and sign-in handoff + +By default the portal signs people in with the platform's shared client (`global.identity.clientId`), which muster, the managers and the CLI helpers use as well. `backstage.oidcClientId` gives the portal a client of its own at the same issuer: + +- the identity provider registers it with the portal's redirect URI only (`https:///api/auth/oidc-agent-platform/handler/frame`), and its secret goes into `global.identity.existingSecret` under `portal-dex-client-secret`; +- the portal requests the platform client's audience (`audience:server:client_id:`, added to `backstage.extraScopes`), so the token's `aud` still holds the platform client and every component that trusts it (muster's `trustedAudiences`, the managers' trusted audiences, the API server through `dex-k8s-authenticator`) accepts it unchanged. Its `azp` names the portal's client. On Dex the platform client and `dex-k8s-authenticator` (and any other client whose audience `extraScopes` requests) list the portal's client under `trustedPeers`; +- muster keys a forwarded token's session by its client too: a person's connector sign-ins made through the shared client are not the portal's, except subject-scoped ones (`spec.auth.grantScope: subject`). + +With a dedicated client and `backstage.signInHandoff` on (the default), the chart lists that client, and only that one, in muster's `approval.handoffClients` (from `agent-platform.muster.handoffFloor`). When a person clicks *Open* on an approval or connector sign-in prompt in portal chat, the portal backend asks muster `POST /handoff-tickets` with the person's token for a one-time ticket bound to that page and person (60 s), and the page opens signed in instead of asking for muster's own sign-in. The trade-off: whoever holds a portal token of a person can open that person's approval page without a browser sign-in; only the portal backend holds such tokens, and deciding still takes the click on muster's page with its anti-forgery, origin and person checks. The shared client is never listed (the render fails if `muster.muster.approval.handoffClients` names it): agents' delegations and CLIs hold its tokens. `backstage.signInHandoff: false` keeps muster's own sign-in on every page. + ## 4. Edge JWT validation and JWKS agentgateway verifies the JWT itself (`Strict`, against `global.identity.issuerUrl`) on three routes: the kagent controller route ([5](#5-the-kagent-controller-route)), the agent-manager route (`agentManager.route` with its `jwtAuthentication.enabled`, both off by default) and the models Gateway ([6](#6-the-models-gateway)). Each takes its key set from its own `jwtAuthentication.jwks` (`host`, `port`, `path`, `tls`). The agentgateway controller fetches it and pushes the keys to the data plane. A failed fetch refuses every caller with `401 token uses the unknown key`. diff --git a/helm/agent-platform-connectivity/README.md b/helm/agent-platform-connectivity/README.md index d0f9d6f9..a9bae7de 100644 --- a/helm/agent-platform-connectivity/README.md +++ b/helm/agent-platform-connectivity/README.md @@ -1944,6 +1944,7 @@ The kagent block is open in the schema, so the template refuses a key under `kag | backstage.installationName | string | `"agent-platform"` | | | backstage.extraScopes[0] | string | `"federated:id"` | | | backstage.extraScopes[1] | string | `"audience:server:client_id:dex-k8s-authenticator"` | | +| backstage.oidcClientId | string | `""` | | | backstage.startUrlSearchParams | object | `{}` | | | backstage.enabledExtensions | list | `[]` | | | backstage.disabledExtensions[0] | string | `"page:gs/clusters"` | | diff --git a/helm/agent-platform-connectivity/templates/backstage/app-config.yaml b/helm/agent-platform-connectivity/templates/backstage/app-config.yaml index 391670c6..f46b57eb 100644 --- a/helm/agent-platform-connectivity/templates/backstage/app-config.yaml +++ b/helm/agent-platform-connectivity/templates/backstage/app-config.yaml @@ -8,6 +8,21 @@ route hostname. */}} {{- $issuer := include "agent-platform.issuerUrl" (dict "ctx" . "for" "the Backstage login provider") }} {{- $installation := include "agent-platform.backstage.installationName" . }} {{- $provider := "oidc-agent-platform" }} +{{- /* The portal's own OAuth client (backstage.oidcClientId), else the +platform's shared one. A dedicated client reads its secret from its own env +var (the meta chart's backstage values mount portal-dex-client-secret) and +also requests the platform client's audience, so every component that trusts +that audience accepts the portal's tokens as before. */}} +{{- $platformClient := toString (.Values.global.identity.clientId | default "") }} +{{- $portalClient := toString ($backstage.oidcClientId | default "") }} +{{- $dedicated := and $portalClient (ne $portalClient $platformClient) }} +{{- $extraScopes := $backstage.extraScopes | default list }} +{{- if and $dedicated $platformClient $extraScopes }} +{{- $platformScope := printf "audience:server:client_id:%s" $platformClient }} +{{- if not (has $platformScope $extraScopes) }} +{{- $extraScopes = append $extraScopes $platformScope }} +{{- end }} +{{- end }} {{- $musterHostname := "" }} {{- if .Values.ingress.hostnames }} {{- $musterHostname = index .Values.ingress.hostnames 0 }} @@ -103,8 +118,13 @@ data: {{ $provider }}: production: metadataUrl: {{ $issuer }}/.well-known/openid-configuration + {{- if $dedicated }} + clientId: {{ $portalClient }} + clientSecret: ${AGENT_PLATFORM_PORTAL_OIDC_CLIENT_SECRET} + {{- else }} clientId: {{ .Values.global.identity.clientId }} clientSecret: ${AGENT_PLATFORM_OIDC_CLIENT_SECRET} + {{- end }} {{- /* Unset, the Backstage oidc authenticator sends prompt=none on every authorize request. Dex ignores it, but a spec-strict IdP (Google) answers a fresh login with error=interaction_required @@ -124,7 +144,7 @@ data: {{- end }} gs: authProvider: {{ $provider }} - {{- with $backstage.extraScopes }} + {{- with $extraScopes }} auth: extraScopes: {{- toYaml . | nindent 10 }} diff --git a/helm/agent-platform-connectivity/values.yaml b/helm/agent-platform-connectivity/values.yaml index 43d9834d..489312e3 100644 --- a/helm/agent-platform-connectivity/values.yaml +++ b/helm/agent-platform-connectivity/values.yaml @@ -3591,6 +3591,16 @@ backstage: # @schema skipProperties: true; additionalProperties: true extraScopes: - federated:id - audience:server:client_id:dex-k8s-authenticator + # The portal's own OAuth client. Empty (the default) signs in with + # global.identity.clientId and the env AGENT_PLATFORM_OIDC_CLIENT_SECRET. + # Set and different from it, the login provider takes this client id and + # the env AGENT_PLATFORM_PORTAL_OIDC_CLIENT_SECRET (the meta chart mounts + # the key portal-dex-client-secret of global.identity.existingSecret), and + # audience:server:client_id: is added to the + # extraScopes (unless they are empty), so the portal's tokens keep the + # platform client's audience. The meta chart's values.yaml says what the + # identity provider needs for it (backstage.oidcClientId there). + oidcClientId: "" # Extra query parameters on the login provider's authorize request (the # oidc authenticator's startUrlSearchParams). Dex needs none. Google models # offline access as authorize parameters, not as the offline_access scope diff --git a/helm/agent-platform/README.md b/helm/agent-platform/README.md index 474e1d42..e5bd79d0 100644 --- a/helm/agent-platform/README.md +++ b/helm/agent-platform/README.md @@ -782,6 +782,8 @@ The map is merged into each component's own `nodeSelector` (`muster.nodeSelector | components.backstage.omitKeys[9] | string | `"skillPullRequests"` | | | components.backstage.omitKeys[10] | string | `"metaAgents"` | | | components.backstage.omitKeys[11] | string | `"configReload"` | | +| components.backstage.omitKeys[12] | string | `"oidcClientId"` | | +| components.backstage.omitKeys[13] | string | `"signInHandoff"` | | | components.backstage.enabled | bool | `false` | | | components.backstage.dependsOn[0] | string | `"cloudnative-pg"` | | | components.backstage.dependsOn[1] | string | `"agent-platform-connectivity"` | | @@ -1655,7 +1657,7 @@ The map is merged into each component's own `nodeSelector` (`muster.nodeSelector | clusterManager.networkPolicy.workloadClusters.ports[1] | int | `6443` | | | clusterManager.networkPolicy.egress.fqdns | list | `[]` | | | clusterManager.networkPolicy.egress.cidrs | list | `[]` | | -| governance | object | `{"mode":"trusted","roleFloors":{}}` | The platform's governance (mode and role floors). The mode, trusted (the default) or governed, changes no tool approval setting's meaning; it adds asking for agent callers. Governed asks a person before an agent runs any tool of a governed server (governedServers below) that is not on that server's safe list (new and renamed tools too), and before any of muster's own tools but its reads; the Dev Portal's connector wizard pre-selects the Recommended preset (read-only tools run, the rest ask). Trusted lets agents run what the connectors' own settings allow and pre-selects Allow all. In both modes muster's built-in floors ask a person before an agent adds or repoints a connector, changes approval settings, grants access, adds a model, egress origin, credential or backend, approves an action or a toolchain source, or changes muster's own configuration; the role floors hold on the governed servers of that role, so governedServers names them in both modes. The meta chart renders muster's governance configuration from it (muster.governance: the mode and governedServers), from the muster release that reads it (agent-platform.muster.governanceFloor); below it `governed` fails the render and trusted renders nothing. From that release the meta chart also renders muster.approval.installation (backstage.installationName, the name the approval page shows), muster-approval-binder's subject (agent-manager's ServiceAccount, muster.rbac.approvalBinder.subjects) and the pages muster may return the browser to after an approval in muster.oauth.mcpClient.postLoginRedirectAllowlist (the portal's /sessions with backstage.publicPort, klausGateway.obo.callbackBaseUrl + /auth/slack/return; an own list's entries stay). Approval itself needs muster's OAuth server with Dex sign-in, Valkey storage (the default) and muster.muster.oauth.mcpClient.publicUrl on the OAuth server's origin with mcpClient.enabled for the allowlist; the chart does not fail without them, muster refuses asking calls with the reason. The mode is set with this chart value (no agent tool changes it). The block mirrors muster's own governance configuration; a string here (the earlier scalar) fails the render. Further reading (optional): https://docs.giantswarm.io/overview/agent-platform/governing-tool-calls/ | +| governance | object | `{"mode":"trusted","roleFloors":{}}` | The platform's governance (mode and role floors). The mode, trusted (the default) or governed, changes no tool approval setting's meaning; it adds asking for agent callers. Governed asks a person before an agent runs any tool of a governed server (governedServers below) that is not on that server's safe list (new and renamed tools too), and before any of muster's own tools but its reads; the Dev Portal's connector wizard pre-selects the Recommended preset (read-only tools run, the rest ask). Trusted lets agents run what the connectors' own settings allow and pre-selects Allow all. In both modes muster's built-in floors ask a person before an agent adds or repoints a connector, changes approval settings, grants access, adds a model, egress origin, credential or backend, approves an action or a toolchain source, or changes muster's own configuration; the role floors hold on the governed servers of that role, so governedServers names them in both modes. The meta chart renders muster's governance configuration from it (muster.governance: the mode and governedServers), from the muster release that reads it (agent-platform.muster.governanceFloor); below it `governed` fails the render and trusted renders nothing. From that release the meta chart also renders muster.approval.installation (backstage.installationName, the name the approval page shows; and handoffClients, the portal's own client, with backstage.oidcClientId and backstage.signInHandoff), muster-approval-binder's subject (agent-manager's ServiceAccount, muster.rbac.approvalBinder.subjects) and the pages muster may return the browser to after an approval in muster.oauth.mcpClient.postLoginRedirectAllowlist (the portal's /sessions with backstage.publicPort, klausGateway.obo.callbackBaseUrl + /auth/slack/return; an own list's entries stay). Approval itself needs muster's OAuth server with Dex sign-in, Valkey storage (the default) and muster.muster.oauth.mcpClient.publicUrl on the OAuth server's origin with mcpClient.enabled for the allowlist; the chart does not fail without them, muster refuses asking calls with the reason. The mode is set with this chart value (no agent tool changes it). The block mirrors muster's own governance configuration; a string here (the earlier scalar) fails the render. Further reading (optional): https://docs.giantswarm.io/overview/agent-platform/governing-tool-calls/ | | governance.mode | string | `"trusted"` | trusted (the default) or governed; anything else fails the render. | | governance.roleFloors | object | `{}` | Floors per governance role (muster.governance.roleFloors): role -> the server's own tool names that ask agents in both modes on the governed servers of that role, added to muster's built-in floors (config can only add: a built-in floor is never removed). A role named here is a valid `role` of governedServers. For a server the installation registers itself, e.g.: governance: roleFloors: exampleManager: [approve_change, merge_change] governedServers: example-manager: role: exampleManager safe: [get_info, list_changes] Rendered from the muster release that reads the governance configuration (agent-platform.muster.governanceFloor), like governedServers. | | governedServers | object | `{"agent-manager":{"role":"agentManager","safe":["get_info","list_agents","get_agent","get_agent_status","validate_agent","list_model_configs","list_egress_policies","list_skills","list_sessions","get_session","get_session_turn","toolchain_users","list_organizations","get_organization","list_organization_members","list_organization_connectors"]},"cluster-manager":{"role":"clusterManager","safe":["get_info","list_clusters","list_releases","list_node_pools"]},"kagent":{"role":"sessionManager","safe":["list_sessions","list_session_checkpoints","list_sandbox_templates","list_sandboxes","get_sandbox","get_sandbox_process","read_sandbox_outputs","read_sandbox_file"]},"mcp-kubernetes":{"role":"infrastructure","safe":["logs","list_port_forward_sessions","context_list","context_get_current","can_i","api_resources","cluster_health","capi_list_clusters","capi_get_cluster","capi_resolve_cluster","capi_cluster_health","get","list","describe"]},"model-manager":{"role":"modelManager","safe":["get_info","get_backend","list_backends","list_models","get_model","list_loaded_models","list_presets","search_models","check_fit","list_nodes","list_jobs","get_job"]},"skill-manager":{"role":"skillManager","safe":["list_skill_sources","list_skills","resolve_skills","get_skill","get_skill_file"]},"toolchain-manager":{"role":"toolchainManager","safe":["list_sources","list_toolchains","describe_toolchain","toolchain_build_status","search_packages"]},"vm-manager":{"role":"vmManager","safe":["get_info","get_host","list_images","get_image","list_networks","get_network","list_vms","get_vm","get_vm_metrics","get_vm_attestation"]},"workspace-manager":{"role":"workspaceManager","safe":["list_providers","list_owners","list_workspaces","get_workspace","list_repositories","preview_workspace"]}}` | The servers muster governs (muster.governance.governedServers), per source the platform ships: `role` (which of muster's role floors hold on it: agentManager, connectorManager, sessionManager, modelManager, clusterManager, vmManager, workspaceManager, toolchainManager, skillManager, infrastructure, or a role governance.roleFloors declares) and `safe`, the server's own tool names agents call unasked on governed (reads only; a floor never, muster refuses to start on one). Every other tool of a governed server asks agents on governed. A source renders one entry per MCPServer it ships while that renders (agent-platform.muster.governedKeys): a manager component's .muster.mcpServer.name in its namespace; kagent the connectivity chart's kagent server; mcp-kubernetes the connectivity chart's and every agent-platform-mcps kubernetes entry; any other key is a muster server key itself (a server the installation registers, e.g. example-manager). null drops a source (then list it in governanceExempt with the reason). make verify-tool-approval fails on a shipped MCPServer that is neither here nor in governanceExempt, and on a safe entry that names a floor or no tool of its server, or whose name starts with a write verb (create, delete, exec, set, approve, ...) unless a `# safe-write: : ` comment above `safe:` says why it reads. | @@ -1791,6 +1793,8 @@ The map is merged into each component's own `nodeSelector` (`muster.nodeSelector | backstage.installationName | string | `"agent-platform"` | | | backstage.extraScopes[0] | string | `"federated:id"` | | | backstage.extraScopes[1] | string | `"audience:server:client_id:dex-k8s-authenticator"` | | +| backstage.oidcClientId | string | `""` | | +| backstage.signInHandoff | bool | `true` | | | backstage.startUrlSearchParams | object | `{}` | | | backstage.enabledExtensions | list | `[]` | | | backstage.disabledExtensions[0] | string | `"page:gs/clusters"` | | @@ -1825,8 +1829,12 @@ The map is merged into each component's own `nodeSelector` (`muster.nodeSelector | backstage.backstage.extraEnvVars[1].name | string | `"AGENT_PLATFORM_OIDC_CLIENT_SECRET"` | | | backstage.backstage.extraEnvVars[1].valueFrom.secretKeyRef.name | string | `"{{ .Values.global.identity.existingSecret }}"` | | | backstage.backstage.extraEnvVars[1].valueFrom.secretKeyRef.key | string | `"dex-client-secret"` | | -| backstage.backstage.extraEnvVars[2].name | string | `"NODE_EXTRA_CA_CERTS"` | | -| backstage.backstage.extraEnvVars[2].value | string | `"{{ with (dig \"identity\" \"ca\" \"secretName\" \"\" .Values.global) }}/etc/agent-platform/idp-ca/{{ dig \"identity\" \"ca\" \"key\" \"ca.crt\" $.Values.global }}{{ end }}"` | | +| backstage.backstage.extraEnvVars[2].name | string | `"AGENT_PLATFORM_PORTAL_OIDC_CLIENT_SECRET"` | | +| backstage.backstage.extraEnvVars[2].valueFrom.secretKeyRef.name | string | `"{{ .Values.global.identity.existingSecret }}"` | | +| backstage.backstage.extraEnvVars[2].valueFrom.secretKeyRef.key | string | `"portal-dex-client-secret"` | | +| backstage.backstage.extraEnvVars[2].valueFrom.secretKeyRef.optional | bool | `true` | | +| backstage.backstage.extraEnvVars[3].name | string | `"NODE_EXTRA_CA_CERTS"` | | +| backstage.backstage.extraEnvVars[3].value | string | `"{{ with (dig \"identity\" \"ca\" \"secretName\" \"\" .Values.global) }}/etc/agent-platform/idp-ca/{{ dig \"identity\" \"ca\" \"key\" \"ca.crt\" $.Values.global }}{{ end }}"` | | | backstage.backstage.extraVolumes[0].name | string | `"idp-ca"` | | | backstage.backstage.extraVolumes[0].secret.secretName | string | `"{{ dig \"identity\" \"ca\" \"secretName\" \"\" .Values.global | default \"agent-platform-idp-ca\" }}"` | | | backstage.backstage.extraVolumes[0].secret.optional | bool | `true` | | diff --git a/helm/agent-platform/templates/_helpers.tpl b/helm/agent-platform/templates/_helpers.tpl index 713be5cd..6fe33705 100644 --- a/helm/agent-platform/templates/_helpers.tpl +++ b/helm/agent-platform/templates/_helpers.tpl @@ -2176,6 +2176,9 @@ inside the define. (muster.credentialProvider.sessionBindings); UNSET until it exists. */ -}} {{- define "agent-platform.muster.sessionBindingsPortFloor" -}}{{- end -}} +{{- /* The first muster issuing sign-in handoff tickets to the clients of +approval.handoffClients (POST /handoff-tickets); UNSET until it exists. */ -}} +{{- define "agent-platform.muster.handoffFloor" -}}{{- end -}} {{/* The session bindings API muster serves agent-manager alone: @@ -2228,7 +2231,7 @@ nothing here would enforce it, so it fails too. Emits nothing. */}} {{- define "agent-platform.validateReleaseFloors" -}} {{- if not (include "agent-platform.muster.governanceFloor" .) -}} -{{- range $name := list "agentManager.toolApprovalFloor" "muster.agentApprovalFloor" "muster.sessionBindingsPortFloor" "agentManager.agentChartV3Floor" -}} +{{- range $name := list "agentManager.toolApprovalFloor" "muster.agentApprovalFloor" "muster.sessionBindingsPortFloor" "agentManager.agentChartV3Floor" "muster.handoffFloor" -}} {{- if include (printf "agent-platform.%s" $name) $ -}} {{- fail (printf "agent-platform.%s is set while agent-platform.muster.governanceFloor is unset: the muster approval binder, approval block and redirect allowlist render only from the governance floor, so agent-manager would bind settings that muster refuses from it and no Session would start; set agent-platform.muster.governanceFloor in the same release" $name) -}} {{- end -}} @@ -5289,8 +5292,16 @@ muster's approval configuration (muster.approval, rendered as `approval` into config.yaml): installation, the name the approval page shows, from backstage.installationName (the name the portal shows for this platform, default agent-platform) unless muster.muster.approval.installation names its -own; any other own key (ttl) is kept. Only from the muster floor -agent-platform.muster.governanceFloor; {} below it. +own; any other own key (ttl) is kept. handoffClients, the OAuth clients +whose bearers may ask muster for a one-time sign-in handoff ticket (the +portal opens muster's approval page and connector sign-in signed in): the +portal's own client (agent-platform.backstage.oidcClient) while the portal is +on with a dedicated client, backstage.signInHandoff is on and muster is at +least agent-platform.muster.handoffFloor; an own list stands. A list naming +the platform's shared client (global.identity.clientId, else muster's login +client) fails the render: every holder of such a token (muster, an agent's +delegation, a CLI) could then skip the page's own sign-in. Only from the muster +floor agent-platform.muster.governanceFloor; {} below it. Usage: include "agent-platform.muster.approval" $root | fromJson */}} {{- define "agent-platform.muster.approval" -}} @@ -5298,10 +5309,33 @@ Usage: include "agent-platform.muster.approval" $root | fromJson {{- if include "agent-platform.componentFloorAtLeast" (dict "root" . "name" "muster" "version" (include "agent-platform.muster.governanceFloor" .)) -}} {{- $own := dig "muster" "approval" dict (.Values.muster | default dict) | default dict -}} {{- $out = mergeOverwrite (dict "installation" (include "agent-platform.portalInstallationName" .)) $own -}} +{{- $portal := include "agent-platform.backstage.oidcClient" . | fromJson -}} +{{- if and (not (hasKey $own "handoffClients")) $portal.dedicated (dig "signInHandoff" true (.Values.backstage | default dict)) (include "agent-platform.componentEnabled" (dict "root" . "name" "backstage")) (include "agent-platform.componentFloorAtLeast" (dict "root" . "name" "muster" "version" (include "agent-platform.muster.handoffFloor" .))) -}} +{{- $_ := set $out "handoffClients" (list $portal.clientId) -}} +{{- end -}} +{{- if and $portal.platformClientId (has $portal.platformClientId (get $out "handoffClients" | default list)) -}} +{{- fail (printf "muster.muster.approval.handoffClients lists %q, the platform's shared OAuth client: every holder of a token of that client (muster itself, agents acting for a person, CLIs) could open a person's approval page without its sign-in; list only the portal's own client (backstage.oidcClientId)" $portal.platformClientId) -}} +{{- end -}} {{- end -}} {{- $out | toJson -}} {{- end -}} +{{/* +The OAuth client the portal signs people in with: backstage.oidcClientId, else +the platform's shared client (global.identity.clientId). dedicated is true when +the portal's client is set and differs from the platform's client (global +.identity.clientId, else muster's login client); only a dedicated client may +be trusted for sign-in handoff (agent-platform.muster.approval). Emits JSON +{clientId, platformClientId, dedicated}. +Usage: include "agent-platform.backstage.oidcClient" $root | fromJson +*/}} +{{- define "agent-platform.backstage.oidcClient" -}} +{{- $login := include "agent-platform.identity.musterLogin" .Values | fromJson -}} +{{- $platform := toString (dig "identity" "clientId" "" (.Values.global | default dict) | default ($login.clientID | default "")) -}} +{{- $own := toString (dig "oidcClientId" "" (.Values.backstage | default dict) | default "") -}} +{{- dict "clientId" ($own | default $platform) "platformClientId" $platform "dedicated" (and (ne $own "") (ne $own $platform)) | toJson -}} +{{- end -}} + {{/* The pages muster may send the browser back to after an approval (muster.oauth.mcpClient.postLoginRedirectAllowlist; muster compares scheme and diff --git a/helm/agent-platform/values.schema.json b/helm/agent-platform/values.schema.json index 03f832b8..b7fe4a64 100644 --- a/helm/agent-platform/values.schema.json +++ b/helm/agent-platform/values.schema.json @@ -2166,7 +2166,7 @@ }, "governance": { "type": "object", - "description": "The platform's governance (mode and role floors). The mode, trusted (the default) or governed, changes no tool approval setting's meaning; it adds asking for agent callers. Governed asks a person before an agent runs any tool of a governed server (governedServers below) that is not on that server's safe list (new and renamed tools too), and before any of muster's own tools but its reads; the Dev Portal's connector wizard pre-selects the Recommended preset (read-only tools run, the rest ask). Trusted lets agents run what the connectors' own settings allow and pre-selects Allow all. In both modes muster's built-in floors ask a person before an agent adds or repoints a connector, changes approval settings, grants access, adds a model, egress origin, credential or backend, approves an action or a toolchain source, or changes muster's own configuration; the role floors hold on the governed servers of that role, so governedServers names them in both modes. The meta chart renders muster's governance configuration from it (muster.governance: the mode and governedServers), from the muster release that reads it (agent-platform.muster.governanceFloor); below it `governed` fails the render and trusted renders nothing. From that release the meta chart also renders muster.approval.installation (backstage.installationName, the name the approval page shows), muster-approval-binder's subject (agent-manager's ServiceAccount, muster.rbac.approvalBinder.subjects) and the pages muster may return the browser to after an approval in muster.oauth.mcpClient.postLoginRedirectAllowlist (the portal's /sessions with backstage.publicPort, klausGateway.obo.callbackBaseUrl + /auth/slack/return; an own list's entries stay). Approval itself needs muster's OAuth server with Dex sign-in, Valkey storage (the default) and muster.muster.oauth.mcpClient.publicUrl on the OAuth server's origin with mcpClient.enabled for the allowlist; the chart does not fail without them, muster refuses asking calls with the reason. The mode is set with this chart value (no agent tool changes it). The block mirrors muster's own governance configuration; a string here (the earlier scalar) fails the render. Further reading (optional): https://docs.giantswarm.io/overview/agent-platform/governing-tool-calls/", + "description": "The platform's governance (mode and role floors). The mode, trusted (the default) or governed, changes no tool approval setting's meaning; it adds asking for agent callers. Governed asks a person before an agent runs any tool of a governed server (governedServers below) that is not on that server's safe list (new and renamed tools too), and before any of muster's own tools but its reads; the Dev Portal's connector wizard pre-selects the Recommended preset (read-only tools run, the rest ask). Trusted lets agents run what the connectors' own settings allow and pre-selects Allow all. In both modes muster's built-in floors ask a person before an agent adds or repoints a connector, changes approval settings, grants access, adds a model, egress origin, credential or backend, approves an action or a toolchain source, or changes muster's own configuration; the role floors hold on the governed servers of that role, so governedServers names them in both modes. The meta chart renders muster's governance configuration from it (muster.governance: the mode and governedServers), from the muster release that reads it (agent-platform.muster.governanceFloor); below it `governed` fails the render and trusted renders nothing. From that release the meta chart also renders muster.approval.installation (backstage.installationName, the name the approval page shows; and handoffClients, the portal's own client, with backstage.oidcClientId and backstage.signInHandoff), muster-approval-binder's subject (agent-manager's ServiceAccount, muster.rbac.approvalBinder.subjects) and the pages muster may return the browser to after an approval in muster.oauth.mcpClient.postLoginRedirectAllowlist (the portal's /sessions with backstage.publicPort, klausGateway.obo.callbackBaseUrl + /auth/slack/return; an own list's entries stay). Approval itself needs muster's OAuth server with Dex sign-in, Valkey storage (the default) and muster.muster.oauth.mcpClient.publicUrl on the OAuth server's origin with mcpClient.enabled for the allowlist; the chart does not fail without them, muster refuses asking calls with the reason. The mode is set with this chart value (no agent tool changes it). The block mirrors muster's own governance configuration; a string here (the earlier scalar) fails the render. Further reading (optional): https://docs.giantswarm.io/overview/agent-platform/governing-tool-calls/", "additionalProperties": false, "properties": { "mode": { diff --git a/helm/agent-platform/values.yaml b/helm/agent-platform/values.yaml index 7af818f6..b4c4a9c1 100644 --- a/helm/agent-platform/values.yaml +++ b/helm/agent-platform/values.yaml @@ -1533,6 +1533,8 @@ components: # @schema additionalProperties: true - skillPullRequests - metaAgents - configReload + - oidcClientId + - signInHandoff enabled: false # Renders a CNPG Cluster for its database when backstage.database.engine is # postgresql (the chart's default is sqlite); dropped at render time while @@ -5867,7 +5869,8 @@ clusterManager: # @schema skipProperties: true; additionalProperties: true # that reads it (agent-platform.muster.governanceFloor); below it `governed` # fails the render and trusted renders nothing. From that release the meta # chart also renders muster.approval.installation (backstage.installationName, -# the name the approval page shows), muster-approval-binder's subject +# the name the approval page shows; and handoffClients, the portal's own +# client, with backstage.oidcClientId and backstage.signInHandoff), muster-approval-binder's subject # (agent-manager's ServiceAccount, muster.rbac.approvalBinder.subjects) and # the pages muster may return the browser to after an approval in # muster.oauth.mcpClient.postLoginRedirectAllowlist (the portal's /sessions @@ -6939,6 +6942,32 @@ backstage: # @schema skipProperties: true; additionalProperties: true extraScopes: - federated:id - audience:server:client_id:dex-k8s-authenticator + # The portal's own OAuth client at the identity provider. Empty (the default) + # signs people in with the platform's shared client (global.identity + # .clientId), as before. Set, the portal signs in with this client: its + # secret is the key portal-dex-client-secret of global.identity + # .existingSecret, the provider registers only the portal's redirect URI + # (https:///api/auth/oidc-agent-platform/handler/frame) for it, and + # the portal also requests the platform client's audience + # (audience:server:client_id:, added to + # extraScopes unless they are empty), so muster, the managers and the API + # server accept its tokens as before. On Dex, the platform client and every + # client whose audience extraScopes request (dex-k8s-authenticator) list + # this client under trustedPeers. muster and the managers key a person's + # sessions by the token's client too, so a person's connector sign-ins of + # the shared client are not the portal's (subject-scoped ones are). + oidcClientId: "" + # Sign-in handoff: with a dedicated oidcClientId, muster gives the portal's + # backend a one-time ticket (muster.approval.handoffClients) when a person + # clicks Open on an approval or connector sign-in prompt in chat, and the + # page opens signed in instead of asking the person to sign in to muster + # again. The trade-off: whoever holds a portal token of a person (only the + # portal backend, by design) can open that person's approval page without + # a browser sign-in; deciding still takes the click on muster's page, with + # its anti-forgery and origin checks. false keeps muster's own sign-in on + # every page. Without a dedicated client nothing is listed: the shared + # client is held by muster, agents and CLIs as well. + signInHandoff: true # Extra query parameters on the login provider's authorize request. Dex needs # none; Google needs access_type: offline and prompt: consent for a refresh # token. @@ -7006,6 +7035,14 @@ backstage: # @schema skipProperties: true; additionalProperties: true secretKeyRef: name: "{{ .Values.global.identity.existingSecret }}" key: dex-client-secret + # The portal's own client secret, read while backstage.oidcClientId + # names a dedicated client (optional: absent otherwise). + - name: AGENT_PLATFORM_PORTAL_OIDC_CLIENT_SECRET + valueFrom: + secretKeyRef: + name: "{{ .Values.global.identity.existingSecret }}" + key: portal-dex-client-secret + optional: true - name: NODE_EXTRA_CA_CERTS value: "{{ with (dig \"identity\" \"ca\" \"secretName\" \"\" .Values.global) }}/etc/agent-platform/idp-ca/{{ dig \"identity\" \"ca\" \"key\" \"ca.crt\" $.Values.global }}{{ end }}" extraVolumes: diff --git a/tests/golden/meta-ci-engine-off.yaml b/tests/golden/meta-ci-engine-off.yaml index 5d740c71..d121950d 100644 --- a/tests/golden/meta-ci-engine-off.yaml +++ b/tests/golden/meta-ci-engine-off.yaml @@ -338,6 +338,12 @@ spec: secretKeyRef: key: dex-client-secret name: '{{ .Values.global.identity.existingSecret }}' + - name: AGENT_PLATFORM_PORTAL_OIDC_CLIENT_SECRET + valueFrom: + secretKeyRef: + key: portal-dex-client-secret + name: '{{ .Values.global.identity.existingSecret }}' + optional: true - name: NODE_EXTRA_CA_CERTS value: '{{ with (dig "identity" "ca" "secretName" "" .Values.global) }}/etc/agent-platform/idp-ca/{{ dig "identity" "ca" "key" "ca.crt" $.Values.global }}{{ end }}' @@ -384,10 +390,12 @@ spec: endpoint: http://otlp-gateway.kube-system.svc:4317 headers: X-Scope-OrgID=giantswarm protocol: grpc + oidcClientId: "" parentRefs: [] resources: verticalPodAutoscaler: enabled: false + signInHandoff: true skillsRepositories: - https://github.com/giantswarm/agent-skills startUrlSearchParams: {} diff --git a/tests/golden/meta-default.yaml b/tests/golden/meta-default.yaml index b39c70e6..a9011641 100644 --- a/tests/golden/meta-default.yaml +++ b/tests/golden/meta-default.yaml @@ -539,6 +539,12 @@ spec: secretKeyRef: key: dex-client-secret name: '{{ .Values.global.identity.existingSecret }}' + - name: AGENT_PLATFORM_PORTAL_OIDC_CLIENT_SECRET + valueFrom: + secretKeyRef: + key: portal-dex-client-secret + name: '{{ .Values.global.identity.existingSecret }}' + optional: true - name: NODE_EXTRA_CA_CERTS value: '{{ with (dig "identity" "ca" "secretName" "" .Values.global) }}/etc/agent-platform/idp-ca/{{ dig "identity" "ca" "key" "ca.crt" $.Values.global }}{{ end }}' @@ -585,10 +591,12 @@ spec: endpoint: http://otlp-gateway.kube-system.svc:4317 headers: X-Scope-OrgID=giantswarm protocol: grpc + oidcClientId: "" parentRefs: [] resources: verticalPodAutoscaler: enabled: false + signInHandoff: true skillsRepositories: - https://github.com/giantswarm/agent-skills startUrlSearchParams: {} diff --git a/tests/verify-tool-approval.py b/tests/verify-tool-approval.py index 79c2b3a0..804c094c 100755 --- a/tests/verify-tool-approval.py +++ b/tests/verify-tool-approval.py @@ -27,6 +27,13 @@ /auth/slack/return with its port while klaus-gateway is on and names it; invalid ports and URLs fail; own entries stay, first, once each; none below the floor. +- sign-in handoff: muster.approval.handoffClients is the portal's own client + (backstage.oidcClientId, when it differs from the platform's shared client) + while the portal is on, backstage.signInHandoff is on and muster is at least + agent-platform.muster.handoffFloor; an own list stands; a list naming the + shared client fails; the backstage release mounts portal-dex-client-secret + and the connectivity app-config signs in with that client, requesting the + platform client's audience. - governance floor: agent-platform.muster.governanceFloor is one X.Y.Z; its PLACEHOLDER-GOVERNANCE-FLOOR marker, while it is still there, appears once. - connector-admin: muster's mcpserver-editor Role (the platform's @@ -729,7 +736,8 @@ def check_approval() -> None: # chart while the chart keeps them unset until their releases exist #. TEST_FLOORS = {"muster.governanceFloor": "5.65.0", "muster.agentApprovalFloor": "5.66.0", - "agentManager.toolApprovalFloor": "3.6.0", "muster.sessionBindingsPortFloor": "5.66.0"} + "agentManager.toolApprovalFloor": "3.6.0", "muster.sessionBindingsPortFloor": "5.66.0", + "muster.handoffFloor": "5.68.0"} def with_test_floors(meta_dir: str, dst: str) -> str: @@ -765,7 +773,7 @@ def check_floor_dependencies() -> None: """The floors that need the governance wiring fail the render while the governance floor is unset, whichever of them is set; governed mode and role floors fail with muster off.""" - dependent = ["agentManager.toolApprovalFloor", "muster.agentApprovalFloor", "muster.sessionBindingsPortFloor", "agentManager.agentChartV3Floor"] + dependent = ["agentManager.toolApprovalFloor", "muster.agentApprovalFloor", "muster.sessionBindingsPortFloor", "agentManager.agentChartV3Floor", "muster.handoffFloor"] values = {**TEST_FLOORS, "agentManager.agentChartV3Floor": "3.6.0"} with tempfile.TemporaryDirectory(prefix="verify-floor-deps-") as tmp: for i, name in enumerate(dependent): @@ -822,6 +830,10 @@ def check_unset_floors_keep_everything_off() -> None: fail("with muster's agent approval floor unset agent-manager must bind no settings") if "muster.sessionBindingsPortFloor" in unset and block(muster, " sessionBindings:"): fail("with the session bindings floor unset muster must keep its earlier bindings wiring") + if "muster.handoffFloor" in unset: + portal = render_meta(high + PORTAL_CLIENT + ["--set", "backstage.oidcClientId=platform-portal"]) + if "handoffClients" in (doc(portal, "HelmRelease", "muster") or ""): + fail("with the handoff floor unset muster must list no sign-in handoff client") print(f"ok: unset floors ({', '.join(unset)}) keep what they gate off for any muster and agent-manager range; `governed` fails") @@ -915,6 +927,84 @@ def releases(args: list[str]) -> tuple[str, str, str]: print("ok: with a remote target agent-manager gets the default agent's approval values (muster.toolApproval.platformAgents: kagent/default-agent, release /-default-agent, the release's toolset) instead of platformReleases; none without the default agent") +# The portal on with the platform's identity (client `platform`). +PORTAL_CLIENT = [ + "--set", "global.domain=ci.example.com", + "--set", "global.identity.issuerUrl=https://dex.ci.example.com", + "--set", "global.identity.clientId=platform", + "--set", "global.identity.existingSecret=platform-oauth", + "--set", "components.backstage.enabled=true", +] + + +def check_handoff_clients() -> None: + """muster.approval.handoffClients lists the portal's own client + (backstage.oidcClientId) while it differs from the platform's shared + client, the portal is on, backstage.signInHandoff is on and muster is at + least agent-platform.muster.handoffFloor; an own list stands; a list + naming the shared client fails the render.""" + handoff = f"components.muster.versionRange=>={TEST_FLOORS['muster.handoffFloor']} <6.0.0-0" + header = " handoffClients:" + + def clients(args: list[str], floor: str = handoff) -> list[str]: + got = block(muster_release(["--set", floor, *PORTAL_CLIENT, *args]), header) + return [l.strip() for l in got.split("\n")[1:] if l.strip()] + + dedicated = ["--set", "backstage.oidcClientId=platform-portal"] + if clients(dedicated) != ["- platform-portal"]: + fail(f"a dedicated portal client must be muster's one handoff client, got {clients(dedicated)}") + for args, why in ( + ([], "the portal on the shared client"), + (["--set", "backstage.oidcClientId=platform"], "backstage.oidcClientId equal to the shared client"), + (dedicated + ["--set", "backstage.signInHandoff=false"], "backstage.signInHandoff false"), + (dedicated + ["--set", "components.backstage.enabled=false"], "the portal off"), + ): + if clients(args): + fail(f"{why}: no handoff client expected, got {clients(args)}") + if clients(dedicated, FLOOR_RANGE): + fail("below the handoff floor muster must list no handoff client") + own = clients(dedicated + ["--set", "muster.muster.approval.handoffClients[0]=other-portal"]) + if own != ["- other-portal"]: + fail(f"an own handoffClients list must stand, got {own}") + if clients(dedicated + ["--set-json", "muster.muster.approval.handoffClients=[]"]): + fail("an own empty handoffClients list must stand (no tickets)") + err = render(META_DIR, META + ["--set", handoff, *PORTAL_CLIENT, "--set", "muster.muster.approval.handoffClients[0]=platform"], expect_fail=True) + if 'handoffClients lists "platform", the platform\'s shared OAuth client' not in err: + fail(f"a handoff list naming the shared client must fail the render:\n{err}") + rel = doc(render_meta(["--set", handoff, *PORTAL_CLIENT, *dedicated]), "HelmRelease", "backstage") or "" + if "key: portal-dex-client-secret" not in rel or "optional: true" not in rel: + fail("the backstage release must mount the portal's own client secret (portal-dex-client-secret, optional)") + print("ok: muster.approval.handoffClients is the portal's dedicated client from the handoff floor (none on the shared client, with signInHandoff false, the portal off or below the floor), an own list stands, the shared client fails") + + +def check_portal_client_app_config() -> None: + """The connectivity chart's app-config signs the portal in with + backstage.oidcClientId and its own secret env, and requests the platform + client's audience on top of extraScopes; the shared client renders as + before.""" + base = CONN + ["--set", "components.backstage.enabled=true", "--set", "backstage.parentRefs[0].name=x"] + + def cfg(args: list[str]) -> str: + out = render(CONN_DIR, base + args) + cm = doc(out, "ConfigMap", "agent-platform-backstage-app-config") + if cm is None: + fail(f"no backstage app-config with {args}") + return cm + + shared = cfg([]) + if "clientId: platform\n" not in shared or "${AGENT_PLATFORM_OIDC_CLIENT_SECRET}" not in shared or "audience:server:client_id:platform\n" in shared: + fail(f"the shared client must render as before:\n{shared}") + own = cfg(["--set", "backstage.oidcClientId=platform-portal"]) + if "clientId: platform-portal\n" not in own or "${AGENT_PLATFORM_PORTAL_OIDC_CLIENT_SECRET}" not in own: + fail(f"a dedicated client must sign in with its id and its own secret env:\n{own}") + if "- audience:server:client_id:platform\n" not in own or "- audience:server:client_id:dex-k8s-authenticator\n" not in own: + fail(f"a dedicated client must request the platform client's audience on top of extraScopes:\n{own}") + bare = cfg(["--set", "backstage.oidcClientId=platform-portal", "--set-json", "backstage.extraScopes=[]"]) + if "audience:server:client_id:" in bare: + fail(f"empty extraScopes (a provider without Dex's cross-client scopes) must stay empty:\n{bare}") + print("ok: the portal signs in with backstage.oidcClientId and AGENT_PLATFORM_PORTAL_OIDC_CLIENT_SECRET, requesting the platform client's audience; the shared client renders as before") + + def render_meta_fail(args: list[str]) -> str: return render(META_DIR, META + args, expect_fail=True) @@ -932,6 +1022,8 @@ def render_meta_fail(args: list[str]) -> str: check_write_like() check_coverage() check_approval_config() + check_handoff_clients() + check_portal_client_app_config() check_connector_admin() check_binder() check_agent_manager_tool_approval() From be57118da33fa589aef9f4e9eb44ef4c69e238ed Mon Sep 17 00:00:00 2001 From: Dominik Schmidle Date: Thu, 26 Nov 2026 22:40:35 +0100 Subject: [PATCH 47/56] feat(approval): trust the portal's own client for muster's inline approval decisions muster renamed approval.handoffClients to approval.trustedClients: the clients listed there decide a person's approvals inline (POST /approvals/{id}/decision with the person's token) and get sign-in handoff tickets. The chart lists the portal's dedicated client as trustedClients from the new floor agent-platform.muster.trustedClientsFloor (unset until that muster is released), and as handoffClients from handoffFloor below it. An own list under either name stands; naming the shared client fails the render. Docs, the tools skill and verify-tool-approval follow. --- docs/authentication.md | 2 +- helm/agent-platform/README.md | 2 +- helm/agent-platform/templates/_helpers.tpl | 43 ++++++++----- helm/agent-platform/values.schema.json | 2 +- helm/agent-platform/values.yaml | 22 +++---- skills/agent-platform-tools/SKILL.md | 5 +- tests/verify-tool-approval.py | 71 +++++++++++++--------- 7 files changed, 89 insertions(+), 58 deletions(-) diff --git a/docs/authentication.md b/docs/authentication.md index 624f4368..71eb0c27 100644 --- a/docs/authentication.md +++ b/docs/authentication.md @@ -52,7 +52,7 @@ By default the portal signs people in with the platform's shared client (`global - the portal requests the platform client's audience (`audience:server:client_id:`, added to `backstage.extraScopes`), so the token's `aud` still holds the platform client and every component that trusts it (muster's `trustedAudiences`, the managers' trusted audiences, the API server through `dex-k8s-authenticator`) accepts it unchanged. Its `azp` names the portal's client. On Dex the platform client and `dex-k8s-authenticator` (and any other client whose audience `extraScopes` requests) list the portal's client under `trustedPeers`; - muster keys a forwarded token's session by its client too: a person's connector sign-ins made through the shared client are not the portal's, except subject-scoped ones (`spec.auth.grantScope: subject`). -With a dedicated client and `backstage.signInHandoff` on (the default), the chart lists that client, and only that one, in muster's `approval.handoffClients` (from `agent-platform.muster.handoffFloor`). When a person clicks *Open* on an approval or connector sign-in prompt in portal chat, the portal backend asks muster `POST /handoff-tickets` with the person's token for a one-time ticket bound to that page and person (60 s), and the page opens signed in instead of asking for muster's own sign-in. The trade-off: whoever holds a portal token of a person can open that person's approval page without a browser sign-in; only the portal backend holds such tokens, and deciding still takes the click on muster's page with its anti-forgery, origin and person checks. The shared client is never listed (the render fails if `muster.muster.approval.handoffClients` names it): agents' delegations and CLIs hold its tokens. `backstage.signInHandoff: false` keeps muster's own sign-in on every page. +With a dedicated client and `backstage.signInHandoff` on (the default), the chart lists that client, and only that one, in muster's `approval.trustedClients` (from `agent-platform.muster.trustedClientsFloor`; from `agent-platform.muster.handoffFloor` below it under the earlier name `approval.handoffClients`). muster trusts that client with a person's approvals: a tool approval in portal chat is shown inline and decided on the person's click (*Approve* / *Decline*), the portal backend posting the decision to muster (`POST /approvals/{id}/decision`) with the person's token and the digest of what was shown; and *Open* on a connector sign-in prompt asks muster `POST /handoff-tickets` for a one-time ticket, so the sign-in opens signed in. The trade-off: whoever holds a portal token of a person can approve that person's pending requests without muster's browser sign-in (script injected into the portal could too); only the portal backend holds such tokens and it decides only on the person's click. muster refuses any token naming an acting party, an agent's credential, another client and another person. The shared client is never listed (the render fails if `muster.muster.approval.trustedClients` or `handoffClients` names it): agents' delegations and CLIs hold its tokens. `backstage.signInHandoff: false` keeps every decision and sign-in on muster's own pages. ## 4. Edge JWT validation and JWKS diff --git a/helm/agent-platform/README.md b/helm/agent-platform/README.md index e5bd79d0..bf6e28af 100644 --- a/helm/agent-platform/README.md +++ b/helm/agent-platform/README.md @@ -1657,7 +1657,7 @@ The map is merged into each component's own `nodeSelector` (`muster.nodeSelector | clusterManager.networkPolicy.workloadClusters.ports[1] | int | `6443` | | | clusterManager.networkPolicy.egress.fqdns | list | `[]` | | | clusterManager.networkPolicy.egress.cidrs | list | `[]` | | -| governance | object | `{"mode":"trusted","roleFloors":{}}` | The platform's governance (mode and role floors). The mode, trusted (the default) or governed, changes no tool approval setting's meaning; it adds asking for agent callers. Governed asks a person before an agent runs any tool of a governed server (governedServers below) that is not on that server's safe list (new and renamed tools too), and before any of muster's own tools but its reads; the Dev Portal's connector wizard pre-selects the Recommended preset (read-only tools run, the rest ask). Trusted lets agents run what the connectors' own settings allow and pre-selects Allow all. In both modes muster's built-in floors ask a person before an agent adds or repoints a connector, changes approval settings, grants access, adds a model, egress origin, credential or backend, approves an action or a toolchain source, or changes muster's own configuration; the role floors hold on the governed servers of that role, so governedServers names them in both modes. The meta chart renders muster's governance configuration from it (muster.governance: the mode and governedServers), from the muster release that reads it (agent-platform.muster.governanceFloor); below it `governed` fails the render and trusted renders nothing. From that release the meta chart also renders muster.approval.installation (backstage.installationName, the name the approval page shows; and handoffClients, the portal's own client, with backstage.oidcClientId and backstage.signInHandoff), muster-approval-binder's subject (agent-manager's ServiceAccount, muster.rbac.approvalBinder.subjects) and the pages muster may return the browser to after an approval in muster.oauth.mcpClient.postLoginRedirectAllowlist (the portal's /sessions with backstage.publicPort, klausGateway.obo.callbackBaseUrl + /auth/slack/return; an own list's entries stay). Approval itself needs muster's OAuth server with Dex sign-in, Valkey storage (the default) and muster.muster.oauth.mcpClient.publicUrl on the OAuth server's origin with mcpClient.enabled for the allowlist; the chart does not fail without them, muster refuses asking calls with the reason. The mode is set with this chart value (no agent tool changes it). The block mirrors muster's own governance configuration; a string here (the earlier scalar) fails the render. Further reading (optional): https://docs.giantswarm.io/overview/agent-platform/governing-tool-calls/ | +| governance | object | `{"mode":"trusted","roleFloors":{}}` | The platform's governance (mode and role floors). The mode, trusted (the default) or governed, changes no tool approval setting's meaning; it adds asking for agent callers. Governed asks a person before an agent runs any tool of a governed server (governedServers below) that is not on that server's safe list (new and renamed tools too), and before any of muster's own tools but its reads; the Dev Portal's connector wizard pre-selects the Recommended preset (read-only tools run, the rest ask). Trusted lets agents run what the connectors' own settings allow and pre-selects Allow all. In both modes muster's built-in floors ask a person before an agent adds or repoints a connector, changes approval settings, grants access, adds a model, egress origin, credential or backend, approves an action or a toolchain source, or changes muster's own configuration; the role floors hold on the governed servers of that role, so governedServers names them in both modes. The meta chart renders muster's governance configuration from it (muster.governance: the mode and governedServers), from the muster release that reads it (agent-platform.muster.governanceFloor); below it `governed` fails the render and trusted renders nothing. From that release the meta chart also renders muster.approval.installation (backstage.installationName, the name the approval page shows; and trustedClients, the portal's own client, with backstage.oidcClientId and backstage.signInHandoff), muster-approval-binder's subject (agent-manager's ServiceAccount, muster.rbac.approvalBinder.subjects) and the pages muster may return the browser to after an approval in muster.oauth.mcpClient.postLoginRedirectAllowlist (the portal's /sessions with backstage.publicPort, klausGateway.obo.callbackBaseUrl + /auth/slack/return; an own list's entries stay). Approval itself needs muster's OAuth server with Dex sign-in, Valkey storage (the default) and muster.muster.oauth.mcpClient.publicUrl on the OAuth server's origin with mcpClient.enabled for the allowlist; the chart does not fail without them, muster refuses asking calls with the reason. The mode is set with this chart value (no agent tool changes it). The block mirrors muster's own governance configuration; a string here (the earlier scalar) fails the render. Further reading (optional): https://docs.giantswarm.io/overview/agent-platform/governing-tool-calls/ | | governance.mode | string | `"trusted"` | trusted (the default) or governed; anything else fails the render. | | governance.roleFloors | object | `{}` | Floors per governance role (muster.governance.roleFloors): role -> the server's own tool names that ask agents in both modes on the governed servers of that role, added to muster's built-in floors (config can only add: a built-in floor is never removed). A role named here is a valid `role` of governedServers. For a server the installation registers itself, e.g.: governance: roleFloors: exampleManager: [approve_change, merge_change] governedServers: example-manager: role: exampleManager safe: [get_info, list_changes] Rendered from the muster release that reads the governance configuration (agent-platform.muster.governanceFloor), like governedServers. | | governedServers | object | `{"agent-manager":{"role":"agentManager","safe":["get_info","list_agents","get_agent","get_agent_status","validate_agent","list_model_configs","list_egress_policies","list_skills","list_sessions","get_session","get_session_turn","toolchain_users","list_organizations","get_organization","list_organization_members","list_organization_connectors"]},"cluster-manager":{"role":"clusterManager","safe":["get_info","list_clusters","list_releases","list_node_pools"]},"kagent":{"role":"sessionManager","safe":["list_sessions","list_session_checkpoints","list_sandbox_templates","list_sandboxes","get_sandbox","get_sandbox_process","read_sandbox_outputs","read_sandbox_file"]},"mcp-kubernetes":{"role":"infrastructure","safe":["logs","list_port_forward_sessions","context_list","context_get_current","can_i","api_resources","cluster_health","capi_list_clusters","capi_get_cluster","capi_resolve_cluster","capi_cluster_health","get","list","describe"]},"model-manager":{"role":"modelManager","safe":["get_info","get_backend","list_backends","list_models","get_model","list_loaded_models","list_presets","search_models","check_fit","list_nodes","list_jobs","get_job"]},"skill-manager":{"role":"skillManager","safe":["list_skill_sources","list_skills","resolve_skills","get_skill","get_skill_file"]},"toolchain-manager":{"role":"toolchainManager","safe":["list_sources","list_toolchains","describe_toolchain","toolchain_build_status","search_packages"]},"vm-manager":{"role":"vmManager","safe":["get_info","get_host","list_images","get_image","list_networks","get_network","list_vms","get_vm","get_vm_metrics","get_vm_attestation"]},"workspace-manager":{"role":"workspaceManager","safe":["list_providers","list_owners","list_workspaces","get_workspace","list_repositories","preview_workspace"]}}` | The servers muster governs (muster.governance.governedServers), per source the platform ships: `role` (which of muster's role floors hold on it: agentManager, connectorManager, sessionManager, modelManager, clusterManager, vmManager, workspaceManager, toolchainManager, skillManager, infrastructure, or a role governance.roleFloors declares) and `safe`, the server's own tool names agents call unasked on governed (reads only; a floor never, muster refuses to start on one). Every other tool of a governed server asks agents on governed. A source renders one entry per MCPServer it ships while that renders (agent-platform.muster.governedKeys): a manager component's .muster.mcpServer.name in its namespace; kagent the connectivity chart's kagent server; mcp-kubernetes the connectivity chart's and every agent-platform-mcps kubernetes entry; any other key is a muster server key itself (a server the installation registers, e.g. example-manager). null drops a source (then list it in governanceExempt with the reason). make verify-tool-approval fails on a shipped MCPServer that is neither here nor in governanceExempt, and on a safe entry that names a floor or no tool of its server, or whose name starts with a write verb (create, delete, exec, set, approve, ...) unless a `# safe-write: : ` comment above `safe:` says why it reads. | diff --git a/helm/agent-platform/templates/_helpers.tpl b/helm/agent-platform/templates/_helpers.tpl index 6fe33705..f90ed492 100644 --- a/helm/agent-platform/templates/_helpers.tpl +++ b/helm/agent-platform/templates/_helpers.tpl @@ -2179,6 +2179,11 @@ exists. */ -}} {{- /* The first muster issuing sign-in handoff tickets to the clients of approval.handoffClients (POST /handoff-tickets); UNSET until it exists. */ -}} {{- define "agent-platform.muster.handoffFloor" -}}{{- end -}} +{{- /* The first muster reading approval.trustedClients (handoffClients +renamed; the trusted client also decides approvals inline, POST +/approvals/{id}/decision); UNSET until it exists. Below it, from +handoffFloor, the list renders as handoffClients. */ -}} +{{- define "agent-platform.muster.trustedClientsFloor" -}}{{- end -}} {{/* The session bindings API muster serves agent-manager alone: @@ -2231,7 +2236,7 @@ nothing here would enforce it, so it fails too. Emits nothing. */}} {{- define "agent-platform.validateReleaseFloors" -}} {{- if not (include "agent-platform.muster.governanceFloor" .) -}} -{{- range $name := list "agentManager.toolApprovalFloor" "muster.agentApprovalFloor" "muster.sessionBindingsPortFloor" "agentManager.agentChartV3Floor" "muster.handoffFloor" -}} +{{- range $name := list "agentManager.toolApprovalFloor" "muster.agentApprovalFloor" "muster.sessionBindingsPortFloor" "agentManager.agentChartV3Floor" "muster.handoffFloor" "muster.trustedClientsFloor" -}} {{- if include (printf "agent-platform.%s" $name) $ -}} {{- fail (printf "agent-platform.%s is set while agent-platform.muster.governanceFloor is unset: the muster approval binder, approval block and redirect allowlist render only from the governance floor, so agent-manager would bind settings that muster refuses from it and no Session would start; set agent-platform.muster.governanceFloor in the same release" $name) -}} {{- end -}} @@ -5292,16 +5297,20 @@ muster's approval configuration (muster.approval, rendered as `approval` into config.yaml): installation, the name the approval page shows, from backstage.installationName (the name the portal shows for this platform, default agent-platform) unless muster.muster.approval.installation names its -own; any other own key (ttl) is kept. handoffClients, the OAuth clients -whose bearers may ask muster for a one-time sign-in handoff ticket (the -portal opens muster's approval page and connector sign-in signed in): the -portal's own client (agent-platform.backstage.oidcClient) while the portal is -on with a dedicated client, backstage.signInHandoff is on and muster is at -least agent-platform.muster.handoffFloor; an own list stands. A list naming -the platform's shared client (global.identity.clientId, else muster's login -client) fails the render: every holder of such a token (muster, an agent's -delegation, a CLI) could then skip the page's own sign-in. Only from the muster -floor agent-platform.muster.governanceFloor; {} below it. +own; any other own key (ttl) is kept. trustedClients, the OAuth clients muster +trusts with a person's approvals (the portal decides them inline in chat with +the person's token, and opens muster's connector sign-in signed in through a +one-time handoff ticket): the portal's own client +(agent-platform.backstage.oidcClient) while the portal is on with a dedicated +client, backstage.signInHandoff is on and muster is at least +agent-platform.muster.trustedClientsFloor; from +agent-platform.muster.handoffFloor up to it the same list renders under its +earlier name handoffClients (that muster reads no trustedClients). An own +list under either name stands. A list naming the platform's shared client +(global.identity.clientId, else muster's login client) fails the render: +every holder of such a token (muster, an agent's delegation, a CLI) could then +approve without the page's own sign-in. Only from the muster floor +agent-platform.muster.governanceFloor; {} below it. Usage: include "agent-platform.muster.approval" $root | fromJson */}} {{- define "agent-platform.muster.approval" -}} @@ -5310,11 +5319,17 @@ Usage: include "agent-platform.muster.approval" $root | fromJson {{- $own := dig "muster" "approval" dict (.Values.muster | default dict) | default dict -}} {{- $out = mergeOverwrite (dict "installation" (include "agent-platform.portalInstallationName" .)) $own -}} {{- $portal := include "agent-platform.backstage.oidcClient" . | fromJson -}} -{{- if and (not (hasKey $own "handoffClients")) $portal.dedicated (dig "signInHandoff" true (.Values.backstage | default dict)) (include "agent-platform.componentEnabled" (dict "root" . "name" "backstage")) (include "agent-platform.componentFloorAtLeast" (dict "root" . "name" "muster" "version" (include "agent-platform.muster.handoffFloor" .))) -}} +{{- if and (not (hasKey $own "handoffClients")) (not (hasKey $own "trustedClients")) $portal.dedicated (dig "signInHandoff" true (.Values.backstage | default dict)) (include "agent-platform.componentEnabled" (dict "root" . "name" "backstage")) -}} +{{- if include "agent-platform.componentFloorAtLeast" (dict "root" . "name" "muster" "version" (include "agent-platform.muster.trustedClientsFloor" .)) -}} +{{- $_ := set $out "trustedClients" (list $portal.clientId) -}} +{{- else if include "agent-platform.componentFloorAtLeast" (dict "root" . "name" "muster" "version" (include "agent-platform.muster.handoffFloor" .)) -}} {{- $_ := set $out "handoffClients" (list $portal.clientId) -}} {{- end -}} -{{- if and $portal.platformClientId (has $portal.platformClientId (get $out "handoffClients" | default list)) -}} -{{- fail (printf "muster.muster.approval.handoffClients lists %q, the platform's shared OAuth client: every holder of a token of that client (muster itself, agents acting for a person, CLIs) could open a person's approval page without its sign-in; list only the portal's own client (backstage.oidcClientId)" $portal.platformClientId) -}} +{{- end -}} +{{- range $key := list "trustedClients" "handoffClients" -}} +{{- if and $portal.platformClientId (has $portal.platformClientId (get $out $key | default list)) -}} +{{- fail (printf "muster.muster.approval.%s lists %q, the platform's shared OAuth client: every holder of a token of that client (muster itself, agents acting for a person, CLIs) could approve a person's requests without muster's sign-in; list only the portal's own client (backstage.oidcClientId)" $key $portal.platformClientId) -}} +{{- end -}} {{- end -}} {{- end -}} {{- $out | toJson -}} diff --git a/helm/agent-platform/values.schema.json b/helm/agent-platform/values.schema.json index b7fe4a64..5eb57f2a 100644 --- a/helm/agent-platform/values.schema.json +++ b/helm/agent-platform/values.schema.json @@ -2166,7 +2166,7 @@ }, "governance": { "type": "object", - "description": "The platform's governance (mode and role floors). The mode, trusted (the default) or governed, changes no tool approval setting's meaning; it adds asking for agent callers. Governed asks a person before an agent runs any tool of a governed server (governedServers below) that is not on that server's safe list (new and renamed tools too), and before any of muster's own tools but its reads; the Dev Portal's connector wizard pre-selects the Recommended preset (read-only tools run, the rest ask). Trusted lets agents run what the connectors' own settings allow and pre-selects Allow all. In both modes muster's built-in floors ask a person before an agent adds or repoints a connector, changes approval settings, grants access, adds a model, egress origin, credential or backend, approves an action or a toolchain source, or changes muster's own configuration; the role floors hold on the governed servers of that role, so governedServers names them in both modes. The meta chart renders muster's governance configuration from it (muster.governance: the mode and governedServers), from the muster release that reads it (agent-platform.muster.governanceFloor); below it `governed` fails the render and trusted renders nothing. From that release the meta chart also renders muster.approval.installation (backstage.installationName, the name the approval page shows; and handoffClients, the portal's own client, with backstage.oidcClientId and backstage.signInHandoff), muster-approval-binder's subject (agent-manager's ServiceAccount, muster.rbac.approvalBinder.subjects) and the pages muster may return the browser to after an approval in muster.oauth.mcpClient.postLoginRedirectAllowlist (the portal's /sessions with backstage.publicPort, klausGateway.obo.callbackBaseUrl + /auth/slack/return; an own list's entries stay). Approval itself needs muster's OAuth server with Dex sign-in, Valkey storage (the default) and muster.muster.oauth.mcpClient.publicUrl on the OAuth server's origin with mcpClient.enabled for the allowlist; the chart does not fail without them, muster refuses asking calls with the reason. The mode is set with this chart value (no agent tool changes it). The block mirrors muster's own governance configuration; a string here (the earlier scalar) fails the render. Further reading (optional): https://docs.giantswarm.io/overview/agent-platform/governing-tool-calls/", + "description": "The platform's governance (mode and role floors). The mode, trusted (the default) or governed, changes no tool approval setting's meaning; it adds asking for agent callers. Governed asks a person before an agent runs any tool of a governed server (governedServers below) that is not on that server's safe list (new and renamed tools too), and before any of muster's own tools but its reads; the Dev Portal's connector wizard pre-selects the Recommended preset (read-only tools run, the rest ask). Trusted lets agents run what the connectors' own settings allow and pre-selects Allow all. In both modes muster's built-in floors ask a person before an agent adds or repoints a connector, changes approval settings, grants access, adds a model, egress origin, credential or backend, approves an action or a toolchain source, or changes muster's own configuration; the role floors hold on the governed servers of that role, so governedServers names them in both modes. The meta chart renders muster's governance configuration from it (muster.governance: the mode and governedServers), from the muster release that reads it (agent-platform.muster.governanceFloor); below it `governed` fails the render and trusted renders nothing. From that release the meta chart also renders muster.approval.installation (backstage.installationName, the name the approval page shows; and trustedClients, the portal's own client, with backstage.oidcClientId and backstage.signInHandoff), muster-approval-binder's subject (agent-manager's ServiceAccount, muster.rbac.approvalBinder.subjects) and the pages muster may return the browser to after an approval in muster.oauth.mcpClient.postLoginRedirectAllowlist (the portal's /sessions with backstage.publicPort, klausGateway.obo.callbackBaseUrl + /auth/slack/return; an own list's entries stay). Approval itself needs muster's OAuth server with Dex sign-in, Valkey storage (the default) and muster.muster.oauth.mcpClient.publicUrl on the OAuth server's origin with mcpClient.enabled for the allowlist; the chart does not fail without them, muster refuses asking calls with the reason. The mode is set with this chart value (no agent tool changes it). The block mirrors muster's own governance configuration; a string here (the earlier scalar) fails the render. Further reading (optional): https://docs.giantswarm.io/overview/agent-platform/governing-tool-calls/", "additionalProperties": false, "properties": { "mode": { diff --git a/helm/agent-platform/values.yaml b/helm/agent-platform/values.yaml index b4c4a9c1..3de8ec78 100644 --- a/helm/agent-platform/values.yaml +++ b/helm/agent-platform/values.yaml @@ -5869,7 +5869,7 @@ clusterManager: # @schema skipProperties: true; additionalProperties: true # that reads it (agent-platform.muster.governanceFloor); below it `governed` # fails the render and trusted renders nothing. From that release the meta # chart also renders muster.approval.installation (backstage.installationName, -# the name the approval page shows; and handoffClients, the portal's own +# the name the approval page shows; and trustedClients, the portal's own # client, with backstage.oidcClientId and backstage.signInHandoff), muster-approval-binder's subject # (agent-manager's ServiceAccount, muster.rbac.approvalBinder.subjects) and # the pages muster may return the browser to after an approval in @@ -6957,16 +6957,16 @@ backstage: # @schema skipProperties: true; additionalProperties: true # sessions by the token's client too, so a person's connector sign-ins of # the shared client are not the portal's (subject-scoped ones are). oidcClientId: "" - # Sign-in handoff: with a dedicated oidcClientId, muster gives the portal's - # backend a one-time ticket (muster.approval.handoffClients) when a person - # clicks Open on an approval or connector sign-in prompt in chat, and the - # page opens signed in instead of asking the person to sign in to muster - # again. The trade-off: whoever holds a portal token of a person (only the - # portal backend, by design) can open that person's approval page without - # a browser sign-in; deciding still takes the click on muster's page, with - # its anti-forgery and origin checks. false keeps muster's own sign-in on - # every page. Without a dedicated client nothing is listed: the shared - # client is held by muster, agents and CLIs as well. + # muster trusts the portal with a person's approvals: with a dedicated + # oidcClientId the chart lists it in muster.approval.trustedClients, so the + # portal shows a tool approval in chat and decides it on the person's click + # (Approve / Decline, with the person's token), and opens muster's connector + # sign-in signed in through a one-time ticket. The trade-off: whoever holds a + # portal token of a person (only the portal backend, by design) can approve + # that person's pending requests without muster's browser sign-in; the + # portal decides only on the person's click. false keeps every decision and + # sign-in on muster's own pages. Without a dedicated client nothing is + # listed: the shared client is held by muster, agents and CLIs as well. signInHandoff: true # Extra query parameters on the login provider's authorize request. Dex needs # none; Google needs access_type: offline and prompt: consent for a refresh diff --git a/skills/agent-platform-tools/SKILL.md b/skills/agent-platform-tools/SKILL.md index 0b3b5b88..59eb8f45 100644 --- a/skills/agent-platform-tools/SKILL.md +++ b/skills/agent-platform-tools/SKILL.md @@ -139,8 +139,9 @@ https://docs.giantswarm.io/tutorials/agent-platform/connecting-custom-mcp-server Further reading (optional): https://docs.giantswarm.io/overview/agent-platform/governing-tool-calls/. Every tool has one setting, decided by Muster on every call, whoever calls (an agent, the portal, Slack, Claude Code): -- **Allow** runs. **Ask**: a person confirms the exact call on Muster's approval page first; the - call then runs once. **Block**: hidden, absent from `filter_tools`, refused as not found. +- **Allow** runs. **Ask**: a person confirms the exact call first (in portal chat, where the request + is shown with Approve / Decline, or on Muster's approval page); the call then runs once. An agent + cannot decide its own request: Muster takes decisions only from the person. **Block**: hidden, absent from `filter_tools`, refused as not found. - A connector carries `spec.approval`: a `rule` (`Allow`, `Ask` or `Block`) that every tool without its own entry follows — **new tools follow the rule**, so a `Block` rule hides every tool nobody has reviewed yet — and per-tool entries by the server's own tool name (no `x__` prefix). diff --git a/tests/verify-tool-approval.py b/tests/verify-tool-approval.py index 804c094c..7824bba8 100755 --- a/tests/verify-tool-approval.py +++ b/tests/verify-tool-approval.py @@ -27,10 +27,12 @@ /auth/slack/return with its port while klaus-gateway is on and names it; invalid ports and URLs fail; own entries stay, first, once each; none below the floor. -- sign-in handoff: muster.approval.handoffClients is the portal's own client +- trusted clients: muster.approval.trustedClients is the portal's own client (backstage.oidcClientId, when it differs from the platform's shared client) while the portal is on, backstage.signInHandoff is on and muster is at least - agent-platform.muster.handoffFloor; an own list stands; a list naming the + agent-platform.muster.trustedClientsFloor; from + agent-platform.muster.handoffFloor below it the list renders as + handoffClients; an own list under either name stands; a list naming the shared client fails; the backstage release mounts portal-dex-client-secret and the connectivity app-config signs in with that client, requesting the platform client's audience. @@ -737,7 +739,7 @@ def check_approval() -> None: #. TEST_FLOORS = {"muster.governanceFloor": "5.65.0", "muster.agentApprovalFloor": "5.66.0", "agentManager.toolApprovalFloor": "3.6.0", "muster.sessionBindingsPortFloor": "5.66.0", - "muster.handoffFloor": "5.68.0"} + "muster.handoffFloor": "5.68.0", "muster.trustedClientsFloor": "5.69.0"} def with_test_floors(meta_dir: str, dst: str) -> str: @@ -773,7 +775,7 @@ def check_floor_dependencies() -> None: """The floors that need the governance wiring fail the render while the governance floor is unset, whichever of them is set; governed mode and role floors fail with muster off.""" - dependent = ["agentManager.toolApprovalFloor", "muster.agentApprovalFloor", "muster.sessionBindingsPortFloor", "agentManager.agentChartV3Floor", "muster.handoffFloor"] + dependent = ["agentManager.toolApprovalFloor", "muster.agentApprovalFloor", "muster.sessionBindingsPortFloor", "agentManager.agentChartV3Floor", "muster.handoffFloor", "muster.trustedClientsFloor"] values = {**TEST_FLOORS, "agentManager.agentChartV3Floor": "3.6.0"} with tempfile.TemporaryDirectory(prefix="verify-floor-deps-") as tmp: for i, name in enumerate(dependent): @@ -830,10 +832,11 @@ def check_unset_floors_keep_everything_off() -> None: fail("with muster's agent approval floor unset agent-manager must bind no settings") if "muster.sessionBindingsPortFloor" in unset and block(muster, " sessionBindings:"): fail("with the session bindings floor unset muster must keep its earlier bindings wiring") - if "muster.handoffFloor" in unset: + if "muster.handoffFloor" in unset and "muster.trustedClientsFloor" in unset: portal = render_meta(high + PORTAL_CLIENT + ["--set", "backstage.oidcClientId=platform-portal"]) - if "handoffClients" in (doc(portal, "HelmRelease", "muster") or ""): - fail("with the handoff floor unset muster must list no sign-in handoff client") + release = doc(portal, "HelmRelease", "muster") or "" + if "handoffClients" in release or "trustedClients" in release: + fail("with the handoff and trusted-clients floors unset muster must list no trusted client") print(f"ok: unset floors ({', '.join(unset)}) keep what they gate off for any muster and agent-manager range; `governed` fails") @@ -938,21 +941,29 @@ def releases(args: list[str]) -> tuple[str, str, str]: def check_handoff_clients() -> None: - """muster.approval.handoffClients lists the portal's own client + """muster.approval.trustedClients lists the portal's own client (backstage.oidcClientId) while it differs from the platform's shared client, the portal is on, backstage.signInHandoff is on and muster is at - least agent-platform.muster.handoffFloor; an own list stands; a list - naming the shared client fails the render.""" - handoff = f"components.muster.versionRange=>={TEST_FLOORS['muster.handoffFloor']} <6.0.0-0" - header = " handoffClients:" - - def clients(args: list[str], floor: str = handoff) -> list[str]: - got = block(muster_release(["--set", floor, *PORTAL_CLIENT, *args]), header) + least agent-platform.muster.trustedClientsFloor; from + agent-platform.muster.handoffFloor below it the list renders as + handoffClients (that muster reads no trustedClients); an own list under + either name stands; a list naming the shared client fails the render.""" + trusted = f"components.muster.versionRange=>={TEST_FLOORS['muster.trustedClientsFloor']} <6.0.0-0" + handoff = f"components.muster.versionRange=>={TEST_FLOORS['muster.handoffFloor']} <{TEST_FLOORS['muster.trustedClientsFloor']}" + + def clients(args: list[str], floor: str = trusted, key: str = "trustedClients") -> list[str]: + release = muster_release(["--set", floor, *PORTAL_CLIENT, *args]) + other = "handoffClients" if key == "trustedClients" else "trustedClients" + if block(release, f" {other}:"): + fail(f"muster's approval must not carry {other} when {key} is expected") + got = block(release, f" {key}:") return [l.strip() for l in got.split("\n")[1:] if l.strip()] dedicated = ["--set", "backstage.oidcClientId=platform-portal"] if clients(dedicated) != ["- platform-portal"]: - fail(f"a dedicated portal client must be muster's one handoff client, got {clients(dedicated)}") + fail(f"a dedicated portal client must be muster's one trusted client, got {clients(dedicated)}") + if clients(dedicated, handoff, "handoffClients") != ["- platform-portal"]: + fail("below the trusted-clients floor, from the handoff floor, the list must render as handoffClients") for args, why in ( ([], "the portal on the shared client"), (["--set", "backstage.oidcClientId=platform"], "backstage.oidcClientId equal to the shared client"), @@ -960,21 +971,25 @@ def clients(args: list[str], floor: str = handoff) -> list[str]: (dedicated + ["--set", "components.backstage.enabled=false"], "the portal off"), ): if clients(args): - fail(f"{why}: no handoff client expected, got {clients(args)}") - if clients(dedicated, FLOOR_RANGE): - fail("below the handoff floor muster must list no handoff client") - own = clients(dedicated + ["--set", "muster.muster.approval.handoffClients[0]=other-portal"]) + fail(f"{why}: no trusted client expected, got {clients(args)}") + if clients(dedicated, FLOOR_RANGE) or clients(dedicated, FLOOR_RANGE, "handoffClients"): + fail("below the handoff floor muster must list no trusted client") + own = clients(dedicated + ["--set", "muster.muster.approval.trustedClients[0]=other-portal"]) + if own != ["- other-portal"]: + fail(f"an own trustedClients list must stand, got {own}") + own = clients(dedicated + ["--set", "muster.muster.approval.handoffClients[0]=other-portal"], key="handoffClients") if own != ["- other-portal"]: - fail(f"an own handoffClients list must stand, got {own}") - if clients(dedicated + ["--set-json", "muster.muster.approval.handoffClients=[]"]): - fail("an own empty handoffClients list must stand (no tickets)") - err = render(META_DIR, META + ["--set", handoff, *PORTAL_CLIENT, "--set", "muster.muster.approval.handoffClients[0]=platform"], expect_fail=True) - if 'handoffClients lists "platform", the platform\'s shared OAuth client' not in err: - fail(f"a handoff list naming the shared client must fail the render:\n{err}") - rel = doc(render_meta(["--set", handoff, *PORTAL_CLIENT, *dedicated]), "HelmRelease", "backstage") or "" + fail(f"an own handoffClients list (the earlier name) must stand, got {own}") + if clients(dedicated + ["--set-json", "muster.muster.approval.trustedClients=[]"]): + fail("an own empty trustedClients list must stand (no trusted client)") + for key in ("trustedClients", "handoffClients"): + err = render(META_DIR, META + ["--set", trusted, *PORTAL_CLIENT, "--set", f"muster.muster.approval.{key}[0]=platform"], expect_fail=True) + if f'{key} lists "platform", the platform\'s shared OAuth client' not in err: + fail(f"a {key} list naming the shared client must fail the render:\n{err}") + rel = doc(render_meta(["--set", trusted, *PORTAL_CLIENT, *dedicated]), "HelmRelease", "backstage") or "" if "key: portal-dex-client-secret" not in rel or "optional: true" not in rel: fail("the backstage release must mount the portal's own client secret (portal-dex-client-secret, optional)") - print("ok: muster.approval.handoffClients is the portal's dedicated client from the handoff floor (none on the shared client, with signInHandoff false, the portal off or below the floor), an own list stands, the shared client fails") + print("ok: muster.approval.trustedClients is the portal's dedicated client from the trusted-clients floor (handoffClients from the handoff floor below it; none on the shared client, with signInHandoff false, the portal off or below the floors), an own list under either name stands, the shared client fails") def check_portal_client_app_config() -> None: From c6d0c775a1ce1c89317df51c51858aeb131f7a9f Mon Sep 17 00:00:00 2001 From: Dominik Schmidle Date: Thu, 26 Nov 2026 23:23:09 +0100 Subject: [PATCH 48/56] fix(approval): bind the portal's workload for muster's inline decisions and trust only its dedicated client From agent-platform.muster.trustedClientsFloor, while muster trusts the portal's client, the muster release binds muster-approval-decider (verb decide on toolapprovals) to the portal's ServiceAccount and nothing else (muster.rbac.approvalDecider.subjects, an own list stands), and the backstage release projects that ServiceAccount's token for audience muster at /var/run/secrets/muster.giantswarm.io/serviceaccount/token, beside its own extra volumes. muster takes a person's portal token on its decision API and handoff endpoint only with that workload token. muster.approval.trustedClients and handoffClients may name only the portal's dedicated client: any other id fails the render (the shared client as before, and now dex-k8s-authenticator, the kagent UI's or klaus-gateway's client, a CLI's), in an own list as well. --- docs/authentication.md | 4 +- helm/agent-platform/README.md | 2 +- helm/agent-platform/templates/_helpers.tpl | 87 ++++++++++++++++++-- helm/agent-platform/values.schema.json | 2 +- helm/agent-platform/values.yaml | 24 ++++-- skills/agent-platform-tools/SKILL.md | 3 +- tests/verify-tool-approval.py | 92 +++++++++++++++++++--- 7 files changed, 186 insertions(+), 28 deletions(-) diff --git a/docs/authentication.md b/docs/authentication.md index 71eb0c27..7a8722b9 100644 --- a/docs/authentication.md +++ b/docs/authentication.md @@ -52,7 +52,9 @@ By default the portal signs people in with the platform's shared client (`global - the portal requests the platform client's audience (`audience:server:client_id:`, added to `backstage.extraScopes`), so the token's `aud` still holds the platform client and every component that trusts it (muster's `trustedAudiences`, the managers' trusted audiences, the API server through `dex-k8s-authenticator`) accepts it unchanged. Its `azp` names the portal's client. On Dex the platform client and `dex-k8s-authenticator` (and any other client whose audience `extraScopes` requests) list the portal's client under `trustedPeers`; - muster keys a forwarded token's session by its client too: a person's connector sign-ins made through the shared client are not the portal's, except subject-scoped ones (`spec.auth.grantScope: subject`). -With a dedicated client and `backstage.signInHandoff` on (the default), the chart lists that client, and only that one, in muster's `approval.trustedClients` (from `agent-platform.muster.trustedClientsFloor`; from `agent-platform.muster.handoffFloor` below it under the earlier name `approval.handoffClients`). muster trusts that client with a person's approvals: a tool approval in portal chat is shown inline and decided on the person's click (*Approve* / *Decline*), the portal backend posting the decision to muster (`POST /approvals/{id}/decision`) with the person's token and the digest of what was shown; and *Open* on a connector sign-in prompt asks muster `POST /handoff-tickets` for a one-time ticket, so the sign-in opens signed in. The trade-off: whoever holds a portal token of a person can approve that person's pending requests without muster's browser sign-in (script injected into the portal could too); only the portal backend holds such tokens and it decides only on the person's click. muster refuses any token naming an acting party, an agent's credential, another client and another person. The shared client is never listed (the render fails if `muster.muster.approval.trustedClients` or `handoffClients` names it): agents' delegations and CLIs hold its tokens. `backstage.signInHandoff: false` keeps every decision and sign-in on muster's own pages. +With a dedicated client and `backstage.signInHandoff` on (the default), the chart lists that client, and only that one, in muster's `approval.trustedClients` (from `agent-platform.muster.trustedClientsFloor`; from `agent-platform.muster.handoffFloor` below it under the earlier name `approval.handoffClients`). muster trusts that client with a person's approvals: a tool approval in portal chat is shown inline and decided on the person's click (*Approve* / *Decline*), the portal backend posting the decision to muster (`POST /approvals/{id}/decision`) with the person's token and the digest of what was shown; and *Open* on a connector sign-in prompt asks muster `POST /handoff-tickets` for a one-time ticket, so the sign-in opens signed in. A person's portal token is not held by the portal backend alone: the browser resolves it and sends it to the backend, muster forwards it to `forwardToken` servers, and a runtime handed the caller's credential holds it. So muster takes it on these two endpoints only together with the portal backend's own workload identity: its projected ServiceAccount token (audience `muster`), sent in `X-Muster-Approval-Client`, which muster reviews with a `TokenReview` and a `LocalSubjectAccessReview` for verb `decide` on `toolapprovals.muster.giantswarm.io` in muster's namespace. From the same floor the chart binds the muster chart's Role `muster-approval-decider` to the portal's ServiceAccount (`backstage.name`, default `backstage`, in the portal's namespace; `muster.rbac.approvalDecider.subjects`, an own list stands) and nothing else, and projects that token into the portal's pod at `/var/run/secrets/muster.giantswarm.io/serviceaccount/token`, where its muster backend reads it. The person's token proves who decides, the workload token that the portal backend presents it: either alone decides nothing and mints no ticket. The remaining trade-off: the portal backend can approve a person's pending requests without muster's browser sign-in (script injected into the portal can ask it to); it decides only on the person's click. muster refuses any token naming an acting party, an agent's credential, another client, another workload and another person. A connector sign-in opened through a handoff ticket still asks the browser on muster's own page (*Connect as ?*) before it goes on, so a link passed to someone else's browser connects nothing unseen. Only the portal's dedicated client may be listed: the render fails when `muster.muster.approval.trustedClients` or `handoffClients` names any other id, the shared client (agents' delegations and CLIs hold its tokens), `dex-k8s-authenticator`, the kagent UI's or klaus-gateway's client, or a CLI's. `backstage.signInHandoff: false` keeps every decision and sign-in on muster's own pages. + +`agentlab portal dev` (a portal running from a checkout on the developer's machine against the lab) has no projected token: agentlab mints one for the lab portal's ServiceAccount (TokenRequest, audience `muster`) on every start and points the portal's `muster.workloadTokenFile` at it, so inline approval works there as in the cluster. That token is lab-only and the lab's to mint; never copy an installation's portal token to a laptop. ## 4. Edge JWT validation and JWKS diff --git a/helm/agent-platform/README.md b/helm/agent-platform/README.md index bf6e28af..afabbfea 100644 --- a/helm/agent-platform/README.md +++ b/helm/agent-platform/README.md @@ -1657,7 +1657,7 @@ The map is merged into each component's own `nodeSelector` (`muster.nodeSelector | clusterManager.networkPolicy.workloadClusters.ports[1] | int | `6443` | | | clusterManager.networkPolicy.egress.fqdns | list | `[]` | | | clusterManager.networkPolicy.egress.cidrs | list | `[]` | | -| governance | object | `{"mode":"trusted","roleFloors":{}}` | The platform's governance (mode and role floors). The mode, trusted (the default) or governed, changes no tool approval setting's meaning; it adds asking for agent callers. Governed asks a person before an agent runs any tool of a governed server (governedServers below) that is not on that server's safe list (new and renamed tools too), and before any of muster's own tools but its reads; the Dev Portal's connector wizard pre-selects the Recommended preset (read-only tools run, the rest ask). Trusted lets agents run what the connectors' own settings allow and pre-selects Allow all. In both modes muster's built-in floors ask a person before an agent adds or repoints a connector, changes approval settings, grants access, adds a model, egress origin, credential or backend, approves an action or a toolchain source, or changes muster's own configuration; the role floors hold on the governed servers of that role, so governedServers names them in both modes. The meta chart renders muster's governance configuration from it (muster.governance: the mode and governedServers), from the muster release that reads it (agent-platform.muster.governanceFloor); below it `governed` fails the render and trusted renders nothing. From that release the meta chart also renders muster.approval.installation (backstage.installationName, the name the approval page shows; and trustedClients, the portal's own client, with backstage.oidcClientId and backstage.signInHandoff), muster-approval-binder's subject (agent-manager's ServiceAccount, muster.rbac.approvalBinder.subjects) and the pages muster may return the browser to after an approval in muster.oauth.mcpClient.postLoginRedirectAllowlist (the portal's /sessions with backstage.publicPort, klausGateway.obo.callbackBaseUrl + /auth/slack/return; an own list's entries stay). Approval itself needs muster's OAuth server with Dex sign-in, Valkey storage (the default) and muster.muster.oauth.mcpClient.publicUrl on the OAuth server's origin with mcpClient.enabled for the allowlist; the chart does not fail without them, muster refuses asking calls with the reason. The mode is set with this chart value (no agent tool changes it). The block mirrors muster's own governance configuration; a string here (the earlier scalar) fails the render. Further reading (optional): https://docs.giantswarm.io/overview/agent-platform/governing-tool-calls/ | +| governance | object | `{"mode":"trusted","roleFloors":{}}` | The platform's governance (mode and role floors). The mode, trusted (the default) or governed, changes no tool approval setting's meaning; it adds asking for agent callers. Governed asks a person before an agent runs any tool of a governed server (governedServers below) that is not on that server's safe list (new and renamed tools too), and before any of muster's own tools but its reads; the Dev Portal's connector wizard pre-selects the Recommended preset (read-only tools run, the rest ask). Trusted lets agents run what the connectors' own settings allow and pre-selects Allow all. In both modes muster's built-in floors ask a person before an agent adds or repoints a connector, changes approval settings, grants access, adds a model, egress origin, credential or backend, approves an action or a toolchain source, or changes muster's own configuration; the role floors hold on the governed servers of that role, so governedServers names them in both modes. The meta chart renders muster's governance configuration from it (muster.governance: the mode and governedServers), from the muster release that reads it (agent-platform.muster.governanceFloor); below it `governed` fails the render and trusted renders nothing. From that release the meta chart also renders muster.approval.installation (backstage.installationName, the name the approval page shows; and trustedClients, the portal's own client, with backstage.oidcClientId and backstage.signInHandoff), muster-approval-binder's subject (agent-manager's ServiceAccount, muster.rbac.approvalBinder.subjects), muster-approval-decider's subject (the portal's ServiceAccount, muster.rbac.approvalDecider.subjects, with its token projected into the portal for audience muster, while muster trusts the portal's client) and the pages muster may return the browser to after an approval in muster.oauth.mcpClient.postLoginRedirectAllowlist (the portal's /sessions with backstage.publicPort, klausGateway.obo.callbackBaseUrl + /auth/slack/return; an own list's entries stay). Approval itself needs muster's OAuth server with Dex sign-in, Valkey storage (the default) and muster.muster.oauth.mcpClient.publicUrl on the OAuth server's origin with mcpClient.enabled for the allowlist; the chart does not fail without them, muster refuses asking calls with the reason. The mode is set with this chart value (no agent tool changes it). The block mirrors muster's own governance configuration; a string here (the earlier scalar) fails the render. Further reading (optional): https://docs.giantswarm.io/overview/agent-platform/governing-tool-calls/ | | governance.mode | string | `"trusted"` | trusted (the default) or governed; anything else fails the render. | | governance.roleFloors | object | `{}` | Floors per governance role (muster.governance.roleFloors): role -> the server's own tool names that ask agents in both modes on the governed servers of that role, added to muster's built-in floors (config can only add: a built-in floor is never removed). A role named here is a valid `role` of governedServers. For a server the installation registers itself, e.g.: governance: roleFloors: exampleManager: [approve_change, merge_change] governedServers: example-manager: role: exampleManager safe: [get_info, list_changes] Rendered from the muster release that reads the governance configuration (agent-platform.muster.governanceFloor), like governedServers. | | governedServers | object | `{"agent-manager":{"role":"agentManager","safe":["get_info","list_agents","get_agent","get_agent_status","validate_agent","list_model_configs","list_egress_policies","list_skills","list_sessions","get_session","get_session_turn","toolchain_users","list_organizations","get_organization","list_organization_members","list_organization_connectors"]},"cluster-manager":{"role":"clusterManager","safe":["get_info","list_clusters","list_releases","list_node_pools"]},"kagent":{"role":"sessionManager","safe":["list_sessions","list_session_checkpoints","list_sandbox_templates","list_sandboxes","get_sandbox","get_sandbox_process","read_sandbox_outputs","read_sandbox_file"]},"mcp-kubernetes":{"role":"infrastructure","safe":["logs","list_port_forward_sessions","context_list","context_get_current","can_i","api_resources","cluster_health","capi_list_clusters","capi_get_cluster","capi_resolve_cluster","capi_cluster_health","get","list","describe"]},"model-manager":{"role":"modelManager","safe":["get_info","get_backend","list_backends","list_models","get_model","list_loaded_models","list_presets","search_models","check_fit","list_nodes","list_jobs","get_job"]},"skill-manager":{"role":"skillManager","safe":["list_skill_sources","list_skills","resolve_skills","get_skill","get_skill_file"]},"toolchain-manager":{"role":"toolchainManager","safe":["list_sources","list_toolchains","describe_toolchain","toolchain_build_status","search_packages"]},"vm-manager":{"role":"vmManager","safe":["get_info","get_host","list_images","get_image","list_networks","get_network","list_vms","get_vm","get_vm_metrics","get_vm_attestation"]},"workspace-manager":{"role":"workspaceManager","safe":["list_providers","list_owners","list_workspaces","get_workspace","list_repositories","preview_workspace"]}}` | The servers muster governs (muster.governance.governedServers), per source the platform ships: `role` (which of muster's role floors hold on it: agentManager, connectorManager, sessionManager, modelManager, clusterManager, vmManager, workspaceManager, toolchainManager, skillManager, infrastructure, or a role governance.roleFloors declares) and `safe`, the server's own tool names agents call unasked on governed (reads only; a floor never, muster refuses to start on one). Every other tool of a governed server asks agents on governed. A source renders one entry per MCPServer it ships while that renders (agent-platform.muster.governedKeys): a manager component's .muster.mcpServer.name in its namespace; kagent the connectivity chart's kagent server; mcp-kubernetes the connectivity chart's and every agent-platform-mcps kubernetes entry; any other key is a muster server key itself (a server the installation registers, e.g. example-manager). null drops a source (then list it in governanceExempt with the reason). make verify-tool-approval fails on a shipped MCPServer that is neither here nor in governanceExempt, and on a safe entry that names a floor or no tool of its server, or whose name starts with a write verb (create, delete, exec, set, approve, ...) unless a `# safe-write: : ` comment above `safe:` says why it reads. | diff --git a/helm/agent-platform/templates/_helpers.tpl b/helm/agent-platform/templates/_helpers.tpl index f90ed492..d6307dea 100644 --- a/helm/agent-platform/templates/_helpers.tpl +++ b/helm/agent-platform/templates/_helpers.tpl @@ -696,6 +696,19 @@ connectivity release's values stay those of a chart without the operator. */ -}} {{- $_ := set $derived "agentPlatformOrganizations" (dict "operator" (include "agent-platform.organizations.operator" .root | fromJson)) -}} {{- end -}} {{- end -}} +{{- if eq .name "backstage" -}} +{{- /* The portal backend's own workload token for muster (audience muster), +projected where its muster backend reads it, while the platform binds the +portal's ServiceAccount to muster-approval-decider +(agent-platform.backstage.musterWorkloadToken). Appended to the block's own +extraVolumes and extraVolumeMounts, which derived values would replace. */ -}} +{{- with (include "agent-platform.backstage.musterWorkloadToken" .root | fromJson) -}} +{{- $own := dig "backstage" dict ($.root.Values.backstage | default dict) | default dict -}} +{{- $volumes := append (dig "extraVolumes" list $own | default list) .volume -}} +{{- $mounts := append (dig "extraVolumeMounts" list $own | default list) .mount -}} +{{- $_ := set $derived "backstage" (dict "extraVolumes" $volumes "extraVolumeMounts" $mounts) -}} +{{- end -}} +{{- end -}} {{- if eq .name "toolchain-manager" -}} {{- $derived = include "agent-platform.toolchainManager.derived" .root | fromJson -}} {{- end -}} @@ -1138,6 +1151,14 @@ bound to muster-approval-binder by the muster chart in muster's namespace. */ -} {{- $_ := set $rbac "approvalBinder" (dict "subjects" .) -}} {{- $_ := set $derived "rbac" $rbac -}} {{- end -}} +{{- /* The portal's ServiceAccount, the one workload muster takes a person's +approval decision and handoff request from (beside the person's token), +bound to muster-approval-decider by the muster chart in muster's namespace. */ -}} +{{- with (include "agent-platform.muster.approvalDeciderSubjects" .root | fromJsonArray) -}} +{{- $rbac := get $derived "rbac" | default dict -}} +{{- $_ := set $rbac "approvalDecider" (dict "subjects" .) -}} +{{- $_ := set $derived "rbac" $rbac -}} +{{- end -}} {{- with (include "agent-platform.muster.redirectAllowlist" .root | fromJsonArray) -}} {{- $muster := get $derived "muster" | default dict -}} {{- $_ := set $derived "muster" (mergeOverwrite $muster (dict "oauth" (dict "mcpClient" (dict "postLoginRedirectAllowlist" .)))) -}} @@ -2181,8 +2202,10 @@ approval.handoffClients (POST /handoff-tickets); UNSET until it exists. */ -}} {{- define "agent-platform.muster.handoffFloor" -}}{{- end -}} {{- /* The first muster reading approval.trustedClients (handoffClients renamed; the trusted client also decides approvals inline, POST -/approvals/{id}/decision); UNSET until it exists. Below it, from -handoffFloor, the list renders as handoffClients. */ -}} +/approvals/{id}/decision) and reviewing the trusted client's own workload +token (verb decide, muster-approval-decider; giantswarm/muster#1912); UNSET +until it exists. Below it, from handoffFloor, the list renders as +handoffClients. */ -}} {{- define "agent-platform.muster.trustedClientsFloor" -}}{{- end -}} {{/* @@ -5292,6 +5315,49 @@ Usage: include "agent-platform.muster.approvalBinderSubjects" $root | fromJsonAr {{- $out | toJson -}} {{- end -}} +{{/* +muster's approval-decider subjects (muster.rbac.approvalDecider.subjects): the +muster chart ships the Role muster-approval-decider (verb decide on +toolapprovals) and binds it, in muster's namespace where muster's workload +review asks, to these subjects. muster takes a trusted client's decision or +handoff request only with that client's own workload token beside the +person's (IA-01 of the inline approval security review). The platform binds +the portal's ServiceAccount (backstage.name, default backstage, in the +portal's namespace) and nothing else, while the portal is on and muster's +approval trusts a client (agent-platform.muster.approval renders +trustedClients) from agent-platform.muster.trustedClientsFloor, the first +muster that reviews the workload. An own muster.rbac.approvalDecider.subjects +stands. [] otherwise. +Usage: include "agent-platform.muster.approvalDeciderSubjects" $root | fromJsonArray +*/}} +{{- define "agent-platform.muster.approvalDeciderSubjects" -}} +{{- $out := list -}} +{{- if and (include "agent-platform.componentFloorAtLeast" (dict "root" . "name" "muster" "version" (include "agent-platform.muster.trustedClientsFloor" .))) (include "agent-platform.componentEnabled" (dict "root" . "name" "backstage")) (not (dig "rbac" "approvalDecider" "subjects" list (.Values.muster | default dict))) -}} +{{- with (include "agent-platform.muster.approval" . | fromJson).trustedClients -}} +{{- $name := dig "name" "backstage" ($.Values.backstage | default dict) | default "backstage" -}} +{{- $out = list (dict "kind" "ServiceAccount" "name" $name "namespace" (include "agent-platform.componentNamespace" (dict "root" $ "name" "backstage"))) -}} +{{- end -}} +{{- end -}} +{{- $out | toJson -}} +{{- end -}} + +{{/* +The portal backend's projected ServiceAccount token for muster (audience +muster, an hour, rotated by the kubelet), at the path its muster backend +reads by default (/var/run/secrets/muster.giantswarm.io/serviceaccount/token), +while the platform binds the portal's ServiceAccount to muster-approval-decider +(agent-platform.muster.approvalDeciderSubjects). Emits JSON {volume, mount}, +or {} otherwise. +Usage: include "agent-platform.backstage.musterWorkloadToken" $root | fromJson +*/}} +{{- define "agent-platform.backstage.musterWorkloadToken" -}} +{{- if include "agent-platform.muster.approvalDeciderSubjects" . | fromJsonArray -}} +{{- dict "volume" (dict "name" "muster-workload-token" "projected" (dict "sources" (list (dict "serviceAccountToken" (dict "audience" "muster" "expirationSeconds" 3600 "path" "token"))))) "mount" (dict "name" "muster-workload-token" "mountPath" "/var/run/secrets/muster.giantswarm.io/serviceaccount" "readOnly" true) | toJson -}} +{{- else -}} +{{- dict | toJson -}} +{{- end -}} +{{- end -}} + {{/* muster's approval configuration (muster.approval, rendered as `approval` into config.yaml): installation, the name the approval page shows, from @@ -5306,10 +5372,12 @@ client, backstage.signInHandoff is on and muster is at least agent-platform.muster.trustedClientsFloor; from agent-platform.muster.handoffFloor up to it the same list renders under its earlier name handoffClients (that muster reads no trustedClients). An own -list under either name stands. A list naming the platform's shared client -(global.identity.clientId, else muster's login client) fails the render: -every holder of such a token (muster, an agent's delegation, a CLI) could then -approve without the page's own sign-in. Only from the muster floor +list under either name stands, but every entry must be the portal's dedicated +client: one naming the platform's shared client (global.identity.clientId, +else muster's login client) fails the render (every holder of such a token, +muster, an agent's delegation, a CLI, could then approve without the page's +own sign-in), and so does any other id (dex-k8s-authenticator, the kagent +UI's or klaus-gateway's client, a CLI's: people hold tokens of those too). Only from the muster floor agent-platform.muster.governanceFloor; {} below it. Usage: include "agent-platform.muster.approval" $root | fromJson */}} @@ -5327,9 +5395,14 @@ Usage: include "agent-platform.muster.approval" $root | fromJson {{- end -}} {{- end -}} {{- range $key := list "trustedClients" "handoffClients" -}} -{{- if and $portal.platformClientId (has $portal.platformClientId (get $out $key | default list)) -}} +{{- range $client := (get $out $key | default list) -}} +{{- if and $portal.platformClientId (eq (toString $client) $portal.platformClientId) -}} {{- fail (printf "muster.muster.approval.%s lists %q, the platform's shared OAuth client: every holder of a token of that client (muster itself, agents acting for a person, CLIs) could approve a person's requests without muster's sign-in; list only the portal's own client (backstage.oidcClientId)" $key $portal.platformClientId) -}} {{- end -}} +{{- if not (and $portal.dedicated (eq (toString $client) $portal.clientId)) -}} +{{- fail (printf "muster.muster.approval.%s lists %q, which is not the portal's own OAuth client (backstage.oidcClientId, set and other than the platform's shared client): muster trusts a listed client with a person's approvals, and people sign in to other clients (dex-k8s-authenticator, the kagent UI, klaus-gateway, CLIs) with tokens of their own; list only the portal's dedicated client" $key (toString $client)) -}} +{{- end -}} +{{- end -}} {{- end -}} {{- end -}} {{- $out | toJson -}} diff --git a/helm/agent-platform/values.schema.json b/helm/agent-platform/values.schema.json index 5eb57f2a..c34823f3 100644 --- a/helm/agent-platform/values.schema.json +++ b/helm/agent-platform/values.schema.json @@ -2166,7 +2166,7 @@ }, "governance": { "type": "object", - "description": "The platform's governance (mode and role floors). The mode, trusted (the default) or governed, changes no tool approval setting's meaning; it adds asking for agent callers. Governed asks a person before an agent runs any tool of a governed server (governedServers below) that is not on that server's safe list (new and renamed tools too), and before any of muster's own tools but its reads; the Dev Portal's connector wizard pre-selects the Recommended preset (read-only tools run, the rest ask). Trusted lets agents run what the connectors' own settings allow and pre-selects Allow all. In both modes muster's built-in floors ask a person before an agent adds or repoints a connector, changes approval settings, grants access, adds a model, egress origin, credential or backend, approves an action or a toolchain source, or changes muster's own configuration; the role floors hold on the governed servers of that role, so governedServers names them in both modes. The meta chart renders muster's governance configuration from it (muster.governance: the mode and governedServers), from the muster release that reads it (agent-platform.muster.governanceFloor); below it `governed` fails the render and trusted renders nothing. From that release the meta chart also renders muster.approval.installation (backstage.installationName, the name the approval page shows; and trustedClients, the portal's own client, with backstage.oidcClientId and backstage.signInHandoff), muster-approval-binder's subject (agent-manager's ServiceAccount, muster.rbac.approvalBinder.subjects) and the pages muster may return the browser to after an approval in muster.oauth.mcpClient.postLoginRedirectAllowlist (the portal's /sessions with backstage.publicPort, klausGateway.obo.callbackBaseUrl + /auth/slack/return; an own list's entries stay). Approval itself needs muster's OAuth server with Dex sign-in, Valkey storage (the default) and muster.muster.oauth.mcpClient.publicUrl on the OAuth server's origin with mcpClient.enabled for the allowlist; the chart does not fail without them, muster refuses asking calls with the reason. The mode is set with this chart value (no agent tool changes it). The block mirrors muster's own governance configuration; a string here (the earlier scalar) fails the render. Further reading (optional): https://docs.giantswarm.io/overview/agent-platform/governing-tool-calls/", + "description": "The platform's governance (mode and role floors). The mode, trusted (the default) or governed, changes no tool approval setting's meaning; it adds asking for agent callers. Governed asks a person before an agent runs any tool of a governed server (governedServers below) that is not on that server's safe list (new and renamed tools too), and before any of muster's own tools but its reads; the Dev Portal's connector wizard pre-selects the Recommended preset (read-only tools run, the rest ask). Trusted lets agents run what the connectors' own settings allow and pre-selects Allow all. In both modes muster's built-in floors ask a person before an agent adds or repoints a connector, changes approval settings, grants access, adds a model, egress origin, credential or backend, approves an action or a toolchain source, or changes muster's own configuration; the role floors hold on the governed servers of that role, so governedServers names them in both modes. The meta chart renders muster's governance configuration from it (muster.governance: the mode and governedServers), from the muster release that reads it (agent-platform.muster.governanceFloor); below it `governed` fails the render and trusted renders nothing. From that release the meta chart also renders muster.approval.installation (backstage.installationName, the name the approval page shows; and trustedClients, the portal's own client, with backstage.oidcClientId and backstage.signInHandoff), muster-approval-binder's subject (agent-manager's ServiceAccount, muster.rbac.approvalBinder.subjects), muster-approval-decider's subject (the portal's ServiceAccount, muster.rbac.approvalDecider.subjects, with its token projected into the portal for audience muster, while muster trusts the portal's client) and the pages muster may return the browser to after an approval in muster.oauth.mcpClient.postLoginRedirectAllowlist (the portal's /sessions with backstage.publicPort, klausGateway.obo.callbackBaseUrl + /auth/slack/return; an own list's entries stay). Approval itself needs muster's OAuth server with Dex sign-in, Valkey storage (the default) and muster.muster.oauth.mcpClient.publicUrl on the OAuth server's origin with mcpClient.enabled for the allowlist; the chart does not fail without them, muster refuses asking calls with the reason. The mode is set with this chart value (no agent tool changes it). The block mirrors muster's own governance configuration; a string here (the earlier scalar) fails the render. Further reading (optional): https://docs.giantswarm.io/overview/agent-platform/governing-tool-calls/", "additionalProperties": false, "properties": { "mode": { diff --git a/helm/agent-platform/values.yaml b/helm/agent-platform/values.yaml index 3de8ec78..ad64d23b 100644 --- a/helm/agent-platform/values.yaml +++ b/helm/agent-platform/values.yaml @@ -5871,7 +5871,10 @@ clusterManager: # @schema skipProperties: true; additionalProperties: true # chart also renders muster.approval.installation (backstage.installationName, # the name the approval page shows; and trustedClients, the portal's own # client, with backstage.oidcClientId and backstage.signInHandoff), muster-approval-binder's subject -# (agent-manager's ServiceAccount, muster.rbac.approvalBinder.subjects) and +# (agent-manager's ServiceAccount, muster.rbac.approvalBinder.subjects), +# muster-approval-decider's subject (the portal's ServiceAccount, +# muster.rbac.approvalDecider.subjects, with its token projected into the +# portal for audience muster, while muster trusts the portal's client) and # the pages muster may return the browser to after an approval in # muster.oauth.mcpClient.postLoginRedirectAllowlist (the portal's /sessions # with backstage.publicPort, klausGateway.obo.callbackBaseUrl + @@ -6961,12 +6964,19 @@ backstage: # @schema skipProperties: true; additionalProperties: true # oidcClientId the chart lists it in muster.approval.trustedClients, so the # portal shows a tool approval in chat and decides it on the person's click # (Approve / Decline, with the person's token), and opens muster's connector - # sign-in signed in through a one-time ticket. The trade-off: whoever holds a - # portal token of a person (only the portal backend, by design) can approve - # that person's pending requests without muster's browser sign-in; the - # portal decides only on the person's click. false keeps every decision and - # sign-in on muster's own pages. Without a dedicated client nothing is - # listed: the shared client is held by muster, agents and CLIs as well. + # sign-in signed in through a one-time ticket (muster still asks the browser + # "Connect as ?" first). muster takes a person's portal + # token there only with the portal backend's own ServiceAccount token + # (audience muster, projected into the portal; the chart binds the portal's + # ServiceAccount to muster-approval-decider), so a portal token held + # elsewhere (the browser, a forwardToken server, an agent runtime) decides + # nothing. The trade-off: the portal backend can approve a person's pending + # requests without muster's browser sign-in; it decides only on the + # person's click. false keeps every decision and sign-in on muster's own + # pages. Without a dedicated client nothing is listed: the shared client is + # held by muster, agents and CLIs as well. An own + # muster.muster.approval.trustedClients may name this client only; any + # other id fails the render. signInHandoff: true # Extra query parameters on the login provider's authorize request. Dex needs # none; Google needs access_type: offline and prompt: consent for a refresh diff --git a/skills/agent-platform-tools/SKILL.md b/skills/agent-platform-tools/SKILL.md index 59eb8f45..2bb9f453 100644 --- a/skills/agent-platform-tools/SKILL.md +++ b/skills/agent-platform-tools/SKILL.md @@ -141,7 +141,8 @@ agent, the portal, Slack, Claude Code): - **Allow** runs. **Ask**: a person confirms the exact call first (in portal chat, where the request is shown with Approve / Decline, or on Muster's approval page); the call then runs once. An agent - cannot decide its own request: Muster takes decisions only from the person. **Block**: hidden, absent from `filter_tools`, refused as not found. + cannot decide its own request: Muster takes decisions only from the person, inline only through + the portal backend's own identity, so no token you hold decides one. **Block**: hidden, absent from `filter_tools`, refused as not found. - A connector carries `spec.approval`: a `rule` (`Allow`, `Ask` or `Block`) that every tool without its own entry follows — **new tools follow the rule**, so a `Block` rule hides every tool nobody has reviewed yet — and per-tool entries by the server's own tool name (no `x__` prefix). diff --git a/tests/verify-tool-approval.py b/tests/verify-tool-approval.py index 7824bba8..3a0ad34a 100755 --- a/tests/verify-tool-approval.py +++ b/tests/verify-tool-approval.py @@ -32,10 +32,18 @@ while the portal is on, backstage.signInHandoff is on and muster is at least agent-platform.muster.trustedClientsFloor; from agent-platform.muster.handoffFloor below it the list renders as - handoffClients; an own list under either name stands; a list naming the - shared client fails; the backstage release mounts portal-dex-client-secret - and the connectivity app-config signs in with that client, requesting the - platform client's audience. + handoffClients; an own list under either name stands while it names only + the dedicated portal client (any other id fails: the shared client, + dex-k8s-authenticator, any client people sign in to); the backstage release + mounts portal-dex-client-secret and the connectivity app-config signs in + with that client, requesting the platform client's audience. +- approval decider: from the trusted-clients floor, while muster trusts the + portal's client, the muster release binds muster-approval-decider to the + portal's ServiceAccount (backstage.name in the portal's namespace) and + nothing else (an own list stands), and the backstage release projects that + ServiceAccount's token for audience muster where the portal's muster + backend reads it, beside its own extra volumes; none without a trusted + client or below the floor. - governance floor: agent-platform.muster.governanceFloor is one X.Y.Z; its PLACEHOLDER-GOVERNANCE-FLOOR marker, while it is still there, appears once. - connector-admin: muster's mcpserver-editor Role (the platform's @@ -974,11 +982,11 @@ def clients(args: list[str], floor: str = trusted, key: str = "trustedClients") fail(f"{why}: no trusted client expected, got {clients(args)}") if clients(dedicated, FLOOR_RANGE) or clients(dedicated, FLOOR_RANGE, "handoffClients"): fail("below the handoff floor muster must list no trusted client") - own = clients(dedicated + ["--set", "muster.muster.approval.trustedClients[0]=other-portal"]) - if own != ["- other-portal"]: - fail(f"an own trustedClients list must stand, got {own}") - own = clients(dedicated + ["--set", "muster.muster.approval.handoffClients[0]=other-portal"], key="handoffClients") - if own != ["- other-portal"]: + own = clients(dedicated + ["--set", "muster.muster.approval.trustedClients[0]=platform-portal"]) + if own != ["- platform-portal"]: + fail(f"an own trustedClients list naming the portal's client must stand, got {own}") + own = clients(dedicated + ["--set", "muster.muster.approval.handoffClients[0]=platform-portal"], key="handoffClients") + if own != ["- platform-portal"]: fail(f"an own handoffClients list (the earlier name) must stand, got {own}") if clients(dedicated + ["--set-json", "muster.muster.approval.trustedClients=[]"]): fail("an own empty trustedClients list must stand (no trusted client)") @@ -986,10 +994,73 @@ def clients(args: list[str], floor: str = trusted, key: str = "trustedClients") err = render(META_DIR, META + ["--set", trusted, *PORTAL_CLIENT, "--set", f"muster.muster.approval.{key}[0]=platform"], expect_fail=True) if f'{key} lists "platform", the platform\'s shared OAuth client' not in err: fail(f"a {key} list naming the shared client must fail the render:\n{err}") + # IA-06: only the portal's dedicated client may be trusted; any other id + # (a client people sign in to with tokens of their own) fails, in an own + # list and through backstage.oidcClientId alike. + for args, client, key in ( + (dedicated + ["--set", "muster.muster.approval.trustedClients[0]=dex-k8s-authenticator"], "dex-k8s-authenticator", "trustedClients"), + (dedicated + ["--set", "muster.muster.approval.trustedClients[0]=platform-portal", "--set", "muster.muster.approval.trustedClients[1]=kubectl-gs"], "kubectl-gs", "trustedClients"), + (dedicated + ["--set", "muster.muster.approval.handoffClients[0]=muster-cli"], "muster-cli", "handoffClients"), + (["--set", "muster.muster.approval.handoffClients[0]=muster-cli"], "muster-cli", "handoffClients"), + (["--set", "muster.muster.approval.trustedClients[0]=other-portal"], "other-portal", "trustedClients"), + ): + err = render(META_DIR, META + ["--set", trusted, *PORTAL_CLIENT, *args], expect_fail=True) + if f'{key} lists "{client}", which is not the portal\'s own OAuth client' not in err: + fail(f"{args}: a {key} list naming {client} must fail the render:\n{err}") rel = doc(render_meta(["--set", trusted, *PORTAL_CLIENT, *dedicated]), "HelmRelease", "backstage") or "" if "key: portal-dex-client-secret" not in rel or "optional: true" not in rel: fail("the backstage release must mount the portal's own client secret (portal-dex-client-secret, optional)") - print("ok: muster.approval.trustedClients is the portal's dedicated client from the trusted-clients floor (handoffClients from the handoff floor below it; none on the shared client, with signInHandoff false, the portal off or below the floors), an own list under either name stands, the shared client fails") + print("ok: muster.approval.trustedClients is the portal's dedicated client from the trusted-clients floor (handoffClients from the handoff floor below it; none on the shared client, with signInHandoff false, the portal off or below the floors), an own list under either name naming it stands, the shared client and any other client fail") + + +def check_approval_decider() -> None: + """From the trusted-clients floor, while muster trusts the portal's + client, muster-approval-decider binds the portal's ServiceAccount only, + and the portal's pod projects its token for audience muster where its + muster backend reads it (IA-01).""" + trusted = f"components.muster.versionRange=>={TEST_FLOORS['muster.trustedClientsFloor']} <6.0.0-0" + handoff = f"components.muster.versionRange=>={TEST_FLOORS['muster.handoffFloor']} <{TEST_FLOORS['muster.trustedClientsFloor']}" + dedicated = ["--set", "backstage.oidcClientId=platform-portal"] + + def decider(args: list[str]) -> str: + return block(muster_release([*PORTAL_CLIENT, *args]), " approvalDecider:") + + def backstage(args: list[str]) -> str: + return doc(render_meta([*PORTAL_CLIENT, *args]), "HelmRelease", "backstage") or "" + + got = decider(["--set", trusted, *dedicated]) + want = "\n".join([ + " approvalDecider:", + " subjects:", + " - kind: ServiceAccount", + " name: backstage", + " namespace: default", + ]) + if got.rstrip() != want: + fail(f"muster-approval-decider must bind the portal's ServiceAccount only, want:\n{want}\ngot:\n{got}") + moved = decider(["--set", trusted, *dedicated, "--set", "components.backstage.targetNamespace=portal", "--set", "backstage.name=portal-sa"]) + if "name: portal-sa" not in moved or "namespace: portal" not in moved: + fail(f"the subject must follow the portal's ServiceAccount name and namespace:\n{moved}") + own = decider(["--set", trusted, *dedicated, "--set", "muster.rbac.approvalDecider.subjects[0].kind=ServiceAccount", "--set", "muster.rbac.approvalDecider.subjects[0].name=other", "--set", "muster.rbac.approvalDecider.subjects[0].namespace=x"]) + if "name: other" not in own or "name: backstage" in own: + fail(f"an own approvalDecider list must stand:\n{own}") + for args, why in ( + (["--set", trusted], "the portal on the shared client (no trusted client)"), + (["--set", trusted, *dedicated, "--set", "backstage.signInHandoff=false"], "signInHandoff false"), + (["--set", handoff, *dedicated], "below the trusted-clients floor"), + (["--set", trusted, *dedicated, "--set-json", "muster.muster.approval.trustedClients=[]"], "an own empty trustedClients list"), + ): + if decider(args): + fail(f"{why}: no approvalDecider subjects expected") + if "muster-workload-token" in backstage(args): + fail(f"{why}: no workload token projected into the portal") + rel = backstage(["--set", trusted, *dedicated]) + for want in ("name: muster-workload-token", "audience: muster", "path: token", "expirationSeconds: 3600", + "mountPath: /var/run/secrets/muster.giantswarm.io/serviceaccount", + "name: idp-ca", "mountPath: /etc/agent-platform/idp-ca"): + if want not in rel: + fail(f"the backstage release must project the portal's workload token beside its own volumes ({want!r} missing):\n{rel}") + print("ok: muster-approval-decider binds the portal's ServiceAccount only (name and namespace following the portal, an own list standing) and the portal projects its token for audience muster where its muster backend reads it, beside its own volumes; none without a trusted client or below the trusted-clients floor") def check_portal_client_app_config() -> None: @@ -1038,6 +1109,7 @@ def render_meta_fail(args: list[str]) -> str: check_coverage() check_approval_config() check_handoff_clients() + check_approval_decider() check_portal_client_app_config() check_connector_admin() check_binder() From 018d14deffb26ed8835e673c92401c7243c47e50 Mon Sep 17 00:00:00 2001 From: Dominik Schmidle Date: Fri, 27 Nov 2026 00:09:35 +0100 Subject: [PATCH 49/56] fix(approval): list the portal as muster's trusted client only from the trusted-clients floor Drop agent-platform.muster.handoffFloor and its handoffClients branch: a muster below the trusted-clients floor issues handoff tickets without the workload review and the sign-in confirmation, and must not be trusted with them. An own list under either name still stands. --- docs/authentication.md | 2 +- helm/agent-platform/templates/_helpers.tpl | 20 +++++------ tests/verify-tool-approval.py | 41 +++++++++++++--------- 3 files changed, 33 insertions(+), 30 deletions(-) diff --git a/docs/authentication.md b/docs/authentication.md index 7a8722b9..c98604ba 100644 --- a/docs/authentication.md +++ b/docs/authentication.md @@ -52,7 +52,7 @@ By default the portal signs people in with the platform's shared client (`global - the portal requests the platform client's audience (`audience:server:client_id:`, added to `backstage.extraScopes`), so the token's `aud` still holds the platform client and every component that trusts it (muster's `trustedAudiences`, the managers' trusted audiences, the API server through `dex-k8s-authenticator`) accepts it unchanged. Its `azp` names the portal's client. On Dex the platform client and `dex-k8s-authenticator` (and any other client whose audience `extraScopes` requests) list the portal's client under `trustedPeers`; - muster keys a forwarded token's session by its client too: a person's connector sign-ins made through the shared client are not the portal's, except subject-scoped ones (`spec.auth.grantScope: subject`). -With a dedicated client and `backstage.signInHandoff` on (the default), the chart lists that client, and only that one, in muster's `approval.trustedClients` (from `agent-platform.muster.trustedClientsFloor`; from `agent-platform.muster.handoffFloor` below it under the earlier name `approval.handoffClients`). muster trusts that client with a person's approvals: a tool approval in portal chat is shown inline and decided on the person's click (*Approve* / *Decline*), the portal backend posting the decision to muster (`POST /approvals/{id}/decision`) with the person's token and the digest of what was shown; and *Open* on a connector sign-in prompt asks muster `POST /handoff-tickets` for a one-time ticket, so the sign-in opens signed in. A person's portal token is not held by the portal backend alone: the browser resolves it and sends it to the backend, muster forwards it to `forwardToken` servers, and a runtime handed the caller's credential holds it. So muster takes it on these two endpoints only together with the portal backend's own workload identity: its projected ServiceAccount token (audience `muster`), sent in `X-Muster-Approval-Client`, which muster reviews with a `TokenReview` and a `LocalSubjectAccessReview` for verb `decide` on `toolapprovals.muster.giantswarm.io` in muster's namespace. From the same floor the chart binds the muster chart's Role `muster-approval-decider` to the portal's ServiceAccount (`backstage.name`, default `backstage`, in the portal's namespace; `muster.rbac.approvalDecider.subjects`, an own list stands) and nothing else, and projects that token into the portal's pod at `/var/run/secrets/muster.giantswarm.io/serviceaccount/token`, where its muster backend reads it. The person's token proves who decides, the workload token that the portal backend presents it: either alone decides nothing and mints no ticket. The remaining trade-off: the portal backend can approve a person's pending requests without muster's browser sign-in (script injected into the portal can ask it to); it decides only on the person's click. muster refuses any token naming an acting party, an agent's credential, another client, another workload and another person. A connector sign-in opened through a handoff ticket still asks the browser on muster's own page (*Connect as ?*) before it goes on, so a link passed to someone else's browser connects nothing unseen. Only the portal's dedicated client may be listed: the render fails when `muster.muster.approval.trustedClients` or `handoffClients` names any other id, the shared client (agents' delegations and CLIs hold its tokens), `dex-k8s-authenticator`, the kagent UI's or klaus-gateway's client, or a CLI's. `backstage.signInHandoff: false` keeps every decision and sign-in on muster's own pages. +With a dedicated client and `backstage.signInHandoff` on (the default), the chart lists that client, and only that one, in muster's `approval.trustedClients` (from `agent-platform.muster.trustedClientsFloor`, the first muster that reviews the portal backend's workload and confirms a handed-over sign-in; below it the chart lists none, under either name). muster trusts that client with a person's approvals: a tool approval in portal chat is shown inline and decided on the person's click (*Approve* / *Decline*), the portal backend posting the decision to muster (`POST /approvals/{id}/decision`) with the person's token and the digest of what was shown; and *Open* on a connector sign-in prompt asks muster `POST /handoff-tickets` for a one-time ticket, so the sign-in opens signed in. A person's portal token is not held by the portal backend alone: the browser resolves it and sends it to the backend, muster forwards it to `forwardToken` servers, and a runtime handed the caller's credential holds it. So muster takes it on these two endpoints only together with the portal backend's own workload identity: its projected ServiceAccount token (audience `muster`), sent in `X-Muster-Approval-Client`, which muster reviews with a `TokenReview` and a `LocalSubjectAccessReview` for verb `decide` on `toolapprovals.muster.giantswarm.io` in muster's namespace. From the same floor the chart binds the muster chart's Role `muster-approval-decider` to the portal's ServiceAccount (`backstage.name`, default `backstage`, in the portal's namespace; `muster.rbac.approvalDecider.subjects`, an own list stands) and nothing else, and projects that token into the portal's pod at `/var/run/secrets/muster.giantswarm.io/serviceaccount/token`, where its muster backend reads it. The person's token proves who decides, the workload token that the portal backend presents it: either alone decides nothing and mints no ticket. The remaining trade-off: the portal backend can approve a person's pending requests without muster's browser sign-in (script injected into the portal can ask it to); it decides only on the person's click. muster refuses any token naming an acting party, an agent's credential, another client, another workload and another person. A connector sign-in opened through a handoff ticket still asks the browser on muster's own page (*Connect as ?*) before it goes on, so a link passed to someone else's browser connects nothing unseen. Only the portal's dedicated client may be listed: the render fails when `muster.muster.approval.trustedClients` or `handoffClients` names any other id, the shared client (agents' delegations and CLIs hold its tokens), `dex-k8s-authenticator`, the kagent UI's or klaus-gateway's client, or a CLI's. `backstage.signInHandoff: false` keeps every decision and sign-in on muster's own pages. `agentlab portal dev` (a portal running from a checkout on the developer's machine against the lab) has no projected token: agentlab mints one for the lab portal's ServiceAccount (TokenRequest, audience `muster`) on every start and points the portal's `muster.workloadTokenFile` at it, so inline approval works there as in the cluster. That token is lab-only and the lab's to mint; never copy an installation's portal token to a laptop. diff --git a/helm/agent-platform/templates/_helpers.tpl b/helm/agent-platform/templates/_helpers.tpl index d6307dea..b5143efe 100644 --- a/helm/agent-platform/templates/_helpers.tpl +++ b/helm/agent-platform/templates/_helpers.tpl @@ -2197,15 +2197,13 @@ inside the define. (muster.credentialProvider.sessionBindings); UNSET until it exists. */ -}} {{- define "agent-platform.muster.sessionBindingsPortFloor" -}}{{- end -}} -{{- /* The first muster issuing sign-in handoff tickets to the clients of -approval.handoffClients (POST /handoff-tickets); UNSET until it exists. */ -}} -{{- define "agent-platform.muster.handoffFloor" -}}{{- end -}} {{- /* The first muster reading approval.trustedClients (handoffClients renamed; the trusted client also decides approvals inline, POST /approvals/{id}/decision) and reviewing the trusted client's own workload token (verb decide, muster-approval-decider; giantswarm/muster#1912); UNSET -until it exists. Below it, from handoffFloor, the list renders as -handoffClients. */ -}} +until it exists. Below it the chart lists no trusted client under either +name: a muster that issues handoff tickets without the workload review and +the sign-in confirmation must not be trusted with them. */ -}} {{- define "agent-platform.muster.trustedClientsFloor" -}}{{- end -}} {{/* @@ -2259,7 +2257,7 @@ nothing here would enforce it, so it fails too. Emits nothing. */}} {{- define "agent-platform.validateReleaseFloors" -}} {{- if not (include "agent-platform.muster.governanceFloor" .) -}} -{{- range $name := list "agentManager.toolApprovalFloor" "muster.agentApprovalFloor" "muster.sessionBindingsPortFloor" "agentManager.agentChartV3Floor" "muster.handoffFloor" "muster.trustedClientsFloor" -}} +{{- range $name := list "agentManager.toolApprovalFloor" "muster.agentApprovalFloor" "muster.sessionBindingsPortFloor" "agentManager.agentChartV3Floor" "muster.trustedClientsFloor" -}} {{- if include (printf "agent-platform.%s" $name) $ -}} {{- fail (printf "agent-platform.%s is set while agent-platform.muster.governanceFloor is unset: the muster approval binder, approval block and redirect allowlist render only from the governance floor, so agent-manager would bind settings that muster refuses from it and no Session would start; set agent-platform.muster.governanceFloor in the same release" $name) -}} {{- end -}} @@ -5369,10 +5367,10 @@ the person's token, and opens muster's connector sign-in signed in through a one-time handoff ticket): the portal's own client (agent-platform.backstage.oidcClient) while the portal is on with a dedicated client, backstage.signInHandoff is on and muster is at least -agent-platform.muster.trustedClientsFloor; from -agent-platform.muster.handoffFloor up to it the same list renders under its -earlier name handoffClients (that muster reads no trustedClients). An own -list under either name stands, but every entry must be the portal's dedicated +agent-platform.muster.trustedClientsFloor, and none below it (an earlier +muster issues handoff tickets without the workload review and the sign-in +confirmation). An own list under either name (handoffClients, the earlier +one) stands, but every entry must be the portal's dedicated client: one naming the platform's shared client (global.identity.clientId, else muster's login client) fails the render (every holder of such a token, muster, an agent's delegation, a CLI, could then approve without the page's @@ -5390,8 +5388,6 @@ Usage: include "agent-platform.muster.approval" $root | fromJson {{- if and (not (hasKey $own "handoffClients")) (not (hasKey $own "trustedClients")) $portal.dedicated (dig "signInHandoff" true (.Values.backstage | default dict)) (include "agent-platform.componentEnabled" (dict "root" . "name" "backstage")) -}} {{- if include "agent-platform.componentFloorAtLeast" (dict "root" . "name" "muster" "version" (include "agent-platform.muster.trustedClientsFloor" .)) -}} {{- $_ := set $out "trustedClients" (list $portal.clientId) -}} -{{- else if include "agent-platform.componentFloorAtLeast" (dict "root" . "name" "muster" "version" (include "agent-platform.muster.handoffFloor" .)) -}} -{{- $_ := set $out "handoffClients" (list $portal.clientId) -}} {{- end -}} {{- end -}} {{- range $key := list "trustedClients" "handoffClients" -}} diff --git a/tests/verify-tool-approval.py b/tests/verify-tool-approval.py index 3a0ad34a..32e37e29 100755 --- a/tests/verify-tool-approval.py +++ b/tests/verify-tool-approval.py @@ -30,9 +30,8 @@ - trusted clients: muster.approval.trustedClients is the portal's own client (backstage.oidcClientId, when it differs from the platform's shared client) while the portal is on, backstage.signInHandoff is on and muster is at least - agent-platform.muster.trustedClientsFloor; from - agent-platform.muster.handoffFloor below it the list renders as - handoffClients; an own list under either name stands while it names only + agent-platform.muster.trustedClientsFloor, and under neither name below it + (an earlier muster issues tickets without the workload review); an own list under either name stands while it names only the dedicated portal client (any other id fails: the shared client, dex-k8s-authenticator, any client people sign in to); the backstage release mounts portal-dex-client-secret and the connectivity app-config signs in @@ -747,7 +746,12 @@ def check_approval() -> None: #. TEST_FLOORS = {"muster.governanceFloor": "5.65.0", "muster.agentApprovalFloor": "5.66.0", "agentManager.toolApprovalFloor": "3.6.0", "muster.sessionBindingsPortFloor": "5.66.0", - "muster.handoffFloor": "5.68.0", "muster.trustedClientsFloor": "5.69.0"} + "muster.trustedClientsFloor": "5.69.0"} + +# A muster below the trusted-clients floor and above the others: one that +# issued handoff tickets without the workload review and the sign-in +# confirmation. +BELOW_TRUSTED = f"components.muster.versionRange=>=5.68.0 <{TEST_FLOORS['muster.trustedClientsFloor']}" def with_test_floors(meta_dir: str, dst: str) -> str: @@ -783,7 +787,7 @@ def check_floor_dependencies() -> None: """The floors that need the governance wiring fail the render while the governance floor is unset, whichever of them is set; governed mode and role floors fail with muster off.""" - dependent = ["agentManager.toolApprovalFloor", "muster.agentApprovalFloor", "muster.sessionBindingsPortFloor", "agentManager.agentChartV3Floor", "muster.handoffFloor", "muster.trustedClientsFloor"] + dependent = ["agentManager.toolApprovalFloor", "muster.agentApprovalFloor", "muster.sessionBindingsPortFloor", "agentManager.agentChartV3Floor", "muster.trustedClientsFloor"] values = {**TEST_FLOORS, "agentManager.agentChartV3Floor": "3.6.0"} with tempfile.TemporaryDirectory(prefix="verify-floor-deps-") as tmp: for i, name in enumerate(dependent): @@ -840,11 +844,11 @@ def check_unset_floors_keep_everything_off() -> None: fail("with muster's agent approval floor unset agent-manager must bind no settings") if "muster.sessionBindingsPortFloor" in unset and block(muster, " sessionBindings:"): fail("with the session bindings floor unset muster must keep its earlier bindings wiring") - if "muster.handoffFloor" in unset and "muster.trustedClientsFloor" in unset: + if "muster.trustedClientsFloor" in unset: portal = render_meta(high + PORTAL_CLIENT + ["--set", "backstage.oidcClientId=platform-portal"]) release = doc(portal, "HelmRelease", "muster") or "" if "handoffClients" in release or "trustedClients" in release: - fail("with the handoff and trusted-clients floors unset muster must list no trusted client") + fail("with the trusted-clients floor unset muster must list no trusted client") print(f"ok: unset floors ({', '.join(unset)}) keep what they gate off for any muster and agent-manager range; `governed` fails") @@ -952,12 +956,12 @@ def check_handoff_clients() -> None: """muster.approval.trustedClients lists the portal's own client (backstage.oidcClientId) while it differs from the platform's shared client, the portal is on, backstage.signInHandoff is on and muster is at - least agent-platform.muster.trustedClientsFloor; from - agent-platform.muster.handoffFloor below it the list renders as - handoffClients (that muster reads no trustedClients); an own list under - either name stands; a list naming the shared client fails the render.""" + least agent-platform.muster.trustedClientsFloor, and none under either + name below it (an earlier muster issues handoff tickets without the + workload review and the sign-in confirmation); an own list under either + name stands; a list naming the shared client fails the render.""" trusted = f"components.muster.versionRange=>={TEST_FLOORS['muster.trustedClientsFloor']} <6.0.0-0" - handoff = f"components.muster.versionRange=>={TEST_FLOORS['muster.handoffFloor']} <{TEST_FLOORS['muster.trustedClientsFloor']}" + handoff = BELOW_TRUSTED def clients(args: list[str], floor: str = trusted, key: str = "trustedClients") -> list[str]: release = muster_release(["--set", floor, *PORTAL_CLIENT, *args]) @@ -970,8 +974,11 @@ def clients(args: list[str], floor: str = trusted, key: str = "trustedClients") dedicated = ["--set", "backstage.oidcClientId=platform-portal"] if clients(dedicated) != ["- platform-portal"]: fail(f"a dedicated portal client must be muster's one trusted client, got {clients(dedicated)}") - if clients(dedicated, handoff, "handoffClients") != ["- platform-portal"]: - fail("below the trusted-clients floor, from the handoff floor, the list must render as handoffClients") + helpers = open(os.path.join(META_DIR, "templates", "_helpers.tpl")).read() + if re.search(r'set \$\w+ "handoffClients"', helpers): + fail("the chart must render handoffClients from no floor: below the trusted-clients floor a muster issues handoff tickets without the workload review; only an own list may carry the earlier name") + if clients(dedicated, handoff) or clients(dedicated, handoff, "handoffClients"): + fail("below the trusted-clients floor muster must list no trusted client under either name: that muster issues handoff tickets without the workload review") for args, why in ( ([], "the portal on the shared client"), (["--set", "backstage.oidcClientId=platform"], "backstage.oidcClientId equal to the shared client"), @@ -981,7 +988,7 @@ def clients(args: list[str], floor: str = trusted, key: str = "trustedClients") if clients(args): fail(f"{why}: no trusted client expected, got {clients(args)}") if clients(dedicated, FLOOR_RANGE) or clients(dedicated, FLOOR_RANGE, "handoffClients"): - fail("below the handoff floor muster must list no trusted client") + fail("below the floors muster must list no trusted client") own = clients(dedicated + ["--set", "muster.muster.approval.trustedClients[0]=platform-portal"]) if own != ["- platform-portal"]: fail(f"an own trustedClients list naming the portal's client must stand, got {own}") @@ -1010,7 +1017,7 @@ def clients(args: list[str], floor: str = trusted, key: str = "trustedClients") rel = doc(render_meta(["--set", trusted, *PORTAL_CLIENT, *dedicated]), "HelmRelease", "backstage") or "" if "key: portal-dex-client-secret" not in rel or "optional: true" not in rel: fail("the backstage release must mount the portal's own client secret (portal-dex-client-secret, optional)") - print("ok: muster.approval.trustedClients is the portal's dedicated client from the trusted-clients floor (handoffClients from the handoff floor below it; none on the shared client, with signInHandoff false, the portal off or below the floors), an own list under either name naming it stands, the shared client and any other client fail") + print("ok: muster.approval.trustedClients is the portal's dedicated client from the trusted-clients floor (none below it, under either name; none on the shared client, with signInHandoff false, the portal off or below the floors), an own list under either name naming it stands, the shared client and any other client fail") def check_approval_decider() -> None: @@ -1019,7 +1026,7 @@ def check_approval_decider() -> None: and the portal's pod projects its token for audience muster where its muster backend reads it (IA-01).""" trusted = f"components.muster.versionRange=>={TEST_FLOORS['muster.trustedClientsFloor']} <6.0.0-0" - handoff = f"components.muster.versionRange=>={TEST_FLOORS['muster.handoffFloor']} <{TEST_FLOORS['muster.trustedClientsFloor']}" + handoff = BELOW_TRUSTED dedicated = ["--set", "backstage.oidcClientId=platform-portal"] def decider(args: list[str]) -> str: From fcd8f8c55745bb9fd526aa0414047645e11a1fb9 Mon Sep 17 00:00:00 2001 From: Dominik Schmidle Date: Fri, 27 Nov 2026 00:15:45 +0100 Subject: [PATCH 50/56] docs: condense tool approval docs --- UPGRADE.md | 48 ++-- docs/authentication.md | 17 +- docs/toolset-presets.md | 2 +- helm/agent-platform-connectivity/values.yaml | 111 ++++---- helm/agent-platform/README.md | 169 ++++-------- helm/agent-platform/README.md.gotmpl | 169 ++++-------- helm/agent-platform/values.schema.json | 10 +- helm/agent-platform/values.yaml | 243 +++++++----------- .../agent-platform-agent-management/SKILL.md | 57 ++-- .../agent-platform-building-blocks/SKILL.md | 7 +- skills/agent-platform-tools/SKILL.md | 99 ++++--- 11 files changed, 348 insertions(+), 584 deletions(-) diff --git a/UPGRADE.md b/UPGRADE.md index 398bc486..5df136a1 100644 --- a/UPGRADE.md +++ b/UPGRADE.md @@ -17,33 +17,42 @@ A CRD version change that needs more than an apply (a stored version dropped, as ## \ → \ (agent chart 3.0: `muster.requireApproval` becomes `default: Ask`) -agent chart 3.0 removes `muster.requireApproval` (kagent's flag that paused an agent before every tool call) and the default of `modelConfig.name`. `default: Ask` replaces `requireApproval: true`: muster asks a person before every tool call the agent makes through it, from every client; once migrated, nothing asks twice (until then see *Running Sessions* below). `agent-manager.agentChart.semver` moves the agents of the whole installation: agent-manager composes new agents on it, its migrate run (the connectivity release's start hook) moves the existing ones, and the agent-platform-operator moves each organization's chart source once migrate marks that organization ready (agent-platform-operator from the release carrying `agentChart.migrationReport`). +Agent chart 3.0 removes `muster.requireApproval` and the default of `modelConfig.name`. `default: Ask` replaces `requireApproval: true`: muster asks a person before every tool call the agent makes through it, from every client. `agent-manager.agentChart.semver` moves the agents of the whole installation: agent-manager composes new agents on it, its migrate run (the connectivity release's start hook) rewrites the existing releases, and the agent-platform-operator moves each organization's chart source once migrate marks that organization ready. -The render allows the 3.x line only together with what makes it safe (`make verify-agent-chart-line`): agent-manager at `agent-platform.agentManager.agentChartV3Floor`, whose migrate has the 2.x → 3.x hop, muster at `agent-platform.muster.agentApprovalFloor`, which enforces `default: Ask`, agent-manager's tool approval on (`agent-manager.muster.toolApproval.enabled` unset) and the default agent's range on the same major. **Both floors are unset in this chart** until the muster and agent-manager releases carrying tool approval exist, so every 3.x range is refused for now, whatever its form (`3.x`, `~3.2`, `>=3.1.0 <3.6.0`); the platform release that pins those versions sets them. They are chart code, not values, on purpose: a floor states which released version carries a feature, and a value would let one installation's configuration claim it for a release that lacks it (a lab tests a branch build on a copy of the chart, as the verify scripts do). The same goes for the other floors of tool approval (`agent-platform.agentManager.toolApprovalFloor`, `agent-platform.muster.governanceFloor`, `agent-platform.muster.sessionBindingsPortFloor`): unset, what they gate stays off and `governance: governed` fails. The range is read as agent-manager's migrate and the agent-platform-operator read it: every version it names and every alternative of a `||` range count, so a range admitting two majors (`>=3.0.0`, `3.0.1 || 2.6.0`) or only pre-releases fails. +The render allows the 3.x line only together with `make verify-agent-chart-line`'s conditions: agent-manager at `agent-platform.agentManager.agentChartV3Floor`, muster at `agent-platform.muster.agentApprovalFloor`, agent-manager's tool approval on, and the default agent's range on the same major. **Both floors are unset in this chart** until the releases carrying tool approval exist, so every 3.x range is refused for now; the platform release that pins those versions sets them. The other tool approval floors (`agentManager.toolApprovalFloor`, `muster.governanceFloor`, `muster.sessionBindingsPortFloor`) behave the same: unset, what they gate stays off and `governance: governed` fails. A range admitting two majors or only pre-releases fails. -The migrate run writes each release's 3.x values (`muster.requireApproval: true` → `default: Ask` where the muster binding renders, the key dropped, an unset `modelConfig.name` spelled out as the 2.x default `default-model-config`) only once a 3.x chart is published and only where it moves the namespace's source in the same run. It writes no release with `spec.valuesFrom` (reported `failed` with what to change), none whose source it cannot move (pinned, owned by git, the platform's: `pending` with the diff); any of them keeps the report in the expand phase. In organization namespaces it applies the same rules but for the source, which stays the operator's: it rewrites the releases agent-manager owns, gives a GitOps-owned one its diff (holding its siblings), writes its report in each organization namespace and annotates it `agent-platform.giantswarm.io/agent-chart-ready-major: "3"` once every release there is on 3.x values. The operator moves an organization's source to 3.x only on that annotation (or when no HelmRelease there uses the source); until then the organization is `Ready=False` with reason `ChartSourceHeld`, and its releases stay on 2.x, still asking. The mark also names the releases it covers (`agent-platform.giantswarm.io/agent-chart-ready-releases`); a release created on the 2.x source after the run read the namespace is not covered, and the operator holds the source, naming it, until migrate runs again. A missing source is recreated on the same terms when a release there last deployed 2.x, and a range of several majors or of none moves and creates no source (`ChartRangeInvalid`). The window in which a rewritten organization release's 2.x upgrade fails (it keeps its deployed revision, which still asks): from the run's write until the operator runs with the 3.x range (its release follows the connectivity release whose hook runs migrate, so the operator's rollout bounds it first), then until its next look (`agentChart.migrationPoll`, 1m). A run that failed a write after others succeeded leaves the namespace unmarked with rewritten releases under the 2.x source until migrate runs again. +What migrate does: + +| Case | Result | +|------|--------| +| Release owned by agent-manager | Rewritten: `requireApproval: true` becomes `default: Ask`, the key is dropped, an unset `modelConfig.name` becomes `default-model-config` | +| Release with `spec.valuesFrom` | `failed`: move the settings into `spec.values` | +| Pinned, git-owned or platform release | `pending` with a diff to apply | +| Organization namespace | Same rules; GitOps-owned releases get a diff. Annotates the namespace `agent-platform.giantswarm.io/agent-chart-ready-major: "3"` once every release is on 3.x values | + +Any `failed` or `pending` release keeps the namespace in the expand phase. The operator moves an organization's source only on that annotation; until then the organization is `Ready=False` (`ChartSourceHeld`) and its releases stay on 2.x, still asking. A release created on the 2.x source after the run is not covered: the operator holds the source and names it until migrate runs again. ### Operator action -- Once the floors are set: move `agent-manager.agentChart.semver` and `components.default-agent.versionRange` to `>=3.0.0 <4.0.0` together with `components.agent-manager.versionRange` and `components.muster.versionRange` at or above the floors, and with organizations on set `agentManager.migration.cutover: true` in the same change (a boolean: a string, also `"false"`, fails the render; without it the run may read the organizations but not rewrite them, so their sources stay held). The render refuses the line without the two component floors, without tool approval, or with the default agent on the other major; moving the component ranges alone renders. -- Tool approval's prerequisites must hold (muster's OAuth server with Dex sign-in, Valkey storage; the entry below): without them muster refuses every call that asks, so an agent migrated to `default: Ask` cannot call its tools until they hold. It never runs them unasked. -- **Mandatory before the upgrade:** with the line still on 2.x, set `agentManager.migration.preflightSemver: ">=3.0.0 <4.0.0"` (it renders the never-started CronJob `-agent-manager-migrate-preflight` and grants the migration's identity the read-only access the 3.x path needs: list namespaces; with organizations, read their HelmReleases, OCIRepositories and Agents), then run `kubectl -n create job --from=cronjob/-agent-manager-migrate-preflight preflight-1` and read the report in `kubectl -n logs job/preflight-1` (a dry run writes no ConfigMap). Fix every release it lists that the run will not write (`failed`, and `diff` ones you own in git), including those in organization namespaces, before moving the line; unset `preflightSemver` afterwards to drop the extra reads. Also check releases whose values come from `valuesFrom`: `kubectl get helmreleases -A -o json | jq -r '.items[] | select(.spec.values.muster.requireApproval != null or .spec.values.modelConfig.name == null or (.spec.valuesFrom // [] | length > 0)) | "\(.metadata.namespace)/\(.metadata.name)"'` and the ConfigMaps or Secrets they name. -- The repair is always **replace `muster.requireApproval: true` with `default: Ask`**, never just delete the key (that turns the agent's asks off); drop `requireApproval: false` and `null`; set `modelConfig.name` where it is unset. In git, apply it together with the move of that release's chart source to 3.x; for `valuesFrom`, move the settings into `spec.values` (agent-manager binds settings only from there). -- Running Sessions: with tool approval on (agent-manager at `agent-platform.agentManager.toolApprovalFloor`), agent-manager binds a Session of an agent on `muster.requireApproval: true` with `default: Ask` already on 2.x, so such an agent needs muster's approval prerequisites from then on, not only on 3.x; (such an agent is asked twice there, by kagent and by muster, until it is migrated), so Sessions running across the upgrade keep asking. A Session started by an agent-manager below `agent-platform.agentManager.toolApprovalFloor` carries no settings and muster applies the agent's re-rendered `X-Muster-Tool-Approval: default=Ask`. -- Read the report after the run: `kubectl -n get configmap agent-manager-migrate-report -o jsonpath='{.data.report\.yaml}'`; each rewritten release lists `changes.removed` and `changes.set`. A release carrying `requireApproval: true` beside tool approval settings is reported failed (no released chart renders that combination) and holds its chart source; set its settings by hand. The run needs list on namespaces, read access in organization namespaces and, there, update on HelmReleases and its report ConfigMap (the chart grants the reads only on a 3.x line or preflight range and the writes only on the 3.x line with `agentManager.migration.cutover`, held by the ValidatingAdmissionPolicy `agent-platform-organization-migrate-scope` to organization namespaces and the kagent namespace, to `spec.values` and to the report's name); without them it fails before it writes anything (`--organization-namespaces none` skips them, leaving them unchecked and their sources held). -- **Per organization:** `kubectl get agentplatformorganizations -A -o json | jq -r '.items[] | select(any(.status.conditions[]?; .reason == "ChartSourceHeld")) | "\(.metadata.namespace)/\(.metadata.name)"'` lists the organizations still on 2.x; the report in each one's namespace (`kubectl -n get configmap agent-manager-migrate-report -o jsonpath='{.data.report\.yaml}'`) names the releases that hold it. Apply each diff in the organization's repository (`default: Ask` in place of `requireApproval: true`), then run migrate again: `kubectl -n create job --from=cronjob/-agent-manager-migrate migrate-2` (also after a run that failed a write, and when the condition names releases created after the run). Once none is held, unset `agentManager.migration.cutover`: the migration's identity then keeps its reads on the 3.x line and loses its writes in organization namespaces. +- **Before the upgrade (mandatory), with the line still on 2.x:** set `agentManager.migration.preflightSemver: ">=3.0.0 <4.0.0"`, run `kubectl -n create job --from=cronjob/-agent-manager-migrate-preflight preflight-1` and read `kubectl -n logs job/preflight-1` (a dry run writes nothing). Fix every release it lists that the run will not write (`failed`, and `diff` ones you own in git), organization namespaces included, then unset `preflightSemver`. Also list releases with `valuesFrom` or without the 3.x settings: `kubectl get helmreleases -A -o json | jq -r '.items[] | select(.spec.values.muster.requireApproval != null or .spec.values.modelConfig.name == null or (.spec.valuesFrom // [] | length > 0)) | "\(.metadata.namespace)/\(.metadata.name)"'`. +- **The repair is always `muster.requireApproval: true` to `default: Ask`**, never just deleting the key (that turns asks off); drop `false` and `null`; set `modelConfig.name` where unset. In git, apply it together with moving that release's chart source to 3.x. +- Once the floors are set, move `agent-manager.agentChart.semver` and `components.default-agent.versionRange` to `>=3.0.0 <4.0.0` together with `components.agent-manager.versionRange` and `components.muster.versionRange` at or above the floors. With organizations on, set `agentManager.migration.cutover: true` in the same change (a boolean; without it the organizations' sources stay held). +- Tool approval's prerequisites must hold (muster's OAuth server with Dex sign-in, Valkey; see the next entry): without them muster refuses every call that asks, so a migrated agent cannot call its tools. It never runs them unasked. +- Running Sessions: with agent-manager at `agentManager.toolApprovalFloor`, it binds `default: Ask` for a Session of an agent still on `requireApproval: true` already on 2.x. That agent needs the prerequisites from then on and is asked twice (kagent and muster) until migrated. Sessions from an older agent-manager carry no settings and muster applies the agent's `X-Muster-Tool-Approval: default=Ask`. +- Read the report: `kubectl -n get configmap agent-manager-migrate-report -o jsonpath='{.data.report\.yaml}'`. A release with `requireApproval: true` beside tool approval settings is `failed`: set its settings by hand. The run needs list on namespaces and, in organization namespaces, read access and update on HelmReleases and its report ConfigMap (granted only on the 3.x line with `cutover`, scoped by the ValidatingAdmissionPolicy `agent-platform-organization-migrate-scope`); without them it fails before writing. +- **Per organization:** `kubectl get agentplatformorganizations -A -o json | jq -r '.items[] | select(any(.status.conditions[]?; .reason == "ChartSourceHeld")) | "\(.metadata.namespace)/\(.metadata.name)"'` lists those still on 2.x; the report in the organization's namespace names the releases that hold it. Apply each diff in the organization's repository, then run migrate again: `kubectl -n create job --from=cronjob/-agent-manager-migrate migrate-2` (also after a failed write, and when the condition names releases created after the run). Once none is held, unset `cutover`. ## \ → \ (tool approval and the governance mode) -muster decides Allow, Ask or Block for every tool call, and the chart renders muster's governance configuration (`governance` — `{mode, roleFloors}` —, `governedServers`: per shipped MCPServer its role and its safe list of reads), the approval page's installation name, the redirect allowlist and the approval binder ([chart README, "Tool approval and the governance mode"](helm/agent-platform/README.md#tool-approval-and-the-governance-mode)). None of it reaches a muster below `agent-platform.muster.governanceFloor`. +muster decides Allow, Ask or Block for every tool call; the chart renders its governance configuration, the approval page's installation name, the redirect allowlist and the approval binder ([chart README](helm/agent-platform/README.md#tool-approval-and-the-governance-mode)). None of it reaches a muster below `agent-platform.muster.governanceFloor`. ### Operator action -- Move `components.muster.versionRange` to the muster release that carries tool approval with this chart. `governance.mode: governed` below it fails the render. -- After muster's CRD upgrade, force a reconcile of the releases that render MCPServers (connectivity, agent-platform-mcps, the managers) if any of them was applied while the old CRD was served (its `spec.approval` was pruned): `flux reconcile helmrelease -n --force`. Until the CRD knows `spec.approval`, muster refuses every server tool. -- **Editor defaults changed.** `muster.rbac.mcpServerEditor.subjects` (the connector admins) and `muster.rbac.workflowEditor.subjects` default to a ServiceAccount subject the chart never creates and no identity provider can issue a token for (`kube-system/agent-platform-unset-connector-admins`, `kube-system/agent-platform-unset-workflow-editors`); before, they named two fixed admin groups. Set both to your admin groups in the installation's values (as the API server sees them, with the OIDC groups prefix); `tenants.platformTeam` is still appended. Until then only cluster admins register servers, author workflows or change tool approval (fail closed). Keep the lists non-empty: muster's chart no longer binds `system:authenticated` and fails the upgrade with an empty list while the old binding exists (`muster.rbac.mcpServerEditor.allowRemovingBinding: true` drops it). `tenants.platform.editors` keeps its earlier default admin groups: replace them too. -- **`governance` is a map** mirroring muster's governance configuration: `governance: {mode: trusted|governed, roleFloors: {}}`. Write `governance.mode: governed` where you wrote `governance: governed`; a string fails the render with that hint. -- **No server outside the platform's components is governed by default.** The earlier default `governedServers` entry for a vendor's own manager is gone, and role floors beyond muster's built-in ones come from `governance.roleFloors` (set below the muster governance floor, it fails the render instead of being dropped). An installation that registers a server of its own names it with its role and safe list in `governedServers` and its floors in `governance.roleFloors`, in the installation's values (a vendor documents its own server's entry): +- Move `components.muster.versionRange` to the muster release carrying tool approval. `governance.mode: governed` below it fails the render. +- After muster's CRD upgrade, force a reconcile of the releases that render MCPServers (connectivity, agent-platform-mcps, the managers) if any was applied while the old CRD was served (its `spec.approval` was pruned): `flux reconcile helmrelease -n --force`. Until then muster refuses every server tool. Check with `kubectl get mcpservers -A -o custom-columns=NAME:.metadata.name,RULE:.spec.approval.rule`. +- **Editor defaults changed.** `muster.rbac.mcpServerEditor.subjects` (connector admins) and `muster.rbac.workflowEditor.subjects` default to a ServiceAccount nobody can authenticate as (`kube-system/agent-platform-unset-connector-admins`, `...-workflow-editors`); before, they named two fixed admin groups. Set both to your admin groups (with the OIDC groups prefix); `tenants.platformTeam` is still appended. Until then only cluster admins register servers, author workflows or change tool approval. Keep the lists non-empty: muster's chart fails the upgrade with an empty list while its old `system:authenticated` binding exists (`muster.rbac.mcpServerEditor.allowRemovingBinding: true` drops it). `tenants.platform.editors` keeps its earlier default groups: replace them too. +- **`governance` is a map.** Write `governance.mode: governed` where you wrote `governance: governed`; a string fails the render. +- **No server outside the platform's components is governed by default.** Own servers go in `governedServers` with `governance.roleFloors` (set below the muster governance floor, the render fails): ```yaml governance: @@ -54,10 +63,11 @@ muster decides Allow, Ask or Block for every tool call, and the chart renders mu role: exampleManager safe: [get_info, list_changes] ``` -- Replace an own `muster.muster.governance.servers.` with `governedServers` entries (the render fails on the earlier shape). -- An edge not on 443: set `backstage.publicPort`, and remove a hand-written portal entry from `muster.muster.oauth.mcpClient.postLoginRedirectAllowlist`. The allowlist reaches muster only with `muster.muster.oauth.mcpClient.enabled`. +- Replace an own `muster.muster.governance.servers.` with `governedServers` entries (the earlier shape fails the render). +- An edge not on 443: set `backstage.publicPort` and remove a hand-written portal entry from `muster.muster.oauth.mcpClient.postLoginRedirectAllowlist`. The allowlist reaches muster only with `muster.muster.oauth.mcpClient.enabled`. - An agent-manager ServiceAccount the chart does not create (`agent-manager.serviceAccount.create: false`) needs `agent-manager.serviceAccount.name`. -- Clients (portal, klaus-gateway, kagent) retry an approved call as the same client of the same person (any MCP session of it); another client of the person asks anew. +- The connectivity release no longer renders `agent-platform:muster-approval-binder`; the muster release binds `muster-approval-binder` in muster's namespace instead. +- Clients (portal, klaus-gateway, kagent) retry an approved call as the same client of the same person; another client asks anew. ## \ → \ (forge CLI configuration from the Harness only) diff --git a/docs/authentication.md b/docs/authentication.md index c98604ba..1309343d 100644 --- a/docs/authentication.md +++ b/docs/authentication.md @@ -46,15 +46,20 @@ muster signs no tokens of its own: every downstream server validates against Dex ### The portal's own client and sign-in handoff -By default the portal signs people in with the platform's shared client (`global.identity.clientId`), which muster, the managers and the CLI helpers use as well. `backstage.oidcClientId` gives the portal a client of its own at the same issuer: +By default the portal signs in with the platform's shared client (`global.identity.clientId`). `backstage.oidcClientId` gives it a client of its own at the same issuer: -- the identity provider registers it with the portal's redirect URI only (`https:///api/auth/oidc-agent-platform/handler/frame`), and its secret goes into `global.identity.existingSecret` under `portal-dex-client-secret`; -- the portal requests the platform client's audience (`audience:server:client_id:`, added to `backstage.extraScopes`), so the token's `aud` still holds the platform client and every component that trusts it (muster's `trustedAudiences`, the managers' trusted audiences, the API server through `dex-k8s-authenticator`) accepts it unchanged. Its `azp` names the portal's client. On Dex the platform client and `dex-k8s-authenticator` (and any other client whose audience `extraScopes` requests) list the portal's client under `trustedPeers`; -- muster keys a forwarded token's session by its client too: a person's connector sign-ins made through the shared client are not the portal's, except subject-scoped ones (`spec.auth.grantScope: subject`). +- The identity provider registers it with the portal's redirect URI only (`https:///api/auth/oidc-agent-platform/handler/frame`); its secret goes into `global.identity.existingSecret` under `portal-dex-client-secret`. +- The portal also requests the platform client's audience (`audience:server:client_id:`, added to `backstage.extraScopes`), so every component that trusts the platform client accepts its tokens unchanged; `azp` names the portal's client. On Dex, the platform client and `dex-k8s-authenticator` list the portal's client under `trustedPeers`. +- muster keys a forwarded token's session by its client too: a person's connector sign-ins through the shared client are not the portal's, except subject-scoped ones (`spec.auth.grantScope: subject`). -With a dedicated client and `backstage.signInHandoff` on (the default), the chart lists that client, and only that one, in muster's `approval.trustedClients` (from `agent-platform.muster.trustedClientsFloor`, the first muster that reviews the portal backend's workload and confirms a handed-over sign-in; below it the chart lists none, under either name). muster trusts that client with a person's approvals: a tool approval in portal chat is shown inline and decided on the person's click (*Approve* / *Decline*), the portal backend posting the decision to muster (`POST /approvals/{id}/decision`) with the person's token and the digest of what was shown; and *Open* on a connector sign-in prompt asks muster `POST /handoff-tickets` for a one-time ticket, so the sign-in opens signed in. A person's portal token is not held by the portal backend alone: the browser resolves it and sends it to the backend, muster forwards it to `forwardToken` servers, and a runtime handed the caller's credential holds it. So muster takes it on these two endpoints only together with the portal backend's own workload identity: its projected ServiceAccount token (audience `muster`), sent in `X-Muster-Approval-Client`, which muster reviews with a `TokenReview` and a `LocalSubjectAccessReview` for verb `decide` on `toolapprovals.muster.giantswarm.io` in muster's namespace. From the same floor the chart binds the muster chart's Role `muster-approval-decider` to the portal's ServiceAccount (`backstage.name`, default `backstage`, in the portal's namespace; `muster.rbac.approvalDecider.subjects`, an own list stands) and nothing else, and projects that token into the portal's pod at `/var/run/secrets/muster.giantswarm.io/serviceaccount/token`, where its muster backend reads it. The person's token proves who decides, the workload token that the portal backend presents it: either alone decides nothing and mints no ticket. The remaining trade-off: the portal backend can approve a person's pending requests without muster's browser sign-in (script injected into the portal can ask it to); it decides only on the person's click. muster refuses any token naming an acting party, an agent's credential, another client, another workload and another person. A connector sign-in opened through a handoff ticket still asks the browser on muster's own page (*Connect as ?*) before it goes on, so a link passed to someone else's browser connects nothing unseen. Only the portal's dedicated client may be listed: the render fails when `muster.muster.approval.trustedClients` or `handoffClients` names any other id, the shared client (agents' delegations and CLIs hold its tokens), `dex-k8s-authenticator`, the kagent UI's or klaus-gateway's client, or a CLI's. `backstage.signInHandoff: false` keeps every decision and sign-in on muster's own pages. +With a dedicated client and `backstage.signInHandoff` on (default), the chart lists that client, and only it, in muster's `approval.trustedClients` (from `agent-platform.muster.trustedClientsFloor`; below it none). The portal then shows a tool approval inline and posts the decision to muster (`POST /approvals/{id}/decision`) with the person's token and the digest of what was shown, and *Open* on a connector sign-in prompt gets a one-time ticket from `POST /handoff-tickets`. A person's portal token is not held by the portal backend alone (the browser, `forwardToken` servers and runtimes hold it too), so muster takes it on these two endpoints only together with the backend's own workload identity: its projected ServiceAccount token (audience `muster`, in `X-Muster-Approval-Client`, checked by `TokenReview` and a `LocalSubjectAccessReview` for `decide` on `toolapprovals.muster.giantswarm.io`). The chart binds muster's Role `muster-approval-decider` to the portal's ServiceAccount (`muster.rbac.approvalDecider.subjects`; an own list stands) and projects the token at `/var/run/secrets/muster.giantswarm.io/serviceaccount/token`. Either token alone decides nothing and mints no ticket. -`agentlab portal dev` (a portal running from a checkout on the developer's machine against the lab) has no projected token: agentlab mints one for the lab portal's ServiceAccount (TokenRequest, audience `muster`) on every start and points the portal's `muster.workloadTokenFile` at it, so inline approval works there as in the cluster. That token is lab-only and the lab's to mint; never copy an installation's portal token to a laptop. +- Trade-off: the portal backend can approve a person's pending requests without muster's browser sign-in, on the person's click only. +- muster refuses tokens naming an acting party, an agent's credential, another client, another workload or another person. A ticketed connector sign-in still asks the browser on muster's page first. +- Only the portal's dedicated client may be listed: the render fails when `muster.muster.approval.trustedClients` or `handoffClients` names any other id (the shared client, `dex-k8s-authenticator`, the kagent UI's, klaus-gateway's or a CLI's). +- `backstage.signInHandoff: false` keeps every decision and sign-in on muster's own pages. + +`agentlab portal dev` has no projected token: agentlab mints a lab-only one for the lab portal's ServiceAccount (audience `muster`) on every start and points `muster.workloadTokenFile` at it. Never copy an installation's portal token to a laptop. ## 4. Edge JWT validation and JWKS diff --git a/docs/toolset-presets.md b/docs/toolset-presets.md index e4177ec7..ac7a583a 100644 --- a/docs/toolset-presets.md +++ b/docs/toolset-presets.md @@ -2,7 +2,7 @@ A **toolset** is the selector list an agent declares to say which of the gateway's tools it is composed with: the agent chart's `toolset` value (rendered as the `X-Muster-Toolset` header on the agent's muster tool entry), agent-manager's `toolset` argument, or the `toolset` argument of muster's `filter_tools`. muster evaluates it on every request as one more filter on the caller's own catalogue — it never widens access; the invoking human's identity and the backends' own authorization remain the boundary. The grammar, the built-in presets and the error texts are muster's: [docs/reference/toolsets.md](https://github.com/giantswarm/muster/blob/main/docs/reference/toolsets.md). -A toolset selects tools; whether a selected tool runs, asks a person or is hidden is its connector's tool approval setting (`Allow`, `Ask`, `Block`, and a connector-wide `rule`), and on a governed platform agents are also asked before every non-read tool of the platform's own servers (the agent-platform chart's README, "Tool approval and the governance mode"; further reading, optional: [Governing tool calls](https://docs.giantswarm.io/overview/agent-platform/governing-tool-calls/)). Once agent-manager ships per-agent tool lists (its `create_agent` schema has `tools`), the toolset becomes the agent's `tools` list: the same selectors, each optionally `Allow`, `Ask` or `Block`, plus a `default` for the list. +A toolset only selects tools; whether a selected tool runs, asks a person or is hidden is its connector's tool approval (`Allow`, `Ask`, `Block`; the agent-platform chart README, "Tool approval and the governance mode"; [Governing tool calls](https://docs.giantswarm.io/overview/agent-platform/governing-tool-calls/)). Once agent-manager ships per-agent tool lists (`tools` in `create_agent`), the toolset becomes that list: the same selectors, each optionally `Allow`, `Ask` or `Block`, plus a `default`. A **preset** is a named selection an agent refers to as `preset:`. Presets are muster configuration — `toolsetPresets` in muster's `config.yaml`, which the muster chart renders from its `muster.toolsetPresets` value. This meta-package forwards its `muster:` block to the muster release, so the presets an installation ships live under **`muster.muster.toolsetPresets`** in these values (the first `muster` is the component block, the second is the muster chart's own `muster:` key). diff --git a/helm/agent-platform-connectivity/values.yaml b/helm/agent-platform-connectivity/values.yaml index 489312e3..8d5daa9b 100644 --- a/helm/agent-platform-connectivity/values.yaml +++ b/helm/agent-platform-connectivity/values.yaml @@ -810,11 +810,9 @@ networkPolicy: musterInClusterMcpPorts: - 8080 - 8443 - # Port of muster's session bindings API, which agent-manager calls on its - # own port (start_session's binds, grant drops) and muster admits from - # agent-manager alone; set by the meta chart from muster's floor. 0 (the - # default) opens no egress for it: agent-manager then binds on muster's - # aggregator port. + # Port of muster's session bindings API (agent-manager only); set by the meta + # chart from muster's floor. 0 opens no egress for it: agent-manager binds on + # muster's aggregator port. musterSessionBindingsPort: 0 # Namespace muster runs in, for that egress rule; set by the meta chart from # muster's namespace (components.muster.targetNamespace). Empty selects the @@ -1807,24 +1805,17 @@ kagent: # @schema skipProperties: true; additionalProperties: true # The line the Dev Portal shows under the server's name (the MCPServer's # spec.description, at most 500 characters); empty renders none. description: "Your agent sessions on this installation, as the signed-in person: list them, send one a message, and checkpoint or fork them" - # The connector's tool approval (the MCPServer's spec.approval; further - # reading, optional: https://docs.giantswarm.io/overview/agent-platform/governing-tool-calls/): - # `rule` (Allow | Ask | Block; a Block rule hides and refuses every - # tool without its own entry, new ones included) for a tool without its - # own entry, and `tools`, the server's own tool names -> Allow | Ask | - # Block (Block hides the tool), at most 512. Written out for every tool - # of the kagent line as the Allow all preset: the platform's own session - # tools, which every session with the agent-platform preset uses as the - # person who ran the turn and which carry no MCP annotations (Recommended - # would make reads ask too). These settings apply on a trusted platform - # (invoke_session and fork_session included: no floor covers them); on a - # governed one muster asks agents before every tool of this server that - # is not on its safe list (the meta chart's governedServers.kagent, role - # sessionManager: the list and read tools), whatever these say. An - # installation tightens a tool here; null renders none (the connector - # runs every tool, not reviewed). A muster whose CRD lacks spec.approval - # drops the field, and muster then refuses the server's tools until the - # CRD is upgraded. + # The connector's tool approval (spec.approval; see + # https://docs.giantswarm.io/overview/agent-platform/governing-tool-calls/): + # `rule` (Allow | Ask | Block) for a tool without its own entry, new ones + # included, and `tools`, the server's own tool names -> Allow | Ask | Block + # (at most 512). Written out for every tool as the Allow all preset: these + # session tools run as the person who ran the turn and carry no MCP + # annotations. On a governed platform muster also asks agents before every + # tool not on the meta chart's governedServers.kagent safe list, whatever + # these say. null renders none (the connector runs every tool, not + # reviewed). Without spec.approval in muster's CRD, muster refuses the + # server's tools until the CRD is upgraded. approval: rule: Allow tools: @@ -2969,24 +2960,18 @@ agentManager: # @schema skipProperties: true; additionalProperties: true # --dry-run: the report and the diffs, nothing written — a rehearsal of # one installation's cut-over before the real run. dryRun: false - # A second, never-started CronJob -preflight that runs - # `migrate --dry-run` against this range instead of the line's, e.g. - # ">=3.0.0 <4.0.0" before the agent chart line moves to 3.x: the mandatory - # check of UPGRADE.md, run as the migration's identity with - # `kubectl create job --from=cronjob/-preflight`, reading its - # report from the run's log (a dry run writes nothing). A 3.x range here - # also grants the identity the read-only access the 3.x path needs (list - # namespaces; with organizations, read their releases, sources and Agents); - # empty (the default) renders neither. + # A never-started CronJob -preflight that runs `migrate --dry-run` + # against this range instead of the line's, e.g. ">=3.0.0 <4.0.0" before the + # agent chart line moves to 3.x (the mandatory check of UPGRADE.md; a dry + # run writes nothing). A 3.x range also grants the migration's identity the + # read-only access the 3.x path needs. Empty renders neither. preflightSemver: "" - # true while the 2.x -> 3.x cut-over of the organizations runs: only then, - # and only with agent-manager.agentChart.semver on a 3.x line and - # agentPlatformOrganizations.enabled, the migration's identity may update - # the organizations' HelmReleases (spec.values only) and write its report - # there, held by the ValidatingAdmissionPolicy - # agent-platform-organization-migrate-scope. Set it in the change that - # moves the line; unset it once no organization is Ready=False with reason - # ChartSourceHeld (UPGRADE.md). + # true only while the organizations' 2.x -> 3.x cut-over runs, with + # agent-manager.agentChart.semver on 3.x and agentPlatformOrganizations + # enabled: the migration's identity may then update the organizations' + # HelmReleases (spec.values only) and write its report there, held by the + # ValidatingAdmissionPolicy agent-platform-organization-migrate-scope. + # Unset it once no organization is Ready=False with reason ChartSourceHeld. cutover: false # Namespaces the GitOps-owned agents' HelmReleases and OCIRepositories live # in (a HelmRelease with targetNamespace: kagent applied from elsewhere — @@ -3591,15 +3576,13 @@ backstage: # @schema skipProperties: true; additionalProperties: true extraScopes: - federated:id - audience:server:client_id:dex-k8s-authenticator - # The portal's own OAuth client. Empty (the default) signs in with - # global.identity.clientId and the env AGENT_PLATFORM_OIDC_CLIENT_SECRET. - # Set and different from it, the login provider takes this client id and - # the env AGENT_PLATFORM_PORTAL_OIDC_CLIENT_SECRET (the meta chart mounts - # the key portal-dex-client-secret of global.identity.existingSecret), and - # audience:server:client_id: is added to the - # extraScopes (unless they are empty), so the portal's tokens keep the - # platform client's audience. The meta chart's values.yaml says what the - # identity provider needs for it (backstage.oidcClientId there). + # The portal's own OAuth client. Empty (default) signs in with + # global.identity.clientId and AGENT_PLATFORM_OIDC_CLIENT_SECRET. Set, the + # login provider takes this id and AGENT_PLATFORM_PORTAL_OIDC_CLIENT_SECRET + # (the meta chart mounts the key portal-dex-client-secret), and + # audience:server:client_id: is added to + # extraScopes (unless they are empty). The meta chart's values.yaml lists + # what the identity provider needs. oidcClientId: "" # Extra query parameters on the login provider's authorize request (the # oidc authenticator's startUrlSearchParams). Dex needs none. Google models @@ -3723,26 +3706,18 @@ mcp-kubernetes: # @schema skipProperties: true; additionalProperties: true # What the Dev Portal shows under the name (the MCPServer's # spec.description), at most 500 characters. Empty renders none. description: "Resources, events and pod logs of this installation's cluster, and the health of its workload clusters" - # The connector's tool approval (the MCPServer's spec.approval; further - # reading, optional: https://docs.giantswarm.io/overview/agent-platform/governing-tool-calls/): - # `rule` (Allow | Ask | Block; a Block rule hides and refuses every tool - # without its own entry) for a tool without its own entry, new tools + # The connector's tool approval (spec.approval; see + # https://docs.giantswarm.io/overview/agent-platform/governing-tool-calls/): + # `rule` (Allow | Ask | Block) for a tool without its own entry, new ones # included, and `tools`, the server's own tool names -> Allow | Ask | Block - # (Block hides the tool), at most 512. Written out for every tool of - # mcp-kubernetes as the Recommended preset, as agent-platform-mcps' - # kubernetes family: the tools annotated read-only run, every other one - # asks a person (the mutating ones are registered only when the server's - # non-destructive mode is off), new tools ask until listed. An - # installation changes a tool here; null renders none (the connector - # runs every tool, not reviewed). The 15 deprecated kubernetes_* aliases - # the server registers beside these are not listed: they follow the rule - # (Ask). This map equals agent-platform-mcps' kubernetes family's (make - # verify-tool-approval compares them where that checkout is beside this - # one). On a governed platform muster asks agents before every tool not on - # the meta chart's governedServers.mcp-kubernetes safe list (role - # infrastructure), whatever these say. A muster whose CRD lacks - # spec.approval drops the field, and muster then refuses the server's - # tools until the CRD is upgraded. + # (at most 512). Written out as the Recommended preset, equal to + # agent-platform-mcps' kubernetes family (make verify-tool-approval compares + # them): read-only tools run, every other one asks, new tools ask until + # listed. The deprecated kubernetes_* aliases follow the rule. On a governed + # platform muster also asks agents before every tool not on the meta chart's + # governedServers.mcp-kubernetes safe list. null renders none (not + # reviewed). Without spec.approval in muster's CRD, muster refuses the + # server's tools until the CRD is upgraded. approval: rule: Ask tools: diff --git a/helm/agent-platform/README.md b/helm/agent-platform/README.md index afabbfea..221dbea2 100644 --- a/helm/agent-platform/README.md +++ b/helm/agent-platform/README.md @@ -379,125 +379,56 @@ required); below `1.3.0` the key is refused. ## Tool approval and the governance mode Every tool behind muster is **Allow**, **Ask** (a person confirms the call first) or **Block** -(hidden and refused); a connector's `rule` (Allow, Ask or Block) is what a tool without its own -entry gets, new tools included, so a Block rule lets nobody add an unreviewed tool. muster's -documentation describes the settings and the prompts; further reading (optional): -[Governing tool calls](https://docs.giantswarm.io/overview/agent-platform/governing-tool-calls/). What this chart configures: +(hidden and refused). A connector's `rule` applies to tools without their own entry, new ones +included. Concepts and prompts: [Governing tool calls](https://docs.giantswarm.io/overview/agent-platform/governing-tool-calls/). -- **`governance.mode`** (`trusted`, the default, or `governed`) and **`governedServers`**: the meta - chart renders muster's governance configuration (`muster.governance`: `mode` and - `governedServers`, one `{server, role, safe}` per MCPServer the platform ships while it renders) - from the muster release that reads it (`agent-platform.muster.governanceFloor`). On governed, - muster asks a person before an agent runs any tool of a governed server that is not on that - server's safe list (new and renamed tools too) and any of muster's own tools but its reads; the - safe lists are the read tools (`governedServers..safe`). A role's floors (granting access, - adding a model, egress origin, credential or backend, approving an action or a toolchain source, - adding or repointing a connector, changing approval settings) ask agents in both modes, on the - governed server of that role, so the servers are named on trusted as well. Sources: the manager - components (their `muster.mcpServer.name` in their namespace), `kagent` (the connectivity chart's - session tools), `mcp-kubernetes` (the connectivity chart's and every agent-platform-mcps - kubernetes entry), and any other key as a muster server key itself (a server the installation - registers); a server outside muster's namespace is keyed `namespace/name`. `null` drops a source; `governanceExempt` names the shipped sources that are - deliberately not governed (prometheus, capi: reads only). An own - `muster.muster.governance.governedServers` entry stands for its server; the earlier - `muster.muster.governance.servers.` shape fails the render, as does `governed` below the - muster floor (it would ask nothing). Persons get the connector settings only. The mode is set - with this chart value; no agent tool changes it. `governance` mirrors muster's own governance - configuration (`{mode, roleFloors}`); a string there fails the render. Anything but the two values fails the render. -- **`governance.roleFloors`** (default `{}`): role name to the server's own tool names that ask agents - in both modes on the governed servers of that role, rendered as `muster.governance.roleFloors` and - added to muster's built-in floors (config never removes one). Set while the chart renders no - governance configuration (below the muster governance floor) it fails the render. A role declared here is a valid - `role` in `governedServers`, so an installation governs a server of its own: +| Value | What it does | +|-------|--------------| +| `governance.mode` | `trusted` (default) or `governed`; anything else fails the render. `governed` asks a person before an agent runs any tool of a governed server that is not on its safe list (new tools too) and any muster tool but its reads; it fails the render below `agent-platform.muster.governanceFloor`. | +| `governedServers` | Per source `{role, safe}`: `safe` is the read tools agents call unasked. Sources: the manager components, `kagent`, `mcp-kubernetes`, or any other key as a muster server key (`namespace/name` outside muster's namespace). `null` drops a source; `governanceExempt` lists shipped sources left ungoverned. The earlier `muster.muster.governance.servers.` shape fails the render. | +| `governance.roleFloors` | Role to tool names that ask agents in both modes, added to muster's built-in floors. A role declared here is valid in `governedServers`. | - ```yaml - governance: - roleFloors: - exampleManager: [approve_change, merge_change] - governedServers: - example-manager: - role: exampleManager - safe: [get_info, list_changes] - ``` -- **What approval needs, and what this chart renders for it.** Asking calls refuse with the reason - unless muster's shared store is Valkey, muster runs its OAuth server (the browser sign-in through - Dex) and has a public URL on that server's origin. The bundled Valkey and - `muster.muster.oauth.server.storage.type: valkey` are the defaults; the OAuth server is on by - default but needs the installation's `oauth.server.baseUrl`, `dex.issuerUrl`, `dex.clientId` and - `existingSecret`; `muster.muster.oauth.mcpClient.enabled` with `publicUrl` (on the origin of - `oauth.server.baseUrl`) is the installation's to set (muster takes the OAuth server's base URL - when `publicUrl` is empty, but renders the allowlist below only with `mcpClient.enabled`; the - release notes say so while it is off). The chart does not fail a `governed` render without them: - muster refuses each asking call with the reason and `filter_tools` reports - `approval.unavailable`. From the same muster release the meta chart also renders - `muster.approval.installation` (the name the approval page shows: `backstage.installationName`, - default `agent-platform`; an own `muster.muster.approval.installation` stands) and - `muster.oauth.mcpClient.postLoginRedirectAllowlist`, where muster may send the browser back after - a decision (scheme, host and port must match exactly): `https://[:]/sessions` - while the portal is on and has a host (`backstage.hostname`, else `backstage.`; - the port from `backstage.publicPort` when it is not 443) and - `/auth/slack/return` (its port kept; anything but an http(s) - URL with a host fails) while klaus-gateway is on and names it; an own list's entries stay. - Without an entry the person sees muster's own "answer recorded" page and answers *Done* in the - portal or Slack. -- **Retry as the same client.** muster binds a pending approval to the person and the calling - client (the OAuth client id `azp` of a person's client, the acting party of a delegated token, - or the agent's own Session for an actor JWT), not to the MCP session: after the person decides, - the same client retries, over any MCP session; another client of the same person asks anew. - At most 3 pending approvals per client and 10 per person. -- **The `connector-admin` role** is muster's `mcpserver-editor` Role in muster's namespace, bound to - `muster.rbac.mcpServerEditor.subjects` plus `tenants.platformTeam`. Whoever holds it edits the - namespace's connectors, sets their tool approval and may let an agent skip a tool's `Ask`. The - default binds no person: a ServiceAccount subject the chart never creates and no identity provider - can issue a token for (`kube-system/agent-platform-unset-connector-admins`; - `muster.rbac.workflowEditor.subjects` likewise `agent-platform-unset-workflow-editors`), so a - real IdP group can never match it. Until the installation names its admin groups (as the API - server sees them, with the OIDC groups prefix), only cluster admins edit connectors. The muster - chart no longer binds `system:authenticated` and fails an upgrade with an empty list while its - old binding exists; the placeholder keeps the list non-empty (`system:authenticated` makes - everyone a connector admin). -- **`muster-approval-binder`**: muster takes an agent's tool settings in a Session binding only from - a sender allowed to `bind` `toolapprovals` in muster's namespace. The muster chart ships that Role - and binds it there, to `muster.rbac.approvalBinder.subjects`, which the meta chart sets to - agent-manager's ServiceAccount (its name and namespace), and only it; an own list stands, and an - agent-manager ServiceAccount the chart does not create must be named. muster reviews the sender - with its own `tokenreviews` ClusterRole and a `localsubjectaccessreviews` Role in its namespace - (`muster.rbac.approvalBinder.reviews`, on by default), not `system:auth-delegator`. -- **Explicit settings on every shipped connector** (`spec.approval`): the MCPServers this chart - renders carry them as values — `mcp-kubernetes.mcpServer.approval` (the *Recommended* preset: - read-only tools Allow, the rest Ask, rule Ask) and `kagent.controllerRoute.mcp.approval` (*Allow - all*: kagent's session tools carry no annotations, and agents use them as the person); the - component charts set theirs under `.muster.mcpServer.approval` (*Allow all* for the - managers, whose tools the portal calls as the person) and agent-platform-mcps per family - (`agent-platform-mcps.muster.families..approval`, *Recommended*). These are what trusted - platforms and persons get; governed platforms ask agents by the safe lists above. An - installation tightens a tool there (`Ask`, `Block`) or the rule (`Block`); `null` removes the - block (the connector runs everything, shown as *not reviewed*). +Persons get the connectors' settings only; no agent tool changes the mode. `governance` is a map +(`{mode, roleFloors}`); a string fails the render. Registering a server of your own: -### Upgrading to tool approval +```yaml +governance: + roleFloors: + exampleManager: [approve_change, merge_change] +governedServers: + example-manager: + role: exampleManager + safe: [get_info, list_changes] +``` -- Move `components.muster.versionRange` to the muster release that carries tool approval - (`agent-platform.muster.governanceFloor`) together with this chart: below it nothing is - forwarded and `governed` fails the render. muster's CRDs upgrade with the muster release - (`CreateReplace`) and every consumer of them `dependsOn` muster. -- While the served MCPServer CRD lacks `spec.approval`, muster refuses every server tool - (`approval_unavailable`) rather than run them unreviewed. A release applied while the old CRD - was served lost its `spec.approval` (the API server prunes unknown fields) and Helm does not - re-apply an unchanged release: after the CRD upgrade, reconcile the connectivity, agent-platform-mcps and - manager releases with `flux reconcile helmrelease --force`, then check - `kubectl get mcpservers -A -o custom-columns=NAME:.metadata.name,RULE:.spec.approval.rule`. -- `muster.rbac.mcpServerEditor.subjects` must stay non-empty (the default) or the muster chart - fails the upgrade while the old `system:authenticated` binding exists - (`muster.rbac.mcpServerEditor.allowRemovingBinding: true` drops it deliberately). -- The connectivity release no longer renders `agent-platform:muster-approval-binder` (Helm deletes - it); the muster release binds `muster-approval-binder` in muster's namespace instead. -- On a lab or any edge not on 443, set `backstage.publicPort` and drop a hand-written portal entry - from `muster.muster.oauth.mcpClient.postLoginRedirectAllowlist`. -- Clients retry an approved call as the same client (see above). +- **Prerequisites.** Asking calls are refused (reported as `approval.unavailable`) unless muster + runs on Valkey (default), has its OAuth server with Dex sign-in (`oauth.server.baseUrl`, + `dex.issuerUrl`, `dex.clientId`, `existingSecret`) and a public URL on that server's origin + (`muster.muster.oauth.mcpClient.enabled` with `publicUrl`). The chart does not fail a render + without them. +- **Rendered for muster.** `approval.installation` (`backstage.installationName`) and + `oauth.mcpClient.postLoginRedirectAllowlist`: the portal's `/sessions` (`backstage.publicPort` + when not 443) and `/auth/slack/return`; an own list's entries + stay. Without an entry the person answers in the portal or Slack by hand. +- **Retry as the same client.** An approval binds to the person and the calling client, not the MCP + session; another client of the person asks anew. At most 3 pending per client, 10 per person. +- **`connector-admin`** is muster's `mcpserver-editor` Role, bound to + `muster.rbac.mcpServerEditor.subjects` plus `tenants.platformTeam`. Its holders edit connectors, + set tool approval and may let an agent skip an `Ask`. The default subject is a ServiceAccount + nobody can authenticate as (fail closed; `workflowEditor` likewise): set your admin groups, + with the OIDC groups prefix. Binding `system:authenticated` makes everyone an admin. +- **`muster-approval-binder`** lets agent-manager's ServiceAccount (and only it) bind an agent's + tool settings to a Session (`muster.rbac.approvalBinder.subjects`; an own list stands; name an + agent-manager ServiceAccount the chart does not create). +- **Shipped connectors carry `spec.approval`.** `mcp-kubernetes.mcpServer.approval` is + *Recommended* (read-only Allow, rest Ask), `kagent.controllerRoute.mcp.approval` and the managers' + `.muster.mcpServer.approval` are *Allow all*, agent-platform-mcps families + `muster.families..approval` *Recommended*. Tighten a tool or the rule there; `null` + renders none (the connector runs everything, shown as *not reviewed*). -`make verify-tool-approval` asserts the governance configuration and its coverage (every shipped -MCPServer governed or exempt, no floor safe, every safe entry a tool of its server), the -allowlist, the connector admins, the binder and the connectors' settings. +Operator steps: [UPGRADE.md](../../UPGRADE.md). `make verify-tool-approval` asserts the governance configuration, its coverage (every shipped +MCPServer governed or exempt, no floor safe), the allowlist, the admins, the binder and the +connectors' settings. ## Voluntary disruption @@ -1657,13 +1588,13 @@ The map is merged into each component's own `nodeSelector` (`muster.nodeSelector | clusterManager.networkPolicy.workloadClusters.ports[1] | int | `6443` | | | clusterManager.networkPolicy.egress.fqdns | list | `[]` | | | clusterManager.networkPolicy.egress.cidrs | list | `[]` | | -| governance | object | `{"mode":"trusted","roleFloors":{}}` | The platform's governance (mode and role floors). The mode, trusted (the default) or governed, changes no tool approval setting's meaning; it adds asking for agent callers. Governed asks a person before an agent runs any tool of a governed server (governedServers below) that is not on that server's safe list (new and renamed tools too), and before any of muster's own tools but its reads; the Dev Portal's connector wizard pre-selects the Recommended preset (read-only tools run, the rest ask). Trusted lets agents run what the connectors' own settings allow and pre-selects Allow all. In both modes muster's built-in floors ask a person before an agent adds or repoints a connector, changes approval settings, grants access, adds a model, egress origin, credential or backend, approves an action or a toolchain source, or changes muster's own configuration; the role floors hold on the governed servers of that role, so governedServers names them in both modes. The meta chart renders muster's governance configuration from it (muster.governance: the mode and governedServers), from the muster release that reads it (agent-platform.muster.governanceFloor); below it `governed` fails the render and trusted renders nothing. From that release the meta chart also renders muster.approval.installation (backstage.installationName, the name the approval page shows; and trustedClients, the portal's own client, with backstage.oidcClientId and backstage.signInHandoff), muster-approval-binder's subject (agent-manager's ServiceAccount, muster.rbac.approvalBinder.subjects), muster-approval-decider's subject (the portal's ServiceAccount, muster.rbac.approvalDecider.subjects, with its token projected into the portal for audience muster, while muster trusts the portal's client) and the pages muster may return the browser to after an approval in muster.oauth.mcpClient.postLoginRedirectAllowlist (the portal's /sessions with backstage.publicPort, klausGateway.obo.callbackBaseUrl + /auth/slack/return; an own list's entries stay). Approval itself needs muster's OAuth server with Dex sign-in, Valkey storage (the default) and muster.muster.oauth.mcpClient.publicUrl on the OAuth server's origin with mcpClient.enabled for the allowlist; the chart does not fail without them, muster refuses asking calls with the reason. The mode is set with this chart value (no agent tool changes it). The block mirrors muster's own governance configuration; a string here (the earlier scalar) fails the render. Further reading (optional): https://docs.giantswarm.io/overview/agent-platform/governing-tool-calls/ | +| governance | object | `{"mode":"trusted","roleFloors":{}}` | The platform's governance (mode and role floors). `trusted` (default) lets agents run what the connectors' settings allow; `governed` also asks a person before an agent runs any tool of a governed server (governedServers) that is not on its safe list, and any muster tool but its reads. In both modes muster's built-in floors ask before an agent adds or repoints a connector, changes approval settings, grants access, adds a model, egress origin, credential or backend, approves an action or toolchain source, or changes muster's configuration. Rendered as muster.governance from agent-platform.muster.governanceFloor; below it `governed` fails the render. Approval needs muster's OAuth server with Dex sign-in, Valkey storage and muster.muster.oauth.mcpClient.publicUrl (with mcpClient.enabled for the redirect allowlist); without them muster refuses asking calls with the reason. No agent tool changes the mode. A string here (the earlier scalar) fails the render. See https://docs.giantswarm.io/overview/agent-platform/governing-tool-calls/ | | governance.mode | string | `"trusted"` | trusted (the default) or governed; anything else fails the render. | -| governance.roleFloors | object | `{}` | Floors per governance role (muster.governance.roleFloors): role -> the server's own tool names that ask agents in both modes on the governed servers of that role, added to muster's built-in floors (config can only add: a built-in floor is never removed). A role named here is a valid `role` of governedServers. For a server the installation registers itself, e.g.: governance: roleFloors: exampleManager: [approve_change, merge_change] governedServers: example-manager: role: exampleManager safe: [get_info, list_changes] Rendered from the muster release that reads the governance configuration (agent-platform.muster.governanceFloor), like governedServers. | -| governedServers | object | `{"agent-manager":{"role":"agentManager","safe":["get_info","list_agents","get_agent","get_agent_status","validate_agent","list_model_configs","list_egress_policies","list_skills","list_sessions","get_session","get_session_turn","toolchain_users","list_organizations","get_organization","list_organization_members","list_organization_connectors"]},"cluster-manager":{"role":"clusterManager","safe":["get_info","list_clusters","list_releases","list_node_pools"]},"kagent":{"role":"sessionManager","safe":["list_sessions","list_session_checkpoints","list_sandbox_templates","list_sandboxes","get_sandbox","get_sandbox_process","read_sandbox_outputs","read_sandbox_file"]},"mcp-kubernetes":{"role":"infrastructure","safe":["logs","list_port_forward_sessions","context_list","context_get_current","can_i","api_resources","cluster_health","capi_list_clusters","capi_get_cluster","capi_resolve_cluster","capi_cluster_health","get","list","describe"]},"model-manager":{"role":"modelManager","safe":["get_info","get_backend","list_backends","list_models","get_model","list_loaded_models","list_presets","search_models","check_fit","list_nodes","list_jobs","get_job"]},"skill-manager":{"role":"skillManager","safe":["list_skill_sources","list_skills","resolve_skills","get_skill","get_skill_file"]},"toolchain-manager":{"role":"toolchainManager","safe":["list_sources","list_toolchains","describe_toolchain","toolchain_build_status","search_packages"]},"vm-manager":{"role":"vmManager","safe":["get_info","get_host","list_images","get_image","list_networks","get_network","list_vms","get_vm","get_vm_metrics","get_vm_attestation"]},"workspace-manager":{"role":"workspaceManager","safe":["list_providers","list_owners","list_workspaces","get_workspace","list_repositories","preview_workspace"]}}` | The servers muster governs (muster.governance.governedServers), per source the platform ships: `role` (which of muster's role floors hold on it: agentManager, connectorManager, sessionManager, modelManager, clusterManager, vmManager, workspaceManager, toolchainManager, skillManager, infrastructure, or a role governance.roleFloors declares) and `safe`, the server's own tool names agents call unasked on governed (reads only; a floor never, muster refuses to start on one). Every other tool of a governed server asks agents on governed. A source renders one entry per MCPServer it ships while that renders (agent-platform.muster.governedKeys): a manager component's .muster.mcpServer.name in its namespace; kagent the connectivity chart's kagent server; mcp-kubernetes the connectivity chart's and every agent-platform-mcps kubernetes entry; any other key is a muster server key itself (a server the installation registers, e.g. example-manager). null drops a source (then list it in governanceExempt with the reason). make verify-tool-approval fails on a shipped MCPServer that is neither here nor in governanceExempt, and on a safe entry that names a floor or no tool of its server, or whose name starts with a write verb (create, delete, exec, set, approve, ...) unless a `# safe-write: : ` comment above `safe:` says why it reads. | -| governanceExempt | object | `{"capi":"agent-platform-mcps' capi family (mcp-kubernetes' CAPI tools): every tool reads","prometheus":"agent-platform-mcps' prometheus family (mcp-prometheus): every tool reads"}` | MCPServer sources the platform ships that muster deliberately does not govern, each with its reason (make verify-tool-approval wants every shipped source in governedServers or here). Read by the meta chart's tests only. | +| governance.roleFloors | object | `{}` | Floors per governance role (muster.governance.roleFloors): role -> tool names that ask agents in both modes on the governed servers of that role, added to muster's built-in floors. A role named here is valid in governedServers. Example for a server the installation registers: governance: roleFloors: exampleManager: [approve_change, merge_change] governedServers: example-manager: role: exampleManager safe: [get_info, list_changes] | +| governedServers | object | `{"agent-manager":{"role":"agentManager","safe":["get_info","list_agents","get_agent","get_agent_status","validate_agent","list_model_configs","list_egress_policies","list_skills","list_sessions","get_session","get_session_turn","toolchain_users","list_organizations","get_organization","list_organization_members","list_organization_connectors"]},"cluster-manager":{"role":"clusterManager","safe":["get_info","list_clusters","list_releases","list_node_pools"]},"kagent":{"role":"sessionManager","safe":["list_sessions","list_session_checkpoints","list_sandbox_templates","list_sandboxes","get_sandbox","get_sandbox_process","read_sandbox_outputs","read_sandbox_file"]},"mcp-kubernetes":{"role":"infrastructure","safe":["logs","list_port_forward_sessions","context_list","context_get_current","can_i","api_resources","cluster_health","capi_list_clusters","capi_get_cluster","capi_resolve_cluster","capi_cluster_health","get","list","describe"]},"model-manager":{"role":"modelManager","safe":["get_info","get_backend","list_backends","list_models","get_model","list_loaded_models","list_presets","search_models","check_fit","list_nodes","list_jobs","get_job"]},"skill-manager":{"role":"skillManager","safe":["list_skill_sources","list_skills","resolve_skills","get_skill","get_skill_file"]},"toolchain-manager":{"role":"toolchainManager","safe":["list_sources","list_toolchains","describe_toolchain","toolchain_build_status","search_packages"]},"vm-manager":{"role":"vmManager","safe":["get_info","get_host","list_images","get_image","list_networks","get_network","list_vms","get_vm","get_vm_metrics","get_vm_attestation"]},"workspace-manager":{"role":"workspaceManager","safe":["list_providers","list_owners","list_workspaces","get_workspace","list_repositories","preview_workspace"]}}` | The servers muster governs (muster.governance.governedServers), per source: `role` (agentManager, connectorManager, sessionManager, modelManager, clusterManager, vmManager, workspaceManager, toolchainManager, skillManager, infrastructure, or a role governance.roleFloors declares) and `safe`, the server's own read tools that agents call unasked on governed (never a floor). Every other tool asks agents on governed. A source renders one entry per MCPServer it ships: a manager component's .muster.mcpServer.name; kagent; mcp-kubernetes (the connectivity chart's and every agent-platform-mcps kubernetes entry); any other key is a muster server key itself. null drops a source (list it in governanceExempt). make verify-tool-approval fails on a shipped MCPServer in neither place, and on a safe entry that names a floor, no tool of its server, or starts with a write verb unless a `# safe-write: : ` comment above `safe:` says why. | +| governanceExempt | object | `{"capi":"agent-platform-mcps' capi family (mcp-kubernetes' CAPI tools): every tool reads","prometheus":"agent-platform-mcps' prometheus family (mcp-prometheus): every tool reads"}` | Shipped MCPServer sources muster deliberately does not govern, each with its reason. Read by the meta chart's tests only. | | tenants.platform.users | list | `[{"apiGroup":"rbac.authorization.k8s.io","kind":"Group","name":"system:authenticated"}]` | Every signed-in person: bound to agent-platform:platform-user in the kagent namespace, and, while musterMcpServerViewers is unset, to `list` (with get and watch) on muster's MCPServers in muster's namespace (the servers for everyone). RBAC subjects. The default, system:authenticated, gives this to every user. It also gives it to every ServiceAccount, so every pod in the cluster can read the platform tenant's Agents, RemoteMCPServer URLs and muster's MCPServer specs. To give it to people only, replace the default with an OIDC group that every user belongs to, written as the API server sees it (with the installation's OIDC groups prefix). | -| tenants.platform.editors | list | `[{"apiGroup":"rbac.authorization.k8s.io","kind":"Group","name":"giantswarm-ad:giantswarm-admins"},{"apiGroup":"rbac.authorization.k8s.io","kind":"Group","name":"giantswarm-github:giantswarm:giantswarm-admins"}]` | The platform's operators: bound to agent-platform:editor in the kagent namespace. RBAC subjects. The default names two admin groups of the chart's original deployment, kept from before tool approval: replace them with the installation's own. | +| tenants.platform.editors | list | `[{"apiGroup":"rbac.authorization.k8s.io","kind":"Group","name":"giantswarm-ad:giantswarm-admins"},{"apiGroup":"rbac.authorization.k8s.io","kind":"Group","name":"giantswarm-github:giantswarm:giantswarm-admins"}]` | The platform's operators: bound to agent-platform:editor in the kagent namespace. RBAC subjects. The default names two admin groups kept from before tool approval: replace them with the installation's own. | | tenants.platform.kagentRelease.name | string | `""` | The name of kagent's HelmRelease in the kagent namespace. Empty, the default, admits none. | | tenants.platform.kagentRelease.writers | list | `[]` | The identities that write it: RBAC-style subjects of kind User, Group or ServiceAccount (with its namespace), as the API server sees them (a kubeconfig's user or group, a Flux ServiceAccount). | | tenants.platformTeam | list | `[]` | The customer's platform team, per installation: RBAC subjects bound to agent-platform:editor in the kagent namespace beside `platform.editors`, and added to muster's mcpserver-editor and workflow-editor subjects beside muster.rbac.*.subjects (the meta chart appends them to the muster release's values). Empty by default. A group is written as the API server sees it (with the OIDC groups prefix of the installation). | diff --git a/helm/agent-platform/README.md.gotmpl b/helm/agent-platform/README.md.gotmpl index f18c9bbe..11af3547 100644 --- a/helm/agent-platform/README.md.gotmpl +++ b/helm/agent-platform/README.md.gotmpl @@ -365,125 +365,56 @@ required); below `1.3.0` the key is refused. ## Tool approval and the governance mode Every tool behind muster is **Allow**, **Ask** (a person confirms the call first) or **Block** -(hidden and refused); a connector's `rule` (Allow, Ask or Block) is what a tool without its own -entry gets, new tools included, so a Block rule lets nobody add an unreviewed tool. muster's -documentation describes the settings and the prompts; further reading (optional): -[Governing tool calls](https://docs.giantswarm.io/overview/agent-platform/governing-tool-calls/). What this chart configures: - -- **`governance.mode`** (`trusted`, the default, or `governed`) and **`governedServers`**: the meta - chart renders muster's governance configuration (`muster.governance`: `mode` and - `governedServers`, one `{server, role, safe}` per MCPServer the platform ships while it renders) - from the muster release that reads it (`agent-platform.muster.governanceFloor`). On governed, - muster asks a person before an agent runs any tool of a governed server that is not on that - server's safe list (new and renamed tools too) and any of muster's own tools but its reads; the - safe lists are the read tools (`governedServers..safe`). A role's floors (granting access, - adding a model, egress origin, credential or backend, approving an action or a toolchain source, - adding or repointing a connector, changing approval settings) ask agents in both modes, on the - governed server of that role, so the servers are named on trusted as well. Sources: the manager - components (their `muster.mcpServer.name` in their namespace), `kagent` (the connectivity chart's - session tools), `mcp-kubernetes` (the connectivity chart's and every agent-platform-mcps - kubernetes entry), and any other key as a muster server key itself (a server the installation - registers); a server outside muster's namespace is keyed `namespace/name`. `null` drops a source; `governanceExempt` names the shipped sources that are - deliberately not governed (prometheus, capi: reads only). An own - `muster.muster.governance.governedServers` entry stands for its server; the earlier - `muster.muster.governance.servers.` shape fails the render, as does `governed` below the - muster floor (it would ask nothing). Persons get the connector settings only. The mode is set - with this chart value; no agent tool changes it. `governance` mirrors muster's own governance - configuration (`{mode, roleFloors}`); a string there fails the render. Anything but the two values fails the render. -- **`governance.roleFloors`** (default `{}`): role name to the server's own tool names that ask agents - in both modes on the governed servers of that role, rendered as `muster.governance.roleFloors` and - added to muster's built-in floors (config never removes one). Set while the chart renders no - governance configuration (below the muster governance floor) it fails the render. A role declared here is a valid - `role` in `governedServers`, so an installation governs a server of its own: - - ```yaml - governance: - roleFloors: - exampleManager: [approve_change, merge_change] - governedServers: - example-manager: - role: exampleManager - safe: [get_info, list_changes] - ``` -- **What approval needs, and what this chart renders for it.** Asking calls refuse with the reason - unless muster's shared store is Valkey, muster runs its OAuth server (the browser sign-in through - Dex) and has a public URL on that server's origin. The bundled Valkey and - `muster.muster.oauth.server.storage.type: valkey` are the defaults; the OAuth server is on by - default but needs the installation's `oauth.server.baseUrl`, `dex.issuerUrl`, `dex.clientId` and - `existingSecret`; `muster.muster.oauth.mcpClient.enabled` with `publicUrl` (on the origin of - `oauth.server.baseUrl`) is the installation's to set (muster takes the OAuth server's base URL - when `publicUrl` is empty, but renders the allowlist below only with `mcpClient.enabled`; the - release notes say so while it is off). The chart does not fail a `governed` render without them: - muster refuses each asking call with the reason and `filter_tools` reports - `approval.unavailable`. From the same muster release the meta chart also renders - `muster.approval.installation` (the name the approval page shows: `backstage.installationName`, - default `agent-platform`; an own `muster.muster.approval.installation` stands) and - `muster.oauth.mcpClient.postLoginRedirectAllowlist`, where muster may send the browser back after - a decision (scheme, host and port must match exactly): `https://[:]/sessions` - while the portal is on and has a host (`backstage.hostname`, else `backstage.`; - the port from `backstage.publicPort` when it is not 443) and - `/auth/slack/return` (its port kept; anything but an http(s) - URL with a host fails) while klaus-gateway is on and names it; an own list's entries stay. - Without an entry the person sees muster's own "answer recorded" page and answers *Done* in the - portal or Slack. -- **Retry as the same client.** muster binds a pending approval to the person and the calling - client (the OAuth client id `azp` of a person's client, the acting party of a delegated token, - or the agent's own Session for an actor JWT), not to the MCP session: after the person decides, - the same client retries, over any MCP session; another client of the same person asks anew. - At most 3 pending approvals per client and 10 per person. -- **The `connector-admin` role** is muster's `mcpserver-editor` Role in muster's namespace, bound to - `muster.rbac.mcpServerEditor.subjects` plus `tenants.platformTeam`. Whoever holds it edits the - namespace's connectors, sets their tool approval and may let an agent skip a tool's `Ask`. The - default binds no person: a ServiceAccount subject the chart never creates and no identity provider - can issue a token for (`kube-system/agent-platform-unset-connector-admins`; - `muster.rbac.workflowEditor.subjects` likewise `agent-platform-unset-workflow-editors`), so a - real IdP group can never match it. Until the installation names its admin groups (as the API - server sees them, with the OIDC groups prefix), only cluster admins edit connectors. The muster - chart no longer binds `system:authenticated` and fails an upgrade with an empty list while its - old binding exists; the placeholder keeps the list non-empty (`system:authenticated` makes - everyone a connector admin). -- **`muster-approval-binder`**: muster takes an agent's tool settings in a Session binding only from - a sender allowed to `bind` `toolapprovals` in muster's namespace. The muster chart ships that Role - and binds it there, to `muster.rbac.approvalBinder.subjects`, which the meta chart sets to - agent-manager's ServiceAccount (its name and namespace), and only it; an own list stands, and an - agent-manager ServiceAccount the chart does not create must be named. muster reviews the sender - with its own `tokenreviews` ClusterRole and a `localsubjectaccessreviews` Role in its namespace - (`muster.rbac.approvalBinder.reviews`, on by default), not `system:auth-delegator`. -- **Explicit settings on every shipped connector** (`spec.approval`): the MCPServers this chart - renders carry them as values — `mcp-kubernetes.mcpServer.approval` (the *Recommended* preset: - read-only tools Allow, the rest Ask, rule Ask) and `kagent.controllerRoute.mcp.approval` (*Allow - all*: kagent's session tools carry no annotations, and agents use them as the person); the - component charts set theirs under `.muster.mcpServer.approval` (*Allow all* for the - managers, whose tools the portal calls as the person) and agent-platform-mcps per family - (`agent-platform-mcps.muster.families..approval`, *Recommended*). These are what trusted - platforms and persons get; governed platforms ask agents by the safe lists above. An - installation tightens a tool there (`Ask`, `Block`) or the rule (`Block`); `null` removes the - block (the connector runs everything, shown as *not reviewed*). - -### Upgrading to tool approval - -- Move `components.muster.versionRange` to the muster release that carries tool approval - (`agent-platform.muster.governanceFloor`) together with this chart: below it nothing is - forwarded and `governed` fails the render. muster's CRDs upgrade with the muster release - (`CreateReplace`) and every consumer of them `dependsOn` muster. -- While the served MCPServer CRD lacks `spec.approval`, muster refuses every server tool - (`approval_unavailable`) rather than run them unreviewed. A release applied while the old CRD - was served lost its `spec.approval` (the API server prunes unknown fields) and Helm does not - re-apply an unchanged release: after the CRD upgrade, reconcile the connectivity, agent-platform-mcps and - manager releases with `flux reconcile helmrelease --force`, then check - `kubectl get mcpservers -A -o custom-columns=NAME:.metadata.name,RULE:.spec.approval.rule`. -- `muster.rbac.mcpServerEditor.subjects` must stay non-empty (the default) or the muster chart - fails the upgrade while the old `system:authenticated` binding exists - (`muster.rbac.mcpServerEditor.allowRemovingBinding: true` drops it deliberately). -- The connectivity release no longer renders `agent-platform:muster-approval-binder` (Helm deletes - it); the muster release binds `muster-approval-binder` in muster's namespace instead. -- On a lab or any edge not on 443, set `backstage.publicPort` and drop a hand-written portal entry - from `muster.muster.oauth.mcpClient.postLoginRedirectAllowlist`. -- Clients retry an approved call as the same client (see above). - -`make verify-tool-approval` asserts the governance configuration and its coverage (every shipped -MCPServer governed or exempt, no floor safe, every safe entry a tool of its server), the -allowlist, the connector admins, the binder and the connectors' settings. +(hidden and refused). A connector's `rule` applies to tools without their own entry, new ones +included. Concepts and prompts: [Governing tool calls](https://docs.giantswarm.io/overview/agent-platform/governing-tool-calls/). + +| Value | What it does | +|-------|--------------| +| `governance.mode` | `trusted` (default) or `governed`; anything else fails the render. `governed` asks a person before an agent runs any tool of a governed server that is not on its safe list (new tools too) and any muster tool but its reads; it fails the render below `agent-platform.muster.governanceFloor`. | +| `governedServers` | Per source `{role, safe}`: `safe` is the read tools agents call unasked. Sources: the manager components, `kagent`, `mcp-kubernetes`, or any other key as a muster server key (`namespace/name` outside muster's namespace). `null` drops a source; `governanceExempt` lists shipped sources left ungoverned. The earlier `muster.muster.governance.servers.` shape fails the render. | +| `governance.roleFloors` | Role to tool names that ask agents in both modes, added to muster's built-in floors. A role declared here is valid in `governedServers`. | + +Persons get the connectors' settings only; no agent tool changes the mode. `governance` is a map +(`{mode, roleFloors}`); a string fails the render. Registering a server of your own: + +```yaml +governance: + roleFloors: + exampleManager: [approve_change, merge_change] +governedServers: + example-manager: + role: exampleManager + safe: [get_info, list_changes] +``` + +- **Prerequisites.** Asking calls are refused (reported as `approval.unavailable`) unless muster + runs on Valkey (default), has its OAuth server with Dex sign-in (`oauth.server.baseUrl`, + `dex.issuerUrl`, `dex.clientId`, `existingSecret`) and a public URL on that server's origin + (`muster.muster.oauth.mcpClient.enabled` with `publicUrl`). The chart does not fail a render + without them. +- **Rendered for muster.** `approval.installation` (`backstage.installationName`) and + `oauth.mcpClient.postLoginRedirectAllowlist`: the portal's `/sessions` (`backstage.publicPort` + when not 443) and `/auth/slack/return`; an own list's entries + stay. Without an entry the person answers in the portal or Slack by hand. +- **Retry as the same client.** An approval binds to the person and the calling client, not the MCP + session; another client of the person asks anew. At most 3 pending per client, 10 per person. +- **`connector-admin`** is muster's `mcpserver-editor` Role, bound to + `muster.rbac.mcpServerEditor.subjects` plus `tenants.platformTeam`. Its holders edit connectors, + set tool approval and may let an agent skip an `Ask`. The default subject is a ServiceAccount + nobody can authenticate as (fail closed; `workflowEditor` likewise): set your admin groups, + with the OIDC groups prefix. Binding `system:authenticated` makes everyone an admin. +- **`muster-approval-binder`** lets agent-manager's ServiceAccount (and only it) bind an agent's + tool settings to a Session (`muster.rbac.approvalBinder.subjects`; an own list stands; name an + agent-manager ServiceAccount the chart does not create). +- **Shipped connectors carry `spec.approval`.** `mcp-kubernetes.mcpServer.approval` is + *Recommended* (read-only Allow, rest Ask), `kagent.controllerRoute.mcp.approval` and the managers' + `.muster.mcpServer.approval` are *Allow all*, agent-platform-mcps families + `muster.families..approval` *Recommended*. Tighten a tool or the rule there; `null` + renders none (the connector runs everything, shown as *not reviewed*). + +Operator steps: [UPGRADE.md](../../UPGRADE.md). `make verify-tool-approval` asserts the governance configuration, its coverage (every shipped +MCPServer governed or exempt, no floor safe), the allowlist, the admins, the binder and the +connectors' settings. ## Voluntary disruption diff --git a/helm/agent-platform/values.schema.json b/helm/agent-platform/values.schema.json index c34823f3..c115d50f 100644 --- a/helm/agent-platform/values.schema.json +++ b/helm/agent-platform/values.schema.json @@ -2166,7 +2166,7 @@ }, "governance": { "type": "object", - "description": "The platform's governance (mode and role floors). The mode, trusted (the default) or governed, changes no tool approval setting's meaning; it adds asking for agent callers. Governed asks a person before an agent runs any tool of a governed server (governedServers below) that is not on that server's safe list (new and renamed tools too), and before any of muster's own tools but its reads; the Dev Portal's connector wizard pre-selects the Recommended preset (read-only tools run, the rest ask). Trusted lets agents run what the connectors' own settings allow and pre-selects Allow all. In both modes muster's built-in floors ask a person before an agent adds or repoints a connector, changes approval settings, grants access, adds a model, egress origin, credential or backend, approves an action or a toolchain source, or changes muster's own configuration; the role floors hold on the governed servers of that role, so governedServers names them in both modes. The meta chart renders muster's governance configuration from it (muster.governance: the mode and governedServers), from the muster release that reads it (agent-platform.muster.governanceFloor); below it `governed` fails the render and trusted renders nothing. From that release the meta chart also renders muster.approval.installation (backstage.installationName, the name the approval page shows; and trustedClients, the portal's own client, with backstage.oidcClientId and backstage.signInHandoff), muster-approval-binder's subject (agent-manager's ServiceAccount, muster.rbac.approvalBinder.subjects), muster-approval-decider's subject (the portal's ServiceAccount, muster.rbac.approvalDecider.subjects, with its token projected into the portal for audience muster, while muster trusts the portal's client) and the pages muster may return the browser to after an approval in muster.oauth.mcpClient.postLoginRedirectAllowlist (the portal's /sessions with backstage.publicPort, klausGateway.obo.callbackBaseUrl + /auth/slack/return; an own list's entries stay). Approval itself needs muster's OAuth server with Dex sign-in, Valkey storage (the default) and muster.muster.oauth.mcpClient.publicUrl on the OAuth server's origin with mcpClient.enabled for the allowlist; the chart does not fail without them, muster refuses asking calls with the reason. The mode is set with this chart value (no agent tool changes it). The block mirrors muster's own governance configuration; a string here (the earlier scalar) fails the render. Further reading (optional): https://docs.giantswarm.io/overview/agent-platform/governing-tool-calls/", + "description": "The platform's governance (mode and role floors). `trusted` (default) lets agents run what the connectors' settings allow; `governed` also asks a person before an agent runs any tool of a governed server (governedServers) that is not on its safe list, and any muster tool but its reads. In both modes muster's built-in floors ask before an agent adds or repoints a connector, changes approval settings, grants access, adds a model, egress origin, credential or backend, approves an action or toolchain source, or changes muster's configuration. Rendered as muster.governance from agent-platform.muster.governanceFloor; below it `governed` fails the render. Approval needs muster's OAuth server with Dex sign-in, Valkey storage and muster.muster.oauth.mcpClient.publicUrl (with mcpClient.enabled for the redirect allowlist); without them muster refuses asking calls with the reason. No agent tool changes the mode. A string here (the earlier scalar) fails the render. See https://docs.giantswarm.io/overview/agent-platform/governing-tool-calls/", "additionalProperties": false, "properties": { "mode": { @@ -2179,7 +2179,7 @@ }, "roleFloors": { "type": "object", - "description": "Floors per governance role (muster.governance.roleFloors): role -> the server's own tool names that ask agents in both modes on the governed servers of that role, added to muster's built-in floors (config can only add: a built-in floor is never removed). A role named here is a valid `role` of governedServers. For a server the installation registers itself, e.g.: governance: roleFloors: exampleManager: [approve_change, merge_change] governedServers: example-manager: role: exampleManager safe: [get_info, list_changes] Rendered from the muster release that reads the governance configuration (agent-platform.muster.governanceFloor), like governedServers.", + "description": "Floors per governance role (muster.governance.roleFloors): role -> tool names that ask agents in both modes on the governed servers of that role, added to muster's built-in floors. A role named here is valid in governedServers. Example for a server the installation registers: governance: roleFloors: exampleManager: [approve_change, merge_change] governedServers: example-manager: role: exampleManager safe: [get_info, list_changes]", "additionalProperties": { "type": "array", "items": { @@ -2191,7 +2191,7 @@ }, "governanceExempt": { "type": "object", - "description": "MCPServer sources the platform ships that muster deliberately does not govern, each with its reason (make verify-tool-approval wants every shipped source in governedServers or here). Read by the meta chart's tests only.", + "description": "Shipped MCPServer sources muster deliberately does not govern, each with its reason. Read by the meta chart's tests only.", "properties": { "capi": { "type": "string" @@ -2206,7 +2206,7 @@ }, "governedServers": { "type": "object", - "description": "The servers muster governs (muster.governance.governedServers), per source the platform ships: `role` (which of muster's role floors hold on it: agentManager, connectorManager, sessionManager, modelManager, clusterManager, vmManager, workspaceManager, toolchainManager, skillManager, infrastructure, or a role governance.roleFloors declares) and `safe`, the server's own tool names agents call unasked on governed (reads only; a floor never, muster refuses to start on one). Every other tool of a governed server asks agents on governed. A source renders one entry per MCPServer it ships while that renders (agent-platform.muster.governedKeys): a manager component's .muster.mcpServer.name in its namespace; kagent the connectivity chart's kagent server; mcp-kubernetes the connectivity chart's and every agent-platform-mcps kubernetes entry; any other key is a muster server key itself (a server the installation registers, e.g. example-manager). null drops a source (then list it in governanceExempt with the reason). make verify-tool-approval fails on a shipped MCPServer that is neither here nor in governanceExempt, and on a safe entry that names a floor or no tool of its server, or whose name starts with a write verb (create, delete, exec, set, approve, ...) unless a `# safe-write: : ` comment above `safe:` says why it reads.", + "description": "The servers muster governs (muster.governance.governedServers), per source: `role` (agentManager, connectorManager, sessionManager, modelManager, clusterManager, vmManager, workspaceManager, toolchainManager, skillManager, infrastructure, or a role governance.roleFloors declares) and `safe`, the server's own read tools that agents call unasked on governed (never a floor). Every other tool asks agents on governed. A source renders one entry per MCPServer it ships: a manager component's .muster.mcpServer.name; kagent; mcp-kubernetes (the connectivity chart's and every agent-platform-mcps kubernetes entry); any other key is a muster server key itself. null drops a source (list it in governanceExempt). make verify-tool-approval fails on a shipped MCPServer in neither place, and on a safe entry that names a floor, no tool of its server, or starts with a write verb unless a `# safe-write: : ` comment above `safe:` says why.", "additionalProperties": true, "properties": { "agent-manager": { @@ -3599,7 +3599,7 @@ "properties": { "editors": { "type": "array", - "description": "The platform's operators: bound to agent-platform:editor in the kagent namespace. RBAC subjects. The default names two admin groups of the chart's original deployment, kept from before tool approval: replace them with the installation's own.", + "description": "The platform's operators: bound to agent-platform:editor in the kagent namespace. RBAC subjects. The default names two admin groups kept from before tool approval: replace them with the installation's own.", "items": { "type": "object", "required": [ diff --git a/helm/agent-platform/values.yaml b/helm/agent-platform/values.yaml index ad64d23b..45d7483c 100644 --- a/helm/agent-platform/values.yaml +++ b/helm/agent-platform/values.yaml @@ -2545,10 +2545,9 @@ networkPolicy: musterInClusterMcpPorts: - 8080 - 8443 - # Port of muster's session bindings API, which agent-manager calls on its - # own port and muster admits from agent-manager alone; the chart sets it - # from muster's floor. 0 (the default) opens no egress for it: agent-manager - # then binds on muster's aggregator port. + # Port of muster's session bindings API (agent-manager only); set from + # muster's floor. 0 opens no egress for it: agent-manager binds on muster's + # aggregator port. musterSessionBindingsPort: 0 # Namespace muster runs in, for that egress rule; set by the meta chart from # muster's namespace (components.muster.targetNamespace). Empty selects the @@ -2744,28 +2743,16 @@ muster: # @schema skipProperties: true; additionalProperties: true # with the crds/-dir copy. Stays as a guard regardless of the muster version below. crds: install: false - # Who may register MCPServers and author Workflows through muster's - # writes-as-caller path. Every registered server and authored workflow is - # visible to and routed through by other users, so the chart binds both - # editor Roles explicitly. The defaults bind no person: a ServiceAccount - # subject (agent-platform-unset-connector-admins, - # agent-platform-unset-workflow-editors in kube-system) that the chart never - # creates and no identity provider can issue a token for (a group name could - # be matched by a real IdP group). Until an installation names its own - # subjects, nobody but a cluster admin registers servers, authors workflows - # or changes tool approval: fail closed. Replace them with the - # installation's admin groups, written as the API server sees them (with the - # OIDC groups prefix); the meta chart appends tenants.platformTeam to both. An empty list fails muster's render. - # - # mcpServerEditor is the platform's connector-admin role: whoever holds - # muster's mcpserver-editor Role in muster's namespace edits every connector - # there, sets its tool approval (MCPServer spec.approval: Allow, Ask or - # Block per tool, and the rule new tools follow) and is the only one who may - # let an agent run a tool the connector asks for. The muster chart itself - # binds nobody by default (it bound system:authenticated before), so this - # list is what keeps connector admins on an upgrade; binding - # system:authenticated makes everyone a connector admin. Further reading - # (optional): https://docs.giantswarm.io/overview/agent-platform/governing-tool-calls/ + # Who may register MCPServers and author Workflows (muster's writes-as-caller + # path). The defaults bind no person: a ServiceAccount nobody can + # authenticate as, so only cluster admins register servers, author workflows + # or change tool approval (fail closed). Set the installation's admin groups + # as the API server sees them (with the OIDC groups prefix); tenants.platformTeam + # is appended to both; an empty list fails muster's render. + # mcpServerEditor is the connector-admin role: its holders edit connectors, + # set their tool approval and alone may let an agent skip an Ask. Binding + # system:authenticated makes everyone a connector admin. See + # https://docs.giantswarm.io/overview/agent-platform/governing-tool-calls/ rbac: mcpServerEditor: subjects: @@ -4104,12 +4091,9 @@ kagent: # @schema skipProperties: true; additionalProperties: true # The line the Dev Portal shows under the server's name (the MCPServer's # spec.description, at most 500 characters); empty renders none. description: "Your agent sessions on this installation, as the signed-in person: list them, send one a message, and checkpoint or fork them" - # The connector's tool approval (the MCPServer's spec.approval) is - # approval: its default, the Allow all preset written out for every tool - # of the kagent line, is the connectivity chart's - # (kagent.controllerRoute.mcp.approval there, which says why); set it here - # to tighten a tool (Ask or Block). Further reading (optional): - # https://docs.giantswarm.io/overview/agent-platform/governing-tool-calls/ + # The connector's tool approval (spec.approval): the Allow all preset, + # the connectivity chart's (kagent.controllerRoute.mcp.approval there). + # Set it here to tighten a tool (Ask or Block). approval: rule: Allow tools: @@ -5386,19 +5370,14 @@ agent-manager: # @schema skipProperties: true; additionalProperties: true # the v1alpha2 Agent of kagent 0.10. A range, so patch and minor releases # of the line reach the agents on their own; the major is the API boundary # and moves only with this chart. The floor moves with components.kagent - # and components.default-agent.versionRange. The same range reaches - # agent-manager's migrate run and the agent-platform-operator, which moves - # every organization's chart source at once. 3.x (chart 3.0 removes - # muster.requireApproval) renders only with - # components.agent-manager.versionRange at - # agent-platform.agentManager.agentChartV3Floor (its migrate rewrites - # requireApproval to default: Ask before it moves a namespace's source), - # components.muster.versionRange at agent-platform.muster.agentApprovalFloor - # (muster enforces default: Ask), agent-manager's tool approval on and the - # default agent's range on 3.x: move all of them in one change - # (agent-platform.validateAgentChartLine, make verify-agent-chart-line). - # Both floors are unset until those releases exist, so every 3.x range is - # refused for now (UPGRADE.md). + # and components.default-agent.versionRange. The same range drives + # agent-manager's migrate run and the agent-platform-operator. 3.x renders + # only with agent-manager and muster at their floors + # (agent-platform.agentManager.agentChartV3Floor, + # agent-platform.muster.agentApprovalFloor), agent-manager's tool approval on + # and the default agent's range on 3.x, moved together + # (make verify-agent-chart-line). Both floors are unset until those releases + # exist, so every 3.x range is refused for now (UPGRADE.md). semver: ">=2.6.0 <3.0.0" # Deprecated: set skillManager.sources. Read only while agent-manager does # not pin through the skill-manager (components.skill-manager off, or @@ -5568,12 +5547,8 @@ agentManager: # @schema skipProperties: true; additionalProperties: true repository: giantswarm/agent-manager tag: 3.5.6 dryRun: false - # preflightSemver (unset): forwarded when set, the connectivity chart's - # values.yaml documents it (UPGRADE.md, the dry run before the agent chart - # line moves to 3.x). - # cutover (unset): forwarded when set; true only while the organizations' - # 2.x -> 3.x cut-over runs (the connectivity chart's values.yaml, - # UPGRADE.md). + # preflightSemver and cutover (unset): forwarded when set; documented in + # the connectivity chart's values.yaml and UPGRADE.md. gitopsNamespaces: [] # === Skill repositories === @@ -5851,50 +5826,27 @@ clusterManager: # @schema skipProperties: true; additionalProperties: true # agent-platform:workspace-manager-sessions): the manager lists every creator's # Sessions for the session directories' cleanup, which no tenant role grants. # === Governance mode (Governing tool calls) === -# -- The platform's governance (mode and role floors). The mode, trusted (the -# default) or governed, changes no tool approval setting's meaning; it adds asking for agent -# callers. Governed asks a person before an agent runs any tool of a governed -# server (governedServers below) that is not on that server's safe list (new -# and renamed tools too), and before any of muster's own tools but its reads; -# the Dev Portal's connector wizard pre-selects the Recommended preset -# (read-only tools run, the rest ask). Trusted lets agents run what the -# connectors' own settings allow and pre-selects Allow all. In both modes -# muster's built-in floors ask a person before an agent adds or repoints a -# connector, changes approval settings, grants access, adds a model, egress -# origin, credential or backend, approves an action or a toolchain source, or -# changes muster's own configuration; the role floors hold on the governed -# servers of that role, so governedServers names them in both modes. The meta -# chart renders muster's governance configuration from it -# (muster.governance: the mode and governedServers), from the muster release -# that reads it (agent-platform.muster.governanceFloor); below it `governed` -# fails the render and trusted renders nothing. From that release the meta -# chart also renders muster.approval.installation (backstage.installationName, -# the name the approval page shows; and trustedClients, the portal's own -# client, with backstage.oidcClientId and backstage.signInHandoff), muster-approval-binder's subject -# (agent-manager's ServiceAccount, muster.rbac.approvalBinder.subjects), -# muster-approval-decider's subject (the portal's ServiceAccount, -# muster.rbac.approvalDecider.subjects, with its token projected into the -# portal for audience muster, while muster trusts the portal's client) and -# the pages muster may return the browser to after an approval in -# muster.oauth.mcpClient.postLoginRedirectAllowlist (the portal's /sessions -# with backstage.publicPort, klausGateway.obo.callbackBaseUrl + -# /auth/slack/return; an own list's entries stay). Approval itself needs -# muster's OAuth server with Dex sign-in, Valkey storage (the default) and -# muster.muster.oauth.mcpClient.publicUrl on the OAuth server's origin with -# mcpClient.enabled for the allowlist; the chart does not fail without them, -# muster refuses asking calls with the reason. The mode is set with this chart -# value (no agent tool changes it). The block mirrors muster's own governance -# configuration; a string here (the earlier scalar) fails the render. Further -# reading (optional): https://docs.giantswarm.io/overview/agent-platform/governing-tool-calls/ +# -- The platform's governance (mode and role floors). `trusted` (default) lets +# agents run what the connectors' settings allow; `governed` also asks a person +# before an agent runs any tool of a governed server (governedServers) that is +# not on its safe list, and any muster tool but its reads. In both modes +# muster's built-in floors ask before an agent adds or repoints a connector, +# changes approval settings, grants access, adds a model, egress origin, +# credential or backend, approves an action or toolchain source, or changes +# muster's configuration. Rendered as muster.governance from +# agent-platform.muster.governanceFloor; below it `governed` fails the render. +# Approval needs muster's OAuth server with Dex sign-in, Valkey storage and +# muster.muster.oauth.mcpClient.publicUrl (with mcpClient.enabled for the +# redirect allowlist); without them muster refuses asking calls with the reason. +# No agent tool changes the mode. A string here (the earlier scalar) fails the +# render. See https://docs.giantswarm.io/overview/agent-platform/governing-tool-calls/ governance: # @schema additionalProperties: false # -- trusted (the default) or governed; anything else fails the render. mode: trusted # @schema enum: [trusted, governed] - # -- Floors per governance role (muster.governance.roleFloors): role -> the - # server's own tool names that ask agents in both modes on the governed - # servers of that role, added to muster's built-in floors (config can only - # add: a built-in floor is never removed). A role named here is a valid - # `role` of governedServers. For a server the installation registers - # itself, e.g.: + # -- Floors per governance role (muster.governance.roleFloors): role -> tool + # names that ask agents in both modes on the governed servers of that role, + # added to muster's built-in floors. A role named here is valid in + # governedServers. Example for a server the installation registers: # governance: # roleFloors: # exampleManager: [approve_change, merge_change] @@ -5902,31 +5854,21 @@ governance: # @schema additionalProperties: false # example-manager: # role: exampleManager # safe: [get_info, list_changes] - # Rendered from the muster release that reads the governance configuration - # (agent-platform.muster.governanceFloor), like governedServers. roleFloors: {} # @schema additionalProperties: {type: array, items: {type: string}} -# -- The servers muster governs (muster.governance.governedServers), per -# source the platform ships: `role` (which of muster's role floors hold on -# it: agentManager, connectorManager, sessionManager, modelManager, -# clusterManager, vmManager, workspaceManager, toolchainManager, -# skillManager, infrastructure, or a role governance.roleFloors declares) and -# `safe`, the server's -# own tool names agents call unasked on governed (reads only; a floor never, -# muster refuses to start on one). Every other tool of a governed server asks -# agents on governed. A source renders one entry per MCPServer it ships -# while that renders (agent-platform.muster.governedKeys): a manager -# component's .muster.mcpServer.name in its namespace; kagent the -# connectivity chart's kagent server; mcp-kubernetes the connectivity chart's -# and every agent-platform-mcps kubernetes entry; any other key is a muster -# server key itself (a server the installation registers, e.g. -# example-manager). null drops a source (then -# list it in governanceExempt with the reason). make verify-tool-approval -# fails on a shipped MCPServer that is neither here nor in governanceExempt, -# and on a safe entry that names a floor or no tool of its server, or whose -# name starts with a write verb (create, delete, exec, set, approve, ...) -# unless a `# safe-write: : ` comment above `safe:` says why -# it reads. +# -- The servers muster governs (muster.governance.governedServers), per source: +# `role` (agentManager, connectorManager, sessionManager, modelManager, +# clusterManager, vmManager, workspaceManager, toolchainManager, skillManager, +# infrastructure, or a role governance.roleFloors declares) and `safe`, the +# server's own read tools that agents call unasked on governed (never a floor). +# Every other tool asks agents on governed. A source renders one entry per +# MCPServer it ships: a manager component's .muster.mcpServer.name; +# kagent; mcp-kubernetes (the connectivity chart's and every agent-platform-mcps +# kubernetes entry); any other key is a muster server key itself. null drops a +# source (list it in governanceExempt). make verify-tool-approval fails on a +# shipped MCPServer in neither place, and on a safe entry that names a floor, +# no tool of its server, or starts with a write verb unless a +# `# safe-write: : ` comment above `safe:` says why. governedServers: # @schema additionalProperties: true agent-manager: role: agentManager @@ -5963,9 +5905,8 @@ governedServers: # @schema additionalProperties: true # kubernetes_* aliases ask agents on governed. safe: [logs, list_port_forward_sessions, context_list, context_get_current, can_i, api_resources, cluster_health, capi_list_clusters, capi_get_cluster, capi_resolve_cluster, capi_cluster_health, get, list, describe] -# -- MCPServer sources the platform ships that muster deliberately does not -# govern, each with its reason (make verify-tool-approval wants every shipped -# source in governedServers or here). Read by the meta chart's tests only. +# -- Shipped MCPServer sources muster deliberately does not govern, each with its +# reason. Read by the meta chart's tests only. governanceExempt: # @schema additionalProperties: {type: string} prometheus: "agent-platform-mcps' prometheus family (mcp-prometheus): every tool reads" capi: "agent-platform-mcps' capi family (mcp-kubernetes' CAPI tools): every tool reads" @@ -5987,9 +5928,8 @@ tenants: kind: Group name: system:authenticated # -- The platform's operators: bound to agent-platform:editor in the - # kagent namespace. RBAC subjects. The default names two admin groups of - # the chart's original deployment, kept from before tool approval: replace - # them with the installation's own. + # kagent namespace. RBAC subjects. The default names two admin groups kept + # from before tool approval: replace them with the installation's own. editors: # @schema item: object; itemRequired: [kind, name]; itemProperties: {"apiGroup": {"type": "string"}, "kind": {"type": "string"}, "name": {"type": "string"}, "namespace": {"type": "string"}} - apiGroup: rbac.authorization.k8s.io kind: Group @@ -6925,11 +6865,9 @@ backstage: # @schema skipProperties: true; additionalProperties: true # --- Wiring (read by the connectivity chart, not passed to the backstage chart) --- # Public hostname; empty derives backstage.. hostname: "" - # publicPort: the port of the portal's public URL when it is not 443 (a - # lab edge on 8443): read by the meta chart alone, for the portal entry of - # muster's redirect allowlist (https://:/sessions; - # muster compares the port exactly). Unset or 443 writes none. Unset by - # default (it is no key of the backstage chart: components.backstage.omitKeys). + # publicPort: the port of the portal's public URL when it is not 443 (a lab + # edge on 8443); read by the meta chart alone, for the portal's entry in + # muster's redirect allowlist. Unset or 443 writes none. # publicPort: 8443 # Gateway of the Backstage route; empty follows the platform default (the # chart-owned edge, else global.gatewayApi.parentRefs). @@ -6945,38 +6883,29 @@ backstage: # @schema skipProperties: true; additionalProperties: true extraScopes: - federated:id - audience:server:client_id:dex-k8s-authenticator - # The portal's own OAuth client at the identity provider. Empty (the default) - # signs people in with the platform's shared client (global.identity - # .clientId), as before. Set, the portal signs in with this client: its - # secret is the key portal-dex-client-secret of global.identity - # .existingSecret, the provider registers only the portal's redirect URI - # (https:///api/auth/oidc-agent-platform/handler/frame) for it, and - # the portal also requests the platform client's audience - # (audience:server:client_id:, added to - # extraScopes unless they are empty), so muster, the managers and the API - # server accept its tokens as before. On Dex, the platform client and every - # client whose audience extraScopes request (dex-k8s-authenticator) list - # this client under trustedPeers. muster and the managers key a person's - # sessions by the token's client too, so a person's connector sign-ins of - # the shared client are not the portal's (subject-scoped ones are). + # The portal's own OAuth client at the identity provider. Empty (default) + # signs in with the platform's shared client (global.identity.clientId). Set, + # its secret is the key portal-dex-client-secret of + # global.identity.existingSecret, the provider registers only the portal's + # redirect URI (https:///api/auth/oidc-agent-platform/handler/frame) + # for it, and audience:server:client_id: is added to + # extraScopes so tokens keep the platform client's audience. On Dex, the + # platform client and every client whose audience extraScopes request list + # this client under trustedPeers. Sessions are keyed by client too: a person's + # connector sign-ins made through the shared client are not the portal's + # (subject-scoped ones are). oidcClientId: "" - # muster trusts the portal with a person's approvals: with a dedicated - # oidcClientId the chart lists it in muster.approval.trustedClients, so the - # portal shows a tool approval in chat and decides it on the person's click - # (Approve / Decline, with the person's token), and opens muster's connector - # sign-in signed in through a one-time ticket (muster still asks the browser - # "Connect as ?" first). muster takes a person's portal - # token there only with the portal backend's own ServiceAccount token - # (audience muster, projected into the portal; the chart binds the portal's - # ServiceAccount to muster-approval-decider), so a portal token held - # elsewhere (the browser, a forwardToken server, an agent runtime) decides - # nothing. The trade-off: the portal backend can approve a person's pending - # requests without muster's browser sign-in; it decides only on the - # person's click. false keeps every decision and sign-in on muster's own - # pages. Without a dedicated client nothing is listed: the shared client is - # held by muster, agents and CLIs as well. An own - # muster.muster.approval.trustedClients may name this client only; any - # other id fails the render. + # With a dedicated oidcClientId, the chart lists it in + # muster.approval.trustedClients: the portal then shows a tool approval in + # chat and decides it on the person's click, and opens muster's connector + # sign-in through a one-time ticket. muster accepts the person's portal token + # there only together with the portal backend's own ServiceAccount token + # (audience muster; the chart projects it and binds the ServiceAccount to + # muster-approval-decider). Trade-off: the portal backend can approve a + # person's pending requests without muster's browser sign-in, on the person's + # click only. false keeps every decision on muster's own pages. Without a + # dedicated client nothing is listed; an own muster.muster.approval.trustedClients + # may name this client only. signInHandoff: true # Extra query parameters on the login provider's authorize request. Dex needs # none; Google needs access_type: offline and prompt: consent for a refresh diff --git a/skills/agent-platform-agent-management/SKILL.md b/skills/agent-platform-agent-management/SKILL.md index 8dbf496d..0e704b3f 100644 --- a/skills/agent-platform-agent-management/SKILL.md +++ b/skills/agent-platform-agent-management/SKILL.md @@ -127,37 +127,34 @@ never assume an argument. The agent tools drop an unknown key without an error: on an explicit request. An own-account (OAuth) connector without `grantScope: subject` needs a sign-in in each of the agent's conversations (`agent-platform-tools`); say so before choosing it. - **Tool approval** (further reading, optional: https://docs.giantswarm.io/overview/agent-platform/governing-tool-calls/): - today an agent's toolset only selects tools; their Allow/Ask/Block settings are the connectors' + today a toolset only selects tools; their Allow/Ask/Block settings are the connectors' (`agent-platform-tools`). On a **governed** platform every agent-manager tool that is not a read - (`create_agent`, `update_agent`, `delete_agent`, `start_session`, `delete_session`, the - organization writes) asks the person when an agent calls it; on a trusted one (the default) they - run, except the floors that ask in both modes (`set_organization_connector`, - `add_organization_member`, `set_organization_model`, `set_organization_egress_policy`, - `replace_organization_credential`). Check the `filter_tools` `approval` of the tool before you - promise an outcome. **Only once agent-manager ships per-agent tool lists** (its `create_agent` - schema has `tools`, and `x_agent-manager_update_agent_access` and - `x_agent-manager_set_agent_approval` exist; describe them first): the toolset becomes the agent's - **tool list**, the same selectors each optionally `Allow`, `Ask` or `Block` plus a `default`, at - most 32 entries, an unlisted tool invisible; an agent's settings only tighten its connectors' - (the strictest wins); `Allow` over a connector's `Ask` is an **exception** only a connector admin - of that connector grants, through `set_agent_approval`, which asks the person whenever an agent - calls it, and a save drops the exceptions the saver is not connector admin for (say so before - saving). `set_agent_approval` takes `settings` (`{"": "Allow"|"Ask"|"Block"|""}` for - entries already in `tools`) and `default`; `create_agent` and `update_agent_access` refuse an - `Allow` over a connector's `Ask` and any `default: Allow`. `get_agent` and `list_agents` return - the list as `toolSettings` (their `tools` stays the kagent MCP bindings), with `defaultApproval`, - `grants` (with `grantedBy`) and `approvalSettings` (false: this installation does not bind - settings and refuses them); `x_agent-manager_list_approval_grants` lists a namespace's grants, per - connector with `server`; `filter_tools` with `agentTools` shows how a list resolves before you - save it. A save's `sessionsUpdated: false` and `warnings` mean running sessions still carry a - dropped exception until agent-manager tells muster again: say so. A governed platform's asks - cannot be lifted per agent. To make an agent ask before every call, set `default: Ask` - (`set_agent_approval`). Agent chart 3.0 removes `muster.requireApproval`: agent-manager's - migrate rewrites `true` to `default: Ask` in the releases it owns, organization namespaces - included, and reports the others (GitOps, `valuesFrom`) in its report: check it. An - organization stays on chart 2.x (`Ready=False`, `ChartSourceHeld`) until every release there is - on 3.x values and migrate ran again; the fix is replacing the key with `default: Ask`, never - deleting it. Never write the key. + asks the person when an agent calls it; on a trusted one (the default) they run, except the floors + that ask in both modes (`set_organization_connector`, `add_organization_member`, + `set_organization_model`, `set_organization_egress_policy`, `replace_organization_credential`). + Check the `filter_tools` `approval` of the tool before you promise an outcome. + **Only once agent-manager ships per-agent tool lists** (`create_agent`'s schema has `tools`; + `update_agent_access` and `set_agent_approval` exist; `describe_tool` them first): the toolset + becomes the agent's **tool list**, the same selectors each optionally `Allow`, `Ask` or `Block`, + plus a `default`; at most 32 entries, an unlisted tool invisible. + - An agent's settings only tighten its connectors' (the strictest wins). `Allow` over a + connector's `Ask` is an **exception** only a connector admin of that connector grants, through + `set_agent_approval` (it asks the person whenever an agent calls it); a save drops the + exceptions the saver may not grant, so say so before saving. `create_agent` and + `update_agent_access` refuse such an `Allow` and any `default: Allow`. + - `set_agent_approval` takes `settings` (`{"": "Allow"|"Ask"|"Block"|""}` for entries + already in `tools`) and `default`. `get_agent`/`list_agents` return the list as `toolSettings` + (`tools` stays the kagent MCP bindings), plus `defaultApproval`, `grants` (`grantedBy`) and + `approvalSettings` (false: this installation refuses settings). `list_approval_grants` lists a + namespace's grants; `filter_tools` with `agentTools` shows how a list resolves before you save. + - `sessionsUpdated: false` or `warnings` on a save mean running sessions still carry a dropped + exception until agent-manager tells muster again: say so. A governed platform's asks cannot be + lifted per agent; to make an agent ask before every call, set `default: Ask`. + - Agent chart 3.0 removes `muster.requireApproval`: agent-manager's migrate rewrites `true` to + `default: Ask` in the releases it owns and reports the others (GitOps, `valuesFrom`); check its + report. An organization stays on chart 2.x (`Ready=False`, `ChartSourceHeld`) until every + release there is on 3.x values and migrate ran again. The fix is replacing the key with + `default: Ask`, never deleting it; never write the key. - **An organization's connectors**: a kagent `RemoteMCPServer` in the organization namespace (`x_agent-manager_set_organization_connector`), not a Muster server, so no `toolset` selector reaches it. From agent-manager 3.3.0 (`connectors` in `x_agent-manager_create_agent`'s schema; diff --git a/skills/agent-platform-building-blocks/SKILL.md b/skills/agent-platform-building-blocks/SKILL.md index b7683b62..ebbb274d 100644 --- a/skills/agent-platform-building-blocks/SKILL.md +++ b/skills/agent-platform-building-blocks/SKILL.md @@ -28,10 +28,9 @@ person: what they may do in the service is what the agent may do there. Some con person to sign in once with their own account; until then their tools are hidden for that person. Each tool of a connector is **Allow** (runs), **Ask** (a person confirms the call first) or -**Block** (hidden); a connector's rule decides for tools nobody has set yet, new ones included, and -the strictest setting wins. A governed platform also asks before an agent changes anything through -the platform's own connectors (further reading, optional: -https://docs.giantswarm.io/overview/agent-platform/governing-tool-calls/). +**Block** (hidden); a connector's rule covers tools nobody has set yet, and the strictest setting +wins. A governed platform also asks before an agent changes anything through the platform's own +connectors (https://docs.giantswarm.io/overview/agent-platform/governing-tool-calls/). **Suggest one** when the goal needs a system no connector reaches yet ("read our Jira tickets"): someone registers it with **Add connector**. A connector that exists but whose tools are missing diff --git a/skills/agent-platform-tools/SKILL.md b/skills/agent-platform-tools/SKILL.md index 2bb9f453..7ad3d7e1 100644 --- a/skills/agent-platform-tools/SKILL.md +++ b/skills/agent-platform-tools/SKILL.md @@ -136,62 +136,49 @@ https://docs.giantswarm.io/tutorials/agent-platform/connecting-custom-mcp-server ## Tool approval: Allow, Ask, Block -Further reading (optional): https://docs.giantswarm.io/overview/agent-platform/governing-tool-calls/. Every tool has one setting, decided by Muster on every call, whoever calls (an -agent, the portal, Slack, Claude Code): - -- **Allow** runs. **Ask**: a person confirms the exact call first (in portal chat, where the request - is shown with Approve / Decline, or on Muster's approval page); the call then runs once. An agent - cannot decide its own request: Muster takes decisions only from the person, inline only through - the portal backend's own identity, so no token you hold decides one. **Block**: hidden, absent from `filter_tools`, refused as not found. -- A connector carries `spec.approval`: a `rule` (`Allow`, `Ask` or `Block`) that every tool without - its own entry follows — **new tools follow the rule**, so a `Block` rule hides every tool nobody - has reviewed yet — and per-tool entries by the server's own tool name (no `x__` prefix). - A connector without `approval` runs everything and is shown as *not reviewed*. An agent's - settings can only tighten them (agent-manager's tool lists, when its schema has `tools`); the - strictest wins. -- `filter_tools` and `describe_tool` report each tool's `approval` (`setting`; `source`: `tool`, - `connector`, `unreviewed`, `builtin`, `governance`, `unavailable`, and with agent tool lists - `agent`, `agent-exception`; `new` for a tool without its own entry; `unavailable` with the reason - when asking calls are refused here) for **you**, the caller, and `connectorAdmin`, whether you - may change that connector's settings. The `filter_tools` result's `governance` field says - whether the platform is `trusted` or `governed`. -- **Presets** fill in every tool once, on save, from the tools listed at that moment: *Recommended* - (rule Ask, tools annotated read-only Allow, the rest Ask), *Allow all*, *Ask all*. Creating a - connector over MCP (`core_mcpserver_create`) requires `preset` or explicit `approval`; - `core_mcpserver_set_approval` changes them (pass the `generation` from `core_mcpserver_get` as - `expectedGeneration`; a conflict means someone changed it: read again). Only a connector admin - (whoever may update `mcpservers` in its namespace: the `connector-admin` role) may write them, - and an agent writing them always asks a person. The portal's wizard pre-selects *Allow all* on a - trusted platform and *Recommended* on a governed one. The platform's own connectors arrive - reviewed: its management servers (agent-manager, the other managers, kagent's session tools) on - *Allow all*, the infrastructure servers (Kubernetes, Prometheus, Cluster API) on *Recommended*. -- **When a call asks**, you get an approval link (or, in a client without the prompt, an - `approval_required` text with the URL). Give the person the link as is, wait, then call the tool - again with the same arguments **as the same client** (any MCP session of it will do): approved, - it runs once; declined, you get a declined result — accept it, never retry another way. A retry - from another client of the person asks anew. A workflow asks once, up front, for all its steps. At - most 3 calls of one client (10 of one person) wait for a decision at a time. Never press *Approve* - yourself, and never ask the person to approve something you did not show them; with no person - to open the link the call expires and is refused. -- **Built in, every mode** (agents only): an agent is asked before it adds or repoints a connector, - changes approval settings, creates, changes or deletes a workflow, grants or changes access - (organization members, connectors, models, egress, credentials), adds a model backend, approves - an action or a toolchain source, or changes Muster's configuration (that one asks every caller). - A **governed** platform also asks an agent before **every tool of the platform's own servers that - is not a read on their safe list** (creating, changing, starting or deleting agents and sessions, - VMs, clusters, models, workspaces, toolchains, Kubernetes writes, new tools too) and before - Muster's own tools other than its reads (pausing, deleting, starting or stopping a connector). - A **trusted** one (the default) leaves those to the connectors' settings. A person is never asked - by the mode, only by the connectors' settings. +Further reading (optional): https://docs.giantswarm.io/overview/agent-platform/governing-tool-calls/. +Muster decides every call by its tool's setting, whoever calls (an agent, the portal, Slack, Claude Code): + +- **Allow** runs. **Ask**: a person confirms the exact call first (inline in portal chat, or on Muster's + approval page); the call then runs once. An agent cannot decide its own request, and no token you + hold decides one. **Block**: hidden, absent from `filter_tools`, refused as not found. +- A connector carries `spec.approval`: a `rule` for every tool without its own entry (**new tools + follow it**, so `Block` hides every unreviewed tool) and per-tool entries by the server's own tool + name (no `x__` prefix). Without `approval` it runs everything and is shown as *not + reviewed*. An agent's settings can only tighten them (the strictest wins). +- `filter_tools` and `describe_tool` report each tool's `approval` for **you**: `setting`; `source` + (`tool`, `connector`, `unreviewed`, `builtin`, `governance`, `unavailable`, and with agent tool + lists `agent`, `agent-exception`); `new` for a tool without its own entry; `unavailable` with the + reason when asking calls are refused here. `connectorAdmin` says whether you may change the + connector's settings; the result's `governance` field says `trusted` or `governed`. +- **Presets** fill in every tool once, on save, from the tools listed then: *Recommended* (rule Ask, + read-only tools Allow, the rest Ask), *Allow all*, *Ask all*. `core_mcpserver_create` requires + `preset` or explicit `approval`; `core_mcpserver_set_approval` changes them (pass `generation` from + `core_mcpserver_get` as `expectedGeneration`; a conflict means read again). Only a connector admin + (whoever may update `mcpservers` in its namespace, the `connector-admin` role) may write them, and + an agent writing them always asks a person. The portal wizard pre-selects *Allow all* on a trusted + platform, *Recommended* on a governed one. The platform's management servers arrive on *Allow all*, + its infrastructure servers (Kubernetes, Prometheus, Cluster API) on *Recommended*. +- **When a call asks**, you get an approval link (or an `approval_required` text with the URL). Give + the person the link as is, wait, then call the tool again with the same arguments **as the same + client** (any MCP session of it): approved, it runs once; declined, accept it and never retry + another way. Another client of the person asks anew. A workflow asks once, up front, for all its + steps. At most 3 calls of one client (10 of one person) wait at a time. Never press *Approve* + yourself or ask the person to approve something you did not show them; with no person to open the + link the call expires and is refused. +- **Built in, every mode** (agents only): asked before adding or repointing a connector, changing + approval settings, creating, changing or deleting a workflow, granting or changing access + (organization members, connectors, models, egress, credentials), adding a model backend, + approving an action or a toolchain source, or changing Muster's configuration (that one asks every + caller). A **governed** platform also asks an agent before every tool of the platform's own servers + that is not a read on their safe list, new tools too, and before Muster's own non-read tools. A + **trusted** one (the default) leaves those to the connectors' settings. A person is only ever + asked by the connectors' settings. - Missing prerequisites (Muster's Valkey store, its OAuth server with browser sign-in, a public URL on that server's origin) make every asking call refused with the reason, reported as - `approval.unavailable` on each tool that asks; tell the person, it is the installation's to fix - (the platform chart does not fail a render over it). So does a cluster whose MCPServer CRD does - not know `spec.approval` yet (every server tool refused until it is upgraded). The approval page - returns the browser to the portal or Slack only where the installation's redirect allowlist names - them: the chart derives the entries (with the portal's port, `backstage.publicPort`), and Muster - renders them only with `muster.muster.oauth.mcpClient.enabled`; otherwise the person returns by - hand. + `approval.unavailable`; tell the person, it is the installation's to fix. So does an MCPServer CRD + without `spec.approval` (every server tool refused until upgraded). Without a redirect allowlist + entry the person returns to the portal or Slack by hand. ## Workflows @@ -268,8 +255,8 @@ clients. Procedure and version prerequisites: grant backend permissions. A successful agent-manager read with `releaseWithheld` is a partial answer, not an error: use the readable Agent data and explain which release details are unavailable. Do not send an authenticated person through sign-in again or blame them for this platform limit. -- `approval_required`, or an approval link instead of a result: the tool's setting is Ask (above). - A tool that `filter_tools` no longer lists may be blocked for you: its connector's admins decide. +- `approval_required`, or an approval link instead of a result: the tool's setting is Ask (above). A + tool that `filter_tools` no longer lists may be blocked for you: its connector's admins decide. - "tool `x_…` not found" from the runtime: a backend tool was emitted as a function — go through `call_tool`. - An issuer discovery or TLS error is installation connectivity, not a request for the person to From d2ff7f77047cfe9d3401f26d0b7873ecbcf353a1 Mon Sep 17 00:00:00 2001 From: Dominik Schmidle Date: Fri, 27 Nov 2026 11:22:33 +0100 Subject: [PATCH 51/56] docs: move tool approval docs into the repository --- README.md | 2 +- docs/tool-approval.md | 45 +++++++++++++++++++ docs/toolset-presets.md | 2 +- helm/agent-platform-connectivity/values.yaml | 4 +- helm/agent-platform/README.md | 4 +- helm/agent-platform/README.md.gotmpl | 2 +- helm/agent-platform/values.schema.json | 2 +- helm/agent-platform/values.yaml | 4 +- .../agent-platform-agent-management/SKILL.md | 2 +- .../agent-platform-building-blocks/SKILL.md | 2 +- skills/agent-platform-tools/SKILL.md | 2 +- 11 files changed, 58 insertions(+), 13 deletions(-) create mode 100644 docs/tool-approval.md diff --git a/README.md b/README.md index 87357222..170bba73 100644 --- a/README.md +++ b/README.md @@ -121,7 +121,7 @@ Then point any MCP client at `https://muster./mcp`. Its traffic cro | [Operator reference](docs/reference.md) | Every component and value: GitOps engine, self-management, serving and runtime slices, network policies, observability, CRD lifecycle | | [Authentication](docs/authentication.md) | The request path, OAuth discovery, token forwarding and exchange, edge JWT validation | | [Toolset presets](docs/toolset-presets.md) | Choosing which tools an agent gets | -| [Governing tool calls](https://docs.giantswarm.io/overview/agent-platform/governing-tool-calls/) | Allow, Ask or Block per connector and tool, the governance mode and who sets what ([chart values](helm/agent-platform/README.md#tool-approval-and-the-governance-mode)) | +| [Tool approval](docs/tool-approval.md) | Allow, Ask or Block per connector and tool, the governance mode and who sets what ([chart values](helm/agent-platform/README.md#tool-approval-and-the-governance-mode)) | | [Serving presets](docs/serving-presets.md) | Adding and benchmarking a model recipe | | [ChatGPT login](docs/chatgpt-login.md) | Running codex on each person's own ChatGPT subscription | | [Agent Substrate security](docs/substrate-security.md) | What the agent runtime changes on the cluster, and what protects it | diff --git a/docs/tool-approval.md b/docs/tool-approval.md new file mode 100644 index 00000000..c2a375aa --- /dev/null +++ b/docs/tool-approval.md @@ -0,0 +1,45 @@ +# Tool approval + +Every tool behind muster, the platform's tool gateway, is **Allow** (runs), **Ask** (a person confirms the exact call first) or **Block** (hidden, refused). muster enforces it on every call, so it holds in the Dev Portal, Slack, Claude Code and an agent's sandbox alike. The chart values, floors and prerequisites are in the chart README ("Tool approval and the governance mode"); upgrade steps are in [UPGRADE.md](../UPGRADE.md). + +## Who sets what + +| Who | Sets | Where | +|---|---|---| +| Connector admin (`muster.rbac.mcpServerEditor.subjects`, `tenants.platformTeam`) | A `rule` for tools without an entry (new ones included) and a setting per tool | The connector's `MCPServer` `spec.approval`, or the Dev Portal's *Connectors* page | +| Agent builder | The agent's tool list, each entry optionally Allow, Ask or Block, plus a `default` | The agent chart's `tools` and `default` | +| Connector admin only | An exception: Allow for one agent on a tool its connector asks for | agent-manager's `set_agent_approval` | + +The stricter of the connector's and the agent's setting holds. A person calling a tool directly gets the connector's setting only. A connector without settings runs every tool and shows as *not reviewed*. + +## Trusted and governed + +`governance.mode` (`trusted`, the default, or `governed`) adds asking for agent callers; it never asks a person using a tool directly. + +- **trusted**: an agent runs what the connector allows. It still asks before it adds or repoints a connector, changes approval settings, grants access or exceptions, authors workflows, or changes muster's configuration (the floors). +- **governed**: besides the floors, an agent asks before any tool of a governed server that is not on its `safe` list in `governedServers`, so a new or renamed tool asks until someone lists it. + +Floors for your own servers go under `governance.roleFloors`; they add to the built-in ones and never narrow them. + +```yaml +governance: + mode: governed + roleFloors: + exampleManager: [approve_change, merge_change] +governedServers: + example-manager: + role: exampleManager + safe: [get_info, list_changes] +``` + +Whoever can change these values can switch the mode or shorten a safe list, and nobody else approves it: protect the values repository with required reviews. + +## What fails closed + +- Asking needs muster's OAuth server with Dex sign-in, Valkey and `muster.muster.oauth.mcpClient.publicUrl`; without them every call that would ask is refused (`approval.unavailable`), never run. +- An agent with nobody to open the approval link runs only what is Allow; the rest expires. +- `governed` fails the render below the release floors (`agent-platform.muster.governanceFloor` and the others in `values.yaml`); a safe list naming a floor, or a `role` declared nowhere, fails muster's start. +- The editor groups default to a ServiceAccount nobody can authenticate as, so until you name your admin groups only cluster admins change approval. +- muster refuses every connector's tools while the `MCPServer` CRD lacks `spec.approval`. + +A selection of tools (the agent's [toolset](toolset-presets.md)) is separate from whether a selected tool runs, asks or is hidden. diff --git a/docs/toolset-presets.md b/docs/toolset-presets.md index ac7a583a..8e3ac1c6 100644 --- a/docs/toolset-presets.md +++ b/docs/toolset-presets.md @@ -2,7 +2,7 @@ A **toolset** is the selector list an agent declares to say which of the gateway's tools it is composed with: the agent chart's `toolset` value (rendered as the `X-Muster-Toolset` header on the agent's muster tool entry), agent-manager's `toolset` argument, or the `toolset` argument of muster's `filter_tools`. muster evaluates it on every request as one more filter on the caller's own catalogue — it never widens access; the invoking human's identity and the backends' own authorization remain the boundary. The grammar, the built-in presets and the error texts are muster's: [docs/reference/toolsets.md](https://github.com/giantswarm/muster/blob/main/docs/reference/toolsets.md). -A toolset only selects tools; whether a selected tool runs, asks a person or is hidden is its connector's tool approval (`Allow`, `Ask`, `Block`; the agent-platform chart README, "Tool approval and the governance mode"; [Governing tool calls](https://docs.giantswarm.io/overview/agent-platform/governing-tool-calls/)). Once agent-manager ships per-agent tool lists (`tools` in `create_agent`), the toolset becomes that list: the same selectors, each optionally `Allow`, `Ask` or `Block`, plus a `default`. +A toolset only selects tools; whether a selected tool runs, asks a person or is hidden is its connector's tool approval (`Allow`, `Ask`, `Block`; the agent-platform chart README, "Tool approval and the governance mode"; [Tool approval](tool-approval.md)). Once agent-manager ships per-agent tool lists (`tools` in `create_agent`), the toolset becomes that list: the same selectors, each optionally `Allow`, `Ask` or `Block`, plus a `default`. A **preset** is a named selection an agent refers to as `preset:`. Presets are muster configuration — `toolsetPresets` in muster's `config.yaml`, which the muster chart renders from its `muster.toolsetPresets` value. This meta-package forwards its `muster:` block to the muster release, so the presets an installation ships live under **`muster.muster.toolsetPresets`** in these values (the first `muster` is the component block, the second is the muster chart's own `muster:` key). diff --git a/helm/agent-platform-connectivity/values.yaml b/helm/agent-platform-connectivity/values.yaml index a1a2dbe8..f99eaab5 100644 --- a/helm/agent-platform-connectivity/values.yaml +++ b/helm/agent-platform-connectivity/values.yaml @@ -1822,7 +1822,7 @@ kagent: # @schema skipProperties: true; additionalProperties: true # spec.description, at most 500 characters); empty renders none. description: "Your agent sessions on this installation, as the signed-in person: list them, send one a message, and checkpoint or fork them" # The connector's tool approval (spec.approval; see - # https://docs.giantswarm.io/overview/agent-platform/governing-tool-calls/): + # https://github.com/giantswarm/agent-platform/blob/main/docs/tool-approval.md): # `rule` (Allow | Ask | Block) for a tool without its own entry, new ones # included, and `tools`, the server's own tool names -> Allow | Ask | Block # (at most 512). Written out for every tool as the Allow all preset: these @@ -3721,7 +3721,7 @@ mcp-kubernetes: # @schema skipProperties: true; additionalProperties: true # spec.description), at most 500 characters. Empty renders none. description: "Resources, events and pod logs of this installation's cluster, and the health of its workload clusters" # The connector's tool approval (spec.approval; see - # https://docs.giantswarm.io/overview/agent-platform/governing-tool-calls/): + # https://github.com/giantswarm/agent-platform/blob/main/docs/tool-approval.md): # `rule` (Allow | Ask | Block) for a tool without its own entry, new ones # included, and `tools`, the server's own tool names -> Allow | Ask | Block # (at most 512). Written out as the Recommended preset, equal to diff --git a/helm/agent-platform/README.md b/helm/agent-platform/README.md index 71460118..fa8a7cea 100644 --- a/helm/agent-platform/README.md +++ b/helm/agent-platform/README.md @@ -380,7 +380,7 @@ required); below `1.3.0` the key is refused. Every tool behind muster is **Allow**, **Ask** (a person confirms the call first) or **Block** (hidden and refused). A connector's `rule` applies to tools without their own entry, new ones -included. Concepts and prompts: [Governing tool calls](https://docs.giantswarm.io/overview/agent-platform/governing-tool-calls/). +included. Concepts and prompts: [Governing tool calls](https://github.com/giantswarm/agent-platform/blob/main/docs/tool-approval.md). | Value | What it does | |-------|--------------| @@ -1583,7 +1583,7 @@ The map is merged into each component's own `nodeSelector` (`muster.nodeSelector | clusterManager.networkPolicy.workloadClusters.ports[1] | int | `6443` | | | clusterManager.networkPolicy.egress.fqdns | list | `[]` | | | clusterManager.networkPolicy.egress.cidrs | list | `[]` | | -| governance | object | `{"mode":"trusted","roleFloors":{}}` | The platform's governance (mode and role floors). `trusted` (default) lets agents run what the connectors' settings allow; `governed` also asks a person before an agent runs any tool of a governed server (governedServers) that is not on its safe list, and any muster tool but its reads. In both modes muster's built-in floors ask before an agent adds or repoints a connector, changes approval settings, grants access, adds a model, egress origin, credential or backend, approves an action or toolchain source, or changes muster's configuration. Rendered as muster.governance from agent-platform.muster.governanceFloor; below it `governed` fails the render. Approval needs muster's OAuth server with Dex sign-in, Valkey storage and muster.muster.oauth.mcpClient.publicUrl (with mcpClient.enabled for the redirect allowlist); without them muster refuses asking calls with the reason. No agent tool changes the mode. A string here (the earlier scalar) fails the render. See https://docs.giantswarm.io/overview/agent-platform/governing-tool-calls/ | +| governance | object | `{"mode":"trusted","roleFloors":{}}` | The platform's governance (mode and role floors). `trusted` (default) lets agents run what the connectors' settings allow; `governed` also asks a person before an agent runs any tool of a governed server (governedServers) that is not on its safe list, and any muster tool but its reads. In both modes muster's built-in floors ask before an agent adds or repoints a connector, changes approval settings, grants access, adds a model, egress origin, credential or backend, approves an action or toolchain source, or changes muster's configuration. Rendered as muster.governance from agent-platform.muster.governanceFloor; below it `governed` fails the render. Approval needs muster's OAuth server with Dex sign-in, Valkey storage and muster.muster.oauth.mcpClient.publicUrl (with mcpClient.enabled for the redirect allowlist); without them muster refuses asking calls with the reason. No agent tool changes the mode. A string here (the earlier scalar) fails the render. See https://github.com/giantswarm/agent-platform/blob/main/docs/tool-approval.md | | governance.mode | string | `"trusted"` | trusted (the default) or governed; anything else fails the render. | | governance.roleFloors | object | `{}` | Floors per governance role (muster.governance.roleFloors): role -> tool names that ask agents in both modes on the governed servers of that role, added to muster's built-in floors. A role named here is valid in governedServers. Example for a server the installation registers: governance: roleFloors: exampleManager: [approve_change, merge_change] governedServers: example-manager: role: exampleManager safe: [get_info, list_changes] | | governedServers | object | `{"agent-manager":{"role":"agentManager","safe":["get_info","list_agents","get_agent","get_agent_status","validate_agent","list_model_configs","list_egress_policies","list_skills","list_sessions","get_session","get_session_turn","toolchain_users","list_organizations","get_organization","list_organization_members","list_organization_connectors"]},"cluster-manager":{"role":"clusterManager","safe":["get_info","list_clusters","list_releases","list_node_pools"]},"kagent":{"role":"sessionManager","safe":["list_sessions","list_session_checkpoints","list_sandbox_templates","list_sandboxes","get_sandbox","get_sandbox_process","read_sandbox_outputs","read_sandbox_file"]},"mcp-kubernetes":{"role":"infrastructure","safe":["logs","list_port_forward_sessions","context_list","context_get_current","can_i","api_resources","cluster_health","capi_list_clusters","capi_get_cluster","capi_resolve_cluster","capi_cluster_health","get","list","describe"]},"model-manager":{"role":"modelManager","safe":["get_info","get_backend","list_backends","list_models","get_model","list_loaded_models","list_presets","search_models","check_fit","list_nodes","list_jobs","get_job"]},"skill-manager":{"role":"skillManager","safe":["list_skill_sources","list_skills","resolve_skills","get_skill","get_skill_file"]},"toolchain-manager":{"role":"toolchainManager","safe":["list_sources","list_toolchains","describe_toolchain","toolchain_build_status","search_packages"]},"vm-manager":{"role":"vmManager","safe":["get_info","get_host","list_images","get_image","list_networks","get_network","list_vms","get_vm","get_vm_metrics","get_vm_attestation"]},"workspace-manager":{"role":"workspaceManager","safe":["list_providers","list_owners","list_workspaces","get_workspace","list_repositories","preview_workspace"]}}` | The servers muster governs (muster.governance.governedServers), per source: `role` (agentManager, connectorManager, sessionManager, modelManager, clusterManager, vmManager, workspaceManager, toolchainManager, skillManager, infrastructure, or a role governance.roleFloors declares) and `safe`, the server's own read tools that agents call unasked on governed (never a floor). Every other tool asks agents on governed. A source renders one entry per MCPServer it ships: a manager component's .muster.mcpServer.name; kagent; mcp-kubernetes (the connectivity chart's and every agent-platform-mcps kubernetes entry); any other key is a muster server key itself. null drops a source (list it in governanceExempt). make verify-tool-approval fails on a shipped MCPServer in neither place, and on a safe entry that names a floor, no tool of its server, or starts with a write verb unless a `# safe-write: : ` comment above `safe:` says why. | diff --git a/helm/agent-platform/README.md.gotmpl b/helm/agent-platform/README.md.gotmpl index 11af3547..2e85a4a9 100644 --- a/helm/agent-platform/README.md.gotmpl +++ b/helm/agent-platform/README.md.gotmpl @@ -366,7 +366,7 @@ required); below `1.3.0` the key is refused. Every tool behind muster is **Allow**, **Ask** (a person confirms the call first) or **Block** (hidden and refused). A connector's `rule` applies to tools without their own entry, new ones -included. Concepts and prompts: [Governing tool calls](https://docs.giantswarm.io/overview/agent-platform/governing-tool-calls/). +included. Concepts and prompts: [Governing tool calls](https://github.com/giantswarm/agent-platform/blob/main/docs/tool-approval.md). | Value | What it does | |-------|--------------| diff --git a/helm/agent-platform/values.schema.json b/helm/agent-platform/values.schema.json index c20d2b65..ebaa3708 100644 --- a/helm/agent-platform/values.schema.json +++ b/helm/agent-platform/values.schema.json @@ -2186,7 +2186,7 @@ }, "governance": { "type": "object", - "description": "The platform's governance (mode and role floors). `trusted` (default) lets agents run what the connectors' settings allow; `governed` also asks a person before an agent runs any tool of a governed server (governedServers) that is not on its safe list, and any muster tool but its reads. In both modes muster's built-in floors ask before an agent adds or repoints a connector, changes approval settings, grants access, adds a model, egress origin, credential or backend, approves an action or toolchain source, or changes muster's configuration. Rendered as muster.governance from agent-platform.muster.governanceFloor; below it `governed` fails the render. Approval needs muster's OAuth server with Dex sign-in, Valkey storage and muster.muster.oauth.mcpClient.publicUrl (with mcpClient.enabled for the redirect allowlist); without them muster refuses asking calls with the reason. No agent tool changes the mode. A string here (the earlier scalar) fails the render. See https://docs.giantswarm.io/overview/agent-platform/governing-tool-calls/", + "description": "The platform's governance (mode and role floors). `trusted` (default) lets agents run what the connectors' settings allow; `governed` also asks a person before an agent runs any tool of a governed server (governedServers) that is not on its safe list, and any muster tool but its reads. In both modes muster's built-in floors ask before an agent adds or repoints a connector, changes approval settings, grants access, adds a model, egress origin, credential or backend, approves an action or toolchain source, or changes muster's configuration. Rendered as muster.governance from agent-platform.muster.governanceFloor; below it `governed` fails the render. Approval needs muster's OAuth server with Dex sign-in, Valkey storage and muster.muster.oauth.mcpClient.publicUrl (with mcpClient.enabled for the redirect allowlist); without them muster refuses asking calls with the reason. No agent tool changes the mode. A string here (the earlier scalar) fails the render. See https://github.com/giantswarm/agent-platform/blob/main/docs/tool-approval.md", "additionalProperties": false, "properties": { "mode": { diff --git a/helm/agent-platform/values.yaml b/helm/agent-platform/values.yaml index ecb2fec1..964d196b 100644 --- a/helm/agent-platform/values.yaml +++ b/helm/agent-platform/values.yaml @@ -2780,7 +2780,7 @@ muster: # @schema skipProperties: true; additionalProperties: true # mcpServerEditor is the connector-admin role: its holders edit connectors, # set their tool approval and alone may let an agent skip an Ask. Binding # system:authenticated makes everyone a connector admin. See - # https://docs.giantswarm.io/overview/agent-platform/governing-tool-calls/ + # https://github.com/giantswarm/agent-platform/blob/main/docs/tool-approval.md rbac: mcpServerEditor: subjects: @@ -5862,7 +5862,7 @@ clusterManager: # @schema skipProperties: true; additionalProperties: true # muster.muster.oauth.mcpClient.publicUrl (with mcpClient.enabled for the # redirect allowlist); without them muster refuses asking calls with the reason. # No agent tool changes the mode. A string here (the earlier scalar) fails the -# render. See https://docs.giantswarm.io/overview/agent-platform/governing-tool-calls/ +# render. See https://github.com/giantswarm/agent-platform/blob/main/docs/tool-approval.md governance: # @schema additionalProperties: false # -- trusted (the default) or governed; anything else fails the render. mode: trusted # @schema enum: [trusted, governed] diff --git a/skills/agent-platform-agent-management/SKILL.md b/skills/agent-platform-agent-management/SKILL.md index f254f9f8..40867777 100644 --- a/skills/agent-platform-agent-management/SKILL.md +++ b/skills/agent-platform-agent-management/SKILL.md @@ -126,7 +126,7 @@ never assume an argument. The agent tools drop an unknown key without an error: - **Toolset**: the smallest that does the job; `preset:none` for chat only; the broadest preset only on an explicit request. An own-account (OAuth) connector without `grantScope: subject` needs a sign-in in each of the agent's conversations (`agent-platform-tools`); say so before choosing it. -- **Tool approval** (further reading, optional: https://docs.giantswarm.io/overview/agent-platform/governing-tool-calls/): +- **Tool approval** (further reading, optional: https://github.com/giantswarm/agent-platform/blob/main/docs/tool-approval.md): today a toolset only selects tools; their Allow/Ask/Block settings are the connectors' (`agent-platform-tools`). On a **governed** platform every agent-manager tool that is not a read asks the person when an agent calls it; on a trusted one (the default) they run, except the floors diff --git a/skills/agent-platform-building-blocks/SKILL.md b/skills/agent-platform-building-blocks/SKILL.md index ebbb274d..4ed72ce5 100644 --- a/skills/agent-platform-building-blocks/SKILL.md +++ b/skills/agent-platform-building-blocks/SKILL.md @@ -30,7 +30,7 @@ person to sign in once with their own account; until then their tools are hidden Each tool of a connector is **Allow** (runs), **Ask** (a person confirms the call first) or **Block** (hidden); a connector's rule covers tools nobody has set yet, and the strictest setting wins. A governed platform also asks before an agent changes anything through the platform's own -connectors (https://docs.giantswarm.io/overview/agent-platform/governing-tool-calls/). +connectors (https://github.com/giantswarm/agent-platform/blob/main/docs/tool-approval.md). **Suggest one** when the goal needs a system no connector reaches yet ("read our Jira tickets"): someone registers it with **Add connector**. A connector that exists but whose tools are missing diff --git a/skills/agent-platform-tools/SKILL.md b/skills/agent-platform-tools/SKILL.md index 36113ca0..d611b69e 100644 --- a/skills/agent-platform-tools/SKILL.md +++ b/skills/agent-platform-tools/SKILL.md @@ -136,7 +136,7 @@ https://docs.giantswarm.io/tutorials/agent-platform/connecting-custom-mcp-server ## Tool approval: Allow, Ask, Block -Further reading (optional): https://docs.giantswarm.io/overview/agent-platform/governing-tool-calls/. +Further reading (optional): https://github.com/giantswarm/agent-platform/blob/main/docs/tool-approval.md. Muster decides every call by its tool's setting, whoever calls (an agent, the portal, Slack, Claude Code): - **Allow** runs. **Ask**: a person confirms the exact call first (inline in portal chat, or on Muster's From 9493705c4e0d9a33b4b302d10b1be0f6ac62851b Mon Sep 17 00:00:00 2001 From: Dominik Schmidle Date: Sat, 28 Nov 2026 14:56:14 +0100 Subject: [PATCH 52/56] fix(agent-platform): refuse agent chart ranges that admit a major past 99 Document the range grammar agent-platform.agentChart.majors reads and refuse a line that admits an agent chart major of 100 or more as unsupported, as agent-manager's migrate and the agent-platform-operator do. --- helm/agent-platform/templates/_helpers.tpl | 39 ++++++++++++++++++++++ tests/verify-agent-chart-line.py | 4 +++ 2 files changed, 43 insertions(+) diff --git a/helm/agent-platform/templates/_helpers.tpl b/helm/agent-platform/templates/_helpers.tpl index 436356f8..8c3b879a 100644 --- a/helm/agent-platform/templates/_helpers.tpl +++ b/helm/agent-platform/templates/_helpers.tpl @@ -2285,6 +2285,13 @@ x-ranges, carets, tildes and bounds all count. A probe counts only when the range admits it. A range that admits only pre-releases admits no major. Release versions only, as Flux's semver admits them without a pre-release comparator. +Supported grammar, the same in agent-manager's migrate and the +agent-platform-operator: a Masterminds semver range as Flux reads it +(x-ranges, carets, tildes, comparisons, hyphen ranges, `||` alternatives) +over release majors 0-99. A range that admits a version of major 100 or more +is unsupported (agent-platform.agentChart.beyondProbes) and refused by +agent-platform.validateAgentChartLine: the probes stop at 99. These are +finite probes, not a general semver intersection. Usage: include "agent-platform.agentChart.majors" "" | fromJsonArray */}} {{- define "agent-platform.agentChart.majors" -}} @@ -2312,6 +2319,35 @@ Usage: include "agent-platform.agentChart.majors" "" | fromJsonArray {{- $out | toJson -}} {{- end -}} +{{/* +"true" when a range admits a version of a major past the probes of +agent-platform.agentChart.majors (99): a version of major 100 or more it names +(with its next patch and minor), or any version of major 100 (first and late +version of minors 0-199, and a late minor); empty otherwise. Read as +agent-manager's migrate and the agent-platform-operator read it (beyondProbes). +Usage: include "agent-platform.agentChart.beyondProbes" "" +*/}} +{{- define "agent-platform.agentChart.beyondProbes" -}} +{{- $range := toString . -}} +{{- $hit := false -}} +{{- range $lit := regexFindAll "[0-9]+(\\.[0-9]+)?(\\.[0-9]+)?" $range -1 -}} +{{- $p := splitList "." $lit -}} +{{- $maj := atoi (index $p 0) -}} +{{- if gt $maj 99 -}} +{{- $min := 0 -}}{{- if gt (len $p) 1 -}}{{- $min = atoi (index $p 1) -}}{{- end -}} +{{- $pat := 0 -}}{{- if gt (len $p) 2 -}}{{- $pat = atoi (index $p 2) -}}{{- end -}} +{{- range $v := list (printf "%d.%d.%d" $maj $min $pat) (printf "%d.%d.%d" $maj $min (add1 $pat)) (printf "%d.%d.0" $maj (add1 $min)) -}} +{{- if semverCompare $range $v -}}{{- $hit = true -}}{{- end -}} +{{- end -}} +{{- end -}} +{{- end -}} +{{- if or (semverCompare $range "100.0.0") (semverCompare $range "100.999999.999999") -}}{{- $hit = true -}}{{- end -}} +{{- range $n := until 200 -}} +{{- if and (not $hit) (or (semverCompare $range (printf "100.%d.0" $n)) (semverCompare $range (printf "100.%d.999999" $n))) -}}{{- $hit = true -}}{{- end -}} +{{- end -}} +{{- if $hit -}}true{{- end -}} +{{- end -}} + {{/* The first pre-release of the next major a range admits (e.g. 3.0.0-rc.1 under ">=2.6.0 <=3.0.0-rc.1"), or empty: Flux would serve that chart under a range @@ -2356,6 +2392,9 @@ the key and the fix. {{- fail (printf "agent-manager.agentChart.semver %q is not a semver range: name the line as a range of one major (\">=2.6.0 <3.0.0\")" $range) -}} {{- end -}} {{- $majors := include "agent-platform.agentChart.majors" $range | fromJsonArray -}} +{{- if and (le (len $majors) 1) (include "agent-platform.agentChart.beyondProbes" $range) -}} +{{- fail (printf "agent-manager.agentChart.semver %q admits an agent chart major of 100 or more, which this chart, agent-manager's migrate and the agent-platform-operator do not read: name the line as a range of one major below 100 (\">=3.0.0 <4.0.0\")" $range) -}} +{{- end -}} {{- if not $majors -}} {{- fail (printf "agent-manager.agentChart.semver %q admits no release version of the agent chart: name the line as a range of one major (\">=2.6.0 <3.0.0\"; \">=3.0.0 <4.0.0\" once it may move), never a pre-release alone" $range) -}} {{- end -}} diff --git a/tests/verify-agent-chart-line.py b/tests/verify-agent-chart-line.py index 2b013e3a..5c2e97cc 100755 --- a/tests/verify-agent-chart-line.py +++ b/tests/verify-agent-chart-line.py @@ -162,6 +162,10 @@ def with_floors(dst: str, floors: dict[str, str] | None = None) -> str: refused(f"{r} below the floors", "admits a release below", "--set", f"agent-manager.agentChart.semver={r}") refused("a pre-release alone", "admits no release version", "--set", "agent-manager.agentChart.semver=3.0.0-rc.6") refused(">=3.0.0 spans majors as for migrate", "admits agent chart majors 3, 4, 5, 6, 7, …", "--set", "agent-manager.agentChart.semver=>=3.0.0") +# QB-07: majors past the probes (99) are refused as unsupported, as +# agent-manager's migrate and the operator refuse them, never read short. +for r in [">=100.0.0 <102.0.0", "100.x", ">=99.5.0", "^2.0.0 || 150.0.0"]: + refused(f"{r} past major 99", "admits an agent chart major of 100 or more", "--set", f"agent-manager.agentChart.semver={r}") refused("range spanning 2.x and 3.x", "admits agent chart majors 2, 3", "--set", "agent-manager.agentChart.semver=>=2.6.0") refused("3.x with agent-manager off: the operator still gets the range", "keep the 2.x line" if unset else "admits a release below", "--set", "components.agent-manager.enabled=false", "--set", f"agent-manager.agentChart.semver={V3}") From 7167a7fafb67cf90a257a101a42121fdab8c509d Mon Sep 17 00:00:00 2001 From: Dominik Schmidle Date: Sat, 28 Nov 2026 15:44:29 +0100 Subject: [PATCH 53/56] fix(muster): fail the render for explicit trusted client lists below the floor --- helm/agent-platform/templates/_helpers.tpl | 5 ++++- tests/verify-tool-approval.py | 9 +++++++++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/helm/agent-platform/templates/_helpers.tpl b/helm/agent-platform/templates/_helpers.tpl index 8c3b879a..6ad1ca17 100644 --- a/helm/agent-platform/templates/_helpers.tpl +++ b/helm/agent-platform/templates/_helpers.tpl @@ -5483,7 +5483,7 @@ client, backstage.signInHandoff is on and muster is at least agent-platform.muster.trustedClientsFloor, and none below it (an earlier muster issues handoff tickets without the workload review and the sign-in confirmation). An own list under either name (handoffClients, the earlier -one) stands, but every entry must be the portal's dedicated +one) stands from that floor (below it a non-empty one fails the render), and every entry must be the portal's dedicated client: one naming the platform's shared client (global.identity.clientId, else muster's login client) fails the render (every holder of such a token, muster, an agent's delegation, a CLI, could then approve without the page's @@ -5504,6 +5504,9 @@ Usage: include "agent-platform.muster.approval" $root | fromJson {{- end -}} {{- end -}} {{- range $key := list "trustedClients" "handoffClients" -}} +{{- if and (get $out $key | default list) (not (include "agent-platform.componentFloorAtLeast" (dict "root" $ "name" "muster" "version" (include "agent-platform.muster.trustedClientsFloor" $)))) -}} +{{- fail (printf "muster.muster.approval.%s is set, but muster is below agent-platform.muster.trustedClientsFloor (or the floor is unset): an earlier muster issues handoff tickets without the workload review and the sign-in confirmation, so it must trust no client; raise components.muster.versionRange or drop the list" $key) -}} +{{- end -}} {{- range $client := (get $out $key | default list) -}} {{- if and $portal.platformClientId (eq (toString $client) $portal.platformClientId) -}} {{- fail (printf "muster.muster.approval.%s lists %q, the platform's shared OAuth client: every holder of a token of that client (muster itself, agents acting for a person, CLIs) could approve a person's requests without muster's sign-in; list only the portal's own client (backstage.oidcClientId)" $key $portal.platformClientId) -}} diff --git a/tests/verify-tool-approval.py b/tests/verify-tool-approval.py index 32e37e29..3e4fd406 100755 --- a/tests/verify-tool-approval.py +++ b/tests/verify-tool-approval.py @@ -1014,6 +1014,15 @@ def clients(args: list[str], floor: str = trusted, key: str = "trustedClients") err = render(META_DIR, META + ["--set", trusted, *PORTAL_CLIENT, *args], expect_fail=True) if f'{key} lists "{client}", which is not the portal\'s own OAuth client' not in err: fail(f"{args}: a {key} list naming {client} must fail the render:\n{err}") + # Below the floor an explicit list fails too (it would trust a client of a + # muster that issues handoff tickets without the workload review). + for key in ("trustedClients", "handoffClients"): + for floor in (handoff, FLOOR_RANGE): + err = render(META_DIR, META + ["--set", floor, *PORTAL_CLIENT, *dedicated, "--set", f"muster.muster.approval.{key}[0]=platform-portal"], expect_fail=True) + if f"muster.muster.approval.{key} is set, but muster is below agent-platform.muster.trustedClientsFloor" not in err: + fail(f"an explicit {key} list below the trusted-clients floor must fail the render:\n{err}") + if clients(dedicated + ["--set-json", "muster.muster.approval.trustedClients=[]"], handoff): + fail("an own empty trustedClients list below the floor must render no trusted client") rel = doc(render_meta(["--set", trusted, *PORTAL_CLIENT, *dedicated]), "HelmRelease", "backstage") or "" if "key: portal-dex-client-secret" not in rel or "optional: true" not in rel: fail("the backstage release must mount the portal's own client secret (portal-dex-client-secret, optional)") From e13abf412372eb02fef63bd230197c1ab0b01b64 Mon Sep 17 00:00:00 2001 From: Dominik Schmidle Date: Mon, 30 Nov 2026 14:03:48 +0100 Subject: [PATCH 54/56] fix(muster): bind only ServiceAccounts as approval deciders An own muster.rbac.approvalDecider.subjects list, which an installation sets for a portal deployed as its own release (components.backstage off), now fails the render for any subject other than a ServiceAccount: a bound group or user could approve for any person whose token it holds. The test covers such a portal: an own decider list and trustedClients list stand, and the platform projects no token. --- docs/authentication.md | 2 +- helm/agent-platform/templates/_helpers.tpl | 10 +++++++++- tests/verify-tool-approval.py | 19 ++++++++++++++++++- 3 files changed, 28 insertions(+), 3 deletions(-) diff --git a/docs/authentication.md b/docs/authentication.md index 1caa9902..45b29916 100644 --- a/docs/authentication.md +++ b/docs/authentication.md @@ -52,7 +52,7 @@ By default the portal signs in with the platform's shared client (`global.identi - The portal also requests the platform client's audience (`audience:server:client_id:`, added to `backstage.extraScopes`), so every component that trusts the platform client accepts its tokens unchanged; `azp` names the portal's client. On Dex, the platform client and `dex-k8s-authenticator` list the portal's client under `trustedPeers`. - muster keys a forwarded token's session by its client too: a person's connector sign-ins through the shared client are not the portal's, except subject-scoped ones (`spec.auth.grantScope: subject`). -With a dedicated client and `backstage.signInHandoff` on (default), the chart lists that client, and only it, in muster's `approval.trustedClients` (from `agent-platform.muster.trustedClientsFloor`; below it none). The portal then shows a tool approval inline and posts the decision to muster (`POST /approvals/{id}/decision`) with the person's token and the digest of what was shown, and *Open* on a connector sign-in prompt gets a one-time ticket from `POST /handoff-tickets`. A person's portal token is not held by the portal backend alone (the browser, `forwardToken` servers and runtimes hold it too), so muster takes it on these two endpoints only together with the backend's own workload identity: its projected ServiceAccount token (audience `muster`, in `X-Muster-Approval-Client`, checked by `TokenReview` and a `LocalSubjectAccessReview` for `decide` on `toolapprovals.muster.giantswarm.io`). The chart binds muster's Role `muster-approval-decider` to the portal's ServiceAccount (`muster.rbac.approvalDecider.subjects`; an own list stands) and projects the token at `/var/run/secrets/muster.giantswarm.io/serviceaccount/token`. Either token alone decides nothing and mints no ticket. +With a dedicated client and `backstage.signInHandoff` on (default), the chart lists that client, and only it, in muster's `approval.trustedClients` (from `agent-platform.muster.trustedClientsFloor`; below it none). The portal then shows a tool approval inline and posts the decision to muster (`POST /approvals/{id}/decision`) with the person's token and the digest of what was shown, and *Open* on a connector sign-in prompt gets a one-time ticket from `POST /handoff-tickets`. A person's portal token is not held by the portal backend alone (the browser, `forwardToken` servers and runtimes hold it too), so muster takes it on these two endpoints only together with the backend's own workload identity: its projected ServiceAccount token (audience `muster`, in `X-Muster-Approval-Client`, checked by `TokenReview` and a `LocalSubjectAccessReview` for `decide` on `toolapprovals.muster.giantswarm.io`). The chart binds muster's Role `muster-approval-decider` to the portal's ServiceAccount (`muster.rbac.approvalDecider.subjects`; an own list stands) and projects the token at `/var/run/secrets/muster.giantswarm.io/serviceaccount/token`. Either token alone decides nothing and mints no ticket. A portal deployed as its own release (`components.backstage` off) gets neither: name its ServiceAccount in `muster.rbac.approvalDecider.subjects` (ServiceAccounts only, any other kind fails the render) and its client in `muster.muster.approval.trustedClients`, and project the token into its pod yourself. - Trade-off: the portal backend can approve a person's pending requests without muster's browser sign-in, on the person's click only. - muster refuses tokens naming an acting party, an agent's credential, another client, another workload or another person. A ticketed connector sign-in still asks the browser on muster's page first. diff --git a/helm/agent-platform/templates/_helpers.tpl b/helm/agent-platform/templates/_helpers.tpl index f8d88b89..175bc25f 100644 --- a/helm/agent-platform/templates/_helpers.tpl +++ b/helm/agent-platform/templates/_helpers.tpl @@ -5441,10 +5441,18 @@ portal's namespace) and nothing else, while the portal is on and muster's approval trusts a client (agent-platform.muster.approval renders trustedClients) from agent-platform.muster.trustedClientsFloor, the first muster that reviews the workload. An own muster.rbac.approvalDecider.subjects -stands. [] otherwise. +stands (a portal deployed as its own release names its ServiceAccount there +and projects the token itself), but every entry must be a ServiceAccount: any +other kind fails the render, since a bound group or user could approve for +any person whose token it holds. [] otherwise. Usage: include "agent-platform.muster.approvalDeciderSubjects" $root | fromJsonArray */}} {{- define "agent-platform.muster.approvalDeciderSubjects" -}} +{{- range $s := (dig "rbac" "approvalDecider" "subjects" list (.Values.muster | default dict)) -}} +{{- if ne (toString (get ($s | default dict) "kind")) "ServiceAccount" -}} +{{- fail (printf "muster.rbac.approvalDecider.subjects lists a %s (%v): bind only the portal backend's ServiceAccount, the one workload that sends its token beside a person's; a bound group or user could approve for any person whose token it holds" (toString (get ($s | default dict) "kind") | default "subject without a kind") (get ($s | default dict) "name")) -}} +{{- end -}} +{{- end -}} {{- $out := list -}} {{- if and (include "agent-platform.componentFloorAtLeast" (dict "root" . "name" "muster" "version" (include "agent-platform.muster.trustedClientsFloor" .))) (include "agent-platform.componentEnabled" (dict "root" . "name" "backstage")) (not (dig "rbac" "approvalDecider" "subjects" list (.Values.muster | default dict))) -}} {{- with (include "agent-platform.muster.approval" . | fromJson).trustedClients -}} diff --git a/tests/verify-tool-approval.py b/tests/verify-tool-approval.py index da771bd4..e2089b11 100755 --- a/tests/verify-tool-approval.py +++ b/tests/verify-tool-approval.py @@ -1061,6 +1061,23 @@ def backstage(args: list[str]) -> str: own = decider(["--set", trusted, *dedicated, "--set", "muster.rbac.approvalDecider.subjects[0].kind=ServiceAccount", "--set", "muster.rbac.approvalDecider.subjects[0].name=other", "--set", "muster.rbac.approvalDecider.subjects[0].namespace=x"]) if "name: other" not in own or "name: backstage" in own: fail(f"an own approvalDecider list must stand:\n{own}") + # A portal deployed as its own release (components.backstage off): the + # platform binds nobody, and an installation names the portal's + # ServiceAccount and its client itself; both lists stand, and the portal + # projects its token on its own. + separate = ["--set", trusted, *dedicated, "--set", "components.backstage.enabled=false"] + if decider(separate): + fail("a portal outside the platform: no approvalDecider subjects expected") + own_sa = ["--set", "muster.rbac.approvalDecider.subjects[0].kind=ServiceAccount", "--set", "muster.rbac.approvalDecider.subjects[0].name=backstage", "--set", "muster.rbac.approvalDecider.subjects[0].namespace=backstage"] + rel = muster_release([*PORTAL_CLIENT, *separate, *own_sa, "--set", "muster.muster.approval.trustedClients[0]=platform-portal"]) + if "namespace: backstage" not in block(rel, " approvalDecider:") or "- platform-portal" not in block(rel, " trustedClients:"): + fail(f"a portal outside the platform: an own approvalDecider list and trustedClients list must stand:\n{rel}") + if "muster-workload-token" in render_meta([*PORTAL_CLIENT, *separate, *own_sa]): + fail("a portal outside the platform: the platform projects no workload token") + for kind in ("Group", "User"): + err = render_meta_fail([*PORTAL_CLIENT, *separate, "--set", f"muster.rbac.approvalDecider.subjects[0].kind={kind}", "--set", "muster.rbac.approvalDecider.subjects[0].name=admins"]) + if "muster.rbac.approvalDecider.subjects" not in err or "ServiceAccount" not in err: + fail(f"an approvalDecider subject of kind {kind} must fail the render naming the key:\n{err}") for args, why in ( (["--set", trusted], "the portal on the shared client (no trusted client)"), (["--set", trusted, *dedicated, "--set", "backstage.signInHandoff=false"], "signInHandoff false"), @@ -1077,7 +1094,7 @@ def backstage(args: list[str]) -> str: "name: idp-ca", "mountPath: /etc/agent-platform/idp-ca"): if want not in rel: fail(f"the backstage release must project the portal's workload token beside its own volumes ({want!r} missing):\n{rel}") - print("ok: muster-approval-decider binds the portal's ServiceAccount only (name and namespace following the portal, an own list standing) and the portal projects its token for audience muster where its muster backend reads it, beside its own volumes; none without a trusted client or below the trusted-clients floor") + print("ok: muster-approval-decider binds the portal's ServiceAccount only (name and namespace following the portal, an own list standing, also for a portal outside the platform, a subject other than a ServiceAccount failing) and the portal projects its token for audience muster where its muster backend reads it, beside its own volumes; none without a trusted client or below the trusted-clients floor") def check_portal_client_app_config() -> None: From f4c0b3f0d661da181703f4de3b99702604cfb9b0 Mon Sep 17 00:00:00 2001 From: Dominik Schmidle Date: Mon, 30 Nov 2026 14:28:40 +0100 Subject: [PATCH 55/56] fix(backstage): refuse a second projection of the portal's workload token Where the platform projects the portal's workload token for muster, the portal chart's own projection (backstage.backstage.musterWorkloadToken) or an own volume or mount of that name fails the render instead of a pod declaring it twice. The tests add mixed decider lists, an entry without a kind, and the same with the portal on. --- helm/agent-platform/templates/_helpers.tpl | 12 +++++++++++- tests/verify-tool-approval.py | 17 +++++++++++++++++ 2 files changed, 28 insertions(+), 1 deletion(-) diff --git a/helm/agent-platform/templates/_helpers.tpl b/helm/agent-platform/templates/_helpers.tpl index 175bc25f..dd2aa1f9 100644 --- a/helm/agent-platform/templates/_helpers.tpl +++ b/helm/agent-platform/templates/_helpers.tpl @@ -701,9 +701,19 @@ connectivity release's values stay those of a chart without the operator. */ -}} projected where its muster backend reads it, while the platform binds the portal's ServiceAccount to muster-approval-decider (agent-platform.backstage.musterWorkloadToken). Appended to the block's own -extraVolumes and extraVolumeMounts, which derived values would replace. */ -}} +extraVolumes and extraVolumeMounts, which derived values would replace. The +portal chart's own projection (backstage.backstage.musterWorkloadToken) or an +own entry of that name would declare it twice: the render fails. */ -}} {{- with (include "agent-platform.backstage.musterWorkloadToken" .root | fromJson) -}} {{- $own := dig "backstage" dict ($.root.Values.backstage | default dict) | default dict -}} +{{- if dig "musterWorkloadToken" "enabled" false $own -}} +{{- fail "backstage.backstage.musterWorkloadToken.enabled is on, and the platform projects the portal's workload token for muster itself: turn the value off" -}} +{{- end -}} +{{- range concat (dig "extraVolumes" list $own | default list) (dig "extraVolumeMounts" list $own | default list) -}} +{{- if eq (toString (get (. | default dict) "name")) "muster-workload-token" -}} +{{- fail "backstage.backstage.extraVolumes or extraVolumeMounts name muster-workload-token, which the platform projects itself for the portal's workload token: drop the entry" -}} +{{- end -}} +{{- end -}} {{- $volumes := append (dig "extraVolumes" list $own | default list) .volume -}} {{- $mounts := append (dig "extraVolumeMounts" list $own | default list) .mount -}} {{- $_ := set $derived "backstage" (dict "extraVolumes" $volumes "extraVolumeMounts" $mounts) -}} diff --git a/tests/verify-tool-approval.py b/tests/verify-tool-approval.py index e2089b11..2cb118d4 100755 --- a/tests/verify-tool-approval.py +++ b/tests/verify-tool-approval.py @@ -1078,6 +1078,23 @@ def backstage(args: list[str]) -> str: err = render_meta_fail([*PORTAL_CLIENT, *separate, "--set", f"muster.rbac.approvalDecider.subjects[0].kind={kind}", "--set", "muster.rbac.approvalDecider.subjects[0].name=admins"]) if "muster.rbac.approvalDecider.subjects" not in err or "ServiceAccount" not in err: fail(f"an approvalDecider subject of kind {kind} must fail the render naming the key:\n{err}") + second_group = ["--set", "muster.rbac.approvalDecider.subjects[1].kind=Group", "--set", "muster.rbac.approvalDecider.subjects[1].name=admins"] + for args, why in ( + ([*separate, *own_sa, *second_group], "a ServiceAccount and a Group, the portal outside the platform"), + (["--set", trusted, *dedicated, *own_sa, *second_group], "a ServiceAccount and a Group, the portal on"), + ([*separate, "--set", "muster.rbac.approvalDecider.subjects[0].name=backstage"], "an entry without a kind"), + ): + err = render_meta_fail([*PORTAL_CLIENT, *args]) + if "muster.rbac.approvalDecider.subjects" not in err: + fail(f"{why} must fail the render naming the key:\n{err}") + # The portal chart's own projection, or an own volume of that name, beside + # the platform's would declare the volume twice. + for args in (["--set", "backstage.backstage.musterWorkloadToken.enabled=true"], + ["--set", "backstage.backstage.extraVolumes[0].name=muster-workload-token", "--set", "backstage.backstage.extraVolumes[0].emptyDir.medium=Memory"], + ["--set", "backstage.backstage.extraVolumeMounts[0].name=muster-workload-token", "--set", "backstage.backstage.extraVolumeMounts[0].mountPath=/x"]): + err = render_meta_fail([*PORTAL_CLIENT, "--set", trusted, *dedicated, *args]) + if "muster-workload-token" not in err and "musterWorkloadToken" not in err: + fail(f"a second projection of the workload token must fail the render ({args}):\n{err}") for args, why in ( (["--set", trusted], "the portal on the shared client (no trusted client)"), (["--set", trusted, *dedicated, "--set", "backstage.signInHandoff=false"], "signInHandoff false"), From 31f52905e404f69e5e2c17959f04b2d502f2be4f Mon Sep 17 00:00:00 2001 From: Dominik Schmidle Date: Mon, 30 Nov 2026 19:57:23 +0100 Subject: [PATCH 56/56] feat: set the tool approval release floors and move the component ranges to the epic releases --- UPGRADE.md | 1 + helm/agent-platform/README.md | 22 ++-- .../agent-platform/examples/customer-bom.yaml | 22 ++-- helm/agent-platform/templates/_helpers.tpl | 45 ++++--- helm/agent-platform/values.yaml | 47 ++++++-- tests/golden/meta-ci-engine-off.yaml | 113 ++++++++++++++++-- tests/golden/meta-default.yaml | 27 ++++- tests/verify-agent-chart-line.py | 53 +++++--- tests/verify-chatgpt-personal-login.py | 10 +- tests/verify-cluster-manager.py | 10 +- tests/verify-target.py | 42 ++++++- tests/verify-tool-approval.py | 34 +++--- tests/verify-workspace-manager.py | 11 +- 13 files changed, 323 insertions(+), 114 deletions(-) diff --git a/UPGRADE.md b/UPGRADE.md index 261966ee..b1f68b90 100644 --- a/UPGRADE.md +++ b/UPGRADE.md @@ -64,6 +64,7 @@ muster decides Allow, Ask or Block for every tool call; the chart renders its go ### Operator action - Move `components.muster.versionRange` to the muster release carrying tool approval. `governance.mode: governed` below it fails the render. +- The floors are muster `5.67.0-rc.61` and agent-manager `4.1.0-rc.1`. A pinned BOM moves muster, agent-manager and the MCPServer components to the pins in `examples/customer-bom.yaml`. - After muster's CRD upgrade, force a reconcile of the releases that render MCPServers (connectivity, agent-platform-mcps, the managers) if any was applied while the old CRD was served (its `spec.approval` was pruned): `flux reconcile helmrelease -n --force`. Until then muster refuses every server tool. Check with `kubectl get mcpservers -A -o custom-columns=NAME:.metadata.name,RULE:.spec.approval.rule`. - **Editor defaults changed.** `muster.rbac.mcpServerEditor.subjects` (connector admins) and `muster.rbac.workflowEditor.subjects` default to a ServiceAccount nobody can authenticate as (`kube-system/agent-platform-unset-connector-admins`, `...-workflow-editors`); before, they named two fixed admin groups. Set both to your admin groups (with the OIDC groups prefix); `tenants.platformTeam` is still appended. Until then only cluster admins register servers, author workflows or change tool approval. Keep the lists non-empty: muster's chart fails the upgrade with an empty list while its old `system:authenticated` binding exists (`muster.rbac.mcpServerEditor.allowRemovingBinding: true` drops it). `tenants.platform.editors` keeps its earlier default groups: replace them too. - **`governance` is a map.** Write `governance.mode: governed` where you wrote `governance: governed`; a string fails the render. diff --git a/helm/agent-platform/README.md b/helm/agent-platform/README.md index 5020e6f4..0e9e67c5 100644 --- a/helm/agent-platform/README.md +++ b/helm/agent-platform/README.md @@ -511,7 +511,7 @@ The map is merged into each component's own `nodeSelector` (`muster.nodeSelector | components.flux.enabled | bool | `true` | | | components.muster.chart | string | `"muster"` | | | components.muster.repository | string | `"oci://gsoci.azurecr.io/charts/giantswarm"` | | -| components.muster.versionRange | string | `">=5.67.0-rc.19 <6.0.0-0"` | | +| components.muster.versionRange | string | `">=5.67.0-rc.61 <6.0.0-0"` | | | components.muster.valuesFrom | string | `"muster"` | | | components.muster.crds | string | `"CreateReplace"` | | | components.muster.dependsOn[0] | string | `"valkey"` | | @@ -534,7 +534,7 @@ The map is merged into each component's own `nodeSelector` (`muster.nodeSelector | components.valkey.omitKeys[0] | string | `"podDisruptionBudget"` | | | components.agent-platform-mcps.chart | string | `"agent-platform-mcps"` | | | components.agent-platform-mcps.repository | string | `"oci://gsoci.azurecr.io/charts/giantswarm"` | | -| components.agent-platform-mcps.versionRange | string | `"0.12.x"` | | +| components.agent-platform-mcps.versionRange | string | `">=0.13.0-rc.1 <0.14.0-0"` | | | components.agent-platform-mcps.valuesFrom | string | `"agent-platform-mcps"` | | | components.agent-platform-mcps.injectGlobal | bool | `false` | | | components.agent-platform-mcps.dependsOn[0] | string | `"muster"` | | @@ -599,7 +599,7 @@ The map is merged into each component's own `nodeSelector` (`muster.nodeSelector | components.google-access-token-credential-provider.dependsOn[0] | string | `"substrate"` | | | components.klaus-gateway.chart | string | `"klaus-gateway"` | | | components.klaus-gateway.repository | string | `"oci://gsoci.azurecr.io/charts/giantswarm"` | | -| components.klaus-gateway.versionRange | string | `">=4.18.10 <5.0.0"` | | +| components.klaus-gateway.versionRange | string | `">=4.20.0-rc.8 <5.0.0-0"` | | | components.klaus-gateway.valuesFrom | string | `"klausGateway"` | | | components.klaus-gateway.omitKeys[0] | string | `"observability.enabled"` | | | components.klaus-gateway.omitKeys[1] | string | `"refusals"` | | @@ -615,7 +615,7 @@ The map is merged into each component's own `nodeSelector` (`muster.nodeSelector | components.agent-sandbox.dependsOn[0] | string | `"agent-platform-connectivity"` | | | components.model-manager.chart | string | `"model-manager"` | | | components.model-manager.repository | string | `"oci://gsoci.azurecr.io/charts/giantswarm"` | | -| components.model-manager.versionRange | string | `">=1.25.0 <2.0.0-0"` | | +| components.model-manager.versionRange | string | `">=1.26.0-rc.1 <2.0.0-0"` | | | components.model-manager.valuesFrom | string | `"model-manager"` | | | components.model-manager.enabled | bool | `true` | | | components.model-manager.dependsOn[0] | string | `"muster"` | | @@ -633,7 +633,7 @@ The map is merged into each component's own `nodeSelector` (`muster.nodeSelector | components.credential-api.dependsOn[0] | string | `"valkey"` | | | components.agent-manager.chart | string | `"agent-manager"` | | | components.agent-manager.repository | string | `"oci://gsoci.azurecr.io/charts/giantswarm"` | | -| components.agent-manager.versionRange | string | `">=4.0.0 <5.0.0"` | | +| components.agent-manager.versionRange | string | `">=4.1.0-rc.1 <5.0.0-0"` | | | components.agent-manager.valuesFrom | string | `"agent-manager"` | | | components.agent-manager.omitEmptyKeys[0] | string | `"harness.egress"` | | | components.agent-manager.enabled | bool | `false` | | @@ -641,7 +641,7 @@ The map is merged into each component's own `nodeSelector` (`muster.nodeSelector | components.agent-manager.dependsOn[1] | string | `"kagent"` | | | components.skill-manager.chart | string | `"skill-manager"` | | | components.skill-manager.repository | string | `"oci://gsoci.azurecr.io/charts/giantswarm"` | | -| components.skill-manager.versionRange | string | `">=0.4.0-rc.1 <0.5.0-0"` | | +| components.skill-manager.versionRange | string | `">=0.5.0-rc.1 <0.6.0-0"` | | | components.skill-manager.valuesFrom | string | `"skill-manager"` | | | components.skill-manager.dependsOn[0] | string | `"muster"` | | | components.skill-manager.gatedRoster | bool | `true` | | @@ -659,7 +659,7 @@ The map is merged into each component's own `nodeSelector` (`muster.nodeSelector | components.default-agent.dependsOn[0] | string | `"kagent"` | | | components.vm-manager.chart | string | `"vm-manager"` | | | components.vm-manager.repository | string | `"oci://gsoci.azurecr.io/charts/giantswarm"` | | -| components.vm-manager.versionRange | string | `">=0.29.0 <0.30.0"` | | +| components.vm-manager.versionRange | string | `">=0.30.0-rc.2 <0.31.0-0"` | | | components.vm-manager.valuesFrom | string | `"vm-manager"` | | | components.vm-manager.enabled | bool | `false` | | | components.vm-manager.dependsOn[0] | string | `"muster"` | | @@ -668,7 +668,7 @@ The map is merged into each component's own `nodeSelector` (`muster.nodeSelector | components.vm-manager.gatedValues[1] | string | `"vmManager"` | | | components.cluster-manager.chart | string | `"cluster-manager"` | | | components.cluster-manager.repository | string | `"oci://gsoci.azurecr.io/charts/giantswarm"` | | -| components.cluster-manager.versionRange | string | `">=0.40.0-rc.1"` | | +| components.cluster-manager.versionRange | string | `">=0.40.0-rc.3"` | | | components.cluster-manager.valuesFrom | string | `"cluster-manager"` | | | components.cluster-manager.enabled | bool | `false` | | | components.cluster-manager.dependsOn[0] | string | `"muster"` | | @@ -676,7 +676,7 @@ The map is merged into each component's own `nodeSelector` (`muster.nodeSelector | components.cluster-manager.gatedValues[1] | string | `"clusterManager"` | | | components.workspace-manager.chart | string | `"workspace-manager"` | | | components.workspace-manager.repository | string | `"oci://gsoci.azurecr.io/charts/giantswarm"` | | -| components.workspace-manager.versionRange | string | `">=0.16.0-rc.1 <0.17.0-0"` | | +| components.workspace-manager.versionRange | string | `">=0.17.0-rc.1 <0.18.0-0"` | | | components.workspace-manager.valuesFrom | string | `"workspace-manager"` | | | components.workspace-manager.dependsOn[0] | string | `"muster"` | | | components.workspace-manager.dependsOn[1] | string | `"agent-platform-connectivity"` | | @@ -696,7 +696,7 @@ The map is merged into each component's own `nodeSelector` (`muster.nodeSelector | components.workspace-manager.omitEmptyKeys[9] | string | `"storage.sizing.maxSize"` | | | components.toolchain-manager.chart | string | `"toolchain-manager"` | | | components.toolchain-manager.repository | string | `"oci://gsoci.azurecr.io/charts/giantswarm"` | | -| components.toolchain-manager.versionRange | string | `">=0.5.0 <0.6.0"` | | +| components.toolchain-manager.versionRange | string | `">=0.6.0-rc.16 <0.7.0-0"` | | | components.toolchain-manager.valuesFrom | string | `"toolchain-manager"` | | | components.toolchain-manager.enabled | bool | `false` | | | components.toolchain-manager.dependsOn[0] | string | `"muster"` | | @@ -705,7 +705,7 @@ The map is merged into each component's own `nodeSelector` (`muster.nodeSelector | components.toolchain-manager.gatedRoster | bool | `true` | | | components.agent-platform-operator.chart | string | `"agent-platform-operator"` | | | components.agent-platform-operator.repository | string | `"oci://gsoci.azurecr.io/charts/giantswarm"` | | -| components.agent-platform-operator.versionRange | string | `">=0.5.0 <0.6.0"` | | +| components.agent-platform-operator.versionRange | string | `">=0.6.0-rc.1 <0.7.0-0"` | | | components.agent-platform-operator.valuesFrom | string | `"agent-platform-operator"` | | | components.agent-platform-operator.dependsOn[0] | string | `"agent-platform-connectivity"` | | | components.agent-platform-operator.gatedRoster | bool | `true` | | diff --git a/helm/agent-platform/examples/customer-bom.yaml b/helm/agent-platform/examples/customer-bom.yaml index 3e70e4cd..f74c2c0f 100644 --- a/helm/agent-platform/examples/customer-bom.yaml +++ b/helm/agent-platform/examples/customer-bom.yaml @@ -37,36 +37,36 @@ gitops: interval: 30m components: - muster: { versionRange: "5.67.0-rc.19" } + muster: { versionRange: "5.67.0-rc.61" } agentgateway: { versionRange: "2.8.0" } valkey: { versionRange: "0.1.4" } - agent-platform-mcps: { versionRange: "0.9.0" } + agent-platform-mcps: { versionRange: "0.13.0-rc.1" } kagent: { versionRange: "1.34.0-rc.4" } kagent-crds: { versionRange: "1.34.0-rc.4" } substrate: { versionRange: "1.18.0" } substrate-crds: { versionRange: "1.18.0" } google-access-token-credential-provider: { versionRange: "0.3.0" } - klaus-gateway: { versionRange: "4.18.10" } + klaus-gateway: { versionRange: "4.20.0-rc.8" } agent-sandbox: { versionRange: "0.2.31" } dicebear: { versionRange: "0.3.10" } - model-manager: { versionRange: "1.25.0" } + model-manager: { versionRange: "1.26.0-rc.1" } credential-api: { versionRange: "0.1.0" } - agent-manager: { versionRange: "4.0.0" } + agent-manager: { versionRange: "4.1.0-rc.1" } # The default agent (components.default-agent): the agent chart. default-agent: { versionRange: "2.6.0" } - vm-manager: { versionRange: "0.29.0" } + vm-manager: { versionRange: "0.30.0-rc.2" } # The cluster write surface (components.cluster-manager, off by default). - cluster-manager: { versionRange: "0.40.0-rc.1" } + cluster-manager: { versionRange: "0.40.0-rc.3" } # The workspace surface (components.workspace-manager, follows # workspaces.enabled, off by default). - workspace-manager: { versionRange: "0.16.0-rc.1" } + workspace-manager: { versionRange: "0.17.0-rc.1" } # The toolchain surface (components.toolchain-manager, off by default). - toolchain-manager: { versionRange: "0.5.0" } + toolchain-manager: { versionRange: "0.6.0-rc.16" } # The skill sources (components.skill-manager, follows agent-manager). - skill-manager: { versionRange: "0.4.0-rc.1" } + skill-manager: { versionRange: "0.5.0-rc.1" } # The organizations' operator (components.agent-platform-operator, follows # agentPlatformOrganizations.enabled, off by default). - agent-platform-operator: { versionRange: "0.5.0" } + agent-platform-operator: { versionRange: "0.6.0-rc.1" } # The standalone chart's extras (off by default; the pins apply when an # installation turns them on). Snapshot of the agent-platform-standalone # chart's tested pins on 2026-09-08; the kserve charts move together (one diff --git a/helm/agent-platform/templates/_helpers.tpl b/helm/agent-platform/templates/_helpers.tpl index ff1df2b4..f2428dce 100644 --- a/helm/agent-platform/templates/_helpers.tpl +++ b/helm/agent-platform/templates/_helpers.tpl @@ -2328,28 +2328,26 @@ each, no comment inside the define. {{/* The floors of tool approval per agent: the first agent-manager whose chart takes muster.toolApproval, and the first muster that takes an -agent's approval settings with a Session binding. UNSET until those releases -exist: an empty floor admits no -release, so what it gates stays off and the agent chart line cannot move to -3.x; the platform release that pins those versions sets them. A guess would -switch the wiring on against released versions without the feature (muster -5.66.x and 5.67.0-rc.1 have no agent approval). One line each, no comment -inside the define. -*/}} -{{- define "agent-platform.agentManager.toolApprovalFloor" -}}{{- end -}} -{{- define "agent-platform.muster.agentApprovalFloor" -}}{{- end -}} +agent's approval settings with a Session binding: agent-manager 4.1.0-rc.1 +and muster 5.67.0-rc.61 (giantswarm/giantswarm#38902). An empty floor admits +no release, so what it gates stays off and the agent chart line cannot move to +3.x. A guess would switch the wiring on against released versions without the +feature (muster 5.66.x and 5.67.0-rc.1 have no agent approval). One line each, +no comment inside the define. +*/}} +{{- define "agent-platform.agentManager.toolApprovalFloor" -}}4.1.0-rc.1{{- end -}} +{{- define "agent-platform.muster.agentApprovalFloor" -}}5.67.0-rc.61{{- end -}} {{- /* The first muster serving the session bindings API on its own port -(muster.credentialProvider.sessionBindings); UNSET until it -exists. */ -}} -{{- define "agent-platform.muster.sessionBindingsPortFloor" -}}{{- end -}} +(muster.credentialProvider.sessionBindings). */ -}} +{{- define "agent-platform.muster.sessionBindingsPortFloor" -}}5.67.0-rc.61{{- end -}} {{- /* The first muster reading approval.trustedClients (handoffClients renamed; the trusted client also decides approvals inline, POST /approvals/{id}/decision) and reviewing the trusted client's own workload -token (verb decide, muster-approval-decider; giantswarm/muster#1912); UNSET -until it exists. Below it the chart lists no trusted client under either +token (verb decide, muster-approval-decider; giantswarm/muster#1912). +Below it the chart lists no trusted client under either name: a muster that issues handoff tickets without the workload review and the sign-in confirmation must not be trusted with them. */ -}} -{{- define "agent-platform.muster.trustedClientsFloor" -}}{{- end -}} +{{- define "agent-platform.muster.trustedClientsFloor" -}}5.67.0-rc.61{{- end -}} {{/* The session bindings API muster serves agent-manager alone: @@ -2382,10 +2380,10 @@ The first agent-manager whose migrate has the Generic chart 2.x -> 3.x hop : agent chart 3.0 removes muster.requireApproval, and that migrate rewrites it to default: Ask before it moves a namespace's chart source. The same release as -agent-platform.agentManager.toolApprovalFloor; UNSET until it exists, -which keeps every 3.x line refused. One line, no comment inside the define. +agent-platform.agentManager.toolApprovalFloor; unset, it keeps every 3.x +line refused. One line, no comment inside the define. */}} -{{- define "agent-platform.agentManager.agentChartV3Floor" -}}{{- end -}} +{{- define "agent-platform.agentManager.agentChartV3Floor" -}}4.1.0-rc.1{{- end -}} {{/* The release floors depend on one another: the governance floor @@ -5385,16 +5383,15 @@ comment inside the define. {{/* The first muster release that reads the governance configuration (muster.governance: the mode and the servers it names per role) and enforces -tool approval (Governing tool calls). -UNRELEASED: PLACEHOLDER-GOVERNANCE-FLOOR, UNSET until the release that carries -it exists (a guessed floor would render the configuration for a muster that ignores -it, so a `governed` platform would not be governed); the +tool approval (Governing tool calls): 5.67.0-rc.61 (giantswarm/muster#1912). +A guessed floor would render the configuration for a muster that ignores +it, so a `governed` platform would not be governed. The same floor gates the approval block and the redirect allowlist entries below (agent-platform.muster.approval, agent-platform.muster.redirectAllowlist), and tests/verify-tool-approval.py takes it from here. Below it the meta chart forwards none of them. One line, no comment inside the define. */}} -{{- define "agent-platform.muster.governanceFloor" -}}{{- end -}} +{{- define "agent-platform.muster.governanceFloor" -}}5.67.0-rc.61{{- end -}} {{/* The platform's governance mode (top-level `governance`: trusted, the default, diff --git a/helm/agent-platform/values.yaml b/helm/agent-platform/values.yaml index 3ee04f8a..695ea6df 100644 --- a/helm/agent-platform/values.yaml +++ b/helm/agent-platform/values.yaml @@ -499,7 +499,10 @@ components: # @schema additionalProperties: true # key for every replica (giantswarm/muster#1929). 5.67.0-rc.15 to rc.18 # refuse more than one replica without encryptionKey (giantswarm/muster#1919), # and an older chart keeps the tokens unencrypted; muster.replicaCount is 2. - versionRange: ">=5.67.0-rc.19 <6.0.0-0" + # Floor 5.67.0-rc.61: tool approval (giantswarm/muster#1912), the release + # the muster floors of this chart name (agent-platform.muster.governanceFloor, + # agentApprovalFloor, sessionBindingsPortFloor, trustedClientsFloor). + versionRange: ">=5.67.0-rc.61 <6.0.0-0" valuesFrom: muster # App-owned CRDs: muster ships its MCPServer/Workflow CRDs in its own chart # crds/ dir and owns their version. CreateReplace makes Flux upgrade them @@ -617,7 +620,9 @@ components: # @schema additionalProperties: true agent-platform-mcps: # @schema additionalProperties: true chart: agent-platform-mcps repository: oci://gsoci.azurecr.io/charts/giantswarm - versionRange: "0.12.x" + # 0.13.0-rc.1 is the floor: its servers carry their tool approval + # (spec.approval), which needs muster's tool approval floor. + versionRange: ">=0.13.0-rc.1 <0.14.0-0" valuesFrom: agent-platform-mcps # It renders the agentgateway data plane's one route to muster (the # hostless HTTPRoute behind the public /mcp, viaMuster), so it follows @@ -1052,7 +1057,9 @@ components: # @schema additionalProperties: true # on (giantswarm/klaus-gateway#616); an earlier gateway sends the # organization namespace, and the first Slack message to an organization's # agent is answered invalid_request. - versionRange: ">=4.18.10 <5.0.0" + # The floor is 4.20.0-rc.8: tool approval, approvals bound to the calling + # client and returned to Slack (giantswarm/giantswarm#38902). + versionRange: ">=4.20.0-rc.8 <5.0.0-0" valuesFrom: klausGateway # klausGateway.observability.enabled is this chart's knob (auto | true | # false, resolved by agent-platform.shape.apply); the klaus-gateway chart's @@ -1132,7 +1139,9 @@ components: # @schema additionalProperties: true # 1.25.0 is the floor: its schema has oauth.authorizationServer and # oauth.resourceServer, the keys agent-platform.identity.apply fills # (giantswarm/model-manager#461). - versionRange: ">=1.25.0 <2.0.0-0" + # 1.26.0-rc.1 is the floor: its MCPServer carries its tool approval + # (spec.approval, giantswarm/giantswarm#38902). + versionRange: ">=1.26.0-rc.1 <2.0.0-0" valuesFrom: model-manager enabled: true # Creates a muster.giantswarm.io/MCPServer CR (CRD owned by the muster app) @@ -1234,7 +1243,10 @@ components: # @schema additionalProperties: true # policies and skills are written for, and its schema has # oauth.authorizationServer and oauth.resourceServer, the keys # agent-platform.identity.apply fills. The ceiling is the next major. - versionRange: ">=4.0.0 <5.0.0" + # 4.1.0-rc.1 is the floor: per-agent tool approval and the migrate hop + # to agent chart 3.x (agent-platform.agentManager.toolApprovalFloor, + # agentChartV3Floor; giantswarm/giantswarm#38902). + versionRange: ">=4.1.0-rc.1 <5.0.0-0" valuesFrom: agent-manager # harness.egress travels only when set: the key is new in agent-manager # 1.11.0, and an older chart's closed harness block refuses it; unset, the @@ -1263,7 +1275,9 @@ components: # @schema additionalProperties: true # without it. The ceiling is the next minor: a skill-manager minor rolls # in with the chart release that renders its values. # mcp-oauth v1.15.0 permits private issuer JWKS without a blanket allowance. - versionRange: ">=0.4.0-rc.1 <0.5.0-0" + # 0.5.0-rc.1 is the floor: its MCPServer carries its tool approval + # (spec.approval, giantswarm/giantswarm#38902). + versionRange: ">=0.5.0-rc.1 <0.6.0-0" valuesFrom: skill-manager # Creates a muster.giantswarm.io/MCPServer CR (CRD owned by the muster # app); the reference is dropped at render time when muster is off. @@ -1336,7 +1350,9 @@ components: # @schema additionalProperties: true # writes the image certificate the artifact carries into each VM's UEFI db, # and create_vm's layer_certificates and cni_version are optional # (giantswarm/vm-manager#266, #286). The chart's values are those of 0.27. - versionRange: ">=0.29.0 <0.30.0" + # 0.30.0-rc.2 is the floor: its MCPServer carries its tool approval + # (spec.approval, giantswarm/giantswarm#38902). + versionRange: ">=0.30.0-rc.2 <0.31.0-0" valuesFrom: vm-manager enabled: false # Creates a muster.giantswarm.io/MCPServer CR (CRD owned by the muster @@ -1377,7 +1393,9 @@ components: # @schema additionalProperties: true # chart follows (UNCAPPED in tests/verify-range-ceilings.py). # 0.40.0-rc.1 is the floor: its schema has oauth.authorizationServer and # oauth.resourceServer, the keys agent-platform.identity.apply fills. - versionRange: ">=0.40.0-rc.1" + # 0.40.0-rc.3 is the floor: its MCPServer carries its tool approval + # (spec.approval, giantswarm/giantswarm#38902). + versionRange: ">=0.40.0-rc.3" valuesFrom: cluster-manager enabled: false # Creates a muster.giantswarm.io/MCPServer CR (CRD owned by the muster app); @@ -1425,7 +1443,9 @@ components: # @schema additionalProperties: true # minor: a workspace-manager minor rolls in with the chart release that # renders its values. # mcp-oauth v1.15.0 permits private issuer JWKS without a blanket allowance. - versionRange: ">=0.16.0-rc.1 <0.17.0-0" + # 0.17.0-rc.1 is the floor: its MCPServer carries its tool approval + # (spec.approval, giantswarm/giantswarm#38902). + versionRange: ">=0.17.0-rc.1 <0.18.0-0" valuesFrom: workspace-manager # Creates a muster.giantswarm.io/MCPServer CR (CRD owned by the muster app); # the reference is dropped at render time when the component is off. With @@ -1461,7 +1481,9 @@ components: # @schema additionalProperties: true # lists the manager's ServiceAccount in its allowedCallers). The ceiling is # the next minor: a toolchain-manager minor rolls in with the chart release # that renders its values. - versionRange: ">=0.5.0 <0.6.0" + # 0.6.0-rc.16 is the floor: its MCPServer carries its tool approval + # (spec.approval, giantswarm/giantswarm#38902). + versionRange: ">=0.6.0-rc.16 <0.7.0-0" valuesFrom: toolchain-manager enabled: false # Creates a muster.giantswarm.io/MCPServer CR (CRD owned by the muster app); @@ -1528,7 +1550,10 @@ components: # @schema additionalProperties: true # AgentPlatformOrganizations, whose namespaces and Kustomizations these # policies refuse. Its chart ships no crds/ dir: the Organization CRD is # organization-operator's, or agentPlatformOrganizations.organizationCRD's. - versionRange: ">=0.5.0 <0.6.0" + # 0.6.0-rc.1 is the floor: it moves an organization's chart source to a + # higher major only once migrate's ready mark names every release on it + # (ChartSourceHeld otherwise), which the agent chart 3.x cut-over needs. + versionRange: ">=0.6.0-rc.1 <0.7.0-0" valuesFrom: agent-platform-operator # The connectivity release first: the admission policies that hold the # operator, its kagent machine-caller binding, its network policies, and diff --git a/tests/golden/meta-ci-engine-off.yaml b/tests/golden/meta-ci-engine-off.yaml index d4669749..055a8139 100644 --- a/tests/golden/meta-ci-engine-off.yaml +++ b/tests/golden/meta-ci-engine-off.yaml @@ -77,12 +77,21 @@ spec: enabled: true muster: actorBearer: true + bindingsUrl: http://muster.default.svc.cluster.local:8091/session-bindings mcpServer: auth: forwardToken: true requiredAudiences: - dex-k8s-authenticator enabled: true + toolApproval: + enabled: true + platformReleases: + - agent: + name: default-agent + namespace: kagent + name: default-agent + namespace: default url: http://muster.default.svc.cluster.local:8090/mcp networkPolicy: enabled: false @@ -1317,8 +1326,8 @@ spec: musterInClusterMcpPorts: - 8080 - 8443 - musterSessionBindingsNamespace: "" - musterSessionBindingsPort: 0 + musterSessionBindingsNamespace: default + musterSessionBindingsPort: 8091 substrate: credentialProvider: egressFQDNs: [] @@ -2707,12 +2716,89 @@ spec: image: registry: gsoci.azurecr.io muster: + approval: + installation: agent-platform credentialProvider: actorBearer: enabled: true issuer: https://idp.ate-system.svc enabled: true gatewayIdentity: spiffe://cluster.local/ns/ate-system/sa/atenet-egress + sessionBindings: + allowedFrom: + - namespace: default + podLabels: + app.kubernetes.io/name: agent-manager + onMainPort: false + governance: + governedServers: + - role: agentManager + safe: + - get_info + - list_agents + - get_agent + - get_agent_status + - validate_agent + - list_model_configs + - list_egress_policies + - list_skills + - list_sessions + - get_session + - get_session_turn + - toolchain_users + - list_organizations + - get_organization + - list_organization_members + - list_organization_connectors + server: agent-manager + - role: sessionManager + safe: + - list_sessions + - list_session_checkpoints + - list_sandbox_templates + - list_sandboxes + - get_sandbox + - get_sandbox_process + - read_sandbox_outputs + - read_sandbox_file + server: kagent + - role: modelManager + safe: + - get_info + - get_backend + - list_backends + - list_models + - get_model + - list_loaded_models + - list_presets + - search_models + - check_fit + - list_nodes + - list_jobs + - get_job + server: model-manager + - role: skillManager + safe: + - list_skill_sources + - list_skills + - resolve_skills + - get_skill + - get_skill_file + server: skill-manager + - role: vmManager + safe: + - get_info + - get_host + - list_images + - get_image + - list_networks + - get_network + - list_vms + - get_vm + - get_vm_metrics + - get_vm_attestation + server: vm-manager + mode: trusted oauth: server: baseUrl: "" @@ -2776,6 +2862,11 @@ spec: enabled: true minAvailable: 1 rbac: + approvalBinder: + subjects: + - kind: ServiceAccount + name: agent-manager + namespace: default mcpServerEditor: subjects: - kind: ServiceAccount @@ -3336,7 +3427,8 @@ spec: mediaType: application/vnd.cncf.helm.chart.content.v1.tar+gzip operation: copy ref: - semver: ">=4.0.0 <5.0.0" + semver: ">=4.1.0-rc.1 <5.0.0-0" + semverFilter: "^v?[0-9]+\\.[0-9]+\\.[0-9]+(-rc\\.[0-9]+)?$" --- # Source: agent-platform/templates/components.yaml apiVersion: source.toolkit.fluxcd.io/v1 @@ -3386,7 +3478,8 @@ spec: mediaType: application/vnd.cncf.helm.chart.content.v1.tar+gzip operation: copy ref: - semver: "0.12.x" + semver: ">=0.13.0-rc.1 <0.14.0-0" + semverFilter: "^v?[0-9]+\\.[0-9]+\\.[0-9]+(-rc\\.[0-9]+)?$" --- # Source: agent-platform/templates/components.yaml apiVersion: source.toolkit.fluxcd.io/v1 @@ -3588,7 +3681,8 @@ spec: mediaType: application/vnd.cncf.helm.chart.content.v1.tar+gzip operation: copy ref: - semver: ">=4.18.10 <5.0.0" + semver: ">=4.20.0-rc.8 <5.0.0-0" + semverFilter: "^v?[0-9]+\\.[0-9]+\\.[0-9]+(-rc\\.[0-9]+)?$" --- # Source: agent-platform/templates/components.yaml apiVersion: source.toolkit.fluxcd.io/v1 @@ -3613,7 +3707,7 @@ spec: mediaType: application/vnd.cncf.helm.chart.content.v1.tar+gzip operation: copy ref: - semver: ">=1.25.0 <2.0.0-0" + semver: ">=1.26.0-rc.1 <2.0.0-0" semverFilter: "^v?[0-9]+\\.[0-9]+\\.[0-9]+(-rc\\.[0-9]+)?$" --- # Source: agent-platform/templates/components.yaml @@ -3639,7 +3733,7 @@ spec: mediaType: application/vnd.cncf.helm.chart.content.v1.tar+gzip operation: copy ref: - semver: ">=5.67.0-rc.19 <6.0.0-0" + semver: ">=5.67.0-rc.61 <6.0.0-0" semverFilter: "^v?[0-9]+\\.[0-9]+\\.[0-9]+(-rc\\.[0-9]+)?$" --- # Source: agent-platform/templates/components.yaml @@ -3665,7 +3759,7 @@ spec: mediaType: application/vnd.cncf.helm.chart.content.v1.tar+gzip operation: copy ref: - semver: ">=0.4.0-rc.1 <0.5.0-0" + semver: ">=0.5.0-rc.1 <0.6.0-0" semverFilter: "^v?[0-9]+\\.[0-9]+\\.[0-9]+(-rc\\.[0-9]+)?$" --- # Source: agent-platform/templates/components.yaml @@ -3766,4 +3860,5 @@ spec: mediaType: application/vnd.cncf.helm.chart.content.v1.tar+gzip operation: copy ref: - semver: ">=0.29.0 <0.30.0" + semver: ">=0.30.0-rc.2 <0.31.0-0" + semverFilter: "^v?[0-9]+\\.[0-9]+\\.[0-9]+(-rc\\.[0-9]+)?$" diff --git a/tests/golden/meta-default.yaml b/tests/golden/meta-default.yaml index d9833df8..aab5d5ef 100644 --- a/tests/golden/meta-default.yaml +++ b/tests/golden/meta-default.yaml @@ -2175,6 +2175,26 @@ spec: image: registry: gsoci.azurecr.io muster: + approval: + installation: agent-platform + governance: + governedServers: + - role: modelManager + safe: + - get_info + - get_backend + - list_backends + - list_models + - get_model + - list_loaded_models + - list_presets + - search_models + - check_fit + - list_nodes + - list_jobs + - get_job + server: model-manager + mode: trusted oauth: server: baseUrl: "" @@ -2532,7 +2552,8 @@ spec: mediaType: application/vnd.cncf.helm.chart.content.v1.tar+gzip operation: copy ref: - semver: "0.12.x" + semver: ">=0.13.0-rc.1 <0.14.0-0" + semverFilter: "^v?[0-9]+\\.[0-9]+\\.[0-9]+(-rc\\.[0-9]+)?$" --- # Source: agent-platform/templates/components.yaml apiVersion: source.toolkit.fluxcd.io/v1 @@ -2607,7 +2628,7 @@ spec: mediaType: application/vnd.cncf.helm.chart.content.v1.tar+gzip operation: copy ref: - semver: ">=1.25.0 <2.0.0-0" + semver: ">=1.26.0-rc.1 <2.0.0-0" semverFilter: "^v?[0-9]+\\.[0-9]+\\.[0-9]+(-rc\\.[0-9]+)?$" --- # Source: agent-platform/templates/components.yaml @@ -2633,7 +2654,7 @@ spec: mediaType: application/vnd.cncf.helm.chart.content.v1.tar+gzip operation: copy ref: - semver: ">=5.67.0-rc.19 <6.0.0-0" + semver: ">=5.67.0-rc.61 <6.0.0-0" semverFilter: "^v?[0-9]+\\.[0-9]+\\.[0-9]+(-rc\\.[0-9]+)?$" --- # Source: agent-platform/templates/components.yaml diff --git a/tests/verify-agent-chart-line.py b/tests/verify-agent-chart-line.py index 5c2e97cc..d294c726 100755 --- a/tests/verify-agent-chart-line.py +++ b/tests/verify-agent-chart-line.py @@ -21,7 +21,9 @@ bindings) are unset or above the last release without the feature; while the hop's or muster's floor is unset every 3.x range is refused, whatever its form (~3.2, 3.1.x, bounds), a pre-release alone and >=3.0.0 (spans - majors, as migrate says) too; the gated paths run on a copy of the chart + majors, as migrate says) too; once they are set, the same ranges are + refused with agent-manager and muster below them and the 3.x line renders + with the default ranges; the gated paths run on a copy of the chart with test floors; - a floor that needs the governance wiring (agent approval, the hop, tool approval, session bindings) set while the governance floor is unset fails @@ -64,7 +66,7 @@ ] V3 = ">=3.0.0 <4.0.0" LINE = ["--set", f"agent-manager.agentChart.semver={V3}"] -AM = ["--set", "components.agent-manager.versionRange=>={floor}-rc.1 <4.0.0-0"] +AM = ["--set", "components.agent-manager.versionRange=>={floor}-rc.1 <5.0.0-0"] MUSTER = ["--set", "components.muster.versionRange=>={floor} <6.0.0"] DEFAULT_AGENT = ["--set", f"components.default-agent.versionRange={V3}"] @@ -96,18 +98,31 @@ def refused(what: str, needle: str, *args: str) -> None: # The releases that do not carry what the 3.x line needs: a floor at or below # them would let a 3.x line through against a muster that ignores default: Ask # or an agent-manager whose migrate has no 2.x -> 3.x hop. -LAST_WITHOUT = {"muster.agentApprovalFloor": (5, 67, 0), "agentManager.agentChartV3Floor": (3, 5, 8), - "agentManager.toolApprovalFloor": (3, 5, 8), "muster.governanceFloor": (5, 67, 0), - "muster.sessionBindingsPortFloor": (5, 67, 0)} +LAST_WITHOUT = {"muster.agentApprovalFloor": "5.67.0-rc.60", "agentManager.agentChartV3Floor": "4.0.1", + "agentManager.toolApprovalFloor": "4.0.1", "muster.governanceFloor": "5.67.0-rc.60", + "muster.sessionBindingsPortFloor": "5.67.0-rc.60"} PLACEHOLDERS = list(LAST_WITHOUT) # Test values for the floors in a copy of the chart, so the paths they gate # are exercised while the chart itself keeps them unset. -TEST_FLOORS = {"muster.agentApprovalFloor": "5.68.0", "agentManager.agentChartV3Floor": "3.6.0", - "agentManager.toolApprovalFloor": "3.6.0", "muster.governanceFloor": "5.68.0", +# They sit above the default component ranges, so the default render is below +# every one of them. +TEST_FLOORS = {"muster.agentApprovalFloor": "5.68.0", "agentManager.agentChartV3Floor": "4.6.0", + "agentManager.toolApprovalFloor": "4.6.0", "muster.governanceFloor": "5.68.0", "muster.sessionBindingsPortFloor": "5.68.0"} +# agent-manager and muster below the chart's own floors (the last lines +# without the feature). +BELOW = ["--set", "components.agent-manager.versionRange=>=4.0.0 <4.1.0-0", "--set", "components.muster.versionRange=>=5.66.0 <5.67.0-0"] BYPASS = ["~3.2", "3.1.x", ">=3.1.0 <3.6.0", "3.0.0-rc.6", ">=3.0.0", "3.x", V3] +def semver_key(v: str) -> tuple: + """Semver precedence: a pre-release sorts below its release, its + dot-separated identifiers numerically where they are numbers.""" + core, _, pre = v.partition("-") + ids = tuple((0, int(i), "") if i.isdigit() else (1, 0, i) for i in pre.split(".")) if pre else () + return (tuple(map(int, core.split("."))), 0 if pre else 1, ids) + + def floor_value(chart: str, name: str) -> str | None: text = open(os.path.join(chart, "templates", "_helpers.tpl"), encoding="utf-8").read() m = re.search(r'\{\{- define "agent-platform\.' + re.escape(name) + r'" -\}\}([^{]*)\{\{- end -\}\}', text) @@ -136,10 +151,10 @@ def with_floors(dst: str, floors: dict[str, str] | None = None) -> str: v = floor_value(META, name) if v is None or v == "": continue - if not re.fullmatch(r"\d+\.\d+\.\d+", v): - fail(f"agent-platform.{name} {v!r} is neither unset nor one X.Y.Z") - elif tuple(map(int, v.split("."))) <= LAST_WITHOUT[name]: - fail(f"agent-platform.{name} {v} admits a release without the feature (last without it: {'.'.join(map(str, LAST_WITHOUT[name]))})") + if not re.fullmatch(r"\d+\.\d+\.\d+(-[0-9A-Za-z.-]+)?", v): + fail(f"agent-platform.{name} {v!r} is neither unset nor one X.Y.Z[-pre]") + elif semver_key(v) <= semver_key(LAST_WITHOUT[name]): + fail(f"agent-platform.{name} {v} admits a release without the feature (last without it: {LAST_WITHOUT[name]})") unset = not floor_value(META, "agentManager.agentChartV3Floor") or not floor_value(META, "muster.agentApprovalFloor") out = renders("default") @@ -159,7 +174,11 @@ def with_floors(dst: str, floors: dict[str, str] | None = None) -> str: if unset: refused(f"{r} while the floors are unset", "are unset; keep the 2.x line", "--set", f"agent-manager.agentChart.semver={r}") else: - refused(f"{r} below the floors", "admits a release below", "--set", f"agent-manager.agentChart.semver={r}") + refused(f"{r} below the floors", "admits a release below", *BELOW, "--set", f"agent-manager.agentChart.semver={r}") +if not unset: + out = renders("3.x line at the chart's floors with the default ranges", *LINE, *DEFAULT_AGENT) + if out.count(V3) < 3: + fail(f"at the chart's floors the 3.x line reaches {out.count(V3)} places; want agent-manager's release, the connectivity release and the default agent's source") refused("a pre-release alone", "admits no release version", "--set", "agent-manager.agentChart.semver=3.0.0-rc.6") refused(">=3.0.0 spans majors as for migrate", "admits agent chart majors 3, 4, 5, 6, 7, …", "--set", "agent-manager.agentChart.semver=>=3.0.0") # QB-07: majors past the probes (99) are refused as unsupported, as @@ -168,7 +187,7 @@ def with_floors(dst: str, floors: dict[str, str] | None = None) -> str: refused(f"{r} past major 99", "admits an agent chart major of 100 or more", "--set", f"agent-manager.agentChart.semver={r}") refused("range spanning 2.x and 3.x", "admits agent chart majors 2, 3", "--set", "agent-manager.agentChart.semver=>=2.6.0") refused("3.x with agent-manager off: the operator still gets the range", "keep the 2.x line" if unset else "admits a release below", - "--set", "components.agent-manager.enabled=false", "--set", f"agent-manager.agentChart.semver={V3}") + *([] if unset else BELOW), "--set", "components.agent-manager.enabled=false", "--set", f"agent-manager.agentChart.semver={V3}") # With the floors set (a copy of the chart), the gated paths. with tempfile.TemporaryDirectory() as tmp: @@ -181,7 +200,7 @@ def with_floors(dst: str, floors: dict[str, str] | None = None) -> str: for r in ["~3.2", "3.1.x", ">=3.1.0 <3.6.0"]: renders(f"{r} with its floors", "--set", f"agent-manager.agentChart.semver={r}", *am, *muster, "--set", f"components.default-agent.versionRange={r}") refused(f"{r}, muster below its floor", "admits a release below 5.68.0", "--set", f"agent-manager.agentChart.semver={r}", *am, "--set", f"components.default-agent.versionRange={r}") - refused("3.x line, agent-manager below its floor", "admits a release below 3.6.0", *LINE, *muster, *DEFAULT_AGENT) + refused("3.x line, agent-manager below its floor", f"admits a release below {TEST_FLOORS['agentManager.agentChartV3Floor']}", *LINE, *muster, *DEFAULT_AGENT) refused("3.x line, muster below its floor", "admits a release below 5.68.0", *LINE, *am, *DEFAULT_AGENT) refused("3.x line, tool approval off", "agent-manager.muster.toolApproval.enabled is false", *LINE, *am, *muster, *DEFAULT_AGENT, "--set", "agent-manager.muster.toolApproval.enabled=false") @@ -318,7 +337,7 @@ def scope_policy(*args: str) -> str: # both, not an agent-manager that binds what muster refuses. for dependent in ("muster.agentApprovalFloor", "agentManager.agentChartV3Floor", "agentManager.toolApprovalFloor", "muster.sessionBindingsPortFloor"): with tempfile.TemporaryDirectory() as tmp: - META = with_floors(tmp, {dependent: TEST_FLOORS[dependent]} | {"muster.governanceFloor": ""}) + META = with_floors(tmp, {n: "" for n in PLACEHOLDERS} | {dependent: TEST_FLOORS[dependent]}) refused(f"{dependent} set, governance floor unset", f"agent-platform.{dependent} is set while agent-platform.muster.governanceFloor is unset") refused(f"{dependent} set, governance floor unset, 2.x line", "agent-platform.muster.governanceFloor is unset", "--set", "agent-manager.agentChart.semver=2.6.1") META = META_ORIG @@ -351,7 +370,7 @@ def bound_cases() -> None: refused("latest", "is not a semver range", "--set", "agent-manager.agentChart.semver=latest") refused("empty", "is not a semver range", "--set-string", "agent-manager.agentChart.semver=") renders("an exact 2.x pin", "--set-string", "agent-manager.agentChart.semver=2.6.1") -refused("an exact 3.x pin", "keep the 2.x line" if unset else "admits a release below", "--set-string", "agent-manager.agentChart.semver=3.0.0") +refused("an exact 3.x pin", "keep the 2.x line" if unset else "admits a release below", *([] if unset else BELOW), "--set-string", "agent-manager.agentChart.semver=3.0.0") renders("prerelease-widened 2.x line", "--set", "agent-manager.agentChart.semver=>=2.6.0-0 <3.0.0-0") # An || range is held to its lowest alternative's floor. @@ -361,7 +380,7 @@ def bound_cases() -> None: muster = [a.replace("{floor}", TEST_FLOORS["muster.agentApprovalFloor"]) for a in MUSTER] for what, args in (("muster", ["--set", "components.muster.versionRange=>=5.68.0 <6.0.0 || >=5.0.0", *am]), ("muster, exact alternatives", ["--set", "components.muster.versionRange=5.68.0 || 5.66.2", *am]), - ("agent-manager", ["--set", "components.agent-manager.versionRange=>=3.6.0 || >=3.5.0", *muster])): + ("agent-manager", ["--set", "components.agent-manager.versionRange=>=4.6.0 || >=4.5.0", *muster])): refused(f"|| range of {what} below its floor", "admits a release below", *LINE, *DEFAULT_AGENT, *args) META = META_ORIG diff --git a/tests/verify-chatgpt-personal-login.py b/tests/verify-chatgpt-personal-login.py index 9fa669b8..20b3aaf1 100755 --- a/tests/verify-chatgpt-personal-login.py +++ b/tests/verify-chatgpt-personal-login.py @@ -38,6 +38,10 @@ "--set", "global.identity.existingSecret=platform-oauth", "--set", "muster.muster.oauth.server.existingSecret=platform-oauth"] MUSTER_CHART = ("oci://gsoci.azurecr.io/charts/giantswarm/muster", "5.52.5") +# The muster chart the release's values render against: the default range's +# floor, whose schema takes what the meta chart derives from its release floors +# (approval, governance, the session bindings port). +MUSTER_RELEASE_CHART = ("oci://gsoci.azurecr.io/charts/giantswarm/muster", "5.67.0-rc.61") KAGENT_CHART = ("oci://gsoci.azurecr.io/giantswarm/kagent/helm/kagent", "1.24.0-rc.1") PROVIDER = "chatgpt:\n{i} hostname: chatgpt.com\n{i} pathPrefix: /backend-api/codex/\n{i} scheme: Bearer\n" APP = "- flow: chatgptDeviceCode\n{i} name: chatgpt\n" @@ -132,13 +136,13 @@ def main(chart: str) -> int: fail(f"an own muster App chatgpt does not stand in place of the derived one:\n{apps}") ok("an own key of the provider entry and an own muster App chatgpt stand") - config = component_render(release(on, "muster"), MUSTER_CHART) + config = component_render(release(on, "muster"), MUSTER_RELEASE_CHART) if not re.search(r"providerApps:\n(?:\s+.*\n)*?\s+- flow: chatgptDeviceCode\n\s+name: chatgpt", config): - fail(f"the muster chart {MUSTER_CHART[1]} does not keep the chatgpt App:\n{config}") + fail(f"the muster chart {MUSTER_RELEASE_CHART[1]} does not keep the chatgpt App:\n{config}") controller = component_render(release(on, "kagent"), KAGENT_CHART).replace('\\"', '"') if '"chatgpt":{"hostname":"chatgpt.com","pathPrefix":"/backend-api/codex/","scheme":"Bearer"}' not in controller: fail(f"the kagent chart {KAGENT_CHART[1]} does not list the chatgpt provider in KAGENT_SESSION_ACTOR_JWT_PROVIDERS") - ok(f"the muster chart {MUSTER_CHART[1]} keeps the App; the kagent chart {KAGENT_CHART[1]} lists the provider") + ok(f"the muster chart {MUSTER_RELEASE_CHART[1]} keeps the App; the kagent chart {KAGENT_CHART[1]} lists the provider") # --- without a prerequisite nothing is derived ------------------------------------- for flags, case in ( diff --git a/tests/verify-cluster-manager.py b/tests/verify-cluster-manager.py index 26ef471c..80886548 100755 --- a/tests/verify-cluster-manager.py +++ b/tests/verify-cluster-manager.py @@ -172,10 +172,18 @@ def main(meta: str, connectivity: str) -> int: fail(f"switching the component on added documents other than its two: {sorted(added)}") if set(off_docs) - set(on_docs): fail(f"switching the component on removed documents: {sorted(set(off_docs) - set(on_docs))}") + # muster governs the component's server (muster.governance.governedServers, + # tests/verify-tool-approval.py): the one entry it gains. + governed = re.compile(r"^ - role: clusterManager\n(?: .*\n)*", re.M) for key, doc in off_docs.items(): if key == ("HelmRelease", "agent-platform-connectivity"): continue - if on_docs[key] != doc: + on_doc = on_docs[key] + if key == ("HelmRelease", "muster"): + if len(governed.findall(on_doc)) != 1 or governed.search(doc): + fail("switching the component on must add one governedServers entry for its server to muster's release") + on_doc = governed.sub("", on_doc) + if on_doc != doc: fail(f"switching the component on changed {key}") ok(f"on: one OCIRepository ({rng}) + one HelmRelease dependsOn muster, the block forwarded (Service name, OAuth as the caller, the muster registration, global), the namespace derived, the two blocks reach connectivity; nothing else moved") diff --git a/tests/verify-target.py b/tests/verify-target.py index 8f4e2287..9510edb4 100755 --- a/tests/verify-target.py +++ b/tests/verify-target.py @@ -132,8 +132,11 @@ def targeted(doc: str) -> str: skill-manager's Service that agent-manager is pointed at (skillManager.url and, on the connectivity release, agentManager.skillManager.namespace), and muster's in-cluster address its consumers are given (muster.url, muster.mcpUrl, - kagent's actor JWT provider hostname).""" - out, section, backends, skills = [], "", -1, -1 + muster.bindingsUrl, kagent's actor JWT provider hostname), and agent-manager's + namespace muster's session bindings and approval binder name + (muster.credentialProvider.sessionBindings.allowedFrom, + rbac.approvalBinder.subjects, networkPolicy.musterSessionBindingsNamespace).""" + out, section, backends, skills, agentManagerNs = [], "", -1, -1, -1 for line in doc.split("\n"): if re.match(r"^ \S", line): section = line.strip() @@ -142,15 +145,23 @@ def targeted(doc: str) -> str: backends = -1 if skills >= 0 and line.strip() and indent <= skills: skills = -1 + if agentManagerNs >= 0 and line.strip() and indent <= agentManagerNs: + agentManagerNs = -1 if re.match(r"^ +mcpBackends:$", line): backends = indent elif re.match(r"^ +skillManager:$", line): skills = indent + elif re.match(r"^ +(sessionBindings|approvalBinder):$", line): + agentManagerNs = indent elif (backends >= 0 or skills >= 0) and re.match(r"^ +namespace: default$", line): line = line.replace(": default", ": agent-platform") + elif agentManagerNs >= 0 and re.match(r"^ +(- )?namespace: default$", line): + line = line.replace(": default", ": agent-platform") + elif re.match(r"^ +musterSessionBindingsNamespace: default$", line): + line = line.replace(": default", ": agent-platform") elif skills >= 0 and re.match(r"^ +url: http://[^.]+\.default\.svc\.cluster\.local[:/]", line): line = line.replace(".default.svc.", ".agent-platform.svc.", 1) - elif section == "values:" and re.match(r"^ +(url|mcpUrl): http://muster\.default\.svc\.cluster\.local:|^ +hostname: muster\.default\.svc\.cluster\.local$", line): + elif section == "values:" and re.match(r"^ +(url|mcpUrl|bindingsUrl): http://muster\.default\.svc\.cluster\.local:|^ +hostname: muster\.default\.svc\.cluster\.local$", line): line = line.replace(".default.svc.", ".agent-platform.svc.", 1) if re.match(r"^ name: ", line) and section.startswith("name:"): line = line.replace("name: ", "name: t-", 1) @@ -165,6 +176,27 @@ def targeted(doc: str) -> str: return "\n".join(out) +def without_platform_agents(doc: str) -> str: + """The document without agent-manager's muster.toolApproval.platformReleases + or platformAgents block: with a remote target agent-manager gets the default + agent's approval values instead of its release (tests/verify-tool-approval.py, + check_default_agent_on_remote_target).""" + out, skip = [], -1 + for line in doc.split("\n"): + indent = len(line) - len(line.lstrip()) + if skip >= 0 and line.strip() and indent <= skip and not line.lstrip().startswith("- "): + skip = -1 + elif skip >= 0 and line.strip() and indent < skip: + skip = -1 + if skip >= 0: + continue + if re.match(r"^ +platform(Releases|Agents):$", line): + skip = indent + continue + out.append(line) + return "\n".join(out) + + def ok(msg: str) -> None: print(f"ok: {msg}") @@ -189,8 +221,8 @@ def check_knob(meta: str) -> None: # a target (targeted: the names prefixed, the workloads and their Helm # storage in agent-platform); what else leaves the render is the hook # family (a hook runs where the chart is installed — check_hooks). - stripped = {k: "\n".join(line for line in d.split("\n") if line not in lines) for k, d in docs.items() if k[0] in FLUX_KINDS} - expected = {(k[0], f"t-{k[1]}"): targeted(d) for k, d in documents(plain).items() if k[0] in FLUX_KINDS} + stripped = {k: without_platform_agents("\n".join(line for line in d.split("\n") if line not in lines)) for k, d in docs.items() if k[0] in FLUX_KINDS} + expected = {(k[0], f"t-{k[1]}"): without_platform_agents(targeted(d)) for k, d in documents(plain).items() if k[0] in FLUX_KINDS} if stripped != expected: diff = sorted(k for k in set(stripped) | set(expected) if stripped.get(k) != expected.get(k)) sys.exit(f"FAIL: the knob changed an OCIRepository / HelmRelease beyond the kubeConfig lines and the target placement ({flags}): {diff}") diff --git a/tests/verify-tool-approval.py b/tests/verify-tool-approval.py index 2cb118d4..d3ef8cb6 100755 --- a/tests/verify-tool-approval.py +++ b/tests/verify-tool-approval.py @@ -43,7 +43,7 @@ ServiceAccount's token for audience muster where the portal's muster backend reads it, beside its own extra volumes; none without a trusted client or below the floor. -- governance floor: agent-platform.muster.governanceFloor is one X.Y.Z; its +- governance floor: agent-platform.muster.governanceFloor is one X.Y.Z[-pre]; its PLACEHOLDER-GOVERNANCE-FLOOR marker, while it is still there, appears once. - connector-admin: muster's mcpserver-editor Role (the platform's connector-admin role) is bound to the configured groups: by default a @@ -111,9 +111,9 @@ def governance_floor(meta_dir: str) -> str: """The value of agent-platform.muster.governanceFloor, and its one marker.""" text = open(os.path.join(meta_dir, "templates", "_helpers.tpl")).read() - m = re.search(r'define "agent-platform\.muster\.governanceFloor" -\}\}((?:[0-9]+\.[0-9]+\.[0-9]+)?)\{\{-', text) + m = re.search(r'define "agent-platform\.muster\.governanceFloor" -\}\}((?:[0-9]+\.[0-9]+\.[0-9]+(?:-[0-9A-Za-z.-]+)?)?)\{\{-', text) if not m: - fail("agent-platform.muster.governanceFloor must be one line holding one X.Y.Z, or nothing while its release does not exist") + fail("agent-platform.muster.governanceFloor must be one line holding one X.Y.Z[-pre], or nothing while its release does not exist") if not m.group(1): print("note: the governance floor is unset (PLACEHOLDER-GOVERNANCE-FLOOR): nothing it gates renders; set it in the platform release that pins the muster release carrying tool approval") return "" @@ -122,9 +122,6 @@ def governance_floor(meta_dir: str) -> str: fail("the governance floor placeholder must be marked at most once (PLACEHOLDER-GOVERNANCE-FLOOR) next to its define") if markers and m.group(1): print(f"note: the governance floor {m.group(1)} is still a placeholder (PLACEHOLDER-GOVERNANCE-FLOOR): move it to the muster release that carries tool approval before releasing") - values = open(os.path.join(meta_dir, "values.yaml")).read() - if f">={m.group(1)}" in values: - fail(f"values.yaml repeats the governance floor {m.group(1)}: it lives in agent-platform.muster.governanceFloor alone") return m.group(1) @@ -617,7 +614,7 @@ def release(args: list[str]) -> str: fail(f"no agent-manager HelmRelease with {args}") return block(hr, " toolApproval:") - am = "components.agent-manager.versionRange=>=3.6.0 <4.0.0-0" + am = "components.agent-manager.versionRange=>=4.6.0 <5.0.0-0" if release(["--set", am]).split() != ["toolApproval:", "enabled:", "false"]: fail(f"below muster's agent approval floor agent-manager must bind no settings (toolApproval.enabled false):\n{release(['--set', am])}") on = release(["--set", am, "--set", "components.muster.versionRange=>=5.71.0 <6.0.0-0"]) @@ -634,6 +631,7 @@ def release(args: list[str]) -> str: def check_session_bindings() -> None: base = [ "--set", "global.identity.issuerUrl=https://dex.ci.example.com", + "--set", "global.identity.clientId=platform", "--set", "components.kagent.enabled=true", "--set", "components.agent-manager.enabled=true", "--set", "kagent.harness.snapshotLocation=s3://ci-agent-snapshots/agents", @@ -742,11 +740,11 @@ def check_approval() -> None: # Test values for the floors this file's checks need, set in a copy of the -# chart while the chart keeps them unset until their releases exist. They sit -# above the floor of components.muster.versionRange, so the default render is -# below every one of them. +# chart in place of the chart's own. They sit above the floors of +# components.muster.versionRange and components.agent-manager.versionRange, +# so the default render is below every one of them. TEST_FLOORS = {"muster.governanceFloor": "5.70.0", "muster.agentApprovalFloor": "5.71.0", - "agentManager.toolApprovalFloor": "3.6.0", "muster.sessionBindingsPortFloor": "5.71.0", + "agentManager.toolApprovalFloor": "4.6.0", "muster.sessionBindingsPortFloor": "5.71.0", "muster.trustedClientsFloor": "5.74.0"} # A muster below the trusted-clients floor and above the others: one that @@ -756,14 +754,14 @@ def check_approval() -> None: def with_test_floors(meta_dir: str, dst: str) -> str: - """A copy of the meta chart with every unset floor of TEST_FLOORS set.""" + """A copy of the meta chart with every floor of TEST_FLOORS set to its test value.""" chart = os.path.join(dst, "agent-platform") shutil.copytree(meta_dir, chart) path = os.path.join(chart, "templates", "_helpers.tpl") text = open(path).read() for name, v in TEST_FLOORS.items(): - text, n = re.subn(r'(\{\{- define "agent-platform\.' + re.escape(name) + r'" -\}\})(\{\{- end -\}\})', r"\g<1>" + v + r"\g<2>", text) - if n == 0 and f'define "agent-platform.{name}" -}}}}{{{{- end' not in text and not re.search(r'define "agent-platform\.' + re.escape(name) + r'" -\}\}[0-9]', text): + text, n = re.subn(r'(\{\{- define "agent-platform\.' + re.escape(name) + r'" -\}\})[^{]*(\{\{- end -\}\})', r"\g<1>" + v + r"\g<2>", text) + if n != 1: fail(f"agent-platform.{name}: no one-line define") open(path, "w").write(text) return chart @@ -789,7 +787,7 @@ def check_floor_dependencies() -> None: governance floor is unset, whichever of them is set; governed mode and role floors fail with muster off.""" dependent = ["agentManager.toolApprovalFloor", "muster.agentApprovalFloor", "muster.sessionBindingsPortFloor", "agentManager.agentChartV3Floor", "muster.trustedClientsFloor"] - values = {**TEST_FLOORS, "agentManager.agentChartV3Floor": "3.6.0"} + values = {**TEST_FLOORS, "agentManager.agentChartV3Floor": "4.6.0"} with tempfile.TemporaryDirectory(prefix="verify-floor-deps-") as tmp: for i, name in enumerate(dependent): os.makedirs(os.path.join(tmp, str(i))) @@ -820,7 +818,7 @@ def check_floor_dependencies() -> None: def check_unset_floors_keep_everything_off() -> None: """On the chart as it is: a floor whose release does not exist gates its wiring off whatever the component ranges say.""" - high = ["--set", "components.muster.versionRange=>=5.99.0 <6.0.0-0", "--set", "components.agent-manager.versionRange=>=3.99.0 <4.0.0-0", + high = ["--set", "components.muster.versionRange=>=5.99.0 <6.0.0-0", "--set", "components.agent-manager.versionRange=>=4.99.0 <5.0.0-0", "--set", "components.agent-manager.enabled=true"] text = open(os.path.join(META_DIR, "templates", "_helpers.tpl")).read() unset = [n for n in TEST_FLOORS if re.search(r'define "agent-platform\.' + re.escape(n) + r'" -\}\}\{\{- end', text)] @@ -875,7 +873,7 @@ def check_default_agent_release_readable() -> None: the kagent namespace agent-manager manages: agent-manager gets get on it by name (muster.toolApproval.platformReleases), so a session of the default agent can read its tool approval settings for every person.""" - am = "components.agent-manager.versionRange=>=3.6.0 <4.0.0-0" + am = "components.agent-manager.versionRange=>=4.6.0 <5.0.0-0" musters = "components.muster.versionRange=>=5.71.0 <6.0.0-0" def releases(args: list[str]) -> str: @@ -911,7 +909,7 @@ def check_default_agent_on_remote_target() -> None: (muster.toolApproval.platformAgents), the Agent, the release its Flux labels name (/-default-agent) and the release's own tools/toolset/default, and no platformReleases.""" - am = "components.agent-manager.versionRange=>=3.6.0 <4.0.0-0" + am = "components.agent-manager.versionRange=>=4.6.0 <5.0.0-0" musters = "components.muster.versionRange=>=5.71.0 <6.0.0-0" target = ["--set", "gitops.target.kubeConfig.secretRef.name=wc1-kubeconfig", "--set", "gitops.target.name=wc1", "--set", "gitops.namespace=flux-giantswarm"] diff --git a/tests/verify-workspace-manager.py b/tests/verify-workspace-manager.py index f3dde383..1294fb9c 100755 --- a/tests/verify-workspace-manager.py +++ b/tests/verify-workspace-manager.py @@ -241,6 +241,9 @@ def golden(meta: str, connectivity: str) -> None: """With the switch off, the renders are byte-identical to the same chart's renders without the component: its roster entry and its blocks removed (a Helm null).""" absent = [x for key in (f"components.{NAME}", NAME, "workspaceManager", "workspaces") for x in ("--set", f"{key}=null")] + # The meta chart's governedServers.workspace-manager too: without its roster + # entry the source would read as an installation's own server key. + absent_meta = [*absent, "--set", f"governedServers.{NAME}=null"] shapes = [ (meta, ["-f", f"{meta}/ci/ci-values.yaml"]), (meta, []), @@ -250,7 +253,7 @@ def golden(meta: str, connectivity: str) -> None: ] for chart, flags in shapes: head = helm(chart, flags, ci_values=False) - ref = helm(chart, [*flags, *absent], ci_values=False) + ref = helm(chart, [*flags, *(absent_meta if chart == meta else absent)], ci_values=False) if head != ref: with tempfile.NamedTemporaryFile("w", suffix=".ref") as a, tempfile.NamedTemporaryFile("w", suffix=".head") as b: a.write(ref), b.write(head), a.flush(), b.flush() @@ -424,6 +427,12 @@ def main(meta: str, connectivity: str) -> int: if want not in apps: fail(f"switching workspaces on did not derive muster's github provider App ({want.strip()!r}) onto {key}:\n{apps}") on = on.replace(apps, "", 1) + # And muster governs the component's server (muster.governance + # .governedServers, tests/verify-tool-approval.py): one entry. + governed = re.compile(r"^ - role: workspaceManager\n(?: .*\n)*", re.M) + if len(governed.findall(on or "")) != 1 or governed.search(doc): + fail(f"switching workspaces on must add one governedServers entry for its server to {key}") + on = governed.sub("", on or "") if on != doc: fail(f"switching workspaces on changed {key} (muster.* included)") if any(kind == "MCPServer" for kind, _ in on_docs):