Skip to content
This repository has been archived by the owner on Oct 12, 2023. It is now read-only.

Cluster generator cannot select local cluster #116

Merged
merged 4 commits into from Feb 16, 2021

Conversation

jgwest
Copy link
Member

@jgwest jgwest commented Feb 4, 2021

This PR switches the behaviour of the cluster generator, such that it will now target both local AND non-local clusters (eg those with secrets defined).

If you wish to use the existing behaviour -- that is, targeting non-local clusters only with your Application -- then use a cluster selector with labels, for example:

  generators:
  - clusters:
      selector:
        matchLabels:
          argocd.argoproj.io/secret-type: cluster

This selector will not match local clusters, since the local cluster does not have a secret (and thus does not have labels on that secret). Any cluster selector that specifies on a label will automatically exclude local clusters.

If you wish to target both local and non-local cluster, using labels, you can create a secret for the local cluster as per the parent issue.

I'm using the existing Argo CD util/db package logic (pulled in directly from that package) to identify local/non-local clusters.

Additional tweaks

Clean up cluster unit tests

  • add test names
  • remove base64 encoding on Data field (it should be decoded)
  • general cleanup (add fields to test struct)

Clean up cluster E2E tests:

  • move cluster e2e tests into their file
  • miscellaneous test fixture tweaks

Fixes #35

@jgwest jgwest marked this pull request as ready for review February 4, 2021 21:19
pkg/generators/cluster.go Outdated Show resolved Hide resolved
pkg/generators/cluster.go Show resolved Hide resolved
@jgwest jgwest merged commit 352857a into argoproj:master Feb 16, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Cluster generator cannot select local cluster
2 participants