Skip to content

Commit

Permalink
fix(node-controller): delete instance manager and requeue node when l…
Browse files Browse the repository at this point in the history
…abels are missing

longhorn/longhorn-9464

Signed-off-by: Chin-Ya Huang <chin-ya.huang@suse.com>
(cherry picked from commit 86a4416)
  • Loading branch information
c3y1huang authored and derekbit committed Sep 16, 2024
1 parent 7510bb4 commit bc46b6d
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion controller/node_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -1238,7 +1238,17 @@ func (nc *NodeController) syncInstanceManagers(node *longhorn.Node) error {
}

log.Infof("Creating default instance manager %v, image: %v, dataEngine: %v", imName, defaultInstanceManagerImage, dataEngine)
if _, err := nc.createInstanceManager(node, imName, defaultInstanceManagerImage, imType, dataEngine); err != nil {
_, err = nc.createInstanceManager(node, imName, defaultInstanceManagerImage, imType, dataEngine)
if err != nil {
if apierrors.IsAlreadyExists(err) {
log.WithError(err).Warnf("Deleting instance manager %v because it cannot be obtained by selector labels", imName)
if err := nc.ds.DeleteInstanceManager(imName); err != nil {
return err
}

nc.enqueueNode(node)
return nil
}
return err
}
}
Expand Down

0 comments on commit bc46b6d

Please sign in to comment.