Skip to content

Agent Mesh

charts: drop the bundled Dex

Tomas Tormo0bffff7b4b11
diff --git a/charts/sam-mesh/README.md b/charts/sam-mesh/README.md
index e271237b..4399b93e 100644
--- a/charts/sam-mesh/README.md
+++ b/charts/sam-mesh/README.md
@@ -1,8 +1,8 @@
# sam-mesh Helm chart
-Deploys a self-contained SAM mesh (control plane, router, console, and
-optionally an in-cluster Postgres + Dex) for local development, testing, or
-self-hosting your own hub.
+Deploys a self-contained SAM mesh (control plane, router, console, and an
+in-cluster Postgres) for local development, testing, or self-hosting your
+own hub.
> For large-scale production deployments (GKE/EKS/AKS) using externally
> managed Postgres/DNS/OIDC, see the
@@ -12,9 +12,17 @@ self-hosting your own hub.
## Install
```bash
-helm upgrade --install sam-mesh ./charts/sam-mesh --namespace sam --create-namespace
+helm upgrade --install sam-mesh ./charts/sam-mesh --namespace sam --create-namespace \
+ --set controlPlane.oidcIssuer=<your OIDC issuer URL>
```
+`controlPlane.oidcIssuer` is required: the chart bundles no identity
+provider, and the control plane refuses to start without an issuer. Point it
+at your own OIDC provider (Google, Okta, a Dex you run, the cluster's own
+issuer for ServiceAccount Workload Identity Federation, …). The `kind` dev
+environment (`make kind-up`) deploys its own throwaway Dex from
+`development/kind/dex.yaml` and wires it in for you.
+
At the end of `helm install`/`helm upgrade`, the chart prints the exact
`kubectl` command to retrieve your generated secrets (see below) — read the
NOTES output before doing anything else.
@@ -59,9 +67,53 @@ administrator to approve each enrollment via `/admin/enrollments` before a
node can join — see the
[Control Plane Configuration guide](https://sam-mesh.dev/docs/user/control-plane-configuration/#6-headless-node-enrollment-bootstrap-token-flow).
-## Dex (`dex.enabled`)
+## Gateway API (`gateway.enabled`)
+
+Disabled by default. When enabled the chart creates one `Gateway` fronting
+the mesh, with one `HTTPRoute`. `gateway.className` is then **required**,
+with no default, because the right GatewayClass is provider-specific
+(`cloud-provider-kind` in kind, `gke-l7-global-external-managed` on GKE,
+`istio`, `envoy-gateway`, …).
+
+The route exposes only the control plane's enrollment surface (`/register`,
+`/info`, `/keys`, `/routers/lease`, `/policies`, `/enroll`, `/enroll/status`,
+`/refresh`) and the console under `gateway.consolePath`; everything else,
+including `/admin` and `/user`, is unrouted. `gateway.adminRoute: true`
+additionally routes `/admin` — a dev convenience, leave it off in production.
+
+The console rules mirror the cloud deployment exactly: the bare prefix
+(`/console`) is answered with a 302 to `/console/`, and a `URLRewrite` filter
+strips the prefix before the request reaches the console. `URLRewrite` is
+**Extended** (not core) Gateway API conformance, so the provider must support
+it. Set `gateway.consolePath: ""` to leave the console unrouted.
+
+`listeners`, `hostnames`, `addresses` and `annotations` are passed through to
+the Gateway API objects verbatim, so anything the spec allows is expressible.
+They default to one plain-HTTP listener on port 80 matching every host, which
+suits a local cluster. For example, on GKE:
+
+```yaml
+gateway:
+ enabled: true
+ className: gke-l7-global-external-managed
+ listeners:
+ - name: https
+ protocol: HTTPS
+ port: 443
+ tls:
+ certificateRefs:
+ - name: sam-mesh-tls
+ allowedRoutes:
+ namespaces:
+ from: Same
+ hostnames: [hub.example.com]
+ addresses:
+ - type: NamedAddress
+ value: sam-hub-ip
+```
+
+## OIDC login for the console
-Disabled by default. The bundled Dex is only meant for local/dev OIDC login
-(username/password test users); real deployments should point
-`controlPlane.oidcIssuer` at your own identity provider instead of enabling
-this.
+There is no bundled Dex. Point `controlPlane.oidcIssuer` at your identity
+provider and register `https://<hub-hostname><consolePath>/auth/callback` as
+a redirect URI for the OIDC client the control plane reports.
diff --git a/charts/sam-mesh/templates/dex-deployment.yaml b/charts/sam-mesh/templates/dex-deployment.yaml
deleted file mode 100644
index 8f6a65a7..00000000
--- a/charts/sam-mesh/templates/dex-deployment.yaml
+++ /dev/null
@@ -1,86 +0,0 @@
-{{- if .Values.dex.enabled -}}
-apiVersion: v1
-kind: ConfigMap
-metadata:
- name: {{ include "sam-mesh.fullname" . }}-dex-config
- labels:
- {{- include "sam-mesh.labels" . | nindent 4 }}
-data:
- config.yaml: |
- issuer: http://{{ include "sam-mesh.fullname" . }}-dex:5556/dex
- storage:
- type: memory
- web:
- http: 0.0.0.0:5556
- oauth2:
- skipApprovalScreen: true
- staticClients:
- - id: sam-console
- redirectURIs:
- - http://localhost:9092/auth/callback
- - http://127.0.0.1:9092/auth/callback
- name: 'SAM Console'
- public: true
- enablePasswordDB: true
- staticPasswords:
- # bcrypt hash for 'password'
- hash: "$2a$10$TUOgJVdtu0AL6Y6TcNBQXOSjRWRKhIkC0kXDzN9kOkPB4hg2aFPE2"
- username: admin
- userID: "0898fa90-3453-4311-8566-020953250212"
----
-apiVersion: apps/v1
-kind: Deployment
-metadata:
- name: {{ include "sam-mesh.fullname" . }}-dex
- labels:
- {{- include "sam-mesh.labels" . | nindent 4 }}
-spec:
- replicas: 1
- selector:
- matchLabels:
- app: {{ include "sam-mesh.fullname" . }}-dex
- template:
- metadata:
- labels:
- app: {{ include "sam-mesh.fullname" . }}-dex
- spec:
- nodeSelector:
- sam-role: control-plane
- containers:
- - name: dex
- image: "{{ .Values.dex.image.repository }}:{{ .Values.dex.image.tag }}"
- imagePullPolicy: {{ .Values.global.imagePullPolicy }}
- args:
- - dex
- - serve
- - /etc/dex/cfg/config.yaml
- ports:
- - containerPort: 5556
- name: http
- volumeMounts:
- - name: config
- mountPath: /etc/dex/cfg
- volumes:
- - name: config
- configMap:
- name: {{ include "sam-mesh.fullname" . }}-dex-config
----
-apiVersion: v1
-kind: Service
-metadata:
- name: {{ include "sam-mesh.fullname" . }}-dex
- labels:
- {{- include "sam-mesh.labels" . | nindent 4 }}
-spec:
- type: NodePort
- selector:
- app: {{ include "sam-mesh.fullname" . }}-dex
- ports:
- - name: http
- port: 5556
- targetPort: 5556
- {{- if .Values.dex.nodePort }}
- nodePort: {{ .Values.dex.nodePort }}
- {{- end }}
-{{- end }}
diff --git a/charts/sam-mesh/values.yaml b/charts/sam-mesh/values.yaml
index af1fd446..33e6217e 100644
--- a/charts/sam-mesh/values.yaml
+++ b/charts/sam-mesh/values.yaml
@@ -41,7 +41,9 @@ controlPlane:
# Only skips TLS verification for the OIDC issuer; leave false unless
# pointing at a local/dev issuer without a valid certificate.
insecureSkipTlsVerify: false
- oidcIssuer: "http://sam-mesh-dex:5556/dex"
+ # Required: the chart bundles no identity provider. Point it at your OIDC issuer
+ # (comma-separated for more than one); the control plane refuses to start without one.
+ oidcIssuer: ""
allowedAudiences: "sam-mesh-audience,sam-control-plane-audience"
resources:
requests:
@@ -123,22 +125,7 @@ console:
port: 8081
nodePort: null
-dex:
- enabled: false
- nodePort: 30556
- image:
- repository: dexidp/dex
- tag: v2.39.0
- google:
- clientId: ""
- clientSecret: ""
- github:
- clientId: ""
- clientSecret: ""
- cliOAuthSecret: ""
-
bootstrap:
bindings: []
# Services sam:role:node may call
nodeServices: ["*"]
-