Documentation ¶
Index ¶
- Constants
- func CleanUpMountPoint(path string) error
- func CleanUpMountPoints(paths []string) error
- func ExecCmdWithTimeout(name string, args []string) ([]byte, error)
- func ExecMount(sourcePath, targetPath string, args []string) ([]byte, error)
- func ExecMountBind(sourcePath, targetPath string, ReadOnly bool) ([]byte, error)
- func Exist(path string) (bool, error)
- func ForceUnmount(path string) error
- func ForceUnmountAndRemove(path string) error
- func FsIDToFsNameUsername(fsID string) (fsName, username string)
- func GetCmdTimeout() time.Duration
- func GetDefaultGID() int
- func GetDefaultUID() int
- func GetDiskPercent() float64
- func GetFileInode(path string) (uint64, error)
- func GetFsNameAndUserNameByFsID(fsID string) (fsName, username string, err error)
- func GetK8SConfigPathEnv() string
- func GetK8STimeoutEnv() int
- func GetKubeletDataPath() string
- func GetMountPointCheckIntervalTime() int
- func GetPodUIDFromTargetPath(targetPath string) string
- func GetPodsHandleConcurrency() int
- func GetPodsUpdateIntervalTime() int
- func GetProcessCPUPercent() float64
- func GetProcessMemPercent() float32
- func GetRandID(randNum int) string
- func GetRootToken(ctx *logger.RequestContext) (string, error)
- func GetSourceMountPath(pathPrefix string) string
- func GetSourceMountPathByPod(podUID, volumeName string) string
- func GetSubPathSourcePath(volumePath, subpath string) string
- func GetSubPathTargetPath(podUID string, volumeName string, containerName string, volumeMountIndex int) string
- func GetSysCpuPercent() float64
- func GetSysMemPercent() (uint64, float64)
- func GetVolumeBindMountPathByPod(podUID, volumeName string) string
- func GetVolumeMountPath(pathPrefix string) string
- func GetVolumeSourceMountPath(pathPrefix string) string
- func IsEmptyDir(path string) (bool, error)
- func IsLikelyMountPoint(path string) (bool, error)
- func IsMountPoint(path string) (bool, error)
- func ManualUnmount(path string) error
- func New(k8sConfigPath string, k8sClientTimeout int) (*k8sClient, error)
- func Open(path string) (io.ReadCloser, error)
- func ProcessCacheConfig(fsCacheBase64 string) (model.FSCacheConfig, error)
- func ProcessFSInfo(fsInfoBase64 string) (model.FileSystem, error)
- func Readdirnames(path string) ([]string, error)
- type Client
- type PatchMapValue
Constants ¶
const ( MountCmdName = "mount" UMountCmdName = "umount" MountPointCmdName = "mountpoint" IsNotMountPoint = "is not a mountpoint" IsNotMountPointZhCN = "不是一个挂载点" ErrEndpointNotConnected = "transport endpoint is not connected" TransportEndpointIsNotConnected = "Transport endpoint is not connected" SocketNotConnected = "Socket not connected" TransportEndpointIsNotConnectedZhCN = "传输端点尚未连接" DirectoryNotEmpty = "directory not empty" DirectoryNotEmptyZhCN = "目录非空" NotMounted = "not mounted" CmdTimeoutEnv = "CMD_TIMEOUT_IN_SECOND" DefaultCmdTimoutInSecond = 60 KillPGroupCmd = "kill -9 -%d" )
const ( VolumePluginName = "kubernetes.io~csi" KubeletDataPathEnv = "KUBELET_DATA_PATH" NotRootUserEnableEnv = "NOT_ROOT_USER_ENABLE" MountPointIntervalTimeEnv = "MOUNT_POINT_INTERVAL_TIME" PodsHandleConcurrencyEnv = "PODS_HANDLE_CONCURRENCY" PodUpdateIntervalTimeEnv = "POD_UPDATE_INTERVAL_TIME" DefaultUIDEnv = "DEFAULT_UID_ENV" DefaultGIDEnv = "DEFAULT_GID_ENV" K8SConfigPathEnv = "K8S_CONFIG_PATH" K8SClientTimeoutEnv = "K8S_CLIENT_TIMEOUT" DefaultKubeletDataPath = "/var/lib/kubelet" DefaultCheckIntervalTime = 15 DefaultK8SClientTimeout = 0 DefaultPodsHandleConcurrency = 10 DefaultUpdateIntervalTime = 15 DefaultUID = 601 DefaultGID = 601 )
Variables ¶
This section is empty.
Functions ¶
func CleanUpMountPoint ¶
func CleanUpMountPoints ¶
func ExecMountBind ¶
func ForceUnmount ¶
func ForceUnmountAndRemove ¶
func FsIDToFsNameUsername ¶
func GetCmdTimeout ¶
func GetDefaultGID ¶
func GetDefaultGID() int
func GetDefaultUID ¶
func GetDefaultUID() int
func GetDiskPercent ¶ added in v0.14.6
func GetDiskPercent() float64
func GetFileInode ¶
func GetK8SConfigPathEnv ¶
func GetK8SConfigPathEnv() string
func GetK8STimeoutEnv ¶
func GetK8STimeoutEnv() int
func GetKubeletDataPath ¶
func GetKubeletDataPath() string
func GetMountPointCheckIntervalTime ¶
func GetMountPointCheckIntervalTime() int
func GetPodUIDFromTargetPath ¶
func GetPodsHandleConcurrency ¶
func GetPodsHandleConcurrency() int
func GetPodsUpdateIntervalTime ¶
func GetPodsUpdateIntervalTime() int
func GetProcessCPUPercent ¶ added in v0.14.6
func GetProcessCPUPercent() float64
func GetProcessMemPercent ¶ added in v0.14.6
func GetProcessMemPercent() float32
func GetRootToken ¶
func GetRootToken(ctx *logger.RequestContext) (string, error)
func GetSourceMountPath ¶ added in v0.14.4
default value: /var/lib/kubelet/pods/{podUID}/volumes/{volumePluginName}/{volumeName}/source
func GetSourceMountPathByPod ¶
GetSourceMountPathByPod default value: /var/lib/kubelet/pods/{podUID}/volumes/{volumePluginName}/{volumeName}/source
func GetSubPathSourcePath ¶ added in v0.14.4
func GetSubPathTargetPath ¶ added in v0.14.4
func GetSubPathTargetPath(podUID string, volumeName string, containerName string, volumeMountIndex int) string
default value: /var/lib/kubelet/pods/{podUID}/volumes-subpaths/{volumeName}/{containerName}/{volumeMountIndex}
func GetSysCpuPercent ¶ added in v0.14.6
func GetSysCpuPercent() float64
func GetSysMemPercent ¶ added in v0.14.6
func GetVolumeBindMountPathByPod ¶
GetVolumeBindMountPathByPod default value: /var/lib/kubelet/pods/{podUID}/volumes/{volumePluginName}/{volumeName}/mount
func GetVolumeMountPath ¶
GetVolumeMountPath default value: /var/lib/kubelet/pods/{podUID}/volumes/{volumePluginName}/{volumeName}/mount
func GetVolumeSourceMountPath ¶
GetVolumeSourceMountPath default value: /var/lib/kubelet/pods/{podUID}/volumes/{volumePluginName}/{volumeName}/source
func IsEmptyDir ¶
func IsLikelyMountPoint ¶
func IsMountPoint ¶
func ManualUnmount ¶
func ProcessCacheConfig ¶
func ProcessCacheConfig(fsCacheBase64 string) (model.FSCacheConfig, error)
func ProcessFSInfo ¶
func ProcessFSInfo(fsInfoBase64 string) (model.FileSystem, error)
func Readdirnames ¶
Readdirnames reads the contents of the directory associated with file and returns a slice of up to n names of files in the directory.
The ioutil.ReadDir function will get the directory name and call lstat to get the directory FileInfo. but when mount point is not connected, lstat function will return error
Types ¶
type Client ¶
type Client interface { // pod ProxyGetPods(nodeID string) (result *corev1.PodList, err error) CreatePod(pod *corev1.Pod) (*corev1.Pod, error) GetPod(namespace, name string) (*corev1.Pod, error) PatchPod(namespace, name string, data []byte) error UpdatePod(namespace string, pod *corev1.Pod) (*corev1.Pod, error) DeletePod(pod *corev1.Pod) error GetPodLog(namespace, podName, containerName string) (string, error) PatchPodAnnotation(pod *corev1.Pod) error PatchPodLabel(pod *corev1.Pod) error // pv CreatePersistentVolume(pv *corev1.PersistentVolume) (*corev1.PersistentVolume, error) DeletePersistentVolume(name string, deleteOptions metav1.DeleteOptions) error GetPersistentVolume(name string, getOptions metav1.GetOptions) (*corev1.PersistentVolume, error) ListPersistentVolume(listOptions metav1.ListOptions) (*corev1.PersistentVolumeList, error) // pvc CreatePersistentVolumeClaim(namespace string, pvc *corev1.PersistentVolumeClaim) (*corev1.PersistentVolumeClaim, error) DeletePersistentVolumeClaim(namespace, name string, deleteOptions metav1.DeleteOptions) error GetPersistentVolumeClaim(namespace, name string, getOptions metav1.GetOptions) (*corev1.PersistentVolumeClaim, error) // ns GetNamespace(namespace string, getOptions metav1.GetOptions) (*corev1.Namespace, error) ListNamespaces(listOptions metav1.ListOptions) (*corev1.NamespaceList, error) }
func GetFakeK8sClient ¶
func GetFakeK8sClient() Client