Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 719512a

Browse files
committedOct 21, 2024·
PR improvements in logging
1 parent 36c6127 commit 719512a

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed
 

‎controllers/ibmpowervsmachine_controller.go

+10-10
Original file line numberDiff line numberDiff line change
@@ -212,27 +212,26 @@ func (r *IBMPowerVSMachineReconciler) handleLoadBalancerPoolMemberConfiguration(
212212
}
213213

214214
func (r *IBMPowerVSMachineReconciler) reconcileNormal(machineScope *scope.PowerVSMachineScope) (ctrl.Result, error) {
215-
ctx := context.Background()
216-
log := ctrl.LoggerFrom(ctx)
217-
machineScope.Info("Reconciling IBMPowerVSMachine")
215+
log := ctrl.LoggerFrom(context.Background())
216+
log.V(3).Info("Reconciling IBMPowerVSMachine")
218217

219218
if !machineScope.Cluster.Status.InfrastructureReady {
220-
machineScope.Info("Cluster infrastructure is not ready yet")
219+
log.V(3).Info("Cluster infrastructure is not ready yet")
221220
conditions.MarkFalse(machineScope.IBMPowerVSMachine, infrav1beta2.InstanceReadyCondition, infrav1beta2.WaitingForClusterInfrastructureReason, capiv1beta1.ConditionSeverityInfo, "")
222221
return ctrl.Result{RequeueAfter: 1 * time.Minute}, nil
223222
}
224223

225224
if machineScope.IBMPowerVSImage != nil {
226225
if !machineScope.IBMPowerVSImage.Status.Ready {
227-
machineScope.Info("IBMPowerVSImage is not ready yet")
226+
log.V(3).Info("IBMPowerVSImage is not ready yet")
228227
conditions.MarkFalse(machineScope.IBMPowerVSMachine, infrav1beta2.InstanceReadyCondition, infrav1beta2.WaitingForIBMPowerVSImageReason, capiv1beta1.ConditionSeverityInfo, "")
229228
return ctrl.Result{RequeueAfter: 1 * time.Minute}, nil
230229
}
231230
}
232231

233232
// Make sure bootstrap data is available and populated.
234233
if machineScope.Machine.Spec.Bootstrap.DataSecretName == nil {
235-
machineScope.Info("Bootstrap data secret reference is not yet available")
234+
log.V(3).Info("Bootstrap data secret reference is not yet available")
236235
conditions.MarkFalse(machineScope.IBMPowerVSMachine, infrav1beta2.InstanceReadyCondition, infrav1beta2.WaitingForBootstrapDataReason, capiv1beta1.ConditionSeverityInfo, "")
237236
return ctrl.Result{RequeueAfter: 1 * time.Minute}, nil
238237
}
@@ -282,7 +281,7 @@ func (r *IBMPowerVSMachineReconciler) reconcileNormal(machineScope *scope.PowerV
282281
return ctrl.Result{}, nil
283282
default:
284283
machineScope.SetNotReady()
285-
machineScope.Info("PowerVS instance state is undefined", "state", *instance.Status, "instance-id", machineScope.GetInstanceID())
284+
log.V(3).Info("PowerVS instance state is undefined", "state", *instance.Status, "instance-id", machineScope.GetInstanceID())
286285
conditions.MarkUnknown(machineScope.IBMPowerVSMachine, infrav1beta2.InstanceReadyCondition, "", "")
287286
}
288287
} else {
@@ -298,17 +297,18 @@ func (r *IBMPowerVSMachineReconciler) reconcileNormal(machineScope *scope.PowerV
298297
return ctrl.Result{}, nil
299298
}
300299
// Register instance with load balancer
301-
machineScope.Info("updating loadbalancer for machine", "name", machineScope.IBMPowerVSMachine.Name)
300+
log.V(3).Info("updating loadbalancer for machine", "name", machineScope.IBMPowerVSMachine.Name)
302301
internalIP := machineScope.GetMachineInternalIP()
303302
if internalIP == "" {
304-
machineScope.Info("Unable to update the LoadBalancer, Machine internal IP not yet set", "machineName", machineScope.IBMPowerVSMachine.Name)
303+
log.V(3).Info("Unable to update the LoadBalancer, Machine internal IP not yet set", "machineName", machineScope.IBMPowerVSMachine.Name)
305304
return ctrl.Result{}, nil
306305
}
307306

308307
if util.IsControlPlaneMachine(machineScope.Machine) {
309-
log.V(3).Info("skipping loadbalancer configuration as it is not control plane machine", "machineName", machineScope.IBMPowerVSMachine.Name)
308+
log.V(3).Info("Configuring loadbalancer configuration for control plane machine", "machineName", machineScope.IBMPowerVSMachine.Name)
310309
return r.handleLoadBalancerPoolMemberConfiguration(machineScope)
311310
}
311+
log.V(3).Info("skipping loadbalancer configuration as it is not control plane machine", "machineName", machineScope.IBMPowerVSMachine.Name)
312312

313313
return ctrl.Result{}, nil
314314
}

0 commit comments

Comments
 (0)
Please sign in to comment.