diff --git a/proto/vantage/v1/vantage.proto b/proto/vantage/v1/vantage.proto index 245e7bf..b753dc2 100644 --- a/proto/vantage/v1/vantage.proto +++ b/proto/vantage/v1/vantage.proto @@ -10,6 +10,7 @@ service Vantage { rpc UploadGeneratedKey(UploadKeyRequest) returns (UploadKeyResponse); rpc ReportUpdates(ReportUpdatesRequest) returns (ReportUpdatesResponse); rpc ReportPackages(ReportPackagesRequest) returns (ReportPackagesResponse); + rpc ReportWorkloads(ReportWorkloadsRequest) returns (ReportWorkloadsResponse); rpc ReportInventory(InventoryReport) returns (InventoryReportResponse); rpc SyncMonitors(SyncMonitorsRequest) returns (SyncMonitorsResponse); rpc ReportChecks(ReportChecksRequest) returns (ReportChecksResponse); @@ -107,6 +108,7 @@ message AgentMessage { CommandResult result = 4; StepResult step_result = 5; StepOutputChunk step_output = 6; + WorkloadLogsResult workload_logs_result = 7; } } @@ -229,6 +231,9 @@ message ServerCommand { CleanupWorkspaceCmd cleanup_workspace = 7; OpenProxyCmd open_proxy = 8; PingCmd ping = 9; + RefreshWorkloadsCmd refresh_workloads = 10; + ControlWorkloadCmd control_workload = 11; + WorkloadLogsCmd workload_logs = 12; } } @@ -319,3 +324,63 @@ message ProxyServerMsg { ProxyClose close = 2; } } + +// --------------------------------------------------------------------------- +// Workload registry + +// ReportWorkloads carries what a server is running. +// +// Offer-then-send, the same handshake as ReportPackages: the agent calls once +// with workloads empty, and resends with the body only if need_full is set. +message ReportWorkloadsRequest { + string server_id = 1; + string agent_token = 2; + string hash = 3; + bool docker_ok = 4; + string docker_error = 5; + bool systemd_ok = 6; + string systemd_error = 7; + repeated Workload workloads = 8; // empty on the offer call +} + +message ReportWorkloadsResponse { + bool need_full = 1; +} + +message Workload { + string kind = 1; // "container" | "unit" + string id = 2; + string name = 3; + string state = 4; + string health = 5; + string image = 6; + string stack = 7; + repeated string ports = 8; + int32 restarts = 9; + string started_at = 10; // RFC3339, empty when not running + bool protected = 11; +} + +// RefreshWorkloadsCmd carries no payload back. It makes the agent report +// immediately through ReportWorkloads, so there is exactly one writer for the +// server_workloads collection rather than two arriving by different routes. +message RefreshWorkloadsCmd {} + +message ControlWorkloadCmd { + string kind = 1; + string id = 2; + string action = 3; // "start" | "stop" | "restart" +} + +message WorkloadLogsCmd { + string kind = 1; + string id = 2; + int32 tail = 3; +} + +message WorkloadLogsResult { + string command_id = 1; + string text = 2; + bool truncated = 3; + string error = 4; +}