Skip to content

Commit 783cb84

Browse files
authored
feat(rbac): bind makeitworkcloud:admins GitHub team to cluster-admin (#22)
## Summary When Headlamp authenticates a user via Dex, the resulting ID token is forwarded to kube-apiserver. With the apiserver's \`--oidc-issuer-url\` / \`--oidc-client-id=headlamp\` / \`--oidc-username-claim=email\` / \`--oidc-groups-claim=groups\` flags (added to k3s cloud-init in the matching tfroot-libvirt PR), the apiserver validates the token and surfaces the user as e.g. \`steven@makeitwork.cloud\` with groups like \`makeitworkcloud:admins\`. Without an RBAC binding the user is recognized but not authorized → 401 from the apiserver, which Headlamp interprets as a failed login and re-prompts. This adds a single ClusterRoleBinding mapping the GitHub team \`makeitworkcloud:admins\` to cluster-admin. Anyone in that team gets full kubectl/Headlamp access; non-members get the standard denied response. ## Pairs with - tfroot-libvirt PR (incoming): adds \`--oidc-*\` apiserver args to k3s cloud-init. ## Test plan - [x] Already validated on the live cluster — the same binding was applied manually after restarting k3s with the OIDC apiserver flags, and Headlamp login completed (no more 401 loop). - [x] After merge: \`kubectl get clusterrolebinding oidc-makeitworkcloud-admins\` exists and is owned by ArgoCD. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
1 parent 1fa5186 commit 783cb84

2 files changed

Lines changed: 24 additions & 0 deletions

File tree

bootstrap/kustomization.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ resources:
66
# NOTE: cluster-admin ClusterRoleBinding is managed by ansible-role-crc
77
# (ArgoCD cannot grant itself permissions it doesn't have)
88
- argocd-config.yaml
9+
# Wave 0: GitHub-team-to-cluster-admin RBAC for OIDC users (Headlamp, kubectl)
10+
- oidc-rbac.yaml
911
# Wave 0: CI/CD service account with cluster-admin for GitHub Actions
1012
- ci-service-account.yaml
1113
# PostSync: Sync ci-deployer token to GitHub Actions secrets

bootstrap/oidc-rbac.yaml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
---
2+
# Maps the GitHub team `makeitworkcloud:admins` (surfaced as a `groups` claim
3+
# by Dex's GitHub connector) to cluster-admin so OIDC-authenticated users
4+
# can use kubectl/Headlamp without a separate per-user binding.
5+
#
6+
# Pairs with the k3s apiserver flags in tfroot-libvirt cloud-init that point
7+
# at the same Dex issuer: --oidc-issuer-url, --oidc-client-id=headlamp,
8+
# --oidc-username-claim=email, --oidc-groups-claim=groups.
9+
apiVersion: rbac.authorization.k8s.io/v1
10+
kind: ClusterRoleBinding
11+
metadata:
12+
name: oidc-makeitworkcloud-admins
13+
annotations:
14+
argocd.argoproj.io/sync-wave: "0"
15+
subjects:
16+
- kind: Group
17+
name: makeitworkcloud:admins
18+
apiGroup: rbac.authorization.k8s.io
19+
roleRef:
20+
kind: ClusterRole
21+
name: cluster-admin
22+
apiGroup: rbac.authorization.k8s.io

0 commit comments

Comments
 (0)