Documentation
¶
Overview ¶
Package enginereport reads the engines the operator's replicas report in their inkwall-engines-<pod> ConfigMaps (0004 §4.8): which engines are connected, the bundle each runs and the one it rejected. The leader reads them for the policies' status; inkwallctl status reads them too.
Index ¶
Constants ¶
const ( // Label marks a report ConfigMap. Label = "waf.inkwall.dev/engines" // EnginesKey holds the engines, a JSON array of Engine. EnginesKey = "engines.json" // UpdatedAtKey is when the replica last wrote it (RFC 3339): a report // not refreshed for long is from a replica that is gone. UpdatedAtKey = "updatedAt" // LeftOutKey counts the engines left out of a full report. LeftOutKey = "leftOut" // NamePrefix and the replica's pod name name a report. NamePrefix = "inkwall-engines-" )
Labels and keys of the replicas' report ConfigMaps.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Engine ¶
type Engine struct {
// ID is the engine's own, from its Hello.
ID string `json:"id"`
// ServiceAccount authenticated the stream, as "namespace/name".
ServiceAccount string `json:"serviceAccount"`
// Pod and node: from the token when it is bound to a pod, otherwise as
// the engine reported them.
PodNamespace string `json:"podNamespace,omitempty"`
PodName string `json:"podName,omitempty"`
NodeName string `json:"nodeName,omitempty"`
EngineVersion string `json:"engineVersion,omitempty"`
// Applied is the newest bundle version the engine runs.
Applied uint64 `json:"applied"`
// Rejected is the newest version the engine refused, and why.
Rejected uint64 `json:"rejected,omitempty"`
RejectError string `json:"rejectError,omitempty"`
// TrustedKeys are the IDs of the bundle signing keys the engine
// accepts; empty from an engine older than key rotation.
TrustedKeys []string `json:"trustedKeys,omitempty"`
// ProbeReceipts are the receipts of the operator's probes the engine
// verified where the proxy discards its answer (#475), as its last
// heartbeat reported them: the leader's probe matches them.
ProbeReceipts []string `json:"probeReceipts,omitempty"`
// Replica is the operator replica the engine is connected to.
Replica string `json:"replica"`
ConnectedAt time.Time `json:"connectedAt"`
}
Engine is one connected engine, as a replica reports it.
func Read ¶
func Read(ctx context.Context, c client.Reader, namespace string, stale time.Duration, now time.Time) (engines []Engine, leftOut int, err error)
Read merges the replicas' reports in namespace, skipping those not refreshed within stale (their replica is gone). An engine listed twice, while it moves between replicas, counts once, with its newest connection: the same engine ID, ServiceAccount and pod, so an engine can't hide another's record by naming its engine ID. They are sorted by ID. leftOut counts the engines left out of full reports: while it isn't 0, the list is incomplete.