-
Notifications
You must be signed in to change notification settings - Fork 44
feat: GitOps platform-user management (bootstrap superuser SA + reconcile CLI) #1720
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
rohilsurana
merged 11 commits into
feat/platform-user-correctness
from
feat/gitops-platform-users
Jul 1, 2026
Merged
Changes from all commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
421a215
feat: GitOps platform-user management (bootstrap superuser SA + recon…
rohilsurana 54ccfaa
Merge branch 'feat/platform-user-correctness' into feat/gitops-platfo…
rohilsurana b455183
fix(platform): harden reconcile/bootstrap per review (require spec, r…
rohilsurana 2d67630
refactor(reconcile): de-duplicate principal-id assignment in apply vi…
rohilsurana 40b0997
fix(platform): bootstrap-SA guards return generic permission_denied, …
rohilsurana fa60cef
refactor(reconcile): rename platform-user spec field 'role' to 'relat…
rohilsurana 02884e4
test(reconcile): cover ref matching by user id, user email, and servi…
rohilsurana 84b818d
fix(platform): guard bootstrap-SA credential/token/key deletes, fix r…
rohilsurana daea3f6
Merge remote-tracking branch 'origin/feat/platform-user-correctness' …
rohilsurana 528cd57
docs(platform): rewrite gitops reconcile and bootstrap comments in pl…
rohilsurana 99021a5
Merge remote-tracking branch 'origin/feat/platform-user-correctness' …
rohilsurana File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,76 @@ | ||
| package cmd | ||
|
|
||
| import ( | ||
| "fmt" | ||
| "os" | ||
|
|
||
| "github.com/MakeNowJust/heredoc" | ||
| "github.com/raystack/frontier/internal/reconcile" | ||
| cli "github.com/spf13/cobra" | ||
| ) | ||
|
|
||
| func ReconcileCommand(cliConfig *Config) *cli.Command { | ||
| var ( | ||
| filePath string | ||
| dryRun bool | ||
| header string | ||
| ) | ||
| cmd := &cli.Command{ | ||
| Use: "reconcile", | ||
| Short: "Reconcile platform configuration to a desired-state file", | ||
| Long: heredoc.Doc(` | ||
| Make platform resources match a desired-state YAML file, through the admin API. | ||
|
|
||
| Supports the PlatformUser kind (platform admins and members) for now. The file | ||
| decides who has access: anyone listed is added, anyone not listed is removed. | ||
| Log in as a superuser (for example the bootstrap service account) with --header. | ||
| `), | ||
| Example: heredoc.Doc(` | ||
| $ frontier reconcile -f platform-users.yaml --dry-run -H "Authorization:Basic <base64>" | ||
| $ frontier reconcile -f platform-users.yaml -H "Authorization:Basic <base64>" | ||
| `), | ||
| Annotations: map[string]string{ | ||
| "group": "core", | ||
| "client": "true", | ||
| }, | ||
| RunE: func(cmd *cli.Command, args []string) error { | ||
| data, err := os.ReadFile(filePath) | ||
| if err != nil { | ||
| return fmt.Errorf("read desired-state file: %w", err) | ||
| } | ||
| adminClient, err := createAdminClient(cliConfig.Host) | ||
| if err != nil { | ||
| return err | ||
| } | ||
| registry := map[string]reconcile.Reconciler{ | ||
| reconcile.KindPlatformUser: reconcile.NewPlatformUserReconciler(adminClient, header), | ||
| } | ||
| reports, runErr := reconcile.Run(cmd.Context(), registry, data, dryRun) | ||
| for _, rep := range reports { | ||
| printReconcileReport(cmd, rep) | ||
| } | ||
| return runErr | ||
| }, | ||
| } | ||
| cmd.Flags().StringVarP(&filePath, "file", "f", "", "Path to the desired-state YAML file") | ||
| cmd.MarkFlagRequired("file") | ||
| cmd.Flags().BoolVar(&dryRun, "dry-run", false, "Print the plan without applying changes") | ||
| cmd.Flags().StringVarP(&header, "header", "H", "", "Header <key>:<value> for auth, e.g. 'Authorization:Basic <base64>'") | ||
| bindFlagsFromClientConfig(cmd) | ||
| return cmd | ||
| } | ||
|
|
||
| func printReconcileReport(cmd *cli.Command, rep reconcile.Report) { | ||
| if len(rep.Planned) == 0 { | ||
| cmd.Printf("%s: no changes\n", rep.Kind) | ||
| return | ||
| } | ||
| verb, count := "applied", rep.Applied | ||
| if rep.DryRun { | ||
| verb, count = "planned", len(rep.Planned) | ||
| } | ||
| cmd.Printf("%s (%s %d):\n", rep.Kind, verb, count) | ||
| for _, p := range rep.Planned { | ||
| cmd.Printf(" - %s\n", p) | ||
| } | ||
| } |
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
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
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
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
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
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
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
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
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
Oops, something went wrong.
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.