Skip to content
Merged
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
15 changes: 9 additions & 6 deletions pkg/cloud/openstack/machine/actuator.go
Original file line number Diff line number Diff line change
Expand Up @@ -295,7 +295,7 @@ func (oc *OpenstackClient) Create(ctx context.Context, cluster *clusterv1.Cluste
return nil
}

oc.eventRecorder.Eventf(machine, corev1.EventTypeNormal, "Created", "Created Machine %v", machine.Name)
oc.eventRecorder.Eventf(machine, corev1.EventTypeNormal, "Created", "Created machine %v", machine.Name)
return oc.updateAnnotation(machine, instance.ID)
}

Expand Down Expand Up @@ -363,12 +363,20 @@ func (oc *OpenstackClient) Update(ctx context.Context, cluster *clusterv1.Cluste
}

if _, ok := currentMachine.Labels["node-role.kubernetes.io/master"]; ok {
// In this conditional block, Machine is Control Plane
// TODO: add master inplace
klog.Errorf("master inplace update failed: not supported")
return oc.handleMachineError(machine, apierrors.UpdateMachine(
"master inplace update failed: not supported"), updateEventAction)
} else {
// In this conditional block, Machine is Compute Node
klog.Infof("re-creating machine %s for update.", currentMachine.ObjectMeta.Name)
err = oc.Create(ctx, cluster, machine)
if err != nil {
klog.Errorf("create machine %s for update failed: %v", machine.ObjectMeta.Name, err)
return fmt.Errorf("Cannot create machine %s: %v", machine.ObjectMeta.Name, err)
}

err = oc.Delete(ctx, cluster, currentMachine)
if err != nil {
klog.Errorf("delete machine %s for update failed: %v", currentMachine.ObjectMeta.Name, err)
Expand All @@ -387,11 +395,6 @@ func (oc *OpenstackClient) Update(ctx context.Context, cluster *clusterv1.Cluste
return oc.handleMachineError(machine, apierrors.DeleteMachine(
"error deleting Openstack instance: %v", err), updateEventAction)
}
err = oc.Create(ctx, cluster, machine)
if err != nil {
klog.Errorf("create machine %s for update failed: %v", machine.ObjectMeta.Name, err)
return fmt.Errorf("Cannot create machine %s: %v", machine.ObjectMeta.Name, err)
}
klog.Infof("Successfully updated machine %s", currentMachine.ObjectMeta.Name)
}

Expand Down