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.
const ( SinkExporting = "Exporting" SinkFailing = "Failing" SinkConfigInvalid = "ConfigInvalid" SinkDropping = "Dropping" SinkAddressRefused = "AddressRefused" )
The state classes of a sink, as a replica reports them.
const ExportKey = "export.json"
ExportKey holds the replica's export sinks, a JSON array of Sink (design 0010 §8).
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"`
// GeoTable is the hash of the country table the engine holds, in hex
// (design 0011 §4.4); empty if none, or from an engine before 0.7.0.
GeoTable string `json:"geoTable,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.
type ReplicaSinks ¶
ReplicaSinks are one replica's sinks.
func ReadExport ¶
func ReadExport(ctx context.Context, c client.Reader, namespace string, stale time.Duration, now time.Time) ([]ReplicaSinks, error)
ReadExport reads the replicas' sinks from their reports in namespace, skipping those not refreshed within stale; sorted by replica. Every fresh report is listed, a replica that reports no sinks with none.
type Sink ¶
type Sink struct {
Name string `json:"name"`
State string `json:"state"`
Message string `json:"message,omitempty"`
// Pending counts the events the sink hasn't had accepted, as of the
// report.
Pending uint64 `json:"pending"`
Plaintext bool `json:"plaintext,omitempty"`
}
Sink is an export sink's state on one replica.