-
Notifications
You must be signed in to change notification settings - Fork 34
Add support for managing HumioGroup and roles assignment to groups in HumioOperator #964
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
Conversation
d8f6242 to
c9f0a01
Compare
4571097 to
95e0b91
Compare
wxu-stripe
left a comment
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.
Some comments, nothing is hard blocking
| } | ||
| } | ||
|
|
||
| mutation CreateGroup( |
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.
Maybe keep the name consistent as AddGroup?
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.
Create* is consistent with the function naming for other resources though, so we either match with the graphQL API name or follow the same convention as repos and views for example. I think Create* is cleaner overall and makes the golang code easier to find at least
|
|
||
| const ( | ||
| // HumioGroupStateUnknown is the Unknown state of the group | ||
| HumioGroupStateUnknown = "Unknown" |
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.
Any idea how we get this state?
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.
line 116 in the controller code sets this state, looks like its from generic API errors
| externalClusterName: | ||
| description: |- | ||
| ExternalClusterName refers to an object of type HumioExternalCluster where the Humio resources should be created. | ||
| This conflicts with ManagedClusterName. |
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.
Do we want validation to make sure they're not both provided?
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.
| mutation DeleteGroup( | ||
| $GroupId: String! | ||
| ) { | ||
| removeGroup( |
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.
Similar here, tho maybe not as bad, since your go function has the same naming.
| defer func(ctx context.Context, hg *humiov1alpha1.HumioGroup) { | ||
| _, err := r.HumioClient.GetGroup(ctx, humioHttpClient, req, hg) | ||
| if errors.As(err, &humioapi.EntityNotFound{}) { | ||
| _ = r.setState(ctx, humiov1alpha1.HumioGroupStateNotFound, hg) |
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.
We're ignoring the errors here? Maybe at least log it?
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.
I believe the "finalizer" acts on this error state "eventually". for this part I am mostly copying the existing logic from other controllers, would love if someone from CrowdStrike can confirm this is correct though
|
@bowens-stripe Thank you for this contribution. Much appreciated. I do have a few changes I'd like to see before this is ready to get merged in. Would you mind if I take your branch and make some adjustments to it? Can you tell me if you strictly need support for assigning existing roles to the group (as in, roles that are not managed by the operator), or if it would be OK to only allow role assignments to roles that the operator manages? For context, LogScale supports 3 different "types/classes" of permissions, and the current state of this PR only deals with 1 of the 3 types, namely "view permissions". We intend to add support for all of these 3 types of role permissions and mechanisms for assigning them to groups. If you're able to answer my two questions above, then I'd like to pick this up and continue the work based on your contribution. |
|
@SaaldjorMike I just added you as a collaborator on my fork, feel free to add anything to the branch!
I dont really "need" that, but I was just planning to use the Admin/Member/Reader role created automatically for us with these groups. If that's not the recommended way I can also make fresh roles to go along with the groups. (which needs a separate PR to create roles in humio-operator probably) |
|
@SaaldjorMike asking because it affects planning on our side to decide what to pick up next |
Awesome. I'll probably end up just pushing a branch directly to the upstream repo based on your branch, and continue working on it there. This way all the github actions workflows that runs test and so on will work to validate the work.
I do not see this is mergeable just yet, but I should be able to pick this one up alongside support for all the types of roles (which I'm already working on), including ways of assigning the roles to groups. The primary reason is that I'd like to move the group assignment part into the new CRD's for the roles for each of the 3 types of permissions. The primary reasoning is to keep the "who can assign this system permission role" as part of the CRUD of the "system permission role" itself, rather than on the "generic" group. I believe this creates a slightly better situation for the user that'll be setting up k8s RBAC rules for who can manage which types of roles and which groups they are assigned to. My overall plan is like this:
To answer your question on an estimate for when: I intend to get all the 4 new CRD's wrapped up this month. |
|
@SaaldjorMike sounds good, thank you! I just subscribed myself to #976 , please keep us posted :) |
|
@bowens-stripe Quick update. I've now merged the CRD's for roles and groups today. This means I now have all the building blocks I need to extend the role CRD's with mechanisms for assigning the roles to groups. |
|
@SaaldjorMike thank you for the update! are there plans to cut a release with the new CRDs now or that's coming after the role assignments piece? |
Currently I do not intend to push out a release until the role assignment work is done, as I didn't feel like it was of as much use without the role assignment mechanisms. I expect I'll be able to get the role assignment work done within days rather than weeks so I thought I might as well just wait until that lands before cutting a new release. We can adjust the plans if needed, so if you think it is useful for us to prioritize cutting the new release before the role assignment work is done, let me know and I'll see what I can do. |
that's awesome to know! waiting until after that sounds good to me, thank you! @SaaldjorMike |
|
@bowens-stripe Quick update. I just opened up #984 to add some functionality for assigning roles to groups. It may still need a bit more work, but I've shared this around internally for some review/feedback. |
|
@bowens-stripe I'm going to close this PR now. The addition of the new CRD's have already been merged, and as soon as #984 gets merged, I'll see what I can do about getting a new release out with these features. Thank you again for your contributions here. Much appreciated. |
Overview
as title, this PR adds support for basic CRUD of
HumioGroups inHumioOperatorto manage user groups in LogScale, as well as the functionalities to assign and unassign (existing) roles to / from these groups that are associated with (existing) views.I am using this PR which added
HumioViewheavily as a reference, as well as existing code forHumioRepositoryTest
make testpasses locally. Please feel free to advice on additional testing strategies as needed!