From e5425a5ccd691e10844f1f2f1d69a1bd8400599d Mon Sep 17 00:00:00 2001 From: Jordan Rodgers Date: Fri, 2 Aug 2024 11:13:28 -0700 Subject: [PATCH] fix param ordering Signed-off-by: Jordan Rodgers --- controllers/rediscluster_controller.go | 4 ++-- controllers/redisreplication_controller.go | 2 +- k8sutils/statefulset.go | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/controllers/rediscluster_controller.go b/controllers/rediscluster_controller.go index 374d3791f..2e4e6b489 100644 --- a/controllers/rediscluster_controller.go +++ b/controllers/rediscluster_controller.go @@ -121,7 +121,7 @@ func (r *RedisClusterReconciler) Reconcile(ctx context.Context, req ctrl.Request return intctrlutil.RequeueWithError(err, reqLogger, "") } - if r.IsStatefulSetReady(ctx, r.K8sClient, instance, instance.Name+"-leader", instance.Namespace) { + if r.IsStatefulSetReady(ctx, r.K8sClient, instance, instance.Namespace, instance.Name+"-leader") { // Mark the cluster status as initializing if there are no follower nodes if (instance.Status.ReadyLeaderReplicas == 0 && instance.Status.ReadyFollowerReplicas == 0) || instance.Status.ReadyFollowerReplicas != followerReplicas { @@ -147,7 +147,7 @@ func (r *RedisClusterReconciler) Reconcile(ctx context.Context, req ctrl.Request } } - if !(r.IsStatefulSetReady(ctx, r.K8sClient, instance, instance.Name+"-leader", instance.Namespace) && r.IsStatefulSetReady(ctx, r.K8sClient, instance, instance.Name+"-follower", instance.Namespace)) { + if !(r.IsStatefulSetReady(ctx, r.K8sClient, instance, instance.Namespace, instance.Name+"-leader") && r.IsStatefulSetReady(ctx, r.K8sClient, instance, instance.Namespace, instance.Name+"-follower")) { return intctrlutil.RequeueAfter(reqLogger, time.Second*10, "Redis cluster is not ready") } diff --git a/controllers/redisreplication_controller.go b/controllers/redisreplication_controller.go index 20fee1e59..76e9d020b 100644 --- a/controllers/redisreplication_controller.go +++ b/controllers/redisreplication_controller.go @@ -57,7 +57,7 @@ func (r *RedisReplicationReconciler) Reconcile(ctx context.Context, req ctrl.Req if err != nil { return intctrlutil.RequeueWithError(err, reqLogger, "") } - if !r.IsStatefulSetReady(ctx, r.K8sClient, instance, instance.Name, instance.Namespace) { + if !r.IsStatefulSetReady(ctx, r.K8sClient, instance, instance.Namespace, instance.Name) { return intctrlutil.RequeueAfter(reqLogger, time.Second*10, "") } diff --git a/k8sutils/statefulset.go b/k8sutils/statefulset.go index d1f115d41..e28cc303f 100644 --- a/k8sutils/statefulset.go +++ b/k8sutils/statefulset.go @@ -26,7 +26,7 @@ import ( ) type StatefulSet interface { - IsStatefulSetReady(ctx context.Context, client kubernetes.Interface, cr runtime.Object, name, namespace string) bool + IsStatefulSetReady(ctx context.Context, client kubernetes.Interface, cr runtime.Object, namespace, name string) bool } type StatefulSetService struct { @@ -42,7 +42,7 @@ func NewStatefulSetService(kubeClient kubernetes.Interface, log logr.Logger) *St } } -func (s *StatefulSetService) IsStatefulSetReady(ctx context.Context, client kubernetes.Interface, cr runtime.Object, namespace string, name string) bool { +func (s *StatefulSetService) IsStatefulSetReady(ctx context.Context, client kubernetes.Interface, cr runtime.Object, namespace, name string) bool { var ( partition = 0 replicas = 1