observed

package
v1.78.0 Latest Latest
Warning

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

Go to latest
Published: Nov 14, 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 observed holds what the cluster-facing services observe about each package: workload health, the release progress, the endpoints, whether the release has workloads, the last failure of a hook that ran outside the package's operations and the last verdict of its readiness probe. It is the observed half of a package's status; the other is the engine's lifecycle Report.

  • Observations are never lifecycle inputs: a flapping pod must not start a run or change convergence, so the engine core never imports this package.
  • Each field has one writer: the release service (tracking, URLs, "no workloads"), the health callback (health) and the hook lanes (the hook failure, the probe); the composition root forgets a package once its removal is reported done. Writers declare their own narrow interfaces.
  • The status projection joins both halves by name; both notify through the same status queues.

Index

Constants

View Source
const (
	// HookReasonSync: a hook failed its synchronization run (the binding's initial snapshot).
	HookReasonSync = "SyncHookFailed"
	// HookReasonEvent: a hook failed its run on a Kubernetes event or a schedule.
	HookReasonEvent = "EventHookFailed"
)

Hook failure reasons: the projection reports a failed synchronization as a hook initialization failure and a failed event run as a hook failure.

Variables

This section is empty.

Functions

This section is empty.

Types

type Health

type Health struct {
	State   HealthState `json:"state" yaml:"state"`
	Message string      `json:"message" yaml:"message"`
}

Health is the reduced workload health of one package; it becomes the Scaled condition.

type HealthState

type HealthState string

HealthState is the reduced health of a package's workloads.

const (
	// HealthUnknown means no workload of the package reported yet.
	HealthUnknown HealthState = ""
	// HealthReady means every workload is ready.
	HealthReady HealthState = "Ready"
	// HealthProgressing means a workload is rolling out or scaling.
	HealthProgressing HealthState = "Progressing"
	// HealthDegraded means a workload is not ready.
	HealthDegraded HealthState = "Degraded"
)

type HookFailure

type HookFailure struct {
	Hook    string `json:"hook" yaml:"hook"`
	Reason  string `json:"reason" yaml:"reason"` // Reason is HookReasonSync or HookReasonEvent.
	Message string `json:"message" yaml:"message"`
	// Since is when this failure (same hook, reason and message) was first recorded; a retry that
	// fails the same way does not move it.
	Since time.Time `json:"since" yaml:"since"`
}

HookFailure is the last failure of a hook run in the hook lanes (a synchronization, or a run on an event or a schedule). It lasts until that hook succeeds, because its lane retries it and holds the items behind it. Failures of hooks an operation runs are in the engine's Report.

type Observation

type Observation struct {
	Health      Health   `json:"health" yaml:"health"`
	Tracking    Tracking `json:"tracking" yaml:"tracking"`
	URLs        []URL    `json:"urls" yaml:"urls"`
	NoWorkloads bool     `json:"noWorkloads" yaml:"noWorkloads"`
	// HookFailure is the last failure of a runtime or synchronization hook; nil when none is
	// outstanding.
	HookFailure *HookFailure `json:"hookFailure" yaml:"hookFailure"`
	// Probe is the last verdict of the readiness probe; nil while none is in force (no readiness
	// hook, or its lanes are not running).
	Probe *Probe `json:"probe" yaml:"probe"`
}

Observation is everything observed about one package. Returned by value; its slices, the hook failure and the probe are copies the caller may keep.

type Probe

type Probe struct {
	Ready   bool   `json:"ready" yaml:"ready"`
	Message string `json:"message" yaml:"message"` // Message says why the package is not ready.
}

Probe is the last verdict of a package's readiness probe: the readiness hook its SDK declares.

type Store

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

Store is the observation store. Safe for concurrent use. Every write that changes the stored observation calls notify with the package name after the lock is released; a write that changes nothing does not.

func New

func New(notify func(name string)) *Store

New returns an empty store. notify is called with a package name after its observation changed; it must not block (enqueue and return) and must not call back into the store synchronously. Nil disables notifications.

func (*Store) ClearHookFailure

func (s *Store) ClearHookFailure(name, hook string)

ClearHookFailure clears the recorded failure when it is hook's: hook just ran successfully, so its lane moved on. A failure of another hook is kept. Writer: the hook lanes.

func (*Store) Forget

func (s *Store) Forget(name string)

Forget drops everything observed about name, after the package was removed. Writer: the composition root (the engine facade), when it reports the removal done to the controller.

func (*Store) Get

func (s *Store) Get(name string) Observation

Get returns the observation of name; the zero Observation when nothing was observed.

func (*Store) Names

func (s *Store) Names() []string

Names returns the names with an observation, sorted.

func (*Store) RecordHookFailure

func (s *Store) RecordHookFailure(name, hook, reason, message string)

RecordHookFailure records a failure of hook with reason and message, replacing the recorded one. A repeated identical failure (a retry that fails the same way) changes nothing and does not notify. Writer: the hook lanes (synchronization and runtime hook runs).

func (*Store) RecordProbe

func (s *Store) RecordProbe(name string, p Probe)

RecordProbe records the verdict of a readiness probe run. A repeated verdict changes nothing and does not notify. Writer: the hook lanes.

func (*Store) ResetHookFailure

func (s *Store) ResetHookFailure(name string)

ResetHookFailure clears the recorded failure whatever hook it is of: the package's hook lanes stopped, so no failed item is retried any more. Writer: the hook lanes (their stop, hooklane).

func (*Store) ResetProbe

func (s *Store) ResetProbe(name string)

ResetProbe clears the verdict: the package's hook lanes stopped, so the probe no longer runs and its last verdict says nothing about the package. Writer: the hook lanes (their stop).

func (*Store) ResetTracking

func (s *Store) ResetTracking(name string)

ResetTracking clears the progress before a new apply, so the progress of the previous apply is not shown as this one's. Writer: the release service.

func (*Store) SetNoWorkloads

func (s *Store) SetNoWorkloads(name string, none bool)

SetNoWorkloads records whether the last render has no workloads (health then has nothing to watch, and the projection must not wait for Scaled). Writer: the release service.

func (*Store) UpdateHealth

func (s *Store) UpdateHealth(name string, h Health)

UpdateHealth records a health transition. Writer: the health service (its callback).

func (*Store) UpdateTracking

func (s *Store) UpdateTracking(name string, t Tracking)

UpdateTracking records the progress nelm reported for an apply or a release delete. Writer: the release service.

func (*Store) UpdateURLs

func (s *Store) UpdateURLs(name string, urls []URL)

UpdateURLs records the endpoints of the last render. Writer: the release service.

type Tracking

type Tracking struct {
	// Completed is the number of completed resource operations of Report.
	Completed int `json:"completed" yaml:"completed"`
	// Remaining is the number of the other resource operations of Report.
	Remaining int `json:"remaining" yaml:"remaining"`
	// Report is nelm's progress report, marshaled by the release service; empty when nothing was
	// reported since the last reset.
	Report json.RawMessage `json:"report" yaml:"report"`
}

Tracking is the progress of the latest release apply or uninstall: json.Marshal(Tracking) is status.tracking byte for byte, an external contract that carries nelm's report as nelm produced it. Raw JSON keeps this package free of nelm types.

func (Tracking) Empty

func (t Tracking) Empty() bool

Empty reports whether no progress is recorded; the projection then leaves status.tracking as it is.

type URL

type URL struct {
	URL         string `json:"url" yaml:"url"`
	Description string `json:"description" yaml:"description"`
}

URL is an endpoint a package exposes, extracted by the release service from the rendered Ingresses (it becomes an entry of Application status.urls).

Jump to

Keyboard shortcuts

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