talos/api/machine/machine.proto
Andrey Smirnov 63212ab17e test: fix integration test for k8s version
Push versions to constants, introduce 'platform' to version API to
discover node mode. Check kernel version for non-containers.

A bit of refactoring on version package to expose something closer to a
single response.

Signed-off-by: Andrey Smirnov <smirnov.andrey@gmail.com>
2019-11-11 13:42:21 -08:00

265 lines
6.4 KiB
Protocol Buffer

syntax = "proto3";
package machine;
option go_package = "github.com/talos-systems/talos/api/machine";
option java_multiple_files = true;
option java_outer_classname = "MachineApi";
option java_package = "com.machine.api";
import "google/protobuf/empty.proto";
import "google/protobuf/timestamp.proto";
import "common/common.proto";
// The machine service definition.
service Machine {
rpc CopyOut(CopyOutRequest) returns (stream StreamingData);
rpc Kubeconfig(google.protobuf.Empty) returns (stream StreamingData);
rpc LS(LSRequest) returns (stream FileInfo);
rpc Logs(LogsRequest) returns (stream common.Data);
rpc Mounts(google.protobuf.Empty) returns (MountsReply);
rpc Reboot(google.protobuf.Empty) returns (RebootReply);
rpc Reset(google.protobuf.Empty) returns (ResetReply);
rpc ServiceList(google.protobuf.Empty) returns (ServiceListReply);
rpc ServiceRestart(ServiceRestartRequest) returns (ServiceRestartReply);
rpc ServiceStart(ServiceStartRequest) returns (ServiceStartReply);
rpc ServiceStop(ServiceStopRequest) returns (ServiceStopReply);
rpc Shutdown(google.protobuf.Empty) returns (ShutdownReply);
rpc Upgrade(UpgradeRequest) returns (UpgradeReply);
rpc Start(StartRequest) returns (StartReply) {
option deprecated = true;
};
rpc Stop(StopRequest) returns (StopReply) {
option deprecated = true;
};
rpc Version(google.protobuf.Empty) returns (VersionReply);
}
// rpc reboot
// The response message containing the reboot status.
message RebootResponse {
common.NodeMetadata metadata = 1;
}
message RebootReply {
repeated RebootResponse response = 1;
}
// rpc reset
// The response message containing the restart status.
message ResetResponse {
common.NodeMetadata metadata = 1;
}
message ResetReply {
repeated ResetResponse response = 1;
}
// rpc shutdown
// The response message containing the shutdown status.
message ShutdownResponse {
common.NodeMetadata metadata = 1;
}
message ShutdownReply {
repeated ShutdownResponse response = 1;
}
// rpc upgrade
message UpgradeRequest {
string image = 1;
}
message UpgradeResponse {
common.NodeMetadata metadata = 1;
string ack = 2;
}
message UpgradeReply {
repeated UpgradeResponse response = 1;
}
// rpc servicelist
message ServiceListResponse {
common.NodeMetadata metadata = 1;
repeated ServiceInfo services = 2;
}
message ServiceListReply {
repeated ServiceListResponse response = 1;
}
message ServiceInfo {
string id = 1;
string state = 2;
ServiceEvents events = 3;
ServiceHealth health = 4;
}
message ServiceEvents {
repeated ServiceEvent events = 1;
}
message ServiceEvent {
string msg = 1;
string state = 2;
google.protobuf.Timestamp ts = 3;
}
message ServiceHealth {
bool unknown = 1;
bool healthy = 2;
string last_message = 3;
google.protobuf.Timestamp last_change = 4;
}
// rpc servicestart
message ServiceStartRequest {
string id = 1;
}
message ServiceStartResponse {
common.NodeMetadata metadata = 1;
string resp = 2;
}
message ServiceStartReply {
repeated ServiceStartResponse response = 1;
}
message ServiceStopRequest {
string id = 1;
}
message ServiceStopResponse {
common.NodeMetadata metadata = 1;
string resp = 2;
}
message ServiceStopReply {
repeated ServiceStopResponse response = 1;
}
message ServiceRestartRequest {
string id = 1;
}
message ServiceRestartResponse {
common.NodeMetadata metadata = 1;
string resp = 2;
}
message ServiceRestartReply {
repeated ServiceRestartResponse response = 1;
}
message StartRequest {
option deprecated = true;
string id = 1;
}
message StartReply {
option deprecated = true;
string resp = 1;
}
message StopRequest {
option deprecated = true;
string id = 1;
}
message StopReply {
option deprecated = true;
string resp = 1;
}
// StreamingData is used to stream back responses
message StreamingData {
bytes bytes = 1;
string errors = 2;
}
// CopyOutRequest describes a request to copy data out of Talos node
//
// CopyOut produces .tar.gz archive which is streamed back to the caller
message CopyOutRequest {
// Root path to start copying data out, it might be either a file or directory
string root_path = 1;
}
// LSRequest describes a request to list the contents of a directory
message LSRequest {
// Root indicates the root directory for the list. If not indicated, '/' is
// presumed.
string root = 1;
// Recurse indicates that subdirectories should be recursed.
bool recurse = 2;
// RecursionDepth indicates how many levels of subdirectories should be
// recursed. The default (0) indicates that no limit should be enforced.
int32 recursion_depth = 3;
}
// FileInfo describes a file or directory's information
message FileInfo {
// Name is the name (including prefixed path) of the file or directory
string name = 1;
// Size indicates the number of bytes contained within the file
int64 size = 2;
// Mode is the bitmap of UNIX mode/permission flags of the file
uint32 mode = 3;
// Modified indicates the UNIX timestamp at which the file was last modified
int64 modified = 4; // TODO: unix timestamp or include proto's Date type
// IsDir indicates that the file is a directory
bool is_dir = 5;
// Error describes any error encountered while trying to read the file
// information.
string error = 6;
// Link is filled with symlink target
string link = 7;
// RelativeName is the name of the file or directory relative to the RootPath
string relative_name = 8;
}
// The response message containing the requested df stats.
message MountsResponse {
common.NodeMetadata metadata = 1;
repeated MountStat stats = 2;
}
message MountsReply {
repeated MountsResponse response = 1;
}
// The response message containing the requested processes.
message MountStat {
string filesystem = 1;
uint64 size = 2;
uint64 available = 3;
string mounted_on = 4;
}
message VersionResponse {
common.NodeMetadata metadata = 1;
VersionInfo version = 2;
PlatformInfo platform = 3;
}
message VersionReply {
repeated VersionResponse response = 1;
}
message VersionInfo {
string tag = 1;
string sha = 2;
string built = 3;
string go_version = 4;
string os = 5;
string arch = 6;
}
message PlatformInfo {
string name = 1;
string mode = 2;
}
// rpc logs
// The request message containing the process name.
message LogsRequest {
string namespace = 1;
string id = 2;
// driver might be default "containerd" or "cri"
common.ContainerDriver driver = 3;
}