mesh-provisioner-client's report now carries failing-since (mesh-catalog 3aae6c08), kept while a module
stays failed however its words change. S21 measures a failed placing from it, falling back to the
report's time from an older client; the hysteresis of 6ffcea4f (an open condition stays while any
failure stands) is kept. This is the thorough fix that commit named.
Research 072 piece: milestone 3 (health leaves the controller): the judgement reads the owner's state.
49 lines
2.1 KiB
Go
49 lines
2.1 KiB
Go
package inventory
|
|
|
|
import (
|
|
"time"
|
|
)
|
|
|
|
// A machine has applied a send of a provisioned module only once its files are placed (novox/hq ADR 0362, design
|
|
// 57 P6, issue 672): for a module the send handed to the provisioner (SentDeclaration.Provisioned), the machine's
|
|
// own report that it applied the send is half of it, and its provisioner client's `prov.applied` for the build's
|
|
// templates the other half.
|
|
//
|
|
// - both reported, applied: the send is applied, at the later of the two (ADR 0362 §5: delivery time runs to it);
|
|
// - the client reported it failed on that build: a failed apply, named with its reason (§3);
|
|
// - the client has not reported it applied on that build (not yet, waiting for a value, an older build): not yet
|
|
// applied, and once ApplySilentAfter has passed since the send the walk names the machine silent (§4);
|
|
// - a send that handed nothing: the machine's own report alone, as before.
|
|
|
|
// ProvReport is a provisioner client's newest report of one module on its machine, as `prov.applied` says it
|
|
// (mesh-catalog mesh-provisioner-client Report): applied, waiting, failed with the reason, or removed; the digest
|
|
// of the templates it filled from; and when it said it.
|
|
type ProvReport struct {
|
|
Node string `json:"node"`
|
|
Module string `json:"module"`
|
|
Status string `json:"status"`
|
|
Reason string `json:"reason,omitempty"`
|
|
WaitsFor []string `json:"waits-for,omitempty"`
|
|
Templates string `json:"templates,omitempty"`
|
|
At time.Time `json:"at"`
|
|
// FailingSince is, on a failed report, when the module's standing failure began, kept by the client while only its
|
|
// words change (mesh-catalog 3aae6c08); zero from an older client.
|
|
FailingSince time.Time `json:"failing-since,omitzero"`
|
|
}
|
|
|
|
// Since is when a failed report's failure began: FailingSince when the client says it, else At.
|
|
func (r ProvReport) Since() time.Time {
|
|
if !r.FailingSince.IsZero() {
|
|
return r.FailingSince
|
|
}
|
|
return r.At
|
|
}
|
|
|
|
// The words a client's report says.
|
|
const (
|
|
ProvApplied = "applied"
|
|
ProvWaiting = "waiting"
|
|
ProvFailed = "failed"
|
|
ProvRemoved = "removed"
|
|
)
|