talos/api/resource/resource.proto
Andrey Smirnov 11863dd74d feat: implement resource API in Talos
This brings in `os-runtime` package and exposes resources with first
iteration of read-only API.

Two Talos resources (and one controller) are implemented:

* legacy.Service resource tracks Talos 'service' `RUNNING` state
* config.V1Alpha1 stores current runtime config

Glue point between existing runtime and new os-runtime based runtime is
in `v1alpha2` implementation and `V1Alpha2()` sub-interfaces of existing
`Runtime`, `State`, `Controller` interfaces.

Signed-off-by: Andrey Smirnov <smirnov.andrey@gmail.com>
2021-01-19 11:45:46 -08:00

85 lines
1.7 KiB
Protocol Buffer

syntax = "proto3";
package resource;
option go_package = "github.com/talos-systems/talos/pkg/machinery/api/resource";
option java_multiple_files = true;
option java_outer_classname = "ResourceApi";
option java_package = "com.resource.api";
import "common/common.proto";
// The resource service definition.
//
// ResourceService provides user-facing API for the Talos resources.
service ResourceService {
rpc Get(GetRequest) returns (GetResponse);
rpc List(ListRequest) returns (stream ListResponse);
rpc Watch(WatchRequest) returns (stream WatchResponse);
}
// common resource definition
message Resource {
Metadata metadata = 1;
Spec spec = 2;
}
message Metadata {
string namespace = 1;
string type = 2;
string id = 3;
string version = 4;
string phase = 5;
repeated string finalizers = 6;
}
message Spec {
bytes yaml = 1;
}
// rpc Get
message GetRequest {
string namespace = 1;
string type = 2;
string id = 3;
}
// The GetResponse message contains the Resource returned.
message Get {
common.Metadata metadata = 1;
Resource definition = 2;
Resource resource = 3;
}
message GetResponse { repeated Get messages = 1; }
// rpc List
// The ListResponse message contains the Resource returned.
message ListRequest {
string namespace = 1;
string type = 2;
}
message ListResponse {
common.Metadata metadata = 1;
Resource definition = 2;
Resource resource = 3;
}
// rpc Watch
// The WatchResponse message contains the Resource returned.
message WatchRequest {}
enum EventType {
CREATED = 0;
UPDATED = 1;
DELETED = 2;
}
message WatchResponse {
common.Metadata metadata = 1;
EventType event_type = 2;
Resource resource = 3;
}