-
Notifications
You must be signed in to change notification settings - Fork 5.6k
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
feat: add deny destinations for projects (#9464) #9652
feat: add deny destinations for projects (#9464) #9652
Conversation
772d4e2
to
ff35154
Compare
Codecov Report
@@ Coverage Diff @@
## master #9652 +/- ##
==========================================
+ Coverage 45.75% 45.80% +0.04%
==========================================
Files 227 227
Lines 26961 26976 +15
==========================================
+ Hits 12337 12356 +19
+ Misses 12943 12939 -4
Partials 1681 1681
Continue to review full report at Codecov.
|
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.
Thanks so much for working on this!
I think, as currently written, we have a design problem to overcome. Current behavior of the destinations
field is that if any destination matches, the resource is allowed (IsDestinationPermitted
is a for
loop, exiting on the first matching destination). So the feature doesn't work as documented. Any destination will match the first / destination spec, and the loop will exit.
The suggestion in #9464 was to switch the destinations
field to "all must match" mode if all the destinations were deny-type (start with a !
). But 1) the implicit flip in behavior is weird to me, and 2) it doesn't account for cases like your example where one destination is "allow-type" and another is "deny-type".
Suggestion: Add a boolean field called allDestinationsMustMatch
.
Thanks for your feedback!
Good points.
Sounds good to me, you mean as a field on the |
Yep! Adding fields can be tricky with all the codegen logic. Just lmk if you need help. |
ff35154
to
3bae09a
Compare
Alright, so I added the field |
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 also think a e2e test should be added for this
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'm gonna quibble on the docs, 'cause I think this is such an important feature that we definitely want to get the messaging right. But overall, let me reemphasize that this is awesome work. Literally sitting here grinning about this PR. 😁
89fa103
to
04adb72
Compare
I'll also take a look into adding some E2E tests for this feature |
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! I'm going to re-request a review from @rishabh625 and request another review from @leoluz since it's really important we get this right.
If you don't have time to write e2e tests at the moment, we can add a follow-up ticket to do so.
8d00330
to
55ada48
Compare
Awesome, good stuff!! 🎉 🎉
In-between
|
55ada48
to
3e678dd
Compare
No worries, Life > $dayjob > Argo CD. :-) |
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.
Thanks @blakepettersson LGTM , just a nit
@blakepettersson this is still very much on my radar. Leo is swamped, so I'm currently finding a third reviewer just to give it one more pass. |
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.
Thanks a lot for this effort, @blakepettersson !
I was wondering whether we could just change the logic behind the decision making for allowing or denying a destination a little.
I find the allDestinationsMustMatch
toggle a little counter-intuitive. Could we make the decision maybe like follows:
(Any allow pattern matches) AND (none of the deny pattern matches)
I think this would be more intuitive.
WDYT?
+1, I think this would save us an unwieldy config param. |
3e678dd
to
46a6eea
Compare
@jannfis thanks for the review!
That's definitely more intuitive, and simplifies things quite a bit. I've now re-implemented that bit to do just that. I didn't really know how to best document the feature so I suspect that will need some TLC 😃 |
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.
One slight concern, otherwise lgtm!
900aca1
to
f8460cf
Compare
This adds the ability to selectively deny destinations, by prefixing either its `namespace` or `server` with a `!`. Closes argoproj#9464. Signed-off-by: Blake Pettersson <blake.pettersson@gmail.com>
f8460cf
to
945fda9
Compare
@crenshaw-dev @jannfis @rishabh625 does anything else need to be done on this PR? |
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, thanks @blakepettersson!
I'll ping Jann for one last review.
Really hoping to get this on the next release ... "fingers-crossed" |
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!
Thank you @blakepettersson and apologies for the delay in coming back to this!
Awesome @jannfis and @crenshaw-dev, thanks a lot! 🎉 🎉 🎉 🎉 Thanks for approving this, and no worries about any delays 😄 |
Thank you all! |
This adds the ability to selectively deny destinations, by prefixing
either its
namespace
orserver
with a!
. Closes #9464.Note on DCO:
If the DCO action in the integration test fails, one or more of your commits are not signed off. Please click on the Details link next to the DCO action for instructions on how to resolve this.
Checklist:
[ ] I've updated both the CLI and UI to expose my feature, or I plan to submit a second PR with them.