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
- type Health
- type HealthState
- type HookFailure
- type Observation
- type Probe
- type Store
- func (s *Store) ClearHookFailure(name, hook string)
- func (s *Store) Forget(name string)
- func (s *Store) Get(name string) Observation
- func (s *Store) Names() []string
- func (s *Store) RecordHookFailure(name, hook, reason, message string)
- func (s *Store) RecordProbe(name string, p Probe)
- func (s *Store) ResetHookFailure(name string)
- func (s *Store) ResetProbe(name string)
- func (s *Store) ResetTracking(name string)
- func (s *Store) SetNoWorkloads(name string, none bool)
- func (s *Store) UpdateHealth(name string, h Health)
- func (s *Store) UpdateTracking(name string, t Tracking)
- func (s *Store) UpdateURLs(name string, urls []URL)
- type Tracking
- type URL
Constants ¶
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 ¶
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 ¶
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 ¶
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) RecordHookFailure ¶
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 ¶
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 ¶
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 ¶
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 ¶
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 ¶
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 ¶
UpdateHealth records a health transition. Writer: the health service (its callback).
func (*Store) UpdateTracking ¶
UpdateTracking records the progress nelm reported for an apply or a release delete. Writer: the release service.
func (*Store) UpdateURLs ¶
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.