blob: 156f0360c76e7a0c0543eb98e5ea388348524fcb [file] [log] [blame]
Serge Bazanskiefdb6e92020-07-13 17:19:27 +02001// Copyright 2020 The Monogon Project Authors.
2//
3// SPDX-License-Identifier: Apache-2.0
4//
5// Licensed under the Apache License, Version 2.0 (the "License");
6// you may not use this file except in compliance with the License.
7// You may obtain a copy of the License at
8//
9// http://www.apache.org/licenses/LICENSE-2.0
10//
11// Unless required by applicable law or agreed to in writing, software
12// distributed under the License is distributed on an "AS IS" BASIS,
13// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14// See the License for the specific language governing permissions and
15// limitations under the License.
16
17syntax = "proto3";
Serge Bazanski662b5b32020-12-21 13:49:00 +010018package metropolis.proto.api;
Serge Bazanski31370b02021-01-07 16:31:14 +010019option go_package = "source.monogon.dev/metropolis/proto/api";
Serge Bazanskiefdb6e92020-07-13 17:19:27 +020020
Mateusz Zalegacf92f402022-07-08 15:08:48 +020021import "google/protobuf/timestamp.proto";
Serge Bazanskib91938f2023-03-29 14:31:22 +020022import "metropolis/proto/api/management.proto";
Mateusz Zalegacf92f402022-07-08 15:08:48 +020023
Serge Bazanski662b5b32020-12-21 13:49:00 +010024// NodeDebugService exposes debug and testing endpoints that allow introspection into a running Metropolis node.
Serge Bazanski77cb6c52020-12-19 00:09:22 +010025// It is not authenticated and will be disabled in production. It is currently consumed by metropolis/cli/dbg and
26// by tests.
Serge Bazanskiefdb6e92020-07-13 17:19:27 +020027service NodeDebugService {
28 // GetDebugKubeconfig issues kubeconfigs with arbitrary identities and groups for debugging
29 rpc GetDebugKubeconfig(GetDebugKubeconfigRequest) returns (GetDebugKubeconfigResponse);
Serge Bazanskib0272182020-11-02 18:39:44 +010030
31 // GetLogs Returns historical and/or streaming logs for a given DN with given filters from the system global
32 // LogTree.
33 //
Serge Bazanski549b72b2021-01-07 14:54:19 +010034 // For more information about this API, see //metropolis/pkg/logtree. But, in summary:
Serge Bazanskib0272182020-11-02 18:39:44 +010035 // - All logging is performed to a DN (distinguished name), which is a dot-delimited string like foo.bar.baz.
36 // - Log entries can be either raw (coming from unstructured logging from an external service, like a running
Serge Bazanski662b5b32020-12-21 13:49:00 +010037 // process) or leveled (emitted by Metropolis code with a source line, timestamp, and severity).
Serge Bazanskib0272182020-11-02 18:39:44 +010038 // - The DNs form a tree of logging nodes - and when requesting logs, a given subtree of DNs can be requested,
39 // instead of just a given DN.
40 // - All supervised processes live at `root.<supervisor DN>`. For more example paths, see the console logs of
Serge Bazanski662b5b32020-12-21 13:49:00 +010041 // a running Metropolis node, or request all logs (at DN "").
Serge Bazanskib0272182020-11-02 18:39:44 +010042 //
43 // TODO(q3k): move method and its related messages to the non-debug node endpoint once we have one.
44 rpc GetLogs(GetLogsRequest) returns (stream GetLogsResponse);
Lorenz Brun09c275b2021-03-30 12:47:09 +020045
46 // Trace enables tracing of Metropolis using the Linux ftrace infrastructure.
47 rpc Trace(TraceRequest) returns (stream TraceEvent);
Lorenz Brun9d6c4c72021-07-20 21:16:27 +020048
49 // LoadImage loads an uncompressed tarball containing a Docker v1.1, v1.2 or OCI v1 image into the local
50 // containerd image store. The client streams the tarball in arbitrary-sized chunks and closes the sending side
51 // once it has sent the entire image. The server then either returns an empty response if successful or a gRPC error.
52 rpc LoadImage(stream ImagePart) returns (LoadImageResponse);
Serge Bazanskiefdb6e92020-07-13 17:19:27 +020053}
54
Lorenz Brun9d6c4c72021-07-20 21:16:27 +020055message ImagePart {
56 bytes data_part = 1;
57}
58
59message LoadImageResponse {
60}
Serge Bazanskiefdb6e92020-07-13 17:19:27 +020061
62message GetDebugKubeconfigRequest {
63 string id = 1; // Kubernetes identity (user)
64 repeated string groups = 2; // Kubernetes groups
65}
66
67message GetDebugKubeconfigResponse {
68 string debug_kubeconfig = 1;
69}
70
Lorenz Brun09c275b2021-03-30 12:47:09 +020071message TraceRequest {
72 // Name of the tracer to use. Defined in https://www.kernel.org/doc/html/latest/trace/ftrace.html#the-tracers.
73 // Useful ones enabled in Metropolis: function_graph, function.
74 // Gets reset to nop automatically after the stream is terminated.
75 string tracer = 1;
76
77 // List of functions to trace. Accepts wildcards using the '*' character. If left empty traces all functions.
78 repeated string function_filter = 2;
79
80 // List of functions and their descendants to trace with the function_graph tracer.
81 repeated string graph_function_filter = 3;
82}
83
84message TraceEvent {
85 // Currently we do not parse the event data and just return what the kernel outputs, line-by-line.
86 string raw_line = 1;
Mateusz Zalegacf92f402022-07-08 15:08:48 +020087}