From c6f133ebf2b526f6d8ed0930d6e74d7523dee7e7 Mon Sep 17 00:00:00 2001 From: Agent Relay Date: Thu, 19 Nov 2026 16:37:51 +0100 Subject: [PATCH 1/3] fix: route dashboard MCP and OAuth endpoints to Control Co-Authored-By: Claude --- charts/agent-relay/Chart.lock | 6 +- charts/agent-relay/Chart.yaml | 4 +- charts/agent-relay/README.md | 21 ++++- charts/agent-relay/templates/gke-ingress.yaml | 32 +------ charts/agent-relay/templates/local-kind.yaml | 3 +- charts/relay-webapp/Chart.yaml | 2 +- charts/relay-webapp/README.md | 14 ++- charts/relay-webapp/templates/_helpers.tpl | 17 ++++ charts/relay-webapp/templates/ingress.yaml | 34 +------ charts/relay-webapp/values.yaml | 4 +- ci/agent-relay/kind/test_stack.py | 5 + ci/agent-relay/render.sh | 7 +- ci/agent-relay/subdomain-golden.sha256 | 14 +-- ci/agent-relay/test_ingress_routes.py | 91 +++++++++++++++++++ docs/azure-install/ingress.yaml | 13 ++- docs/self-hosted-requirements.md | 17 ++-- scripts/ci/charts.sh | 5 +- scripts/selfhost/eks-alb-ingress.sh | 25 +++-- .../selfhost/tests/eks-alb-ingress-test.sh | 5 + scripts/selfhost/tests/run-tests.sh | 1 + self-hosted/requirements.yaml | 29 ++++-- 21 files changed, 246 insertions(+), 103 deletions(-) create mode 100644 ci/agent-relay/test_ingress_routes.py create mode 100644 scripts/selfhost/tests/eks-alb-ingress-test.sh diff --git a/charts/agent-relay/Chart.lock b/charts/agent-relay/Chart.lock index 4496ee4a..7c7929d1 100644 --- a/charts/agent-relay/Chart.lock +++ b/charts/agent-relay/Chart.lock @@ -13,7 +13,7 @@ dependencies: version: 0.4.22 - name: relay-webapp repository: file://../relay-webapp - version: 0.2.7 + version: 0.2.8 - name: relayflows repository: file://../relayflows version: 0.2.5 @@ -35,5 +35,5 @@ dependencies: - name: relaygate repository: file://../relaygate version: 0.1.10 -digest: sha256:a4a325ec3ae15db069e46b7a81325f8398a97d2874ee7a2543c0ee803112595a -generated: "2026-11-19T01:03:48.144280701-08:00" +digest: sha256:c4afc64138c8007dfbbb281b88926fc9750c5fa9414e99f93d581acbf3421f3d +generated: "2026-11-19T16:34:58.161369+01:00" diff --git a/charts/agent-relay/Chart.yaml b/charts/agent-relay/Chart.yaml index 49f76f1f..a893b880 100644 --- a/charts/agent-relay/Chart.yaml +++ b/charts/agent-relay/Chart.yaml @@ -2,7 +2,7 @@ apiVersion: v2 name: agent-relay description: Self-hosted Agent Relay messaging and sessions suite type: application -version: 0.7.61 +version: 0.7.63 appVersion: "0.1.0" kubeVersion: ">=1.28.0-0" annotations: @@ -33,7 +33,7 @@ dependencies: repository: file://../relay-control condition: components.control - name: relay-webapp - version: 0.2.7 + version: 0.2.8 repository: file://../relay-webapp condition: components.webapp - name: relayflows diff --git a/charts/agent-relay/README.md b/charts/agent-relay/README.md index ce73d247..1ef82f9d 100644 --- a/charts/agent-relay/README.md +++ b/charts/agent-relay/README.md @@ -238,10 +238,26 @@ of the durable-actors, Relayfile and flows proof overlays. One umbrella GKE Ingress reserves a global static address (`gkeIngress.staticIpName`), uses one Google ManagedCertificate for all four hosts, and enables HTTP-to-HTTPS redirect through a FrontendConfig. +The dashboard host routes `/mcp`, `/cloud/mcp`, +`/.well-known/oauth-protected-resource`, +`/.well-known/oauth-authorization-server`, `/.well-known/openid-configuration`, +`/cloud/.well-known` and `/cloud/oauth` to Control before the `/` dashboard +catch-all. These cover MCP, OAuth discovery, JWKS and browser consent for the +pinned Control 0.5.24 image (source `edad6432`). Token, registration and +revocation already use `/cloud/api`. Only the named root discovery prefixes +are claimed; `/.well-known/acme-challenge` remains available for ACME. +The leaf and GKE Ingress share `relay-webapp.controlPaths`; app-prefixed paths +are derived from the parent of `runtime.apiBasePath` (default `/cloud`). + +The GKE dashboard rule has 11 Prefix paths in split-host mode and 12 in +single-host mode. All Control paths reuse the `api` backend and its +BackendConfig timeout (`gkeIngress.backends.api.timeoutSec`, default 3600). + For a base domain `relay.example.com`: - `relay.example.com`: `/cloud/api`, `/login` and `/relay-node` to the - control API, then `/` to the dashboard. `/relay-node/v1/*` (Desktop node + control API, plus the MCP and OAuth prefixes above, then `/` to the dashboard. + `/relay-node/v1/*` (Desktop node enrolment and the `GET /relay-node/v1/ws` node WebSocket) is served only at the root path, never under `/cloud`, and Desktop calls it on this sign-in origin. @@ -538,7 +554,8 @@ helm template agent-relay . -n agent-relay -f values-gcp.yaml -f values-single-h For `global.singleHost.host: relay.example.com`: - `relay.example.com`: `/cloud/api`, `/login`, `/relay-node` and `/api` to - the control API, then `/` to the dashboard. `/api` carries the flows worker endpoints and the + the control API, along with the MCP and OAuth prefixes listed above, then + `/` to the dashboard. `/api` carries the flows worker endpoints and the integrations OAuth callback, which relaycontrol hands out as `/api/v1/...`; it is not routed in the default mode, where the api host serves them. diff --git a/charts/agent-relay/templates/gke-ingress.yaml b/charts/agent-relay/templates/gke-ingress.yaml index 6264a14e..08b54279 100644 --- a/charts/agent-relay/templates/gke-ingress.yaml +++ b/charts/agent-relay/templates/gke-ingress.yaml @@ -582,34 +582,10 @@ spec: - host: {{ $hostRoot | quote }} http: paths: - - path: /cloud/api - pathType: Prefix - backend: - service: - name: {{ index $backendNames "api" }} - port: { number: {{ $gke.backends.api.servicePort }} } - - path: /login - pathType: Prefix - backend: - service: - name: {{ index $backendNames "api" }} - port: { number: {{ $gke.backends.api.servicePort }} } - # relay-node broker routes (POST /relay-node/v1/nodes, the - # GET /relay-node/v1/ws node socket, ...) are served only at the - # root path, never under /cloud. Desktop uses this sign-in origin as - # its control_url, so they must reach relay-control here, not the - # dashboard. The api BackendConfig timeout keeps the socket open. - - path: /relay-node - pathType: Prefix - backend: - service: - name: {{ index $backendNames "api" }} - port: { number: {{ $gke.backends.api.servicePort }} } - {{- if $singleHost }} - # Single-host mode: flows workers and the integrations OAuth - # callback call /api/v1/...; the api BackendConfig - # timeout covers the worker queue SSE stream here too. - - path: /api + # Control's MCP streams share the existing api BackendConfig timeout. + {{- $dashboardContext := dict "Values" (merge (dict "global" .Values.global) (deepCopy $dashboard)) }} + {{- range include "relay-webapp.controlPaths" $dashboardContext | fromJsonArray }} + - path: {{ . }} pathType: Prefix backend: service: diff --git a/charts/agent-relay/templates/local-kind.yaml b/charts/agent-relay/templates/local-kind.yaml index 131a21ff..c6720aa7 100644 --- a/charts/agent-relay/templates/local-kind.yaml +++ b/charts/agent-relay/templates/local-kind.yaml @@ -51,7 +51,8 @@ spec: - { protocol: UDP, port: 53 } - { protocol: TCP, port: 53 } --- -# Dashboard leaf ingress already handles /cloud/api, /login and /relay-node. +# Dashboard leaf ingress uses relay-webapp.controlPaths for /cloud/api, +# /login, /relay-node, MCP and OAuth discovery/consent paths. # Route the Desktop and integration /api entry point to the same control plane # as well. apiVersion: networking.k8s.io/v1 diff --git a/charts/relay-webapp/Chart.yaml b/charts/relay-webapp/Chart.yaml index 1e255228..53d9a160 100644 --- a/charts/relay-webapp/Chart.yaml +++ b/charts/relay-webapp/Chart.yaml @@ -2,7 +2,7 @@ apiVersion: v2 name: relay-webapp description: Static self-hosted Agent Relay sessions and messaging dashboard type: application -version: 0.2.7 +version: 0.2.8 appVersion: "0.1.0" kubeVersion: ">=1.28.0-0" annotations: diff --git a/charts/relay-webapp/README.md b/charts/relay-webapp/README.md index 093f01ea..5e9f4499 100644 --- a/charts/relay-webapp/README.md +++ b/charts/relay-webapp/README.md @@ -9,7 +9,19 @@ settings are passed with `DASHBOARD_PUBLIC_URL`, `DASHBOARD_APP_PATH`, The browser calls `runtime.apiBasePath` (default `/cloud/api`) on its current origin. When ingress is enabled, the chart routes `runtime.apiBasePath` and -`runtime.loginPath` to `api.serviceName` and `/` to the dashboard. +`runtime.loginPath` and `/relay-node` to `api.serviceName` and `/` to the dashboard. + +The dashboard host also routes `/mcp`, `/cloud/mcp`, +`/.well-known/oauth-protected-resource`, +`/.well-known/oauth-authorization-server`, `/.well-known/openid-configuration`, +`/cloud/.well-known` and `/cloud/oauth` to Control before the `/` dashboard +catch-all. These cover MCP, OAuth discovery, JWKS and browser consent for the +pinned Control 0.5.24 image (source `edad6432`). Token, registration and +revocation already use `/cloud/api`. Only the named root discovery prefixes +are claimed; `/.well-known/acme-challenge` remains available for ACME. +The leaf and GKE Ingress share `relay-webapp.controlPaths`; app-prefixed paths +are derived from the parent of `runtime.apiBasePath` (default `/cloud`). + `api.serviceName` has no default and is required with ingress: set it to the relay-control Service in the same namespace, which is that release's fullname (`-relay-control`, or its `fullnameOverride`; for example diff --git a/charts/relay-webapp/templates/_helpers.tpl b/charts/relay-webapp/templates/_helpers.tpl index d18a507a..c819dc35 100644 --- a/charts/relay-webapp/templates/_helpers.tpl +++ b/charts/relay-webapp/templates/_helpers.tpl @@ -115,3 +115,20 @@ different backends, which controllers reject or resolve unpredictably. */ -}} {{- if and .Values.networkPolicy.enabled (empty .Values.networkPolicy.ingressFrom) }}{{ fail "ingress with networkPolicy requires networkPolicy.ingressFrom" }}{{ end -}} {{- end -}} {{- end -}} + +{{- /* Dashboard-origin paths served by Control. Reused by the umbrella GKE +Ingress; keep the EKS and Azure definitions in step (test_ingress_routes.py). +The app base is the parent of runtime.apiBasePath (normally /cloud/api). +Never claim all of /.well-known: ACME uses /.well-known/acme-challenge. */ -}} +{{- define "relay-webapp.controlPaths" -}} +{{- $api := trimSuffix "/" .Values.runtime.apiBasePath -}} +{{- $base := trimSuffix "/api" $api -}} +{{- $paths := list $api .Values.runtime.loginPath "/relay-node" + "/mcp" (printf "%s/mcp" $base) + "/.well-known/oauth-protected-resource" + "/.well-known/oauth-authorization-server" + "/.well-known/openid-configuration" + (printf "%s/.well-known" $base) (printf "%s/oauth" $base) -}} +{{- if include "relay-webapp.singleHost" . }}{{ $paths = append $paths "/api" }}{{ end -}} +{{- $paths | uniq | toJson -}} +{{- end -}} diff --git a/charts/relay-webapp/templates/ingress.yaml b/charts/relay-webapp/templates/ingress.yaml index a891fc86..e5269037 100644 --- a/charts/relay-webapp/templates/ingress.yaml +++ b/charts/relay-webapp/templates/ingress.yaml @@ -25,40 +25,14 @@ spec: paths: # Must precede "/" for ingress controllers that preserve declaration # order. Longest-path matching is also required by networking.k8s.io/v1. - - path: {{ .Values.runtime.apiBasePath }} + {{- range include "relay-webapp.controlPaths" . | fromJsonArray }} + - path: {{ . }} pathType: Prefix backend: service: - name: {{ .Values.api.serviceName }} + name: {{ $.Values.api.serviceName }} port: - number: {{ .Values.api.servicePort }} - - path: {{ .Values.runtime.loginPath }} - pathType: Prefix - backend: - service: - name: {{ .Values.api.serviceName }} - port: - number: {{ .Values.api.servicePort }} - # relay-node broker routes (/relay-node/v1/*, including the - # GET /relay-node/v1/ws node WebSocket) are served only at the root - # path, never under the API alias. Desktop calls them on this origin. - - path: /relay-node - pathType: Prefix - backend: - service: - name: {{ .Values.api.serviceName }} - port: - number: {{ .Values.api.servicePort }} - {{- if include "relay-webapp.singleHost" . }} - # Single-host mode: flows workers and the integrations OAuth - # callback use /api/v1/... on this host. - - path: /api - pathType: Prefix - backend: - service: - name: {{ .Values.api.serviceName }} - port: - number: {{ .Values.api.servicePort }} + number: {{ $.Values.api.servicePort }} {{- end }} - path: / pathType: Prefix diff --git a/charts/relay-webapp/values.yaml b/charts/relay-webapp/values.yaml index 63f9381e..a2fa00b1 100644 --- a/charts/relay-webapp/values.yaml +++ b/charts/relay-webapp/values.yaml @@ -53,7 +53,9 @@ runtime: # See the README "Customer profile" section. customerProfile: {} -# A leaf Ingress can proxy /cloud/api, /login and /relay-node to this Service. +# A leaf Ingress proxies /cloud/api, /login, /relay-node, /mcp, /cloud/mcp, +# /.well-known/{oauth-protected-resource,oauth-authorization-server, +# openid-configuration}, /cloud/.well-known and /cloud/oauth to this Service. # The GKE proof uses the umbrella Ingress instead and leaves this ingress # disabled. Required when ingress.enabled=true: the relay-control Service name # in this namespace, i.e. its fullname (-relay-control unless diff --git a/ci/agent-relay/kind/test_stack.py b/ci/agent-relay/kind/test_stack.py index b3176f32..8560ff56 100644 --- a/ci/agent-relay/kind/test_stack.py +++ b/ci/agent-relay/kind/test_stack.py @@ -131,6 +131,11 @@ def test_dashboard_ingress_routes_relay_node_to_control(self): dashboard = next(d for d in docs if d["kind"] == "Ingress" and d["metadata"]["name"] == "relay-webapp") paths = {p["path"]: (p["pathType"], p["backend"]["service"]["name"]) for p in dashboard["spec"]["rules"][0]["http"]["paths"]} self.assertEqual(paths["/relay-node"], ("Prefix", "relay-control")) + for prefix in ("/mcp", "/cloud/mcp", "/.well-known/oauth-protected-resource", + "/.well-known/oauth-authorization-server", "/.well-known/openid-configuration", + "/cloud/.well-known", "/cloud/oauth"): + self.assertEqual(paths[prefix], ("Prefix", "relay-control")) + self.assertEqual(paths["/"], ("Prefix", "relay-webapp")) def test_local_scope_guard_and_configurable_api_ingress(self): self.assertIn("allowLocalOnly", self.render(extra=["--set", "localKind.allowLocalOnly=false"], ok=False)) diff --git a/ci/agent-relay/render.sh b/ci/agent-relay/render.sh index 99dd770e..ebdb5e38 100755 --- a/ci/agent-relay/render.sh +++ b/ci/agent-relay/render.sh @@ -5,6 +5,7 @@ cd "$(dirname "$0")/../.." # Helm does not recursively vendor file:// dependency children. helm dependency build charts/sessions-pipeline >/dev/null helm dependency build charts/agent-relay >/dev/null +python3 ci/agent-relay/test_ingress_routes.py out=$(helm template proof charts/agent-relay -n agent-relay --no-hooks \ -f charts/agent-relay/values-gcp-proof.yaml \ -f charts/agent-relay/ci/gcp-proof-values.yaml) @@ -44,7 +45,7 @@ test "$root_login" = relay-control root_paths=$(yq 'select(.kind == "Ingress" and .metadata.name == "agent-relay-gcp-proof") | .spec.rules[] | select(.host == "gcp-proof.agentrelay.com") | .http.paths[] | .path + " " + .pathType + " " + .backend.service.name' <<<"$out") -test "$root_paths" = "$(printf '%s\n' '/cloud/api Prefix relay-control' '/login Prefix relay-control' '/relay-node Prefix relay-control' '/ Prefix relay-webapp')" \ +test "$root_paths" = "$(printf '%s\n' '/cloud/api Prefix relay-control' '/login Prefix relay-control' '/relay-node Prefix relay-control' '/mcp Prefix relay-control' '/cloud/mcp Prefix relay-control' '/.well-known/oauth-protected-resource Prefix relay-control' '/.well-known/oauth-authorization-server Prefix relay-control' '/.well-known/openid-configuration Prefix relay-control' '/cloud/.well-known Prefix relay-control' '/cloud/oauth Prefix relay-control' '/ Prefix relay-webapp')" \ || { echo "unexpected routes on the root host: $root_paths" >&2; exit 1; } test "$(yq 'select(.kind == "BackendConfig" and .metadata.name == "agent-relay-gcp-proof-api") | .spec.timeoutSec' <<<"$out")" = 3600 \ || { echo "api BackendConfig must keep the relay-node WebSocket open (timeoutSec 3600)" >&2; exit 1; } @@ -824,7 +825,7 @@ sh_args=(-f charts/agent-relay/values-gcp-proof.yaml -f charts/agent-relay/ci/si sh_host=relay.gcp-proof.agentrelay.com sh_out=$(helm template proof charts/agent-relay -n agent-relay --no-hooks "${sh_args[@]}") sh_paths() { yq "select(.kind == \"Ingress\") | .spec.rules[] | select(.host == \"$1\") | .http.paths[] | .path + \" \" + .backend.service.name" <<<"$sh_out"; } -test "$(sh_paths "$sh_host")" = "$(printf '%s\n' '/cloud/api relay-control' '/login relay-control' '/relay-node relay-control' '/api relay-control' '/ relay-webapp')" \ +test "$(sh_paths "$sh_host")" = "$(printf '%s\n' '/cloud/api relay-control' '/login relay-control' '/relay-node relay-control' '/mcp relay-control' '/cloud/mcp relay-control' '/.well-known/oauth-protected-resource relay-control' '/.well-known/oauth-authorization-server relay-control' '/.well-known/openid-configuration relay-control' '/cloud/.well-known relay-control' '/cloud/oauth relay-control' '/api relay-control' '/ relay-webapp')" \ || sh_fail "unexpected routes on $sh_host: $(sh_paths "$sh_host")" test "$(yq 'select(.kind == "Ingress") | .spec.rules[].host' <<<"$sh_out" | sort | tr '\n' ' ')" = \ "cast.gcp-proof.agentrelay.com history.gcp-proof.agentrelay.com $sh_host " || sh_fail "unexpected Ingress hosts (an api host must not render)" @@ -869,7 +870,7 @@ expect_sh_failure "publicUrl is derived from global.singleHost.host" --set relay expect_sh_failure "runtime.publicUrl is derived from global.singleHost.host" --set relay-webapp.runtime.publicUrl=https://gcp-proof.agentrelay.com # Leaf charts on their own (non-GKE edge): the dashboard Ingress carries /api. leaf_sh=$(helm template ci charts/relay-webapp -n ci --no-hooks -f charts/relay-webapp/ci/single-host-values.yaml) -test "$(yq 'select(.kind == "Ingress") | .spec.rules[] | .host + " " + ([.http.paths[].path] | join(","))' <<<"$leaf_sh")" = "$sh_host /cloud/api,/login,/relay-node,/api,/" \ +test "$(yq 'select(.kind == "Ingress") | .spec.rules[] | .host + " " + ([.http.paths[].path] | join(","))' <<<"$leaf_sh")" = "$sh_host /cloud/api,/login,/relay-node,/mcp,/cloud/mcp,/.well-known/oauth-protected-resource,/.well-known/oauth-authorization-server,/.well-known/openid-configuration,/cloud/.well-known,/cloud/oauth,/api,/" \ || sh_fail "relay-webapp leaf Ingress in single-host mode" # The leaf Ingress outside single-host mode still sends /relay-node to Control. leaf_mh=$(helm template ci charts/relay-webapp -n ci --no-hooks -f charts/relay-webapp/ci/default-values.yaml) diff --git a/ci/agent-relay/subdomain-golden.sha256 b/ci/agent-relay/subdomain-golden.sha256 index 8a6ca4e0..88b8f171 100644 --- a/ci/agent-relay/subdomain-golden.sha256 +++ b/ci/agent-relay/subdomain-golden.sha256 @@ -1,11 +1,11 @@ # helm v4.3.1 8aa015a3683520f43abf3122999398cb511fb36d7702d4d575148d42d49a7b42 eks-rds-native.yaml -d7634c03f7104f7c601ec8778cd34e9e67db7e3a8804e52a1d126bcb373a9e00 gcp-durable-actors.yaml -d9c77f7ab7d0b596305adb7a0b78607d2f5c7e152c99c91cad766b6f25cd464a gcp-proof-flows.yaml -8cfbc78501640e685465e2991d0592c08aa235aeab0d4e6871a64a36fca6618c gcp-proof-live.yaml -0695c2b8b2f804cb0a817bd9dcba04538808283c996d9695235b006d3bc3deec gcp-proof.yaml -7f03c0491cd61dcf3210027f595b7214532489e82eced54043dbb0fe5396c137 gcp-supported-100.yaml -503424c72488a96cf3e76c338d941706be5ef338ef88c19efab395696a1bf71e gcp.yaml +144ca65adee66eade341241629904deb2333d07d6e6a73020229fb3ee29ef600 gcp-durable-actors.yaml +0fafdd5840024ad47d585d159cc9d691f257bccbafa465aec99cbb6e2f598a3e gcp-proof-flows.yaml +6f23e1d3e9eae71754aa5c8ed0a9f67372a5ce1819a969e163684baaa6c43b32 gcp-proof-live.yaml +66912be89079b82f54baf9252f143e82fab8cc38062c12052985f70471d120f6 gcp-proof.yaml +2cdf2d4c6eff2b3e0a9d6f149db5d46eabee3e633cc65bf05196ca7ef4cc49fa gcp-supported-100.yaml +b6070a475d074cdb3f9f8ff8d69be0c54cee481fae86ef07b3787f87cfaa39fb gcp.yaml 3e3f87fde30fafb454dad5c0d4d935cde221ef8e2d3210ed242e77f04da94f56 kind-durable-actors.yaml fdc618e39628ef38a9cdb1f323a7e92d167573b84872079f986c01a7dc4fc963 relay-control.yaml -18606a2d87c10f97b7e33c323283c6221daf97543e3d0d9e388db5cd913e74a4 relay-webapp.yaml +dfb644a6f10249294131293d9764e2384dd9a1f366425ee5d25d970feb111d32 relay-webapp.yaml diff --git a/ci/agent-relay/test_ingress_routes.py b/ci/agent-relay/test_ingress_routes.py new file mode 100644 index 00000000..c9e6f6fb --- /dev/null +++ b/ci/agent-relay/test_ingress_routes.py @@ -0,0 +1,91 @@ +#!/usr/bin/env python3 +"""Offline drift contract for dashboard-origin Control routing on every edge.""" +import json +import os +from pathlib import Path +import subprocess +import unittest + +ROOT = Path(__file__).resolve().parents[2] +# Control 0.5.24, edad6432: src/mcp/{routes,oauth/routes,oauth/protocol}.ts. +MCP_PATHS = ( + "/mcp", "/cloud/mcp", "/.well-known/oauth-protected-resource", + "/.well-known/oauth-authorization-server", "/.well-known/openid-configuration", + "/cloud/.well-known", "/cloud/oauth", +) +CONTROL_PATHS = ("/cloud/api", "/login", "/relay-node", *MCP_PATHS) + + +def run(*args, env=None): + return subprocess.check_output(args, cwd=ROOT, env=env, text=True) + + +def documents(raw): + # yq is already required by both chart render suites; no Python YAML dependency. + result = subprocess.run(["yq", "-o=json", "-I=0", "."], input=raw, + text=True, capture_output=True, check=True) + return [json.loads(line) for line in result.stdout.splitlines() if line != "null"] + + +def dashboard(docs, host=None): + return next(rule["http"]["paths"] for doc in docs if doc["kind"] == "Ingress" + for rule in doc["spec"]["rules"] + if (host is None or rule["host"] == host) + and any(p["backend"]["service"]["name"].endswith("relay-webapp") + for p in rule["http"]["paths"])) + + +class Routes(unittest.TestCase): + def assert_routes(self, paths, expected=CONTROL_PATHS, chief=False): + target = lambda p: p["backend"]["service"] + control = [p for p in paths if target(p)["name"].endswith("relay-control")] + want = [(p, "Exact" if chief else "Prefix") for p in expected] + if chief: + want += [(p + "/*", "ImplementationSpecific") for p in expected] + self.assertEqual([(p["path"], p["pathType"]) for p in control], want) + self.assertTrue(all(target(p)["port"] == {"number": 80} for p in control)) + self.assertEqual(paths[-1]["path"], "/*" if chief else "/") + self.assertTrue(target(paths[-1])["name"].endswith("relay-webapp")) + self.assertFalse(any(p["path"] in ("/.well-known", "/.well-known/*") for p in paths)) + + def test_leaf_split_single_and_custom_base(self): + for fixture, extra, expected in ( + ("default", (), CONTROL_PATHS), + ("single-host", (), (*CONTROL_PATHS, "/api")), + ("default", ("--set", "runtime.apiBasePath=/custom/api"), + tuple(p.replace("/cloud", "/custom") for p in CONTROL_PATHS)), + ): + with self.subTest(fixture=fixture, extra=extra): + docs = documents(run("helm", "template", "ci", "charts/relay-webapp", "-f", + f"charts/relay-webapp/ci/{fixture}-values.yaml", *extra)) + self.assert_routes(dashboard(docs), expected) + + def test_gke_split_and_single(self): + for single in (False, True): + with self.subTest(single=single): + extra = ("-f", "charts/agent-relay/values-single-host-example.yaml") if single else () + docs = documents(run("helm", "template", "ci", "charts/agent-relay", "-n", "agent-relay", + "-f", "charts/agent-relay/values-gcp-proof.yaml", + "-f", "charts/agent-relay/ci/gcp-proof-values.yaml", *extra)) + paths = dashboard(docs) + self.assert_routes(paths, (*CONTROL_PATHS, "/api") if single else CONTROL_PATHS) + self.assertEqual(len(paths), 12 if single else 11) + service = next(d for d in docs if d["kind"] == "Service" and d["metadata"]["name"] == "relay-control") + config = json.loads(service["metadata"]["annotations"]["cloud.google.com/backend-config"])["default"] + self.assertEqual(next(d for d in docs if d["kind"] == "BackendConfig" and d["metadata"]["name"] == config)["spec"]["timeoutSec"], 3600) + + def test_eks_with_chief_and_flows(self): + for chief in (False, True): + for flows in (False, True): + with self.subTest(chief=chief, flows=flows): + env = {**os.environ, "EKS_ALB_DOMAIN": "relay.example.com", "EKS_ALB_CERT_ARN": "render-only", + "EKS_ALB_CHIEF_SERVICE": "relaychief-control" if chief else "", + "EKS_ALB_RELAYFILE_CONTROL": str(flows).lower()} + self.assert_routes(dashboard(documents(run("bash", "scripts/selfhost/eks-alb-ingress.sh", env=env))), chief=chief) + + def test_azure(self): + self.assert_routes(dashboard(documents((ROOT / "docs/azure-install/ingress.yaml").read_text()), "__HOST_ROOT__")) + + +if __name__ == "__main__": + unittest.main() diff --git a/docs/azure-install/ingress.yaml b/docs/azure-install/ingress.yaml index a6bd9af2..b35f9a64 100644 --- a/docs/azure-install/ingress.yaml +++ b/docs/azure-install/ingress.yaml @@ -3,8 +3,10 @@ # with EKS_ALB_INGEST=true) and GKE Ingress. # # __HOST_ROOT__ dashboard, with /cloud/api, /login and /relay-node routed to -# the control API (/relay-node/v1/* carries Desktop node -# enrolment and the node WebSocket; it has no /cloud alias) +# the control API, plus MCP and OAuth discovery/consent +# prefixes (keep in step with relay-webapp.controlPaths). +# /relay-node/v1/* carries Desktop node +# enrolment and the node WebSocket; it has no /cloud alias # __HOST_API__ control API # __HOST_CAST__ Relaycast # __HOST_HISTORY__ native History: ingest edge for uploads, read API for reads @@ -48,6 +50,13 @@ spec: - { path: /cloud/api, pathType: Prefix, backend: { service: { name: relay-control, port: { number: 80 } } } } - { path: /login, pathType: Prefix, backend: { service: { name: relay-control, port: { number: 80 } } } } - { path: /relay-node, pathType: Prefix, backend: { service: { name: relay-control, port: { number: 80 } } } } + - { path: /mcp, pathType: Prefix, backend: { service: { name: relay-control, port: { number: 80 } } } } + - { path: /cloud/mcp, pathType: Prefix, backend: { service: { name: relay-control, port: { number: 80 } } } } + - { path: /.well-known/oauth-protected-resource, pathType: Prefix, backend: { service: { name: relay-control, port: { number: 80 } } } } + - { path: /.well-known/oauth-authorization-server, pathType: Prefix, backend: { service: { name: relay-control, port: { number: 80 } } } } + - { path: /.well-known/openid-configuration, pathType: Prefix, backend: { service: { name: relay-control, port: { number: 80 } } } } + - { path: /cloud/.well-known, pathType: Prefix, backend: { service: { name: relay-control, port: { number: 80 } } } } + - { path: /cloud/oauth, pathType: Prefix, backend: { service: { name: relay-control, port: { number: 80 } } } } - { path: /, pathType: Prefix, backend: { service: { name: relay-webapp, port: { number: 8080 } } } } - host: __HOST_API__ http: diff --git a/docs/self-hosted-requirements.md b/docs/self-hosted-requirements.md index 40073c7c..a11ffe48 100644 --- a/docs/self-hosted-requirements.md +++ b/docs/self-hosted-requirements.md @@ -168,7 +168,8 @@ Services image (sessions-pipeline-worker, alleyoop and the privileged SQL Jobs): | relayauth-0.1.2 | shipped | relayauth 0.1.2 | relayauth: `ghcr.io/agentworkforce/relayauth@sha256:c23c92d25fdf…` | | | License-annotation patch bump of 0.1.1. Superseded by 0.1.3. | | relayauth-0.1.1 | shipped | relayauth 0.1.1 | relayauth: `ghcr.io/agentworkforce/relayauth@sha256:c23c92d25fdf…` | | | relayauth 784582ef (machine-bound History assertion contract, relayauth #113). Superseded by 0.1.2. | | relayauth-0.1.0 | shipped | relayauth 0.1.0 | relayauth: `ghcr.io/agentworkforce/relayauth@sha256:eb71daa28e30…` | | | superseded by 0.1.1. | -| agent-relay-0.7.61 | unreleased | agent-relay 0.7.61
relay-control 0.4.22
relay-webapp 0.2.7
(deps: relaycast 0.3.16, relayauth 0.1.5, sessions-pipeline 0.8.50, relay-control 0.4.22, relay-webapp 0.2.7, relayflows 0.2.5, durable-actors 0.14.6-awf.4, relayfile 0.2.2, telemetry-collector 0.1.7, relay-chief 0.1.0, slack-relay 0.3.11, relaygate 0.1.10) | relaycast: `ghcr.io/agentworkforce/relaycast-self-host@sha256:ec062ef901af…`
relaycast-postgres: `ghcr.io/agentworkforce/relaycast-self-host@sha256:ec062ef901af…`
sessions-pipeline-worker: `ghcr.io/agentworkforce/sessions-pipeline@sha256:77022c5b6a1d…`
relay-control: `ghcr.io/agentworkforce/relay-control@sha256:d1b6ca95fab2…`
relay-webapp: `ghcr.io/agentworkforce/relay-webapp@sha256:bd295ccb7d13…` | | | Carries 0.7.60 and sessions-pipeline 0.8.50 (searchIndexer.stagedReconcile.enabled, issue 610 Phase 3; no image pin changes). | +| agent-relay-0.7.63 | unreleased | agent-relay 0.7.63
relay-control 0.4.22
relay-webapp 0.2.8
(deps: relaycast 0.3.16, relayauth 0.1.5, sessions-pipeline 0.8.50, relay-control 0.4.22, relay-webapp 0.2.8, relayflows 0.2.5, durable-actors 0.14.6-awf.4, relayfile 0.2.2, telemetry-collector 0.1.7, relay-chief 0.1.0, slack-relay 0.3.11, relaygate 0.1.10) | relaycast: `ghcr.io/agentworkforce/relaycast-self-host@sha256:ec062ef901af…`
relaycast-postgres: `ghcr.io/agentworkforce/relaycast-self-host@sha256:ec062ef901af…`
sessions-pipeline-worker: `ghcr.io/agentworkforce/sessions-pipeline@sha256:77022c5b6a1d…`
relay-control: `ghcr.io/agentworkforce/relay-control@sha256:d1b6ca95fab2…`
relay-webapp: `ghcr.io/agentworkforce/relay-webapp@sha256:bd295ccb7d13…` | | | Carries 0.7.61. relay-webapp 0.2.8 adds dashboard-origin MCP and OAuth discovery/consent prefixes to the leaf and shared GKE routes, with matching EKS ALB and Azure definitions. Confirmed against Control 0.5.24 source edad6432; images unchanged. GKE uses the existing api BackendConfig and has 11 dashboard paths, or 12 in single-host mode. No live install or client sign-in proof. | +| agent-relay-0.7.61 | **planned** | agent-relay 0.7.61
relay-control 0.4.22
relay-webapp 0.2.7
(deps: relaycast 0.3.16, relayauth 0.1.5, sessions-pipeline 0.8.50, relay-control 0.4.22, relay-webapp 0.2.7, relayflows 0.2.5, durable-actors 0.14.6-awf.4, relayfile 0.2.2, telemetry-collector 0.1.7, relay-chief 0.1.0, slack-relay 0.3.11, relaygate 0.1.10) | relaycast: `ghcr.io/agentworkforce/relaycast-self-host@sha256:ec062ef901af…`
relaycast-postgres: `ghcr.io/agentworkforce/relaycast-self-host@sha256:ec062ef901af…`
sessions-pipeline-worker: `ghcr.io/agentworkforce/sessions-pipeline@sha256:77022c5b6a1d…`
relay-control: `ghcr.io/agentworkforce/relay-control@sha256:d1b6ca95fab2…`
relay-webapp: `ghcr.io/agentworkforce/relay-webapp@sha256:bd295ccb7d13…` | | | Carries 0.7.60 and sessions-pipeline 0.8.50 (searchIndexer.stagedReconcile.enabled, issue 610 Phase 3; no image pin changes). | | agent-relay-0.7.60 | **planned** | agent-relay 0.7.60
relay-control 0.4.22
relay-webapp 0.2.7
(deps: relaycast 0.3.16, relayauth 0.1.5, sessions-pipeline 0.8.49, relay-control 0.4.22, relay-webapp 0.2.7, relayflows 0.2.5, durable-actors 0.14.6-awf.4, relayfile 0.2.2, telemetry-collector 0.1.7, relay-chief 0.1.0, slack-relay 0.3.11, relaygate 0.1.10) | relaycast: `ghcr.io/agentworkforce/relaycast-self-host@sha256:ec062ef901af…`
relaycast-postgres: `ghcr.io/agentworkforce/relaycast-self-host@sha256:ec062ef901af…`
sessions-pipeline-worker: `ghcr.io/agentworkforce/sessions-pipeline@sha256:77022c5b6a1d…`
relay-control: `ghcr.io/agentworkforce/relay-control@sha256:d1b6ca95fab2…`
relay-webapp: `ghcr.io/agentworkforce/relay-webapp@sha256:bd295ccb7d13…` | | | Carries 0.7.59. Internal-only GKE edge, opt-in: gkeIngress.mode=internal (default external) renders the Ingress with class gce-internal, a regional static internal address (gkeIngress.staticIpName) and HTTP closed, for a regional internal Application Load Balancer that answers only inside the VPC and the networks routed to it. No ManagedCertificate or FrontendConfig is rendered (GKE Ingress supports neither internally): the certificate is gkeIngress.tlsSecretName or gkeIngress.internal.preSharedCerts (regional certificates). gkeIngress.internal.proxyOnlySubnetCidr is required and every backend NetworkPolicy (and the durable-actors policy) must admit it; the render refuses otherwise, and also refuses sslPolicy or securityPolicy in internal mode and internal.* in external mode. values-gcp-internal.yaml is the overlay; terraform/modules/gcp/internal-edge creates the proxy-only subnet, the address and the firewall rule. Default renders differ only in the helm.sh/chart labels; images unchanged. | | agent-relay-0.7.59 | **planned** | agent-relay 0.7.59
relay-control 0.4.22
relay-webapp 0.2.7
(deps: relaycast 0.3.16, relayauth 0.1.5, sessions-pipeline 0.8.49, relay-control 0.4.22, relay-webapp 0.2.7, relayflows 0.2.5, durable-actors 0.14.6-awf.4, relayfile 0.2.2, telemetry-collector 0.1.7, relay-chief 0.1.0, slack-relay 0.3.11, relaygate 0.1.10) | relaycast: `ghcr.io/agentworkforce/relaycast-self-host@sha256:ec062ef901af…`
relaycast-postgres: `ghcr.io/agentworkforce/relaycast-self-host@sha256:ec062ef901af…`
sessions-pipeline-worker: `ghcr.io/agentworkforce/sessions-pipeline@sha256:77022c5b6a1d…`
relay-control: `ghcr.io/agentworkforce/relay-control@sha256:d1b6ca95fab2…`
relay-webapp: `ghcr.io/agentworkforce/relay-webapp@sha256:bd295ccb7d13…` | | | Carries 0.7.57 (0.7.58 is taken by another open change). GKE edge hardening, all opt-in and empty by default: gkeIngress.sslPolicy names a Compute SSL policy that the FrontendConfig applies to the HTTPS listener (without one Google's default policy still accepts TLS 1.0 and 1.1); gkeIngress.securityPolicy names a Cloud Armor backend security policy set on the BackendConfig of every backend behind the Ingress (api, cast, both history edges, the actors and relaygate edges, and new policy-only BackendConfigs -dashboard, -edge-deny and -files; the relay-webapp and relayfile Services need their backend-config annotation and the render fails with the exact value otherwise); gkeIngress.tlsSecretName serves a kubernetes.io/tls Secret instead of the ManagedCertificate, for an edge whose DNS points at a proxy or CDN. The resources come from terraform/modules/gcp/edge-security; terraform/examples/gcp now creates the TLS 1.2 SSL policy by default and exports it in chart_values. Default renders differ only in the helm.sh/chart labels (subdomain golden unchanged); images unchanged. | | agent-relay-0.7.57 | **planned** | agent-relay 0.7.57
relay-control 0.4.22
relay-webapp 0.2.7
(deps: relaycast 0.3.16, relayauth 0.1.5, sessions-pipeline 0.8.49, relay-control 0.4.22, relay-webapp 0.2.7, relayflows 0.2.5, durable-actors 0.14.6-awf.4, relayfile 0.2.2, telemetry-collector 0.1.7, relay-chief 0.1.0, slack-relay 0.3.11, relaygate 0.1.10) | relaycast: `ghcr.io/agentworkforce/relaycast-self-host@sha256:ec062ef901af…`
relaycast-postgres: `ghcr.io/agentworkforce/relaycast-self-host@sha256:ec062ef901af…`
sessions-pipeline-worker: `ghcr.io/agentworkforce/sessions-pipeline@sha256:77022c5b6a1d…`
relay-control: `ghcr.io/agentworkforce/relay-control@sha256:d1b6ca95fab2…`
relay-webapp: `ghcr.io/agentworkforce/relay-webapp@sha256:bd295ccb7d13…` | | | Carries 0.7.56. Opt-in externalSecrets (default off): renders one External Secrets Operator ExternalSecret (external-secrets.io/v1) per externalSecrets.secrets entry, targeting the Kubernetes Secret of that name, so install Secrets can come from AWS SSM Parameter Store, AWS Secrets Manager or another ESO provider without chart edits; store.create renders a namespaced SecretStore from store.provider. Default renders differ only in the helm.sh/chart labels. | @@ -3396,7 +3397,8 @@ allowAllEgress=false, the level is not off and the transport is https. global.singleHost.host (off when empty) puts the dashboard and the self-host control API on one host: / to the dashboard and /cloud/api, -/login and /api to relay-control (flows workers and the integrations +/login, /relay-node, MCP/OAuth discovery/consent and /api to relay-control +(flows workers and the integrations OAuth callback use /api/v1/...). relay-control.publicUrl and relay-webapp.runtime.publicUrl are derived as https://, and relay-webapp.ingress.host as the bare ; each must be left empty @@ -3424,9 +3426,12 @@ rather than Gateway API. **Dashboard ingress and same-origin API proxy** · shipped · chart `relay-webapp` · profiles relay-webapp -The dashboard ingress routes /cloud/api to relay-control and / to the -dashboard. The GKE proof disables this leaf ingress and supplies the same -routes through its single umbrella Ingress. +The dashboard ingress routes /cloud/api, /login, /relay-node, /mcp, +/cloud/mcp, /.well-known/oauth-protected-resource, +/.well-known/oauth-authorization-server, /.well-known/openid-configuration, +/cloud/.well-known and /cloud/oauth to relay-control and / to the dashboard. +Only the named root discovery prefixes are claimed, leaving ACME paths +available. GKE shares the leaf chart helper through its umbrella Ingress. - Default: `enabled` - Choices: `enabled`; `disabled` @@ -3435,7 +3440,7 @@ routes through its single umbrella Ingress. - Env: `DASHBOARD_PUBLIC_URL`, `DASHBOARD_APP_PATH`, `DASHBOARD_API_BASE_PATH`, `DASHBOARD_LOGIN_PATH`, `DASHBOARD_SESSION_READ_API_ENABLED` - Secret: ``. kubernetes.io/tls - Secret: ``. optional registry pull Secret -- Verify: render contains the configured dashboard runtime environment and routes /cloud/api to relay-control +- Verify: ci/agent-relay/test_ingress_routes.py checks every Control prefix, dashboard catch-all, GKE BackendConfig, EKS Chief variants and Azure parity - Sources: [`charts/relay-webapp/templates/ingress.yaml`](../charts/relay-webapp/templates/ingress.yaml), [`ci/agent-relay/render.sh`](../ci/agent-relay/render.sh) #### opt.relay-webapp.customer-profile diff --git a/scripts/ci/charts.sh b/scripts/ci/charts.sh index 9074e826..b069295f 100755 --- a/scripts/ci/charts.sh +++ b/scripts/ci/charts.sh @@ -108,6 +108,9 @@ for chart in "${charts[@]}"; do fi add_repos "charts/$chart/Chart.yaml" helm dependency build "charts/$chart" >/dev/null || { err "$chart: helm dependency build failed"; continue; } + if [ "$mode" = static ] && [ "$chart" = agent-relay ]; then + python3 ci/agent-relay/test_ingress_routes.py || err "$chart: dashboard ingress route contract failed" + fi fi values=(charts/"$chart"/ci/*-values.yaml) [ -e "${values[0]}" ] || values=("") @@ -1167,7 +1170,7 @@ for chart in "${charts[@]}"; do # and opens GET /relay-node/v1/ws there; relay-control serves the # relay-node routes only at the root path, so the root host must send # /relay-node to relay-control, not the dashboard. - [ "$(routes gcp-proof.agentrelay.com)" = "/cloud/api Prefix relay-control;/login Prefix relay-control;/relay-node Prefix relay-control;/ Prefix relay-webapp;" ] \ + [ "$(routes gcp-proof.agentrelay.com)" = "/cloud/api Prefix relay-control;/login Prefix relay-control;/relay-node Prefix relay-control;/mcp Prefix relay-control;/cloud/mcp Prefix relay-control;/.well-known/oauth-protected-resource Prefix relay-control;/.well-known/oauth-authorization-server Prefix relay-control;/.well-known/openid-configuration Prefix relay-control;/cloud/.well-known Prefix relay-control;/cloud/oauth Prefix relay-control;/ Prefix relay-webapp;" ] \ || err "$chart: gate-only root routes must send /relay-node to relay-control: $(routes gcp-proof.agentrelay.com)" [ "$(yq "select(.kind == \"Service\" and .metadata.name == \"$gate\") | .spec.selector[\"app.kubernetes.io/name\"] + \" \" + .metadata.annotations[\"cloud.google.com/backend-config\"]" <<<"$out" | sed '/^---$/d;/^$/d')" = "relaygate {\"default\": \"$gate\"}" ] || err "$chart: gate edge Service must select relaygate with its BackendConfig" [ "$(yq "select(.kind == \"BackendConfig\" and .metadata.name == \"$gate\") | .spec.healthCheck.requestPath + \" \" + (.spec.timeoutSec | tostring)" <<<"$out" | sed '/^---$/d;/^$/d')" = "/healthz 3600" ] || err "$chart: gate edge BackendConfig must check /healthz with the cast timeout" diff --git a/scripts/selfhost/eks-alb-ingress.sh b/scripts/selfhost/eks-alb-ingress.sh index 63c46720..ff51a2ed 100755 --- a/scripts/selfhost/eks-alb-ingress.sh +++ b/scripts/selfhost/eks-alb-ingress.sh @@ -191,22 +191,29 @@ EOF host "$DOMAIN" flows_routes /cloud/api/v1 +# Keep in step with relay-webapp.controlPaths and the Azure dashboard rule. +control_paths=(/cloud/api /login /relay-node + /mcp /cloud/mcp + /.well-known/oauth-protected-resource + /.well-known/oauth-authorization-server + /.well-known/openid-configuration + /cloud/.well-known /cloud/oauth) if [[ -n "$CHIEF_SVC" ]]; then - route /cloud/api "$CONTROL_SVC" 80 Exact - route /login "$CONTROL_SVC" 80 Exact - route /relay-node "$CONTROL_SVC" 80 Exact + for path in "${control_paths[@]}"; do + route "$path" "$CONTROL_SVC" 80 Exact + done for prefix in /cloud/api/v1 /api/v1; do route "\"$prefix/workspaces/*/chiefs\"" "$CHIEF_SVC" "$CHIEF_PORT" ImplementationSpecific route "\"$prefix/workspaces/*/chiefs/*\"" "$CHIEF_SVC" "$CHIEF_PORT" ImplementationSpecific done - route '"/cloud/api/*"' "$CONTROL_SVC" 80 ImplementationSpecific - route '"/login/*"' "$CONTROL_SVC" 80 ImplementationSpecific - route '"/relay-node/*"' "$CONTROL_SVC" 80 ImplementationSpecific + for path in "${control_paths[@]}"; do + route "\"$path/*\"" "$CONTROL_SVC" 80 ImplementationSpecific + done route '"/*"' "$WEBAPP_SVC" 8080 ImplementationSpecific else - route /cloud/api "$CONTROL_SVC" 80 - route /login "$CONTROL_SVC" 80 - route /relay-node "$CONTROL_SVC" 80 + for path in "${control_paths[@]}"; do + route "$path" "$CONTROL_SVC" 80 + done route / "$WEBAPP_SVC" 8080 fi diff --git a/scripts/selfhost/tests/eks-alb-ingress-test.sh b/scripts/selfhost/tests/eks-alb-ingress-test.sh new file mode 100644 index 00000000..6c4eb258 --- /dev/null +++ b/scripts/selfhost/tests/eks-alb-ingress-test.sh @@ -0,0 +1,5 @@ +#!/usr/bin/env bash +# Render only: checks every MCP/OAuth route, Chief ordering and Azure parity. +set -euo pipefail +cd "$(dirname "$0")/../../.." +python3 ci/agent-relay/test_ingress_routes.py Routes.test_eks_with_chief_and_flows Routes.test_azure diff --git a/scripts/selfhost/tests/run-tests.sh b/scripts/selfhost/tests/run-tests.sh index 203e9a7c..2f9e803c 100755 --- a/scripts/selfhost/tests/run-tests.sh +++ b/scripts/selfhost/tests/run-tests.sh @@ -12,6 +12,7 @@ RECOVERY_DIR="${REPO_ROOT}/charts/agent-relay/scripts" TEST_BASH="${TEST_BASH:-bash}" # The Node helper uses injected API responses; it never contacts a cluster. node --test "${TEST_DIR}/operator-device-login.test.mjs" +bash "${TEST_DIR}/eks-alb-ingress-test.sh" tmp_root="$(mktemp -d)" trap 'rm -rf "${tmp_root}"' EXIT diff --git a/self-hosted/requirements.yaml b/self-hosted/requirements.yaml index f38aa1d8..53e532e7 100644 --- a/self-hosted/requirements.yaml +++ b/self-hosted/requirements.yaml @@ -1984,9 +1984,22 @@ compatibility: images: relayauth: { repository: ghcr.io/agentworkforce/relayauth, digest: sha256:eb71daa28e30eb7305f666d0bccc5a4002e53e8a574e3c4c32163d907a1b71df } notes: superseded by 0.1.1. - - id: agent-relay-0.7.61 + - id: agent-relay-0.7.63 status: unreleased current: true + charts: { agent-relay: 0.7.63, relay-control: 0.4.22, relay-webapp: 0.2.8 } + app_versions: { agent-relay: 0.1.0, relay-control: 0.1.0, relay-webapp: 0.1.0 } + depends: + agent-relay: { relaycast: 0.3.16, relayauth: 0.1.5, sessions-pipeline: 0.8.50, relay-control: 0.4.22, relay-webapp: 0.2.8, relayflows: 0.2.5, durable-actors: 0.14.6-awf.4, relayfile: 0.2.2, telemetry-collector: 0.1.7, relay-chief: 0.1.0, slack-relay: 0.3.11, relaygate: 0.1.10 } + images: + relaycast: { repository: ghcr.io/agentworkforce/relaycast-self-host, digest: sha256:ec062ef901af15cf575b53a71d7eb09f2e6ab6e7c0d5be2da35339a275a5c6cc } + relaycast-postgres: { repository: ghcr.io/agentworkforce/relaycast-self-host, digest: sha256:ec062ef901af15cf575b53a71d7eb09f2e6ab6e7c0d5be2da35339a275a5c6cc } + sessions-pipeline-worker: { repository: ghcr.io/agentworkforce/sessions-pipeline, digest: sha256:77022c5b6a1d30f96f921d703eb27a1acada8ec273ad84aebdde24f8eddce305 } + relay-control: { repository: ghcr.io/agentworkforce/relay-control, digest: sha256:d1b6ca95fab240a9d41208d83de3b1f4245408b0765038762f1c419ee60f43bc } + relay-webapp: { repository: ghcr.io/agentworkforce/relay-webapp, digest: sha256:bd295ccb7d1323965dce890f19d0b7f857d706c00d7756f719c713763fdb49f3 } + notes: 'Carries 0.7.61. relay-webapp 0.2.8 adds dashboard-origin MCP and OAuth discovery/consent prefixes to the leaf and shared GKE routes, with matching EKS ALB and Azure definitions. Confirmed against Control 0.5.24 source edad6432; images unchanged. GKE uses the existing api BackendConfig and has 11 dashboard paths, or 12 in single-host mode. No live install or client sign-in proof.' + - id: agent-relay-0.7.61 + status: planned charts: { agent-relay: 0.7.61, relay-control: 0.4.22, relay-webapp: 0.2.7 } app_versions: { agent-relay: 0.1.0, relay-control: 0.1.0, relay-webapp: 0.1.0 } depends: @@ -5692,7 +5705,8 @@ entries: description: | global.singleHost.host (off when empty) puts the dashboard and the self-host control API on one host: / to the dashboard and /cloud/api, - /login and /api to relay-control (flows workers and the integrations + /login, /relay-node, MCP/OAuth discovery/consent and /api to relay-control + (flows workers and the integrations OAuth callback use /api/v1/...). relay-control.publicUrl and relay-webapp.runtime.publicUrl are derived as https://, and relay-webapp.ingress.host as the bare ; each must be left empty @@ -5734,9 +5748,12 @@ entries: kind: option title: Dashboard ingress and same-origin API proxy description: | - The dashboard ingress routes /cloud/api to relay-control and / to the - dashboard. The GKE proof disables this leaf ingress and supplies the same - routes through its single umbrella Ingress. + The dashboard ingress routes /cloud/api, /login, /relay-node, /mcp, + /cloud/mcp, /.well-known/oauth-protected-resource, + /.well-known/oauth-authorization-server, /.well-known/openid-configuration, + /cloud/.well-known and /cloud/oauth to relay-control and / to the dashboard. + Only the named root discovery prefixes are claimed, leaving ACME paths + available. GKE shares the leaf chart helper through its umbrella Ingress. chart: relay-webapp values: [runtime.publicUrl, runtime.appPath, runtime.apiBasePath, runtime.loginPath, ingress.tls, imagePullSecrets] env: [DASHBOARD_PUBLIC_URL, DASHBOARD_APP_PATH, DASHBOARD_API_BASE_PATH, DASHBOARD_LOGIN_PATH, DASHBOARD_SESSION_READ_API_ENABLED] @@ -5752,7 +5769,7 @@ entries: note: kubernetes.io/tls - name: "" note: optional registry pull Secret - verify: render contains the configured dashboard runtime environment and routes /cloud/api to relay-control + verify: ci/agent-relay/test_ingress_routes.py checks every Control prefix, dashboard catch-all, GKE BackendConfig, EKS Chief variants and Azure parity sources: - "charts/relay-webapp/templates/ingress.yaml" - "ci/agent-relay/render.sh" From e6982521c4a8168477c6786374c33ebd142f0da3 Mon Sep 17 00:00:00 2001 From: Agent Relay Date: Thu, 19 Nov 2026 16:44:28 +0100 Subject: [PATCH 2/3] fix: preserve root discovery scope and isolate ingress fixtures Co-Authored-By: Claude --- charts/agent-relay/README.md | 2 ++ charts/relay-webapp/README.md | 2 ++ charts/relay-webapp/templates/_helpers.tpl | 7 +++++-- ci/agent-relay/test_ingress_routes.py | 8 +++++++- 4 files changed, 16 insertions(+), 3 deletions(-) diff --git a/charts/agent-relay/README.md b/charts/agent-relay/README.md index 404e95e2..91f8163d 100644 --- a/charts/agent-relay/README.md +++ b/charts/agent-relay/README.md @@ -261,6 +261,8 @@ revocation already use `/cloud/api`. Only the named root discovery prefixes are claimed; `/.well-known/acme-challenge` remains available for ACME. The leaf and GKE Ingress share `relay-webapp.controlPaths`; app-prefixed paths are derived from the parent of `runtime.apiBasePath` (default `/cloud`). +With `/api` at the root, only named root discovery prefixes are routed; +the broad `/.well-known` route is omitted. The GKE dashboard rule has 11 Prefix paths in split-host mode and 12 in single-host mode. All Control paths reuse the `api` backend and its diff --git a/charts/relay-webapp/README.md b/charts/relay-webapp/README.md index 5e9f4499..520bf644 100644 --- a/charts/relay-webapp/README.md +++ b/charts/relay-webapp/README.md @@ -21,6 +21,8 @@ revocation already use `/cloud/api`. Only the named root discovery prefixes are claimed; `/.well-known/acme-challenge` remains available for ACME. The leaf and GKE Ingress share `relay-webapp.controlPaths`; app-prefixed paths are derived from the parent of `runtime.apiBasePath` (default `/cloud`). +With `/api` at the root, only named root discovery prefixes are routed; +the broad `/.well-known` route is omitted. `api.serviceName` has no default and is required with ingress: set it to the relay-control Service in the same namespace, which is that release's diff --git a/charts/relay-webapp/templates/_helpers.tpl b/charts/relay-webapp/templates/_helpers.tpl index c819dc35..ecc8ab5f 100644 --- a/charts/relay-webapp/templates/_helpers.tpl +++ b/charts/relay-webapp/templates/_helpers.tpl @@ -127,8 +127,11 @@ Never claim all of /.well-known: ACME uses /.well-known/acme-challenge. */ -}} "/mcp" (printf "%s/mcp" $base) "/.well-known/oauth-protected-resource" "/.well-known/oauth-authorization-server" - "/.well-known/openid-configuration" - (printf "%s/.well-known" $base) (printf "%s/oauth" $base) -}} + "/.well-known/openid-configuration" -}} +{{- /* An API mounted at /api has no app base: claim only named root +discovery paths, leaving ACME and unrelated /.well-known routes alone. */ -}} +{{- if $base }}{{ $paths = append $paths (printf "%s/.well-known" $base) }}{{ end -}} +{{- $paths = append $paths (printf "%s/oauth" $base) -}} {{- if include "relay-webapp.singleHost" . }}{{ $paths = append $paths "/api" }}{{ end -}} {{- $paths | uniq | toJson -}} {{- end -}} diff --git a/ci/agent-relay/test_ingress_routes.py b/ci/agent-relay/test_ingress_routes.py index c9e6f6fb..07b0caab 100644 --- a/ci/agent-relay/test_ingress_routes.py +++ b/ci/agent-relay/test_ingress_routes.py @@ -54,6 +54,9 @@ def test_leaf_split_single_and_custom_base(self): ("single-host", (), (*CONTROL_PATHS, "/api")), ("default", ("--set", "runtime.apiBasePath=/custom/api"), tuple(p.replace("/cloud", "/custom") for p in CONTROL_PATHS)), + ("default", ("--set", "runtime.apiBasePath=/api"), + tuple(dict.fromkeys(p.replace("/cloud", "") for p in CONTROL_PATHS + if p != "/cloud/.well-known"))), ): with self.subTest(fixture=fixture, extra=extra): docs = documents(run("helm", "template", "ci", "charts/relay-webapp", "-f", @@ -78,7 +81,10 @@ def test_eks_with_chief_and_flows(self): for chief in (False, True): for flows in (False, True): with self.subTest(chief=chief, flows=flows): - env = {**os.environ, "EKS_ALB_DOMAIN": "relay.example.com", "EKS_ALB_CERT_ARN": "render-only", + # Fixtures must not inherit an operator's install settings. + clean_env = {k: v for k, v in os.environ.items() + if not k.startswith("EKS_ALB_") and k != "EKS_INGRESS_CLASS"} + env = {**clean_env, "EKS_ALB_DOMAIN": "relay.example.com", "EKS_ALB_CERT_ARN": "render-only", "EKS_ALB_CHIEF_SERVICE": "relaychief-control" if chief else "", "EKS_ALB_RELAYFILE_CONTROL": str(flows).lower()} self.assert_routes(dashboard(documents(run("bash", "scripts/selfhost/eks-alb-ingress.sh", env=env))), chief=chief) From b5bae7ab507a5a22111d9b15c842f90081d00fec Mon Sep 17 00:00:00 2001 From: Agent Relay Date: Fri, 20 Nov 2026 23:17:41 +0100 Subject: [PATCH 3/3] fix: retain EKS control paths defaults for saved values Co-Authored-By: Claude --- charts/agent-relay/templates/_helpers.tpl | 11 +++++++++ .../templates/eks-alb-ingress.yaml | 7 ++++-- ci/agent-relay/test_eks_alb_ingress.py | 23 +++++++++++++++++++ 3 files changed, 39 insertions(+), 2 deletions(-) diff --git a/charts/agent-relay/templates/_helpers.tpl b/charts/agent-relay/templates/_helpers.tpl index 4890f89b..b720e877 100644 --- a/charts/agent-relay/templates/_helpers.tpl +++ b/charts/agent-relay/templates/_helpers.tpl @@ -287,3 +287,14 @@ hyphens, so no empty label ("a..b") and no label starting or ending with "-". */ {{- end -}} {{- if $ok }}true{{ end -}} {{- end }} + +{{- /* Compatibility default for upgrades whose saved values predate eksIngress. +Keep in step with values.yaml; the script/chart equivalence tests exercise both +normal defaults and the missing/null-key fallback, with Chief off and on. */ -}} +{{- define "agent-relay.eksDefaultControlPaths" -}} +{{- list "/cloud/api" "/login" "/relay-node" "/mcp" "/cloud/mcp" + "/.well-known/oauth-protected-resource" + "/.well-known/oauth-authorization-server" + "/.well-known/openid-configuration" + "/cloud/.well-known" "/cloud/oauth" | toJson -}} +{{- end -}} diff --git a/charts/agent-relay/templates/eks-alb-ingress.yaml b/charts/agent-relay/templates/eks-alb-ingress.yaml index fa85f160..642c1f12 100644 --- a/charts/agent-relay/templates/eks-alb-ingress.yaml +++ b/charts/agent-relay/templates/eks-alb-ingress.yaml @@ -82,8 +82,11 @@ published and not read-only. */ -}} {{- /* Dashboard-host paths sent to the control API. The default is the list the script emits; a path here is a Prefix route (Exact plus "/*" with Chief on), so it may not be "/", end in "/", or hold "*" or "//". */ -}} -{{- /* The default list lives in values.yaml; keep no second copy here. */ -}} -{{- $controlPaths := $e.controlPaths -}} +{{- /* Old saved values may lack this key. Use the compatibility helper for +an absent or null key, but preserve an explicitly empty list. */ -}} +{{- $defaultControlPaths := include "agent-relay.eksDefaultControlPaths" . | fromJsonArray -}} +{{- $controlPaths := dig "controlPaths" $defaultControlPaths $e -}} +{{- if kindIs "invalid" $controlPaths }}{{ $controlPaths = $defaultControlPaths }}{{ end -}} {{- if not (kindIs "slice" $controlPaths) }}{{ fail "eksIngress.controlPaths must be a list of paths" }}{{ end -}} {{- range $p := $controlPaths }} {{- if not (and (kindIs "string" $p) (regexMatch "^(/[-A-Za-z0-9._~%!$&'()+,;=:@]+)+$" $p)) }}{{ fail (printf "eksIngress.controlPaths entry %v must be an absolute path such as /cloud/api: not \"/\", no trailing \"/\", \"//\", \"*\" or spaces" $p) }}{{ end -}} diff --git a/ci/agent-relay/test_eks_alb_ingress.py b/ci/agent-relay/test_eks_alb_ingress.py index e749016b..0e167736 100644 --- a/ci/agent-relay/test_eks_alb_ingress.py +++ b/ci/agent-relay/test_eks_alb_ingress.py @@ -210,6 +210,29 @@ def test_control_paths_default_is_the_script_list(self): with self.subTest(env=env): self.assert_same(env, {'controlPaths': DEFAULT_CONTROL_PATHS}) + def test_control_paths_missing_or_null_use_defaults(self): + for env in ({}, {'EKS_ALB_CHIEF_SERVICE': 'relaychief-control'}): + with self.subTest(env=env): + self.assert_same(env) + # Helm removes the null key during coalescing, just as older + # saved defaults lack it when upgrading with --reuse-values. + self.assert_same(env, {'controlPaths': None}) + result = helm(chart_values(env), extra=['--set', 'eksIngress.controlPaths=null']) + self.assertEqual(result.returncode, 0, result.stderr) + self.assertEqual(comparable(ingress(result.stdout)), comparable(ingress(script(env).stdout))) + + def test_control_paths_can_be_empty(self): + for env in ({}, {'EKS_ALB_CHIEF_SERVICE': 'relaychief-control'}): + with self.subTest(env=env): + want = ingress(script(env).stdout) + result = helm({**chart_values(env), 'controlPaths': []}) + self.assertEqual(result.returncode, 0, result.stderr) + removed = {path for p in DEFAULT_CONTROL_PATHS for path in (p, p + '/*')} + for rule in want['spec']['rules']: + if rule['host'] == 'relay.example.com': + rule['http']['paths'] = [p for p in rule['http']['paths'] if p['path'] not in removed] + self.assertEqual(comparable(ingress(result.stdout)), comparable(want)) + def test_control_paths_drop_only_the_relay_node_rules(self): for env in ({}, {'EKS_ALB_CHIEF_SERVICE': 'relaychief-control'}, {'EKS_ALB_RELAYFILE_CONTROL': 'true'}): with self.subTest(env=env):