Skip to content

Commit b7a2301

Browse files
authored
Merge pull request #27 from jumpstarter-dev/add-status-reporting
Add exporter status reporting
2 parents a865a5f + 9cbdaea commit b7a2301

File tree

3 files changed

+52
-11
lines changed

3 files changed

+52
-11
lines changed

proto/jumpstarter/client/v1/client.proto

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ import "google/protobuf/empty.proto";
1818
import "google/protobuf/field_mask.proto";
1919
import "google/protobuf/timestamp.proto";
2020
import "jumpstarter/v1/kubernetes.proto";
21+
import "jumpstarter/v1/common.proto";
2122

2223
service ClientService {
2324
rpc GetExporter(GetExporterRequest) returns (Exporter) {
@@ -68,16 +69,7 @@ message Exporter {
6869
string name = 1 [(google.api.field_behavior) = IDENTIFIER];
6970
map<string, string> labels = 2;
7071
bool online = 3 [(google.api.field_behavior) = OUTPUT_ONLY, deprecated = true];
71-
ExporterStatus status = 4 [(google.api.field_behavior) = OUTPUT_ONLY];
72-
}
73-
74-
enum ExporterStatus {
75-
EXPORTER_STATUS_UNSPECIFIED = 0; // Unspecified exporter status
76-
EXPORTER_STATUS_OFFLINE = 1; // Exporter is offline
77-
EXPORTER_STATUS_AVAILABLE = 2; // Exporter is available to be leased
78-
EXPORTER_STATUS_BEFORE_LEASE_HOOK = 3; // Exporter is executing before lease hook(s)
79-
EXPORTER_STATUS_LEASE_READY = 4; // Exporter is leased and ready to accept commands
80-
EXPORTER_STATUS_AFTER_LEASE_HOOK = 5; // Exporter is executing after lease hook(s)
72+
jumpstarter.v1.ExporterStatus status = 4 [(google.api.field_behavior) = OUTPUT_ONLY];
8173
}
8274

8375
message Lease {

proto/jumpstarter/v1/common.proto

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
// Copyright 2024 The Jumpstarter Authors
2+
3+
syntax = "proto3";
4+
5+
package jumpstarter.v1;
6+
7+
// Shared types used across multiple Jumpstarter services
8+
9+
// Exporter status information
10+
enum ExporterStatus {
11+
EXPORTER_STATUS_UNSPECIFIED = 0; // Unspecified exporter status
12+
EXPORTER_STATUS_OFFLINE = 1; // Exporter is offline
13+
EXPORTER_STATUS_AVAILABLE = 2; // Exporter is available to be leased
14+
EXPORTER_STATUS_BEFORE_LEASE_HOOK = 3; // Exporter is executing before lease hook(s)
15+
EXPORTER_STATUS_LEASE_READY = 4; // Exporter is leased and ready to accept commands
16+
EXPORTER_STATUS_AFTER_LEASE_HOOK = 5; // Exporter is executing after lease hook(s)
17+
EXPORTER_STATUS_BEFORE_LEASE_HOOK_FAILED = 6; // Exporter before lease hook failed
18+
EXPORTER_STATUS_AFTER_LEASE_HOOK_FAILED = 7; // Exporter after lease hook failed
19+
}
20+
21+
// Source of log stream messages
22+
enum LogSource {
23+
LOG_SOURCE_UNSPECIFIED = 0; // Unspecified log source
24+
LOG_SOURCE_DRIVER = 1; // Driver/device logs
25+
LOG_SOURCE_BEFORE_LEASE_HOOK = 2; // beforeLease hook execution logs
26+
LOG_SOURCE_AFTER_LEASE_HOOK = 3; // afterLease hook execution logs
27+
LOG_SOURCE_SYSTEM = 4; // System/exporter logs
28+
}

proto/jumpstarter/v1/jumpstarter.proto

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import "google/protobuf/empty.proto";
99
import "google/protobuf/struct.proto";
1010
import "google/protobuf/timestamp.proto";
1111
import "jumpstarter/v1/kubernetes.proto";
12+
import "jumpstarter/v1/common.proto";
1213

1314
// A service where a exporter can connect to make itself available
1415
service ControllerService {
@@ -21,6 +22,10 @@ service ControllerService {
2122
// has been invalidated
2223
rpc Unregister(UnregisterRequest) returns (UnregisterResponse);
2324

25+
// Exporter status report
26+
// Allows exporters to report their own status to the controller
27+
rpc ReportStatus(ReportStatusRequest) returns (ReportStatusResponse);
28+
2429
// Exporter listening
2530
// Returns stream tokens for accepting incoming client connections
2631
rpc Listen(ListenRequest) returns (stream ListenResponse);
@@ -59,7 +64,7 @@ message RegisterRequest {
5964
}
6065

6166
message DriverInstanceReport {
62-
string uuid = 1; // a unique id within the expoter
67+
string uuid = 1; // a unique id within the exporter
6368
optional string parent_uuid = 2; // optional, if device has a parent device
6469
map<string, string> labels = 3;
6570
}
@@ -109,6 +114,13 @@ message AuditStreamRequest {
109114
string message = 4;
110115
}
111116

117+
message ReportStatusRequest {
118+
ExporterStatus status = 1;
119+
optional string message = 2; // Optional human-readable status message
120+
}
121+
122+
message ReportStatusResponse {}
123+
112124
// A service a exporter can share locally to be used without a server
113125
// Channel/Call credentials are used to authenticate the client, and routing to the right exporter
114126
service ExporterService {
@@ -118,6 +130,7 @@ service ExporterService {
118130
rpc StreamingDriverCall(StreamingDriverCallRequest) returns (stream StreamingDriverCallResponse);
119131
rpc LogStream(google.protobuf.Empty) returns (stream LogStreamResponse);
120132
rpc Reset(ResetRequest) returns (ResetResponse);
133+
rpc GetStatus(GetStatusRequest) returns (GetStatusResponse);
121134
}
122135

123136
message GetReportResponse {
@@ -163,6 +176,7 @@ message LogStreamResponse {
163176
string uuid = 1;
164177
string severity = 2;
165178
string message = 3;
179+
optional LogSource source = 4; // New optional field
166180
}
167181

168182
message ResetRequest {}
@@ -201,3 +215,10 @@ message ListLeasesRequest {}
201215
message ListLeasesResponse {
202216
repeated string names = 1;
203217
}
218+
219+
message GetStatusRequest {}
220+
221+
message GetStatusResponse {
222+
ExporterStatus status = 1;
223+
optional string message = 2;
224+
}

0 commit comments

Comments
 (0)