Skip to content
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(appset): Implement Plugin Generator #13017

Merged
merged 33 commits into from
Jun 2, 2023

Conversation

binboum
Copy link
Contributor

@binboum binboum commented Mar 27, 2023

ApplicationSet generators are useful for modeling templates using external data sources to deploy applications.

Today, generators have been developed based on the needs of the community, and when a new need arises, it's necessary to modify the Appset codebase.

The proposal here is to have a "plugin" generator that would allow extending the codebase according to specific needs, without having to modify it directly.

It's inspired by the Plugin functionality of Argo Workflows

PR includes:

  • Proposal
  • Generator Plugin ( Matrix, Merge, Webhook are included )
  • Internal library HTTP for generator
  • First draft of documentation

Labs :

Discussions : https://cloud-native.slack.com/archives/C01TSERG0KZ/p1677240673615059 @crenshaw-dev @scrocquesel

Related :

#12429
#12368

Credits @binboum @scrocquesel

Checklist:

  • Either (a) I've created an enhancement proposal and discussed it with the community, (b) this is a bug fix, or (c) this does not need to be in the release notes.
  • The title of the PR states what changed and the related issues number (used for the release note).
  • I've included "Closes [ISSUE #]" or "Fixes [ISSUE #]" in the description to automatically close the associated issue.
  • I've updated both the CLI and UI to expose my feature, or I plan to submit a second PR with them.
  • Does this PR require documentation updates?
  • I've updated documentation as required by this PR.
  • Optional. My organization is added to USERS.md.
  • I have signed off all my commits as required by DCO
  • I have written unit and/or e2e tests for my change. PRs without these are unlikely to be merged.
  • My build is green (troubleshooting builds).
  • My new feature complies with the feature status guidelines.
  • I have added a brief description of why this PR is necessary and/or what this PR solves.

Please see Contribution FAQs if you have questions about your pull-request.

binboum added 10 commits March 27, 2023 06:51
Signed-off-by: Maxence Laude <maxence@laude.pro>
Signed-off-by: Maxence Laude <maxence@laude.pro>
Signed-off-by: Maxence Laude <maxence@laude.pro>
Signed-off-by: Maxence Laude <maxence@laude.pro>
Signed-off-by: Maxence Laude <maxence@laude.pro>
Signed-off-by: Maxence Laude <maxence@laude.pro>
Signed-off-by: Maxence Laude <maxence@laude.pro>
Signed-off-by: Maxence Laude <maxence@laude.pro>
Signed-off-by: Maxence Laude <maxence@laude.pro>
Signed-off-by: Maxence Laude <maxence@laude.pro>
@codecov
Copy link

codecov bot commented Mar 27, 2023

Codecov Report

Patch coverage: 68.26% and project coverage change: +0.20 🎉

Comparison is base (129892b) 49.27% compared to head (1f7ff87) 49.48%.

Additional details and impacted files
@@            Coverage Diff             @@
##           master   #13017      +/-   ##
==========================================
+ Coverage   49.27%   49.48%   +0.20%     
==========================================
  Files         251      256       +5     
  Lines       43541    43847     +306     
==========================================
+ Hits        21455    21697     +242     
- Misses      19951    19988      +37     
- Partials     2135     2162      +27     
Impacted Files Coverage Δ
...cationset/services/internal/http/client_options.go 0.00% <0.00%> (ø)
.../apis/application/v1alpha1/applicationset_types.go 28.23% <0.00%> (-0.34%) ⬇️
applicationset/generators/merge.go 53.20% <50.00%> (-0.05%) ⬇️
applicationset/utils/utils.go 79.00% <50.00%> (+7.98%) ⬆️
applicationset/services/plugin/plugin_service.go 60.00% <60.00%> (ø)
applicationset/services/internal/http/client.go 62.50% <62.50%> (ø)
controller/state.go 67.98% <66.66%> (ø)
applicationset/generators/plugin.go 75.52% <75.52%> (ø)
applicationset/generators/matrix.go 77.86% <100.00%> (+0.36%) ⬆️
applicationset/services/plugin/utils.go 100.00% <100.00%> (ø)
... and 2 more

... and 1 file with indirect coverage changes

☔ View full report in Codecov by Sentry.
📢 Do you have feedback about the report comment? Let us know in this issue.

@crenshaw-dev crenshaw-dev changed the title feat: Implement Plugin Generator feat(appset): Implement Plugin Generator Mar 29, 2023
Signed-off-by: Sébastien Crocquesel <88554524+scrocquesel@users.noreply.github.com>
@crenshaw-dev
Copy link
Member

@binboum Intuit has an internal hackathon 3 weeks from now where I plan to build a POC for this on an internal use case. Looking forward to helping move this PR forward!

@binboum
Copy link
Contributor Author

