Cluster Generator reconciling on cluster secret events #8
Conversation
- clusters: | ||
selector: | ||
matchLabels: | ||
argocd.argoproj.io/secret-type: cluster |
There was a problem hiding this comment.
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) |
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes. fine
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.