kubeobserver

package
v0.0.89 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AreReplicasReady added in v0.0.75

func AreReplicasReady(replicas, ready, updated int32) bool

func NewPodCondititionWaiter

func NewPodCondititionWaiter(namespace string, selector metav1.ListOptions, isOk func(corev1.PodStatus) (bool, error)) *podWaiter

func PickPod

func PickPod(name string) metav1.ListOptions

func PodStatusToWaitStatus added in v0.0.81

func PodStatusToWaitStatus(ns, name string, ps v1.PodStatus) *orchestration.Event_WaitStatus

func PrepareEvent

func PrepareEvent(gvk kubeschema.GroupVersionKind, namespace, name, desc string, deployable *runtime.Deployable) *orchestration.Event

func ResolvePod

func ResolvePod(ctx context.Context, client *k8s.Clientset, namespace string, labels map[string]string) (v1.Pod, error)

func StatusToDiagnostic

func StatusToDiagnostic(status v1.ContainerStatus) *runtime.Diagnostics

func WaitForCondition

func WaitForCondition[Client any](ctx context.Context, cli Client, action *tasks.ActionEvent, waiter ConditionWaiter[Client]) error

func WatchDeployable

func WatchDeployable[V any](ctx context.Context, actionName string, cli *k8s.Clientset, namespace string, object runtime.Deployable, callback func(corev1.Pod) (V, bool, error)) (V, error)

func WatchPods

func WatchPods[V any](ctx context.Context, cli *k8s.Clientset, namespace string, labels map[string]string, callback func(corev1.Pod) (V, bool, error)) (V, error)

Types

type ConditionWaiter

type ConditionWaiter[Client any] interface {
	Prepare(context.Context, Client) error
	Poll(context.Context, Client) (bool, error)
}

func WaitForPodConditition

func WaitForPodConditition(namespace string, selector metav1.ListOptions, isOk func(corev1.PodStatus) (bool, error)) ConditionWaiter[*k8s.Clientset]

type PodObserver

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

PodObserver continuously attempts to resolve a single pod that match the specified set of labels. If the resolved pod is terminated, a new one is picked.

func NewPodObserver

func NewPodObserver(ctx context.Context, client *k8s.Clientset, namespace string, labels map[string]string) *PodObserver

func (*PodObserver) Resolve

func (p *PodObserver) Resolve(ctx context.Context) (v1.Pod, error)

func (*PodObserver) Watch

func (p *PodObserver) Watch(f func(*v1.Pod, int64, error)) func()

type WaitOnGenerationCondition

type WaitOnGenerationCondition struct {
	RestConfig         *rest.Config
	Name, Namespace    string
	ExpectedGeneration int64
	ConditionType      string
	Resource           schema.GroupVersionResource
}

func (WaitOnGenerationCondition) WaitUntilReady

func (w WaitOnGenerationCondition) WaitUntilReady(ctx context.Context, ch chan *orchestration.Event) error

type WaitOnResource

type WaitOnResource struct {
	RestConfig *rest.Config

	Name, Namespace  string
	Description      string
	GroupVersionKind kubeschema.GroupVersionKind
	Scope            schema.PackageName

	PreviousGen, ExpectedGen int64
}

func (WaitOnResource) WaitUntilReady

func (w WaitOnResource) WaitUntilReady(ctx context.Context, ch chan *orchestration.Event) error

Jump to

Keyboard shortcuts

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