Files
cp1-agents/docs/platform-issues/mcp-gateway-default-tenant/mcp-gateway-link-default-tenant.job.yaml
Jonathan Boniface 416c66ced4
All checks were successful
check agents / check (push) Successful in 10s
Add CP1 Discovery agents in both patterns
ALZ-F01 Discovery as a sub-agent orchestrator (sub-agents/) and as eight
individual declarative agents (individual-agents/), with their KAB workflow
exports. Shared check, render and import scripts, the alz-discovery-sample
MCP server, the crucible-kab-dev deploy profile, deployment docs, platform
issue reports and the source material. Agent steps time out at 20 minutes.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-29 18:25:57 +00:00

67 lines
2.8 KiB
YAML

# Link KAB's default tenant to the MCP Gateway's "default" tenant (kab-dev, namespace core-components).
#
# KAB creates its default tenant at startup without the provisioning workflow, so the workflow's
# provision_mcp_gateway_tenant step never ran for it. Without that link, every MCP server registration from the
# default tenant fails row-level security (HTTP 500). This Job makes the same idempotent call the step makes,
# with the same credential:
#
# POST /api/v1/admin/tenants X-Internal-Service-Token: <internal-service-secret/token>
# {"id": "default", "name": "Default Organization", "external_id": <kab-tenant-id/tenant-id>, "status": "active"}
#
# The gateway tenant id stays "default" (its RLS policies use it); KAB's id becomes its external_id, which is what
# the gateway resolves proxied requests by. It is the AKS equivalent of the dev kit's link-mcp-tenants.sh.
#
# Apply secrets.yaml first. Safe to run again: the endpoint is an upsert. The Job deletes itself an hour after it
# finishes. Neither key is printed: the token is sent as a header, and only the response body is logged.
apiVersion: batch/v1
kind: Job
metadata:
name: mcp-gateway-link-default-tenant
namespace: core-components
labels:
app.kubernetes.io/part-of: kab
app.kubernetes.io/component: mcp-gateway-tenant-link
spec:
backoffLimit: 3
ttlSecondsAfterFinished: 3600
template:
metadata:
labels:
app.kubernetes.io/component: mcp-gateway-tenant-link
spec:
restartPolicy: Never
containers:
- name: link
image: docker.io/curlimages/curl:8.11.1
env:
- name: INTERNAL_SERVICE_TOKEN
valueFrom:
secretKeyRef:
name: internal-service-secret
key: token
- name: KAB_TENANT_ID
valueFrom:
secretKeyRef:
name: kab-tenant-id
key: tenant-id
- name: GATEWAY_URL
value: http://kyn-agent-builder-mcp-gateway.core-components.svc.cluster.local:8000
command:
- sh
- -c
- |
set -eu
body=$(printf '{"id":"default","name":"Default Organization","external_id":"%s","status":"active"}' "$KAB_TENANT_ID")
code=$(curl -sS -o /tmp/response -w '%{http_code}' -X POST "$GATEWAY_URL/api/v1/admin/tenants" \
-H "X-Internal-Service-Token: $INTERNAL_SERVICE_TOKEN" -H "Content-Type: application/json" -d "$body")
echo "upsert: HTTP $code"; cat /tmp/response; echo
[ "$code" -lt 300 ] || exit 1
curl -sS "$GATEWAY_URL/api/v1/admin/tenants" -H "X-Internal-Service-Token: $INTERNAL_SERVICE_TOKEN"; echo
resources:
requests:
cpu: 10m
memory: 32Mi
limits:
cpu: 100m
memory: 64Mi