health

package
v0.22.8 Latest Latest
Warning

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

Go to latest
Published: Feb 26, 2026 License: MIT Imports: 25 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func HealthStatusFromProbeResults

func HealthStatusFromProbeResults(results []apiv1.HealthProbeResult) apiv1.HealthStatus

Computes the health status of an object that has one or more health probes associated with it.

func UpdateHealthProbeResults

func UpdateHealthProbeResults(previous []apiv1.HealthProbeResult, latest map[string]apiv1.HealthProbeResult) ([]apiv1.HealthProbeResult, bool)

Computes updated health probe results based on the "previous" and "latest" results. Returns the updated results and a flag indicating whether the map has changed (true if the results have changed).

func VerifyHealthReports

func VerifyHealthReports(expected map[commonapi.NamespacedNameWithKind]map[string]apiv1.HealthProbeOutcome, reports []HealthProbeReport) error

Verifies that the LATEST health probe result for each probe and owner combination matches expectations.

func VerifyHealthResults

func VerifyHealthResults(expected map[string]apiv1.HealthProbeOutcome, results []apiv1.HealthProbeResult) error

Verify that all health probe results that we care about match expectations. The expected map contains the expected outcome for each probe name. If the probe name is not in the map, we do not care about the result.

Types

type HealthProbeExecutor

type HealthProbeExecutor interface {
	Execute(
		executionCtx context.Context,
		probe *apiv1.HealthProbe,
		probeOwner commonapi.DcpModelObject,
		probeID healthProbeIdentifier,
	) (apiv1.HealthProbeResult, error)
}

type HealthProbeExecutorFunc

type HealthProbeExecutorFunc func(
	executionCtx context.Context,
	probe *apiv1.HealthProbe,
	probeOwner commonapi.DcpModelObject,
	probeID healthProbeIdentifier,
) (apiv1.HealthProbeResult, error)

func (HealthProbeExecutorFunc) Execute

func (f HealthProbeExecutorFunc) Execute(
	executionCtx context.Context,
	probe *apiv1.HealthProbe,
	probeOwner commonapi.DcpModelObject,
	probeID healthProbeIdentifier,
) (apiv1.HealthProbeResult, error)

type HealthProbeReport

type HealthProbeReport struct {
	Probe  *apiv1.HealthProbe
	Result apiv1.HealthProbeResult
	Owner  commonapi.NamespacedNameWithKind
}

HealthProbeReport represents a result of a single health probe execution.

type HealthProbeSet

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

HealthProbeSet holds a set of active health probes and schedules their execution.

func NewHealthProbeSet

func NewHealthProbeSet(lifetimeCtx context.Context, log logr.Logger, executors map[apiv1.HealthProbeType]HealthProbeExecutor) *HealthProbeSet

func (*HealthProbeSet) DisableProbes

func (hps *HealthProbeSet) DisableProbes(owner commonapi.DcpModelObject)

Removes all health probes owned by the specified object and cancels remaining probe executions, if any.

func (*HealthProbeSet) EnableProbes

func (hps *HealthProbeSet) EnableProbes(owner commonapi.DcpModelObject, probes []apiv1.HealthProbe) error

Adds a set of health probes to the probe set and schedules their execution as necessary.

func (*HealthProbeSet) Subscribe

Subscribe to be notified about health probe results. Subscriptions are specific to the kind of object that owns health probes (ownerKind parameter).

type HttpProbeExecutor

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

func NewHttpProbeExecutor

func NewHttpProbeExecutor(apiClient ctrl_client.Client, log logr.Logger) *HttpProbeExecutor

func (*HttpProbeExecutor) Execute

func (hpe *HttpProbeExecutor) Execute(
	executionCtx context.Context,
	probeDefinition *apiv1.HealthProbe,
	owner commonapi.DcpModelObject,
	probeID healthProbeIdentifier,
) (apiv1.HealthProbeResult, error)

Jump to

Keyboard shortcuts

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