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(argo-cd): Expose cluster's project as a label #2968

Closed

Conversation

nbarrientos
Copy link
Contributor

@nbarrientos nbarrientos commented Oct 7, 2024

Given that Argo CD's ApplicationSet cluster generator allows selecting clusters using arbitrary labels, it'd be useful for operators to have the clusters' project available as label to for instance easily deploy a single application to all the clusters of a given project.

More info: #2949

Checklist:

  • I have bumped the chart version according to versioning
  • I have updated the documentation according to documentation
  • I have updated the chart changelog with all the changes that come with this pull request according to changelog.
  • Any new values are backwards compatible and/or have sensible default.
  • I have signed off all my commits as required by DCO.
  • My build is green (troubleshooting builds).

Given that Argo CD's ApplicationSet cluster generator allows selecting
clusters using arbitrary labels, it'd be useful for operators to have
the clusters' project available as label to for instance easily deploy
a single application to all the clusters of a given project.

More info: argoproj#2949

Signed-off-by: Nacho Barrientos <[email protected]>
@mkilchhofer
Copy link
Member

Are you aware that it is already possible today?

  clusterCredentials: {}
    # mycluster:
    #   server: https://mycluster.example.com
    #   labels: {}                               # <-- see here
    #   annotations: {}
    #   config:
    #     bearerToken: "<authentication token>"
    #     tlsClientConfig:
    #       insecure: false
    #       caData: "<base64 encoded certificate>"

@nbarrientos
Copy link
Contributor Author

Are you aware that it is already possible today?

Thanks for taking a look. Yes, I am, but this approach requires setting it in two places, the project itself and then the label. With this patch it's only set in one place and propagated automatically, avoiding duplication and possible misalignments upon (bogus) configuration changes. This is the added value of this patch :)

@mkilchhofer
Copy link
Member

mkilchhofer commented Oct 7, 2024

Thank you for elaborate your background.

Can you point me to a resource where the key of the label is documented? :)
I did not find something in the docs of Argo CD.

I am also curious why we should add the label argocd.argoproj.io/project on all project scoped clusters (where customers do not use AppSet for example).

@nbarrientos
Copy link
Contributor Author

nbarrientos commented Oct 7, 2024

Hi,

Hehe, I have to confess that made up the resource label key, it's indeed not listed here but hey, in my defense it's just an arbitrary label :) I used the argocd.argoproj.io/ namespace as this information is inherent to Argo CD so it kinda made sense to me.

Setting it to all clusters could be eventually beneficial when filtering resources using kubectl's label selectors, but being frank at least for me the main use-case is to combine this with AppilicationsSets. I could make the automatic labeling optional (even the label key customizable) so it's not added by default (in view of users not using ApplicationsSets as you're mentioning) if that increased the chances of having this merged.

Thanks again.

@nbarrientos
Copy link
Contributor Author

Would a chart-specific label make this more appealing, perhaps? 👼

Copy link

This pull request has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants