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: make discovery field optional in plugins #12073
feat: make discovery field optional in plugins #12073
Conversation
Signed-off-by: Soumya Ghosh Dastidar <gdsoumya@gmail.com>
Signed-off-by: Soumya Ghosh Dastidar <gdsoumya@gmail.com>
Signed-off-by: Soumya Ghosh Dastidar <gdsoumya@gmail.com>
Codecov ReportBase: 47.43% // Head: 47.42% // Decreases project coverage by
Additional details and impacted files@@ Coverage Diff @@
## master #12073 +/- ##
==========================================
- Coverage 47.43% 47.42% -0.01%
==========================================
Files 246 246
Lines 41826 41823 -3
==========================================
- Hits 19840 19836 -4
- Misses 19990 19992 +2
+ Partials 1996 1995 -1
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. ☔ View 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.
I think this PR goes just a git too far. I think we should make the discovery field optional. But when it's present, I think it should have to match in addition to the name field matching.
This will prevent 2.6 from introducing a new way for users to bypass discovery rules. This is important because Argo CD operators might be using discovery rules to enforce important patterns.
There's no way to know if the discovery field is set or not so we just call the matchRepo rpc and try to check if the repo matches but if discovery is not specified it will automatically return false or no match for the request. I think that's probably fine because we do not break any existing implementations/patterns as previously discovery was compulsory so it's always there and users would probably not be putting plugin names in the app spec that won't work as the ui would have blocked it in the old version. WDYT? |
We can maybe update the matchRepo rpc to return one more bool to specify if the discovery was specified or not and always make the matchRepo call and on the response, if discovery is false we continue with the specified plugin. |
I'm worried specifically about the cases where
I think instead of defaulting to false, we can default to true. If no discovery rules are set, |
I see so the default behavior can be if discovery is not specified it will match all repos. That sounds good. Will make the change and update the docs to reflect the same. |
On second thought @crenshaw-dev do you think this would cause issues with auto-discovery? The reason I set it to not match by default was that I didn't want it to randomly match any repo that uses auto-discovery. I think that's more of a breaking case because older config using auto-discovery might see modified behavior after we enable this. |
We would default to matching if and only if discovery is not set. As you mentioned earlier, every user of sidecar CMPs currently has discovery set, so it shouldn't be a breaking change. If discovery is set, we'll respect the discovery rules. |
Yes but would that not break existing apps? for eg. if a user now creates a plugin with no discovery rules and because of how the plugin is named it get's more priority in the auto-discovery list then older apps that depended on auto-discovery would start matching with this plugin and because the plugin will always match with the repo the generated resources for those apps could be altered ? This is how we get the list of plugins in auto-discovery mode :
And the ordering of this is influenced by the name of the plugin, so a new plugin with higher precedence here would alter older apps using auto discovery. |
I understand the issue now. Good catch. I think to satisfy all use cases, we need to modify the rpc so we can differentiate between "doesn't match because discovery" and "doesn't match because there is no discovery". |
Signed-off-by: Soumya Ghosh Dastidar <gdsoumya@gmail.com>
Signed-off-by: Soumya Ghosh Dastidar <gdsoumya@gmail.com>
Signed-off-by: Soumya Ghosh Dastidar <gdsoumya@gmail.com>
Signed-off-by: Soumya Ghosh Dastidar <gdsoumya@gmail.com>
Signed-off-by: Soumya Ghosh Dastidar <gdsoumya@gmail.com>
Signed-off-by: Soumya Ghosh Dastidar <gdsoumya@gmail.com>
Thanks, @gdsoumya! |
* feat: make discovery field optional in plugins Signed-off-by: Soumya Ghosh Dastidar <gdsoumya@gmail.com> * docs: updated plugin docs Signed-off-by: Soumya Ghosh Dastidar <gdsoumya@gmail.com> * docs: updated plugin docs Signed-off-by: Soumya Ghosh Dastidar <gdsoumya@gmail.com> * feat: updated discovery check for named plugins Signed-off-by: Soumya Ghosh Dastidar <gdsoumya@gmail.com> * fix: fixed unit tests Signed-off-by: Soumya Ghosh Dastidar <gdsoumya@gmail.com> * feat: simplified code Signed-off-by: Soumya Ghosh Dastidar <gdsoumya@gmail.com> * fix: close connection on error Signed-off-by: Soumya Ghosh Dastidar <gdsoumya@gmail.com> * feat: simplify code Signed-off-by: Soumya Ghosh Dastidar <gdsoumya@gmail.com> * feat: add named return values Signed-off-by: Soumya Ghosh Dastidar <gdsoumya@gmail.com> --------- Signed-off-by: Soumya Ghosh Dastidar <gdsoumya@gmail.com>
Cherry-picked onto release-2.6 for 2.6.0-rc8 or 2.6.0 GA, whichever comes first. :-) |
* feat: make discovery field optional in plugins Signed-off-by: Soumya Ghosh Dastidar <gdsoumya@gmail.com> * docs: updated plugin docs Signed-off-by: Soumya Ghosh Dastidar <gdsoumya@gmail.com> * docs: updated plugin docs Signed-off-by: Soumya Ghosh Dastidar <gdsoumya@gmail.com> * feat: updated discovery check for named plugins Signed-off-by: Soumya Ghosh Dastidar <gdsoumya@gmail.com> * fix: fixed unit tests Signed-off-by: Soumya Ghosh Dastidar <gdsoumya@gmail.com> * feat: simplified code Signed-off-by: Soumya Ghosh Dastidar <gdsoumya@gmail.com> * fix: close connection on error Signed-off-by: Soumya Ghosh Dastidar <gdsoumya@gmail.com> * feat: simplify code Signed-off-by: Soumya Ghosh Dastidar <gdsoumya@gmail.com> * feat: add named return values Signed-off-by: Soumya Ghosh Dastidar <gdsoumya@gmail.com> --------- Signed-off-by: Soumya Ghosh Dastidar <gdsoumya@gmail.com> Signed-off-by: schakrad <chakradari.sindhu@gmail.com>
Signed-off-by: Soumya Ghosh Dastidar gdsoumya@gmail.com
Fixes #12027
This PR makes discovery field in cmpv2 plugin spec optional and removes discovery check for plugins when plugin name is explicitly specified in the app.
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: