diff --git a/controllers/openstackmachine_controller.go b/controllers/openstackmachine_controller.go index 4f95ae3795..65ce48eb31 100644 --- a/controllers/openstackmachine_controller.go +++ b/controllers/openstackmachine_controller.go @@ -359,12 +359,12 @@ func (r *OpenStackMachineReconciler) reconcileNormal(ctx context.Context, scope switch instanceStatus.State() { case infrav1.InstanceStateActive: - scope.Logger().Info("Machine instance state is ACTIVE", "instance-id", instanceStatus.ID()) + scope.Logger().Info("Machine instance state is ACTIVE", "id", instanceStatus.ID()) conditions.MarkTrue(openStackMachine, infrav1.InstanceReadyCondition) openStackMachine.Status.Ready = true case infrav1.InstanceStateError: // Error is unexpected, thus we report error and never retry - scope.Logger().Info("Machine instance state is ERROR", "instance-id", instanceStatus.ID()) + scope.Logger().Info("Machine instance state is ERROR", "id", instanceStatus.ID()) err = fmt.Errorf("instance state %q is unexpected", instanceStatus.State()) openStackMachine.SetFailure(capierrors.UpdateMachineError, err) conditions.MarkFalse(openStackMachine, infrav1.InstanceReadyCondition, infrav1.InstanceStateErrorReason, clusterv1.ConditionSeverityError, "") @@ -377,7 +377,7 @@ func (r *OpenStackMachineReconciler) reconcileNormal(ctx context.Context, scope default: // The other state is normal (for example, migrating, shutoff) but we don't want to proceed until it's ACTIVE // due to potential conflict or unexpected actions - scope.Logger().Info("Waiting for instance to become ACTIVE", "instance-id", instanceStatus.ID(), "status", instanceStatus.State()) + scope.Logger().Info("Waiting for instance to become ACTIVE", "id", instanceStatus.ID(), "status", instanceStatus.State()) conditions.MarkUnknown(openStackMachine, infrav1.InstanceReadyCondition, infrav1.InstanceNotReadyReason, "Instance state is not handled: %s", instanceStatus.State()) return ctrl.Result{RequeueAfter: waitForInstanceBecomeActiveToReconcile}, nil } @@ -410,7 +410,7 @@ func (r *OpenStackMachineReconciler) reconcileNormal(ctx context.Context, scope } if fp.PortID != "" { - scope.Logger().Info("Floating IP already associated to a port:", "id", fp.ID, "fixed ip", fp.FixedIP, "portID", port.ID) + scope.Logger().Info("Floating IP already associated to a port", "id", fp.ID, "fixedIP", fp.FixedIP, "portID", port.ID) } else { err = networkingService.AssociateFloatingIP(openStackMachine, fp, port.ID) if err != nil { @@ -433,7 +433,7 @@ func (r *OpenStackMachineReconciler) getOrCreate(logger logr.Logger, cluster *cl if instanceStatus == nil { instanceSpec := machineToInstanceSpec(openStackCluster, machine, openStackMachine, userData) - logger.Info("Machine not exist, Creating Machine", "Machine", openStackMachine.Name) + logger.Info("Machine does not exist, creating Machine", "name", openStackMachine.Name) instanceStatus, err = computeService.CreateInstance(openStackMachine, openStackCluster, instanceSpec, cluster.Name, false) if err != nil { conditions.MarkFalse(openStackMachine, infrav1.InstanceReadyCondition, infrav1.InstanceCreateFailedReason, clusterv1.ConditionSeverityError, err.Error()) diff --git a/pkg/cloud/services/loadbalancer/loadbalancer.go b/pkg/cloud/services/loadbalancer/loadbalancer.go index 0d7bb5b180..a3fdbd815f 100644 --- a/pkg/cloud/services/loadbalancer/loadbalancer.go +++ b/pkg/cloud/services/loadbalancer/loadbalancer.go @@ -169,7 +169,7 @@ func (s *Service) getOrCreateLoadBalancer(openStackCluster *infrav1.OpenStackClu return lb, nil } - s.scope.Logger().Info(fmt.Sprintf("Creating load balancer in subnet: %q", subnetID), "name", loadBalancerName) + s.scope.Logger().Info("Creating load balancer in subnet", "subnetID", subnetID, "name", loadBalancerName) lbCreateOpts := loadbalancers.CreateOpts{ Name: loadBalancerName, @@ -199,7 +199,7 @@ func (s *Service) getOrCreateListener(openStackCluster *infrav1.OpenStackCluster return listener, nil } - s.scope.Logger().Info("Creating load balancer listener", "name", listenerName, "lb-id", lbID) + s.scope.Logger().Info("Creating load balancer listener", "name", listenerName, "loadBalancerID", lbID) listenerCreateOpts := listeners.CreateOpts{ Name: listenerName, @@ -267,7 +267,7 @@ func (s *Service) getOrUpdateAllowedCIDRS(openStackCluster *infrav1.OpenStackClu listener.AllowedCIDRs = capostrings.Unique(listener.AllowedCIDRs) if !reflect.DeepEqual(allowedCIDRs, listener.AllowedCIDRs) { - s.scope.Logger().Info("CIDRs do not match, start to update listener", "expected CIDRs", allowedCIDRs, "load balancer existing CIDR", listener.AllowedCIDRs) + s.scope.Logger().Info("CIDRs do not match, updating listener", "expectedCIDRs", allowedCIDRs, "currentCIDRs", listener.AllowedCIDRs) listenerUpdateOpts := listeners.UpdateOpts{ AllowedCIDRs: &allowedCIDRs, } @@ -316,7 +316,7 @@ func (s *Service) getOrCreatePool(openStackCluster *infrav1.OpenStackCluster, po return pool, nil } - s.scope.Logger().Info(fmt.Sprintf("Creating load balancer pool for listener %q", listenerID), "name", poolName, "lb-id", lbID) + s.scope.Logger().Info("Creating load balancer pool for listener", "loadBalancerID", lbID, "listenerID", listenerID, "name", poolName) method := pools.LBMethodRoundRobin @@ -356,7 +356,7 @@ func (s *Service) getOrCreateMonitor(openStackCluster *infrav1.OpenStackCluster, return nil } - s.scope.Logger().Info(fmt.Sprintf("Creating load balancer monitor for pool %q", poolID), "name", monitorName, "lb-id", lbID) + s.scope.Logger().Info("Creating load balancer monitor for pool", "loadBalancerID", lbID, "name", monitorName, "poolID", poolID) monitorCreateOpts := monitors.CreateOpts{ Name: monitorName, @@ -400,7 +400,7 @@ func (s *Service) ReconcileLoadBalancerMember(openStackCluster *infrav1.OpenStac } loadBalancerName := getLoadBalancerName(clusterName) - s.scope.Logger().Info("Reconciling load balancer member", "name", loadBalancerName) + s.scope.Logger().Info("Reconciling load balancer member", "loadBalancerName", loadBalancerName) lbID := openStackCluster.Status.APIServerLoadBalancer.ID portList := []int{int(openStackCluster.Spec.ControlPlaneEndpoint.Port)} @@ -429,7 +429,7 @@ func (s *Service) ReconcileLoadBalancerMember(openStackCluster *infrav1.OpenStac continue } - s.scope.Logger().Info("Deleting load balancer member (because the IP of the machine changed)", "name", name) + s.scope.Logger().Info("Deleting load balancer member because the IP of the machine changed", "name", name) // lb member changed so let's delete it so we can create it again with the correct IP err = s.waitForLoadBalancerActive(lbID)