k8s

package
v1.0.0-1 Latest Latest
Warning

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

Go to latest
Published: Apr 26, 2022 License: Apache-2.0 Imports: 32 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ApplyYamlWithKubectl

func ApplyYamlWithKubectl(path, namespace string) error

func GetConfigMapObj

func GetConfigMapObj(yamlPath string) (*v1.ConfigMap, error)

func GetPodObj

func GetPodObj(yamlPath string) (*v1.Pod, error)

func GetSecretObj

func GetSecretObj(yamlPath string) (*v1.Secret, error)

func ObserveEventAfterAction

func ObserveEventAfterAction(c clientset.Interface, ns string, eventPredicate func(*v1.Event) bool, action Action) (bool, error)

observeEventAfterAction returns true if an event matching the predicate was emitted from the system after performing the supplied action.

func ScheduleFailureEvent

func ScheduleFailureEvent(podName string) func(*v1.Event) bool

func ScheduleSuccessEvent

func ScheduleSuccessEvent(ns, podName, nodeName string) func(*v1.Event) bool

func SetPortForwarder

func SetPortForwarder(req PortForwardAPodRequest, dialer httpstream.Dialer, ports []string) error

Types

type Action

type Action func() error

Action is a function to be performed by the system.

type KubeCtl

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

func (*KubeCtl) CreateClusterRoleBinding

func (k *KubeCtl) CreateClusterRoleBinding(
	roleName string,
	role string,
	namespace string,
	serviceAccount string) (*authv1.ClusterRoleBinding, error)

func (*KubeCtl) CreateConfigMap

func (k *KubeCtl) CreateConfigMap(cMap *v1.ConfigMap, namespace string) (*v1.ConfigMap, error)

func (*KubeCtl) CreateConfigMaps

func (k *KubeCtl) CreateConfigMaps(namespace string, cMap *v1.ConfigMap) (*v1.ConfigMap, error)

func (*KubeCtl) CreateNamespace

func (k *KubeCtl) CreateNamespace(namespace string, annotations map[string]string) (*v1.Namespace, error)

Func to create a namespace provided a name

func (*KubeCtl) CreatePod

func (k *KubeCtl) CreatePod(pod *v1.Pod, namespace string) (*v1.Pod, error)

func (*KubeCtl) CreateSecret

func (k *KubeCtl) CreateSecret(secret *v1.Secret, namespace string) (*v1.Secret, error)

func (*KubeCtl) CreateServiceAccount

func (k *KubeCtl) CreateServiceAccount(accountName string, namespace string) (*v1.ServiceAccount, error)

func (*KubeCtl) CreateTestPodAction

func (k *KubeCtl) CreateTestPodAction(pod *v1.Pod, namespace string) Action

CreateTestPodAction returns a closure that creates a pause pod upon invocation.

func (*KubeCtl) DeleteClusterRoleBindings

func (k *KubeCtl) DeleteClusterRoleBindings(roleName string) error

func (*KubeCtl) DeleteConfigMap

func (k *KubeCtl) DeleteConfigMap(cName string, namespace string) error

func (*KubeCtl) DeleteConfigMaps

func (k *KubeCtl) DeleteConfigMaps(namespace string, cMapName string) error

func (*KubeCtl) DeleteNamespace

func (k *KubeCtl) DeleteNamespace(namespace string) error

func (*KubeCtl) DeletePod

func (k *KubeCtl) DeletePod(podName string, namespace string) error

func (*KubeCtl) DeletePodAnnotation

func (k *KubeCtl) DeletePodAnnotation(pod *v1.Pod, namespace, annotation string) (*v1.Pod, error)

func (*KubeCtl) DeletePodGracefully

func (k *KubeCtl) DeletePodGracefully(podName string, namespace string) error

func (*KubeCtl) DeleteServiceAccount

func (k *KubeCtl) DeleteServiceAccount(accountName string, namespace string) error

func (*KubeCtl) GetClient

func (k *KubeCtl) GetClient() *kubernetes.Clientset

func (*KubeCtl) GetConfigMap

func (k *KubeCtl) GetConfigMap(name string, namespace string) (*v1.ConfigMap, error)

func (*KubeCtl) GetConfigMaps

func (k *KubeCtl) GetConfigMaps(namespace string, cMapName string) (*v1.ConfigMap, error)

func (*KubeCtl) GetEvents

func (k *KubeCtl) GetEvents(namespace string) (*v1.EventList, error)

func (*KubeCtl) GetKubeConfig

func (k *KubeCtl) GetKubeConfig() (*rest.Config, error)

func (*KubeCtl) GetPod

func (k *KubeCtl) GetPod(name, namespace string) (*v1.Pod, error)

func (*KubeCtl) GetPodNamesFromNS

func (k *KubeCtl) GetPodNamesFromNS(namespace string) ([]string, error)

func (*KubeCtl) GetPods

func (k *KubeCtl) GetPods(namespace string) (*v1.PodList, error)

func (*KubeCtl) GetSchedulerPod

func (k *KubeCtl) GetSchedulerPod() (string, error)

