Skip to content

Remove the 'replicas' field from the helm template if not used by user

Alexis Boissiere requested to merge (removed):fix/argocd-keda-conflict into main

What does this MR do?

Remove the 'replicas' field from the helm template if not used by user.

Why was this MR needed?

If you are using Keda to auto-scale your runner, it will modify the 'spec.replicas' of the deployment. That will cause a drift from the manifest known to ArgoCD. Therefore ArgoCD resync the resource. But then Keda retry to update it, and so on.....

By modifing the deployment template, we ensure that unless specified by the user, the replicas field is not present in the helm template, and therefore not watch by ArgoCD. Note that by default, Kubernetes will set de 'spec.replicas' field to 1 if not present.

What's the best way to test this MR?

Do three helm template:

  • One with replicaCount to 1
  • One with replicaCount to 0
  • One with replicaCount to null
Edited by Alexis Boissiere

Merge request reports