syntax = "proto3"; package k8shost; // Common types message ObjectMeta { string name = 1; optional string namespace = 2; optional string uid = 3; optional string resource_version = 4; optional string creation_timestamp = 5; map labels = 6; map annotations = 7; optional string org_id = 8; optional string project_id = 9; } message LabelSelector { map match_labels = 1; } // Pod messages message Pod { ObjectMeta metadata = 1; PodSpec spec = 2; optional PodStatus status = 3; } message PodSpec { repeated Container containers = 1; optional string restart_policy = 2; optional string node_name = 3; } message Container { string name = 1; string image = 2; repeated string command = 3; repeated string args = 4; repeated ContainerPort ports = 5; repeated EnvVar env = 6; } message ContainerPort { optional string name = 1; int32 container_port = 2; optional string protocol = 3; } message EnvVar { string name = 1; optional string value = 2; } message PodStatus { optional string phase = 1; optional string pod_ip = 2; optional string host_ip = 3; repeated PodCondition conditions = 4; } message PodCondition { string type = 1; string status = 2; optional string reason = 3; optional string message = 4; } // Service messages message Service { ObjectMeta metadata = 1; ServiceSpec spec = 2; optional ServiceStatus status = 3; } message ServiceSpec { repeated ServicePort ports = 1; map selector = 2; optional string cluster_ip = 3; optional string type = 4; } message ServicePort { optional string name = 1; int32 port = 2; optional int32 target_port = 3; optional string protocol = 4; } message ServiceStatus { optional LoadBalancerStatus load_balancer = 1; } message LoadBalancerStatus { repeated LoadBalancerIngress ingress = 1; } message LoadBalancerIngress { optional string ip = 1; optional string hostname = 2; } // Deployment messages message Deployment { ObjectMeta metadata = 1; DeploymentSpec spec = 2; optional DeploymentStatus status = 3; } message DeploymentSpec { optional int32 replicas = 1; LabelSelector selector = 2; PodTemplateSpec template = 3; } message PodTemplateSpec { ObjectMeta metadata = 1; PodSpec spec = 2; } message DeploymentStatus { optional int32 replicas = 1; optional int32 ready_replicas = 2; optional int32 available_replicas = 3; } // Node messages message Node { ObjectMeta metadata = 1; NodeSpec spec = 2; optional NodeStatus status = 3; } message NodeSpec { optional string pod_cidr = 1; } message NodeStatus { repeated NodeAddress addresses = 1; repeated NodeCondition conditions = 2; map capacity = 3; map allocatable = 4; } message NodeAddress { string type = 1; string address = 2; } message NodeCondition { string type = 1; string status = 2; optional string reason = 3; optional string message = 4; } // Request/Response messages message CreatePodRequest { Pod pod = 1; } message CreatePodResponse { Pod pod = 1; } message GetPodRequest { string namespace = 1; string name = 2; } message GetPodResponse { Pod pod = 1; } message ListPodsRequest { optional string namespace = 1; map label_selector = 2; } message ListPodsResponse { repeated Pod items = 1; } message UpdatePodRequest { Pod pod = 1; } message UpdatePodResponse { Pod pod = 1; } message DeletePodRequest { string namespace = 1; string name = 2; } message DeletePodResponse { bool success = 1; } message WatchPodsRequest { optional string namespace = 1; optional string resource_version = 2; } message WatchEvent { string type = 1; // ADDED, MODIFIED, DELETED Pod object = 2; } // Service requests message CreateServiceRequest { Service service = 1; } message CreateServiceResponse { Service service = 1; } message GetServiceRequest { string namespace = 1; string name = 2; } message GetServiceResponse { Service service = 1; } message ListServicesRequest { optional string namespace = 1; } message ListServicesResponse { repeated Service items = 1; } message UpdateServiceRequest { Service service = 1; } message UpdateServiceResponse { Service service = 1; } message DeleteServiceRequest { string namespace = 1; string name = 2; } message DeleteServiceResponse { bool success = 1; } // Deployment requests message CreateDeploymentRequest { Deployment deployment = 1; } message CreateDeploymentResponse { Deployment deployment = 1; } message GetDeploymentRequest { string namespace = 1; string name = 2; } message GetDeploymentResponse { Deployment deployment = 1; } message ListDeploymentsRequest { optional string namespace = 1; } message ListDeploymentsResponse { repeated Deployment items = 1; } message UpdateDeploymentRequest { Deployment deployment = 1; } message UpdateDeploymentResponse { Deployment deployment = 1; } message DeleteDeploymentRequest { string namespace = 1; string name = 2; } message DeleteDeploymentResponse { bool success = 1; } // Node requests message RegisterNodeRequest { Node node = 1; } message RegisterNodeResponse { Node node = 1; } message HeartbeatRequest { string node_name = 1; NodeStatus status = 2; } message HeartbeatResponse { bool success = 1; } message ListNodesRequest {} message ListNodesResponse { repeated Node items = 1; } // gRPC Services service PodService { rpc CreatePod(CreatePodRequest) returns (CreatePodResponse); rpc GetPod(GetPodRequest) returns (GetPodResponse); rpc ListPods(ListPodsRequest) returns (ListPodsResponse); rpc UpdatePod(UpdatePodRequest) returns (UpdatePodResponse); rpc DeletePod(DeletePodRequest) returns (DeletePodResponse); rpc WatchPods(WatchPodsRequest) returns (stream WatchEvent); } service ServiceService { rpc CreateService(CreateServiceRequest) returns (CreateServiceResponse); rpc GetService(GetServiceRequest) returns (GetServiceResponse); rpc ListServices(ListServicesRequest) returns (ListServicesResponse); rpc UpdateService(UpdateServiceRequest) returns (UpdateServiceResponse); rpc DeleteService(DeleteServiceRequest) returns (DeleteServiceResponse); } service DeploymentService { rpc CreateDeployment(CreateDeploymentRequest) returns (CreateDeploymentResponse); rpc GetDeployment(GetDeploymentRequest) returns (GetDeploymentResponse); rpc ListDeployments(ListDeploymentsRequest) returns (ListDeploymentsResponse); rpc UpdateDeployment(UpdateDeploymentRequest) returns (UpdateDeploymentResponse); rpc DeleteDeployment(DeleteDeploymentRequest) returns (DeleteDeploymentResponse); } service NodeService { rpc RegisterNode(RegisterNodeRequest) returns (RegisterNodeResponse); rpc Heartbeat(HeartbeatRequest) returns (HeartbeatResponse); rpc ListNodes(ListNodesRequest) returns (ListNodesResponse); }