kube

package
v0.0.0-...-52e0d5c Latest Latest
Warning

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

Go to latest
Published: Dec 19, 2024 License: Apache-2.0 Imports: 30 Imported by: 61

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNoPodsFetched = fmt.Errorf("no pods fetched")
)

Functions

func CheckPodsAreReady

func CheckPodsAreReady(fetchFunc PodFetchFunc) ([]corev1.Pod, error)

CheckPodsAreReady checks whether the pods that are selected by the given function is in ready state or not.

func DeleteOptionsForeground

func DeleteOptionsForeground() metav1.DeleteOptions

DeleteOptionsForeground creates new delete options that will block until the operation completes.

func DumpCoreDumps

func DumpCoreDumps(_ resource.Context, c cluster.Cluster, workDir string, namespace string, pods ...corev1.Pod)

func DumpDebug

func DumpDebug(ctx resource.Context, c cluster.Cluster, workDir, endpoint, namespace string)

func DumpDeployments

func DumpDeployments(ctx resource.Context, workDir, namespace string)

func DumpPodAgent

func DumpPodAgent(ctx resource.Context, c cluster.Cluster, workDir string, _ string, pods ...corev1.Pod)

func DumpPodEnvoy

func DumpPodEnvoy(ctx resource.Context, c cluster.Cluster, workDir, namespace string, pods ...corev1.Pod)

DumpPodEnvoy will dump Envoy proxy config and clusters in each of the provided pods or all pods in the namespace if none are provided.

func DumpPodEvents

func DumpPodEvents(_ resource.Context, c cluster.Cluster, workDir, namespace string, pods ...corev1.Pod)

DumpPodEvents dumps the pod events for either the provided pods or all pods in the namespace if none are provided.

func DumpPodLogs

func DumpPodLogs(_ resource.Context, c cluster.Cluster, workDir, namespace string, pods ...corev1.Pod)

DumpPodLogs will dump logs from each container in each of the provided pods or all pods in the namespace if none are provided.

func DumpPodState

func DumpPodState(_ resource.Context, c cluster.Cluster, workDir string, namespace string, pods ...corev1.Pod)

DumpPodState dumps the pod state for either the provided pods or all pods in the namespace if none are provided.

func DumpPods

func DumpPods(ctx resource.Context, workDir, namespace string, selectors []string, dumpers ...PodDumper)

DumpPods runs each dumper with the selected pods in the given namespace. If selectors is empty, all pods in the namespace will be dumpped. If no dumpers are provided, their resource state, events, container logs and Envoy information will be dumped.

func DumpTerminationLogs

func DumpTerminationLogs(ctx context.Context, c cluster.Cluster, workDir string, pod corev1.Pod, containerName string)

Will capture pod logs until target pod/container terminates, and then will write them to file. Generally should be run in a goroutine while deletion happens

func DumpWebhooks

func DumpWebhooks(ctx resource.Context, workDir string)

func MutatingWebhookConfigurationsExists

func MutatingWebhookConfigurationsExists(a kubernetes.Interface, names []string) bool

MutatingWebhookConfigurationsExists returns true if all the given mutating webhook configs exist.

func NamespaceExists

func NamespaceExists(a kubernetes.Interface, ns string) bool

NamespaceExists returns true if the given namespace exists.

func ValidatingWebhookConfigurationsExists

func ValidatingWebhookConfigurationsExists(a kubernetes.Interface, names []string) bool

ValidatingWebhookConfigurationsExists returns true if all the given validating webhook configs exist.

func WaitForNamespaceDeletion

func WaitForNamespaceDeletion(a kubernetes.Interface, ns string, opts ...retry.Option) error

WaitForNamespaceDeletion waits until a namespace is deleted.

func WaitForSecretToExist

func WaitForSecretToExist(a kubernetes.Interface, namespace, name string, waitTime time.Duration) (*corev1.Secret, error)

WaitForSecretToExist waits for the given secret up to the given waitTime.

func WaitForSecretToExistOrFail

func WaitForSecretToExistOrFail(t test.Failer, a kubernetes.Interface, namespace, name string,
	waitTime time.Duration,
) *corev1.Secret

WaitForSecretToExistOrFail calls WaitForSecretToExist and fails the given test.Failer if an error occurs.

func WaitUntilPodsAreReady

func WaitUntilPodsAreReady(fetchFunc PodFetchFunc, opts ...retry.Option) ([]corev1.Pod, error)

WaitUntilPodsAreReady waits until the pod with the name/namespace is in ready state.

func WaitUntilServiceEndpointsAreReady

func WaitUntilServiceEndpointsAreReady(a kubernetes.Interface, ns string, name string,
	opts ...retry.Option,
) (*corev1.Service, *corev1.Endpoints, error)

WaitUntilServiceEndpointsAreReady will wait until the service with the given name/namespace is present, and have at least one usable endpoint.

func WaitUntilServiceLoadBalancerReady

func WaitUntilServiceLoadBalancerReady(a kubernetes.Interface, ns string, name string, opts ...retry.Option) (string, error)

Types

type PodDumper

type PodDumper func(ctx resource.Context, cluster cluster.Cluster, workDir string, namespace string, pods ...corev1.Pod)

PodDumper will dump information from all the pods into the given workDir. If no pods are provided, client will be used to fetch all the pods in a namespace.

type PodFetchFunc

type PodFetchFunc func() ([]corev1.Pod, error)

PodFetchFunc fetches pods from a k8s Client.

func NewPodFetch

func NewPodFetch(a istioKube.CLIClient, namespace string, selectors ...string) PodFetchFunc

NewPodFetch creates a new PodFetchFunction that fetches all pods matching the namespace and label selectors.

func NewPodMustFetch

func NewPodMustFetch(a istioKube.CLIClient, namespace string, selectors ...string) PodFetchFunc

NewPodMustFetch creates a new PodFetchFunction that fetches all pods matching the namespace and label selectors. If no pods are found, an error is returned

func NewSinglePodFetch

func NewSinglePodFetch(a istioKube.CLIClient, namespace string, selectors ...string) PodFetchFunc

NewSinglePodFetch creates a new PodFetchFunction that fetches a single pod matching the given label selectors.

Jump to

Keyboard shortcuts

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