Skip to content

Commit 96a989e

Browse files
KevincxvKevin
andauthored
Add gRPC Protobuf Files for CNS Operations (#2754)
* PB Operations * Updated Protobuf Service Name * Package Rename --------- Co-authored-by: Kevin <[email protected]>
1 parent 0475212 commit 96a989e

File tree

4 files changed

+607
-0
lines changed

4 files changed

+607
-0
lines changed

Makefile

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -952,3 +952,6 @@ tools: acncli gocov gocov-xml go-junit-report golangci-lint gofumpt protoc ## Bu
952952

953953
help: ## Display this help
954954
@awk 'BEGIN {FS = ":.*##"; printf "\nUsage:\n make \033[36m<target>\033[0m\n"} /^[0-9a-zA-Z_-]+:.*?##/ { printf " \033[36m%-15s\033[0m %s\n", $$1, $$2 } /^##@/ { printf "\n\033[1m%s\033[0m\n", substr($$0, 5) } ' $(MAKEFILE_LIST)
955+
956+
proto-gen: ## Generates source code from protobuf files
957+
protoc --go_out=. --go-grpc_out=. cns/grpc/proto/server.proto

cns/grpc/proto/server.proto

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
syntax = "proto3";
2+
3+
package cns;
4+
5+
option go_package = "cns/grpc/v1alpha";
6+
7+
// The Container Network Service (CNS) exposes a set of operations that allow the Delegated Network Controller (DNC) to manage
8+
// and monitor nodes in an orchestrator's infrastructure.
9+
10+
// CNS defines the gRPC service exposed by CNS to interact with DNC.
11+
service CNS {
12+
// Sets the orchestrator information for a node.
13+
rpc SetOrchestratorInfo(SetOrchestratorInfoRequest) returns (SetOrchestratorInfoResponse);
14+
15+
// Retrieves detailed information about a specific node.
16+
// Primarily used for health checks.
17+
rpc GetNodeInfo(NodeInfoRequest) returns (NodeInfoResponse);
18+
}
19+
20+
// SetOrchestratorInfoRequest is the request message for setting the orchestrator information.
21+
message SetOrchestratorInfoRequest {
22+
string dncPartitionKey = 1; // The partition key for DNC.
23+
string nodeID = 2; // The node ID.
24+
string orchestratorType = 3; // The type of the orchestrator.
25+
}
26+
27+
// SetOrchestratorInfoResponse is the response message for setting the orchestrator information.
28+
message SetOrchestratorInfoResponse {}
29+
30+
// NodeInfoRequest is the request message for retrieving detailed information about a specific node.
31+
message NodeInfoRequest {
32+
string nodeID = 1; // The node ID to identify the specific node.
33+
}
34+
35+
// NodeInfoResponse is the response message containing detailed information about a specific node.
36+
message NodeInfoResponse {
37+
string nodeID = 1; // The node ID.
38+
string name = 2; // The name of the node.
39+
string ip = 3; // The IP address of the node.
40+
bool isHealthy = 4; // Indicates whether the node is healthy or not.
41+
string status = 5; // The current status of the node (e.g., running, stopped).
42+
string message = 6; // Additional information about the node's health or status.
43+
}

0 commit comments

Comments
 (0)