From b1af345e26308b7f32ec84601f951823eb4eec3a Mon Sep 17 00:00:00 2001 From: Jose Armesto Date: Thu, 12 Nov 2026 13:36:52 +0100 Subject: [PATCH 1/2] fix(skill-manager): take the OAuth client from muster's login, like the other managers agent-platform.identity.apply now fills skill-manager's oauth.dex.clientID, oauth.trustedAudiences, oauth.dex.issuerURL and oauth.existingSecret from muster.muster.oauth.server when its block and global.identity leave them unset. Without it, an installation that names muster's login and leaves global.identity.clientId unset (enigma) fails the skill-manager install: oauth.dex.clientID (or global.identity.clientId) is required when oauth.enabled. verify-manager-identity.py checks skill-manager with the other managers and pins that every roster component forwarding an oauth block is in the helper's list. --- Makefile.custom.mk | 2 +- helm/agent-platform/templates/_helpers.tpl | 12 ++--- tests/verify-manager-identity.py | 51 +++++++++++++++++++--- 3 files changed, 52 insertions(+), 13 deletions(-) diff --git a/Makefile.custom.mk b/Makefile.custom.mk index 787e27c39..255b86d5a 100644 --- a/Makefile.custom.mk +++ b/Makefile.custom.mk @@ -2268,7 +2268,7 @@ verify-worker-image: ## Assert the Substrate worker image follows the chart's ow @echo "ok: $@" .PHONY: verify-managers -verify-managers: ## Assert the model-manager / agent-manager wiring (routes, JWT policies, network policies in both flavors) and its guards, the four managers' OAuth inputs derived from muster's login (giantswarm/agent-platform#484), and the metrics port of model-manager, agent-manager and cluster-manager (observability.metrics.port, only while observability.metrics.enabled) admitted from the cluster entity, never the API port, in both flavors, with their ServiceMonitors on in the meta render and carrying the tenant label (giantswarm/giantswarm#36711). +verify-managers: ## Assert the model-manager / agent-manager wiring (routes, JWT policies, network policies in both flavors) and its guards, the managers' OAuth inputs (skill-manager's included) derived from muster's login (giantswarm/agent-platform#484), and the metrics port of model-manager, agent-manager and cluster-manager (observability.metrics.port, only while observability.metrics.enabled) admitted from the cluster entity, never the API port, in both flavors, with their ServiceMonitors on in the meta render and carrying the tenant label (giantswarm/giantswarm#36711). @echo "====> $@ ($(CONNECTIVITY_DIR))" @echo "--> both components off render nothing of theirs (agent-manager is off by default; model-manager is on since giantswarm/agent-platform#329)" @$(HELM) template t $(CONNECTIVITY_DIR) $(VM) --set components.kagent.enabled=true --set components.model-manager.enabled=false >$(VERIFY_TMP)/vmg-off.out 2>&1 || { cat $(VERIFY_TMP)/vmg-off.out; exit 1; } diff --git a/helm/agent-platform/templates/_helpers.tpl b/helm/agent-platform/templates/_helpers.tpl index 4ffa5a901..2c0450925 100644 --- a/helm/agent-platform/templates/_helpers.tpl +++ b/helm/agent-platform/templates/_helpers.tpl @@ -4293,10 +4293,12 @@ Usage: include "agent-platform.scheduling.apply" (dict "values" $shaped) {{/* The platform's one login in the managers' OAuth blocks -(giantswarm/agent-platform#484). model-manager, agent-manager, vm-manager and -cluster-manager are OAuth resource servers of the login muster's OAuth server -names. Each chart resolves its issuer, client, Secret and trusted audiences -from its own oauth block, else global.identity; what both leave unset is filled +(giantswarm/agent-platform#484). model-manager, agent-manager, vm-manager, +cluster-manager, workspace-manager and skill-manager are OAuth resource servers +of the login muster's OAuth server names (skill-manager's block does not reach +the connectivity release: its own chart opens its identity-provider egress). +Each chart resolves its issuer, client, Secret and trusted audiences from its +own oauth block, else global.identity; what both leave unset is filled here from muster.muster.oauth.server — oauth.dex.issuerURL from dex.issuerUrl, oauth.dex.clientID from dex.clientId (and oauth.trustedAudiences [that client], the charts' own default from global.identity.clientId), oauth.existingSecret @@ -4330,7 +4332,7 @@ Usage: include "agent-platform.identity.apply" (dict "values" $shaped) {{- if and (dig "enabled" true $server) (eq (toString (dig "provider" "dex" $server)) "dex") -}} {{- $login = dict "issuerURL" (dig "dex" "issuerUrl" "" $server) "clientID" (dig "dex" "clientId" "" $server) "existingSecret" (dig "existingSecret" "" $server) -}} {{- end -}} -{{- range $name, $wiring := dict "model-manager" "modelManager" "agent-manager" "agentManager" "vm-manager" "" "cluster-manager" "" "workspace-manager" "" -}} +{{- range $name, $wiring := dict "model-manager" "modelManager" "agent-manager" "agentManager" "vm-manager" "" "cluster-manager" "" "workspace-manager" "" "skill-manager" "" -}} {{- $block := index $v $name -}} {{- if and (kindIs "map" $block) (kindIs "map" (index $block "oauth")) (dig "oauth" "enabled" false $block) -}} {{- $oauth := index $block "oauth" -}} diff --git a/tests/verify-manager-identity.py b/tests/verify-manager-identity.py index a568a0b48..636798ac1 100755 --- a/tests/verify-manager-identity.py +++ b/tests/verify-manager-identity.py @@ -4,23 +4,27 @@ The meta chart fills what a manager's oauth block and global.identity leave unset from muster.muster.oauth.server (agent-platform.identity.apply): oauth.dex.issuerURL, oauth.dex.clientID with oauth.trustedAudiences, and -oauth.existingSecret for model-manager, agent-manager, vm-manager and -cluster-manager; oauth.baseURL for the two routed managers. The connectivity release receives the same filled -blocks, so each case renders the meta chart, then the connectivity chart with -the values its HelmRelease carries — where the absence guard and the -one-login guard fire. +oauth.existingSecret for model-manager, agent-manager, vm-manager, +cluster-manager and skill-manager; oauth.baseURL for the two routed managers. +The connectivity release receives the same filled blocks (not skill-manager's, +which only its own release reads), so each case renders the meta chart, then +the connectivity chart with the values its HelmRelease carries — where the +absence guard and the one-login guard fire. Usage: verify-manager-identity.py [helm flags...] The helm flags (the Makefile's VM: API versions, required inputs) go to both renders. """ +import re import subprocess import sys import tempfile import yaml -MANAGERS = ("model-manager", "agent-manager", "vm-manager", "cluster-manager") +MANAGERS = ("model-manager", "agent-manager", "vm-manager", "cluster-manager", "skill-manager") +# Blocks the connectivity release does not receive (components.agent-platform-connectivity.omitKeys). +NOT_IN_CONNECTIVITY = ("skill-manager",) ROUTED = {"model-manager": "/model-manager", "agent-manager": "/agent-manager"} ISSUER = "https://dex.ci.example.com" CLIENT = "muster-acme" @@ -86,9 +90,41 @@ def expect(what: str, got, want) -> None: sys.exit(f"FAIL: {what}: got {got!r}, want {want!r}") +def roster_covered(meta: str) -> None: + """Every roster component whose forwarded block has an oauth block is in the helper's list. + + A manager that is an OAuth resource server and is not in the list gets no client + from muster's login, and its chart refuses to render where global.identity.clientId + is unset (skill-manager on enigma). A component that derives its login itself + (toolchain-manager.auth, agent-platform.toolchainManager.derived) has no oauth block. + """ + with open(f"{meta}/values.yaml") as f: + values = yaml.safe_load(f) + with open(f"{meta}/templates/_helpers.tpl") as f: + helpers = f.read() + line = re.search(r"\{\{- range \$name, \$wiring := dict (.*?) -\}\}", helpers) + if not line: + sys.exit("FAIL: roster: the agent-platform.identity.apply list is not found in _helpers.tpl") + listed = set(re.findall(r'"([^"]*)"', line.group(1))[0::2]) + with_oauth = { + key for key, c in values["components"].items() + if isinstance(values.get(c.get("valuesFrom") or ""), dict) + and isinstance(values[c["valuesFrom"]].get("oauth"), dict) + } + missing = sorted(with_oauth - listed) + if missing: + sys.exit(f"FAIL: roster: {missing} forward an oauth block but are not in agent-platform.identity.apply's list") + if not set(MANAGERS) <= with_oauth: + sys.exit(f"FAIL: roster: {sorted(set(MANAGERS) - with_oauth)} have no oauth block in values.yaml") + + def main() -> None: meta, conn, base = sys.argv[1], sys.argv[2], sys.argv[3:] + print("--> roster: every component that forwards an oauth block takes muster's login") + roster_covered(meta) + print("ok: roster") + print("--> derived: muster's login fills every manager; the routed ones get the route's base URL") rels = releases(meta, [*base, *ALL_ON, *LOGIN]) for name in MANAGERS: @@ -102,7 +138,8 @@ def main() -> None: expect(f"{name} oauth.baseURL", o.get("baseURL"), want) cvals = rels["agent-platform-connectivity"] for name in MANAGERS: - expect(f"the connectivity release's {name}.oauth", cvals.get(name, {}).get("oauth"), oauth(rels, name)) + if name not in NOT_IN_CONNECTIVITY: + expect(f"the connectivity release's {name}.oauth", cvals.get(name, {}).get("oauth"), oauth(rels, name)) result = connectivity(conn, cvals, base) if result.returncode != 0: sys.exit(f"FAIL: derived: the connectivity render failed\n{result.stderr}") From 19ffffce9c542dcd7a8882d31e8d0437934bf0f5 Mon Sep 17 00:00:00 2001 From: Jose Armesto Date: Thu, 12 Nov 2026 13:41:52 +0100 Subject: [PATCH 2/2] test(skill-manager): pin enigma's identity shape and parse the helper's list as pairs Adds the case with global.identity issuer and Secret but no client, reads the roster by valuesFrom key, refuses a helper list that is not quoted pairs, and documents that the skill-manager's login falls back to muster's. --- docs/reference.md | 1 + helm/agent-platform/values.yaml | 3 ++- tests/verify-manager-identity.py | 21 +++++++++++++++++++-- 3 files changed, 22 insertions(+), 3 deletions(-) diff --git a/docs/reference.md b/docs/reference.md index 107af87b5..0ceb513e4 100644 --- a/docs/reference.md +++ b/docs/reference.md @@ -308,6 +308,7 @@ The default agent is `default-agent` in the kagent namespace, shown as `defaultA - `components.skill-manager` follows `components.agent-manager`. `enabled: false` leaves it out. `dependsOn: [muster]`. Nothing waits for it: agent-manager and the default agent install while it fails. - Its `sources` are derived: the platform source, then `skillManager.sources`. An own `skill-manager.sources` fails the render. +- It is an OAuth resource server like the managers: the issuer, client, secret and CA come from `skill-manager.oauth`, else from `global.identity`. Anything still unset is filled from muster's OAuth server block (`muster.muster.oauth.server.dex.*`, `.existingSecret`). - GitHub access goes in `skill-manager.github` (`app.secretName` or `tokenSecret.name`). Empty reads public repositories anonymously. - agent-manager gets `skillManager.url`, the skill-manager's Service, from `agent-platform.agentManager.skillManagerFloor` on, `installation` (`backstage.installationName`), which `get_info` reports for the default agent's start links, and `defaultAgentModel.agent: default-agent` while the default agent is on. Below it, or with the skill-manager off, agent-manager gets `skills.repositories` as URLs, without the platform source. `agent-manager.skills.repositories` set while agent-manager uses the skill-manager fails the render. - Its NetworkPolicy admits its callers' namespaces (`networkPolicy.ingressNamespaces`, derived: muster's, the portal's, agent-manager's, the kagent namespace). The connectivity chart registers it as muster's MCP backend and opens agent-manager's and its migrate run's egress to it. diff --git a/helm/agent-platform/values.yaml b/helm/agent-platform/values.yaml index 3dbdb01dd..277dc59cd 100644 --- a/helm/agent-platform/values.yaml +++ b/helm/agent-platform/values.yaml @@ -5421,7 +5421,8 @@ skillManager: # muster forwards (its MCPServer CR, labelled for the agent-platform tool # group) and the one agent-manager forwards on its REST calls, acting as the # person; the issuer, client, secret and CA fall back to global.identity -# inside the chart. GitHub is read with the App (github.app.secretName) or +# inside the chart, and what both leave unset is filled from muster's login +# (muster.muster.oauth.server, agent-platform.identity.apply). GitHub is read with the App (github.app.secretName) or # token Secret (github.tokenSecret.name) set here; empty: anonymous, public # repositories only. The connectivity chart registers it as muster's MCP # backend (networkPolicy.mcpBackends.skill-manager, derived) and opens diff --git a/tests/verify-manager-identity.py b/tests/verify-manager-identity.py index 636798ac1..4d5a46e56 100755 --- a/tests/verify-manager-identity.py +++ b/tests/verify-manager-identity.py @@ -105,9 +105,13 @@ def roster_covered(meta: str) -> None: line = re.search(r"\{\{- range \$name, \$wiring := dict (.*?) -\}\}", helpers) if not line: sys.exit("FAIL: roster: the agent-platform.identity.apply list is not found in _helpers.tpl") - listed = set(re.findall(r'"([^"]*)"', line.group(1))[0::2]) + pairs = line.group(1) + if re.sub(r'"[^"]+"\s+"[^"]*"', "", pairs).strip(): + sys.exit(f"FAIL: roster: the agent-platform.identity.apply list is not pairs of quoted strings: {pairs}") + listed = set(re.findall(r'"([^"]+)"\s+"[^"]*"', pairs)) + # The helper reads the top-level block (index $v $name): the component's valuesFrom key. with_oauth = { - key for key, c in values["components"].items() + c["valuesFrom"] for c in values["components"].values() if isinstance(values.get(c.get("valuesFrom") or ""), dict) and isinstance(values[c["valuesFrom"]].get("oauth"), dict) } @@ -188,6 +192,19 @@ def main() -> None: expect(f"{name} oauth.trustedAudiences with global.identity set", o.get("trustedAudiences"), None) print("ok: global.identity wins") + print("--> global.identity without a client (enigma's shape): each key is filled on its own, the client from muster's login") + rels = releases(meta, [*base, *ALL_ON, *LOGIN, *sets( + f"global.identity.issuerUrl={ISSUER}", + f"global.identity.existingSecret={SECRET}", + )]) + for name in MANAGERS: + o = oauth(rels, name) + expect(f"{name} oauth.dex.clientID without global.identity.clientId", o.get("dex", {}).get("clientID"), CLIENT) + expect(f"{name} oauth.trustedAudiences without global.identity.clientId", o.get("trustedAudiences"), [CLIENT]) + expect(f"{name} oauth.dex.issuerURL with global.identity.issuerUrl set", o.get("dex", {}).get("issuerURL"), None) + expect(f"{name} oauth.existingSecret with global.identity.existingSecret set", o.get("existingSecret"), None) + print("ok: global.identity without a client") + print("--> one login: a global.identity.clientId that differs from muster's fails the connectivity render") rels = releases(meta, [*base, *ALL_ON, *LOGIN, *sets(f"global.identity.issuerUrl={ISSUER}", "global.identity.clientId=platform")]) result = connectivity(conn, rels["agent-platform-connectivity"], base)