-
Notifications
You must be signed in to change notification settings - Fork 167
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
refactor: make Kargo Roles proper runtime objects #1917
Conversation
Signed-off-by: Kent Rancourt <kent.rancourt@gmail.com>
Signed-off-by: Kent Rancourt <kent.rancourt@gmail.com>
Signed-off-by: Kent Rancourt <kent.rancourt@gmail.com>
Signed-off-by: Kent Rancourt <kent.rancourt@gmail.com>
Signed-off-by: Kent Rancourt <kent.rancourt@gmail.com>
Signed-off-by: Kent Rancourt <kent.rancourt@gmail.com>
Signed-off-by: Kent Rancourt <kent.rancourt@gmail.com>
Signed-off-by: Kent Rancourt <kent.rancourt@gmail.com>
✅ Deploy Preview for docs-kargo-akuity-io ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #1917 +/- ##
==========================================
+ Coverage 45.52% 45.58% +0.06%
==========================================
Files 235 235
Lines 15823 15793 -30
==========================================
- Hits 7203 7199 -4
+ Misses 8267 8240 -27
- Partials 353 354 +1 ☔ View full report in Codecov by Sentry. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👏!
Follow up to #1906 and related to #1916
Kargo Roles are the one place in all of our APIs where protobuf messages might be shown directly to a user -- which is how I became aware of #1916.
While there may be some things that can be done about #1916, I recognize that protobuf field names should only matter over the wire and are, essentially, an implementation detail that really never should bleed through to the user. i.e. I don't want to get hung up on fixing #1916 to force json struct tags to look a certain go-ish way.
This sent me down the rabbit hole of trying something new, that turns out to solve a lot of problems at once...
I created a new rbac.kargo.akuity.io/v1alpha1 API wherein Roles are proper k8s runtime objects (although we skip the CRD generation for these, because it's not needed)
This drastically cleans up the RoleDatabase interface, because it now deals with
rbacapi.Role
objects instead of dealing directly with protobuf messages -- something it probably shouldn't have done in the first place.Protobuf messages like GetRoleRequest now wrap Role messages that are generated from the Role runtime object -- i.e. we now handle this exactly as we have always handled GetStageRequest, GetPromotionRequest, etc., which have also always wrapped messages generated from runtime objects. Consistency ftw.
Any JSON or YAML the CLI shows to users now is more conventionally k8s-looking (fields names are lowerCamelCase instead of snake_case).
Last, but certainly not least, Roles being proper runtime objects eliminates all the slight of hand that was previously required to make
There are also some tiny bug fixes to revoke logic in here.