Documentation
¶
Index ¶
Constants ¶
const LabelKey = "health.deckhouse.io/package"
LabelKey is the workload label whose value identifies the owning package. The same constant is used by the indexer, the event handlers, and any caller that wants to add the label to a workload manifest.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Callback ¶
Callback is invoked from the reconcile goroutine whenever a package's reduced health changes. The callback must not block and must not call back into the Service.
type Event ¶
type Event struct {
Health Health
}
Event is the payload delivered to Callback on every package-health transition. It carries only what the consumer needs: the new State and a short human-readable Message naming the dominant workload (for example "Deployment/api: ProgressDeadlineExceeded"). The package name is the first argument of Callback and is intentionally not duplicated here. Because Callback is invoked only on transitions, State always differs from the value reported in the previous Event for the same package.
type Health ¶
Health is the reduced workload-health snapshot for one package. State is the machine-readable enum; consumers map it into a K8s condition's reason field (the enum values are already valid reason strings). Message carries the dominant-workload detail ("Kind/Name: cause") and flows into the condition's message field. StateScaled is the all-healthy case and carries no Message.
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
Service watches per-package workload statuses via an embedded Monitor and reduces them to a single State per package. Transitions are edge-triggered: the configured Callback is invoked only when a package's reduced State differs from the last reported value.
The Service owns the Monitor and its lifecycle. Construction is I/O-free; goroutines and informers start in Start and stop in Stop.
func NewService ¶
NewService constructs a Service. It does not start any goroutines or perform any I/O; that happens in Start. The callback is invoked on every package health transition and must be non-nil and non-blocking.
type State ¶
type State string
const ( // StateUnknown means the package has no known workloads. StateUnknown State = "Unknown" // StateReconciling means at least one workload is rolling out // (generation drift, replicas catching up, revision swap) and none // have failed. The controller is still doing work; ask again later. StateReconciling State = "Reconciling" // StateScaled means every workload is at the desired replica count // and the controller has nothing left to reconcile. StateScaled State = "Scaled" // StateDegraded means at least one workload is Failed, or has been // observed Terminating while still in cache. StateDegraded State = "Degraded" )
State values returned to callbacks. The zero value of State is the empty string, not StateUnknown — code that switches on State should rely on the named constants below, not on default-value behavior.