kubeclient

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Sep 5, 2020 License: Apache-2.0 Imports: 23 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DeleteConfigMap

func DeleteConfigMap(client client.Client, name, namespace string) (err error)

func DeletePersistentVolume

func DeletePersistentVolume(client client.Client, name string) (err error)

DeletePersistentVolume deletes volume

func DeletePersistentVolumeClaim

func DeletePersistentVolumeClaim(client client.Client, name, namespace string) (err error)

DeletePersistentVolumeClaim deletes volume claim

func DeletePod

func DeletePod(client client.Client, pod *corev1.Pod) error

func EnsureNamespace

func EnsureNamespace(client client.Client, namespace string) (err error)

Make sure the namespace exist

func ExecCommandInContainer

func ExecCommandInContainer(podName string, containerName string, namespace string, cmd []string) (stdout string, stderr string, err error)

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)

func ExecShellInContainer

func ExecShellInContainer(podName string, containerName string, namespace string, cmd string) (stdout string, stderr string, err 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 GetNode

func GetNode(client client.Client, name string) (node *v1.Node, err error)

Get the latest node info

func GetPodByName

func GetPodByName(client client.Client, name, namespace string) (pod *corev1.Pod, err error)

func GetPodPvcs

func GetPodPvcs(volumes []v1.Volume) []v1.Volume

GetPodPvcs get PersistVolumeClaims of pod

func GetPvcMountPods

func GetPvcMountPods(e client.Client, pvcName, namespace string) ([]v1.Pod, error)

GetPvcMountPods get pods that mounted the specific pvc for a given namespace

func IsCompletePod

func IsCompletePod(pod *corev1.Pod) bool

IsCompletePod determines if the pod is complete

func IsConfigMapExist

func IsConfigMapExist(client client.Client, name, namespace string) (found bool, err error)

func IsFailedPod

func IsFailedPod(pod *corev1.Pod) bool

IsFailedPod determines if the pod is failed

func IsPersistentVolumeClaimExist

func IsPersistentVolumeClaimExist(client client.Client, name, namespace string, annotations map[string]string) (found bool, err error)

IsPersistentVolumeClaimExist

func IsPersistentVolumeExist

func IsPersistentVolumeExist(client client.Client, name string, annotations map[string]string) (found bool, err error)

IsPersistentVolumeExist

func IsReady

func IsReady(node v1.Node) (ready bool)

Check if the node is ready

func RemoveProtectionFinalizer

func RemoveProtectionFinalizer(client client.Client, name, namespace string) (err error)

RemoveProtectionFinalizer remove finalizers of PersistentVolumeClaim if all owners that this PVC is mounted by are inactive (Succeed or Failed)

func ShouldRemoveProtectionFinalizer

func ShouldRemoveProtectionFinalizer(client client.Client, name, namespace string) (should bool, err error)

ShouldRemoveProtectionFinalizer should remove pvc-protection finalizer when linked pods are inactive and timeout

Types

type ExecOptions

type ExecOptions struct {
	Command []string

	Namespace     string
	PodName       string
	ContainerName string

	Stdin         io.Reader
	CaptureStdout bool
	CaptureStderr bool
	// If false, whitespace in std{err,out} will be removed.
	PreserveWhitespace bool
}

ExecOptions passed to ExecWithOptions

Jump to

Keyboard shortcuts

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