Documentation
¶
Index ¶
- type Backoff
- type Handler
- func (t *Handler) CheckTimeouts(ctx context.Context, namespace string, kubeclientset kubernetes.Interface, ...)
- func (t *Handler) GetBackoff(n types.NamespacedName, startTime metav1.Time, timeout metav1.Duration) (Backoff, bool)
- func (t *Handler) Release(n types.NamespacedName)
- func (t *Handler) SetCallbackFunc(f func(types.NamespacedName))
- func (t *Handler) SetTimer(n types.NamespacedName, d time.Duration)
- func (t *Handler) Wait(n types.NamespacedName, startTime metav1.Time, timeout metav1.Duration)
- type StatusKey
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Backoff ¶
type Backoff struct { // NumAttempts reflects the number of times a given StatusKey has been delayed NumAttempts uint // NextAttempt is the point in time at which this backoff expires NextAttempt time.Time }
Backoff contains state of exponential backoff for a given StatusKey
type Handler ¶
type Handler struct {
// contains filtered or unexported fields
}
Handler knows how to track channels that can be used to communicate with go routines which timeout, and the functions to call when that happens.
func NewHandler ¶
func NewHandler( stopCh <-chan struct{}, logger *zap.SugaredLogger, ) *Handler
NewHandler returns an instance of Handler with the specified stopCh and logger, instantiated and ready to track go routines.
func (*Handler) CheckTimeouts ¶
func (t *Handler) CheckTimeouts(ctx context.Context, namespace string, kubeclientset kubernetes.Interface, pipelineclientset clientset.Interface)
CheckTimeouts function iterates through a given namespace or all namespaces (if empty string) and calls corresponding taskrun/pipelinerun timeout functions
func (*Handler) GetBackoff ¶
func (t *Handler) GetBackoff(n types.NamespacedName, startTime metav1.Time, timeout metav1.Duration) (Backoff, bool)
GetBackoff records the number of times it has seen n and calculates an appropriate backoff deadline based on that count. Only one backoff per n may be active at any moment. Requests for a new backoff in the face of an existing one will be ignored and details of the existing backoff will be returned instead. Further, if a calculated backoff time is after the timeout of the runKey then the time of the timeout will be returned instead.
Returned values are a backoff struct containing a NumAttempts field with the number of attempts performed for this n and a NextAttempt field describing the time at which the next attempt should be performed. Additionally a boolean is returned indicating whether a backoff for n is already in progress.
func (*Handler) Release ¶
func (t *Handler) Release(n types.NamespacedName)
Release deletes channels and data that are specific to a namespacedName
func (*Handler) SetCallbackFunc ¶ added in v0.16.0
func (t *Handler) SetCallbackFunc(f func(types.NamespacedName))
SetCallbackFunc sets the callback function when timeout occurs
func (*Handler) SetTimer ¶ added in v0.16.0
func (t *Handler) SetTimer(n types.NamespacedName, d time.Duration)
SetTimer creates a blocking function for n to wait for 1. Stop signal, 2. TaskRun to complete or 3. a given Duration to elapse.
Since the timer's duration is a parameter rather than being tied to the lifetime of the run object no resources are released after the timer fires. It is the caller's responsibility to Release() the run when work with it has completed.