-
Notifications
You must be signed in to change notification settings - Fork 218
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
Update lease access check to account for lease name and multiple rules #2456
Update lease access check to account for lease name and multiple rules #2456
Conversation
import static org.junit.jupiter.api.Assertions.assertThrows; | ||
import static org.junit.jupiter.api.Assertions.assertTrue; | ||
import static org.mockito.Mockito.mock; | ||
import static org.mockito.Mockito.when; | ||
|
||
class LeaderElectionManagerTest { | ||
|
||
private LeaderElectionManager leaderElectionManager() { | ||
private LeaderElectionManager leaderElectionManager(Optional<Object> selfSubjectReview) { |
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.
It would be better to not use Optional here but pass the object directly and use Optional.ofNullable
when resolving the kubernetes client instead.
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've updated how Optional
is used for the mock client - let me know if it's not what you had in mind.
Hi @MikeEdgar thx for the PR, pls run |
The integration test: |
Thanks, I'll take a look today. |
The rule filter predicate on Lines 134 to 138 in 8f77f68
|
Signed-off-by: Michael Edgar <medgar@redhat.com>
6b6b9a1
to
109e831
Compare
The permission check now tests for wildcard |
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!
Thank you!
Signed-off-by: Chris Laprun <claprun@redhat.com>
Allow the verbs required for lease access to be split between multiple rules and exclude rules that name a non-matching lease name. This allows rules such as those below to work as expected.