There are multiple articles about GitOps describing how to use ArgoCD with Kustomize to configure multiple clusters or environments. They show a nice way to apply some kustomizations, but when you try you implement it in your organization, you’ll probably face the following “How can I” challenges:
- Dynamically add new clusters?
- Use templating (replace vars) in an easy way?
- Add any custom configuration to any of the clusters?
- Specify the configuration I want to add to each cluster?
Maybe you also read a cool post about creating a kustomize plugin. But organizations don’t want to rely on a custom plugin which is not supported. And the answer to all these questions is a really nice combination: ApplicationSets + Helm + Kustomize.
The big picture of this solution is:
- Create an ApplicationSet which auto generates Helm Applications to configure the clusters
- Leverage Helm templating to define all the configuration templates
- Define conditional blocks in each template to control what templates can be included in which cluster
- Create an ApplicationSet which auto generate kustomize Applications to add any overlay
- Patch, add other configurations using kustomize
Note: Creating only an ApplicationSet with a plugin of kustomize+Helm can be an alternative solution, however that would duplicate the same kustomization overlay to all the Cluster applications. So it’s better to have an ApplicationSet for all the configurations based on templates, and an ApplicationSet for the kustomization for each cluster.
Continue reading: https://cloud.redhat.com/blog/configuring-openshift-cluster-with-applicationsets-using-helmkustomize-and-acm-policies