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
[YUNIKORN-1647] Dynamic namespace support in admission controller #557
Conversation
Support annotations on a namespace to define processing behaviour in the admission controller. The annotations have preference over the regexp. If no annotations are found fall back on the regexp. If an annotation is found it defines the behaviour and overrides what is defined in the regexp. Annotations to be supported on a namespace: * yunikorn.apache.org/namespace.generateAppId * yunikorn.apache.org/namespace.enableYuniKorn Supported values for the annotation: true and false.
Codecov Report
@@ Coverage Diff @@
## master #557 +/- ##
==========================================
+ Coverage 69.71% 69.94% +0.23%
==========================================
Files 45 46 +1
Lines 7782 7880 +98
==========================================
+ Hits 5425 5512 +87
- Misses 2155 2164 +9
- Partials 202 204 +2
... and 1 file with indirect coverage changes 📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more |
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.
Not entirely thrilled with the "int as tri-state bool" pattern... It just feels ugly. An enum with constants might be cleaner, and easier to follow in the logic. True/False/Maybe. We get type safety that way too.
I'm +1 on the patch overall, but wouldn't mind a different approach for that.
if process != -1 { | ||
return process == 1 |
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.
1 / 0 / -1 are special values, could you name them? A bit difficult to reason about the logic without names, comments help, but it's better if we can follow the code without them.
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 jira to move to an iota: YUNIKORN-1653
+1 on this, naming the values increases readability. |
What is this PR for?
Support annotations on a namespace to define processing behaviour in the admission controller. The annotations have preference over the regexp. If no annotations are found fall back on the regexp. If an annotation is found it defines the behaviour and overrides what is defined in the regexp.
Annotations to be supported on a namespace:
Supported values for the annotation: true and false.
What type of PR is it?
What is the Jira issue?
How should this be tested?
Unit tests are added.