feat(fga): OMS command to initialize first cluster admin#553
Merged
Conversation
Signed-off-by: Niklas Brodnicke <niklas@codesphere.com>
OliverTrautvetter
requested changes
Jul 2, 2026
OliverTrautvetter
left a comment
Member
There was a problem hiding this comment.
Looks good, just some small comments 👍
24b44c3 to
4653b77
Compare
Signed-off-by: Niklas Brodnicke <niklas@codesphere.com>
4653b77 to
babc23f
Compare
Signed-off-by: nbrodnicke <54493037+nbrodnicke@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.