pivotal / skenario

A simulator toolkit for Knative
Apache License 2.0
29 stars 10 forks source link

Extend plugin to support VPA #98

Open josephburnett opened 4 years ago

josephburnett commented 4 years ago

(Copied from https://github.com/josephburnett/sk-plugin/issues/1 when sk-plugin was moved to the skenario respository)

Now sk-plugin protocol provides 2 callback functions, 2 input and 1 output.

(input) Event--create, update and delete events for pods etc... (input) Stat--periodic system stats such as CPU usage or request concurrency. (output) Scale--a request for a recommended scale, given prior input callbacks.

We need to extend this protocol to support VPA. New protocol will look like:

(input) Event--create, update and delete events for pods etc... (input) Stat--periodic system stats such as CPU usage or request concurrency. (output) Scale_horizontally--a request for a recommended scale horizontally, given prior input callbacks. (output) Scale_vertically--a request for a recommended scale vertically, given prior input callbacks.

Proto

syntax = "proto3"; package proto;

message Empty {}

message Autoscaler { string type = 1; string yaml = 2; }

message Pod { string name = 1; string state = 2; int64 last_transition = 3; int32 cpu_request = 4; }

enum EventType { CREATE = 0; UPDATE = 1; DELETE = 2; }

message EventRequest { string partition = 1; int64 time = 2; EventType type = 3; oneof object_oneof { Autoscaler autoscaler = 4; Pod pod = 5; } }

enum MetricType { CPU_MILLIS = 0; CONCURRENT_REQUESTS_MILLIS = 1; }

message Stat { int64 time = 1; string pod_name = 2; MetricType type = 3; int32 value = 4; }

message StatRequest { string partition = 1; repeated Stat stat = 2; }

message VerticalSizeRequest{ string partition = 1; int64 time_nanos = 2; }

message VerticalSizeResponse{ repeated RecommendedPodResources rec = 1; }

message RecommendedPodResources{ string pod_name = 1; int32 lower_bound = 2; int32 upper_bound = 3; int32 target = 4; string resource_name = 5; int32 recommendation = 2; }

message HorizontalSizeRequest{ string partition = 1; int64 time_nanos = 2; }

message HorizontalSizeResponse{ int32 rec = 1; } service Plugin { rpc Event(EventRequest) returns (Empty); rpc Stat(StatRequest) returns (Empty); rpc HorizontalRecommendation(HorizontalSizeRequest) returns (HorizontalSizeResponse); rpc VerticalRecommendation(VerticalSizeRequest) returns (VerticalSizeResponse); }