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

Cluster Generator reconciling on cluster secret events #8

Merged
merged 4 commits into from Jul 8, 2020

Conversation

dgoodwin
Copy link
Contributor

@dgoodwin dgoodwin commented Jul 3, 2020

This PR enables the cluster generator to run and locate all cluster secrets with matching labels. The controller now watches for changes to cluster Secrets and reconciles all appsets with a Cluster generator.

- clusters:
selector:
matchLabels:
argocd.argoproj.io/secret-type: cluster
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This example just matches every cluster argo knows about as we're re-using the argo label.

var generator generators.Generator
generator = generators.NewListGenerator()
listGenerator := generators.NewListGenerator()
clusterGenerator := generators.NewClusterGenerator(r.Client)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This portion will conflict with #7 but I can fix up once it merges.

for _, tmpGenerator := range applicationSetInfo.Spec.Generators {
desiredApplications, err := generator.GenerateApplications(&tmpGenerator, &applicationSetInfo)
log.Infof("desiredApplications %+v", desiredApplications)
var apps []argov1alpha1.Application
Copy link
Member

Choose a reason for hiding this comment

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

If we have many kinds of generator, will this increase many if else struct .

should we provide a abstract function to hide these like factory.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Per slack it sounds like perhaps we should instantiate all generators we know of, then call each with the AppSet, and let it return us the list of Applications for every item in the list that matches.

Although we should probably discuss if it makes sense to have multiple generators in one AppSet at some point, I'm a little worried that'll never be used due to the nature of the templating and the available params being different.

Should we defer this and followup PR once we know what to do?

Copy link
Member

Choose a reason for hiding this comment

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

yes. fine

@xianlubird xianlubird merged commit 4057235 into argoproj:master Jul 8, 2020
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.

None yet

2 participants