kubernetesk8s.io/kubernetes/pkg/util/removeall Index | Files

package removeall

import "k8s.io/kubernetes/pkg/util/removeall"

Index

Functions

func RemoveAllOneFilesystem

func RemoveAllOneFilesystem(mounter mount.Interface, path string) error

RemoveAllOneFilesystem removes the path and any children it contains, using the os.Remove function. It makes sure it does not cross mount boundaries, i.e. it returns an error rather than remove files from another filesystem. It removes everything it can but returns the first error it encounters. If the path does not exist, it returns nil (no error).

func RemoveAllOneFilesystemCommon

func RemoveAllOneFilesystemCommon(mounter mount.Interface, path string, remove func(string) error) error

RemoveAllOneFilesystemCommon removes the path and any children it contains, using the provided remove function. It removes everything it can but returns the first error it encounters. If the path does not exist, RemoveAll returns nil (no error). It makes sure it does not cross mount boundary, i.e. it does *not* remove files from another filesystems. Like 'rm -rf --one-file-system'. It is copied from RemoveAll() sources, with IsLikelyNotMountPoint

func RemoveDirsOneFilesystem

func RemoveDirsOneFilesystem(mounter mount.Interface, path string) error

RemoveDirsOneFilesystem removes the path and any empty subdirectories it contains, using the syscall.Rmdir function. Unlike RemoveAllOneFilesystem, RemoveDirsOneFilesystem will remove only directories and returns an error if it encounters any files in the directory tree. It makes sure it does not cross mount boundaries, i.e. it returns an error rather than remove dirs from another filesystem. It removes everything it can but returns the first error it encounters. If the path does not exist, it returns nil (no error).

Source Files

removeall.go

Version
v1.33.0 (latest)
Published
Apr 23, 2025
Platform
linux/amd64
Imports
5 packages
Last checked
3 hours ago

Tools for package owners.