watchdog

package
v1.31.0-rc2 Latest Latest
Warning

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

Go to latest
Published: Dec 4, 2026 License: Apache-2.0 Imports: 5 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package watchdog provides liveness-oriented heartbeats for background control loops that the liveness probe can't otherwise observe, such as the primary-lease loop in internal/cmd/manager/instance/run/lease.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type LeaseWatchdog

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

LeaseWatchdog reports whether the primary-lease loop is still attempting lock calls, whether or not they succeed. A stale heartbeat means the loop is wedged, not that renewal fails: a primary that retries against an unreachable API server is handled by the step-down monitor.

func NewLeaseWatchdog

func NewLeaseWatchdog(maxSilence time.Duration) *LeaseWatchdog

NewLeaseWatchdog creates a watchdog that considers the loop stuck once maxSilence has elapsed since the last lock call started or returned, with no call still running.

func (*LeaseWatchdog) Beat

func (w *LeaseWatchdog) Beat()

Beat records lock activity: a call starting or returning.

func (*LeaseWatchdog) IsHealthy

func (w *LeaseWatchdog) IsHealthy() error

IsHealthy reports whether the loop has attempted work recently enough. It always reports healthy until MarkAcquired has been called at least once.

func (*LeaseWatchdog) MarkAcquired

func (w *LeaseWatchdog) MarkAcquired()

MarkAcquired records that the primary lease has been held by this instance at least once. IsHealthy is a no-op until this is called: a replica, or a primary still competing for the lease for the first time, never runs the renewal loop this watchdog is meant to catch a stall in, and must not be fenced for it.

func (*LeaseWatchdog) SetMaxSilence

func (w *LeaseWatchdog) SetMaxSilence(maxSilence time.Duration)

SetMaxSilence changes the silence limit. It only needs to cover the pause between two lock calls: a call still running counts as activity, because how long it may block is the API client's business, not a sign of a wedged loop.

func (*LeaseWatchdog) WrapLock

WrapLock returns a resourcelock.Interface that beats before and after delegating every method call to lock and reports the watchdog healthy while a call is running, so an API server that does not answer is never mistaken for a wedged loop. Get and Update are the only methods actually invoked at runtime by this elector configuration (the cluster controller owns lease creation, so Create is never called), but all methods are wrapped for interface completeness.

Jump to

Keyboard shortcuts

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