Skip to content

Commit

Permalink
Add gRPC Protobuf Files for CNS Operations (#2754)
Browse files Browse the repository at this point in the history
* PB Operations

* Updated Protobuf Service Name

* Package Rename

---------

Co-authored-by: Kevin <t-kcamacho@microsoft.com>
  • Loading branch information
Kevincxv and Kevin authored May 31, 2024
1 parent 0475212 commit 96a989e
Show file tree
Hide file tree
Showing 4 changed files with 607 additions and 0 deletions.
3 changes: 3 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -952,3 +952,6 @@ tools: acncli gocov gocov-xml go-junit-report golangci-lint gofumpt protoc ## Bu

help: ## Display this help
@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)

proto-gen: ## Generates source code from protobuf files
protoc --go_out=. --go-grpc_out=. cns/grpc/proto/server.proto
43 changes: 43 additions & 0 deletions cns/grpc/proto/server.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
syntax = "proto3";

package cns;

option go_package = "cns/grpc/v1alpha";

// The Container Network Service (CNS) exposes a set of operations that allow the Delegated Network Controller (DNC) to manage
// and monitor nodes in an orchestrator's infrastructure.

// CNS defines the gRPC service exposed by CNS to interact with DNC.
service CNS {
// Sets the orchestrator information for a node.
rpc SetOrchestratorInfo(SetOrchestratorInfoRequest) returns (SetOrchestratorInfoResponse);

// Retrieves detailed information about a specific node.
// Primarily used for health checks.
rpc GetNodeInfo(NodeInfoRequest) returns (NodeInfoResponse);
}

// SetOrchestratorInfoRequest is the request message for setting the orchestrator information.
message SetOrchestratorInfoRequest {
string dncPartitionKey = 1; // The partition key for DNC.
string nodeID = 2; // The node ID.
string orchestratorType = 3; // The type of the orchestrator.
}

// SetOrchestratorInfoResponse is the response message for setting the orchestrator information.
message SetOrchestratorInfoResponse {}

// NodeInfoRequest is the request message for retrieving detailed information about a specific node.
message NodeInfoRequest {
string nodeID = 1; // The node ID to identify the specific node.
}

// NodeInfoResponse is the response message containing detailed information about a specific node.
message NodeInfoResponse {
string nodeID = 1; // The node ID.
string name = 2; // The name of the node.
string ip = 3; // The IP address of the node.
bool isHealthy = 4; // Indicates whether the node is healthy or not.
string status = 5; // The current status of the node (e.g., running, stopped).
string message = 6; // Additional information about the node's health or status.
}
Loading

0 comments on commit 96a989e

Please sign in to comment.