@@ -362,6 +362,17 @@ func (r *Reconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Resu
362362}
363363
364364func (r * Reconciler ) reloadTLS (ctx context.Context , rc * rcvb2.RedisCluster , leaderReplicas , followerReplicas int ) error {
365+ secretName := rc .Spec .TLS .Secret .SecretName
366+ var tlsSecret corev1.Secret
367+
368+ if err := r .Get (ctx , client.ObjectKey {Name : secretName , Namespace : rc .Namespace }, & tlsSecret ); err != nil {
369+ return fmt .Errorf ("failed to get TLS secret %s/%s: %w" , rc .Namespace , rc .Name , err )
370+ }
371+
372+ if rc .Status .TLSLastVersion == tlsSecret .ResourceVersion {
373+ return nil
374+ }
375+
365376 log .FromContext (ctx ).Info ("hotReloadTLS: reloading TLS configuration" )
366377 for i := 0 ; i < followerReplicas ; i ++ {
367378 err := k8sutils .HotReloadTLS (ctx , r .K8sClient , rc , rc .Name + "-follower-" + strconv .Itoa (i ))
@@ -375,7 +386,20 @@ func (r *Reconciler) reloadTLS(ctx context.Context, rc *rcvb2.RedisCluster, lead
375386 return fmt .Errorf ("RedisCluster controller -> failed reloading tls in leader: %w" , err )
376387 }
377388 }
378- log .FromContext (ctx ).Info ("hotReloadTLS: reloaded TLS configuration has been completed" )
389+
390+ // update status
391+ err := r .updateStatus (ctx , rc , rcvb2.RedisClusterStatus {
392+ State : rc .Status .State ,
393+ Reason : rc .Status .Reason ,
394+ ReadyFollowerReplicas : rc .Status .ReadyFollowerReplicas ,
395+ ReadyLeaderReplicas : rc .Status .ReadyLeaderReplicas ,
396+ TLSLastVersion : tlsSecret .ResourceVersion ,
397+ })
398+ if err != nil {
399+ log .FromContext (ctx ).Error (err , "update status error" )
400+ }
401+
402+ log .FromContext (ctx ).Info ("hotReloadTLS: reload TLS configuration has been completed" )
379403 return nil
380404}
381405
0 commit comments