helpers

package
v0.0.0-...-2622493 Latest Latest
Warning

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

Go to latest
Published: Feb 17, 2023 License: Apache-2.0 Imports: 18 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	K8s = &K8sClient{}
	Ctx = context.Background()
)

Functions

func ExecInNamespacePodContainer

func ExecInNamespacePodContainer(namespace, podName, containerName string, cmd []string) error

func ExecIntoDockerContainer

func ExecIntoDockerContainer(containerName string, cmds []string) error

func IsK3d

func IsK3d() (bool, error)

checks if local running cluster is a k3s cluster

func RootIntoNamespacePodContainer

func RootIntoNamespacePodContainer(namespace, podName, containerName, shell string) error

func RootIntoPodContainer

func RootIntoPodContainer(podContainerName string) error

func RunInNodeOfPod

func RunInNodeOfPod(pod v1.Pod, cmds []string) error

Types

type K8sClient

type K8sClient struct {
	Clientset *kubernetes.Clientset
}

func Init

func Init() (*K8sClient, error)

func (*K8sClient) DeletePod

func (k8s *K8sClient) DeletePod(pod v1.Pod) error

func (*K8sClient) GetAllPods

func (k8s *K8sClient) GetAllPods() ([]*v1.Pod, error)

func (*K8sClient) GetAllRunningPods

func (k8s *K8sClient) GetAllRunningPods() ([]*v1.Pod, error)

func (*K8sClient) GetHostPathOfVolumeMount

func (k8s *K8sClient) GetHostPathOfVolumeMount(namespace string, volumeMount v1.Volume) (string, error)

func (*K8sClient) GetLogsOfPod

func (k8s *K8sClient) GetLogsOfPod(pod v1.Pod) (string, error)

func (*K8sClient) GetNamespace

func (k8s *K8sClient) GetNamespace() string

func (*K8sClient) GetNodeOfPod

func (k8s *K8sClient) GetNodeOfPod(pod v1.Pod) (*v1.Node, error)

func (*K8sClient) GetNodes

func (k8s *K8sClient) GetNodes() ([]v1.Node, error)

func (*K8sClient) GetPV

func (k8s *K8sClient) GetPV(volumeName string) (*v1.PersistentVolume, error)

func (*K8sClient) GetPVC

func (k8s *K8sClient) GetPVC(namespace, claimName string) (*v1.PersistentVolumeClaim, error)

func (*K8sClient) GetPodByNameInCurrentNamespace

func (k8s *K8sClient) GetPodByNameInCurrentNamespace(name string) (*v1.Pod, error)

func (*K8sClient) GetPodByNamespaceAndName

func (k8s *K8sClient) GetPodByNamespaceAndName(namespace, name string) (*v1.Pod, error)

func (*K8sClient) GetPodsByImage

func (k8s *K8sClient) GetPodsByImage(imageName string, exactMatch bool) ([]*v1.Pod, error)

func (*K8sClient) GetPodsByNamespace

func (k8s *K8sClient) GetPodsByNamespace(namespace string, requireRunning bool) ([]*v1.Pod, error)

func (*K8sClient) GetRunningPodsInCurrentNamespace

func (k8s *K8sClient) GetRunningPodsInCurrentNamespace() ([]*v1.Pod, error)

Jump to

Keyboard shortcuts

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