chore: move to go folder

This commit is contained in:
Nicolas Meienberger
2025-08-20 22:15:43 +02:00
parent 83b4296cfc
commit a0be690eb9
21 changed files with 0 additions and 0 deletions

View File

@@ -0,0 +1,21 @@
package volumes
import (
"fmt"
"strings"
"k8s.io/utils/mount"
)
func UnmountVolume(path string) error {
mounter := mount.New("")
if err := mounter.Unmount(path); err != nil {
if strings.Contains(err.Error(), "not mounted") || strings.Contains(err.Error(), "No such file or directory") || strings.Contains(err.Error(), "Invalid argument") {
// Volume is not mounted
return nil
}
return fmt.Errorf("failed to unmount volume at %s: %w", path, err)
}
return nil
}