func (*KubeCtl) GetService

func (k *KubeCtl) GetService(serviceName string, namespace string) (*v1.Service, error)

func (*KubeCtl) KillPortForwardProcess

func (k *KubeCtl) KillPortForwardProcess()

func (*KubeCtl) ListPods

func (k *KubeCtl) ListPods(namespace string, selector string) (*v1.PodList, error)

Returns the list of currently scheduled or running pods in `namespace` with the given selector

func (*KubeCtl) PodScheduled

func (k *KubeCtl) PodScheduled(podNamespace, podName string) wait.ConditionFunc

PodScheduled checks if the pod has been scheduled

func (*KubeCtl) PodUnschedulable

func (k *KubeCtl) PodUnschedulable(podNamespace, podName string) wait.ConditionFunc

PodUnschedulable returns a condition function that returns true if the given pod gets unschedulable status.

func (*KubeCtl) PortForwardPod

func (k *KubeCtl) PortForwardPod(req PortForwardAPodRequest) error

func (*KubeCtl) PortForwardYkSchedulerPod

func (k *KubeCtl) PortForwardYkSchedulerPod() error

func (*KubeCtl) RemoveYunikornSchedulerPodAnnotation

func (k *KubeCtl) RemoveYunikornSchedulerPodAnnotation(annotation string) error

func (*KubeCtl) SetClient

func (k *KubeCtl) SetClient() error

func (*KubeCtl) TearDownNamespace

func (k *KubeCtl) TearDownNamespace(namespace string) error

func (*KubeCtl) UpdateConfigMap

func (k *KubeCtl) UpdateConfigMap(cMap *v1.ConfigMap, namespace string) (*v1.ConfigMap, error)

func (*KubeCtl) UpdateConfigMaps

func (k *KubeCtl) UpdateConfigMaps(namespace string, cMap *v1.ConfigMap) (*v1.ConfigMap, error)

func (*KubeCtl) UpdatePodWithAnnotation

func (k *KubeCtl) UpdatePodWithAnnotation(pod *v1.Pod, namespace, annotationKey, annotationVal string) (*v1.Pod, error)

func (*KubeCtl) UpdateYunikornSchedulerPodAnnotation

func (k *KubeCtl) UpdateYunikornSchedulerPodAnnotation(annotation string) error

func (*KubeCtl) WaitForPodBySelectorRunning

func (k *KubeCtl) WaitForPodBySelectorRunning(namespace string, selector string, timeout int) error

Wait up to timeout seconds for all pods in 'namespace' with given 'selector' to enter running state. Returns an error if no pods are found or not all discovered pods enter running state.

func (*KubeCtl) WaitForPodFailed

func (k *KubeCtl) WaitForPodFailed(namespace string, podName string, timeout time.Duration) error

func (*KubeCtl) WaitForPodPending

func (k *KubeCtl) WaitForPodPending(namespace string, podName string, timeout time.Duration) error

func (*KubeCtl) WaitForPodRunning

func (k *KubeCtl) WaitForPodRunning(namespace string, podName string, timeout time.Duration) error

Poll up to timeout seconds for pod to enter running state. Returns an error if the pod never enters the running state.

func (*KubeCtl) WaitForPodScheduled

func (k *KubeCtl) WaitForPodScheduled(namespace string, podName string, timeout time.Duration) error

func (*KubeCtl) WaitForPodSucceeded

func (k *KubeCtl) WaitForPodSucceeded(namespace string, podName string, timeout time.Duration) error

func (*KubeCtl) WaitForPodTerminated

func (k *KubeCtl) WaitForPodTerminated(namespace string, podName string, timeout time.Duration) error

func (*KubeCtl) WaitForPodUnschedulable

func (k *KubeCtl) WaitForPodUnschedulable(pod *v1.Pod, timeout time.Duration) error

WaitForPodUnschedulable waits for a pod to fail scheduling and returns an error if it does not become unschedulable within the given timeout.

func (*KubeCtl) WaitForSchedulerAfterAction

func (k *KubeCtl) WaitForSchedulerAfterAction(action Action, ns, podName string, expectSuccess bool) (bool, error)

WaitForSchedulerAfterAction performs the provided action and then waits for scheduler to act on the given pod.

func (*KubeCtl) WaitForServiceAccountPresent

func (k *KubeCtl) WaitForServiceAccountPresent(namespace string, svcAcctName string, timeout time.Duration) error

type PortForwardAPodRequest

type PortForwardAPodRequest struct {
	// Kube config
	RestConfig *rest.Config
	// Pod to port-forward traffic for
	Pod v1.Pod
	// Local port to expose traffic to pod's target port
	LocalPort int
	// Target port for the pod
	PodPort int
	// Streams to configure where to read/write input and output
	Streams genericclioptions.IOStreams
	// StopCh is the channel used to stop the port forward process
	StopCh <-chan struct{}
	// ReadyCh communicates when the tunnel is ready to receive traffic
	ReadyCh chan struct{}
}

Jump to

Keyboard shortcuts

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