Add worker tagging (#862)

This allows workers to have tags assigned to them, which can then be filtered to control which targets they are allowed to serve.
This commit is contained in:
Jeff Mitchell authored and GitHub committed 2021-01-21 16:27:20 -05:00
1 parent 595a86508e
commit 717a3b52ee
54 files changed
+2150 -666

No files matched your search

@@ -65,6 +65,12 @@ message StatusRequest {
// Jobs which this worker wants to report the status.
repeated JobStatus jobs = 20;
// Whether to update tags from the Server block on this RPC. We only need to
// do this at startup or (at some point) SIGHUP, so specifying when it's
// changed allows us to avoid constant database operations for something that
// won't change very often, if ever.
bool update_tags = 30;
}
enum CHANGETYPE {
@@ -33,6 +33,9 @@ service SessionService {
message LookupSessionRequest {
// The session ID from the client
string session_id = 10;
// The name of the requesting worker, used for filtering to ensure this
// worker is allowed to handle this session.
string server_id = 20;
}
// LookupSessionResponse contains information necessary for a client to
@@ -13,8 +13,11 @@ message Server {
// Type of the resource (controller, worker)
string type = 20;
// Name of the resource
string name = 30;
// Name of the resource. This is deprecated because we ended up setting the
// private ID and name to be identical, and there is currently no reason we
// can think of to allow a given server's name to match another within the
// same cluster. So we simply use the private ID and deprecate this.
string name = 30 [deprecated = true];
// Description of the resource
string description = 40;
@@ -27,4 +30,13 @@ message Server {
// Last time there was an update
storage.timestamp.v1.Timestamp update_time = 70;
// Tags for workers
map<string, TagValues> tags = 80;
}
// TagValues is used because map fields cannot be repeated but can be a
// message
message TagValues {
repeated string values = 10;
}