Fix: uninstallation takes long time to finish
We delete instance managers before deleting nodes so that
Longhorn managers doesn't get into a chaotic situation of
transfering ownership of instance manager objects
Longhorn
@@ -338,13 +338,6 @@ func (c *UninstallController) deleteCRDs() (bool, error) {
return true, c.deleteEngineImages(engineImages)
}
- if nodes, err := c.ds.ListNodes(); err != nil {
- return true, err
- } else if len(nodes) > 0 {
- c.logger.Infof("Found %d nodes remaining", len(nodes))
- return true, c.deleteNodes(nodes)
- }
-
if instanceManagers, err := c.ds.ListInstanceManagers(); err != nil {
return true, err
} else if len(instanceManagers) > 0 {
@@ -352,6 +345,13 @@ func (c *UninstallController) deleteCRDs() (bool, error) {
return true, c.deleteInstanceManagers(instanceManagers)
}
+ if nodes, err := c.ds.ListNodes(); err != nil {
+ return true, err
+ } else if len(nodes) > 0 {
+ c.logger.Infof("Found %d nodes remaining", len(nodes))
+ return true, c.deleteNodes(nodes)
+ }
+
return false, nil
}
