Documentation
¶
Index ¶
- Constants
- type NoPodEventsYetFn
- type OnPodEventFn
- type PodWatcher
- func (p *PodWatcher) Start(listOpts metav1.ListOptions) (*corev1.Pod, error)
- func (p *PodWatcher) Stop()
- func (p *PodWatcher) WithNoPodEventsYetFn(fn NoPodEventsYetFn) *PodWatcher
- func (p *PodWatcher) WithOnPodAddedFn(fn OnPodEventFn) *PodWatcher
- func (p *PodWatcher) WithOnPodDeletedFn(fn OnPodEventFn) *PodWatcher
- func (p *PodWatcher) WithOnPodModifiedFn(fn OnPodEventFn) *PodWatcher
- func (p *PodWatcher) WithSkipPodFn(fn SkipPodFn) *PodWatcher
- func (p *PodWatcher) WithTimeoutPodFn(fn TimeoutPodFn) *PodWatcher
- type SkipPodFn
- type TimeoutPodFn
Constants ¶
const ( // ContextTimeoutMessage is the message for a context timeout ContextTimeoutMessage = "context deadline has been exceeded" // RequestTimeoutMessage is the message for a request timeout RequestTimeoutMessage = "request timeout has expired" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type NoPodEventsYetFn ¶ added in v0.6.0
NoPodEventsYetFn when the watch has not received the create event within a reasonable time, where a PodList is also provided in the off chance the Pod completed before the Watch was started.
type OnPodEventFn ¶
OnPodEventFn when a pod is modified this method handles the event.
type PodWatcher ¶
type PodWatcher struct {
// contains filtered or unexported fields
}
PodWatcher a simple function orchestrator based on watching a given pod and reacting upon the state modifications, should work as a helper to build business logic based on the build POD changes.
func NewPodWatcher ¶
func NewPodWatcher( ctx context.Context, timeout time.Duration, clientset kubernetes.Interface, ns string, ) (*PodWatcher, error)
NewPodWatcher instantiate PodWatcher event-loop.
func (*PodWatcher) Start ¶
func (p *PodWatcher) Start(listOpts metav1.ListOptions) (*corev1.Pod, error)
Start runs the event loop based on a watch instantiated against informed pod. In case of errors the loop is interrupted.
func (*PodWatcher) Stop ¶
func (p *PodWatcher) Stop()
Stop closes the stop channel, and stops the execution loop.
func (*PodWatcher) WithNoPodEventsYetFn ¶ added in v0.6.0
func (p *PodWatcher) WithNoPodEventsYetFn(fn NoPodEventsYetFn) *PodWatcher
WithNoPodEventsYetFn sets the function executed when the watcher decides it has waited long enough for the first event
func (*PodWatcher) WithOnPodAddedFn ¶
func (p *PodWatcher) WithOnPodAddedFn(fn OnPodEventFn) *PodWatcher
WithOnPodAddedFn sets the function executed when a pod is added.
func (*PodWatcher) WithOnPodDeletedFn ¶
func (p *PodWatcher) WithOnPodDeletedFn(fn OnPodEventFn) *PodWatcher
WithOnPodDeletedFn sets the function executed when a pod is modified.
func (*PodWatcher) WithOnPodModifiedFn ¶
func (p *PodWatcher) WithOnPodModifiedFn(fn OnPodEventFn) *PodWatcher
WithOnPodModifiedFn sets the function executed when a pod is modified.
func (*PodWatcher) WithSkipPodFn ¶
func (p *PodWatcher) WithSkipPodFn(fn SkipPodFn) *PodWatcher
WithSkipPodFn sets the skip function instance.
func (*PodWatcher) WithTimeoutPodFn ¶ added in v0.6.0
func (p *PodWatcher) WithTimeoutPodFn(fn TimeoutPodFn) *PodWatcher
WithTimeoutPodFn sets the function executed when the context or request timeout fires
type SkipPodFn ¶
SkipPodFn a given pod instance is informed and expects a boolean as return. When true is returned this container state processing is skipped completely.
type TimeoutPodFn ¶ added in v0.6.0
type TimeoutPodFn func(msg string)
TimeoutPodFn when either the context or request timeout expires before the Pod finishes