Commit f95105bb authored by Michelle Nguyen's avatar Michelle Nguyen
Browse files

Separate cloud/vizier APIs into public protos

Summary:
Our original cloudapipb and vizierpb protos weren't actually in a state where we could make them public.
This diff creates new proto files for the protos that we do want to make public.
The changes are as follows:
CloudAPI:
- created new pl.cloudapi.public proto package for our public protos
- Created ClusterManager, which is a wrapper around the ClusterInfoService. This service excludes unnecessary functions such as creating/updating clusters. Users can GetClusters, which contains a subset of data from the original GetClusterInfo. ClusterManager also contains UpdateClusterConfig, which is a wrapper around the internal UpdateClusterConfig.
- copied APIKey/DeployKey services to the new public protos. *in the current state, this will break the old CLI, which points to the old API/DeployKey service.* the CLI, which is the only external place which uses these services, has been updated to use the new public proto. is it worth keeping the old service around for users with the old CLI, or should we just ask them to update?
Vizierpb:
- Renamed old, internal proto package to `pl.api.internal.vizierpb`, so that the public package can be `pl.api.vizierpb`, in hopes of maintaining backwards compatibility.
- Copied ExecuteScript/HealthCheck to new public package

Test Plan:
On Pixie Cloud with new API changes:
- deployed current release version of Vizier. verify that UI + new & old CLI can still query vizier. with new CLI, debugLog continues to work. with old CLI, debugLog does not work.
- deployed Vizier using skaffold. verify that UI + new & old CLI can still query vizier. with new CLI, debugLog works. with old CLI, debugLog does not work.

Reviewers: zasgar, philkuz, #engineering

Reviewed By: zasgar, #engineering

Differential Revision: https://phab.corp.pixielabs.ai/D7185

