heartbeat

package
v1.10.4 Latest Latest
Warning

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

Go to latest
Published: May 14, 2026 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Overview

Package heartbeat manages per-controller liveness reporting for Kargo controllers. Each controller writes a coordination.k8s.io/v1.Lease to the Kargo namespace and renews it periodically; the API server lists those leases to derive controller liveness for the UI.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetAll

func GetAll(
	ctx context.Context,
	c client.Reader,
	namespace string,
) (map[string]Heartbeat, error)

GetAll returns a map of Heartbeats from every controller that has reported in, indexed by controller name. Any controller without a corresponding key in the map has never produced a heartbeat and can therefore be assumed by the caller to be dead or nonexistent.

func NewRenewer

func NewRenewer(
	c client.Client,
	namespace string,
	controllerName string,
	leaseDuration time.Duration,
) manager.Runnable

NewRenewer returns an implementation of controller-runtime's manager.Runnable interface that creates, renews, and (on shutdown) deletes a heartbeat record for a Kargo controller.

Types

type Heartbeat

type Heartbeat struct {
	// Controller is the name of the controller as reported in the Lease's
	// kargoapi.LabelKeyController label. This may be empty if the controller that
	// produced the heartbeat was unnamed.
	Controller string `json:"controller"`
	// Status is point-in-time liveness synthesized from a heartbeat record.
	Status Status `json:"status"`
	// Timestamp is the timestamp of the heartbeat. nil when the underlying record
	// carried no parseable timestamp.
	Timestamp *time.Time `json:"timestamp,omitempty"`
}

Heartbeat describes what the heartbeat system knows about a single controller.

type Status

type Status string // @name HeartbeatStatus

Status is point-in-time liveness synthesized from a single controller's heartbeat.

const (
	// StatusAlive represents a controller that has reported a heartbeat recently
	// enough to be considered alive.
	StatusAlive Status = "Alive"
	// StatusDead represents a controller that has not reported a heartbeat
	// recently enough to be considered alive.
	StatusDead Status = "Dead"
)

Directories

Path Synopsis
Package heartbeattest provides helpers for tests that need to seed the heartbeat package's underlying storage.
Package heartbeattest provides helpers for tests that need to seed the heartbeat package's underlying storage.

Jump to

Keyboard shortcuts

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