Fixes empty fields generated in agent manifests #29
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The way the templating for the cluster-agent is defined now, will always create a tolerations, labels and nodeSelector fields regardless if these fields have values defined for them or not. These fields on the final manifest will just be empty.
labels: {} nodeSelector: {} tolerations: []
While this does not cause issues when the agent is deployed directly via Helm (e.g. via helm install) it does cause issues when deployed via ArgoCD. Argo will try and deploy the manifest (generated using helm template) with the empty fields included, but the final manifest on the cluster will omit this fields. As a result, Argo will identify a diff between the desired and applied manifest and try to apply it again. This results in a sync loop which drains resources from the argoCD deployment.
This pull request adds some if statements on the cluster-agent template, and omits these fields if they are undefined in the provided values file.