Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions pkg/controller/machine/controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ func (r *ReconcileMachine) Reconcile(ctx context.Context, request reconcile.Requ

// Implement controller logic here
machineName := m.GetName()
klog.Infof("%v: reconciling Machine", machineName)
klog.Infof("%q: reconciling Machine", machineName)

// Get the original state of conditions now so that they can be used to calculate the patch later.
// This must be a copy otherwise the referenced slice will be modified by later machine conditions changes.
Expand Down Expand Up @@ -229,14 +229,14 @@ func (r *ReconcileMachine) Reconcile(ctx context.Context, request reconcile.Requ
// we can loose instances, e.g. right after request to create one
// was sent and before a list of node addresses was set.
if len(m.Status.Addresses) > 0 || !isInvalidMachineConfigurationError(err) {
klog.Errorf("%v: failed to delete machine: %v", machineName, err)
klog.Errorf("%q: failed to delete machine: %v", machineName, err)
return delayIfRequeueAfterError(err)
}
}

instanceExists, err := r.actuator.Exists(ctx, m)
if err != nil {
klog.Errorf("%v: failed to check if machine exists: %v", machineName, err)
klog.Errorf("%q: failed to check if machine exists: %v", machineName, err)
return reconcile.Result{}, err
}

Expand Down Expand Up @@ -271,7 +271,7 @@ func (r *ReconcileMachine) Reconcile(ctx context.Context, request reconcile.Requ

instanceExists, err := r.actuator.Exists(ctx, m)
if err != nil {
klog.Errorf("%v: failed to check if machine exists: %v", machineName, err)
klog.Errorf("%q: failed to check if machine exists: %v", machineName, err)

conditions.Set(m, conditions.UnknownCondition(
machinev1.InstanceExistsCondition,
Expand All @@ -289,7 +289,7 @@ func (r *ReconcileMachine) Reconcile(ctx context.Context, request reconcile.Requ
if instanceExists {
klog.Infof("%v: reconciling machine triggers idempotent update", machineName)
if err := r.actuator.Update(ctx, m); err != nil {
klog.Errorf("%v: error updating machine: %v, retrying in %v seconds", machineName, err, requeueAfter)
klog.Errorf("%q: error updating machine: %v, retrying in %s seconds", machineName, err, requeueAfter.String())

if patchErr := r.updateStatus(ctx, m, ptr.Deref(m.Status.Phase, ""), nil, originalConditions); patchErr != nil {
klog.Errorf("%v: error patching status: %v", machineName, patchErr)
Expand Down Expand Up @@ -356,7 +356,7 @@ func (r *ReconcileMachine) Reconcile(ctx context.Context, request reconcile.Requ

klog.Infof("%v: reconciling machine triggers idempotent create", machineName)
if err := r.actuator.Create(ctx, m); err != nil {
klog.Warningf("%v: failed to create machine: %v", machineName, err)
klog.Warningf("%q: failed to create machine: %v", machineName, err)
if isInvalidMachineConfigurationError(err) {
if err := r.updateStatus(ctx, m, machinev1.PhaseFailed, err, originalConditions); err != nil {
return reconcile.Result{}, err
Expand Down
2 changes: 1 addition & 1 deletion pkg/controller/vsphere/actuator.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ func NewActuator(params ActuatorParams) *Actuator {
// Set corresponding event based on error. It also returns the original error
// for convenience, so callers can do "return handleMachineError(...)".
func (a *Actuator) handleMachineError(machine *machinev1.Machine, err error, eventAction string) error {
klog.Errorf("%v error: %v", machine.GetName(), err)
klog.Errorf("%q error: %v", machine.GetName(), err)
if eventAction != noEventAction {
a.eventRecorder.Eventf(machine, corev1.EventTypeWarning, "Failed"+eventAction, "%v", err)
}
Expand Down