binboum commented Apr 23, 2023

@binboum Intuit has an internal hackathon 3 weeks from now where I plan to build a POC for this on an internal use case. Looking forward to helping move this PR forward!

Hello @crenshaw-dev

On our side, the PR is functional technically, we kept it in draft because we wanted to have a feedback on the architecture discussed with the proposal, but in fact, it is functional and tested.

What we have to push now is the documentation, but we were waiting for a return from you :)

docs(plugin-generator): minor improvments
@crenshaw-dev
Copy link
Member

@binboum we're going to start a PoC Monday. :-)

@crenshaw-dev
Copy link
Member

End of day 1: already have a plugin set up querying an internal API to generate our Argo Rollouts deployment apps. It was super easy. I expect to be able to open a PR against this one with changes we've discussed above, to save y'all some coding. :-)

@crenshaw-dev
Copy link
Member

Code as promised: binboum#2

@crenshaw-dev
Copy link
Member

Do we / should we hot-load plugin configmap changes?

@scrocquesel
Copy link
Contributor

Do we / should we hot-load plugin configmap changes?

AFAIR, yes, the http client is recreated at reconcile time from the config map which is cached with an informer. @binboum do you confirm that ?

Regarding "should we", secrets/secret refs/appset are hot reloaded so I guess admins expect the conf to be hot reloaded and so does the plugin config map.

@crenshaw-dev
Copy link
Member

@binboum I made a few more changes on my PR. Can you review/merge? binboum#2

crenshaw-dev and others added 2 commits May 19, 2023 17:05
* changes

Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com>

* fix docs

Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com>

* wrap output

Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com>

* fix test

Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com>

* fix tests

Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com>

* nested parameters

Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com>

* simplify

Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com>

* docs

Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com>

---------

Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com>
@binboum binboum force-pushed the feature/plugin-generator branch from 636ac86 to f4d7a38 Compare May 25, 2023 00:04
USERS.md Outdated Show resolved Hide resolved
binboum and others added 9 commits May 26, 2023 21:43
Signed-off-by: Maxence Laude <maxence@laude.pro>
* more changes

Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com>

* clearer docs

Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com>

* abstract

Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com>

* naming

Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com>

* revert accidental change

Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com>

* ugh

Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com>

* fix accidental renames

Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com>

---------

Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com>
Signed-off-by: Maxence Laude <maxence@laude.pro>
Signed-off-by: Maxence Laude <maxence@laude.pro>
Signed-off-by: Maxence Laude <maxence@laude.pro>
Signed-off-by: Maxence Laude <maxence@laude.pro>
Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com>
Signed-off-by: Maxence Laude <maxence@laude.pro>
* fix plugin generator nil panic

Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com>

* input.parameters

Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com>

---------

Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com>
@binboum binboum force-pushed the feature/plugin-generator branch from 2b6acb9 to 264fcd4 Compare May 26, 2023 19:44
binboum and others added 4 commits May 26, 2023 21:48
* change param structure

Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com>

* nest parameters

Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com>

---------

Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com>
Signed-off-by: Maxence Laude <maxence@laude.pro>
@binboum binboum marked this pull request as ready for review May 30, 2023 19:22
binboum added 5 commits May 30, 2023 21:50
Signed-off-by: Maxence Laude <maxence@laude.pro>
Signed-off-by: Maxence Laude <maxence@laude.pro>
Signed-off-by: Maxence Laude <maxence@laude.pro>
@crenshaw-dev crenshaw-dev merged commit ec2340a into argoproj:master Jun 2, 2023
yyzxw pushed a commit to yyzxw/argo-cd that referenced this pull request Aug 9, 2023
* add internal http package

Signed-off-by: Maxence Laude <maxence@laude.pro>

* add services plugin

Signed-off-by: Maxence Laude <maxence@laude.pro>

* add generator plugin

Signed-off-by: Maxence Laude <maxence@laude.pro>

* adapted matrix && merge generator

Signed-off-by: Maxence Laude <maxence@laude.pro>

* adapted plugin to webhook

Signed-off-by: Maxence Laude <maxence@laude.pro>

* update applicationset controller and types for plugin

Signed-off-by: Maxence Laude <maxence@laude.pro>

* add proposal for applicationset plugin generator

Signed-off-by: Maxence Laude <maxence@laude.pro>

* execute codegen

Signed-off-by: Maxence Laude <maxence@laude.pro>

* First draft of documentation

Signed-off-by: Maxence Laude <maxence@laude.pro>

* Fix wrong expected error on client_test

Signed-off-by: Maxence Laude <maxence@laude.pro>

* docs(plugin-generator): minor improvements

Signed-off-by: Sébastien Crocquesel <88554524+scrocquesel@users.noreply.github.com>

* Improvement

* changes

Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com>

* fix docs

Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com>

* wrap output

Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com>

* fix test

Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com>

