m/n/c/curator: add result filtering to GetNodes
This introduces result filtering to management.GetNodes Curator API
call. GetNodesRequest payload was modified to contain an optional CEL
expression. GetNodes will return only node protobuf messages for which
the expression evaluates to boolean truth. GetNodes behavior remains
unchanged for empty expression strings, returning all nodes.
See: https://github.com/google/cel-go
https: //github.com/google/cel-spec
Change-Id: Ibdd847c73d305de22b7df496c401e9bc37f9f0bc
Reviewed-on: https://review.monogon.dev/c/monogon/+/768
Reviewed-by: Sergiusz Bazanski <serge@monogon.tech>
Vouch-Run-CI: Mateusz Zalega <mateusz@monogon.tech>
Tested-by: Jenkins CI
diff --git a/metropolis/proto/api/management.proto b/metropolis/proto/api/management.proto
index 88cab77..17ff6af 100644
--- a/metropolis/proto/api/management.proto
+++ b/metropolis/proto/api/management.proto
@@ -83,6 +83,13 @@
}
message GetNodesRequest {
+ // filter is a CEL expression used to limit the count of GetNodes results.
+ // Each processed node protobuf message is exposed to the filter as
+ // "node" variable, while related state and health enum constants are
+ // anchored in the root namespace, eg. NODE_STATE_UP, or HEARTBEAT_TIMEOUT.
+ // A node is returned each time the expression is evaluated as true. If
+ // empty, all nodes are returned.
+ string filter = 1;
}
// Node in a Metropolis cluster, streamed by Management.GetNodes. For each node