kube

package
v0.0.0-...-83947fe Latest Latest
Warning

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

Go to latest
Published: Feb 27, 2024 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetPodCondition

func GetPodCondition(status *corev1.PodStatus, conditionType corev1.PodConditionType) (int, *corev1.PodCondition)

GetPodCondition extracts the provided condition from the given status and returns that. Returns nil and -1 if the condition is not present, and the index of the located condition.

func GetPodConditionFromList

func GetPodConditionFromList(conditions []corev1.PodCondition, conditionType corev1.PodConditionType) (int, *corev1.PodCondition)

GetPodConditionFromList extracts the provided condition from the given list of condition and returns the index of the condition and the condition. Returns -1 and nil if the condition is not present.

func GetPodReadyCondition

func GetPodReadyCondition(status corev1.PodStatus) *corev1.PodCondition

GetPodReadyCondition extracts the pod ready condition from the given status and returns that. Returns nil if the condition is not present.

func IsPodReady

func IsPodReady(pod *corev1.Pod) bool

IsPodReady returns true if a pod is ready; false otherwise.

func IsPodReadyConditionTrue

func IsPodReadyConditionTrue(status corev1.PodStatus) bool

IsPodReadyConditionTrue returns true if a pod is ready; false otherwise.

func RollingUpdate

func RollingUpdate(ctx context.Context, cl client.Client, stsName, namespace string, readinessWait, podUpdateTimeout time.Duration) error

func WaitForPodReady

func WaitForPodReady(ctx context.Context, cl client.Client, name, namespace string, podUpdateTimeout,
	podMaxPollingInterval time.Duration) error

func WaitUntilAllStsPodsAreReady

func WaitUntilAllStsPodsAreReady(ctx context.Context, cl client.Client, stsName, namespace string, podUpdateTimeout, podMaxPollingInterval time.Duration) error

WaitUntilAllStsPodsAreReady waits until all pods in the statefulset are in the ready state. The ready state implies all nodes are passing node liveness.

Types

type MutateFn

type MutateFn func() error

MutateFn is a function which mutates the existing object into it's desired state.

type PersistFn

type PersistFn func(context.Context, client.Client, client.Object, MutateFn) (upserted bool, err error)
var DefaultPersister PersistFn = func(ctx context.Context, cl client.Client, obj client.Object, f MutateFn) (upserted bool, err error) {
	result, err := ctrl.CreateOrUpdate(ctx, cl, obj, func() error {
		return f()
	})

	return result == ctrlutil.OperationResultCreated || result == ctrlutil.OperationResultUpdated, err
}

Jump to

Keyboard shortcuts

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