From e80b4036efc9eb93b84ceca119e0fb883caaaf31 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lukas=20W=C3=B6hrl?= Date: Sat, 10 Feb 2024 16:47:46 +0100 Subject: [PATCH] fix: infer correct shard in statefulset setup --- .../commands/argocd_application_controller.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cmd/argocd-application-controller/commands/argocd_application_controller.go b/cmd/argocd-application-controller/commands/argocd_application_controller.go index 0ff9fa33c82547..2fad58792ad704 100644 --- a/cmd/argocd-application-controller/commands/argocd_application_controller.go +++ b/cmd/argocd-application-controller/commands/argocd_application_controller.go @@ -241,7 +241,7 @@ func NewCommand() *cobra.Command { func getClusterSharding(kubeClient *kubernetes.Clientset, settingsMgr *settings.SettingsManager, shardingAlgorithm string, enableDynamicClusterDistribution bool) sharding.ClusterShardingCache { var replicasCount int // StatefulSet mode and Deployment mode uses different default values for shard number. - defaultShardNumberValue := 0 + defaultShardNumberValue := -1 applicationControllerName := env.StringFromEnv(common.EnvAppControllerName, common.DefaultApplicationControllerName) appControllerDeployment, err := kubeClient.AppsV1().Deployments(settingsMgr.GetNamespace()).Get(context.Background(), applicationControllerName, metav1.GetOptions{}) @@ -252,7 +252,6 @@ func getClusterSharding(kubeClient *kubernetes.Clientset, settingsMgr *settings. if enableDynamicClusterDistribution && appControllerDeployment != nil && appControllerDeployment.Spec.Replicas != nil { replicasCount = int(*appControllerDeployment.Spec.Replicas) - defaultShardNumberValue = -1 } else { replicasCount = env.ParseNumFromEnv(common.EnvControllerReplicas, 0, 0, math.MaxInt32) } @@ -285,6 +284,7 @@ func getClusterSharding(kubeClient *kubernetes.Clientset, settingsMgr *settings. } } } else { + defaultShardNumberValue = 0 log.Info("Processing all cluster shards") } db := db.NewDB(settingsMgr.GetNamespace(), settingsMgr, kubeClient)