client

package
v0.8.0 Latest Latest
Warning

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

Go to latest
Published: Jul 17, 2024 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsStatefulSetDegradedPredicate

func IsStatefulSetDegradedPredicate(statefulSet *appsv1.StatefulSet, expectedReplicas int) bool

func IsStatefulSetReadyPredicate

func IsStatefulSetReadyPredicate(statefulSet *appsv1.StatefulSet, expectedReplicas int) bool

func ListPods

func ListPods(ctx context.Context, cs *kubernetes.Clientset, namespace, selector string) (*corev1.PodList, error)

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

func WaitForPodBySelector

func WaitForPodBySelector(ctx context.Context, cs *kubernetes.Clientset, namespace, selector string, timeout time.Duration) error

WaitForPodBySelector waits up to timeout seconds for all pods in 'namespace' with given 'selector' to enter provided state If no pods are found, return nil.

func WaitForPodReady

func WaitForPodReady(ctx context.Context, cs *kubernetes.Clientset, namespace, podName string, timeout time.Duration) error

WaitForPodReady polls up to timeout seconds for pod to enter steady state (running or succeeded state). Returns an error if the pod never enters a steady state.

func WaitForPodToDisappear

func WaitForPodToDisappear(ctx context.Context, cs *kubernetes.Clientset, namespace, podName string, timeout time.Duration) error

WaitForPodToDisappear polls up to timeout seconds for pod to be gone from the Kubernetes cluster. Returns an error if the pod is never deleted, or if GETing it returns an error other than `NotFound`.

func WaitForReplicaSetSteadyState

func WaitForReplicaSetSteadyState(ctx context.Context, cs *kubernetes.Clientset, namespace, label string, replicaSet *appsv1.ReplicaSet, timeout time.Duration) error

WaitForReplicaSetSteadyState only plays nice with the replicaSet it's being used with. Any pods that might be up still from a previous test may cause unexpected results.

func WaitForReplicaSetToDisappear

func WaitForReplicaSetToDisappear(ctx context.Context, cs *kubernetes.Clientset, namespace, rsName string, timeout time.Duration) error

WaitForReplicaSetToDisappear polls up to timeout seconds for replicaset to be gone from the Kubernetes cluster. Returns an error if the replicaset is never deleted, or if GETing it returns an error other than `NotFound`.

func WaitForStatefulSetCondition

func WaitForStatefulSetCondition(ctx context.Context, cs *kubernetes.Clientset, namespace, serviceName string, expectedReplicas int, timeout time.Duration, predicate statefulSetPredicate) error

func WaitForStatefulSetGone

func WaitForStatefulSetGone(ctx context.Context, cs *kubernetes.Clientset, namespace, serviceName string, labelSelector string, timeout time.Duration) error

WaitForStatefulSetGone ...

func WaitForZeroIPPoolAllocations

func WaitForZeroIPPoolAllocations(ctx context.Context, k8sIPAM *kubeClient.KubernetesIPAM, ipPoolCIDR string, timeout time.Duration) error

WaitForZeroIPPoolAllocations polls up to timeout seconds for IP pool allocations to be gone from the Kubernetes cluster. Returns an error if any IP pool allocations remain after time limit, or if GETing IP pools causes an error.

Types

type ClientInfo

type ClientInfo struct {
	Client    *kubernetes.Clientset
	NetClient netclient.K8sCniCncfIoV1Interface
	WbClient  wbclient.Interface
}

func NewClientInfo

func NewClientInfo(config *rest.Config) (*ClientInfo, error)

func (*ClientInfo) AddNetAttachDef

func (*ClientInfo) DelNetAttachDef

func (c *ClientInfo) DelNetAttachDef(netattach *nettypes.NetworkAttachmentDefinition) error

func (*ClientInfo) DeletePod

func (c *ClientInfo) DeletePod(pod *corev1.Pod) error

func (*ClientInfo) DeleteReplicaSet

func (c *ClientInfo) DeleteReplicaSet(replicaSet *appsv1.ReplicaSet) error

func (*ClientInfo) DeleteStatefulSet

func (c *ClientInfo) DeleteStatefulSet(namespace string, serviceName string, labelSelector string) error

func (*ClientInfo) ProvisionPod

func (c *ClientInfo) ProvisionPod(podName string, namespace string, label, annotations map[string]string) (*corev1.Pod, error)

func (*ClientInfo) ProvisionReplicaSet

func (c *ClientInfo) ProvisionReplicaSet(rsName string, namespace string, replicaCount int32, labels, annotations map[string]string) (*appsv1.ReplicaSet, error)

func (*ClientInfo) ProvisionStatefulSet

func (c *ClientInfo) ProvisionStatefulSet(statefulSetName string, namespace string, serviceName string, replicas int, networkNames ...string) (*appsv1.StatefulSet, error)

func (*ClientInfo) ScaleStatefulSet

func (c *ClientInfo) ScaleStatefulSet(statefulSetName string, namespace string, deltaInstance int) error

func (*ClientInfo) UpdateReplicaSet

func (c *ClientInfo) UpdateReplicaSet(replicaSet *appsv1.ReplicaSet) (*appsv1.ReplicaSet, error)

Jump to

Keyboard shortcuts

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