-
Notifications
You must be signed in to change notification settings - Fork 23
CLOUDP-350197: allow to create a custom role with cluster: true #553
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
base: lsierant/custom-roles-regression-tests
Are you sure you want to change the base?
CLOUDP-350197: allow to create a custom role with cluster: true #553
Conversation
43c0502 to
2d7b9a0
Compare
cce9040 to
91233d8
Compare
2d7b9a0 to
3040210
Compare
91233d8 to
d9c39b3
Compare
70c14e8 to
c150032
Compare
d9c39b3 to
0492502
Compare
c150032 to
545dc80
Compare
d3381a7 to
8fa7a1a
Compare
| date: 2025-10-27 | ||
| --- | ||
|
|
||
| * Fixed a problem that prevented specifying cluster-wide privileges in database custom roles. |
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 propose to change to: "Fixed inability to specify cluster-wide privileges in custom roles."
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.
updated, thanks!
545dc80 to
71cd46b
Compare
4c3939d to
f515880
Compare
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.
LGMT!
| --- | ||
| kind: fix | ||
| date: 2025-10-27 | ||
| --- | ||
|
|
||
| * Fixed inability to specify cluster-wide privileges in custom roles. |
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.
LGTM!
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.
LGTM!
71cd46b to
724fa83
Compare
f515880 to
3392469
Compare
Summary
This PR fixes a problem which was preventing creating cluster-wide mongodb custom roles.
Context
As described in MongoDB docs the resource object is either:
or
So that means we cannot provide empty strings for
dbandcollectionfields as empty string means "any db/collection".At the same time our previous serialization rules were always sending empty strings even if not set. This was the source of the problem - it wasn't possible to specify
cluster: truebecause the operator was also sending empty db and collections.Backwards compatibility
Making
dbandcollectionfields just as omitempty*stringis not sufficient, because that would change the semantics of the resource and would be potentially a breaking change. In order to preserve backwards compatibility we need additional logic (see normalizePrivilegeResource that will maintain the same behavior for non-cluster-wide resources (sending empty strings even if the field is not set in yaml).Proof of Work
Tests passing.
Based on PR #551
Chain of upstream PRs as of 2025-10-25
PR CLOUDP-349078: custom roles regression tests #551:
master←lsierant/custom-roles-regression-testslsierant/custom-roles-regression-tests←lsierant/custom-roles