GitOrigin-RevId: f01d8a8a2d0d11256c308f3c4dcaf9b1c5a3b763
parent cf56f4bc
Showing with 14069 additions and 4 deletions
+14069 -4
......@@ -24,6 +24,8 @@ gazelle(
# TODO(zasgar): We should keep an eye on fixes to gazelle that make this automatic
# Make gazelle resolve the proto paths correctly.
# gazelle:resolve go pixielabs.ai/pixielabs/src/cloud/cloudapipb //src/cloud/cloudapipb:cloudapi_pl_go_proto
# gazelle:resolve go pixielabs.ai/pixielabs/src/api/public/cloudapipb //src/api/public/cloudapipb:public_cloudapi_pl_go_proto
# gazelle:resolve go pixielabs.ai/pixielabs/src/api/public/vizierapipb //src/api/public/vizierapipb:public_vizier_pl_go_proto
# gazelle:resolve go pixielabs.ai/pixielabs/src/shared/artifacts/versionspb //src/shared/artifacts/versionspb:versions_pl_go_proto
# gazelle:resolve go pixielabs.ai/pixielabs/src/cloud/artifact_tracker/artifacttrackerpb //src/cloud/artifact_tracker/artifacttrackerpb:artifact_tracker_pl_go_proto
# gazelle:resolve go pixielabs.ai/pixielabs/src/cloud/vzconn/vzconnpb //src/cloud/vzconn/vzconnpb:service_pl_go_proto
......
......@@ -43,6 +43,10 @@ spec:
backend:
serviceName: cloud-proxy-service
servicePort: 5555
- path: /pl.public.cloudapi.ClusterManager/*
backend:
serviceName: cloud-proxy-service
servicePort: 5555
- path: /*
backend:
serviceName: cloud-proxy-service
......
# gazelle:ignore
package(default_visibility = ["//visibility:public"])
load("//bazel:proto_compile.bzl", "pl_cc_proto_library", "pl_go_proto_library", "pl_proto_library", "pl_py_grpc_library")
pl_proto_library(
name = "cloudapi_pl_proto",
srcs = ["cloudapi.proto"],
visibility = ["//visibility:public"],
deps = [
"//src/common/uuid/proto:uuid_pl_proto",
"//src/shared/k8s/metadatapb:metadata_pl_proto",
"//src/shared/vispb:vis_pl_proto",
"@gogo_special_proto//github.com/gogo/protobuf/gogoproto",
],
)
pl_go_proto_library(
name = "public_cloudapi_pl_go_proto",
importpath = "pixielabs.ai/pixielabs/src/api/public/cloudapipb",
proto = ":cloudapi_pl_proto",
visibility = ["//visibility:public"],
deps = [
"//src/common/uuid/proto:uuid_pl_go_proto",
"//src/shared/k8s/metadatapb:metadata_pl_go_proto",
"//src/shared/vispb:vis_pl_go_proto",
"@com_github_gogo_protobuf//gogoproto:go_default_library",
],
)
pl_py_grpc_library(
name = "cloudapi_pl_py_grpc",
proto = ":cloudapi_pl_proto",
visibility = ["//visibility:public"],
imports = ["../../../"],
deps = [
"//src/common/uuid/proto:uuid_pl_py_proto",
"//src/shared/k8s/metadatapb:metadata_pl_py_proto",
"//src/shared/vispb:vis_pl_py_proto",
],
)
This diff is collapsed.
syntax = "proto3";
/**********************************************************************
* NOTICE: INTERNAL
* This file is meant as the external protobuf interface for the cloud.
* Please do not include dependencies that are outside of /src/common
* and only include protobufs that are useful to external-facing users.
**********************************************************************/
package pl.public.cloudapi;
import "github.com/gogo/protobuf/gogoproto/gogo.proto";
import "google/protobuf/wrappers.proto";
import "src/common/uuid/proto/uuid.proto";
option go_package = "pixielabs.ai/pixielabs/src/api/public/cloudapipb;publiccloudapipb";
service ClusterManager {
rpc GetCluster(GetClusterRequest) returns(GetClusterResponse) {}
rpc UpdateClusterConfig(UpdateClusterConfigRequest) returns(UpdateClusterConfigResponse) {}
}
message ClusterConfig {
bool passthrough_enabled = 1;
}
message ClusterConfigUpdate {
google.protobuf.BoolValue passthrough_enabled = 1;
}
message GetClusterRequest {
// Optional. If specified, get cluster info only for the specified cluster.
pl.uuidpb.UUID id = 1 [
(gogoproto.customname) = "ID"
];
}
enum ClusterStatus {
CS_UNKNOWN = 0;
CS_HEALTHY = 1;
CS_UNHEALTHY = 2;
CS_DISCONNECTED = 3;
CS_UPDATING = 4;
CS_CONNECTED = 5;
CS_UPDATE_FAILED = 6;
}
message ClusterInfo {
pl.uuidpb.UUID id = 1 [
(gogoproto.customname) = "ID"
];
ClusterStatus status = 2;
int64 lastHeartbeatNs = 3;
ClusterConfig config = 4;
// A unique ID for the cluster. This is typically the kube-system namespace UID.
string cluster_uid = 5 [
(gogoproto.customname) = "ClusterUID"
];
// The name of the cluster. The return value of "kubectl config current-context".
// This could be empty if the user has not deployed through the CLI.
string cluster_name = 6;
// The version of the K8s cluster. For example: v1.14.10-gke.27. This could be empty if
// the user has not deployed through the CLI.
string cluster_version = 7;
// The version of the deployed Vizier.
string vizier_version = 8;
// The total number of nodes (instrumented & non-instrumented) on the cluster this Vizier is on.
int32 num_nodes = 9;
// The total number of nodes on the cluster that have pems.
int32 num_instrumented_nodes = 10;
}
message GetClusterResponse {
repeated ClusterInfo clusters = 1;
}
message UpdateClusterConfigRequest {
pl.uuidpb.UUID id = 1 [
(gogoproto.customname) = "ID"
];
ClusterConfigUpdate config_update = 2;
}
message UpdateClusterConfigResponse {}
package publiccloudapipb
//go:generate mockgen -source=cloudapi.pb.go -destination=mock/cloudapi_mock.gen.go
load("@io_bazel_rules_go//go:def.bzl", "go_library")
go_library(
name = "go_default_library",
srcs = ["cloudapi_mock.gen.go"],
importpath = "pixielabs.ai/pixielabs/src/api/public/cloudapipb/mock",
visibility = ["//visibility:public"],
deps = [
"//src/api/public/cloudapipb:public_cloudapi_pl_go_proto",
"@com_github_golang_mock//gomock:go_default_library",
"@org_golang_google_grpc//:go_default_library",
],
)
// Code generated by MockGen. DO NOT EDIT.
// Source: cloudapi.pb.go
// Package mock_publiccloudapipb is a generated GoMock package.
package mock_publiccloudapipb
import (
context "context"
gomock "github.com/golang/mock/gomock"
grpc "google.golang.org/grpc"
cloudapipb "pixielabs.ai/pixielabs/src/api/public/cloudapipb"
reflect "reflect"
)
// MockClusterManagerClient is a mock of ClusterManagerClient interface
type MockClusterManagerClient struct {
ctrl *gomock.Controller
recorder *MockClusterManagerClientMockRecorder
}
// MockClusterManagerClientMockRecorder is the mock recorder for MockClusterManagerClient
type MockClusterManagerClientMockRecorder struct {
mock *MockClusterManagerClient
}
// NewMockClusterManagerClient creates a new mock instance
func NewMockClusterManagerClient(ctrl *gomock.Controller) *MockClusterManagerClient {
mock := &MockClusterManagerClient{ctrl: ctrl}
mock.recorder = &MockClusterManagerClientMockRecorder{mock}
return mock
}
// EXPECT returns an object that allows the caller to indicate expected use
func (m *MockClusterManagerClient) EXPECT() *MockClusterManagerClientMockRecorder {
return m.recorder
}
// GetCluster mocks base method
func (m *MockClusterManagerClient) GetCluster(ctx context.Context, in *cloudapipb.GetClusterRequest, opts ...grpc.CallOption) (*cloudapipb.GetClusterResponse, error) {
varargs := []interface{}{ctx, in}
for _, a := range opts {
varargs = append(varargs, a)
}
ret := m.ctrl.Call(m, "GetCluster", varargs...)
ret0, _ := ret[0].(*cloudapipb.GetClusterResponse)
ret1, _ := ret[1].(error)
return ret0, ret1
}
// GetCluster indicates an expected call of GetCluster
func (mr *MockClusterManagerClientMockRecorder) GetCluster(ctx, in interface{}, opts ...interface{}) *gomock.Call {
varargs := append([]interface{}{ctx, in}, opts...)
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetCluster", reflect.TypeOf((*MockClusterManagerClient)(nil).GetCluster), varargs...)
}
// UpdateClusterConfig mocks base method
func (m *MockClusterManagerClient) UpdateClusterConfig(ctx context.Context, in *cloudapipb.UpdateClusterConfigRequest, opts ...grpc.CallOption) (*cloudapipb.UpdateClusterConfigResponse, error) {
varargs := []interface{}{ctx, in}
for _, a := range opts {
varargs = append(varargs, a)
}
ret := m.ctrl.Call(m, "UpdateClusterConfig", varargs...)
ret0, _ := ret[0].(*cloudapipb.UpdateClusterConfigResponse)
ret1, _ := ret[1].(error)
return ret0, ret1
}
// UpdateClusterConfig indicates an expected call of UpdateClusterConfig
func (mr *MockClusterManagerClientMockRecorder) UpdateClusterConfig(ctx, in interface{}, opts ...interface{}) *gomock.Call {
varargs := append([]interface{}{ctx, in}, opts...)
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "UpdateClusterConfig", reflect.TypeOf((*MockClusterManagerClient)(nil).UpdateClusterConfig), varargs...)
}
// MockClusterManagerServer is a mock of ClusterManagerServer interface
type MockClusterManagerServer struct {
ctrl *gomock.Controller
recorder *MockClusterManagerServerMockRecorder
}
// MockClusterManagerServerMockRecorder is the mock recorder for MockClusterManagerServer
type MockClusterManagerServerMockRecorder struct {
mock *MockClusterManagerServer
}
// NewMockClusterManagerServer creates a new mock instance
func NewMockClusterManagerServer(ctrl *gomock.Controller) *MockClusterManagerServer {
mock := &MockClusterManagerServer{ctrl: ctrl}
mock.recorder = &MockClusterManagerServerMockRecorder{mock}
return mock
}
// EXPECT returns an object that allows the caller to indicate expected use
func (m *MockClusterManagerServer) EXPECT() *MockClusterManagerServerMockRecorder {
return m.recorder
}
// GetCluster mocks base method
func (m *MockClusterManagerServer) GetCluster(arg0 context.Context, arg1 *cloudapipb.GetClusterRequest) (*cloudapipb.GetClusterResponse, error) {
ret := m.ctrl.Call(m, "GetCluster", arg0, arg1)
ret0, _ := ret[0].(*cloudapipb.GetClusterResponse)
ret1, _ := ret[1].(error)
return ret0, ret1
}
// GetCluster indicates an expected call of GetCluster
func (mr *MockClusterManagerServerMockRecorder) GetCluster(arg0, arg1 interface{}) *gomock.Call {
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetCluster", reflect.TypeOf((*MockClusterManagerServer)(nil).GetCluster), arg0, arg1)
}
// UpdateClusterConfig mocks base method
func (m *MockClusterManagerServer) UpdateClusterConfig(arg0 context.Context, arg1 *cloudapipb.UpdateClusterConfigRequest) (*cloudapipb.UpdateClusterConfigResponse, error) {
ret := m.ctrl.Call(m, "UpdateClusterConfig", arg0, arg1)
ret0, _ := ret[0].(*cloudapipb.UpdateClusterConfigResponse)
ret1, _ := ret[1].(error)
return ret0, ret1
}
// UpdateClusterConfig indicates an expected call of UpdateClusterConfig
func (mr *MockClusterManagerServerMockRecorder) UpdateClusterConfig(arg0, arg1 interface{}) *gomock.Call {
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "UpdateClusterConfig", reflect.TypeOf((*MockClusterManagerServer)(nil).UpdateClusterConfig), arg0, arg1)
}
# gazelle:ignore
load("//bazel:proto_compile.bzl", "pl_cc_proto_library", "pl_go_proto_library", "pl_proto_library", "pl_py_grpc_library")
load("//bazel:grpc_web.bzl", "pl_grpc_web_library")
pl_proto_library(
name = "vizier_pl_proto",
srcs = ["vizierapi.proto"],
visibility = ["//visibility:public"],
deps = [
"@gogo_grpc_proto//github.com/gogo/protobuf/gogoproto:gogo_pl_proto",
],
)
pl_cc_proto_library(
name = "vizier_pl_cc_proto",
proto = ":vizier_pl_proto",
visibility = ["//visibility:public"],
deps = [
"@gogo_grpc_proto//github.com/gogo/protobuf/gogoproto:gogo_pl_cc_proto",
],
)
pl_go_proto_library(
name = "public_vizier_pl_go_proto",
importpath = "pixielabs.ai/pixielabs/src/api/public/vizierapipb",
proto = ":vizier_pl_proto",
visibility = ["//visibility:public"],
)
pl_grpc_web_library(
name = "vizier_pl_grpc_web_proto",
proto = ":vizier_pl_proto",
visibility = ["//visibility:public"],
)
pl_py_grpc_library(
name = "vizier_pl_py_grpc",
proto = ":vizier_pl_proto",
visibility = ["//visibility:public"],
imports = ["../../../"],
)
package publicvizierapipb
//go:generate mockgen -source=vizierapi.pb.go -destination=mock/vizier_mock.gen.go
load("@io_bazel_rules_go//go:def.bzl", "go_library")
go_library(
name = "go_default_library",
srcs = ["vizier_mock.gen.go"],
importpath = "pixielabs.ai/pixielabs/src/api/public/vizierapipb/mock",
visibility = ["//visibility:public"],
deps = [
"//src/api/public/vizierapipb:public_vizier_pl_go_proto",
"@com_github_golang_mock//gomock:go_default_library",
"@org_golang_google_grpc//:go_default_library",
"@org_golang_google_grpc//metadata:go_default_library",
],
)
This diff is collapsed.
This diff is collapsed.
syntax = "proto3";
import "github.com/gogo/protobuf/gogoproto/gogo.proto";
package pl.api.vizierpb;
option go_package = "pixielabs.ai/pixielabs/src/api/public/vizierapipb;publicvizierapipb";
// The list of data types supported by our execution engine.
enum DataType {
DATA_TYPE_UNKNOWN = 0;
BOOLEAN = 1;
INT64 = 2;
UINT128 = 3;
FLOAT64 = 4;
STRING = 5;
TIME64NS = 6;
}
enum SemanticType {
ST_UNSPECIFIED = 0;
ST_NONE = 1;
ST_TIME_NS = 2;
ST_AGENT_UID = 100;
ST_ASID = 101;
ST_UPID = 200;
ST_SERVICE_NAME = 300;
ST_POD_NAME = 400;
ST_POD_PHASE = 401;
ST_POD_STATUS = 402;
ST_NODE_NAME = 500;
ST_CONTAINER_NAME = 600;
ST_CONTAINER_STATE = 601;
ST_CONTAINER_STATUS = 602;
ST_NAMESPACE_NAME = 700;
ST_BYTES = 800;
ST_PERCENT = 900;
ST_DURATION_NS = 901;
ST_THROUGHPUT_PER_NS = 902;
ST_THROUGHPUT_BYTES_PER_NS = 903;
ST_QUANTILES = 1000;
ST_DURATION_NS_QUANTILES = 1001;
ST_IP_ADDRESS = 1100;
ST_PORT = 1200;
ST_HTTP_REQ_METHOD = 1300;
ST_HTTP_RESP_STATUS = 1400;
ST_HTTP_RESP_MESSAGE = 1500;
ST_SCRIPT_REFERENCE = 3000;
}
message UInt128 {
uint64 low = 1;
uint64 high = 2;
}
// Boolean data column.
message BooleanColumn {
repeated bool data = 1;
}
// Int64 column data.
message Int64Column {
repeated int64 data = 1;
}
// Uint128 column data.
message UInt128Column {
repeated UInt128 data = 1;
}
// Float64 column data.
message Float64Column {
repeated double data = 1;
}
// Time64 column data.
message Time64NSColumn {
repeated int64 data = 1;
}
// String data column.
message StringColumn {
repeated string data = 1;
}
// A single column of data.
message Column {
oneof col_data {
BooleanColumn boolean_data = 1;
Int64Column int64_data = 2;
UInt128Column uint128_data = 3;
Time64NSColumn time64ns_data = 4;
Float64Column float64_data = 5;
StringColumn string_data = 6;
}
}
// RowBatchData is a temporary data type that will remove when proper serialization
// is implemented.
message RowBatchData {
string table_id = 5 [ (gogoproto.customname) = "TableID" ]; // The ID of the table which the row batch belongs to.
repeated Column cols = 1;
int64 num_rows = 2;
bool eow = 3;
bool eos = 4;
}
message Relation {
message ColumnInfo {
string column_name = 1;
DataType column_type = 2;
string column_desc = 3;
SemanticType column_semantic_type = 4;
}
repeated ColumnInfo columns = 1;
}
message CompilerError {
uint64 line = 1;
uint64 column = 2;
string message = 3;
}
message ErrorDetails {
oneof error {
CompilerError compiler_error = 1;
}
}
message Status {
// The status code, which should be an enum value of [google.rpc.Code][google.rpc.Code].
int32 code = 1;
// A developer-facing error message, which should be in English. Any
// user-facing error message should be localized and sent in the
// [google.rpc.Status.details][google.rpc.Status.details] field, or localized by the client.
string message = 2;
// Reserved for deprecated Details.
reserved 3;
repeated ErrorDetails error_details = 4;
}
// This is a proto representation for common lifecycle states.
enum LifeCycleState {
// State of the resource is unknown.
UNKNOWN_STATE = 0;
// Resource is still in the start up process.
PENDING_STATE = 1;
// Resource is active and healthy.
RUNNING_STATE = 2;
// Resource is not running and has failed.
FAILED_STATE = 3;
// Resource has been terminated with no errors.
TERMINATED_STATE = 4;
}
// ScalarValues reference a single constant value.
message ScalarValue {
// We need to store the type to handle the null case and make sure we have the
// "correct" null value. This type takes precedence on the one of value below.
// If they mismatch a null value will be used.
DataType data_type = 1;
oneof value {
bool bool_value = 2;
int64 int64_value = 3;
double float64_value = 4;
string string_value = 5;
int64 time64_ns_value = 6;
UInt128 uint128_value = 7;
}
}
// ExecuteScriptRequest is the request for ExecuteQuery(). This
// should contain all necessary information to successfully run
// a script on Vizier.
message ExecuteScriptRequest {
// query_str is the string representation of the query to run.
string query_str = 1;
// Old arg_values deprecated.
reserved 2;
// The UUID of the cluster encoded as a string with dashes.
string cluster_id = 3 [ (gogoproto.customname) = "ClusterID" ];
// FuncToExecute specifies the name and arguments of a function to execute.
message FuncToExecute {
// Name of function to execute. Can be of the form 'func_name' or 'module_name.func_name'.
string func_name = 1;
message ArgValue {
// name of the argument.
string name = 1;
// value of the argument as a string.
// Compiler will attempt to parse the string as the type expected.
// eg. a value of "1" for a function expecting an int would parse to 1,
// but the same value for a function expecting a string would parse to "1".
// In the future, we could also support parsing of expressions here, but
// this would require doing something along the lines of "'string literal'" for string.
string value = 2;
}
// arg_values are the arguments to the function. If arg_values do not match
// the signature of the function, then the ExecuteScriptResponse will return
// an error stating this issue. Arg_values will not match if
// 1. arg_values misses any parameters to `func_name`
// 2. arg_values adds parameters to `func_name`.
// 3. the value in arg_value doesn't parse to the expected type.
repeated ArgValue arg_values = 2;
// output_table_prefix is the prefix of the name of the table that is returned in the response.
// If the function returns a dataframe, then the table name will be `format("%s", output_table_prefix)`.
// If the function returns a list of dataframes (even if the list is of length 1), then the table names will be
// `format("%s[%d]", output_table_prefix, index)`.
string output_table_prefix = 3;
}
// exec_funcs is a list of functions to execute.
// If any functions specified cannot be found ExecuteScriptResponse will contain a compiler error
repeated FuncToExecute exec_funcs = 4;
// If set to true, the execute script will run the mutations (probe installs, etc.).
// If unset, any mutation will be ignored.
// If the mutated state is already ready, the script will also be executed.
bool mutation = 5;
}
// Tracks information about query execution time.
message QueryTimingInfo {
// The total execution time for the query in nanoseconds.
int64 execution_time_ns = 1;
// The time in ns spent compiling the query.
int64 compilation_time_ns = 2;
}
// QueryExecutionStats contains information about the time/data processed by the query.
// These will be periodically streamed from the server as the query executes.
message QueryExecutionStats {
QueryTimingInfo timing = 1;
// The number of input bytes.
int64 bytes_processed = 2;
// The number of input records.
int64 records_processed = 3;
}
message QueryMetadata {
Relation relation = 1;
string name = 2;
string id = 3 [ (gogoproto.customname) = "ID" ];
}
// The query results generated by carnot.
message QueryData {
RowBatchData batch = 1;
QueryExecutionStats execution_stats = 2;
}
message ExecuteScriptResponse {
// The Status for executing the query. Empty status implies that execution was successful/is currently
// running/the mutation is still not ready. An non-empty status may indicate a compiler error,
// execution error, timeout, etc.
Status status = 1;
// The id for the query. UUID encoded as string.
string query_id = 2 [ (gogoproto.customname) = "QueryID" ];
oneof result {
QueryData data = 3;
QueryMetadata meta_data = 4;
}
// The status of the mutation, only populated if the request was a mutation.
MutationInfo mutation_info = 5;
}
// Status information for a muation.
message MutationInfo {
message MutationState {
// ID of resource created/updated by the mutation.
string id = 1 [ (gogoproto.customname) = "ID" ];
// State of resource created/updated by the mutation.
LifeCycleState state = 2;
// The name of the resource created/updated by the mutation.
string name = 3;
}
// The overall status of the mutation. An UNAVAILABLE status means that the querybroker is still
// waiting for some mutations to complete before the query can actually be executed.
Status status = 1;
// The states of the resources created/updated by the mutation.
repeated MutationState states = 2;
}
message HealthCheckRequest {
// The UUID of the cluster encoded as a string with dashes.
string cluster_id = 1 [ (gogoproto.customname) = "ClusterID" ];;
}
message HealthCheckResponse {
Status status = 1;
}
service VizierService {
// This is an incoming request to Vizier to execute queries.
rpc ExecuteScript(ExecuteScriptRequest) returns (stream ExecuteScriptResponse) {}
rpc HealthCheck(HealthCheckRequest) returns (stream HealthCheckResponse) {}
}
......@@ -27,7 +27,7 @@ go_test(
"//src/utils:go_default_library",
"//src/vizier/funcs/go:go_default_library",
"//src/vizier/services/query_broker/controllers:go_default_library",
"//src/vizier/vizierpb:vizier_pl_go_proto",
"//src/api/public/vizierapipb:public_vizier_pl_go_proto",
"@com_github_gogo_protobuf//jsonpb:go_default_library",
"@com_github_gogo_protobuf//proto:go_default_library",
"@com_github_satori_go_uuid//:go_default_library",
......
......@@ -14,6 +14,7 @@ import (
"github.com/gogo/protobuf/proto"
uuid "github.com/satori/go.uuid"
public_vizierapipb "pixielabs.ai/pixielabs/src/api/public/vizierapipb"
logicalplanner "pixielabs.ai/pixielabs/src/carnot/planner"
"pixielabs.ai/pixielabs/src/carnot/planner/distributedpb"
"pixielabs.ai/pixielabs/src/carnot/udfspb"
......@@ -21,7 +22,6 @@ import (
uuidpb "pixielabs.ai/pixielabs/src/common/uuid/proto"
"pixielabs.ai/pixielabs/src/utils"
funcs "pixielabs.ai/pixielabs/src/vizier/funcs/go"
vizierpb "pixielabs.ai/pixielabs/src/vizier/vizierpb"
)
// Base to use. Must set asid and agent_id.
......@@ -1327,7 +1327,7 @@ func getExecRequest(pxlScript, visJSON string) (*plannerpb.QueryRequest, error)
if err != nil {
return nil, err
}
vpb := &vizierpb.ExecuteScriptRequest{
vpb := &public_vizierapipb.ExecuteScriptRequest{
QueryStr: pxlScript,
ExecFuncs: funcs,
}
......
......@@ -8,6 +8,8 @@ go_library(
importpath = "pixielabs.ai/pixielabs/src/cloud/api",
visibility = ["//visibility:private"],
deps = [
"//src/api/public/cloudapipb:public_cloudapi_pl_go_proto",
"//src/api/public/vizierapipb:public_vizier_pl_go_proto",
"//src/cloud/api/apienv:go_default_library",
"//src/cloud/api/controller:go_default_library",
"//src/cloud/api/ptproxy:go_default_library",
......
......@@ -13,6 +13,8 @@ import (
"github.com/gorilla/handlers"
log "github.com/sirupsen/logrus"
"github.com/spf13/pflag"
public_cloudapipb "pixielabs.ai/pixielabs/src/api/public/cloudapipb"
public_vizierapipb "pixielabs.ai/pixielabs/src/api/public/vizierapipb"
"pixielabs.ai/pixielabs/src/cloud/api/ptproxy"
"pixielabs.ai/pixielabs/src/cloud/autocomplete"
"pixielabs.ai/pixielabs/src/cloud/cloudapipb"
......@@ -145,6 +147,7 @@ func main() {
cis := &controller.VizierClusterInfo{VzMgr: vc, ArtifactTrackerClient: at}
cloudapipb.RegisterVizierClusterInfoServer(s.GRPCServer(), cis)
public_cloudapipb.RegisterClusterManagerServer(s.GRPCServer(), cis)
vdks := &controller.VizierDeploymentKeyServer{VzDeploymentKey: vk}
cloudapipb.RegisterVizierDeploymentKeyManagerServer(s.GRPCServer(), vdks)
......@@ -153,7 +156,7 @@ func main() {
cloudapipb.RegisterAPIKeyManagerServer(s.GRPCServer(), aks)
vpt := ptproxy.NewVizierPassThroughProxy(nc, vc)
pl_api_vizierpb.RegisterVizierServiceServer(s.GRPCServer(), vpt)
public_vizierapipb.RegisterVizierServiceServer(s.GRPCServer(), vpt)
pl_api_vizierpb.RegisterVizierDebugServiceServer(s.GRPCServer(), vpt)
sm, err := apienv.NewScriptMgrServiceClient()
......
......@@ -21,6 +21,7 @@ go_library(
importpath = "pixielabs.ai/pixielabs/src/cloud/api/controller",
visibility = ["//visibility:public"],
deps = [
"//src/api/public/cloudapipb:public_cloudapi_pl_go_proto",
"//src/cloud/api/apienv:go_default_library",
"//src/cloud/api/controller/schema:go_default_library",
"//src/cloud/api/controller/unauthenticated_schema:go_default_library",
......
......@@ -14,6 +14,7 @@ import (
"google.golang.org/grpc/metadata"
"google.golang.org/grpc/status"
public_cloudapipb "pixielabs.ai/pixielabs/src/api/public/cloudapipb"
artifacttrackerpb "pixielabs.ai/pixielabs/src/cloud/artifact_tracker/artifacttrackerpb"
authpb "pixielabs.ai/pixielabs/src/cloud/auth/proto"
"pixielabs.ai/pixielabs/src/cloud/autocomplete"
......@@ -340,6 +341,73 @@ func (v *VizierClusterInfo) UpdateClusterVizierConfig(ctx context.Context, req *
return &cloudapipb.UpdateClusterVizierConfigResponse{}, nil
}
// UpdateClusterConfig supports updates of config for a cluster
func (v *VizierClusterInfo) UpdateClusterConfig(ctx context.Context, req *public_cloudapipb.UpdateClusterConfigRequest) (*public_cloudapipb.UpdateClusterConfigResponse, error) {
_, err := v.UpdateClusterVizierConfig(ctx, &cloudapipb.UpdateClusterVizierConfigRequest{
ID: req.ID,
ConfigUpdate: &cloudapipb.VizierConfigUpdate{
PassthroughEnabled: req.ConfigUpdate.PassthroughEnabled,
},
})
if err != nil {
return nil, err
}
return &public_cloudapipb.UpdateClusterConfigResponse{}, nil
}
func vizierStatusToPublicVizierStatus(s cloudapipb.ClusterStatus) public_cloudapipb.ClusterStatus {
switch s {
case cloudapipb.CS_HEALTHY:
return public_cloudapipb.CS_HEALTHY
case cloudapipb.CS_UNHEALTHY:
return public_cloudapipb.CS_UNHEALTHY
case cloudapipb.CS_DISCONNECTED:
return public_cloudapipb.CS_DISCONNECTED
case cloudapipb.CS_UPDATING:
return public_cloudapipb.CS_UPDATING
case cloudapipb.CS_CONNECTED:
return public_cloudapipb.CS_CONNECTED
case cloudapipb.CS_UPDATE_FAILED:
return public_cloudapipb.CS_UPDATE_FAILED
default:
return public_cloudapipb.CS_UNKNOWN
}
}
// GetCluster gets status info about the specified vizier.
func (v *VizierClusterInfo) GetCluster(ctx context.Context, req *public_cloudapipb.GetClusterRequest) (*public_cloudapipb.GetClusterResponse, error) {
resp, err := v.GetClusterInfo(ctx, &cloudapipb.GetClusterInfoRequest{
ID: req.ID,
})
if err != nil {
return nil, err
}
clusters := make([]*public_cloudapipb.ClusterInfo, len(resp.Clusters))
for i, c := range resp.Clusters {
clusters[i] = &public_cloudapipb.ClusterInfo{
ID: c.ID,
Status: vizierStatusToPublicVizierStatus(c.Status),
LastHeartbeatNs: c.LastHeartbeatNs,
Config: &public_cloudapipb.ClusterConfig{
PassthroughEnabled: c.Config.PassthroughEnabled,
},
ClusterName: c.ClusterName,
ClusterVersion: c.ClusterVersion,
VizierVersion: c.VizierVersion,
NumNodes: c.NumNodes,
NumInstrumentedNodes: c.NumInstrumentedNodes,
}
}
return &public_cloudapipb.GetClusterResponse{
Clusters: clusters,
}, nil
}
// UpdateOrInstallCluster updates or installs the given vizier cluster to the specified version.
func (v *VizierClusterInfo) UpdateOrInstallCluster(ctx context.Context, req *cloudapipb.UpdateOrInstallClusterRequest) (*cloudapipb.UpdateOrInstallClusterResponse, error) {
if req.Version == "" {
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment