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): add 'project' to the Cluster Generator params #20338

Conversation

CefBoud
Copy link
Contributor

@CefBoud CefBoud commented Oct 10, 2024

Closes #18814

Description

This PR adds the project parameter to the Cluster generator. If the cluster doesn't have a project field within its Secret, the param's value defaults to default.

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
  • 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.
  • 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.
  • Optional. My organization is added to USERS.md.
  • Optional. For bug fixes, I've indicated what older releases this fix should be cherry-picked into (this may or may not happen depending on risk/complexity).

Copy link

bunnyshell bot commented Oct 10, 2024

❌ Preview Environment deleted from Bunnyshell

Available commands (reply to this comment):

  • 🚀 /bns:deploy to deploy the environment

@CefBoud CefBoud marked this pull request as ready for review October 10, 2024 23:26
@CefBoud CefBoud requested review from a team as code owners October 10, 2024 23:26
@CefBoud CefBoud force-pushed the feat/add-project-to-cluster-generator-params branch 2 times, most recently from f919e1c to a6a1fa1 Compare October 11, 2024 00:05
Copy link

codecov bot commented Oct 11, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 56.00%. Comparing base (29c59ab) to head (8a6e31d).
Report is 7 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master   #20338      +/-   ##
==========================================
+ Coverage   55.96%   56.00%   +0.03%     
==========================================
  Files         322      322              
  Lines       44717    44723       +6     
==========================================
+ Hits        25025    25046      +21     
+ Misses      17095    17083      -12     
+ Partials     2597     2594       -3     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Member

@crenshaw-dev crenshaw-dev left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like the idea, but I think we should default to an empty string or nil instead of default.

Clusters can be either project-scoped or unscoped. If the project field isn't populated, it's unscoped. project: default to me implies "scoped to the default project".

@CefBoud
Copy link
Contributor Author

CefBoud commented Oct 11, 2024

@crenshaw-dev Thanks for your review.

My concern with setting the project to nil or an empty string is that for applications generated from unscoped clusters, using project: '{{.project}}' would fail validation. The reason is that the value must correspond to an existing project. If the intended behavior is that an application’s project matches the cluster’s project, one could argue that it should default to the default project for unscoped clusters, as that would be the only valid option.

If the validation failure is acceptable, I am happy to make the change.

@CefBoud CefBoud requested a review from crenshaw-dev October 11, 2024 14:26
@crenshaw-dev
Copy link
Member

I think if the user's intent is to use the default project for unscoped clusters, they could use project: '{{ default "default" .project }}'. If their intent is to exclude unscoped clusters, I think it would be possible to use a matchExpressions post selector to exclude them. Probably would be a good idea to validate.

Signed-off-by: cef <moncef.abboud95@gmail.com>
@CefBoud CefBoud force-pushed the feat/add-project-to-cluster-generator-params branch from a6a1fa1 to 8a6e31d Compare October 11, 2024 16:06
@CefBoud
Copy link
Contributor Author

CefBoud commented Oct 11, 2024

@crenshaw-dev Thank you for the explanation. It makes perfect sense. I made the changes.

Copy link
Member

@crenshaw-dev crenshaw-dev left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@crenshaw-dev crenshaw-dev enabled auto-merge (squash) October 11, 2024 16:32
@crenshaw-dev crenshaw-dev merged commit 27eebaa into argoproj:master Oct 11, 2024
26 checks passed
@CefBoud CefBoud deleted the feat/add-project-to-cluster-generator-params branch October 11, 2024 17:55
austin5219 pushed a commit to austin5219/argo-cd that referenced this pull request Oct 16, 2024
…#20338)

Signed-off-by: cef <moncef.abboud95@gmail.com>
Signed-off-by: austin5219 <3936059+austin5219@users.noreply.github.com>
adriananeci pushed a commit to adriananeci/argo-cd that referenced this pull request Dec 4, 2024
…#20338)

Signed-off-by: cef <moncef.abboud95@gmail.com>
Signed-off-by: Adrian Aneci <aneci@adobe.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.

Application Sets using project parameter from cluster secret
2 participants