Documentation ¶
Index ¶
- func CheckIfPVCIsDataset(pvc *corev1.PersistentVolumeClaim) (isDataset bool)
- func CopyConfigMap(client client.Client, src types.NamespacedName, dst types.NamespacedName, ...) error
- func CopySecretToNamespace(client client.Client, from types.NamespacedName, to types.NamespacedName, ...) error
- func CreateSecret(client client.Client, secret *v1.Secret) error
- func DeleteConfigMap(client client.Client, name, namespace string) (err error)
- func DeletePersistentVolume(client client.Client, name string) (err error)
- func DeletePersistentVolumeClaim(client client.Client, name, namespace string) (err error)
- func EnsureNamespace(client client.Client, namespace string) (err error)
- func ExecCommandInContainer(podName string, containerName string, namespace string, cmd []string) (stdout string, stderr string, err error)
- func ExecCommandInContainerWithFullOutput(podName string, containerName string, namespace string, cmd []string) (stdout string, stderr string, err error)
- func ExecCommandInPod(podName string, namespace string, cmd []string) (stdout string, stderr string, err error)
- func ExecShellInContainer(podName string, containerName string, namespace string, cmd string) (stdout string, stderr string, err error)
- func ExecWithOptions(options ExecOptions) (string, string, error)
- func GetConfigmapByName(client client.Client, name, namespace string) (configmap *v1.ConfigMap, err error)
- func GetDaemonPods(c client.Client, ds *appsv1.DaemonSet) (pods []*v1.Pod, err error)
- func GetDaemonset(c client.Client, name string, namespace string) (ds *appsv1.DaemonSet, err error)
- func GetDeployment(c client.Client, key types.NamespacedName) (deploy *appsv1.Deployment, err error)
- func GetFuseMountInContainer(mountType string, container corev1.Container) (volumeMount corev1.VolumeMount, err error)
- func GetIpAddressesOfNodes(nodes []corev1.Node) (ipAddresses []string)
- func GetIpAddressesOfPods(client client.Client, pods []corev1.Pod) (ipAddresses []string, err error)
- func GetMountInfoFromVolumeClaim(client client.Client, name, namespace string) (path string, mountType string, subpath string, err error)
- func GetMountPathInContainer(container corev1.Container) (string, error)
- func GetNode(client client.Reader, name string) (node *corev1.Node, err error)
- func GetPVCNamesFromPod(pod *corev1.Pod) (pvcNames []string)
- func GetPVCsFromPod(pod corev1.Pod) (pvcs []corev1.Volume)
- func GetPersistentVolume(client client.Reader, name string) (pv *corev1.PersistentVolume, err error)
- func GetPersistentVolumeClaim(client client.Client, name, namespace string) (pvc *v1.PersistentVolumeClaim, err error)
- func GetPhaseFromStatefulset(replicas int32, sts appsv1.StatefulSet) (phase datav1alpha1.RuntimePhase)
- func GetPodByName(client client.Client, name, namespace string) (pod *corev1.Pod, err error)
- func GetPodsForStatefulSet(c client.Client, sts *appsv1.StatefulSet, selector labels.Selector) (pods []v1.Pod, err error)
- func GetPvcMountNodes(e client.Client, pvcName, namespace string) (map[string]int64, error)
- func GetPvcMountPods(e client.Client, pvcName, namespace string) ([]corev1.Pod, error)
- func GetReferringDatasetPVCInfo(pvc *corev1.PersistentVolumeClaim) (ok bool, name string, namespace string)
- func GetSecret(client client.Client, name, namespace string) (*v1.Secret, error)
- func GetServiceByName(client client.Client, name, namespace string) (service *corev1.Service, err error)
- func GetStatefulSet(c client.Client, name string, namespace string) (master *appsv1.StatefulSet, err error)
- func GetUnavailableDaemonPodNames(c client.Client, ds *appsv1.DaemonSet) (names []types.NamespacedName, err error)
- func GetUnavailableDaemonPods(c client.Client, ds *appsv1.DaemonSet) (unavailablePods []*v1.Pod, err error)
- func GetUnavailablePodNamesForStatefulSet(c client.Client, sts *appsv1.StatefulSet, selector labels.Selector) (names []types.NamespacedName, err error)
- func GetUnavailablePodsStatefulSet(c client.Client, sts *appsv1.StatefulSet, selector labels.Selector) (unavailablePods []*v1.Pod, err error)
- func IsCompletePod(pod *corev1.Pod) bool
- func IsConfigMapExist(client client.Client, name, namespace string) (found bool, err error)
- func IsDatasetPVC(client client.Reader, name string, namespace string) (find bool, err error)
- func IsFailedPod(pod *corev1.Pod) bool
- func IsFinishedPod(pod *corev1.Pod) bool
- func IsPersistentVolumeClaimExist(client client.Client, name, namespace string, annotations map[string]string) (found bool, err error)
- func IsPersistentVolumeExist(client client.Client, name string, annotations map[string]string) (found bool, err error)
- func IsReady(node corev1.Node) (ready bool)
- func IsSucceededPod(pod *corev1.Pod) bool
- func PVCNames(volumeMounts []corev1.VolumeMount, volumes []corev1.Volume) (pvcNames []string)
- func RemoveProtectionFinalizer(client client.Client, name, namespace string) (err error)
- func SetPVCDeleteTimeout(timeout time.Duration)
- func ShouldDeleteDataset(client client.Client, name, namespace string) (err error)
- func ShouldRemoveProtectionFinalizer(client client.Client, name, namespace string) (should bool, err error)
- func UpdateSecret(client client.Client, secret *v1.Secret) error
- type ExecOptions
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CheckIfPVCIsDataset ¶ added in v0.8.0
func CheckIfPVCIsDataset(pvc *corev1.PersistentVolumeClaim) (isDataset bool)
CheckIfPVCIsDataset checks if the pvc is dataset
func CopyConfigMap ¶ added in v0.9.0
func CopyConfigMap(client client.Client, src types.NamespacedName, dst types.NamespacedName, reference metav1.OwnerReference) error
func CopySecretToNamespace ¶ added in v0.9.0
func CopySecretToNamespace(client client.Client, from types.NamespacedName, to types.NamespacedName, ownerReference *common.OwnerReference) error
func CreateSecret ¶ added in v0.7.0
func DeleteConfigMap ¶
DeleteConfigMap deletes the configmap given its name and namespace if the configmap exists.
func DeletePersistentVolume ¶
DeletePersistentVolume deletes volume
func DeletePersistentVolumeClaim ¶
DeletePersistentVolumeClaim deletes volume claim
func EnsureNamespace ¶
EnsureNamespace makes sure the namespace exist.
func ExecCommandInContainer ¶
func ExecCommandInContainer(podName string, containerName string, namespace string, cmd []string) (stdout string, stderr string, err error)
A wrapper function of ExecCommandInContainerWithFullOutput
func ExecCommandInContainerWithFullOutput ¶
func ExecCommandInContainerWithFullOutput(podName string, containerName string, namespace string, cmd []string) (stdout string, stderr string, err error)
ExecCommandInContainerWithFullOutput executes a command in the specified container and return stdout, stderr and error
func ExecCommandInPod ¶
func ExecCommandInPod(podName string, namespace string, cmd []string) (stdout string, stderr string, err error)
ExecCommandInPod finds the first container in the given pod, executes command in that container, and return stdout, stderr and error.
func ExecShellInContainer ¶
func ExecShellInContainer(podName string, containerName string, namespace string, cmd string) (stdout string, stderr string, err error)
ExecShellInContainer executes shell command or script in the specified container and return stdout, stderr and error
func ExecWithOptions ¶
func ExecWithOptions(options ExecOptions) (string, string, error)
ExecWithOptions executes a command in the specified container, returning stdout, stderr and error. `options` allowed for additional parameters to be passed.
func GetConfigmapByName ¶ added in v0.5.0
func GetConfigmapByName(client client.Client, name, namespace string) (configmap *v1.ConfigMap, err error)
GetConfigmapByName gets configmap with given name and namespace of the configmap.
func GetDaemonPods ¶ added in v0.7.0
GetDaemonPods gets pods of the specified daemonset
func GetDaemonset ¶ added in v0.7.0
GetDaemonset gets the daemonset by name and namespace
func GetDeployment ¶ added in v0.8.0
func GetDeployment(c client.Client, key types.NamespacedName) (deploy *appsv1.Deployment, err error)
GetDeployment gets the deployment by name and namespace
func GetFuseMountInContainer ¶ added in v0.7.0
func GetIpAddressesOfNodes ¶ added in v0.9.0
GetIpAddressesOfNodes gets the ipAddresses of nodes
func GetIpAddressesOfPods ¶ added in v0.9.0
func GetIpAddressesOfPods(client client.Client, pods []corev1.Pod) (ipAddresses []string, err error)
GetIpAddressesOfPods gets the ipAddresses of pods
func GetMountInfoFromVolumeClaim ¶ added in v0.7.0
func GetMountInfoFromVolumeClaim(client client.Client, name, namespace string) (path string, mountType string, subpath string, err error)
GetMountInfoFromVolumeClaim gets the mountPath and type for CSI plugin
func GetMountPathInContainer ¶ added in v0.8.0
func GetPVCNamesFromPod ¶ added in v0.6.0
GetPVCNamesFromPod get names of pvc mounted by Pod
func GetPVCsFromPod ¶ added in v0.6.0
GetPVCsFromPod get PersistVolumeClaims of pod
func GetPersistentVolume ¶ added in v0.7.0
func GetPersistentVolumeClaim ¶ added in v0.7.0
func GetPhaseFromStatefulset ¶ added in v0.7.0
func GetPhaseFromStatefulset(replicas int32, sts appsv1.StatefulSet) (phase datav1alpha1.RuntimePhase)
GetPhaseFromStatefulset gets the phase from statefulset
func GetPodByName ¶
GetPodByName gets pod with given name and namespace of the pod.
func GetPodsForStatefulSet ¶ added in v0.7.0
func GetPodsForStatefulSet(c client.Client, sts *appsv1.StatefulSet, selector labels.Selector) (pods []v1.Pod, err error)
GetPodsForStatefulSet gets pods of the specified statefulset
func GetPvcMountNodes ¶ added in v0.5.0
GetPvcMountNodes get nodes which have pods mounted the specific pvc for a given namespace it will only return a map of nodeName and amount of PvcMountPods on it if the Pvc mount Pod has completed, it will be ignored if fail to get pvc mount Nodes, treat every nodes as with no PVC mount Pods
func GetPvcMountPods ¶
GetPvcMountPods get pods that mounted the specific pvc for a given namespace
func GetReferringDatasetPVCInfo ¶ added in v0.9.0
func GetReferringDatasetPVCInfo(pvc *corev1.PersistentVolumeClaim) (ok bool, name string, namespace string)
GetReferringDatasetPVCInfo check whether the PVC is a referring dataset PVC
func GetSecret ¶ added in v0.7.0
GetSecret gets the secret. It returns a pointer to the secret if successful.
func GetServiceByName ¶ added in v0.4.0
func GetServiceByName(client client.Client, name, namespace string) (service *corev1.Service, err error)
get service given name and namespace of the service.
func GetStatefulSet ¶ added in v0.7.0
func GetStatefulSet(c client.Client, name string, namespace string) (master *appsv1.StatefulSet, err error)
GetStatefulset gets the statefulset by name and namespace
func GetUnavailableDaemonPodNames ¶ added in v0.7.0
func GetUnavailableDaemonPodNames(c client.Client, ds *appsv1.DaemonSet) (names []types.NamespacedName, err error)
GetUnavailableDaemonPods gets unavailable pods of the specified daemonset
func GetUnavailableDaemonPods ¶ added in v0.7.0
func GetUnavailableDaemonPods(c client.Client, ds *appsv1.DaemonSet) (unavailablePods []*v1.Pod, err error)
GetUnavailableDaemonPods gets unavailable pods of the specified daemonset
func GetUnavailablePodNamesForStatefulSet ¶ added in v0.7.0
func GetUnavailablePodNamesForStatefulSet(c client.Client, sts *appsv1.StatefulSet, selector labels.Selector) (names []types.NamespacedName, err error)
GetUnavailablePodNamesForStatefulSet gets pod names of the specified statefulset
func GetUnavailablePodsStatefulSet ¶ added in v0.7.0
func GetUnavailablePodsStatefulSet(c client.Client, sts *appsv1.StatefulSet, selector labels.Selector) (unavailablePods []*v1.Pod, err error)
GetUnavailablePodsStatefulSet gets unavailable pods of the specified statefulset
func IsCompletePod ¶
IsCompletePod determines if the pod is complete
func IsConfigMapExist ¶
IsConfigMapExist checks if the configMap exists given its name and namespace.
func IsDatasetPVC ¶ added in v0.6.0
IsDatasetPVC check whether the PVC is a dataset PVC
func IsFailedPod ¶
IsFailedPod determines if the pod is failed
func IsFinishedPod ¶ added in v0.9.0
IsFinishedPod determines if the pod is succeeded or failed
func IsPersistentVolumeClaimExist ¶
func IsPersistentVolumeClaimExist(client client.Client, name, namespace string, annotations map[string]string) (found bool, err error)
IsPersistentVolumeClaimExist checks if the persistent volume claim exists given name, namespace and annotations of the PVC.
func IsPersistentVolumeExist ¶
func IsPersistentVolumeExist(client client.Client, name string, annotations map[string]string) (found bool, err error)
IsPersistentVolumeExist checks if the persistent volume exists given name and annotations of the PV.
func IsReady ¶
IsReady checks if the node is ready If the node is ready,it returns True.Otherwise,it returns False.
func IsSucceededPod ¶ added in v0.5.0
IsSucceededPod determines if the pod is Succeeded
func PVCNames ¶ added in v0.7.0
func PVCNames(volumeMounts []corev1.VolumeMount, volumes []corev1.Volume) (pvcNames []string)
func RemoveProtectionFinalizer ¶
RemoveProtectionFinalizer removes finalizers of PersistentVolumeClaim if all owners that this PVC is mounted by are inactive (Succeed or Failed)
func SetPVCDeleteTimeout ¶ added in v0.9.0
SetPVCDeleteTimeout is only for test case usage
func ShouldDeleteDataset ¶ added in v0.5.0
ShouldDeleteDataset return no err when no pod is using the volume If cannot get PVC, cannot get PvcMountPods, or running pod is using the volume, return corresponding error
func ShouldRemoveProtectionFinalizer ¶
func ShouldRemoveProtectionFinalizer(client client.Client, name, namespace string) (should bool, err error)
ShouldRemoveProtectionFinalizer check if should remove pvc-protection finalizer by force. Force-removal happens only when it matches both the two following conditions:
- PVC's in Terminating state for over than 30 seconds
- PVC's not actively used by any pods