* fix tests

Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com>

* nested parameters

Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com>

* simplify

Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com>

* docs

Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com>

---------

Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com>

* Add plugin to GetRequeueAfter function (merge && matrix)

Signed-off-by: Maxence Laude <maxence@laude.pro>

* Improvement : renaming

* more changes

Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com>

* clearer docs

Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com>

* abstract

Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com>

* naming

Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com>

* revert accidental change

Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com>

* ugh

Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com>

* fix accidental renames

Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com>

---------

Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com>

* Fix typo renaming

Signed-off-by: Maxence Laude <maxence@laude.pro>

* Improve docs

Signed-off-by: Maxence Laude <maxence@laude.pro>

* Webhook implementation

Signed-off-by: Maxence Laude <maxence@laude.pro>

* Typo docs

Signed-off-by: Maxence Laude <maxence@laude.pro>

* fix plugin generator nil panic

Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com>

* Add company to USERS.md

Signed-off-by: Maxence Laude <maxence@laude.pro>

* input.parameters

* fix plugin generator nil panic

Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com>

* input.parameters

Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com>

---------

Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com>

* Change param structure

* change param structure

Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com>

* nest parameters

Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com>

---------

Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com>

* Fix conflicts

Signed-off-by: Maxence Laude <maxence@laude.pro>

* Fix docs

Signed-off-by: Maxence Laude <maxence@laude.pro>

* Fix docs

Signed-off-by: Maxence Laude <maxence@laude.pro>

---------

Signed-off-by: Maxence Laude <maxence@laude.pro>
Signed-off-by: Sébastien Crocquesel <88554524+scrocquesel@users.noreply.github.com>
Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com>
Co-authored-by: Sébastien Crocquesel <88554524+scrocquesel@users.noreply.github.com>
Co-authored-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com>
tesla59 pushed a commit to tesla59/argo-cd that referenced this pull request Dec 16, 2023
* add internal http package

Signed-off-by: Maxence Laude <maxence@laude.pro>

* add services plugin

Signed-off-by: Maxence Laude <maxence@laude.pro>

* add generator plugin

Signed-off-by: Maxence Laude <maxence@laude.pro>

* adapted matrix && merge generator

Signed-off-by: Maxence Laude <maxence@laude.pro>

* adapted plugin to webhook

Signed-off-by: Maxence Laude <maxence@laude.pro>

* update applicationset controller and types for plugin

Signed-off-by: Maxence Laude <maxence@laude.pro>

* add proposal for applicationset plugin generator

Signed-off-by: Maxence Laude <maxence@laude.pro>

* execute codegen

Signed-off-by: Maxence Laude <maxence@laude.pro>

* First draft of documentation

Signed-off-by: Maxence Laude <maxence@laude.pro>

* Fix wrong expected error on client_test

Signed-off-by: Maxence Laude <maxence@laude.pro>

* docs(plugin-generator): minor improvements

Signed-off-by: Sébastien Crocquesel <88554524+scrocquesel@users.noreply.github.com>

* Improvement

* changes

Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com>

* fix docs

Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com>

* wrap output

Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com>

* fix test

Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com>

* fix tests

Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com>

* nested parameters

Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com>

* simplify

Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com>

* docs

Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com>

---------

Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com>

* Add plugin to GetRequeueAfter function (merge && matrix)

Signed-off-by: Maxence Laude <maxence@laude.pro>

* Improvement : renaming

* more changes

Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com>

* clearer docs

Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com>

* abstract

Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com>

* naming

Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com>

* revert accidental change

Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com>

* ugh

Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com>

* fix accidental renames

Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com>

---------

Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com>

* Fix typo renaming

Signed-off-by: Maxence Laude <maxence@laude.pro>

* Improve docs

Signed-off-by: Maxence Laude <maxence@laude.pro>

* Webhook implementation

Signed-off-by: Maxence Laude <maxence@laude.pro>

* Typo docs

Signed-off-by: Maxence Laude <maxence@laude.pro>

* fix plugin generator nil panic

Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com>

* Add company to USERS.md

Signed-off-by: Maxence Laude <maxence@laude.pro>

* input.parameters

* fix plugin generator nil panic

Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com>

* input.parameters

Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com>

---------

Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com>

* Change param structure

* change param structure

Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com>

* nest parameters

Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com>

---------

Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com>

* Fix conflicts

Signed-off-by: Maxence Laude <maxence@laude.pro>

* Fix docs

Signed-off-by: Maxence Laude <maxence@laude.pro>

* Fix docs

Signed-off-by: Maxence Laude <maxence@laude.pro>

---------

Signed-off-by: Maxence Laude <maxence@laude.pro>
Signed-off-by: Sébastien Crocquesel <88554524+scrocquesel@users.noreply.github.com>
Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com>
Co-authored-by: Sébastien Crocquesel <88554524+scrocquesel@users.noreply.github.com>
Co-authored-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants