Skip to content

Exposure

How people and Slack reach an install, through the Gateway or the Ingress controller the cluster already runs. The umbrella chart (charts/agent-factory) renders the routes and the web front door. Your gateway or Ingress terminates TLS: the chart never issues a certificate.

What must be public

SurfaceCallersMust be publicPath
webpeople’s browsers, maku, the maku mcp serverno: a private gateway (a VPN, a tailnet) is enougheverything on its hosts: the rooms UI, /api, /v1/ws, /mcp, /.well-known/maku, /link/*
slackSlack’s serversyesPOST /slack/events only
the factoryno one outside the clusterno: never exposedthe factory polls GitHub, so GitHub needs no webhook path. Its run API (:8082) is the broker’s, its intake (:8080) is in-cluster

GitHub’s account-link callback (/link/github/callback) is a browser redirect, not a call from GitHub, so it rides the web host, which may stay private.

    flowchart LR
  B[browser, maku] -->|https| G[your Gateway or Ingress]
  S[Slack] -->|https POST /slack/events| G2[your public Gateway or Ingress]
  G -->|http, identity headers removed| P[rooms-web-proxy<br/>oauth2-proxy]
  P -->|http, identity headers set| R[room-broker :8080]
  G2 -->|http| A[factory-slack-app :8080]
  

Each hop inside the cluster is plain HTTP, inside the default-deny policies.

No route ever targets room-broker itself, on any port: :8080 would skip the front door, and :8443 and the ops port :9090 (/metrics, /preflight) are in-cluster only. With maku.preflight.enabled and maku-factory.preflight.enabled, the preflight’s exposure check reads the HTTPRoutes, GRPCRoutes, TLSRoutes (at each version the cluster serves) and Ingresses, and fails, broker_exposed_around_proxy, on any that does. It also catches a request mirror or a backendRef naming the broker’s namespace.

Its scope is the factory’s own namespace: the factory’s Role is namespaced, so it reads no other. It finds the broker from broker.url. When the broker runs in another namespace, or outside the cluster, the check reports undecided, never a pass, and the routes that could reach the broker are yours to check:

kubectl get httproutes,grpcroutes,tlsroutes,ingresses -A -o json |
  jq -r '.items[] | select(tostring | test("\"room-broker\"")) | .kind + " " + .metadata.namespace + "/" + .metadata.name'

The values

expose:
  mode: httproute            # none (the default) | httproute | ingress
  httproute:
    parentRefs: [{name: private, namespace: infra, sectionName: https}]
    timeouts: {}             # the web route's, rendered only when set
  ingress:
    className: ""
    annotations: {}          # every surface's, e.g. cert-manager.io/cluster-issuer
  web:
    hostnames: [rooms.example.com]
  slack:                     # rendered only with slack.enabled
    hostnames: [factory-slack.example.com]
    parentRefs: [{name: public, namespace: infra, sectionName: factory-slack}]
  networkPolicy:
    from: []                 # mode kubernetes: your gateway's or ingress controller's pods
    cilium: {fromEntities: [ingress]}
webProxy:
  enabled: true
  existingSecret: rooms-proxy
maku:
  broker:
    webProxy: true

Each surface takes its own hostnames, and its own parentRefs (httproute) or className, annotations and tls (ingress). A surface’s own value replaces the shared one; annotations are merged, the surface’s winning. So the Slack events path can be public while the web stays on a private gateway. expose.web.enabled and expose.slack.enabled (both true) leave a surface out, for a team that routes it itself.

What fails the render

ConditionWhy
an exposed surface with no hostnamesa route for no host matches nothing, or everything
httproute with no parentRefs on the surface or under expose.httproutethe route would attach to no Gateway
ingress with no className on the surface or under expose.ingressthe chart does not guess the default class
expose.web with maku.broker.human.mode: locallocal mode serves one loopback user behind a port-forward
expose.web without webProxy.enabledin oidc mode the broker reads the identity headers oauth2-proxy sets, so a client must never reach it directly
expose.web or webProxy with maku.networkPolicies.mode: nonenothing would keep a client from the broker’s :8080 around the front door
an exposed surface in mode kubernetes with an empty expose.networkPolicy.fromdefault-deny would drop every request; name the gateway’s pods
an exposed surface in mode cilium with an empty fromEntitiesthe same

The routes

httprouteingress
webrooms-web: PathPrefix / to rooms-web-proxy:80, removing the thirteen headers below; timeouts when setrooms-web: Prefix / to rooms-web-proxy:80
slackfactory-slack-events: Exact /slack/events with method: POST to factory-slack-app:8080. Every other path and method is the gateway’s 404factory-slack-events: pathType: Exact /slack/events. Ingress has no method match: the Slack App answers anything but POST with 405

The web route removes these request headers by exact name, because Gateway API’s remove takes no wildcards:

  • the identity headers oauth2-proxy sets: X-Forwarded-Access-Token, X-Forwarded-User, X-Forwarded-Email, X-Forwarded-Groups, X-Forwarded-Preferred-Username, X-Auth-Request-User, X-Auth-Request-Email, X-Auth-Request-Preferred-Username, X-Auth-Request-Groups and X-Auth-Request-Access-Token;
  • the forwarded headers a proxy that trusted its client would read: X-Forwarded-Uri, X-Forwarded-Host and X-Forwarded-Proto. The front door runs with reverse-proxy=false, so it reads none of them: a forged X-Forwarded-Uri naming a skip-auth path still meets sign-in.

Ingress has no portable header removal. In ingress mode, oauth2-proxy overwrites X-Forwarded-Access-Token and the four X-Forwarded-* user headers on every request, skip-auth routes included. A client’s X-Auth-Request-* headers still reach the broker, which reads none of them (what the probe proved).

HSTS is the gateway’s or the Ingress controller’s job, beside TLS: the front door sets no response headers of its own. For example, on Gateway API:

# a filter on your HTTPS listener's routes, or your gateway's own policy
- type: ResponseHeaderModifier
  responseHeaderModifier:
    set: [{name: Strict-Transport-Security, value: max-age=31536000; includeSubDomains}]

and on ingress-nginx, the controller’s hsts setting (on by default for TLS hosts).

WebSockets. The rooms page holds /v1/ws open for up to an hour, and the broker pings it every 30 seconds. A gateway whose default request timeout would cut it needs expose.httproute.timeouts: {request: 0s} (Envoy-based gateways). An Ingress controller’s WebSocket timeouts are its own annotations, under expose.web.annotations.

TLS. Under httproute, TLS is the Gateway listener’s. Under ingress, tls names your Secret, and annotations may carry cert-manager.io/cluster-issuer. The broker’s own :8443 certificate is the run bridge’s, not an exposed surface.

The web front door

webProxy.enabled renders oauth2-proxy as rooms-web-proxy: a Deployment (two replicas), its Service (http 80, metrics 44180), a PodDisruptionBudget, a ServiceAccount with no token, and its policies. Its arguments are derived from maku.broker.human, so the issuer and the groups are stated once. Identity lists them. maku.broker.webProxy: true opens the broker’s :8080 to these pods, and to nothing else.

ValueDefaultWhat it does
imageoauth2-proxy v7.15.5, by digestthe version the probe asserted
existingSecretrequiredthe web client and the cookie secret: keys client-id, client-secret, cookie-secret (keys renames them). The cookie secret is 32 random bytes: openssl rand -base64 32 | tr -- '+/' '-_'
cookieRefresh1hunder the ID token’s lifetime
cookieSameSitestrictlax when the IdP is on another site than the web host: a strict CSRF cookie does not come back from a cross-site sign-in
extraArgs{}appended as --key=value. A key the chart derives fails the render, naming it, and so does one that would widen what passes: trusted-ip, reverse-proxy, skip-auth-regex, skip-auth-preflight, whitelist-domain, config, alpha-config, pass-user-headers, skip-auth-strip-headers
extraEnv[]e.g. a private IdP CA (SSL_CERT_FILE). An OAUTH2_PROXY_* variable fails the render: oauth2-proxy reads it as a flag
extraVolumes, extraVolumeMounts[]e.g. the CA’s Secret
networkPolicy.idp.to, .portthe issuerthe IdP’s egress: in mode cilium, toFQDNs on the issuer’s host; in mode kubernetes, every public address. Set them for an in-cluster IdP

It also needs maku.broker.human.issuer, an https maku.broker.publicURL (the sign-in returns to <publicURL>/oauth2/callback), and maku.broker.oidc.existingSecret, whose cli key is the client maku’s bearers are issued to.

The policies. In mode kubernetes a NetworkPolicy, in mode cilium a CiliumNetworkPolicy:

  • ingress on :4180 from expose.networkPolicy.from (or fromEntities), and from the kubelet in cilium mode;
  • ingress on :44180 from the scraper (maku.networkPolicies.kubernetes.metricsFrom, or monitoring.serviceMonitor.cilium.fromEndpoints);
  • egress to DNS, to the broker’s :8080 and to the IdP.

With monitoring.serviceMonitor.enabled, a ServiceMonitor scrapes it.

Your own front door

A team that runs its own oauth2-proxy sets expose.web.enabled: false and webProxy.enabled: false, and routes to it itself. Its proxy must do what the chart’s does: overwrite X-Forwarded-Access-Token on every request, strip it on its skip-auth routes, and never trust a client’s X-Forwarded-Uri (reverse-proxy=false, or a trusted-ip that holds only your gateway). Open the broker’s :8080 to it alone with maku.broker.networkPolicy.extraIngress. Routing the web straight to the broker is never safe: a client could then send an access header of its own and pass as a web session.

Exposing only Slack

expose:
  mode: httproute
  web: {enabled: false}
  slack:
    hostnames: [factory-slack.example.com]
    parentRefs: [{name: public, namespace: infra}]
  networkPolicy:
    from: [{namespaceSelector: {matchLabels: {kubernetes.io/metadata.name: gateway}}}]
slack:
  enabled: true

People then reach the web through a port-forward, or through a front door of their own.

What the probe proved

task chart:expose:probe runs charts/agent-factory/tests/expose-probe/probe.sh on a throwaway k3d: agentgateway v1.6.0 on Gateway API v1.2.1, k3s’s Traefik, and oauth2-proxy v7.15.5 against the e2e stub issuer.

What was assertedResult
X1The Slack route answers only POST /slack/eventsagentgateway answers 404 to GET /slack/events, /slack/eventsx, /slack/events/x, /slack and /. Traefik’s Exact path answers 404 to the other paths, and passes GET /slack/events: Ingress has no method match, so the App’s 405 is the guard
X2The web route removes each of the ten identity headers and the three forwarded headersall removed; the gateway may set its own X-Forwarded-Host and -Proto after the filter
X3/v1/ws, pinged every 30 s, stays open 6 minutesthrough agentgateway with and without timeouts, through Traefik, and through agentgateway then oauth2-proxy
X4oauth2-proxy never forwards a client’s X-Forwarded-Access-Token or user headerswith a CLI bearer it is overwritten with the bearer (both headers equal: never a web session); with a session it is the session’s own access token; on a skip-auth route it is stripped. pass-user-headers overwrites the four X-Forwarded-* user headers. A client’s X-Auth-Request-* headers pass unchanged: the broker reads only Authorization and X-Forwarded-Access-Token
X4A forwarded path never selects a skip-auth routewith reverse-proxy=false, GET /api/rooms with X-Forwarded-Uri: /.well-known/maku (or the GitHub callback) and no session redirects to sign in
X4The skip-auth routes and the cookiesGET /.well-known/maku and GET /link/github/callback?… pass without a session; POST /link/github/callback, GET /link/github and /link/github/callbackx redirect to sign in. The cookies are Secure, HttpOnly, SameSite=Strict. A bearer in no agents group is 403
X5oidc-groups-claim with a nested claim (realm_access.roles)not read: a member’s bearer is 403. So the chart sets allowed-group only for a top-level roles claim
X6HTTPRoute.spec.rules[].timeouts on the v1.2.1 standard CRDskept, and agentgateway accepts the route

task chart:expose:k3d then installs the chart that way, by HTTPRoute and by Ingress, and signs in through it.