Skip to content

Commit 37ae9a0

Browse files
refactor: move shouldSkipUninstall check after operand eviction to ensure mount refresh
Signed-off-by: Karthik Vetrivel <[email protected]>
1 parent 1991b8c commit 37ae9a0

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

cmd/driver-manager/main.go

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -287,11 +287,6 @@ func (dm *DriverManager) uninstallDriver() error {
287287
return fmt.Errorf("driver is pre-installed on host")
288288
}
289289

290-
if skip, reason := dm.shouldSkipUninstall(); skip {
291-
dm.log.Infof("Skipping driver uninstall: %s", reason)
292-
return nil
293-
}
294-
295290
// Fetch current component states
296291
if err := dm.fetchCurrentLabels(); err != nil {
297292
return fmt.Errorf("failed to fetch current labels: %w", err)
@@ -309,6 +304,14 @@ func (dm *DriverManager) uninstallDriver() error {
309304
return fmt.Errorf("failed to evict GPU operator components: %w", err)
310305
}
311306

307+
if skip, reason := dm.shouldSkipUninstall(); skip {
308+
dm.log.Infof("Skipping driver uninstall: %s", reason)
309+
if err := dm.rescheduleGPUOperatorComponents(); err != nil {
310+
dm.log.Warnf("Failed to reschedule GPU operator components: %v", err)
311+
}
312+
return nil
313+
}
314+
312315
drainOpts := kube.DrainOptions{
313316
Force: dm.config.drainUseForce,
314317
DeleteEmptyDirData: dm.config.drainDeleteEmptyDirData,
@@ -661,7 +664,7 @@ func (dm *DriverManager) shouldSkipUninstall() (bool, string) {
661664
}
662665

663666
if dm.config.driverVersion == "" {
664-
return false, ""
667+
return false, "Driver version environment variable is not set"
665668
}
666669

667670
version, err := dm.detectCurrentDriverVersion()

0 commit comments

Comments
 (0)