Skip to content

Commit d43a01c

Browse files
laurazardsmira
authored andcommitted
feat: implement talosctl debug
This implements a way to run a debug container with a provided image on the node. The container runs with privileged profile, allowing to issue debugging commands (e.g. using some advanced network tools) to troubleshoot a machine. Signed-off-by: Laura Brehm <laurabrehm@hey.com> Signed-off-by: Andrey Smirnov <andrey.smirnov@siderolabs.com>
1 parent 34a31c9 commit d43a01c

26 files changed

Lines changed: 3474 additions & 122 deletions

File tree

api/common/common.proto

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -97,9 +97,9 @@ enum ContainerdNamespace {
9797

9898
message ContainerdInstance {
9999
// Containerd instance to use.
100-
common.ContainerDriver driver = 1;
100+
ContainerDriver driver = 1;
101101
// Containerd namespace to use.
102-
common.ContainerdNamespace namespace = 2;
102+
ContainerdNamespace namespace = 2;
103103
}
104104

105105
message URL {

api/machine/debug.proto

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
syntax = "proto3";
2+
3+
package machine;
4+
5+
option go_package = "github.com/siderolabs/talos/pkg/machinery/api/machine";
6+
option java_package = "dev.talos.api.machine";
7+
8+
import "common/common.proto";
9+
10+
// DebugService provides debugging and inspection capabilities for a Talos node.
11+
service DebugService {
12+
// ContainerRun runs a debug container, attaches to it, and streams I/O.
13+
rpc ContainerRun(stream DebugContainerRunRequest) returns (stream DebugContainerRunResponse);
14+
}
15+
16+
message DebugContainerRunRequest {
17+
oneof request {
18+
// 1. send the container spec
19+
DebugContainerRunRequestSpec spec = 1;
20+
// 2. send either of the three below to interact with the running container
21+
bytes stdin_data = 2;
22+
int32 signal = 3;
23+
DebugContainerTerminalResize term_resize = 4;
24+
}
25+
}
26+
27+
message DebugContainerRunRequestSpec {
28+
common.ContainerdInstance containerd = 1;
29+
string image_name = 2;
30+
repeated string args = 3;
31+
map<string, string> env = 4;
32+
33+
enum Profile {
34+
PROFILE_UNSPECIFIED = 0;
35+
PROFILE_PRIVILEGED = 1;
36+
}
37+
38+
Profile profile = 5;
39+
bool tty = 6;
40+
}
41+
42+
message DebugContainerTerminalResize {
43+
int32 width = 1;
44+
int32 height = 2;
45+
}
46+
47+
message DebugContainerRunResponse {
48+
oneof resp {
49+
bytes stdout_data = 2;
50+
int32 exit_code = 3;
51+
}
52+
}

0 commit comments

Comments
 (0)