Skip to content

feat(fga): OMS command to initialize first cluster admin#553

Merged
nbrodnicke merged 3 commits into
mainfrom
niklas/oms-add-cluster-admin
Jul 2, 2026
Merged

feat(fga): OMS command to initialize first cluster admin#553
nbrodnicke merged 3 commits into
mainfrom
niklas/oms-add-cluster-admin

Conversation

@nbrodnicke

@nbrodnicke nbrodnicke commented Jul 1, 2026

Copy link
Copy Markdown
Contributor

CU-869dy61ny

Adds a new oms add-cluster-admin CLI command for bootstrapping the first cluster admin on a Codesphere installation.

The command writes the given email address into a Kubernetes secret (cluster-admin-email by default) in the target cluster. On startup, the AuthService reads this secret and grants the stored email cluster-admin permissions via OpenFGA — this is how a fresh installation gets its first admin without a chicken-and-egg problem (no admin exists yet to grant one via the normal permission flow).

Behavior:

Creates the secret if it doesn't exist, or updates it if it does (idempotent — re-running with the same email is a no-op).
--email (required): the cluster admin's email address, validated per RFC 5322 and normalized (lowercased). Malformed input, e.g. not-an-email or a display name without angle brackets like Max Mustermann max@mail.com, is rejected up front with a clear error rather than propagating downstream.
--namespace (default codesphere) and --secret-name (default cluster-admin-email): overridable in case of custom deployments. Empty/whitespace values are rejected early instead of silently overwriting the sensible default.
The target cluster is the current kubeconfig context; can be pointed elsewhere via the standard KUBECONFIG environment variable.

Signed-off-by: Niklas Brodnicke <niklas@codesphere.com>
@nbrodnicke nbrodnicke self-assigned this Jul 1, 2026
@jonas-zipprick

Copy link
Copy Markdown

@OliverTrautvetter OliverTrautvetter left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, just some small comments 👍

Comment thread cli/cmd/add_cluster_admin.go
Comment thread internal/clusteradmin/clusteradmin.go
Comment thread cli/cmd/add_cluster_admin.go
Comment thread cli/cmd/add_cluster_admin.go Outdated
@nbrodnicke nbrodnicke force-pushed the niklas/oms-add-cluster-admin branch from 24b44c3 to 4653b77 Compare July 2, 2026 09:35
Signed-off-by: Niklas Brodnicke <niklas@codesphere.com>
@nbrodnicke nbrodnicke force-pushed the niklas/oms-add-cluster-admin branch from 4653b77 to babc23f Compare July 2, 2026 09:36
Signed-off-by: nbrodnicke <54493037+nbrodnicke@users.noreply.github.com>

@OliverTrautvetter OliverTrautvetter left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚀

@nbrodnicke nbrodnicke merged commit dfef9f9 into main Jul 2, 2026
6 checks passed
@nbrodnicke nbrodnicke deleted the niklas/oms-add-cluster-admin branch July 2, 2026 10:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants