kubenetworks/kubevpn

View on GitHub
pkg/daemon/rpc/daemon.proto

Summary

Maintainability
Test Coverage
syntax = "proto3";

option go_package = ".;rpc";

package rpc;

service Daemon {
  rpc Connect (ConnectRequest) returns (stream ConnectResponse) {}
  rpc ConnectFork (ConnectRequest) returns (stream ConnectResponse) {}
  rpc Disconnect (DisconnectRequest) returns (stream DisconnectResponse) {}
  rpc Proxy (ConnectRequest) returns (stream ConnectResponse) {}
  rpc Leave (LeaveRequest) returns (stream LeaveResponse) {}
  rpc Clone (CloneRequest) returns (stream CloneResponse) {}
  rpc Remove (RemoveRequest) returns (stream RemoveResponse) {}

  rpc ConfigAdd (ConfigAddRequest) returns (ConfigAddResponse) {}
  rpc ConfigRemove (ConfigRemoveRequest) returns (ConfigRemoveResponse) {}
  rpc SshStart (SshStartRequest) returns (SshStartResponse) {}
  rpc SshStop (SshStopRequest) returns (SshStopResponse) {}
  rpc SshConnect (stream SshConnectRequest) returns (stream SshConnectResponse) {}

  rpc Logs (LogRequest) returns (stream LogResponse) {}
  rpc List (ListRequest) returns (ListResponse) {}
  rpc Get (GetRequest) returns (GetResponse) {}
  rpc Upgrade (UpgradeRequest) returns (UpgradeResponse) {}
  rpc Status (StatusRequest) returns (StatusResponse) {}
  rpc Version (VersionRequest) returns (VersionResponse) {}
  rpc Reset (ResetRequest) returns (stream ResetResponse) {}
  rpc Quit (QuitRequest) returns (stream QuitResponse) {}

  rpc Identify (IdentifyRequest) returns (IdentifyResponse) {}
}

message ConnectRequest {
  string KubeconfigBytes = 1;
  string Namespace = 2;
  map<string, string> Headers = 3;
  repeated string PortMap = 4;
  repeated string Workloads = 5;
  string Engine = 7;

  // extra route table info
  ExtraRoute ExtraRoute = 8;

  // ssh jump
  SshJump SshJump = 9;

  // transfer image
  bool TransferImage = 10;
  string Image = 11;

  // foreground
  bool Foreground = 12;

  // log level
  int32 Level = 13;

  string OriginKubeconfigPath = 14;
}

message ConnectResponse {
  string message = 1;
}

message DisconnectRequest {
  // 1) disconnect by id
  optional int32 ID = 1;
  // 2) disconnect all
  optional bool All = 2;
  // 3) disconnect by kubeConfig
  optional string KubeconfigBytes = 3;
  optional string Namespace = 4;
  SshJump SshJump = 5;
  // 4) disconnect by cluster ids
  repeated string ClusterIDs = 6;
}

message DisconnectResponse {
  string message = 1;
}

message LeaveRequest {
  repeated string Workloads = 1;
}

message LeaveResponse {
  string message = 1;
}

message CloneRequest {
  string KubeconfigBytes = 1;
  string Namespace = 2;
  map<string, string> Headers = 3;
  repeated string Workloads = 4;
  string Engine = 6;

  // extra route table info
  ExtraRoute ExtraRoute = 7;

  // ssh jump
  SshJump SshJump = 8;

  // target cluster info
  string TargetKubeconfig = 9;
  string TargetNamespace = 10;
  string TargetContainer = 11;
  string TargetImage = 12;
  string TargetRegistry = 13;
  bool IsChangeTargetRegistry = 14;

  // transfer image
  bool TransferImage = 15;
  string Image = 16;

  // log level
  int32 Level = 17;

  string OriginKubeconfigPath = 18;

  string LocalDir = 19;
  string RemoteDir = 20;
}

message CloneResponse {
  string message = 1;
}

message RemoveRequest {
  repeated string Workloads = 1;
}

message RemoveResponse {
  string message = 1;
}

message QuitRequest {
}

message QuitResponse {
  string message = 1;
}

message StatusRequest {
  repeated string ClusterIDs = 1;
}

message StatusResponse {
  repeated Status List = 1;
}

message Status {
  int32 ID = 1;
  string ClusterID = 2;
  string Cluster = 3;
  string Mode = 4;
  string Kubeconfig = 5;
  string Namespace = 6;
  string Status = 7;
  string Netif = 8;
  repeated Proxy ProxyList = 9;
  repeated Clone CloneList = 10;
}

message Proxy {
  string ClusterID = 1;
  string Cluster = 2;
  string Kubeconfig = 3;
  string Namespace = 4;
  string Workload = 5;
  repeated ProxyRule RuleList = 6;
}

message ProxyRule {
  map<string, string>  Headers = 1;
  string LocalTunIPv4 = 2;
  string LocalTunIPv6 = 3;
  bool CurrentDevice = 4;
  map<int32, int32>  PortMap = 5;
}

message Clone {
  string ClusterID = 1;
  string Cluster = 2;
  string Kubeconfig = 3;
  string Namespace = 4;
  string Workload = 5;
  string SyncthingGUIAddr = 6;
  repeated CloneRule RuleList = 7;
}

message CloneRule {
  map<string, string> Headers = 6;
  string DstClusterID = 9;
  string DstCluster = 10;
  string DstKubeconfig = 11;
  string DstNamespace = 12;
  string DstWorkload = 13;
}

message VersionRequest {
}

message VersionResponse {
  string version = 1;
}

message ConfigAddRequest {
  string KubeconfigBytes = 1;
  string Namespace = 2;
  // ssh jump
  SshJump SshJump = 3;
}

message SshStartRequest {
  string ClientIP = 1;
}

message SshStartResponse {
  string ServerIP = 1;
}

message SshStopRequest {
  string ClientIP = 1;
}

message SshStopResponse {
  string ServerIP = 1;
}

message SshConnectRequest {
  string Stdin = 1;
  SshJump SshJump = 2;
}

message SshConnectResponse {
  string Stdout = 1;
  string Stderr = 2;
}

message ConfigAddResponse {
  string ClusterID = 1;
}

message ConfigRemoveRequest {
  string ClusterID = 1;
}

message ConfigRemoveResponse {
}

message LogRequest {
  bool Follow = 1;
  int32 Lines = 2;
}

message LogResponse {
  string message = 1;
}

message ListRequest {
}

message ListResponse {
  string message = 1;
}

message GetRequest {
  string Namespace = 2;
  string resource = 4;
}

message GetResponse {
  repeated string metadata = 1;
}

message UpgradeRequest {
  string ClientVersion = 1;
}

message UpgradeResponse {
  bool NeedUpgrade = 1;
}

message ResetRequest {
  string KubeconfigBytes = 1;
  string Namespace = 2;
  // ssh jump
  SshJump SshJump = 3;
}

message ResetResponse {
  string message = 1;
}

message SshJump {
  string Addr = 1;
  string User = 2;
  string Password = 3;
  string Keyfile = 4;
  string Jump = 5;
  string ConfigAlias = 6;
  string RemoteKubeconfig = 7;
  string GSSAPIKeytabConf = 8;
  string GSSAPIPassword = 9;
  string GSSAPICacheFile = 10;
}

message ExtraRoute {
  repeated string ExtraCIDR = 1;
  repeated string ExtraDomain = 2;
  bool ExtraNodeIP = 3;
}

message IdentifyRequest {}

message IdentifyResponse {
  string ID = 1;
}