@@ -61,7 +61,7 @@ func add(mgr manager.Manager, r reconcile.Reconciler) error {
6161
6262 pred := predicate.Funcs {
6363 UpdateFunc : func (e event.UpdateEvent ) bool {
64- log .WithValues ("namespace" , e .MetaNew .GetNamespace (), "name" , e .MetaNew .GetName ()).Info ("Call UpdateFunc" )
64+ log .WithValues ("namespace" , e .MetaNew .GetNamespace (), "name" , e .MetaNew .GetName ()).V ( 5 ). Info ("Call UpdateFunc" )
6565 // Ignore updates to CR status in which case metadata.Generation does not change
6666 if e .MetaOld .GetGeneration () != e .MetaNew .GetGeneration () {
6767 log .WithValues ("namespace" , e .MetaNew .GetNamespace (), "name" , e .MetaNew .GetName ()).Info ("Generation change return true" )
@@ -171,7 +171,7 @@ func (r *ReconcileDistributedRedisCluster) Reconcile(request reconcile.Request)
171171 return reconcile.Result {}, err
172172 }
173173
174- status := buildClusterStatus (clusterInfos , redisClusterPods .Items )
174+ status := buildClusterStatus (clusterInfos , redisClusterPods .Items , & instance . Status )
175175 reqLogger .V (4 ).Info ("buildClusterStatus" , "status" , status )
176176 r .updateClusterIfNeed (instance , status )
177177
@@ -188,35 +188,8 @@ func (r *ReconcileDistributedRedisCluster) Reconcile(request reconcile.Request)
188188 return reconcile.Result {}, Redis .Wrap (err , "GetClusterInfos" )
189189 }
190190 }
191- newStatus := buildClusterStatus (newClusterInfos , redisClusterPods .Items )
191+ newStatus := buildClusterStatus (newClusterInfos , redisClusterPods .Items , & instance . Status )
192192 SetClusterOK (newStatus , "OK" )
193193 r .updateClusterIfNeed (instance , newStatus )
194194 return reconcile.Result {RequeueAfter : requeueEnsure }, nil
195- //// Define a new Pod object
196- //pod := newPodForCR(instance)
197- //
198- //// Set DistributedRedisCluster instance as the owner and controller
199- //if err := controllerutil.SetControllerReference(instance, pod, r.scheme); err != nil {
200- // return reconcile.Result{}, err
201- //}
202-
203- // Check if this Pod already exists
204- //found := &corev1.Pod{}
205- //err = r.client.Get(context.TODO(), types.NamespacedName{Name: pod.Name, Namespace: pod.Namespace}, found)
206- //if err != nil && errors.IsNotFound(err) {
207- // reqLogger.Info("Creating a new Pod", "Pod.Namespace", pod.Namespace, "Pod.Name", pod.Name)
208- // err = r.client.Create(context.TODO(), pod)
209- // if err != nil {
210- // return reconcile.Result{}, err
211- // }
212- //
213- // // Pod created successfully - don't requeue
214- // return reconcile.Result{}, nil
215- //} else if err != nil {
216- // return reconcile.Result{}, err
217- //}
218-
219- // Pod already exists - don't requeue
220- //reqLogger.Info("Skip reconcile: Pod already exists", "Pod.Namespace", found.Namespace, "Pod.Name", found.Name)
221- //return reconcile.Result{}, nil
222195}
0 commit comments