@@ -377,6 +377,17 @@ func (r *Reconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Resu
377377}
378378
379379func (r * Reconciler ) reloadTLS (ctx context.Context , rc * rcvb2.RedisCluster , leaderReplicas , followerReplicas int ) error {
380+ secretName := rc .Spec .TLS .Secret .SecretName
381+ var tlsSecret corev1.Secret
382+
383+ if err := r .Get (ctx , client.ObjectKey {Name : secretName , Namespace : rc .Namespace }, & tlsSecret ); err != nil {
384+ return fmt .Errorf ("failed to get TLS secret %s/%s: %w" , rc .Namespace , rc .Name , err )
385+ }
386+
387+ if rc .Status .TLSLastVersion == tlsSecret .ResourceVersion {
388+ return nil
389+ }
390+
380391 log .FromContext (ctx ).Info ("hotReloadTLS: reloading TLS configuration" )
381392 for i := 0 ; i < followerReplicas ; i ++ {
382393 err := k8sutils .HotReloadTLS (ctx , r .K8sClient , rc , rc .Name + "-follower-" + strconv .Itoa (i ))
@@ -390,7 +401,20 @@ func (r *Reconciler) reloadTLS(ctx context.Context, rc *rcvb2.RedisCluster, lead
390401 return fmt .Errorf ("RedisCluster controller -> failed reloading tls in leader: %w" , err )
391402 }
392403 }
393- log .FromContext (ctx ).Info ("hotReloadTLS: reloaded TLS configuration has been completed" )
404+
405+ // update status
406+ err := r .updateStatus (ctx , rc , rcvb2.RedisClusterStatus {
407+ State : rc .Status .State ,
408+ Reason : rc .Status .Reason ,
409+ ReadyFollowerReplicas : rc .Status .ReadyFollowerReplicas ,
410+ ReadyLeaderReplicas : rc .Status .ReadyLeaderReplicas ,
411+ TLSLastVersion : tlsSecret .ResourceVersion ,
412+ })
413+ if err != nil {
414+ log .FromContext (ctx ).Error (err , "update status error" )
415+ }
416+
417+ log .FromContext (ctx ).Info ("hotReloadTLS: reload TLS configuration has been completed" )
394418 return nil
395419}
396420
0 commit comments