argo-cd icon indicating copy to clipboard operation
argo-cd copied to clipboard

feat(appset): Support more than two child generators for matrix generator

Open huynhsontung opened this issue 1 year ago • 20 comments

Closes #14182

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).
  • [ ] The title of the PR conforms to the Toolchain Guide
  • [x] 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.
  • [x] Does this PR require documentation updates?
  • [x] I've updated documentation as required by this PR.
  • [ ] Optional. My organization is added to USERS.md.
  • [x] I have signed off all my commits as required by DCO
  • [x] I have written unit and/or e2e tests for my change. PRs without these are unlikely to be merged.
  • [x] 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.

huynhsontung avatar Jun 23 '23 19:06 huynhsontung

I feel like we should have a controller-level configurable max for number of children in a matrix generator. We're close to having ApplicationSets manageable by non-admins, and it would be good to have a way for admins to mitigate denial of service via bonkers-level matrix generators.

crenshaw-dev avatar Jun 23 '23 19:06 crenshaw-dev

Codecov Report

Attention: Patch coverage is 68.75000% with 10 lines in your changes missing coverage. Please review.

Project coverage is 44.93%. Comparing base (71e1f30) to head (96fb14e). Report is 29 commits behind head on master.

:exclamation: Current head 96fb14e differs from pull request most recent head 6b83263

Please upload reports for the commit 6b83263 to get more accurate results.

Files Patch % Lines
applicationset/generators/matrix.go 78.57% 3 Missing and 3 partials :warning:
...t-controller/commands/applicationset_controller.go 0.00% 4 Missing :warning:
Additional details and impacted files
@@           Coverage Diff           @@
##           master   #14189   +/-   ##
=======================================
  Coverage   44.92%   44.93%           
=======================================
  Files         355      355           
  Lines       47889    47896    +7     
=======================================
+ Hits        21516    21521    +5     
- Misses      23569    23571    +2     
  Partials     2804     2804           

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

codecov[bot] avatar Jun 23 '23 23:06 codecov[bot]

@crenshaw-dev Sounds reasonable. There is no precedent for generator configuration at the controller level. How about a controller flag called max-matrix-children with the default of 0 for an unlimited number of children? Unless we want it configurable on the fly through a ConfigMap.

huynhsontung avatar Jun 23 '23 23:06 huynhsontung

I'm wavering between default of 2 (no change of behavior for people upgrading) and default of 0. I think default 2 makes sense if we want people to be able to provide users create/update privileges on appsets as soon as we button down the remaining admin-only features.

We could make it a controller flag/env var and let users set it via argocd-cmd-params-cm.

crenshaw-dev avatar Jun 23 '23 23:06 crenshaw-dev

Do we allow a value of 1? The code does handle this case but intuitively it doesn't really make sense. If not, any value less than 2 will be parsed as unlimited.

Edit: There is already an error when using a matrix generator with only 1 child. Any value less than 2 will be unlimited then.

huynhsontung avatar Jun 24 '23 00:06 huynhsontung

@crenshaw-dev I have made the max matrix children configurable through NewMatrixGenerator() with the default value of 2. Let me know if there is anything that needs changing before I move on to updating the docs.

huynhsontung avatar Jun 24 '23 04:06 huynhsontung

Sounds reasonable! I'd say carry on with docs.

crenshaw-dev avatar Jun 26 '23 13:06 crenshaw-dev

@crenshaw-dev I updated the manifest to allow setting the limit in the config map and updated the docs.

huynhsontung avatar Jul 01 '23 19:07 huynhsontung

I had to change those messages a bit to also reflect #14573

huynhsontung avatar Aug 24 '23 07:08 huynhsontung

@crenshaw-dev Are there any updates on this PR? I can resolve the merge conflicts if it's ready to merge.

huynhsontung avatar Nov 27 '23 21:11 huynhsontung

Hello, is this still expected to be merged for argocd 2.9?

ptr1120 avatar Jan 26 '24 06:01 ptr1120

Hello, is this still expected to be merged for argocd 2.9?

Hello, you mean 2.10 ?

llavaud avatar Jan 26 '24 08:01 llavaud

any update on this ?

ehsan310 avatar Mar 05 '24 15:03 ehsan310

Any update here?

aburan28 avatar Mar 14 '24 05:03 aburan28

What's the ETA on this ?

jdeus avatar Mar 18 '24 17:03 jdeus

Hello, can we still expect that this support of >2 matrix steps will be reviewed and merged as stated in the roadmap. Since I am having a need for 3 steps and the parameter transfer between nested matrix steps has issues, I am still searching for any solution.

ptr1120 avatar Mar 27 '24 06:03 ptr1120

@crenshaw-dev I have made the max matrix children configurable through NewMatrixGenerator() with the default value of 2. Let me know if there is anything that needs changing before I move on to updating the docs.

Can this default be changed to a higher value? Maybe 100 or 10?

sathieu avatar May 16 '24 11:05 sathieu

So are we waiting another year here ?

jdeus avatar May 16 '24 15:05 jdeus

Can this default be changed to a higher value? Maybe 100 or 10?

@sathieu I chose this default value of 2 to mirror the same limit of the current version of the matrix generator. I'm fine with having a higher value or even unlimited as a default.

huynhsontung avatar May 16 '24 17:05 huynhsontung

Would this not be easier solved using a Plugin Generator? One can then programatically compose the generators the way they're required.

mihaigalos avatar May 17 '24 06:05 mihaigalos

@crenshaw-dev do you still have concerns about this PR?

blakepettersson avatar Jun 11 '24 20:06 blakepettersson

Dismissing my review as stale, since I don't have time to re-review right now. At a glance, no major concerns.

crenshaw-dev avatar Jul 02 '24 15:07 crenshaw-dev

@crenshaw-dev any updates on merging and releasing this feature?

steve-todorov avatar Aug 04 '24 17:08 steve-todorov