notapipeline / tiyo

Tiyo is a Kubernetes application designer and flow executor written in Go and JointJS
Mozilla Public License 2.0
0 stars 0 forks source link

gRPC between syphon and flow #2

Open mproffitt opened 2 years ago

mproffitt commented 2 years ago

At present, syphon makes a rest request to flow to receive commands. This is OK(ish) for command receipt but is a bottleneck on performance, particularly if we want to stream logs back to display on the pipeline front end.

In reality, it would be beneficial to rip out the entire flow api and replace this with gRPC. As not all parts of a Command are required to execute in syphon, this would reduce the request overhead by an order of magnitude.

Example: Flow / syphon:

service Syphon {
    rpc Flow (stream Command) returns (stream Status) {}
}

message Command {
    string command = 1;
    string args = 2;
    string language = 3;
    bool script = 4;
    string scriptcontent = 5;
    int32 timeout = 6;
    GitRepo repo = 7;
    repeated string environment = 8;
    repeated Credential credentials = 9;
}

message Credential {
     string username = 1;
     string password = 2;
}

message GitRepo {
     string url = 1;
     string scriptname = 2;
     string username = 3;
     string password = 4;
}

message Status {
    // is the command still running?
    bool running = 1;

    // The commands exit status
    int32 status = 2;

    // Time of last message
    string timestamp = 3;

    // The last line of output from the command
    string logline = 4;
}