Custom resource plugins
A custom resource plugin adds a new kind of resource that other apps can declare in their app.yml. The Tor plugin, for example, provides onion services.
Usage
Apps declare resources as top-level keys of app.yml, in the form <plugin app>: <plugin id>: <definition>:
tor: # app that provides the plugin
onion-service: # plugin id
web:
target_svc: main
ports:
80: 80When the app is installed or updated, n5i calls GenerateCRs of the plugin with the definition (everything below the plugin id) and applies the Kubernetes objects it returns in the app's namespace.
RPC interface
syntax = "proto3";
package n5i_plugin;
import "common.proto";
message ConvertCRRequest {
string app_id = 1;
// The custom resource, serialized as YAML
string resource = 2;
UserState user_state = 3;
bool is_system_library = 4;
}
message ConvertCRResponse {
// The custom resource(s), encoded as YAML
string resources = 1;
repeated string added_permissions_old = 2 [deprecated = true];
repeated Permission added_permissions = 3;
}
// A CustomResource plugin declares a custom extension to the internal format
service CustomResourcePlugin {
rpc GenerateCRs(ConvertCRRequest) returns (ConvertCRResponse) {}
}GenerateCRs
resource is the definition from app.yml, encoded as YAML. Return the Kubernetes objects to create in resources, as one YAML document or a YAML list. is_system_library is true for apps installed in the system scope.
added_permissions adds permissions to the app, which the user has to grant like the permissions the app requests itself. added_permissions_old is deprecated.