Documentation ¶
Index ¶
- Variables
- func AddPodAnnotation(ctx context.Context, client *k8sclient.K8sClient, pod *corev1.Pod, ...) error
- func AddPodLabel(ctx context.Context, client *k8sclient.K8sClient, pod *corev1.Pod, ...) error
- func AddSecretFinalizer(ctx context.Context, client *k8s.K8sClient, secret *v1.Secret, ...) error
- func CheckDynamicPV(name string) (bool, error)
- func CheckExpectValue(m map[string]string, key string, targetValue string) bool
- func CheckForSecretFinalizer(ctx context.Context, client *k8s.K8sClient, volume *v1.PersistentVolume) (shouldRemoveFinalizer bool, err error)
- func CheckForSubPath(ctx context.Context, client *k8s.K8sClient, volume *v1.PersistentVolume, ...) (shouldDeleted bool, err error)
- func ConsistentRead(filename string, attempts int) ([]byte, error)
- func ContainsPrefix(slice []string, s string) bool
- func ContainsString(slice []string, s string) bool
- func DelPodAnnotation(ctx context.Context, client *k8sclient.K8sClient, pod *corev1.Pod, ...) error
- func DeleteResourceOfPod(pod *corev1.Pod)
- func DevMinor(dev uint64) uint32
- func DoWithContext(ctx context.Context, f func() error) error
- func DoWithTimeout(parent context.Context, timeout time.Duration, f func() error) error
- func GetAllRefKeys(pod corev1.Pod) map[string]string
- func GetDiskUsage(path string) (uint64, uint64, uint64, uint64)
- func GetMountDeviceRefs(pathname string, corrupted bool) ([]string, error)
- func GetMountPathOfPod(pod corev1.Pod) (string, string, error)
- func GetNamespace(ctx context.Context, client *k8sclient.K8sClient, pod *corev1.Pod) (namespace string, err error)
- func GetReferenceKey(target string) string
- func GetTime(str string) (time.Time, error)
- func GetTimeAfterDelay(delayStr string) (string, error)
- func ImageResol(image string) (hasCE, hasEE bool)
- func IsJobCompleted(job *batchv1.Job) bool
- func IsJobFailed(job *batchv1.Job) bool
- func IsJobShouldBeRecycled(job *batchv1.Job) bool
- func IsPodError(pod *corev1.Pod) bool
- func IsPodHasResource(pod corev1.Pod) bool
- func IsPodReady(pod *corev1.Pod) bool
- func IsPodResourceError(pod *corev1.Pod) bool
- func NewPrometheus(nodeName string) (prometheus.Registerer, *prometheus.Registry)
- func ParseEndpoint(endpoint string) (string, string, error)
- func ParseMntPath(cmd string) (string, string, error)
- func ParseToBytes(value string) (uint64, error)
- func QuoteForShell(cmd string) string
- func RandStringRunes(n int) string
- func RemoveFinalizer(ctx context.Context, client *k8sclient.K8sClient, pod *corev1.Pod, ...) error
- func RemoveSecretFinalizer(ctx context.Context, client *k8s.K8sClient, secret *v1.Secret, ...) error
- func ReplacePodAnnotation(ctx context.Context, client *k8sclient.K8sClient, pod *corev1.Pod, ...) error
- func ShouldDelay(ctx context.Context, pod *corev1.Pod, Client *k8s.K8sClient) (shouldDelay bool, err error)
- func StripPasswd(uri string) string
- func StripReadonlyOption(options []string) []string
- func UmountPath(ctx context.Context, sourcePath string)
- func WaitUtilMountReady(ctx context.Context, podName, mntPath string, timeout time.Duration) error
- type ObjectMeta
- type PVPair
- type VolumeLocks
Constants ¶
This section is empty.
Variables ¶
var (
MountPointDevMinorTable sync.Map
)
Functions ¶
func AddPodAnnotation ¶ added in v0.17.4
func AddPodLabel ¶ added in v0.21.0
func AddSecretFinalizer ¶ added in v0.22.0
func CheckDynamicPV ¶ added in v0.16.0
func CheckExpectValue ¶ added in v0.18.0
CheckExpectValue Check if the key has the expected value
func CheckForSecretFinalizer ¶ added in v0.22.0
func CheckForSubPath ¶ added in v0.18.0
func ConsistentRead ¶ added in v0.14.1
ConsistentRead repeatedly reads a file until it gets the same content twice. This is useful when reading files in /proc that are larger than page size and kernel may modify them between individual read() syscalls.
func ContainsPrefix ¶ added in v0.17.2
ContainsPrefix String checks if a string slice contains a string with a given prefix
func ContainsString ¶ added in v0.10.0
ContainsString checks if a string is in a string slice.
func DelPodAnnotation ¶ added in v0.17.4
func DeleteResourceOfPod ¶ added in v0.10.0
func DoWithTimeout ¶ added in v0.17.1
func GetDiskUsage ¶ added in v0.23.4
func GetMountDeviceRefs ¶ added in v0.13.2
GetMountDeviceRefs Get all mountpoints whose source is the device of `pathname` mountpoint, the `pathname` will be excluded. The `pathname` must be a mountpoint, and if the `corrupted` is true, the `pathname` is a corrupted mountpoint.
func GetMountPathOfPod ¶ added in v0.10.7
func GetNamespace ¶ added in v0.23.0
func GetNamespace(ctx context.Context, client *k8sclient.K8sClient, pod *corev1.Pod) (namespace string, err error)
GetNamespace get juicefs pv & pvc from pod when pod namespace is empty
func GetReferenceKey ¶ added in v0.10.7
func GetTimeAfterDelay ¶ added in v0.13.0
GetTimeAfterDelay get time which after delay
func ImageResol ¶ added in v0.19.0
ImageResol check if image contains CE or EE ce image starts with "ce-" (latest image is CE) ee image starts with "ee-" Compatible with previous images: has both ce and ee
func IsJobCompleted ¶ added in v0.13.0
func IsJobFailed ¶ added in v0.13.0
func IsJobShouldBeRecycled ¶ added in v0.20.0
func IsPodError ¶ added in v0.10.0
func IsPodHasResource ¶ added in v0.10.0
func IsPodReady ¶ added in v0.10.0
func IsPodResourceError ¶ added in v0.10.0
func NewPrometheus ¶ added in v0.23.4
func NewPrometheus(nodeName string) (prometheus.Registerer, *prometheus.Registry)
func ParseMntPath ¶ added in v0.10.7
ParseMntPath return mntPath, volumeId (/jfs/volumeId, volumeId err)
func ParseToBytes ¶ added in v0.23.6
ParseToBytes parses a string with a unit suffix (e.g. "1M", "2G") to bytes. default unit is M
func QuoteForShell ¶ added in v0.13.0
func RandStringRunes ¶ added in v0.14.1
func RemoveFinalizer ¶ added in v0.15.0
func RemoveSecretFinalizer ¶ added in v0.22.0
func ReplacePodAnnotation ¶ added in v0.17.4
func ShouldDelay ¶ added in v0.13.0
func StripPasswd ¶ added in v0.13.0
func StripReadonlyOption ¶ added in v0.17.4
func UmountPath ¶ added in v0.17.1
Types ¶
type ObjectMeta ¶ added in v0.23.3
type ObjectMeta struct {
// contains filtered or unexported fields
}
func NewObjectMeta ¶ added in v0.23.3
func NewObjectMeta(pvc v1.PersistentVolumeClaim, node *v1.Node) *ObjectMeta
func (*ObjectMeta) ResolveSecret ¶ added in v0.23.3
func (meta *ObjectMeta) ResolveSecret(str string, pvName string) string
func (*ObjectMeta) StringParser ¶ added in v0.23.3
func (meta *ObjectMeta) StringParser(str string) string
type PVPair ¶ added in v0.23.0
type PVPair struct { PV *corev1.PersistentVolume PVC *corev1.PersistentVolumeClaim }
type VolumeLocks ¶ added in v0.24.0
type VolumeLocks struct {
// contains filtered or unexported fields
}
func NewVolumeLocks ¶ added in v0.24.0
func NewVolumeLocks() *VolumeLocks
func (*VolumeLocks) Release ¶ added in v0.24.0
func (vl *VolumeLocks) Release(volumeID string)
Release deletes the lock on volumeID.
func (*VolumeLocks) TryAcquire ¶ added in v0.24.0
func (vl *VolumeLocks) TryAcquire(volumeID string) bool