resource

package
v0.25.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 30, 2024 License: Apache-2.0 Imports: 29 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// (Ctrl-C) to interrupt or terminate a program or process.
	EndOfText = "\u0003"
	// (Ctrl-D) to indicate end-of-file on a terminal.
	EndOfTransmission = "\u0004"
)

Variables

This section is empty.

Functions

func AddPodAnnotation

func AddPodAnnotation(ctx context.Context, client *k8sclient.K8sClient, pod *corev1.Pod, addAnnotations map[string]string) error

func AddPodLabel

func AddPodLabel(ctx context.Context, client *k8sclient.K8sClient, pod *corev1.Pod, addLabels map[string]string) error

func AddSecretFinalizer

func AddSecretFinalizer(ctx context.Context, client *k8s.K8sClient, secret *v1.Secret, finalizer string) error

func CheckForSecretFinalizer

func CheckForSecretFinalizer(ctx context.Context, client *k8s.K8sClient, volume *v1.PersistentVolume) (shouldRemoveFinalizer bool, err error)

func CheckForSubPath

func CheckForSubPath(ctx context.Context, client *k8s.K8sClient, volume *v1.PersistentVolume, pathPattern string) (shouldDeleted bool, err error)

func DelPodAnnotation

func DelPodAnnotation(ctx context.Context, client *k8sclient.K8sClient, pod *corev1.Pod, delAnnotations []string) error

func DeleteResourceOfPod

func DeleteResourceOfPod(pod *corev1.Pod)

func DownloadPodFile added in v0.24.5

func DownloadPodFile(client kubernetes.Interface, cfg *rest.Config, writer io.Writer, namespace, name, container string, cmd []string) error

func ExecInPod added in v0.24.5

func ExecInPod(client kubernetes.Interface, cfg *rest.Config, h Handler, namespace, name, container string, cmd []string) error

func GetAllRefKeys

func GetAllRefKeys(pod corev1.Pod) map[string]string

func GetCommPath added in v0.25.0

func GetCommPath(basePath string, pod corev1.Pod) (string, error)

func GetNamespace

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 GetPVWithVolumeHandleOrAppInfo added in v0.24.6

func GetPVWithVolumeHandleOrAppInfo(ctx context.Context, client *k8s.K8sClient, volumeHandle string, volCtx map[string]string) (*corev1.PersistentVolume, *corev1.PersistentVolumeClaim, error)

func IsJobCompleted

func IsJobCompleted(job *batchv1.Job) bool

func IsJobFailed

func IsJobFailed(job *batchv1.Job) bool

func IsJobShouldBeRecycled

func IsJobShouldBeRecycled(job *batchv1.Job) bool

func IsPodComplete added in v0.25.0

func IsPodComplete(pod *corev1.Pod) bool

func IsPodError

func IsPodError(pod *corev1.Pod) bool

func IsPodHasResource

func IsPodHasResource(pod corev1.Pod) bool

func IsPodReady

func IsPodReady(pod *corev1.Pod) bool

func IsPodResourceError

func IsPodResourceError(pod *corev1.Pod) bool

func NewTerminalSession added in v0.24.5

func NewTerminalSession(ctx context.Context, conn *websocket.Conn, endOfTransmission string) *terminalSession

func RemoveFinalizer

func RemoveFinalizer(ctx context.Context, client *k8sclient.K8sClient, pod *corev1.Pod, finalizer string) error

func RemoveSecretFinalizer

func RemoveSecretFinalizer(ctx context.Context, client *k8s.K8sClient, secret *v1.Secret, finalizer string) error

func ReplacePodAnnotation

func ReplacePodAnnotation(ctx context.Context, client *k8sclient.K8sClient, pod *corev1.Pod, annotation map[string]string) error

func ShouldDelay

func ShouldDelay(ctx context.Context, pod *corev1.Pod, Client *k8s.K8sClient) (shouldDelay bool, err error)

func SmoothUpgrade added in v0.25.0

func SmoothUpgrade(client kubernetes.Interface, cfg *rest.Config, h Handler, csiName, name, namespace string, restart bool) error

func WaitForJobComplete added in v0.25.0

func WaitForJobComplete(ctx context.Context, client *k8s.K8sClient, name string, timeout time.Duration) error

func WaitUtilMountReady

func WaitUtilMountReady(ctx context.Context, podName, mntPath string, timeout time.Duration) error

Types

type Handler added in v0.24.5

type Handler interface {
	io.Reader
	io.Writer
	remotecommand.TerminalSizeQueue
}

type ObjectMeta

type ObjectMeta struct {
	// contains filtered or unexported fields
}

func NewObjectMeta

func NewObjectMeta(pvc v1.PersistentVolumeClaim, node *v1.Node) *ObjectMeta

func (*ObjectMeta) ResolveSecret

func (meta *ObjectMeta) ResolveSecret(str string, pvName string) string

func (*ObjectMeta) StringParser

func (meta *ObjectMeta) StringParser(str string) string

type PVPair

type PVPair struct {
	PV  *corev1.PersistentVolume
	PVC *corev1.PersistentVolumeClaim
}

func GetVolumes

func GetVolumes(ctx context.Context, client *k8sclient.K8sClient, pod *corev1.Pod) (used bool, pvPairGot []PVPair, err error)

GetVolumes get juicefs pv & pvc from pod

type VolumeLocks

type VolumeLocks struct {
	// contains filtered or unexported fields
}

func NewVolumeLocks

func NewVolumeLocks() *VolumeLocks

func (*VolumeLocks) Release

func (vl *VolumeLocks) Release(volumeID string)

Release deletes the lock on volumeID.

func (*VolumeLocks) TryAcquire

func (vl *VolumeLocks) TryAcquire(volumeID string) bool

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL