From b949c2ddf2567775d333574b2788b8e3a6e71b14 Mon Sep 17 00:00:00 2001 From: Valentyna Bukhalova Date: Fri, 27 Sep 2024 16:25:45 +0200 Subject: [PATCH 01/29] add timeouts and return --- cmd/proxy/main.go | 3 ++- internal/proxy/client.go | 21 +++++++++++---------- 2 files changed, 13 insertions(+), 11 deletions(-) diff --git a/cmd/proxy/main.go b/cmd/proxy/main.go index a997b58..ae2de10 100644 --- a/cmd/proxy/main.go +++ b/cmd/proxy/main.go @@ -53,8 +53,9 @@ func main() { MaxDelay: 5 * time.Second, Multiplier: 1.2, }, + MinConnectTimeout: 10 * time.Second, } - dialOpts = append(dialOpts, grpc.WithConnectParams(connectParams)) + dialOpts = append(dialOpts, grpc.WithConnectParams(connectParams), grpc.WithIdleTimeout(cfg.KeepAliveTimeout)) logger.Infof( "Creating grpc channel against (%s) with connection config (%+v) and TLS enabled=%v", diff --git a/internal/proxy/client.go b/internal/proxy/client.go index 41f6669..988a60f 100644 --- a/internal/proxy/client.go +++ b/internal/proxy/client.go @@ -75,14 +75,7 @@ func (c *Client) Run(ctx context.Context) error { return authCtx.Err() case <-t.C: c.log.Info("Starting proxy client") - stream, closeStream, err := c.getStream(authCtx) - if err != nil { - c.log.Errorf("Could not get stream, restarting proxy client in %vs: %v", time.Duration(c.keepAlive.Load()).Seconds(), err) - t.Reset(time.Duration(c.keepAlive.Load())) - continue - } - - err = c.run(authCtx, stream, closeStream) + err := c.run(authCtx) if err != nil { c.log.Errorf("Restarting proxy client in %vs: due to error: %v", time.Duration(c.keepAlive.Load()).Seconds(), err) t.Reset(time.Duration(c.keepAlive.Load())) @@ -133,10 +126,17 @@ func (c *Client) sendInitialRequest(stream cloudproxyv1alpha.CloudProxyAPI_Strea return nil } -func (c *Client) run(ctx context.Context, stream cloudproxyv1alpha.CloudProxyAPI_StreamCloudProxyClient, closeStream func()) error { +func (c *Client) run(ctx context.Context) error { + ctx, cancel := context.WithCancel(ctx) + defer cancel() + + stream, closeStream, err := c.getStream(ctx) + if err != nil { + return fmt.Errorf("c.getStream: %w", err) + } defer closeStream() - err := c.sendInitialRequest(stream) + err = c.sendInitialRequest(stream) if err != nil { return fmt.Errorf("c.Connect: %w", err) } @@ -189,6 +189,7 @@ func (c *Client) run(ctx context.Context, stream cloudproxyv1alpha.CloudProxyAPI case req := <-messageRespCh: if err := stream.Send(req); err != nil { c.log.WithError(err).Warn("failed to send message response") + return fmt.Errorf("stream.Send: %w", err) } case <-time.After(time.Duration(c.keepAlive.Load())): if !c.isAlive() { From b36b0b58d677dbe61bdb01365809f80cb8b13469 Mon Sep 17 00:00:00 2001 From: Damian Czaja Date: Fri, 27 Sep 2024 17:03:15 +0200 Subject: [PATCH 02/29] add logs --- internal/proxy/client.go | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/internal/proxy/client.go b/internal/proxy/client.go index 988a60f..7839842 100644 --- a/internal/proxy/client.go +++ b/internal/proxy/client.go @@ -207,16 +207,17 @@ func (c *Client) handleMessage(in *cloudproxyv1alpha.StreamCloudProxyResponse, r c.log.Error("nil message") return } + + c.lastSeen.Store(time.Now().UnixNano()) c.processConfigurationRequest(in) // skip processing http request if keep alive message. if in.GetMessageId() == KeepAliveMessageID { - c.lastSeen.Store(time.Now().UnixNano()) c.log.Debugf("Received keep-alive message from castai for %s", in.GetClientMetadata().GetClusterId()) return } - c.log.Debugf("Received request for proxying msg_id=%v from castai", in.GetMessageId()) + c.log.Debugf("Received request for proxying msg_id=%v path=%v from castai", in.GetMessageId(), in.GetHttpRequest().GetPath()) resp := c.processHTTPRequest(in.GetHttpRequest()) if resp.GetError() != "" { c.log.Errorf("Failed to proxy request msg_id=%v with %v", in.GetMessageId(), resp.GetError()) @@ -238,14 +239,17 @@ func (c *Client) handleMessage(in *cloudproxyv1alpha.StreamCloudProxyResponse, r } func (c *Client) processConfigurationRequest(in *cloudproxyv1alpha.StreamCloudProxyResponse) { - if in.ConfigurationRequest != nil { - if in.ConfigurationRequest.GetKeepAlive() != 0 { - c.keepAlive.Store(in.ConfigurationRequest.GetKeepAlive()) - } - if in.ConfigurationRequest.GetKeepAliveTimeout() != 0 { - c.keepAliveTimeout.Store(in.ConfigurationRequest.GetKeepAliveTimeout()) - } + if in.ConfigurationRequest == nil { + return } + + if in.ConfigurationRequest.GetKeepAlive() != 0 { + c.keepAlive.Store(in.ConfigurationRequest.GetKeepAlive()) + } + if in.ConfigurationRequest.GetKeepAliveTimeout() != 0 { + c.keepAliveTimeout.Store(in.ConfigurationRequest.GetKeepAliveTimeout()) + } + c.log.Debugf("Updated keep-alive configuration to %v and keep-alive timeout to %v", c.keepAlive.Load(), c.keepAliveTimeout.Load()) } From 0cff2f47b2c9cf5669ba14db8d10d54a4379aef8 Mon Sep 17 00:00:00 2001 From: Damian Czaja Date: Fri, 27 Sep 2024 17:06:34 +0200 Subject: [PATCH 03/29] single send ch --- internal/proxy/client.go | 30 +++++++++++++++--------------- internal/proxy/client_test.go | 2 +- 2 files changed, 16 insertions(+), 16 deletions(-) diff --git a/internal/proxy/client.go b/internal/proxy/client.go index 7839842..d25220d 100644 --- a/internal/proxy/client.go +++ b/internal/proxy/client.go @@ -141,12 +141,9 @@ func (c *Client) run(ctx context.Context) error { return fmt.Errorf("c.Connect: %w", err) } - keepAliveCh := make(chan *cloudproxyv1alpha.StreamCloudProxyRequest) - defer close(keepAliveCh) - go c.sendKeepAlive(stream, keepAliveCh) - - messageRespCh := make(chan *cloudproxyv1alpha.StreamCloudProxyRequest) - defer close(messageRespCh) + sendCh := make(chan *cloudproxyv1alpha.StreamCloudProxyRequest, 10) + defer close(sendCh) + go c.sendKeepAlive(stream, sendCh) go func() { for { @@ -172,7 +169,7 @@ func (c *Client) run(ctx context.Context) error { } c.log.Debugf("Handling message from castai") - go c.handleMessage(in, messageRespCh) + go c.handleMessage(stream.Context(), in, sendCh) } }() @@ -182,15 +179,11 @@ func (c *Client) run(ctx context.Context) error { return ctx.Err() case <-stream.Context().Done(): return fmt.Errorf("stream closed %w", stream.Context().Err()) - case req := <-keepAliveCh: + case req := <-sendCh: + c.log.Printf("Sending message to stream") if err := stream.Send(req); err != nil { c.log.WithError(err).Warn("failed to send keep alive") } - case req := <-messageRespCh: - if err := stream.Send(req); err != nil { - c.log.WithError(err).Warn("failed to send message response") - return fmt.Errorf("stream.Send: %w", err) - } case <-time.After(time.Duration(c.keepAlive.Load())): if !c.isAlive() { if err := c.lastSeenError.Load(); err != nil { @@ -202,7 +195,7 @@ func (c *Client) run(ctx context.Context) error { } } -func (c *Client) handleMessage(in *cloudproxyv1alpha.StreamCloudProxyResponse, respCh chan<- *cloudproxyv1alpha.StreamCloudProxyRequest) { +func (c *Client) handleMessage(ctx context.Context, in *cloudproxyv1alpha.StreamCloudProxyResponse, respCh chan<- *cloudproxyv1alpha.StreamCloudProxyRequest) { if in == nil { c.log.Error("nil message") return @@ -224,7 +217,12 @@ func (c *Client) handleMessage(in *cloudproxyv1alpha.StreamCloudProxyResponse, r } else { c.log.Debugf("Proxied request msg_id=%v, sending response to castai", in.GetMessageId()) } - respCh <- &cloudproxyv1alpha.StreamCloudProxyRequest{ + + select { + case <-ctx.Done(): + return + + case respCh <- &cloudproxyv1alpha.StreamCloudProxyRequest{ Request: &cloudproxyv1alpha.StreamCloudProxyRequest_Response{ Response: &cloudproxyv1alpha.ClusterResponse{ ClientMetadata: &cloudproxyv1alpha.ClientMetadata{ @@ -235,6 +233,8 @@ func (c *Client) handleMessage(in *cloudproxyv1alpha.StreamCloudProxyResponse, r HttpResponse: resp, }, }, + }: + return } } diff --git a/internal/proxy/client_test.go b/internal/proxy/client_test.go index 5635c6d..390ed2e 100644 --- a/internal/proxy/client_test.go +++ b/internal/proxy/client_test.go @@ -266,7 +266,7 @@ func TestClient_handleMessage(t *testing.T) { <-msgStream }() - c.handleMessage(tt.args.in, msgStream) + c.handleMessage(context.Background(), tt.args.in, msgStream) require.Equal(t, tt.wantLastSeenUpdated, c.lastSeen.Load() > 0, "lastSeen: %v", c.lastSeen.Load()) require.Equal(t, tt.wantKeepAlive, c.keepAlive.Load(), "keepAlive: %v", c.keepAlive.Load()) require.Equal(t, tt.wantKeepAliveTimeout, c.keepAliveTimeout.Load(), "keepAliveTimeout: %v", c.keepAliveTimeout.Load()) From bf24e486545b3a0013030cd1601ef92c8efda4ea Mon Sep 17 00:00:00 2001 From: Damian Czaja Date: Fri, 27 Sep 2024 17:08:37 +0200 Subject: [PATCH 04/29] return on send err --- internal/proxy/client.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/internal/proxy/client.go b/internal/proxy/client.go index d25220d..d51a48e 100644 --- a/internal/proxy/client.go +++ b/internal/proxy/client.go @@ -182,7 +182,8 @@ func (c *Client) run(ctx context.Context) error { case req := <-sendCh: c.log.Printf("Sending message to stream") if err := stream.Send(req); err != nil { - c.log.WithError(err).Warn("failed to send keep alive") + c.log.WithError(err).Warn("failed to send message to stream") + return fmt.Errorf("failed to send message to stream: %w", err) } case <-time.After(time.Duration(c.keepAlive.Load())): if !c.isAlive() { From f1cc03f3897c3c51568b7d092b76645e0f7d7d7e Mon Sep 17 00:00:00 2001 From: Valentyna Bukhalova Date: Fri, 27 Sep 2024 22:15:03 +0200 Subject: [PATCH 05/29] WIP --- cmd/proxy/main.go | 51 +------ internal/proxy/client.go | 276 +++++++++++++++++++++++----------- internal/proxy/client_test.go | 75 ++++++--- 3 files changed, 247 insertions(+), 155 deletions(-) diff --git a/cmd/proxy/main.go b/cmd/proxy/main.go index ae2de10..dd17995 100644 --- a/cmd/proxy/main.go +++ b/cmd/proxy/main.go @@ -7,17 +7,12 @@ import ( "runtime" "time" - "github.com/sirupsen/logrus" - "google.golang.org/grpc" - "google.golang.org/grpc/backoff" - "google.golang.org/grpc/credentials" - "google.golang.org/grpc/credentials/insecure" - "cloud-proxy/internal/cloud/gcp" "cloud-proxy/internal/cloud/gcp/gcpauth" "cloud-proxy/internal/config" "cloud-proxy/internal/healthz" "cloud-proxy/internal/proxy" + "github.com/sirupsen/logrus" ) var ( @@ -38,48 +33,8 @@ func main() { logger.WithError(err).Panicf("Failed to create GCP credentials source") } - dialOpts := make([]grpc.DialOption, 0) - if cfg.CastAI.DisableGRPCTLS { - // ONLY For testing purposes. - dialOpts = append(dialOpts, grpc.WithTransportCredentials(insecure.NewCredentials())) - } else { - dialOpts = append(dialOpts, grpc.WithTransportCredentials(credentials.NewTLS(nil))) - } - - connectParams := grpc.ConnectParams{ - Backoff: backoff.Config{ - BaseDelay: 2 * time.Second, - Jitter: 0.1, - MaxDelay: 5 * time.Second, - Multiplier: 1.2, - }, - MinConnectTimeout: 10 * time.Second, - } - dialOpts = append(dialOpts, grpc.WithConnectParams(connectParams), grpc.WithIdleTimeout(cfg.KeepAliveTimeout)) - - logger.Infof( - "Creating grpc channel against (%s) with connection config (%+v) and TLS enabled=%v", - cfg.CastAI.GrpcURL, - connectParams, - !cfg.CastAI.DisableGRPCTLS, - ) - conn, err := grpc.NewClient(cfg.CastAI.GrpcURL, dialOpts...) - if err != nil { - logger.Panicf("Failed to connect to server: %v", err) - panic(err) - } - - defer func(conn *grpc.ClientConn) { - logger.Info("Closing grpc connection") - err := conn.Close() - if err != nil { - logger.Panicf("Failed to close gRPC connection: %v", err) - panic(err) - } - }(conn) - - client := proxy.New(conn, gcp.New(tokenSource), logger, - cfg.GetPodName(), cfg.ClusterID, GetVersion(), cfg.CastAI.APIKey, cfg.KeepAlive, cfg.KeepAliveTimeout) + client := proxy.New(gcp.New(tokenSource), logger, + GetVersion(), &cfg) go startHealthServer(logger, cfg.HealthAddress) diff --git a/internal/proxy/client.go b/internal/proxy/client.go index d51a48e..8e2545d 100644 --- a/internal/proxy/client.go +++ b/internal/proxy/client.go @@ -17,7 +17,12 @@ import ( "google.golang.org/grpc" "google.golang.org/grpc/metadata" + "cloud-proxy/internal/config" cloudproxyv1alpha "cloud-proxy/proto/gen/proto/v1alpha" + "golang.org/x/sync/errgroup" + "google.golang.org/grpc/backoff" + "google.golang.org/grpc/credentials" + "google.golang.org/grpc/credentials/insecure" ) const ( @@ -29,8 +34,8 @@ type CloudClient interface { } type Client struct { - grpcConn *grpc.ClientConn - apiKey string + cfg *config.Config + cloudClient CloudClient log *logrus.Logger podName string @@ -39,32 +44,33 @@ type Client struct { errCount atomic.Int64 processedCount atomic.Int64 - lastSeen atomic.Int64 - lastSeenError atomic.Pointer[error] + lastSeenReceive atomic.Int64 + lastSeenSend atomic.Int64 + keepAlive atomic.Int64 keepAliveTimeout atomic.Int64 - version string + + version string } -func New(grpcConn *grpc.ClientConn, cloudClient CloudClient, logger *logrus.Logger, podName, clusterID, version, apiKey string, keepalive, keepaliveTimeout time.Duration) *Client { +func New(cloudClient CloudClient, logger *logrus.Logger, version string, cfg *config.Config) *Client { c := &Client{ - grpcConn: grpcConn, - apiKey: apiKey, + cfg: cfg, cloudClient: cloudClient, log: logger, - podName: podName, - clusterID: clusterID, + podName: cfg.PodMetadata.PodName, + clusterID: cfg.ClusterID, version: version, } - c.keepAlive.Store(int64(keepalive)) - c.keepAliveTimeout.Store(int64(keepaliveTimeout)) + c.keepAlive.Store(int64(cfg.KeepAlive)) + c.keepAliveTimeout.Store(int64(cfg.KeepAliveTimeout)) return c } func (c *Client) Run(ctx context.Context) error { authCtx := metadata.NewOutgoingContext(ctx, metadata.Pairs( - "authorization", fmt.Sprintf("Token %s", c.apiKey), + "authorization", fmt.Sprintf("Token %s", c.cfg.CastAI.APIKey), )) t := time.NewTimer(time.Millisecond) @@ -75,7 +81,7 @@ func (c *Client) Run(ctx context.Context) error { return authCtx.Err() case <-t.C: c.log.Info("Starting proxy client") - err := c.run(authCtx) + err := c.prepareAndRun(authCtx) if err != nil { c.log.Errorf("Restarting proxy client in %vs: due to error: %v", time.Duration(c.keepAlive.Load()).Seconds(), err) t.Reset(time.Duration(c.keepAlive.Load())) @@ -86,19 +92,53 @@ func (c *Client) Run(ctx context.Context) error { func (c *Client) getStream(ctx context.Context) (cloudproxyv1alpha.CloudProxyAPI_StreamCloudProxyClient, func(), error) { c.log.Info("Connecting to castai") - apiClient := cloudproxyv1alpha.NewCloudProxyAPIClient(c.grpcConn) - stream, err := apiClient.StreamCloudProxy(ctx) + dialOpts := make([]grpc.DialOption, 0) + if c.cfg.CastAI.DisableGRPCTLS { + // ONLY For testing purposes. + dialOpts = append(dialOpts, grpc.WithTransportCredentials(insecure.NewCredentials())) + } else { + dialOpts = append(dialOpts, grpc.WithTransportCredentials(credentials.NewTLS(nil))) + } + + connectParams := grpc.ConnectParams{ + Backoff: backoff.Config{ + BaseDelay: 2 * time.Second, + Jitter: 0.1, + MaxDelay: 5 * time.Second, + Multiplier: 1.2, + }, + MinConnectTimeout: 2 * time.Minute, + } + dialOpts = append(dialOpts, grpc.WithConnectParams(connectParams)) + + c.log.Infof( + "Creating grpc channel against (%s) with connection config (%+v) and TLS enabled=%v", + c.cfg.CastAI.GrpcURL, + connectParams, + !c.cfg.CastAI.DisableGRPCTLS, + ) + + conn, err := grpc.NewClient(c.cfg.CastAI.GrpcURL, dialOpts...) if err != nil { - return nil, nil, fmt.Errorf("proxyCastAIClient.StreamCloudProxy: %w", err) + return nil, nil, fmt.Errorf("grpc.NewClient: %w", err) } - c.log.Info("Connected to castai, sending initial metadata") - return stream, func() { - err := stream.CloseSend() + cancelFunc := func() { + c.log.Info("Closing grpc connection") + err := conn.Close() if err != nil { - c.log.Errorf("error closing stream %v", err) + c.log.Errorf("error closing grpc connection %v", err) } - }, nil + } + + apiClient := cloudproxyv1alpha.NewCloudProxyAPIClient(conn) + stream, err := apiClient.StreamCloudProxy(ctx) + if err != nil { + return nil, cancelFunc, fmt.Errorf("proxyCastAIClient.StreamCloudProxy: %w", err) + } + + c.log.Info("Connected to castai, sending initial metadata") + return stream, cancelFunc, nil } func (c *Client) sendInitialRequest(stream cloudproxyv1alpha.CloudProxyAPI_StreamCloudProxyClient) error { @@ -118,59 +158,76 @@ func (c *Client) sendInitialRequest(stream cloudproxyv1alpha.CloudProxyAPI_Strea if err != nil { return fmt.Errorf("stream.Send: initial request %w", err) } - c.lastSeen.Store(time.Now().UnixNano()) - c.lastSeenError.Store(nil) + c.lastSeenReceive.Store(time.Now().UnixNano()) c.log.Info("Stream to castai started successfully") return nil } -func (c *Client) run(ctx context.Context) error { +func (c *Client) prepareAndRun(ctx context.Context) error { ctx, cancel := context.WithCancel(ctx) defer cancel() - stream, closeStream, err := c.getStream(ctx) + stream, closeConnection, err := c.getStream(ctx) if err != nil { return fmt.Errorf("c.getStream: %w", err) } - defer closeStream() + defer closeConnection() + + c.lastSeenReceive.Store(time.Now().UnixNano()) + c.lastSeenSend.Store(time.Now().UnixNano()) - err = c.sendInitialRequest(stream) + return c.sendAndReceive(ctx, stream) +} + +func (c *Client) sendAndReceive(ctx context.Context, stream cloudproxyv1alpha.CloudProxyAPI_StreamCloudProxyClient) error { + err := c.sendInitialRequest(stream) if err != nil { return fmt.Errorf("c.Connect: %w", err) } + eg, egctx := errgroup.WithContext(ctx) + sendCh := make(chan *cloudproxyv1alpha.StreamCloudProxyRequest, 10) defer close(sendCh) - go c.sendKeepAlive(stream, sendCh) - - go func() { - for { - select { - case <-ctx.Done(): - return - case <-stream.Context().Done(): - return - default: - if !c.isAlive() { - return - } - } - c.log.Debugf("Polling stream for messages") + eg.Go(func() error { + err := c.sendKeepAlive(egctx, stream, sendCh) + if err != nil { + c.log.Errorf("stopping keep-alive loop: %v", err) + } + return err + }) - in, err := stream.Recv() - if err != nil { - c.log.Errorf("stream.Recv: got error: %v", err) - c.lastSeen.Store(0) - c.lastSeenError.Store(&err) - return - } + eg.Go(func() error { + err := c.receive(egctx, stream, sendCh) + if err != nil { + c.log.Errorf("stopping receive loop: %v", err) + } + return err + }) - c.log.Debugf("Handling message from castai") - go c.handleMessage(stream.Context(), in, sendCh) + eg.Go(func() error { + err := c.send(egctx, stream, sendCh) + if err != nil { + c.log.Errorf("stopping send loop: %v", err) } + return err + }) + + err = eg.Wait() + if err != nil { + c.log.Errorf("sendAndReceive: closing with error: %v", err) + } + + return err +} + +func (c *Client) send(ctx context.Context, stream cloudproxyv1alpha.CloudProxyAPI_StreamCloudProxyClient, sendCh chan *cloudproxyv1alpha.StreamCloudProxyRequest) error { + defer func() { + c.log.Info("Closing send channel") + _ = stream.CloseSend() }() for { @@ -180,19 +237,45 @@ func (c *Client) run(ctx context.Context) error { case <-stream.Context().Done(): return fmt.Errorf("stream closed %w", stream.Context().Err()) case req := <-sendCh: - c.log.Printf("Sending message to stream") + c.log.Printf("Sending message to stream %v", req.GetResponse().GetMessageId()) if err := stream.Send(req); err != nil { c.log.WithError(err).Warn("failed to send message to stream") return fmt.Errorf("failed to send message to stream: %w", err) } + c.lastSeenSend.Store(time.Now().UnixNano()) + case <-time.After(time.Duration(c.keepAlive.Load())): - if !c.isAlive() { - if err := c.lastSeenError.Load(); err != nil { - return fmt.Errorf("received error: %w", *err) - } - return fmt.Errorf("last seen too old, closing stream") + if err := c.isAlive(); err != nil { + return err + } + } + } +} + +func (c *Client) receive(ctx context.Context, stream cloudproxyv1alpha.CloudProxyAPI_StreamCloudProxyClient, respCh chan<- *cloudproxyv1alpha.StreamCloudProxyRequest) error { + for { + select { + case <-ctx.Done(): + return fmt.Errorf("context ended with %w", ctx.Err()) + case <-stream.Context().Done(): + return fmt.Errorf("stream ended with %w", stream.Context().Err()) + default: + if err := c.isAlive(); err != nil { + return err } } + + c.log.Debugf("Polling stream for messages") + + in, err := stream.Recv() + if err != nil { + c.log.Errorf("stream.Recv: got error: %v", err) + c.lastSeenReceive.Store(0) + return fmt.Errorf("stream.Recv: %w", err) + } + + c.log.Debugf("Handling message from castai") + go c.handleMessage(stream.Context(), in, respCh) } } @@ -202,12 +285,12 @@ func (c *Client) handleMessage(ctx context.Context, in *cloudproxyv1alpha.Stream return } - c.lastSeen.Store(time.Now().UnixNano()) + c.lastSeenReceive.Store(time.Now().UnixNano()) c.processConfigurationRequest(in) // skip processing http request if keep alive message. if in.GetMessageId() == KeepAliveMessageID { - c.log.Debugf("Received keep-alive message from castai for %s", in.GetClientMetadata().GetClusterId()) + c.log.Debugf("Received keep-alive message from castai for %s", in.GetClientMetadata().GetPodName()) return } @@ -251,7 +334,7 @@ func (c *Client) processConfigurationRequest(in *cloudproxyv1alpha.StreamCloudPr c.keepAliveTimeout.Store(in.ConfigurationRequest.GetKeepAliveTimeout()) } - c.log.Debugf("Updated keep-alive configuration to %v and keep-alive timeout to %v", c.keepAlive.Load(), c.keepAliveTimeout.Load()) + c.log.Debugf("Updated keep-alive configuration to %v and keep-alive timeout to %v", time.Duration(c.keepAlive.Load()).Seconds(), time.Duration(c.keepAliveTimeout.Load()).Seconds()) } func (c *Client) processHTTPRequest(req *cloudproxyv1alpha.HTTPRequest) *cloudproxyv1alpha.HTTPResponse { @@ -278,45 +361,64 @@ func (c *Client) processHTTPRequest(req *cloudproxyv1alpha.HTTPRequest) *cloudpr return c.toResponse(resp) } -func (c *Client) isAlive() bool { - lastSeen := c.lastSeen.Load() +var errAlive = fmt.Errorf("client connection is not alive") - return time.Now().UnixNano()-lastSeen <= c.keepAliveTimeout.Load() +func (c *Client) isAlive() error { + lastSeenReceive := c.lastSeenReceive.Load() + lastSeenSend := c.lastSeenSend.Load() + keepAliveTimeout := c.keepAliveTimeout.Load() + lastSeenReceiveDiff := time.Now().UnixNano() - lastSeenReceive + lastSeenSendDiff := time.Now().UnixNano() - lastSeenSend + + if lastSeenReceiveDiff > keepAliveTimeout || lastSeenSendDiff > keepAliveTimeout { + c.log.Warnf("last seen receive %v, last seen send %v", + time.Duration(lastSeenReceiveDiff).Seconds(), time.Duration(lastSeenSendDiff).Seconds()) + return errAlive + } + + return nil } -func (c *Client) sendKeepAlive(stream cloudproxyv1alpha.CloudProxyAPI_StreamCloudProxyClient, sendCh chan<- *cloudproxyv1alpha.StreamCloudProxyRequest) { +func (c *Client) sendKeepAlive(ctx context.Context, stream cloudproxyv1alpha.CloudProxyAPI_StreamCloudProxyClient, sendCh chan<- *cloudproxyv1alpha.StreamCloudProxyRequest) error { ticker := time.NewTimer(time.Duration(c.keepAlive.Load())) defer ticker.Stop() c.log.Info("Starting keep-alive loop") + for { select { - case <-stream.Context().Done(): - c.log.Infof("Stopping keep-alive loop: stream ended with %v", stream.Context().Err()) - return + case <-ctx.Done(): + return fmt.Errorf("context ended with %w", ctx.Err()) case <-ticker.C: - if !c.isAlive() { - c.log.Info("Stopping keep-alive loop: client connection is not alive") - return - } - c.log.Debug("Sending keep-alive to castai") - - sendCh <- &cloudproxyv1alpha.StreamCloudProxyRequest{ - Request: &cloudproxyv1alpha.StreamCloudProxyRequest_ClientStats{ - ClientStats: &cloudproxyv1alpha.ClientStats{ - ClientMetadata: &cloudproxyv1alpha.ClientMetadata{ - PodName: c.podName, - ClusterId: c.clusterID, - }, - Stats: &cloudproxyv1alpha.ClientStats_Stats{ - Status: cloudproxyv1alpha.ClientStats_Stats_OK, - Timestamp: time.Now().UnixNano(), + if time.Now().UnixNano()-c.lastSeenSend.Load() <= c.keepAlive.Load()/2 { + ticker.Reset(time.Duration(c.keepAlive.Load())) + } else { + select { + case sendCh <- &cloudproxyv1alpha.StreamCloudProxyRequest{ + Request: &cloudproxyv1alpha.StreamCloudProxyRequest_ClientStats{ + ClientStats: &cloudproxyv1alpha.ClientStats{ + ClientMetadata: &cloudproxyv1alpha.ClientMetadata{ + PodName: c.podName, + ClusterId: c.clusterID, + }, + Stats: &cloudproxyv1alpha.ClientStats_Stats{ + Status: cloudproxyv1alpha.ClientStats_Stats_OK, + Timestamp: time.Now().UnixNano(), + }, }, }, - }, + }: + ticker.Reset(time.Duration(c.keepAlive.Load())) + + default: + if stream.Context().Err() != nil { + return fmt.Errorf("stream ended with %w", stream.Context().Err()) + } + if err := c.isAlive(); err != nil { + return err + } + } } - - ticker.Reset(time.Duration(c.keepAlive.Load())) } } } diff --git a/internal/proxy/client_test.go b/internal/proxy/client_test.go index 390ed2e..b407bed 100644 --- a/internal/proxy/client_test.go +++ b/internal/proxy/client_test.go @@ -83,7 +83,14 @@ func TestClient_toResponse(t *testing.T) { tt := tt t.Run(tt.name, func(t *testing.T) { t.Parallel() - c := New(nil, nil, nil, "podName", "clusterID", "version", "apiKey", time.Second, time.Minute) + c := New(nil, logrus.New(), "version", &config.Config{ + ClusterID: "clusterID", + PodMetadata: config.PodMetadata{ + PodName: "podName", + }, + KeepAlive: time.Second, + KeepAliveTimeout: time.Minute, + }) got := c.toResponse(tt.args.resp) // diff := cmp.Diff(got, tt.want, protocmp.Transform()) // require.Empty(t, diff). @@ -146,7 +153,14 @@ func TestClient_toHTTPRequest(t *testing.T) { tt := tt t.Run(tt.name, func(t *testing.T) { t.Parallel() - c := New(nil, nil, nil, "podName", "clusterID", "version", "apiKey", time.Second, time.Minute) + c := New(nil, logrus.New(), "version", &config.Config{ + ClusterID: "clusterID", + PodMetadata: config.PodMetadata{ + PodName: "podName", + }, + KeepAlive: time.Second, + KeepAliveTimeout: time.Minute, + }) got, err := c.toHTTPRequest(tt.args.req) require.Equal(t, tt.wantErr, err != nil, err) if err != nil { @@ -255,7 +269,14 @@ func TestClient_handleMessage(t *testing.T) { if tt.fields.tuneMockCloudClient != nil { tt.fields.tuneMockCloudClient(cloudClient) } - c := New(nil, cloudClient, logrus.New(), "podName", "clusterID", "version", "apiKey", config.KeepAliveDefault, config.KeepAliveTimeoutDefault) + c := New(cloudClient, logrus.New(), "version", &config.Config{ + ClusterID: "clusterID", + PodMetadata: config.PodMetadata{ + PodName: "podName", + }, + KeepAlive: config.KeepAliveDefault, + KeepAliveTimeout: config.KeepAliveTimeoutDefault, + }) stream := mock_proxy.NewMockCloudProxyAPI_StreamCloudProxyClient(ctrl) if tt.args.tuneMockStream != nil { tt.args.tuneMockStream(stream) @@ -267,7 +288,7 @@ func TestClient_handleMessage(t *testing.T) { }() c.handleMessage(context.Background(), tt.args.in, msgStream) - require.Equal(t, tt.wantLastSeenUpdated, c.lastSeen.Load() > 0, "lastSeen: %v", c.lastSeen.Load()) + require.Equal(t, tt.wantLastSeenUpdated, c.lastSeenReceive.Load() > 0, "lastSeen: %v", c.lastSeenReceive.Load()) require.Equal(t, tt.wantKeepAlive, c.keepAlive.Load(), "keepAlive: %v", c.keepAlive.Load()) require.Equal(t, tt.wantKeepAliveTimeout, c.keepAliveTimeout.Load(), "keepAliveTimeout: %v", c.keepAliveTimeout.Load()) require.Equal(t, tt.wantErrCount, c.errCount.Load(), "errCount: %v", c.errCount.Load()) @@ -345,7 +366,14 @@ func TestClient_processHttpRequest(t *testing.T) { if tt.fields.tuneMockCloudClient != nil { tt.fields.tuneMockCloudClient(cloudClient) } - c := New(nil, cloudClient, logrus.New(), "podName", "clusterID", "version", "apiKey", time.Second, time.Minute) + c := New(cloudClient, logrus.New(), "version", &config.Config{ + ClusterID: "clusterID", + PodMetadata: config.PodMetadata{ + PodName: "podName", + }, + KeepAlive: time.Second, + KeepAliveTimeout: time.Minute, + }) if got := c.processHTTPRequest(tt.args.req); !reflect.DeepEqual(got, tt.want) { t.Errorf("processHttpRequest() = %v, want %v", got, tt.want) } @@ -422,7 +450,7 @@ func TestClient_processHttpRequest(t *testing.T) { // } //}. -func TestClient_run(t *testing.T) { +func TestClient_sendAndReceive(t *testing.T) { t.Parallel() type args struct { @@ -430,10 +458,9 @@ func TestClient_run(t *testing.T) { tuneMockStream func(m *mock_proxy.MockCloudProxyAPI_StreamCloudProxyClient) } tests := []struct { - name string - args args - wantErr bool - wantLastSeenUpdated bool + name string + args args + wantErr bool }{ { name: "send initial error", @@ -445,7 +472,7 @@ func TestClient_run(t *testing.T) { m.EXPECT().Send(gomock.Any()).Return(fmt.Errorf("test error")) }, }, - wantErr: true, + wantErr: false, }, { name: "context done", @@ -456,12 +483,15 @@ func TestClient_run(t *testing.T) { return ctx }, tuneMockStream: func(m *mock_proxy.MockCloudProxyAPI_StreamCloudProxyClient) { - m.EXPECT().Send(gomock.Any()).Return(nil).AnyTimes() // expected 0 or 1 times. - m.EXPECT().Context().Return(context.Background()).AnyTimes() // expected 0 or 1 times. + m.EXPECT().Send(gomock.Any()).Return(nil).AnyTimes() // expected 0 or 1 times. + m.EXPECT().Context().DoAndReturn(func() context.Context { + ctx, cancel := context.WithCancel(context.Background()) + cancel() + return ctx + }).AnyTimes() // expected 0 or 1 times. }, }, - wantLastSeenUpdated: true, - wantErr: true, + wantErr: true, }, { name: "stream not alive", @@ -475,8 +505,7 @@ func TestClient_run(t *testing.T) { m.EXPECT().Recv().Return(nil, fmt.Errorf("test error")) }, }, - wantLastSeenUpdated: false, - wantErr: true, + wantErr: true, }, } for _, tt := range tests { @@ -486,15 +515,21 @@ func TestClient_run(t *testing.T) { ctrl := gomock.NewController(t) defer ctrl.Finish() - c := New(nil, nil, logrus.New(), "podName", "clusterID", "version", "apiKey", time.Second, time.Second) + c := New(nil, logrus.New(), "version", &config.Config{ + ClusterID: "clusterID", + PodMetadata: config.PodMetadata{ + PodName: "podName", + }, + KeepAlive: time.Second, + KeepAliveTimeout: time.Minute, + }) stream := mock_proxy.NewMockCloudProxyAPI_StreamCloudProxyClient(ctrl) if tt.args.tuneMockStream != nil { tt.args.tuneMockStream(stream) } - if err := c.run(tt.args.ctx(), stream, func() {}); (err != nil) != tt.wantErr { + if err := c.sendAndReceive(tt.args.ctx(), stream); (err != nil) != tt.wantErr { t.Errorf("run() error = %v, wantErr %v", err, tt.wantErr) } - require.Equal(t, tt.wantLastSeenUpdated, c.lastSeen.Load() > 0, "lastSeen: %v", c.lastSeen.Load()) }) } } From 55fb63dd05c5640a1440eb91f76540ee2f56252e Mon Sep 17 00:00:00 2001 From: Valentyna Bukhalova Date: Fri, 27 Sep 2024 22:37:29 +0200 Subject: [PATCH 06/29] fixed wait on send --- internal/proxy/client.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/internal/proxy/client.go b/internal/proxy/client.go index 8e2545d..31c3ca9 100644 --- a/internal/proxy/client.go +++ b/internal/proxy/client.go @@ -208,13 +208,13 @@ func (c *Client) sendAndReceive(ctx context.Context, stream cloudproxyv1alpha.Cl return err }) - eg.Go(func() error { + // send loop is separate because it can block on sending messages. + go func() { err := c.send(egctx, stream, sendCh) if err != nil { - c.log.Errorf("stopping send loop: %v", err) + c.log.Errorf("stopped send loop: %v", err) } - return err - }) + }() err = eg.Wait() if err != nil { From 29fee6a32a4f41412e487f6fb1858533b2395343 Mon Sep 17 00:00:00 2001 From: Valentyna Bukhalova Date: Fri, 27 Sep 2024 22:39:46 +0200 Subject: [PATCH 07/29] lint --- cmd/proxy/main.go | 3 ++- internal/proxy/client.go | 8 ++++---- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/cmd/proxy/main.go b/cmd/proxy/main.go index dd17995..57fde4f 100644 --- a/cmd/proxy/main.go +++ b/cmd/proxy/main.go @@ -7,12 +7,13 @@ import ( "runtime" "time" + "github.com/sirupsen/logrus" + "cloud-proxy/internal/cloud/gcp" "cloud-proxy/internal/cloud/gcp/gcpauth" "cloud-proxy/internal/config" "cloud-proxy/internal/healthz" "cloud-proxy/internal/proxy" - "github.com/sirupsen/logrus" ) var ( diff --git a/internal/proxy/client.go b/internal/proxy/client.go index 31c3ca9..46a31cc 100644 --- a/internal/proxy/client.go +++ b/internal/proxy/client.go @@ -14,15 +14,15 @@ import ( "github.com/samber/lo" "github.com/sirupsen/logrus" + "golang.org/x/sync/errgroup" "google.golang.org/grpc" + "google.golang.org/grpc/backoff" + "google.golang.org/grpc/credentials" + "google.golang.org/grpc/credentials/insecure" "google.golang.org/grpc/metadata" "cloud-proxy/internal/config" cloudproxyv1alpha "cloud-proxy/proto/gen/proto/v1alpha" - "golang.org/x/sync/errgroup" - "google.golang.org/grpc/backoff" - "google.golang.org/grpc/credentials" - "google.golang.org/grpc/credentials/insecure" ) const ( From 4ca41bc3292f19bc8bf1cfa84a07a83c124c69bf Mon Sep 17 00:00:00 2001 From: Valentyna Bukhalova Date: Fri, 27 Sep 2024 22:44:56 +0200 Subject: [PATCH 08/29] fix --- internal/proxy/client.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/internal/proxy/client.go b/internal/proxy/client.go index 46a31cc..5561ac1 100644 --- a/internal/proxy/client.go +++ b/internal/proxy/client.go @@ -158,7 +158,7 @@ func (c *Client) sendInitialRequest(stream cloudproxyv1alpha.CloudProxyAPI_Strea if err != nil { return fmt.Errorf("stream.Send: initial request %w", err) } - c.lastSeenReceive.Store(time.Now().UnixNano()) + c.lastSeenSend.Store(time.Now().UnixNano()) c.log.Info("Stream to castai started successfully") @@ -274,6 +274,7 @@ func (c *Client) receive(ctx context.Context, stream cloudproxyv1alpha.CloudProx return fmt.Errorf("stream.Recv: %w", err) } + c.lastSeenReceive.Store(time.Now().UnixNano()) c.log.Debugf("Handling message from castai") go c.handleMessage(stream.Context(), in, respCh) } @@ -285,7 +286,6 @@ func (c *Client) handleMessage(ctx context.Context, in *cloudproxyv1alpha.Stream return } - c.lastSeenReceive.Store(time.Now().UnixNano()) c.processConfigurationRequest(in) // skip processing http request if keep alive message. From 0ffaedcb3428ac471413404760a9a7644bb728be Mon Sep 17 00:00:00 2001 From: Valentyna Bukhalova Date: Mon, 30 Sep 2024 09:59:23 +0200 Subject: [PATCH 09/29] fix --- internal/proxy/client_test.go | 5 ----- 1 file changed, 5 deletions(-) diff --git a/internal/proxy/client_test.go b/internal/proxy/client_test.go index b407bed..c5f0319 100644 --- a/internal/proxy/client_test.go +++ b/internal/proxy/client_test.go @@ -187,14 +187,12 @@ func TestClient_handleMessage(t *testing.T) { name string fields fields args args - wantLastSeenUpdated bool wantKeepAlive int64 wantKeepAliveTimeout int64 wantErrCount int64 }{ { name: "nil response", - wantLastSeenUpdated: false, wantKeepAlive: int64(config.KeepAliveDefault), wantKeepAliveTimeout: int64(config.KeepAliveTimeoutDefault), }, @@ -205,7 +203,6 @@ func TestClient_handleMessage(t *testing.T) { MessageId: KeepAliveMessageID, }, }, - wantLastSeenUpdated: true, wantKeepAlive: int64(config.KeepAliveDefault), wantKeepAliveTimeout: int64(config.KeepAliveTimeoutDefault), }, @@ -220,7 +217,6 @@ func TestClient_handleMessage(t *testing.T) { }, }, }, - wantLastSeenUpdated: true, wantKeepAlive: 1, wantKeepAliveTimeout: 2, }, @@ -288,7 +284,6 @@ func TestClient_handleMessage(t *testing.T) { }() c.handleMessage(context.Background(), tt.args.in, msgStream) - require.Equal(t, tt.wantLastSeenUpdated, c.lastSeenReceive.Load() > 0, "lastSeen: %v", c.lastSeenReceive.Load()) require.Equal(t, tt.wantKeepAlive, c.keepAlive.Load(), "keepAlive: %v", c.keepAlive.Load()) require.Equal(t, tt.wantKeepAliveTimeout, c.keepAliveTimeout.Load(), "keepAliveTimeout: %v", c.keepAliveTimeout.Load()) require.Equal(t, tt.wantErrCount, c.errCount.Load(), "errCount: %v", c.errCount.Load()) From 3b95298786b8b589e3aa19e107a2f09342832960 Mon Sep 17 00:00:00 2001 From: Damian Czaja Date: Mon, 30 Sep 2024 14:57:11 +0200 Subject: [PATCH 10/29] fix tests --- internal/proxy/client_test.go | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/internal/proxy/client_test.go b/internal/proxy/client_test.go index c5f0319..06021b5 100644 --- a/internal/proxy/client_test.go +++ b/internal/proxy/client_test.go @@ -467,7 +467,7 @@ func TestClient_sendAndReceive(t *testing.T) { m.EXPECT().Send(gomock.Any()).Return(fmt.Errorf("test error")) }, }, - wantErr: false, + wantErr: true, }, { name: "context done", @@ -484,12 +484,13 @@ func TestClient_sendAndReceive(t *testing.T) { cancel() return ctx }).AnyTimes() // expected 0 or 1 times. + m.EXPECT().CloseSend().Return(nil) }, }, wantErr: true, }, { - name: "stream not alive", + name: "receive not alive", args: args{ ctx: func() context.Context { return context.Background() @@ -497,7 +498,8 @@ func TestClient_sendAndReceive(t *testing.T) { tuneMockStream: func(m *mock_proxy.MockCloudProxyAPI_StreamCloudProxyClient) { m.EXPECT().Send(gomock.Any()).Return(nil).AnyTimes() // expected 0 or 1 times. m.EXPECT().Context().Return(context.Background()).AnyTimes() // expected 0 or 1 times. - m.EXPECT().Recv().Return(nil, fmt.Errorf("test error")) + m.EXPECT().Recv().Return(nil, fmt.Errorf("test error")).AnyTimes() + m.EXPECT().CloseSend().Return(nil).AnyTimes() }, }, wantErr: true, From da055a0dbb14df8085938636d9b2fd230e80e44e Mon Sep 17 00:00:00 2001 From: Valentyna Bukhalova Date: Tue, 1 Oct 2024 09:54:21 +0200 Subject: [PATCH 11/29] cleaned proto and fixed tests --- internal/proxy/client.go | 65 +-- internal/proxy/client_test.go | 18 +- proto/gen/proto/v1alpha/proxy.pb.go | 760 ++++++++++++---------------- proto/v1alpha/proxy.proto | 38 +- 4 files changed, 358 insertions(+), 523 deletions(-) diff --git a/internal/proxy/client.go b/internal/proxy/client.go index 5561ac1..36b5f84 100644 --- a/internal/proxy/client.go +++ b/internal/proxy/client.go @@ -36,10 +36,11 @@ type CloudClient interface { type Client struct { cfg *config.Config - cloudClient CloudClient - log *logrus.Logger - podName string - clusterID string + cloudClient CloudClient + log *logrus.Logger + podName string + clusterID string + streamRuntimeName string errCount atomic.Int64 processedCount atomic.Int64 @@ -141,30 +142,6 @@ func (c *Client) getStream(ctx context.Context) (cloudproxyv1alpha.CloudProxyAPI return stream, cancelFunc, nil } -func (c *Client) sendInitialRequest(stream cloudproxyv1alpha.CloudProxyAPI_StreamCloudProxyClient) error { - c.log.Info("Sending initial request to castai") - - err := stream.Send(&cloudproxyv1alpha.StreamCloudProxyRequest{ - Request: &cloudproxyv1alpha.StreamCloudProxyRequest_InitialRequest{ - InitialRequest: &cloudproxyv1alpha.InitialCloudProxyRequest{ - ClientMetadata: &cloudproxyv1alpha.ClientMetadata{ - PodName: c.podName, - ClusterId: c.clusterID, - }, - Version: c.version, - }, - }, - }) - if err != nil { - return fmt.Errorf("stream.Send: initial request %w", err) - } - c.lastSeenSend.Store(time.Now().UnixNano()) - - c.log.Info("Stream to castai started successfully") - - return nil -} - func (c *Client) prepareAndRun(ctx context.Context) error { ctx, cancel := context.WithCancel(ctx) defer cancel() @@ -175,6 +152,7 @@ func (c *Client) prepareAndRun(ctx context.Context) error { } defer closeConnection() + c.streamRuntimeName = fmt.Sprintf("stream-%s-%v", c.podName, time.Now().UnixNano()) c.lastSeenReceive.Store(time.Now().UnixNano()) c.lastSeenSend.Store(time.Now().UnixNano()) @@ -182,11 +160,6 @@ func (c *Client) prepareAndRun(ctx context.Context) error { } func (c *Client) sendAndReceive(ctx context.Context, stream cloudproxyv1alpha.CloudProxyAPI_StreamCloudProxyClient) error { - err := c.sendInitialRequest(stream) - if err != nil { - return fmt.Errorf("c.Connect: %w", err) - } - eg, egctx := errgroup.WithContext(ctx) sendCh := make(chan *cloudproxyv1alpha.StreamCloudProxyRequest, 10) @@ -216,7 +189,7 @@ func (c *Client) sendAndReceive(ctx context.Context, stream cloudproxyv1alpha.Cl } }() - err = eg.Wait() + err := eg.Wait() if err != nil { c.log.Errorf("sendAndReceive: closing with error: %v", err) } @@ -237,7 +210,7 @@ func (c *Client) send(ctx context.Context, stream cloudproxyv1alpha.CloudProxyAP case <-stream.Context().Done(): return fmt.Errorf("stream closed %w", stream.Context().Err()) case req := <-sendCh: - c.log.Printf("Sending message to stream %v", req.GetResponse().GetMessageId()) + c.log.Printf("Sending message to stream %v len=%v", req.GetResponse().GetMessageId(), len(req.GetResponse().GetHttpResponse().GetBody())) if err := stream.Send(req); err != nil { c.log.WithError(err).Warn("failed to send message to stream") return fmt.Errorf("failed to send message to stream: %w", err) @@ -276,7 +249,7 @@ func (c *Client) receive(ctx context.Context, stream cloudproxyv1alpha.CloudProx c.lastSeenReceive.Store(time.Now().UnixNano()) c.log.Debugf("Handling message from castai") - go c.handleMessage(stream.Context(), in, respCh) + go c.handleMessage(ctx, in, respCh) } } @@ -310,7 +283,7 @@ func (c *Client) handleMessage(ctx context.Context, in *cloudproxyv1alpha.Stream Request: &cloudproxyv1alpha.StreamCloudProxyRequest_Response{ Response: &cloudproxyv1alpha.ClusterResponse{ ClientMetadata: &cloudproxyv1alpha.ClientMetadata{ - PodName: c.podName, + PodName: c.streamRuntimeName, ClusterId: c.clusterID, }, MessageId: in.GetMessageId(), @@ -323,15 +296,15 @@ func (c *Client) handleMessage(ctx context.Context, in *cloudproxyv1alpha.Stream } func (c *Client) processConfigurationRequest(in *cloudproxyv1alpha.StreamCloudProxyResponse) { - if in.ConfigurationRequest == nil { + if in.GetConfigurationRequest() == nil { return } - if in.ConfigurationRequest.GetKeepAlive() != 0 { - c.keepAlive.Store(in.ConfigurationRequest.GetKeepAlive()) + if in.GetConfigurationRequest().GetKeepAlive() != 0 { + c.keepAlive.Store(in.GetConfigurationRequest().GetKeepAlive()) } - if in.ConfigurationRequest.GetKeepAliveTimeout() != 0 { - c.keepAliveTimeout.Store(in.ConfigurationRequest.GetKeepAliveTimeout()) + if in.GetConfigurationRequest().GetKeepAliveTimeout() != 0 { + c.keepAliveTimeout.Store(in.GetConfigurationRequest().GetKeepAliveTimeout()) } c.log.Debugf("Updated keep-alive configuration to %v and keep-alive timeout to %v", time.Duration(c.keepAlive.Load()).Seconds(), time.Duration(c.keepAliveTimeout.Load()).Seconds()) @@ -371,8 +344,8 @@ func (c *Client) isAlive() error { lastSeenSendDiff := time.Now().UnixNano() - lastSeenSend if lastSeenReceiveDiff > keepAliveTimeout || lastSeenSendDiff > keepAliveTimeout { - c.log.Warnf("last seen receive %v, last seen send %v", - time.Duration(lastSeenReceiveDiff).Seconds(), time.Duration(lastSeenSendDiff).Seconds()) + c.log.Warnf("last seen receive %v, last seen send %v %v", + time.Duration(lastSeenReceiveDiff).Seconds(), time.Duration(lastSeenSendDiff).Seconds(), errAlive) return errAlive } @@ -398,11 +371,11 @@ func (c *Client) sendKeepAlive(ctx context.Context, stream cloudproxyv1alpha.Clo Request: &cloudproxyv1alpha.StreamCloudProxyRequest_ClientStats{ ClientStats: &cloudproxyv1alpha.ClientStats{ ClientMetadata: &cloudproxyv1alpha.ClientMetadata{ - PodName: c.podName, + PodName: c.streamRuntimeName, ClusterId: c.clusterID, + Version: c.version, }, Stats: &cloudproxyv1alpha.ClientStats_Stats{ - Status: cloudproxyv1alpha.ClientStats_Stats_OK, Timestamp: time.Now().UnixNano(), }, }, diff --git a/internal/proxy/client_test.go b/internal/proxy/client_test.go index 06021b5..2572c99 100644 --- a/internal/proxy/client_test.go +++ b/internal/proxy/client_test.go @@ -211,9 +211,11 @@ func TestClient_handleMessage(t *testing.T) { args: args{ in: &cloudproxyv1alpha.StreamCloudProxyResponse{ MessageId: KeepAliveMessageID, - ConfigurationRequest: &cloudproxyv1alpha.ConfigurationRequest{ - KeepAlive: 1, - KeepAliveTimeout: 2, + Response: &cloudproxyv1alpha.StreamCloudProxyResponse_ConfigurationRequest{ + ConfigurationRequest: &cloudproxyv1alpha.ConfigurationRequest{ + KeepAlive: 1, + KeepAliveTimeout: 2, + }, }, }, }, @@ -465,6 +467,12 @@ func TestClient_sendAndReceive(t *testing.T) { }, tuneMockStream: func(m *mock_proxy.MockCloudProxyAPI_StreamCloudProxyClient) { m.EXPECT().Send(gomock.Any()).Return(fmt.Errorf("test error")) + m.EXPECT().Recv().DoAndReturn(func() (*cloudproxyv1alpha.StreamCloudProxyResponse, error) { + time.Sleep(time.Millisecond) + return &cloudproxyv1alpha.StreamCloudProxyResponse{}, nil + }).AnyTimes() + m.EXPECT().Context().Return(context.Background()).AnyTimes() + m.EXPECT().CloseSend().Return(nil) }, }, wantErr: true, @@ -518,8 +526,10 @@ func TestClient_sendAndReceive(t *testing.T) { PodName: "podName", }, KeepAlive: time.Second, - KeepAliveTimeout: time.Minute, + KeepAliveTimeout: time.Second * 2, }) + c.lastSeenReceive.Store(time.Now().UnixNano()) + c.lastSeenSend.Store(time.Now().UnixNano()) stream := mock_proxy.NewMockCloudProxyAPI_StreamCloudProxyClient(ctrl) if tt.args.tuneMockStream != nil { tt.args.tuneMockStream(stream) diff --git a/proto/gen/proto/v1alpha/proxy.pb.go b/proto/gen/proto/v1alpha/proxy.pb.go index 1f09b50..7c40c9f 100644 --- a/proto/gen/proto/v1alpha/proxy.pb.go +++ b/proto/gen/proto/v1alpha/proxy.pb.go @@ -20,56 +20,6 @@ const ( _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) ) -// Status of the cluster client. -type ClientStats_Stats_Status int32 - -const ( - ClientStats_Stats_UNKNOWN ClientStats_Stats_Status = 0 - ClientStats_Stats_OK ClientStats_Stats_Status = 1 - ClientStats_Stats_CLOSING ClientStats_Stats_Status = 2 -) - -// Enum value maps for ClientStats_Stats_Status. -var ( - ClientStats_Stats_Status_name = map[int32]string{ - 0: "UNKNOWN", - 1: "OK", - 2: "CLOSING", - } - ClientStats_Stats_Status_value = map[string]int32{ - "UNKNOWN": 0, - "OK": 1, - "CLOSING": 2, - } -) - -func (x ClientStats_Stats_Status) Enum() *ClientStats_Stats_Status { - p := new(ClientStats_Stats_Status) - *p = x - return p -} - -func (x ClientStats_Stats_Status) String() string { - return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) -} - -func (ClientStats_Stats_Status) Descriptor() protoreflect.EnumDescriptor { - return file_proto_v1alpha_proxy_proto_enumTypes[0].Descriptor() -} - -func (ClientStats_Stats_Status) Type() protoreflect.EnumType { - return &file_proto_v1alpha_proxy_proto_enumTypes[0] -} - -func (x ClientStats_Stats_Status) Number() protoreflect.EnumNumber { - return protoreflect.EnumNumber(x) -} - -// Deprecated: Use ClientStats_Stats_Status.Descriptor instead. -func (ClientStats_Stats_Status) EnumDescriptor() ([]byte, []int) { - return file_proto_v1alpha_proxy_proto_rawDescGZIP(), []int{2, 0, 0} -} - type StreamCloudProxyRequest struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -77,7 +27,6 @@ type StreamCloudProxyRequest struct { // Types that are assignable to Request: // - // *StreamCloudProxyRequest_InitialRequest // *StreamCloudProxyRequest_ClientStats // *StreamCloudProxyRequest_Response Request isStreamCloudProxyRequest_Request `protobuf_oneof:"request"` @@ -122,13 +71,6 @@ func (m *StreamCloudProxyRequest) GetRequest() isStreamCloudProxyRequest_Request return nil } -func (x *StreamCloudProxyRequest) GetInitialRequest() *InitialCloudProxyRequest { - if x, ok := x.GetRequest().(*StreamCloudProxyRequest_InitialRequest); ok { - return x.InitialRequest - } - return nil -} - func (x *StreamCloudProxyRequest) GetClientStats() *ClientStats { if x, ok := x.GetRequest().(*StreamCloudProxyRequest_ClientStats); ok { return x.ClientStats @@ -147,11 +89,6 @@ type isStreamCloudProxyRequest_Request interface { isStreamCloudProxyRequest_Request() } -type StreamCloudProxyRequest_InitialRequest struct { - // Initial request to establish the connection. - InitialRequest *InitialCloudProxyRequest `protobuf:"bytes,1,opt,name=initial_request,json=initialRequest,proto3,oneof"` -} - type StreamCloudProxyRequest_ClientStats struct { ClientStats *ClientStats `protobuf:"bytes,2,opt,name=client_stats,json=clientStats,proto3,oneof"` } @@ -160,67 +97,10 @@ type StreamCloudProxyRequest_Response struct { Response *ClusterResponse `protobuf:"bytes,3,opt,name=response,proto3,oneof"` } -func (*StreamCloudProxyRequest_InitialRequest) isStreamCloudProxyRequest_Request() {} - func (*StreamCloudProxyRequest_ClientStats) isStreamCloudProxyRequest_Request() {} func (*StreamCloudProxyRequest_Response) isStreamCloudProxyRequest_Request() {} -type InitialCloudProxyRequest struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - ClientMetadata *ClientMetadata `protobuf:"bytes,1,opt,name=client_metadata,json=clientMetadata,proto3" json:"client_metadata,omitempty"` - Version string `protobuf:"bytes,2,opt,name=version,proto3" json:"version,omitempty"` -} - -func (x *InitialCloudProxyRequest) Reset() { - *x = InitialCloudProxyRequest{} - if protoimpl.UnsafeEnabled { - mi := &file_proto_v1alpha_proxy_proto_msgTypes[1] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *InitialCloudProxyRequest) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*InitialCloudProxyRequest) ProtoMessage() {} - -func (x *InitialCloudProxyRequest) ProtoReflect() protoreflect.Message { - mi := &file_proto_v1alpha_proxy_proto_msgTypes[1] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use InitialCloudProxyRequest.ProtoReflect.Descriptor instead. -func (*InitialCloudProxyRequest) Descriptor() ([]byte, []int) { - return file_proto_v1alpha_proxy_proto_rawDescGZIP(), []int{1} -} - -func (x *InitialCloudProxyRequest) GetClientMetadata() *ClientMetadata { - if x != nil { - return x.ClientMetadata - } - return nil -} - -func (x *InitialCloudProxyRequest) GetVersion() string { - if x != nil { - return x.Version - } - return "" -} - type ClientStats struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -233,7 +113,7 @@ type ClientStats struct { func (x *ClientStats) Reset() { *x = ClientStats{} if protoimpl.UnsafeEnabled { - mi := &file_proto_v1alpha_proxy_proto_msgTypes[2] + mi := &file_proto_v1alpha_proxy_proto_msgTypes[1] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -246,7 +126,7 @@ func (x *ClientStats) String() string { func (*ClientStats) ProtoMessage() {} func (x *ClientStats) ProtoReflect() protoreflect.Message { - mi := &file_proto_v1alpha_proxy_proto_msgTypes[2] + mi := &file_proto_v1alpha_proxy_proto_msgTypes[1] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -259,7 +139,7 @@ func (x *ClientStats) ProtoReflect() protoreflect.Message { // Deprecated: Use ClientStats.ProtoReflect.Descriptor instead. func (*ClientStats) Descriptor() ([]byte, []int) { - return file_proto_v1alpha_proxy_proto_rawDescGZIP(), []int{2} + return file_proto_v1alpha_proxy_proto_rawDescGZIP(), []int{1} } func (x *ClientStats) GetClientMetadata() *ClientMetadata { @@ -289,7 +169,7 @@ type ClusterResponse struct { func (x *ClusterResponse) Reset() { *x = ClusterResponse{} if protoimpl.UnsafeEnabled { - mi := &file_proto_v1alpha_proxy_proto_msgTypes[3] + mi := &file_proto_v1alpha_proxy_proto_msgTypes[2] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -302,7 +182,7 @@ func (x *ClusterResponse) String() string { func (*ClusterResponse) ProtoMessage() {} func (x *ClusterResponse) ProtoReflect() protoreflect.Message { - mi := &file_proto_v1alpha_proxy_proto_msgTypes[3] + mi := &file_proto_v1alpha_proxy_proto_msgTypes[2] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -315,7 +195,7 @@ func (x *ClusterResponse) ProtoReflect() protoreflect.Message { // Deprecated: Use ClusterResponse.ProtoReflect.Descriptor instead. func (*ClusterResponse) Descriptor() ([]byte, []int) { - return file_proto_v1alpha_proxy_proto_rawDescGZIP(), []int{3} + return file_proto_v1alpha_proxy_proto_rawDescGZIP(), []int{2} } func (x *ClusterResponse) GetClientMetadata() *ClientMetadata { @@ -344,14 +224,14 @@ type CloudProxyRequest struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - MessageId string `protobuf:"bytes,3,opt,name=message_id,json=messageId,proto3" json:"message_id,omitempty"` - HttpRequest *HTTPRequest `protobuf:"bytes,4,opt,name=http_request,json=httpRequest,proto3,oneof" json:"http_request,omitempty"` + MessageId string `protobuf:"bytes,1,opt,name=message_id,json=messageId,proto3" json:"message_id,omitempty"` + HttpRequest *HTTPRequest `protobuf:"bytes,2,opt,name=http_request,json=httpRequest,proto3,oneof" json:"http_request,omitempty"` } func (x *CloudProxyRequest) Reset() { *x = CloudProxyRequest{} if protoimpl.UnsafeEnabled { - mi := &file_proto_v1alpha_proxy_proto_msgTypes[4] + mi := &file_proto_v1alpha_proxy_proto_msgTypes[3] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -364,7 +244,7 @@ func (x *CloudProxyRequest) String() string { func (*CloudProxyRequest) ProtoMessage() {} func (x *CloudProxyRequest) ProtoReflect() protoreflect.Message { - mi := &file_proto_v1alpha_proxy_proto_msgTypes[4] + mi := &file_proto_v1alpha_proxy_proto_msgTypes[3] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -377,7 +257,7 @@ func (x *CloudProxyRequest) ProtoReflect() protoreflect.Message { // Deprecated: Use CloudProxyRequest.ProtoReflect.Descriptor instead. func (*CloudProxyRequest) Descriptor() ([]byte, []int) { - return file_proto_v1alpha_proxy_proto_rawDescGZIP(), []int{4} + return file_proto_v1alpha_proxy_proto_rawDescGZIP(), []int{3} } func (x *CloudProxyRequest) GetMessageId() string { @@ -399,16 +279,19 @@ type StreamCloudProxyResponse struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - ClientMetadata *ClientMetadata `protobuf:"bytes,1,opt,name=client_metadata,json=clientMetadata,proto3,oneof" json:"client_metadata,omitempty"` - MessageId string `protobuf:"bytes,2,opt,name=message_id,json=messageId,proto3" json:"message_id,omitempty"` - HttpRequest *HTTPRequest `protobuf:"bytes,3,opt,name=http_request,json=httpRequest,proto3,oneof" json:"http_request,omitempty"` - ConfigurationRequest *ConfigurationRequest `protobuf:"bytes,4,opt,name=configuration_request,json=configurationRequest,proto3,oneof" json:"configuration_request,omitempty"` + ClientMetadata *ClientMetadata `protobuf:"bytes,1,opt,name=client_metadata,json=clientMetadata,proto3,oneof" json:"client_metadata,omitempty"` + MessageId string `protobuf:"bytes,2,opt,name=message_id,json=messageId,proto3" json:"message_id,omitempty"` + // Types that are assignable to Response: + // + // *StreamCloudProxyResponse_HttpRequest + // *StreamCloudProxyResponse_ConfigurationRequest + Response isStreamCloudProxyResponse_Response `protobuf_oneof:"response"` } func (x *StreamCloudProxyResponse) Reset() { *x = StreamCloudProxyResponse{} if protoimpl.UnsafeEnabled { - mi := &file_proto_v1alpha_proxy_proto_msgTypes[5] + mi := &file_proto_v1alpha_proxy_proto_msgTypes[4] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -421,7 +304,7 @@ func (x *StreamCloudProxyResponse) String() string { func (*StreamCloudProxyResponse) ProtoMessage() {} func (x *StreamCloudProxyResponse) ProtoReflect() protoreflect.Message { - mi := &file_proto_v1alpha_proxy_proto_msgTypes[5] + mi := &file_proto_v1alpha_proxy_proto_msgTypes[4] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -434,7 +317,7 @@ func (x *StreamCloudProxyResponse) ProtoReflect() protoreflect.Message { // Deprecated: Use StreamCloudProxyResponse.ProtoReflect.Descriptor instead. func (*StreamCloudProxyResponse) Descriptor() ([]byte, []int) { - return file_proto_v1alpha_proxy_proto_rawDescGZIP(), []int{5} + return file_proto_v1alpha_proxy_proto_rawDescGZIP(), []int{4} } func (x *StreamCloudProxyResponse) GetClientMetadata() *ClientMetadata { @@ -451,20 +334,43 @@ func (x *StreamCloudProxyResponse) GetMessageId() string { return "" } +func (m *StreamCloudProxyResponse) GetResponse() isStreamCloudProxyResponse_Response { + if m != nil { + return m.Response + } + return nil +} + func (x *StreamCloudProxyResponse) GetHttpRequest() *HTTPRequest { - if x != nil { + if x, ok := x.GetResponse().(*StreamCloudProxyResponse_HttpRequest); ok { return x.HttpRequest } return nil } func (x *StreamCloudProxyResponse) GetConfigurationRequest() *ConfigurationRequest { - if x != nil { + if x, ok := x.GetResponse().(*StreamCloudProxyResponse_ConfigurationRequest); ok { return x.ConfigurationRequest } return nil } +type isStreamCloudProxyResponse_Response interface { + isStreamCloudProxyResponse_Response() +} + +type StreamCloudProxyResponse_HttpRequest struct { + HttpRequest *HTTPRequest `protobuf:"bytes,3,opt,name=http_request,json=httpRequest,proto3,oneof"` +} + +type StreamCloudProxyResponse_ConfigurationRequest struct { + ConfigurationRequest *ConfigurationRequest `protobuf:"bytes,4,opt,name=configuration_request,json=configurationRequest,proto3,oneof"` +} + +func (*StreamCloudProxyResponse_HttpRequest) isStreamCloudProxyResponse_Response() {} + +func (*StreamCloudProxyResponse_ConfigurationRequest) isStreamCloudProxyResponse_Response() {} + type ConfigurationRequest struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -477,7 +383,7 @@ type ConfigurationRequest struct { func (x *ConfigurationRequest) Reset() { *x = ConfigurationRequest{} if protoimpl.UnsafeEnabled { - mi := &file_proto_v1alpha_proxy_proto_msgTypes[6] + mi := &file_proto_v1alpha_proxy_proto_msgTypes[5] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -490,7 +396,7 @@ func (x *ConfigurationRequest) String() string { func (*ConfigurationRequest) ProtoMessage() {} func (x *ConfigurationRequest) ProtoReflect() protoreflect.Message { - mi := &file_proto_v1alpha_proxy_proto_msgTypes[6] + mi := &file_proto_v1alpha_proxy_proto_msgTypes[5] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -503,7 +409,7 @@ func (x *ConfigurationRequest) ProtoReflect() protoreflect.Message { // Deprecated: Use ConfigurationRequest.ProtoReflect.Descriptor instead. func (*ConfigurationRequest) Descriptor() ([]byte, []int) { - return file_proto_v1alpha_proxy_proto_rawDescGZIP(), []int{6} + return file_proto_v1alpha_proxy_proto_rawDescGZIP(), []int{5} } func (x *ConfigurationRequest) GetKeepAlive() int64 { @@ -534,7 +440,7 @@ type HTTPRequest struct { func (x *HTTPRequest) Reset() { *x = HTTPRequest{} if protoimpl.UnsafeEnabled { - mi := &file_proto_v1alpha_proxy_proto_msgTypes[7] + mi := &file_proto_v1alpha_proxy_proto_msgTypes[6] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -547,7 +453,7 @@ func (x *HTTPRequest) String() string { func (*HTTPRequest) ProtoMessage() {} func (x *HTTPRequest) ProtoReflect() protoreflect.Message { - mi := &file_proto_v1alpha_proxy_proto_msgTypes[7] + mi := &file_proto_v1alpha_proxy_proto_msgTypes[6] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -560,7 +466,7 @@ func (x *HTTPRequest) ProtoReflect() protoreflect.Message { // Deprecated: Use HTTPRequest.ProtoReflect.Descriptor instead. func (*HTTPRequest) Descriptor() ([]byte, []int) { - return file_proto_v1alpha_proxy_proto_rawDescGZIP(), []int{7} + return file_proto_v1alpha_proxy_proto_rawDescGZIP(), []int{6} } func (x *HTTPRequest) GetMethod() string { @@ -605,7 +511,7 @@ type HTTPResponse struct { func (x *HTTPResponse) Reset() { *x = HTTPResponse{} if protoimpl.UnsafeEnabled { - mi := &file_proto_v1alpha_proxy_proto_msgTypes[8] + mi := &file_proto_v1alpha_proxy_proto_msgTypes[7] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -618,7 +524,7 @@ func (x *HTTPResponse) String() string { func (*HTTPResponse) ProtoMessage() {} func (x *HTTPResponse) ProtoReflect() protoreflect.Message { - mi := &file_proto_v1alpha_proxy_proto_msgTypes[8] + mi := &file_proto_v1alpha_proxy_proto_msgTypes[7] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -631,7 +537,7 @@ func (x *HTTPResponse) ProtoReflect() protoreflect.Message { // Deprecated: Use HTTPResponse.ProtoReflect.Descriptor instead. func (*HTTPResponse) Descriptor() ([]byte, []int) { - return file_proto_v1alpha_proxy_proto_rawDescGZIP(), []int{8} + return file_proto_v1alpha_proxy_proto_rawDescGZIP(), []int{7} } func (x *HTTPResponse) GetBody() []byte { @@ -673,7 +579,7 @@ type HeaderValue struct { func (x *HeaderValue) Reset() { *x = HeaderValue{} if protoimpl.UnsafeEnabled { - mi := &file_proto_v1alpha_proxy_proto_msgTypes[9] + mi := &file_proto_v1alpha_proxy_proto_msgTypes[8] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -686,7 +592,7 @@ func (x *HeaderValue) String() string { func (*HeaderValue) ProtoMessage() {} func (x *HeaderValue) ProtoReflect() protoreflect.Message { - mi := &file_proto_v1alpha_proxy_proto_msgTypes[9] + mi := &file_proto_v1alpha_proxy_proto_msgTypes[8] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -699,7 +605,7 @@ func (x *HeaderValue) ProtoReflect() protoreflect.Message { // Deprecated: Use HeaderValue.ProtoReflect.Descriptor instead. func (*HeaderValue) Descriptor() ([]byte, []int) { - return file_proto_v1alpha_proxy_proto_rawDescGZIP(), []int{9} + return file_proto_v1alpha_proxy_proto_rawDescGZIP(), []int{8} } func (x *HeaderValue) GetValue() []string { @@ -721,7 +627,7 @@ type SendToProxyRequest struct { func (x *SendToProxyRequest) Reset() { *x = SendToProxyRequest{} if protoimpl.UnsafeEnabled { - mi := &file_proto_v1alpha_proxy_proto_msgTypes[10] + mi := &file_proto_v1alpha_proxy_proto_msgTypes[9] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -734,7 +640,7 @@ func (x *SendToProxyRequest) String() string { func (*SendToProxyRequest) ProtoMessage() {} func (x *SendToProxyRequest) ProtoReflect() protoreflect.Message { - mi := &file_proto_v1alpha_proxy_proto_msgTypes[10] + mi := &file_proto_v1alpha_proxy_proto_msgTypes[9] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -747,7 +653,7 @@ func (x *SendToProxyRequest) ProtoReflect() protoreflect.Message { // Deprecated: Use SendToProxyRequest.ProtoReflect.Descriptor instead. func (*SendToProxyRequest) Descriptor() ([]byte, []int) { - return file_proto_v1alpha_proxy_proto_rawDescGZIP(), []int{10} + return file_proto_v1alpha_proxy_proto_rawDescGZIP(), []int{9} } func (x *SendToProxyRequest) GetClientMetadata() *ClientMetadata { @@ -776,7 +682,7 @@ type SendToProxyResponse struct { func (x *SendToProxyResponse) Reset() { *x = SendToProxyResponse{} if protoimpl.UnsafeEnabled { - mi := &file_proto_v1alpha_proxy_proto_msgTypes[11] + mi := &file_proto_v1alpha_proxy_proto_msgTypes[10] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -789,7 +695,7 @@ func (x *SendToProxyResponse) String() string { func (*SendToProxyResponse) ProtoMessage() {} func (x *SendToProxyResponse) ProtoReflect() protoreflect.Message { - mi := &file_proto_v1alpha_proxy_proto_msgTypes[11] + mi := &file_proto_v1alpha_proxy_proto_msgTypes[10] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -802,7 +708,7 @@ func (x *SendToProxyResponse) ProtoReflect() protoreflect.Message { // Deprecated: Use SendToProxyResponse.ProtoReflect.Descriptor instead. func (*SendToProxyResponse) Descriptor() ([]byte, []int) { - return file_proto_v1alpha_proxy_proto_rawDescGZIP(), []int{11} + return file_proto_v1alpha_proxy_proto_rawDescGZIP(), []int{10} } func (x *SendToProxyResponse) GetHttpResponse() *HTTPResponse { @@ -827,12 +733,13 @@ type ClientMetadata struct { ClusterId string `protobuf:"bytes,1,opt,name=cluster_id,json=clusterId,proto3" json:"cluster_id,omitempty"` OrganizationId *string `protobuf:"bytes,2,opt,name=organization_id,json=organizationId,proto3,oneof" json:"organization_id,omitempty"` PodName string `protobuf:"bytes,3,opt,name=pod_name,json=podName,proto3" json:"pod_name,omitempty"` + Version string `protobuf:"bytes,4,opt,name=version,proto3" json:"version,omitempty"` } func (x *ClientMetadata) Reset() { *x = ClientMetadata{} if protoimpl.UnsafeEnabled { - mi := &file_proto_v1alpha_proxy_proto_msgTypes[12] + mi := &file_proto_v1alpha_proxy_proto_msgTypes[11] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -845,7 +752,7 @@ func (x *ClientMetadata) String() string { func (*ClientMetadata) ProtoMessage() {} func (x *ClientMetadata) ProtoReflect() protoreflect.Message { - mi := &file_proto_v1alpha_proxy_proto_msgTypes[12] + mi := &file_proto_v1alpha_proxy_proto_msgTypes[11] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -858,7 +765,7 @@ func (x *ClientMetadata) ProtoReflect() protoreflect.Message { // Deprecated: Use ClientMetadata.ProtoReflect.Descriptor instead. func (*ClientMetadata) Descriptor() ([]byte, []int) { - return file_proto_v1alpha_proxy_proto_rawDescGZIP(), []int{12} + return file_proto_v1alpha_proxy_proto_rawDescGZIP(), []int{11} } func (x *ClientMetadata) GetClusterId() string { @@ -882,28 +789,34 @@ func (x *ClientMetadata) GetPodName() string { return "" } +func (x *ClientMetadata) GetVersion() string { + if x != nil { + return x.Version + } + return "" +} + type ClientStats_Stats struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - Status ClientStats_Stats_Status `protobuf:"varint,2,opt,name=status,proto3,enum=castai.cloud.proxy.v1alpha.ClientStats_Stats_Status" json:"status,omitempty"` - Timestamp int64 `protobuf:"varint,3,opt,name=timestamp,proto3" json:"timestamp,omitempty"` + Timestamp int64 `protobuf:"varint,2,opt,name=timestamp,proto3" json:"timestamp,omitempty"` // The total number of RPCs that started. - NumCallsStarted int64 `protobuf:"varint,4,opt,name=num_calls_started,json=numCallsStarted,proto3" json:"num_calls_started,omitempty"` + NumCallsStarted int64 `protobuf:"varint,3,opt,name=num_calls_started,json=numCallsStarted,proto3" json:"num_calls_started,omitempty"` // The total number of RPCs that finished. - NumCallsFinished int64 `protobuf:"varint,5,opt,name=num_calls_finished,json=numCallsFinished,proto3" json:"num_calls_finished,omitempty"` + NumCallsFinished int64 `protobuf:"varint,4,opt,name=num_calls_finished,json=numCallsFinished,proto3" json:"num_calls_finished,omitempty"` // The total number of RPCs that failed to reach a server except dropped RPCs. - NumCallsFinishedWithClientFailedToSend int64 `protobuf:"varint,6,opt,name=num_calls_finished_with_client_failed_to_send,json=numCallsFinishedWithClientFailedToSend,proto3" json:"num_calls_finished_with_client_failed_to_send,omitempty"` + NumCallsFinishedWithClientFailedToSend int64 `protobuf:"varint,5,opt,name=num_calls_finished_with_client_failed_to_send,json=numCallsFinishedWithClientFailedToSend,proto3" json:"num_calls_finished_with_client_failed_to_send,omitempty"` // The total number of RPCs that finished and are known to have been received // by a server. - NumCallsFinishedKnownReceived int64 `protobuf:"varint,7,opt,name=num_calls_finished_known_received,json=numCallsFinishedKnownReceived,proto3" json:"num_calls_finished_known_received,omitempty"` + NumCallsFinishedKnownReceived int64 `protobuf:"varint,6,opt,name=num_calls_finished_known_received,json=numCallsFinishedKnownReceived,proto3" json:"num_calls_finished_known_received,omitempty"` } func (x *ClientStats_Stats) Reset() { *x = ClientStats_Stats{} if protoimpl.UnsafeEnabled { - mi := &file_proto_v1alpha_proxy_proto_msgTypes[13] + mi := &file_proto_v1alpha_proxy_proto_msgTypes[12] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -916,7 +829,7 @@ func (x *ClientStats_Stats) String() string { func (*ClientStats_Stats) ProtoMessage() {} func (x *ClientStats_Stats) ProtoReflect() protoreflect.Message { - mi := &file_proto_v1alpha_proxy_proto_msgTypes[13] + mi := &file_proto_v1alpha_proxy_proto_msgTypes[12] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -929,14 +842,7 @@ func (x *ClientStats_Stats) ProtoReflect() protoreflect.Message { // Deprecated: Use ClientStats_Stats.ProtoReflect.Descriptor instead. func (*ClientStats_Stats) Descriptor() ([]byte, []int) { - return file_proto_v1alpha_proxy_proto_rawDescGZIP(), []int{2, 0} -} - -func (x *ClientStats_Stats) GetStatus() ClientStats_Stats_Status { - if x != nil { - return x.Status - } - return ClientStats_Stats_UNKNOWN + return file_proto_v1alpha_proxy_proto_rawDescGZIP(), []int{1, 0} } func (x *ClientStats_Stats) GetTimestamp() int64 { @@ -980,135 +886,128 @@ var file_proto_v1alpha_proxy_proto_rawDesc = []byte{ 0x0a, 0x19, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x2f, 0x70, 0x72, 0x6f, 0x78, 0x79, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x1a, 0x63, 0x61, 0x73, 0x74, 0x61, 0x69, 0x2e, 0x63, 0x6c, 0x6f, 0x75, 0x64, 0x2e, 0x70, 0x72, 0x6f, 0x78, 0x79, 0x2e, - 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x22, 0x9e, 0x02, 0x0a, 0x17, 0x53, 0x74, 0x72, 0x65, + 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x22, 0xbd, 0x01, 0x0a, 0x17, 0x53, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x43, 0x6c, 0x6f, 0x75, 0x64, 0x50, 0x72, 0x6f, 0x78, 0x79, 0x52, 0x65, 0x71, 0x75, - 0x65, 0x73, 0x74, 0x12, 0x5f, 0x0a, 0x0f, 0x69, 0x6e, 0x69, 0x74, 0x69, 0x61, 0x6c, 0x5f, 0x72, - 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x34, 0x2e, 0x63, - 0x61, 0x73, 0x74, 0x61, 0x69, 0x2e, 0x63, 0x6c, 0x6f, 0x75, 0x64, 0x2e, 0x70, 0x72, 0x6f, 0x78, - 0x79, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x2e, 0x49, 0x6e, 0x69, 0x74, 0x69, 0x61, - 0x6c, 0x43, 0x6c, 0x6f, 0x75, 0x64, 0x50, 0x72, 0x6f, 0x78, 0x79, 0x52, 0x65, 0x71, 0x75, 0x65, - 0x73, 0x74, 0x48, 0x00, 0x52, 0x0e, 0x69, 0x6e, 0x69, 0x74, 0x69, 0x61, 0x6c, 0x52, 0x65, 0x71, - 0x75, 0x65, 0x73, 0x74, 0x12, 0x4c, 0x0a, 0x0c, 0x63, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x5f, 0x73, - 0x74, 0x61, 0x74, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x27, 0x2e, 0x63, 0x61, 0x73, - 0x74, 0x61, 0x69, 0x2e, 0x63, 0x6c, 0x6f, 0x75, 0x64, 0x2e, 0x70, 0x72, 0x6f, 0x78, 0x79, 0x2e, - 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x2e, 0x43, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x53, 0x74, - 0x61, 0x74, 0x73, 0x48, 0x00, 0x52, 0x0b, 0x63, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x53, 0x74, 0x61, - 0x74, 0x73, 0x12, 0x49, 0x0a, 0x08, 0x72, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x18, 0x03, - 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2b, 0x2e, 0x63, 0x61, 0x73, 0x74, 0x61, 0x69, 0x2e, 0x63, 0x6c, - 0x6f, 0x75, 0x64, 0x2e, 0x70, 0x72, 0x6f, 0x78, 0x79, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, - 0x61, 0x2e, 0x43, 0x6c, 0x75, 0x73, 0x74, 0x65, 0x72, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, - 0x65, 0x48, 0x00, 0x52, 0x08, 0x72, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x42, 0x09, 0x0a, - 0x07, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x22, 0x89, 0x01, 0x0a, 0x18, 0x49, 0x6e, 0x69, - 0x74, 0x69, 0x61, 0x6c, 0x43, 0x6c, 0x6f, 0x75, 0x64, 0x50, 0x72, 0x6f, 0x78, 0x79, 0x52, 0x65, - 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x53, 0x0a, 0x0f, 0x63, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x5f, - 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2a, - 0x2e, 0x63, 0x61, 0x73, 0x74, 0x61, 0x69, 0x2e, 0x63, 0x6c, 0x6f, 0x75, 0x64, 0x2e, 0x70, 0x72, - 0x6f, 0x78, 0x79, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x2e, 0x43, 0x6c, 0x69, 0x65, - 0x6e, 0x74, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x52, 0x0e, 0x63, 0x6c, 0x69, 0x65, - 0x6e, 0x74, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x12, 0x18, 0x0a, 0x07, 0x76, 0x65, - 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x76, 0x65, 0x72, - 0x73, 0x69, 0x6f, 0x6e, 0x22, 0xcc, 0x04, 0x0a, 0x0b, 0x43, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x53, - 0x74, 0x61, 0x74, 0x73, 0x12, 0x53, 0x0a, 0x0f, 0x63, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x5f, 0x6d, - 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2a, 0x2e, - 0x63, 0x61, 0x73, 0x74, 0x61, 0x69, 0x2e, 0x63, 0x6c, 0x6f, 0x75, 0x64, 0x2e, 0x70, 0x72, 0x6f, - 0x78, 0x79, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x2e, 0x43, 0x6c, 0x69, 0x65, 0x6e, - 0x74, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x52, 0x0e, 0x63, 0x6c, 0x69, 0x65, 0x6e, - 0x74, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x12, 0x43, 0x0a, 0x05, 0x73, 0x74, 0x61, - 0x74, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2d, 0x2e, 0x63, 0x61, 0x73, 0x74, 0x61, - 0x69, 0x2e, 0x63, 0x6c, 0x6f, 0x75, 0x64, 0x2e, 0x70, 0x72, 0x6f, 0x78, 0x79, 0x2e, 0x76, 0x31, - 0x61, 0x6c, 0x70, 0x68, 0x61, 0x2e, 0x43, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x53, 0x74, 0x61, 0x74, - 0x73, 0x2e, 0x53, 0x74, 0x61, 0x74, 0x73, 0x52, 0x05, 0x73, 0x74, 0x61, 0x74, 0x73, 0x1a, 0xa2, - 0x03, 0x0a, 0x05, 0x53, 0x74, 0x61, 0x74, 0x73, 0x12, 0x4c, 0x0a, 0x06, 0x73, 0x74, 0x61, 0x74, - 0x75, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x34, 0x2e, 0x63, 0x61, 0x73, 0x74, 0x61, - 0x69, 0x2e, 0x63, 0x6c, 0x6f, 0x75, 0x64, 0x2e, 0x70, 0x72, 0x6f, 0x78, 0x79, 0x2e, 0x76, 0x31, - 0x61, 0x6c, 0x70, 0x68, 0x61, 0x2e, 0x43, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x53, 0x74, 0x61, 0x74, - 0x73, 0x2e, 0x53, 0x74, 0x61, 0x74, 0x73, 0x2e, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x06, - 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x1c, 0x0a, 0x09, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, - 0x61, 0x6d, 0x70, 0x18, 0x03, 0x20, 0x01, 0x28, 0x03, 0x52, 0x09, 0x74, 0x69, 0x6d, 0x65, 0x73, - 0x74, 0x61, 0x6d, 0x70, 0x12, 0x2a, 0x0a, 0x11, 0x6e, 0x75, 0x6d, 0x5f, 0x63, 0x61, 0x6c, 0x6c, - 0x73, 0x5f, 0x73, 0x74, 0x61, 0x72, 0x74, 0x65, 0x64, 0x18, 0x04, 0x20, 0x01, 0x28, 0x03, 0x52, - 0x0f, 0x6e, 0x75, 0x6d, 0x43, 0x61, 0x6c, 0x6c, 0x73, 0x53, 0x74, 0x61, 0x72, 0x74, 0x65, 0x64, - 0x12, 0x2c, 0x0a, 0x12, 0x6e, 0x75, 0x6d, 0x5f, 0x63, 0x61, 0x6c, 0x6c, 0x73, 0x5f, 0x66, 0x69, - 0x6e, 0x69, 0x73, 0x68, 0x65, 0x64, 0x18, 0x05, 0x20, 0x01, 0x28, 0x03, 0x52, 0x10, 0x6e, 0x75, - 0x6d, 0x43, 0x61, 0x6c, 0x6c, 0x73, 0x46, 0x69, 0x6e, 0x69, 0x73, 0x68, 0x65, 0x64, 0x12, 0x5d, - 0x0a, 0x2d, 0x6e, 0x75, 0x6d, 0x5f, 0x63, 0x61, 0x6c, 0x6c, 0x73, 0x5f, 0x66, 0x69, 0x6e, 0x69, - 0x73, 0x68, 0x65, 0x64, 0x5f, 0x77, 0x69, 0x74, 0x68, 0x5f, 0x63, 0x6c, 0x69, 0x65, 0x6e, 0x74, - 0x5f, 0x66, 0x61, 0x69, 0x6c, 0x65, 0x64, 0x5f, 0x74, 0x6f, 0x5f, 0x73, 0x65, 0x6e, 0x64, 0x18, - 0x06, 0x20, 0x01, 0x28, 0x03, 0x52, 0x26, 0x6e, 0x75, 0x6d, 0x43, 0x61, 0x6c, 0x6c, 0x73, 0x46, - 0x69, 0x6e, 0x69, 0x73, 0x68, 0x65, 0x64, 0x57, 0x69, 0x74, 0x68, 0x43, 0x6c, 0x69, 0x65, 0x6e, - 0x74, 0x46, 0x61, 0x69, 0x6c, 0x65, 0x64, 0x54, 0x6f, 0x53, 0x65, 0x6e, 0x64, 0x12, 0x48, 0x0a, - 0x21, 0x6e, 0x75, 0x6d, 0x5f, 0x63, 0x61, 0x6c, 0x6c, 0x73, 0x5f, 0x66, 0x69, 0x6e, 0x69, 0x73, - 0x68, 0x65, 0x64, 0x5f, 0x6b, 0x6e, 0x6f, 0x77, 0x6e, 0x5f, 0x72, 0x65, 0x63, 0x65, 0x69, 0x76, - 0x65, 0x64, 0x18, 0x07, 0x20, 0x01, 0x28, 0x03, 0x52, 0x1d, 0x6e, 0x75, 0x6d, 0x43, 0x61, 0x6c, - 0x6c, 0x73, 0x46, 0x69, 0x6e, 0x69, 0x73, 0x68, 0x65, 0x64, 0x4b, 0x6e, 0x6f, 0x77, 0x6e, 0x52, - 0x65, 0x63, 0x65, 0x69, 0x76, 0x65, 0x64, 0x22, 0x2a, 0x0a, 0x06, 0x53, 0x74, 0x61, 0x74, 0x75, - 0x73, 0x12, 0x0b, 0x0a, 0x07, 0x55, 0x4e, 0x4b, 0x4e, 0x4f, 0x57, 0x4e, 0x10, 0x00, 0x12, 0x06, - 0x0a, 0x02, 0x4f, 0x4b, 0x10, 0x01, 0x12, 0x0b, 0x0a, 0x07, 0x43, 0x4c, 0x4f, 0x53, 0x49, 0x4e, - 0x47, 0x10, 0x02, 0x22, 0xed, 0x01, 0x0a, 0x0f, 0x43, 0x6c, 0x75, 0x73, 0x74, 0x65, 0x72, 0x52, - 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x58, 0x0a, 0x0f, 0x63, 0x6c, 0x69, 0x65, 0x6e, - 0x74, 0x5f, 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, - 0x32, 0x2a, 0x2e, 0x63, 0x61, 0x73, 0x74, 0x61, 0x69, 0x2e, 0x63, 0x6c, 0x6f, 0x75, 0x64, 0x2e, - 0x70, 0x72, 0x6f, 0x78, 0x79, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x2e, 0x43, 0x6c, - 0x69, 0x65, 0x6e, 0x74, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x48, 0x00, 0x52, 0x0e, - 0x63, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x88, 0x01, - 0x01, 0x12, 0x1d, 0x0a, 0x0a, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x5f, 0x69, 0x64, 0x18, - 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x49, 0x64, - 0x12, 0x4d, 0x0a, 0x0d, 0x68, 0x74, 0x74, 0x70, 0x5f, 0x72, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, - 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x28, 0x2e, 0x63, 0x61, 0x73, 0x74, 0x61, 0x69, - 0x2e, 0x63, 0x6c, 0x6f, 0x75, 0x64, 0x2e, 0x70, 0x72, 0x6f, 0x78, 0x79, 0x2e, 0x76, 0x31, 0x61, - 0x6c, 0x70, 0x68, 0x61, 0x2e, 0x48, 0x54, 0x54, 0x50, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, - 0x65, 0x52, 0x0c, 0x68, 0x74, 0x74, 0x70, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x42, - 0x12, 0x0a, 0x10, 0x5f, 0x63, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x5f, 0x6d, 0x65, 0x74, 0x61, 0x64, - 0x61, 0x74, 0x61, 0x22, 0x94, 0x01, 0x0a, 0x11, 0x43, 0x6c, 0x6f, 0x75, 0x64, 0x50, 0x72, 0x6f, - 0x78, 0x79, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x1d, 0x0a, 0x0a, 0x6d, 0x65, 0x73, - 0x73, 0x61, 0x67, 0x65, 0x5f, 0x69, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x6d, - 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x49, 0x64, 0x12, 0x4f, 0x0a, 0x0c, 0x68, 0x74, 0x74, 0x70, - 0x5f, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x27, - 0x2e, 0x63, 0x61, 0x73, 0x74, 0x61, 0x69, 0x2e, 0x63, 0x6c, 0x6f, 0x75, 0x64, 0x2e, 0x70, 0x72, - 0x6f, 0x78, 0x79, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x2e, 0x48, 0x54, 0x54, 0x50, - 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x48, 0x00, 0x52, 0x0b, 0x68, 0x74, 0x74, 0x70, 0x52, - 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x88, 0x01, 0x01, 0x42, 0x0f, 0x0a, 0x0d, 0x5f, 0x68, 0x74, - 0x74, 0x70, 0x5f, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x22, 0x8f, 0x03, 0x0a, 0x18, 0x53, - 0x74, 0x72, 0x65, 0x61, 0x6d, 0x43, 0x6c, 0x6f, 0x75, 0x64, 0x50, 0x72, 0x6f, 0x78, 0x79, 0x52, - 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x58, 0x0a, 0x0f, 0x63, 0x6c, 0x69, 0x65, 0x6e, + 0x65, 0x73, 0x74, 0x12, 0x4c, 0x0a, 0x0c, 0x63, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x5f, 0x73, 0x74, + 0x61, 0x74, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x27, 0x2e, 0x63, 0x61, 0x73, 0x74, + 0x61, 0x69, 0x2e, 0x63, 0x6c, 0x6f, 0x75, 0x64, 0x2e, 0x70, 0x72, 0x6f, 0x78, 0x79, 0x2e, 0x76, + 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x2e, 0x43, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x53, 0x74, 0x61, + 0x74, 0x73, 0x48, 0x00, 0x52, 0x0b, 0x63, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x53, 0x74, 0x61, 0x74, + 0x73, 0x12, 0x49, 0x0a, 0x08, 0x72, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x18, 0x03, 0x20, + 0x01, 0x28, 0x0b, 0x32, 0x2b, 0x2e, 0x63, 0x61, 0x73, 0x74, 0x61, 0x69, 0x2e, 0x63, 0x6c, 0x6f, + 0x75, 0x64, 0x2e, 0x70, 0x72, 0x6f, 0x78, 0x79, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, + 0x2e, 0x43, 0x6c, 0x75, 0x73, 0x74, 0x65, 0x72, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, + 0x48, 0x00, 0x52, 0x08, 0x72, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x42, 0x09, 0x0a, 0x07, + 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x22, 0xd2, 0x03, 0x0a, 0x0b, 0x43, 0x6c, 0x69, 0x65, + 0x6e, 0x74, 0x53, 0x74, 0x61, 0x74, 0x73, 0x12, 0x53, 0x0a, 0x0f, 0x63, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x5f, 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2a, 0x2e, 0x63, 0x61, 0x73, 0x74, 0x61, 0x69, 0x2e, 0x63, 0x6c, 0x6f, 0x75, 0x64, 0x2e, 0x70, 0x72, 0x6f, 0x78, 0x79, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x2e, 0x43, 0x6c, - 0x69, 0x65, 0x6e, 0x74, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x48, 0x00, 0x52, 0x0e, - 0x63, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x88, 0x01, - 0x01, 0x12, 0x1d, 0x0a, 0x0a, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x5f, 0x69, 0x64, 0x18, - 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x49, 0x64, - 0x12, 0x4f, 0x0a, 0x0c, 0x68, 0x74, 0x74, 0x70, 0x5f, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, - 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x27, 0x2e, 0x63, 0x61, 0x73, 0x74, 0x61, 0x69, 0x2e, - 0x63, 0x6c, 0x6f, 0x75, 0x64, 0x2e, 0x70, 0x72, 0x6f, 0x78, 0x79, 0x2e, 0x76, 0x31, 0x61, 0x6c, - 0x70, 0x68, 0x61, 0x2e, 0x48, 0x54, 0x54, 0x50, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x48, - 0x01, 0x52, 0x0b, 0x68, 0x74, 0x74, 0x70, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x88, 0x01, - 0x01, 0x12, 0x6a, 0x0a, 0x15, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x75, 0x72, 0x61, 0x74, 0x69, - 0x6f, 0x6e, 0x5f, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, - 0x32, 0x30, 0x2e, 0x63, 0x61, 0x73, 0x74, 0x61, 0x69, 0x2e, 0x63, 0x6c, 0x6f, 0x75, 0x64, 0x2e, - 0x70, 0x72, 0x6f, 0x78, 0x79, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x2e, 0x43, 0x6f, - 0x6e, 0x66, 0x69, 0x67, 0x75, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, - 0x73, 0x74, 0x48, 0x02, 0x52, 0x14, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x75, 0x72, 0x61, 0x74, - 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x88, 0x01, 0x01, 0x42, 0x12, 0x0a, - 0x10, 0x5f, 0x63, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x5f, 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, - 0x61, 0x42, 0x0f, 0x0a, 0x0d, 0x5f, 0x68, 0x74, 0x74, 0x70, 0x5f, 0x72, 0x65, 0x71, 0x75, 0x65, - 0x73, 0x74, 0x42, 0x18, 0x0a, 0x16, 0x5f, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x75, 0x72, 0x61, - 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x22, 0x63, 0x0a, 0x14, - 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x75, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x71, - 0x75, 0x65, 0x73, 0x74, 0x12, 0x1d, 0x0a, 0x0a, 0x6b, 0x65, 0x65, 0x70, 0x5f, 0x61, 0x6c, 0x69, - 0x76, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x09, 0x6b, 0x65, 0x65, 0x70, 0x41, 0x6c, - 0x69, 0x76, 0x65, 0x12, 0x2c, 0x0a, 0x12, 0x6b, 0x65, 0x65, 0x70, 0x5f, 0x61, 0x6c, 0x69, 0x76, - 0x65, 0x5f, 0x74, 0x69, 0x6d, 0x65, 0x6f, 0x75, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x52, - 0x10, 0x6b, 0x65, 0x65, 0x70, 0x41, 0x6c, 0x69, 0x76, 0x65, 0x54, 0x69, 0x6d, 0x65, 0x6f, 0x75, - 0x74, 0x22, 0x90, 0x02, 0x0a, 0x0b, 0x48, 0x54, 0x54, 0x50, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, - 0x74, 0x12, 0x16, 0x0a, 0x06, 0x6d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, - 0x09, 0x52, 0x06, 0x6d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x12, 0x12, 0x0a, 0x04, 0x70, 0x61, 0x74, - 0x68, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x70, 0x61, 0x74, 0x68, 0x12, 0x17, 0x0a, - 0x04, 0x62, 0x6f, 0x64, 0x79, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0c, 0x48, 0x00, 0x52, 0x04, 0x62, - 0x6f, 0x64, 0x79, 0x88, 0x01, 0x01, 0x12, 0x4e, 0x0a, 0x07, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, - 0x73, 0x18, 0x04, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x34, 0x2e, 0x63, 0x61, 0x73, 0x74, 0x61, 0x69, + 0x69, 0x65, 0x6e, 0x74, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x52, 0x0e, 0x63, 0x6c, + 0x69, 0x65, 0x6e, 0x74, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x12, 0x43, 0x0a, 0x05, + 0x73, 0x74, 0x61, 0x74, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2d, 0x2e, 0x63, 0x61, + 0x73, 0x74, 0x61, 0x69, 0x2e, 0x63, 0x6c, 0x6f, 0x75, 0x64, 0x2e, 0x70, 0x72, 0x6f, 0x78, 0x79, + 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x2e, 0x43, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x53, + 0x74, 0x61, 0x74, 0x73, 0x2e, 0x53, 0x74, 0x61, 0x74, 0x73, 0x52, 0x05, 0x73, 0x74, 0x61, 0x74, + 0x73, 0x1a, 0xa8, 0x02, 0x0a, 0x05, 0x53, 0x74, 0x61, 0x74, 0x73, 0x12, 0x1c, 0x0a, 0x09, 0x74, + 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x52, 0x09, + 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x12, 0x2a, 0x0a, 0x11, 0x6e, 0x75, 0x6d, + 0x5f, 0x63, 0x61, 0x6c, 0x6c, 0x73, 0x5f, 0x73, 0x74, 0x61, 0x72, 0x74, 0x65, 0x64, 0x18, 0x03, + 0x20, 0x01, 0x28, 0x03, 0x52, 0x0f, 0x6e, 0x75, 0x6d, 0x43, 0x61, 0x6c, 0x6c, 0x73, 0x53, 0x74, + 0x61, 0x72, 0x74, 0x65, 0x64, 0x12, 0x2c, 0x0a, 0x12, 0x6e, 0x75, 0x6d, 0x5f, 0x63, 0x61, 0x6c, + 0x6c, 0x73, 0x5f, 0x66, 0x69, 0x6e, 0x69, 0x73, 0x68, 0x65, 0x64, 0x18, 0x04, 0x20, 0x01, 0x28, + 0x03, 0x52, 0x10, 0x6e, 0x75, 0x6d, 0x43, 0x61, 0x6c, 0x6c, 0x73, 0x46, 0x69, 0x6e, 0x69, 0x73, + 0x68, 0x65, 0x64, 0x12, 0x5d, 0x0a, 0x2d, 0x6e, 0x75, 0x6d, 0x5f, 0x63, 0x61, 0x6c, 0x6c, 0x73, + 0x5f, 0x66, 0x69, 0x6e, 0x69, 0x73, 0x68, 0x65, 0x64, 0x5f, 0x77, 0x69, 0x74, 0x68, 0x5f, 0x63, + 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x5f, 0x66, 0x61, 0x69, 0x6c, 0x65, 0x64, 0x5f, 0x74, 0x6f, 0x5f, + 0x73, 0x65, 0x6e, 0x64, 0x18, 0x05, 0x20, 0x01, 0x28, 0x03, 0x52, 0x26, 0x6e, 0x75, 0x6d, 0x43, + 0x61, 0x6c, 0x6c, 0x73, 0x46, 0x69, 0x6e, 0x69, 0x73, 0x68, 0x65, 0x64, 0x57, 0x69, 0x74, 0x68, + 0x43, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x46, 0x61, 0x69, 0x6c, 0x65, 0x64, 0x54, 0x6f, 0x53, 0x65, + 0x6e, 0x64, 0x12, 0x48, 0x0a, 0x21, 0x6e, 0x75, 0x6d, 0x5f, 0x63, 0x61, 0x6c, 0x6c, 0x73, 0x5f, + 0x66, 0x69, 0x6e, 0x69, 0x73, 0x68, 0x65, 0x64, 0x5f, 0x6b, 0x6e, 0x6f, 0x77, 0x6e, 0x5f, 0x72, + 0x65, 0x63, 0x65, 0x69, 0x76, 0x65, 0x64, 0x18, 0x06, 0x20, 0x01, 0x28, 0x03, 0x52, 0x1d, 0x6e, + 0x75, 0x6d, 0x43, 0x61, 0x6c, 0x6c, 0x73, 0x46, 0x69, 0x6e, 0x69, 0x73, 0x68, 0x65, 0x64, 0x4b, + 0x6e, 0x6f, 0x77, 0x6e, 0x52, 0x65, 0x63, 0x65, 0x69, 0x76, 0x65, 0x64, 0x22, 0xed, 0x01, 0x0a, + 0x0f, 0x43, 0x6c, 0x75, 0x73, 0x74, 0x65, 0x72, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, + 0x12, 0x58, 0x0a, 0x0f, 0x63, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x5f, 0x6d, 0x65, 0x74, 0x61, 0x64, + 0x61, 0x74, 0x61, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2a, 0x2e, 0x63, 0x61, 0x73, 0x74, + 0x61, 0x69, 0x2e, 0x63, 0x6c, 0x6f, 0x75, 0x64, 0x2e, 0x70, 0x72, 0x6f, 0x78, 0x79, 0x2e, 0x76, + 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x2e, 0x43, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x4d, 0x65, 0x74, + 0x61, 0x64, 0x61, 0x74, 0x61, 0x48, 0x00, 0x52, 0x0e, 0x63, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x4d, + 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x88, 0x01, 0x01, 0x12, 0x1d, 0x0a, 0x0a, 0x6d, 0x65, + 0x73, 0x73, 0x61, 0x67, 0x65, 0x5f, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, + 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x49, 0x64, 0x12, 0x4d, 0x0a, 0x0d, 0x68, 0x74, 0x74, + 0x70, 0x5f, 0x72, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, + 0x32, 0x28, 0x2e, 0x63, 0x61, 0x73, 0x74, 0x61, 0x69, 0x2e, 0x63, 0x6c, 0x6f, 0x75, 0x64, 0x2e, + 0x70, 0x72, 0x6f, 0x78, 0x79, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x2e, 0x48, 0x54, + 0x54, 0x50, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x52, 0x0c, 0x68, 0x74, 0x74, 0x70, + 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x42, 0x12, 0x0a, 0x10, 0x5f, 0x63, 0x6c, 0x69, + 0x65, 0x6e, 0x74, 0x5f, 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x22, 0x94, 0x01, 0x0a, + 0x11, 0x43, 0x6c, 0x6f, 0x75, 0x64, 0x50, 0x72, 0x6f, 0x78, 0x79, 0x52, 0x65, 0x71, 0x75, 0x65, + 0x73, 0x74, 0x12, 0x1d, 0x0a, 0x0a, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x5f, 0x69, 0x64, + 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x49, + 0x64, 0x12, 0x4f, 0x0a, 0x0c, 0x68, 0x74, 0x74, 0x70, 0x5f, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, + 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x27, 0x2e, 0x63, 0x61, 0x73, 0x74, 0x61, 0x69, 0x2e, 0x63, 0x6c, 0x6f, 0x75, 0x64, 0x2e, 0x70, 0x72, 0x6f, 0x78, 0x79, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x2e, 0x48, 0x54, 0x54, 0x50, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, + 0x48, 0x00, 0x52, 0x0b, 0x68, 0x74, 0x74, 0x70, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x88, + 0x01, 0x01, 0x42, 0x0f, 0x0a, 0x0d, 0x5f, 0x68, 0x74, 0x74, 0x70, 0x5f, 0x72, 0x65, 0x71, 0x75, + 0x65, 0x73, 0x74, 0x22, 0xea, 0x02, 0x0a, 0x18, 0x53, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x43, 0x6c, + 0x6f, 0x75, 0x64, 0x50, 0x72, 0x6f, 0x78, 0x79, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, + 0x12, 0x58, 0x0a, 0x0f, 0x63, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x5f, 0x6d, 0x65, 0x74, 0x61, 0x64, + 0x61, 0x74, 0x61, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2a, 0x2e, 0x63, 0x61, 0x73, 0x74, + 0x61, 0x69, 0x2e, 0x63, 0x6c, 0x6f, 0x75, 0x64, 0x2e, 0x70, 0x72, 0x6f, 0x78, 0x79, 0x2e, 0x76, + 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x2e, 0x43, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x4d, 0x65, 0x74, + 0x61, 0x64, 0x61, 0x74, 0x61, 0x48, 0x01, 0x52, 0x0e, 0x63, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x4d, + 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x88, 0x01, 0x01, 0x12, 0x1d, 0x0a, 0x0a, 0x6d, 0x65, + 0x73, 0x73, 0x61, 0x67, 0x65, 0x5f, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, + 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x49, 0x64, 0x12, 0x4c, 0x0a, 0x0c, 0x68, 0x74, 0x74, + 0x70, 0x5f, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, + 0x27, 0x2e, 0x63, 0x61, 0x73, 0x74, 0x61, 0x69, 0x2e, 0x63, 0x6c, 0x6f, 0x75, 0x64, 0x2e, 0x70, + 0x72, 0x6f, 0x78, 0x79, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x2e, 0x48, 0x54, 0x54, + 0x50, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x48, 0x00, 0x52, 0x0b, 0x68, 0x74, 0x74, 0x70, + 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x67, 0x0a, 0x15, 0x63, 0x6f, 0x6e, 0x66, 0x69, + 0x67, 0x75, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, + 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x30, 0x2e, 0x63, 0x61, 0x73, 0x74, 0x61, 0x69, 0x2e, + 0x63, 0x6c, 0x6f, 0x75, 0x64, 0x2e, 0x70, 0x72, 0x6f, 0x78, 0x79, 0x2e, 0x76, 0x31, 0x61, 0x6c, + 0x70, 0x68, 0x61, 0x2e, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x75, 0x72, 0x61, 0x74, 0x69, 0x6f, + 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x48, 0x00, 0x52, 0x14, 0x63, 0x6f, 0x6e, 0x66, + 0x69, 0x67, 0x75, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, + 0x42, 0x0a, 0x0a, 0x08, 0x72, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x42, 0x12, 0x0a, 0x10, + 0x5f, 0x63, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x5f, 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, + 0x22, 0x63, 0x0a, 0x14, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x75, 0x72, 0x61, 0x74, 0x69, 0x6f, + 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x1d, 0x0a, 0x0a, 0x6b, 0x65, 0x65, 0x70, + 0x5f, 0x61, 0x6c, 0x69, 0x76, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x09, 0x6b, 0x65, + 0x65, 0x70, 0x41, 0x6c, 0x69, 0x76, 0x65, 0x12, 0x2c, 0x0a, 0x12, 0x6b, 0x65, 0x65, 0x70, 0x5f, + 0x61, 0x6c, 0x69, 0x76, 0x65, 0x5f, 0x74, 0x69, 0x6d, 0x65, 0x6f, 0x75, 0x74, 0x18, 0x02, 0x20, + 0x01, 0x28, 0x03, 0x52, 0x10, 0x6b, 0x65, 0x65, 0x70, 0x41, 0x6c, 0x69, 0x76, 0x65, 0x54, 0x69, + 0x6d, 0x65, 0x6f, 0x75, 0x74, 0x22, 0x90, 0x02, 0x0a, 0x0b, 0x48, 0x54, 0x54, 0x50, 0x52, 0x65, + 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x16, 0x0a, 0x06, 0x6d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x18, + 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x6d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x12, 0x12, 0x0a, + 0x04, 0x70, 0x61, 0x74, 0x68, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x70, 0x61, 0x74, + 0x68, 0x12, 0x17, 0x0a, 0x04, 0x62, 0x6f, 0x64, 0x79, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0c, 0x48, + 0x00, 0x52, 0x04, 0x62, 0x6f, 0x64, 0x79, 0x88, 0x01, 0x01, 0x12, 0x4e, 0x0a, 0x07, 0x68, 0x65, + 0x61, 0x64, 0x65, 0x72, 0x73, 0x18, 0x04, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x34, 0x2e, 0x63, 0x61, + 0x73, 0x74, 0x61, 0x69, 0x2e, 0x63, 0x6c, 0x6f, 0x75, 0x64, 0x2e, 0x70, 0x72, 0x6f, 0x78, 0x79, + 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x2e, 0x48, 0x54, 0x54, 0x50, 0x52, 0x65, 0x71, + 0x75, 0x65, 0x73, 0x74, 0x2e, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x73, 0x45, 0x6e, 0x74, 0x72, + 0x79, 0x52, 0x07, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x73, 0x1a, 0x63, 0x0a, 0x0c, 0x48, 0x65, + 0x61, 0x64, 0x65, 0x72, 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, + 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x3d, 0x0a, 0x05, + 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x27, 0x2e, 0x63, 0x61, + 0x73, 0x74, 0x61, 0x69, 0x2e, 0x63, 0x6c, 0x6f, 0x75, 0x64, 0x2e, 0x70, 0x72, 0x6f, 0x78, 0x79, + 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x2e, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x56, + 0x61, 0x6c, 0x75, 0x65, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x42, + 0x07, 0x0a, 0x05, 0x5f, 0x62, 0x6f, 0x64, 0x79, 0x22, 0xa3, 0x02, 0x0a, 0x0c, 0x48, 0x54, 0x54, + 0x50, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x17, 0x0a, 0x04, 0x62, 0x6f, 0x64, + 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x48, 0x00, 0x52, 0x04, 0x62, 0x6f, 0x64, 0x79, 0x88, + 0x01, 0x01, 0x12, 0x19, 0x0a, 0x05, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, + 0x09, 0x48, 0x01, 0x52, 0x05, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x88, 0x01, 0x01, 0x12, 0x16, 0x0a, + 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x18, 0x03, 0x20, 0x01, 0x28, 0x03, 0x52, 0x06, 0x73, + 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x4f, 0x0a, 0x07, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x73, + 0x18, 0x04, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x35, 0x2e, 0x63, 0x61, 0x73, 0x74, 0x61, 0x69, 0x2e, + 0x63, 0x6c, 0x6f, 0x75, 0x64, 0x2e, 0x70, 0x72, 0x6f, 0x78, 0x79, 0x2e, 0x76, 0x31, 0x61, 0x6c, + 0x70, 0x68, 0x61, 0x2e, 0x48, 0x54, 0x54, 0x50, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x2e, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x07, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x73, 0x1a, 0x63, 0x0a, 0x0c, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, @@ -1117,77 +1016,61 @@ var file_proto_v1alpha_proxy_proto_rawDesc = []byte{ 0x2e, 0x63, 0x6c, 0x6f, 0x75, 0x64, 0x2e, 0x70, 0x72, 0x6f, 0x78, 0x79, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x2e, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x42, 0x07, 0x0a, 0x05, 0x5f, - 0x62, 0x6f, 0x64, 0x79, 0x22, 0xa3, 0x02, 0x0a, 0x0c, 0x48, 0x54, 0x54, 0x50, 0x52, 0x65, 0x73, - 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x17, 0x0a, 0x04, 0x62, 0x6f, 0x64, 0x79, 0x18, 0x01, 0x20, - 0x01, 0x28, 0x0c, 0x48, 0x00, 0x52, 0x04, 0x62, 0x6f, 0x64, 0x79, 0x88, 0x01, 0x01, 0x12, 0x19, - 0x0a, 0x05, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x48, 0x01, 0x52, - 0x05, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x88, 0x01, 0x01, 0x12, 0x16, 0x0a, 0x06, 0x73, 0x74, 0x61, - 0x74, 0x75, 0x73, 0x18, 0x03, 0x20, 0x01, 0x28, 0x03, 0x52, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, - 0x73, 0x12, 0x4f, 0x0a, 0x07, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x73, 0x18, 0x04, 0x20, 0x03, - 0x28, 0x0b, 0x32, 0x35, 0x2e, 0x63, 0x61, 0x73, 0x74, 0x61, 0x69, 0x2e, 0x63, 0x6c, 0x6f, 0x75, - 0x64, 0x2e, 0x70, 0x72, 0x6f, 0x78, 0x79, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x2e, - 0x48, 0x54, 0x54, 0x50, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x2e, 0x48, 0x65, 0x61, - 0x64, 0x65, 0x72, 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x07, 0x68, 0x65, 0x61, 0x64, 0x65, - 0x72, 0x73, 0x1a, 0x63, 0x0a, 0x0c, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x73, 0x45, 0x6e, 0x74, - 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, - 0x03, 0x6b, 0x65, 0x79, 0x12, 0x3d, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, - 0x01, 0x28, 0x0b, 0x32, 0x27, 0x2e, 0x63, 0x61, 0x73, 0x74, 0x61, 0x69, 0x2e, 0x63, 0x6c, 0x6f, + 0x62, 0x6f, 0x64, 0x79, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x22, 0x23, + 0x0a, 0x0b, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x14, 0x0a, + 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x01, 0x20, 0x03, 0x28, 0x09, 0x52, 0x05, 0x76, 0x61, + 0x6c, 0x75, 0x65, 0x22, 0xb5, 0x01, 0x0a, 0x12, 0x53, 0x65, 0x6e, 0x64, 0x54, 0x6f, 0x50, 0x72, + 0x6f, 0x78, 0x79, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x53, 0x0a, 0x0f, 0x63, 0x6c, + 0x69, 0x65, 0x6e, 0x74, 0x5f, 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x18, 0x01, 0x20, + 0x01, 0x28, 0x0b, 0x32, 0x2a, 0x2e, 0x63, 0x61, 0x73, 0x74, 0x61, 0x69, 0x2e, 0x63, 0x6c, 0x6f, 0x75, 0x64, 0x2e, 0x70, 0x72, 0x6f, 0x78, 0x79, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, - 0x2e, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x52, 0x05, 0x76, 0x61, - 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x42, 0x07, 0x0a, 0x05, 0x5f, 0x62, 0x6f, 0x64, 0x79, - 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x22, 0x23, 0x0a, 0x0b, 0x48, 0x65, - 0x61, 0x64, 0x65, 0x72, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, - 0x75, 0x65, 0x18, 0x01, 0x20, 0x03, 0x28, 0x09, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22, - 0xb5, 0x01, 0x0a, 0x12, 0x53, 0x65, 0x6e, 0x64, 0x54, 0x6f, 0x50, 0x72, 0x6f, 0x78, 0x79, 0x52, - 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x53, 0x0a, 0x0f, 0x63, 0x6c, 0x69, 0x65, 0x6e, 0x74, - 0x5f, 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, - 0x2a, 0x2e, 0x63, 0x61, 0x73, 0x74, 0x61, 0x69, 0x2e, 0x63, 0x6c, 0x6f, 0x75, 0x64, 0x2e, 0x70, - 0x72, 0x6f, 0x78, 0x79, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x2e, 0x43, 0x6c, 0x69, - 0x65, 0x6e, 0x74, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x52, 0x0e, 0x63, 0x6c, 0x69, - 0x65, 0x6e, 0x74, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x12, 0x4a, 0x0a, 0x0c, 0x68, - 0x74, 0x74, 0x70, 0x5f, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, - 0x0b, 0x32, 0x27, 0x2e, 0x63, 0x61, 0x73, 0x74, 0x61, 0x69, 0x2e, 0x63, 0x6c, 0x6f, 0x75, 0x64, - 0x2e, 0x70, 0x72, 0x6f, 0x78, 0x79, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x2e, 0x48, - 0x54, 0x54, 0x50, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x52, 0x0b, 0x68, 0x74, 0x74, 0x70, - 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x22, 0x7a, 0x0a, 0x13, 0x53, 0x65, 0x6e, 0x64, 0x54, - 0x6f, 0x50, 0x72, 0x6f, 0x78, 0x79, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x4d, - 0x0a, 0x0d, 0x68, 0x74, 0x74, 0x70, 0x5f, 0x72, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x18, - 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x28, 0x2e, 0x63, 0x61, 0x73, 0x74, 0x61, 0x69, 0x2e, 0x63, + 0x2e, 0x43, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x52, + 0x0e, 0x63, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x12, + 0x4a, 0x0a, 0x0c, 0x68, 0x74, 0x74, 0x70, 0x5f, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x18, + 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x27, 0x2e, 0x63, 0x61, 0x73, 0x74, 0x61, 0x69, 0x2e, 0x63, 0x6c, 0x6f, 0x75, 0x64, 0x2e, 0x70, 0x72, 0x6f, 0x78, 0x79, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, - 0x68, 0x61, 0x2e, 0x48, 0x54, 0x54, 0x50, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x52, - 0x0c, 0x68, 0x74, 0x74, 0x70, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x14, 0x0a, - 0x05, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x65, 0x72, - 0x72, 0x6f, 0x72, 0x22, 0x8c, 0x01, 0x0a, 0x0e, 0x43, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x4d, 0x65, - 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x12, 0x1d, 0x0a, 0x0a, 0x63, 0x6c, 0x75, 0x73, 0x74, 0x65, - 0x72, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x63, 0x6c, 0x75, 0x73, - 0x74, 0x65, 0x72, 0x49, 0x64, 0x12, 0x2c, 0x0a, 0x0f, 0x6f, 0x72, 0x67, 0x61, 0x6e, 0x69, 0x7a, - 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, - 0x52, 0x0e, 0x6f, 0x72, 0x67, 0x61, 0x6e, 0x69, 0x7a, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x49, 0x64, - 0x88, 0x01, 0x01, 0x12, 0x19, 0x0a, 0x08, 0x70, 0x6f, 0x64, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, - 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x70, 0x6f, 0x64, 0x4e, 0x61, 0x6d, 0x65, 0x42, 0x12, - 0x0a, 0x10, 0x5f, 0x6f, 0x72, 0x67, 0x61, 0x6e, 0x69, 0x7a, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x5f, - 0x69, 0x64, 0x32, 0x87, 0x02, 0x0a, 0x0d, 0x43, 0x6c, 0x6f, 0x75, 0x64, 0x50, 0x72, 0x6f, 0x78, - 0x79, 0x41, 0x50, 0x49, 0x12, 0x83, 0x01, 0x0a, 0x10, 0x53, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x43, - 0x6c, 0x6f, 0x75, 0x64, 0x50, 0x72, 0x6f, 0x78, 0x79, 0x12, 0x33, 0x2e, 0x63, 0x61, 0x73, 0x74, - 0x61, 0x69, 0x2e, 0x63, 0x6c, 0x6f, 0x75, 0x64, 0x2e, 0x70, 0x72, 0x6f, 0x78, 0x79, 0x2e, 0x76, - 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x2e, 0x53, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x43, 0x6c, 0x6f, - 0x75, 0x64, 0x50, 0x72, 0x6f, 0x78, 0x79, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x34, - 0x2e, 0x63, 0x61, 0x73, 0x74, 0x61, 0x69, 0x2e, 0x63, 0x6c, 0x6f, 0x75, 0x64, 0x2e, 0x70, 0x72, - 0x6f, 0x78, 0x79, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x2e, 0x53, 0x74, 0x72, 0x65, - 0x61, 0x6d, 0x43, 0x6c, 0x6f, 0x75, 0x64, 0x50, 0x72, 0x6f, 0x78, 0x79, 0x52, 0x65, 0x73, 0x70, - 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x28, 0x01, 0x30, 0x01, 0x12, 0x70, 0x0a, 0x0b, 0x53, 0x65, - 0x6e, 0x64, 0x54, 0x6f, 0x50, 0x72, 0x6f, 0x78, 0x79, 0x12, 0x2e, 0x2e, 0x63, 0x61, 0x73, 0x74, - 0x61, 0x69, 0x2e, 0x63, 0x6c, 0x6f, 0x75, 0x64, 0x2e, 0x70, 0x72, 0x6f, 0x78, 0x79, 0x2e, 0x76, - 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x2e, 0x53, 0x65, 0x6e, 0x64, 0x54, 0x6f, 0x50, 0x72, 0x6f, - 0x78, 0x79, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x2f, 0x2e, 0x63, 0x61, 0x73, 0x74, + 0x68, 0x61, 0x2e, 0x48, 0x54, 0x54, 0x50, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x52, 0x0b, + 0x68, 0x74, 0x74, 0x70, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x22, 0x7a, 0x0a, 0x13, 0x53, + 0x65, 0x6e, 0x64, 0x54, 0x6f, 0x50, 0x72, 0x6f, 0x78, 0x79, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, + 0x73, 0x65, 0x12, 0x4d, 0x0a, 0x0d, 0x68, 0x74, 0x74, 0x70, 0x5f, 0x72, 0x65, 0x73, 0x70, 0x6f, + 0x6e, 0x73, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x28, 0x2e, 0x63, 0x61, 0x73, 0x74, 0x61, 0x69, 0x2e, 0x63, 0x6c, 0x6f, 0x75, 0x64, 0x2e, 0x70, 0x72, 0x6f, 0x78, 0x79, 0x2e, 0x76, - 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x2e, 0x53, 0x65, 0x6e, 0x64, 0x54, 0x6f, 0x50, 0x72, 0x6f, - 0x78, 0x79, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x42, 0x49, 0x5a, 0x47, - 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x63, 0x61, 0x73, 0x74, 0x61, - 0x69, 0x2f, 0x63, 0x6c, 0x6f, 0x75, 0x64, 0x2d, 0x70, 0x72, 0x6f, 0x78, 0x79, 0x2f, 0x70, 0x72, - 0x6f, 0x74, 0x6f, 0x2f, 0x67, 0x65, 0x6e, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x76, 0x31, - 0x61, 0x6c, 0x70, 0x68, 0x61, 0x3b, 0x63, 0x6c, 0x6f, 0x75, 0x64, 0x70, 0x72, 0x6f, 0x78, 0x79, - 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x2e, 0x48, 0x54, 0x54, 0x50, 0x52, 0x65, 0x73, 0x70, 0x6f, + 0x6e, 0x73, 0x65, 0x52, 0x0c, 0x68, 0x74, 0x74, 0x70, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, + 0x65, 0x12, 0x14, 0x0a, 0x05, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, + 0x52, 0x05, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x22, 0xa6, 0x01, 0x0a, 0x0e, 0x43, 0x6c, 0x69, 0x65, + 0x6e, 0x74, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x12, 0x1d, 0x0a, 0x0a, 0x63, 0x6c, + 0x75, 0x73, 0x74, 0x65, 0x72, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, + 0x63, 0x6c, 0x75, 0x73, 0x74, 0x65, 0x72, 0x49, 0x64, 0x12, 0x2c, 0x0a, 0x0f, 0x6f, 0x72, 0x67, + 0x61, 0x6e, 0x69, 0x7a, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, + 0x28, 0x09, 0x48, 0x00, 0x52, 0x0e, 0x6f, 0x72, 0x67, 0x61, 0x6e, 0x69, 0x7a, 0x61, 0x74, 0x69, + 0x6f, 0x6e, 0x49, 0x64, 0x88, 0x01, 0x01, 0x12, 0x19, 0x0a, 0x08, 0x70, 0x6f, 0x64, 0x5f, 0x6e, + 0x61, 0x6d, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x70, 0x6f, 0x64, 0x4e, 0x61, + 0x6d, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x04, 0x20, + 0x01, 0x28, 0x09, 0x52, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x42, 0x12, 0x0a, 0x10, + 0x5f, 0x6f, 0x72, 0x67, 0x61, 0x6e, 0x69, 0x7a, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x69, 0x64, + 0x32, 0x87, 0x02, 0x0a, 0x0d, 0x43, 0x6c, 0x6f, 0x75, 0x64, 0x50, 0x72, 0x6f, 0x78, 0x79, 0x41, + 0x50, 0x49, 0x12, 0x83, 0x01, 0x0a, 0x10, 0x53, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x43, 0x6c, 0x6f, + 0x75, 0x64, 0x50, 0x72, 0x6f, 0x78, 0x79, 0x12, 0x33, 0x2e, 0x63, 0x61, 0x73, 0x74, 0x61, 0x69, + 0x2e, 0x63, 0x6c, 0x6f, 0x75, 0x64, 0x2e, 0x70, 0x72, 0x6f, 0x78, 0x79, 0x2e, 0x76, 0x31, 0x61, + 0x6c, 0x70, 0x68, 0x61, 0x2e, 0x53, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x43, 0x6c, 0x6f, 0x75, 0x64, + 0x50, 0x72, 0x6f, 0x78, 0x79, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x34, 0x2e, 0x63, + 0x61, 0x73, 0x74, 0x61, 0x69, 0x2e, 0x63, 0x6c, 0x6f, 0x75, 0x64, 0x2e, 0x70, 0x72, 0x6f, 0x78, + 0x79, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x2e, 0x53, 0x74, 0x72, 0x65, 0x61, 0x6d, + 0x43, 0x6c, 0x6f, 0x75, 0x64, 0x50, 0x72, 0x6f, 0x78, 0x79, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, + 0x73, 0x65, 0x22, 0x00, 0x28, 0x01, 0x30, 0x01, 0x12, 0x70, 0x0a, 0x0b, 0x53, 0x65, 0x6e, 0x64, + 0x54, 0x6f, 0x50, 0x72, 0x6f, 0x78, 0x79, 0x12, 0x2e, 0x2e, 0x63, 0x61, 0x73, 0x74, 0x61, 0x69, + 0x2e, 0x63, 0x6c, 0x6f, 0x75, 0x64, 0x2e, 0x70, 0x72, 0x6f, 0x78, 0x79, 0x2e, 0x76, 0x31, 0x61, + 0x6c, 0x70, 0x68, 0x61, 0x2e, 0x53, 0x65, 0x6e, 0x64, 0x54, 0x6f, 0x50, 0x72, 0x6f, 0x78, 0x79, + 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x2f, 0x2e, 0x63, 0x61, 0x73, 0x74, 0x61, 0x69, + 0x2e, 0x63, 0x6c, 0x6f, 0x75, 0x64, 0x2e, 0x70, 0x72, 0x6f, 0x78, 0x79, 0x2e, 0x76, 0x31, 0x61, + 0x6c, 0x70, 0x68, 0x61, 0x2e, 0x53, 0x65, 0x6e, 0x64, 0x54, 0x6f, 0x50, 0x72, 0x6f, 0x78, 0x79, + 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x42, 0x49, 0x5a, 0x47, 0x67, 0x69, + 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x63, 0x61, 0x73, 0x74, 0x61, 0x69, 0x2f, + 0x63, 0x6c, 0x6f, 0x75, 0x64, 0x2d, 0x70, 0x72, 0x6f, 0x78, 0x79, 0x2f, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x2f, 0x67, 0x65, 0x6e, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x76, 0x31, 0x61, 0x6c, + 0x70, 0x68, 0x61, 0x3b, 0x63, 0x6c, 0x6f, 0x75, 0x64, 0x70, 0x72, 0x6f, 0x78, 0x79, 0x76, 0x31, + 0x61, 0x6c, 0x70, 0x68, 0x61, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( @@ -1202,57 +1085,51 @@ func file_proto_v1alpha_proxy_proto_rawDescGZIP() []byte { return file_proto_v1alpha_proxy_proto_rawDescData } -var file_proto_v1alpha_proxy_proto_enumTypes = make([]protoimpl.EnumInfo, 1) -var file_proto_v1alpha_proxy_proto_msgTypes = make([]protoimpl.MessageInfo, 16) +var file_proto_v1alpha_proxy_proto_msgTypes = make([]protoimpl.MessageInfo, 15) var file_proto_v1alpha_proxy_proto_goTypes = []any{ - (ClientStats_Stats_Status)(0), // 0: castai.cloud.proxy.v1alpha.ClientStats.Stats.Status - (*StreamCloudProxyRequest)(nil), // 1: castai.cloud.proxy.v1alpha.StreamCloudProxyRequest - (*InitialCloudProxyRequest)(nil), // 2: castai.cloud.proxy.v1alpha.InitialCloudProxyRequest - (*ClientStats)(nil), // 3: castai.cloud.proxy.v1alpha.ClientStats - (*ClusterResponse)(nil), // 4: castai.cloud.proxy.v1alpha.ClusterResponse - (*CloudProxyRequest)(nil), // 5: castai.cloud.proxy.v1alpha.CloudProxyRequest - (*StreamCloudProxyResponse)(nil), // 6: castai.cloud.proxy.v1alpha.StreamCloudProxyResponse - (*ConfigurationRequest)(nil), // 7: castai.cloud.proxy.v1alpha.ConfigurationRequest - (*HTTPRequest)(nil), // 8: castai.cloud.proxy.v1alpha.HTTPRequest - (*HTTPResponse)(nil), // 9: castai.cloud.proxy.v1alpha.HTTPResponse - (*HeaderValue)(nil), // 10: castai.cloud.proxy.v1alpha.HeaderValue - (*SendToProxyRequest)(nil), // 11: castai.cloud.proxy.v1alpha.SendToProxyRequest - (*SendToProxyResponse)(nil), // 12: castai.cloud.proxy.v1alpha.SendToProxyResponse - (*ClientMetadata)(nil), // 13: castai.cloud.proxy.v1alpha.ClientMetadata - (*ClientStats_Stats)(nil), // 14: castai.cloud.proxy.v1alpha.ClientStats.Stats - nil, // 15: castai.cloud.proxy.v1alpha.HTTPRequest.HeadersEntry - nil, // 16: castai.cloud.proxy.v1alpha.HTTPResponse.HeadersEntry + (*StreamCloudProxyRequest)(nil), // 0: castai.cloud.proxy.v1alpha.StreamCloudProxyRequest + (*ClientStats)(nil), // 1: castai.cloud.proxy.v1alpha.ClientStats + (*ClusterResponse)(nil), // 2: castai.cloud.proxy.v1alpha.ClusterResponse + (*CloudProxyRequest)(nil), // 3: castai.cloud.proxy.v1alpha.CloudProxyRequest + (*StreamCloudProxyResponse)(nil), // 4: castai.cloud.proxy.v1alpha.StreamCloudProxyResponse + (*ConfigurationRequest)(nil), // 5: castai.cloud.proxy.v1alpha.ConfigurationRequest + (*HTTPRequest)(nil), // 6: castai.cloud.proxy.v1alpha.HTTPRequest + (*HTTPResponse)(nil), // 7: castai.cloud.proxy.v1alpha.HTTPResponse + (*HeaderValue)(nil), // 8: castai.cloud.proxy.v1alpha.HeaderValue + (*SendToProxyRequest)(nil), // 9: castai.cloud.proxy.v1alpha.SendToProxyRequest + (*SendToProxyResponse)(nil), // 10: castai.cloud.proxy.v1alpha.SendToProxyResponse + (*ClientMetadata)(nil), // 11: castai.cloud.proxy.v1alpha.ClientMetadata + (*ClientStats_Stats)(nil), // 12: castai.cloud.proxy.v1alpha.ClientStats.Stats + nil, // 13: castai.cloud.proxy.v1alpha.HTTPRequest.HeadersEntry + nil, // 14: castai.cloud.proxy.v1alpha.HTTPResponse.HeadersEntry } var file_proto_v1alpha_proxy_proto_depIdxs = []int32{ - 2, // 0: castai.cloud.proxy.v1alpha.StreamCloudProxyRequest.initial_request:type_name -> castai.cloud.proxy.v1alpha.InitialCloudProxyRequest - 3, // 1: castai.cloud.proxy.v1alpha.StreamCloudProxyRequest.client_stats:type_name -> castai.cloud.proxy.v1alpha.ClientStats - 4, // 2: castai.cloud.proxy.v1alpha.StreamCloudProxyRequest.response:type_name -> castai.cloud.proxy.v1alpha.ClusterResponse - 13, // 3: castai.cloud.proxy.v1alpha.InitialCloudProxyRequest.client_metadata:type_name -> castai.cloud.proxy.v1alpha.ClientMetadata - 13, // 4: castai.cloud.proxy.v1alpha.ClientStats.client_metadata:type_name -> castai.cloud.proxy.v1alpha.ClientMetadata - 14, // 5: castai.cloud.proxy.v1alpha.ClientStats.stats:type_name -> castai.cloud.proxy.v1alpha.ClientStats.Stats - 13, // 6: castai.cloud.proxy.v1alpha.ClusterResponse.client_metadata:type_name -> castai.cloud.proxy.v1alpha.ClientMetadata - 9, // 7: castai.cloud.proxy.v1alpha.ClusterResponse.http_response:type_name -> castai.cloud.proxy.v1alpha.HTTPResponse - 8, // 8: castai.cloud.proxy.v1alpha.CloudProxyRequest.http_request:type_name -> castai.cloud.proxy.v1alpha.HTTPRequest - 13, // 9: castai.cloud.proxy.v1alpha.StreamCloudProxyResponse.client_metadata:type_name -> castai.cloud.proxy.v1alpha.ClientMetadata - 8, // 10: castai.cloud.proxy.v1alpha.StreamCloudProxyResponse.http_request:type_name -> castai.cloud.proxy.v1alpha.HTTPRequest - 7, // 11: castai.cloud.proxy.v1alpha.StreamCloudProxyResponse.configuration_request:type_name -> castai.cloud.proxy.v1alpha.ConfigurationRequest - 15, // 12: castai.cloud.proxy.v1alpha.HTTPRequest.headers:type_name -> castai.cloud.proxy.v1alpha.HTTPRequest.HeadersEntry - 16, // 13: castai.cloud.proxy.v1alpha.HTTPResponse.headers:type_name -> castai.cloud.proxy.v1alpha.HTTPResponse.HeadersEntry - 13, // 14: castai.cloud.proxy.v1alpha.SendToProxyRequest.client_metadata:type_name -> castai.cloud.proxy.v1alpha.ClientMetadata - 8, // 15: castai.cloud.proxy.v1alpha.SendToProxyRequest.http_request:type_name -> castai.cloud.proxy.v1alpha.HTTPRequest - 9, // 16: castai.cloud.proxy.v1alpha.SendToProxyResponse.http_response:type_name -> castai.cloud.proxy.v1alpha.HTTPResponse - 0, // 17: castai.cloud.proxy.v1alpha.ClientStats.Stats.status:type_name -> castai.cloud.proxy.v1alpha.ClientStats.Stats.Status - 10, // 18: castai.cloud.proxy.v1alpha.HTTPRequest.HeadersEntry.value:type_name -> castai.cloud.proxy.v1alpha.HeaderValue - 10, // 19: castai.cloud.proxy.v1alpha.HTTPResponse.HeadersEntry.value:type_name -> castai.cloud.proxy.v1alpha.HeaderValue - 1, // 20: castai.cloud.proxy.v1alpha.CloudProxyAPI.StreamCloudProxy:input_type -> castai.cloud.proxy.v1alpha.StreamCloudProxyRequest - 11, // 21: castai.cloud.proxy.v1alpha.CloudProxyAPI.SendToProxy:input_type -> castai.cloud.proxy.v1alpha.SendToProxyRequest - 6, // 22: castai.cloud.proxy.v1alpha.CloudProxyAPI.StreamCloudProxy:output_type -> castai.cloud.proxy.v1alpha.StreamCloudProxyResponse - 12, // 23: castai.cloud.proxy.v1alpha.CloudProxyAPI.SendToProxy:output_type -> castai.cloud.proxy.v1alpha.SendToProxyResponse - 22, // [22:24] is the sub-list for method output_type - 20, // [20:22] is the sub-list for method input_type - 20, // [20:20] is the sub-list for extension type_name - 20, // [20:20] is the sub-list for extension extendee - 0, // [0:20] is the sub-list for field type_name + 1, // 0: castai.cloud.proxy.v1alpha.StreamCloudProxyRequest.client_stats:type_name -> castai.cloud.proxy.v1alpha.ClientStats + 2, // 1: castai.cloud.proxy.v1alpha.StreamCloudProxyRequest.response:type_name -> castai.cloud.proxy.v1alpha.ClusterResponse + 11, // 2: castai.cloud.proxy.v1alpha.ClientStats.client_metadata:type_name -> castai.cloud.proxy.v1alpha.ClientMetadata + 12, // 3: castai.cloud.proxy.v1alpha.ClientStats.stats:type_name -> castai.cloud.proxy.v1alpha.ClientStats.Stats + 11, // 4: castai.cloud.proxy.v1alpha.ClusterResponse.client_metadata:type_name -> castai.cloud.proxy.v1alpha.ClientMetadata + 7, // 5: castai.cloud.proxy.v1alpha.ClusterResponse.http_response:type_name -> castai.cloud.proxy.v1alpha.HTTPResponse + 6, // 6: castai.cloud.proxy.v1alpha.CloudProxyRequest.http_request:type_name -> castai.cloud.proxy.v1alpha.HTTPRequest + 11, // 7: castai.cloud.proxy.v1alpha.StreamCloudProxyResponse.client_metadata:type_name -> castai.cloud.proxy.v1alpha.ClientMetadata + 6, // 8: castai.cloud.proxy.v1alpha.StreamCloudProxyResponse.http_request:type_name -> castai.cloud.proxy.v1alpha.HTTPRequest + 5, // 9: castai.cloud.proxy.v1alpha.StreamCloudProxyResponse.configuration_request:type_name -> castai.cloud.proxy.v1alpha.ConfigurationRequest + 13, // 10: castai.cloud.proxy.v1alpha.HTTPRequest.headers:type_name -> castai.cloud.proxy.v1alpha.HTTPRequest.HeadersEntry + 14, // 11: castai.cloud.proxy.v1alpha.HTTPResponse.headers:type_name -> castai.cloud.proxy.v1alpha.HTTPResponse.HeadersEntry + 11, // 12: castai.cloud.proxy.v1alpha.SendToProxyRequest.client_metadata:type_name -> castai.cloud.proxy.v1alpha.ClientMetadata + 6, // 13: castai.cloud.proxy.v1alpha.SendToProxyRequest.http_request:type_name -> castai.cloud.proxy.v1alpha.HTTPRequest + 7, // 14: castai.cloud.proxy.v1alpha.SendToProxyResponse.http_response:type_name -> castai.cloud.proxy.v1alpha.HTTPResponse + 8, // 15: castai.cloud.proxy.v1alpha.HTTPRequest.HeadersEntry.value:type_name -> castai.cloud.proxy.v1alpha.HeaderValue + 8, // 16: castai.cloud.proxy.v1alpha.HTTPResponse.HeadersEntry.value:type_name -> castai.cloud.proxy.v1alpha.HeaderValue + 0, // 17: castai.cloud.proxy.v1alpha.CloudProxyAPI.StreamCloudProxy:input_type -> castai.cloud.proxy.v1alpha.StreamCloudProxyRequest + 9, // 18: castai.cloud.proxy.v1alpha.CloudProxyAPI.SendToProxy:input_type -> castai.cloud.proxy.v1alpha.SendToProxyRequest + 4, // 19: castai.cloud.proxy.v1alpha.CloudProxyAPI.StreamCloudProxy:output_type -> castai.cloud.proxy.v1alpha.StreamCloudProxyResponse + 10, // 20: castai.cloud.proxy.v1alpha.CloudProxyAPI.SendToProxy:output_type -> castai.cloud.proxy.v1alpha.SendToProxyResponse + 19, // [19:21] is the sub-list for method output_type + 17, // [17:19] is the sub-list for method input_type + 17, // [17:17] is the sub-list for extension type_name + 17, // [17:17] is the sub-list for extension extendee + 0, // [0:17] is the sub-list for field type_name } func init() { file_proto_v1alpha_proxy_proto_init() } @@ -1274,18 +1151,6 @@ func file_proto_v1alpha_proxy_proto_init() { } } file_proto_v1alpha_proxy_proto_msgTypes[1].Exporter = func(v any, i int) any { - switch v := v.(*InitialCloudProxyRequest); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_proto_v1alpha_proxy_proto_msgTypes[2].Exporter = func(v any, i int) any { switch v := v.(*ClientStats); i { case 0: return &v.state @@ -1297,7 +1162,7 @@ func file_proto_v1alpha_proxy_proto_init() { return nil } } - file_proto_v1alpha_proxy_proto_msgTypes[3].Exporter = func(v any, i int) any { + file_proto_v1alpha_proxy_proto_msgTypes[2].Exporter = func(v any, i int) any { switch v := v.(*ClusterResponse); i { case 0: return &v.state @@ -1309,7 +1174,7 @@ func file_proto_v1alpha_proxy_proto_init() { return nil } } - file_proto_v1alpha_proxy_proto_msgTypes[4].Exporter = func(v any, i int) any { + file_proto_v1alpha_proxy_proto_msgTypes[3].Exporter = func(v any, i int) any { switch v := v.(*CloudProxyRequest); i { case 0: return &v.state @@ -1321,7 +1186,7 @@ func file_proto_v1alpha_proxy_proto_init() { return nil } } - file_proto_v1alpha_proxy_proto_msgTypes[5].Exporter = func(v any, i int) any { + file_proto_v1alpha_proxy_proto_msgTypes[4].Exporter = func(v any, i int) any { switch v := v.(*StreamCloudProxyResponse); i { case 0: return &v.state @@ -1333,7 +1198,7 @@ func file_proto_v1alpha_proxy_proto_init() { return nil } } - file_proto_v1alpha_proxy_proto_msgTypes[6].Exporter = func(v any, i int) any { + file_proto_v1alpha_proxy_proto_msgTypes[5].Exporter = func(v any, i int) any { switch v := v.(*ConfigurationRequest); i { case 0: return &v.state @@ -1345,7 +1210,7 @@ func file_proto_v1alpha_proxy_proto_init() { return nil } } - file_proto_v1alpha_proxy_proto_msgTypes[7].Exporter = func(v any, i int) any { + file_proto_v1alpha_proxy_proto_msgTypes[6].Exporter = func(v any, i int) any { switch v := v.(*HTTPRequest); i { case 0: return &v.state @@ -1357,7 +1222,7 @@ func file_proto_v1alpha_proxy_proto_init() { return nil } } - file_proto_v1alpha_proxy_proto_msgTypes[8].Exporter = func(v any, i int) any { + file_proto_v1alpha_proxy_proto_msgTypes[7].Exporter = func(v any, i int) any { switch v := v.(*HTTPResponse); i { case 0: return &v.state @@ -1369,7 +1234,7 @@ func file_proto_v1alpha_proxy_proto_init() { return nil } } - file_proto_v1alpha_proxy_proto_msgTypes[9].Exporter = func(v any, i int) any { + file_proto_v1alpha_proxy_proto_msgTypes[8].Exporter = func(v any, i int) any { switch v := v.(*HeaderValue); i { case 0: return &v.state @@ -1381,7 +1246,7 @@ func file_proto_v1alpha_proxy_proto_init() { return nil } } - file_proto_v1alpha_proxy_proto_msgTypes[10].Exporter = func(v any, i int) any { + file_proto_v1alpha_proxy_proto_msgTypes[9].Exporter = func(v any, i int) any { switch v := v.(*SendToProxyRequest); i { case 0: return &v.state @@ -1393,7 +1258,7 @@ func file_proto_v1alpha_proxy_proto_init() { return nil } } - file_proto_v1alpha_proxy_proto_msgTypes[11].Exporter = func(v any, i int) any { + file_proto_v1alpha_proxy_proto_msgTypes[10].Exporter = func(v any, i int) any { switch v := v.(*SendToProxyResponse); i { case 0: return &v.state @@ -1405,7 +1270,7 @@ func file_proto_v1alpha_proxy_proto_init() { return nil } } - file_proto_v1alpha_proxy_proto_msgTypes[12].Exporter = func(v any, i int) any { + file_proto_v1alpha_proxy_proto_msgTypes[11].Exporter = func(v any, i int) any { switch v := v.(*ClientMetadata); i { case 0: return &v.state @@ -1417,7 +1282,7 @@ func file_proto_v1alpha_proxy_proto_init() { return nil } } - file_proto_v1alpha_proxy_proto_msgTypes[13].Exporter = func(v any, i int) any { + file_proto_v1alpha_proxy_proto_msgTypes[12].Exporter = func(v any, i int) any { switch v := v.(*ClientStats_Stats); i { case 0: return &v.state @@ -1431,29 +1296,30 @@ func file_proto_v1alpha_proxy_proto_init() { } } file_proto_v1alpha_proxy_proto_msgTypes[0].OneofWrappers = []any{ - (*StreamCloudProxyRequest_InitialRequest)(nil), (*StreamCloudProxyRequest_ClientStats)(nil), (*StreamCloudProxyRequest_Response)(nil), } + file_proto_v1alpha_proxy_proto_msgTypes[2].OneofWrappers = []any{} file_proto_v1alpha_proxy_proto_msgTypes[3].OneofWrappers = []any{} - file_proto_v1alpha_proxy_proto_msgTypes[4].OneofWrappers = []any{} - file_proto_v1alpha_proxy_proto_msgTypes[5].OneofWrappers = []any{} + file_proto_v1alpha_proxy_proto_msgTypes[4].OneofWrappers = []any{ + (*StreamCloudProxyResponse_HttpRequest)(nil), + (*StreamCloudProxyResponse_ConfigurationRequest)(nil), + } + file_proto_v1alpha_proxy_proto_msgTypes[6].OneofWrappers = []any{} file_proto_v1alpha_proxy_proto_msgTypes[7].OneofWrappers = []any{} - file_proto_v1alpha_proxy_proto_msgTypes[8].OneofWrappers = []any{} - file_proto_v1alpha_proxy_proto_msgTypes[12].OneofWrappers = []any{} + file_proto_v1alpha_proxy_proto_msgTypes[11].OneofWrappers = []any{} type x struct{} out := protoimpl.TypeBuilder{ File: protoimpl.DescBuilder{ GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: file_proto_v1alpha_proxy_proto_rawDesc, - NumEnums: 1, - NumMessages: 16, + NumEnums: 0, + NumMessages: 15, NumExtensions: 0, NumServices: 1, }, GoTypes: file_proto_v1alpha_proxy_proto_goTypes, DependencyIndexes: file_proto_v1alpha_proxy_proto_depIdxs, - EnumInfos: file_proto_v1alpha_proxy_proto_enumTypes, MessageInfos: file_proto_v1alpha_proxy_proto_msgTypes, }.Build() File_proto_v1alpha_proxy_proto = out.File diff --git a/proto/v1alpha/proxy.proto b/proto/v1alpha/proxy.proto index 3db2f15..64be4d1 100644 --- a/proto/v1alpha/proxy.proto +++ b/proto/v1alpha/proxy.proto @@ -19,48 +19,31 @@ service CloudProxyAPI { message StreamCloudProxyRequest { oneof request { - // Initial request to establish the connection. - InitialCloudProxyRequest initial_request = 1; ClientStats client_stats = 2; ClusterResponse response = 3; } } -message InitialCloudProxyRequest { - ClientMetadata client_metadata = 1; - string version = 2; -} - - message ClientStats { ClientMetadata client_metadata = 1; message Stats { - // Status of the cluster client. - enum Status { - UNKNOWN = 0; - OK = 1; - CLOSING = 2; - } - Status status = 2; - - int64 timestamp = 3; + int64 timestamp = 2; // The total number of RPCs that started. - int64 num_calls_started = 4; + int64 num_calls_started = 3; // The total number of RPCs that finished. - int64 num_calls_finished = 5; + int64 num_calls_finished = 4; // The total number of RPCs that failed to reach a server except dropped RPCs. - int64 num_calls_finished_with_client_failed_to_send = 6; + int64 num_calls_finished_with_client_failed_to_send = 5; // The total number of RPCs that finished and are known to have been received // by a server. - int64 num_calls_finished_known_received = 7; + int64 num_calls_finished_known_received = 6; } Stats stats = 2; } - message ClusterResponse { optional ClientMetadata client_metadata = 1; string message_id = 2; @@ -68,15 +51,17 @@ message ClusterResponse { } message CloudProxyRequest { - string message_id = 3; - optional HTTPRequest http_request = 4; + string message_id = 1; + optional HTTPRequest http_request = 2; } message StreamCloudProxyResponse { optional ClientMetadata client_metadata = 1; string message_id = 2; - optional HTTPRequest http_request = 3; - optional ConfigurationRequest configuration_request = 4; + oneof response { + HTTPRequest http_request = 3; + ConfigurationRequest configuration_request = 4; + } } message ConfigurationRequest { @@ -116,4 +101,5 @@ message ClientMetadata { string cluster_id = 1; optional string organization_id = 2; string pod_name = 3; + string version = 4; } From 1df4620c524f0e171c380ac04f89450b1bacc1d4 Mon Sep 17 00:00:00 2001 From: Valentyna Bukhalova Date: Tue, 1 Oct 2024 11:23:37 +0200 Subject: [PATCH 12/29] fix races --- internal/e2etest/roundtripper.go | 30 +++++++++++++++-------------- internal/proxy/client.go | 33 ++++++++++++++++---------------- internal/proxy/client_test.go | 8 ++------ 3 files changed, 35 insertions(+), 36 deletions(-) diff --git a/internal/e2etest/roundtripper.go b/internal/e2etest/roundtripper.go index 40d2736..6b61a70 100644 --- a/internal/e2etest/roundtripper.go +++ b/internal/e2etest/roundtripper.go @@ -32,20 +32,22 @@ func (p *HTTPOverGrpcRoundTripper) RoundTrip(request *http.Request) (*http.Respo protoReq := &cloudproxyv1alpha.StreamCloudProxyResponse{ MessageId: requestID, - HttpRequest: &cloudproxyv1alpha.HTTPRequest{ - Method: request.Method, - Path: request.URL.String(), - Headers: headers, - Body: func() []byte { - if request.Body == nil { - return []byte{} - } - body, err := io.ReadAll(request.Body) - if err != nil { - panic(fmt.Sprintf("Failed to read body: %v", err)) - } - return body - }(), + Response: &cloudproxyv1alpha.StreamCloudProxyResponse_HttpRequest{ + HttpRequest: &cloudproxyv1alpha.HTTPRequest{ + Method: request.Method, + Path: request.URL.String(), + Headers: headers, + Body: func() []byte { + if request.Body == nil { + return []byte{} + } + body, err := io.ReadAll(request.Body) + if err != nil { + panic(fmt.Sprintf("Failed to read body: %v", err)) + } + return body + }(), + }, }, } waiter, err := p.dispatcher.SendRequest(protoReq) diff --git a/internal/proxy/client.go b/internal/proxy/client.go index 36b5f84..777c5ca 100644 --- a/internal/proxy/client.go +++ b/internal/proxy/client.go @@ -36,6 +36,8 @@ type CloudClient interface { type Client struct { cfg *config.Config + sendCh chan *cloudproxyv1alpha.StreamCloudProxyRequest + cloudClient CloudClient log *logrus.Logger podName string @@ -57,6 +59,7 @@ type Client struct { func New(cloudClient CloudClient, logger *logrus.Logger, version string, cfg *config.Config) *Client { c := &Client{ cfg: cfg, + sendCh: make(chan *cloudproxyv1alpha.StreamCloudProxyRequest, 100), cloudClient: cloudClient, log: logger, podName: cfg.PodMetadata.PodName, @@ -70,6 +73,8 @@ func New(cloudClient CloudClient, logger *logrus.Logger, version string, cfg *co } func (c *Client) Run(ctx context.Context) error { + defer close(c.sendCh) + authCtx := metadata.NewOutgoingContext(ctx, metadata.Pairs( "authorization", fmt.Sprintf("Token %s", c.cfg.CastAI.APIKey), )) @@ -160,13 +165,10 @@ func (c *Client) prepareAndRun(ctx context.Context) error { } func (c *Client) sendAndReceive(ctx context.Context, stream cloudproxyv1alpha.CloudProxyAPI_StreamCloudProxyClient) error { - eg, egctx := errgroup.WithContext(ctx) - - sendCh := make(chan *cloudproxyv1alpha.StreamCloudProxyRequest, 10) - defer close(sendCh) + eg, egCtx := errgroup.WithContext(ctx) eg.Go(func() error { - err := c.sendKeepAlive(egctx, stream, sendCh) + err := c.sendKeepAlive(egCtx, stream) if err != nil { c.log.Errorf("stopping keep-alive loop: %v", err) } @@ -174,7 +176,7 @@ func (c *Client) sendAndReceive(ctx context.Context, stream cloudproxyv1alpha.Cl }) eg.Go(func() error { - err := c.receive(egctx, stream, sendCh) + err := c.receive(egCtx, stream) if err != nil { c.log.Errorf("stopping receive loop: %v", err) } @@ -183,7 +185,7 @@ func (c *Client) sendAndReceive(ctx context.Context, stream cloudproxyv1alpha.Cl // send loop is separate because it can block on sending messages. go func() { - err := c.send(egctx, stream, sendCh) + err := c.send(egCtx, stream) if err != nil { c.log.Errorf("stopped send loop: %v", err) } @@ -197,7 +199,7 @@ func (c *Client) sendAndReceive(ctx context.Context, stream cloudproxyv1alpha.Cl return err } -func (c *Client) send(ctx context.Context, stream cloudproxyv1alpha.CloudProxyAPI_StreamCloudProxyClient, sendCh chan *cloudproxyv1alpha.StreamCloudProxyRequest) error { +func (c *Client) send(ctx context.Context, stream cloudproxyv1alpha.CloudProxyAPI_StreamCloudProxyClient) error { defer func() { c.log.Info("Closing send channel") _ = stream.CloseSend() @@ -209,7 +211,7 @@ func (c *Client) send(ctx context.Context, stream cloudproxyv1alpha.CloudProxyAP return ctx.Err() case <-stream.Context().Done(): return fmt.Errorf("stream closed %w", stream.Context().Err()) - case req := <-sendCh: + case req := <-c.sendCh: c.log.Printf("Sending message to stream %v len=%v", req.GetResponse().GetMessageId(), len(req.GetResponse().GetHttpResponse().GetBody())) if err := stream.Send(req); err != nil { c.log.WithError(err).Warn("failed to send message to stream") @@ -225,7 +227,7 @@ func (c *Client) send(ctx context.Context, stream cloudproxyv1alpha.CloudProxyAP } } -func (c *Client) receive(ctx context.Context, stream cloudproxyv1alpha.CloudProxyAPI_StreamCloudProxyClient, respCh chan<- *cloudproxyv1alpha.StreamCloudProxyRequest) error { +func (c *Client) receive(ctx context.Context, stream cloudproxyv1alpha.CloudProxyAPI_StreamCloudProxyClient) error { for { select { case <-ctx.Done(): @@ -249,11 +251,11 @@ func (c *Client) receive(ctx context.Context, stream cloudproxyv1alpha.CloudProx c.lastSeenReceive.Store(time.Now().UnixNano()) c.log.Debugf("Handling message from castai") - go c.handleMessage(ctx, in, respCh) + go c.handleMessage(ctx, in) } } -func (c *Client) handleMessage(ctx context.Context, in *cloudproxyv1alpha.StreamCloudProxyResponse, respCh chan<- *cloudproxyv1alpha.StreamCloudProxyRequest) { +func (c *Client) handleMessage(ctx context.Context, in *cloudproxyv1alpha.StreamCloudProxyResponse) { if in == nil { c.log.Error("nil message") return @@ -279,11 +281,10 @@ func (c *Client) handleMessage(ctx context.Context, in *cloudproxyv1alpha.Stream case <-ctx.Done(): return - case respCh <- &cloudproxyv1alpha.StreamCloudProxyRequest{ + case c.sendCh <- &cloudproxyv1alpha.StreamCloudProxyRequest{ Request: &cloudproxyv1alpha.StreamCloudProxyRequest_Response{ Response: &cloudproxyv1alpha.ClusterResponse{ ClientMetadata: &cloudproxyv1alpha.ClientMetadata{ - PodName: c.streamRuntimeName, ClusterId: c.clusterID, }, MessageId: in.GetMessageId(), @@ -352,7 +353,7 @@ func (c *Client) isAlive() error { return nil } -func (c *Client) sendKeepAlive(ctx context.Context, stream cloudproxyv1alpha.CloudProxyAPI_StreamCloudProxyClient, sendCh chan<- *cloudproxyv1alpha.StreamCloudProxyRequest) error { +func (c *Client) sendKeepAlive(ctx context.Context, stream cloudproxyv1alpha.CloudProxyAPI_StreamCloudProxyClient) error { ticker := time.NewTimer(time.Duration(c.keepAlive.Load())) defer ticker.Stop() @@ -367,7 +368,7 @@ func (c *Client) sendKeepAlive(ctx context.Context, stream cloudproxyv1alpha.Clo ticker.Reset(time.Duration(c.keepAlive.Load())) } else { select { - case sendCh <- &cloudproxyv1alpha.StreamCloudProxyRequest{ + case c.sendCh <- &cloudproxyv1alpha.StreamCloudProxyRequest{ Request: &cloudproxyv1alpha.StreamCloudProxyRequest_ClientStats{ ClientStats: &cloudproxyv1alpha.ClientStats{ ClientMetadata: &cloudproxyv1alpha.ClientMetadata{ diff --git a/internal/proxy/client_test.go b/internal/proxy/client_test.go index 2572c99..0a91cc3 100644 --- a/internal/proxy/client_test.go +++ b/internal/proxy/client_test.go @@ -280,12 +280,7 @@ func TestClient_handleMessage(t *testing.T) { tt.args.tuneMockStream(stream) } - msgStream := make(chan *cloudproxyv1alpha.StreamCloudProxyRequest) - go func() { - <-msgStream - }() - - c.handleMessage(context.Background(), tt.args.in, msgStream) + c.handleMessage(context.Background(), tt.args.in) require.Equal(t, tt.wantKeepAlive, c.keepAlive.Load(), "keepAlive: %v", c.keepAlive.Load()) require.Equal(t, tt.wantKeepAliveTimeout, c.keepAliveTimeout.Load(), "keepAliveTimeout: %v", c.keepAliveTimeout.Load()) require.Equal(t, tt.wantErrCount, c.errCount.Load(), "errCount: %v", c.errCount.Load()) @@ -534,6 +529,7 @@ func TestClient_sendAndReceive(t *testing.T) { if tt.args.tuneMockStream != nil { tt.args.tuneMockStream(stream) } + if err := c.sendAndReceive(tt.args.ctx(), stream); (err != nil) != tt.wantErr { t.Errorf("run() error = %v, wantErr %v", err, tt.wantErr) } From fc8ff9b17bd070548afaa88122541bad2790ce7f Mon Sep 17 00:00:00 2001 From: Valentyna Bukhalova Date: Tue, 1 Oct 2024 11:37:56 +0200 Subject: [PATCH 13/29] fix --- internal/proxy/client.go | 1 + 1 file changed, 1 insertion(+) diff --git a/internal/proxy/client.go b/internal/proxy/client.go index 777c5ca..abdf125 100644 --- a/internal/proxy/client.go +++ b/internal/proxy/client.go @@ -285,6 +285,7 @@ func (c *Client) handleMessage(ctx context.Context, in *cloudproxyv1alpha.Stream Request: &cloudproxyv1alpha.StreamCloudProxyRequest_Response{ Response: &cloudproxyv1alpha.ClusterResponse{ ClientMetadata: &cloudproxyv1alpha.ClientMetadata{ + PodName: c.streamRuntimeName, ClusterId: c.clusterID, }, MessageId: in.GetMessageId(), From 9bcc139de3c86aea12cfa180838ac7e6afd535ee Mon Sep 17 00:00:00 2001 From: Valentyna Bukhalova Date: Fri, 27 Sep 2024 16:25:45 +0200 Subject: [PATCH 14/29] add timeouts and return --- cmd/proxy/main.go | 3 ++- internal/proxy/client.go | 21 +++++++++++---------- 2 files changed, 13 insertions(+), 11 deletions(-) diff --git a/cmd/proxy/main.go b/cmd/proxy/main.go index 85f22b5..a77db83 100644 --- a/cmd/proxy/main.go +++ b/cmd/proxy/main.go @@ -54,8 +54,9 @@ func main() { MaxDelay: 5 * time.Second, Multiplier: 1.2, }, + MinConnectTimeout: 10 * time.Second, } - dialOpts = append(dialOpts, grpc.WithConnectParams(connectParams)) + dialOpts = append(dialOpts, grpc.WithConnectParams(connectParams), grpc.WithIdleTimeout(cfg.KeepAliveTimeout)) if cfg.UseCompression { dialOpts = append(dialOpts, grpc.WithDefaultCallOptions( diff --git a/internal/proxy/client.go b/internal/proxy/client.go index 35439b1..3abb139 100644 --- a/internal/proxy/client.go +++ b/internal/proxy/client.go @@ -81,14 +81,7 @@ func (c *Client) Run(ctx context.Context) error { return streamCtx.Err() case <-t.C: c.log.Info("Starting proxy client") - stream, closeStream, err := c.getStream(streamCtx) - if err != nil { - c.log.Errorf("Could not get stream, restarting proxy client in %vs: %v", time.Duration(c.keepAlive.Load()).Seconds(), err) - t.Reset(time.Duration(c.keepAlive.Load())) - continue - } - - err = c.run(streamCtx, stream, closeStream) + err := c.run(streamCtx) if err != nil { c.log.Errorf("Restarting proxy client in %vs: due to error: %v", time.Duration(c.keepAlive.Load()).Seconds(), err) t.Reset(time.Duration(c.keepAlive.Load())) @@ -139,10 +132,17 @@ func (c *Client) sendInitialRequest(stream cloudproxyv1alpha.CloudProxyAPI_Strea return nil } -func (c *Client) run(ctx context.Context, stream cloudproxyv1alpha.CloudProxyAPI_StreamCloudProxyClient, closeStream func()) error { +func (c *Client) run(ctx context.Context) error { + ctx, cancel := context.WithCancel(ctx) + defer cancel() + + stream, closeStream, err := c.getStream(ctx) + if err != nil { + return fmt.Errorf("c.getStream: %w", err) + } defer closeStream() - err := c.sendInitialRequest(stream) + err = c.sendInitialRequest(stream) if err != nil { return fmt.Errorf("c.Connect: %w", err) } @@ -195,6 +195,7 @@ func (c *Client) run(ctx context.Context, stream cloudproxyv1alpha.CloudProxyAPI case req := <-messageRespCh: if err := stream.Send(req); err != nil { c.log.WithError(err).Warn("failed to send message response") + return fmt.Errorf("stream.Send: %w", err) } case <-time.After(time.Duration(c.keepAlive.Load())): if !c.isAlive() { From e8b683edffe3a88e72292985fb49a56a494bf390 Mon Sep 17 00:00:00 2001 From: Damian Czaja Date: Fri, 27 Sep 2024 17:03:15 +0200 Subject: [PATCH 15/29] add logs --- internal/proxy/client.go | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/internal/proxy/client.go b/internal/proxy/client.go index 3abb139..cf606cd 100644 --- a/internal/proxy/client.go +++ b/internal/proxy/client.go @@ -213,16 +213,17 @@ func (c *Client) handleMessage(in *cloudproxyv1alpha.StreamCloudProxyResponse, r c.log.Error("nil message") return } + + c.lastSeen.Store(time.Now().UnixNano()) c.processConfigurationRequest(in) // skip processing http request if keep alive message. if in.GetMessageId() == KeepAliveMessageID { - c.lastSeen.Store(time.Now().UnixNano()) c.log.Debugf("Received keep-alive message from castai for %s", in.GetClientMetadata().GetClusterId()) return } - c.log.Debugf("Received request for proxying msg_id=%v from castai", in.GetMessageId()) + c.log.Debugf("Received request for proxying msg_id=%v path=%v from castai", in.GetMessageId(), in.GetHttpRequest().GetPath()) resp := c.processHTTPRequest(in.GetHttpRequest()) if resp.GetError() != "" { c.log.Errorf("Failed to proxy request msg_id=%v with %v", in.GetMessageId(), resp.GetError()) @@ -244,14 +245,17 @@ func (c *Client) handleMessage(in *cloudproxyv1alpha.StreamCloudProxyResponse, r } func (c *Client) processConfigurationRequest(in *cloudproxyv1alpha.StreamCloudProxyResponse) { - if in.ConfigurationRequest != nil { - if in.ConfigurationRequest.GetKeepAlive() != 0 { - c.keepAlive.Store(in.ConfigurationRequest.GetKeepAlive()) - } - if in.ConfigurationRequest.GetKeepAliveTimeout() != 0 { - c.keepAliveTimeout.Store(in.ConfigurationRequest.GetKeepAliveTimeout()) - } + if in.ConfigurationRequest == nil { + return } + + if in.ConfigurationRequest.GetKeepAlive() != 0 { + c.keepAlive.Store(in.ConfigurationRequest.GetKeepAlive()) + } + if in.ConfigurationRequest.GetKeepAliveTimeout() != 0 { + c.keepAliveTimeout.Store(in.ConfigurationRequest.GetKeepAliveTimeout()) + } + c.log.Debugf("Updated keep-alive configuration to %v and keep-alive timeout to %v", c.keepAlive.Load(), c.keepAliveTimeout.Load()) } From ce6d747b66f279ba935efd3bc70996b824bfd523 Mon Sep 17 00:00:00 2001 From: Damian Czaja Date: Fri, 27 Sep 2024 17:06:34 +0200 Subject: [PATCH 16/29] single send ch --- internal/proxy/client.go | 30 +++++++++++++++--------------- internal/proxy/client_test.go | 2 +- 2 files changed, 16 insertions(+), 16 deletions(-) diff --git a/internal/proxy/client.go b/internal/proxy/client.go index cf606cd..e1da8e7 100644 --- a/internal/proxy/client.go +++ b/internal/proxy/client.go @@ -147,12 +147,9 @@ func (c *Client) run(ctx context.Context) error { return fmt.Errorf("c.Connect: %w", err) } - keepAliveCh := make(chan *cloudproxyv1alpha.StreamCloudProxyRequest) - defer close(keepAliveCh) - go c.sendKeepAlive(stream, keepAliveCh) - - messageRespCh := make(chan *cloudproxyv1alpha.StreamCloudProxyRequest) - defer close(messageRespCh) + sendCh := make(chan *cloudproxyv1alpha.StreamCloudProxyRequest, 10) + defer close(sendCh) + go c.sendKeepAlive(stream, sendCh) go func() { for { @@ -178,7 +175,7 @@ func (c *Client) run(ctx context.Context) error { } c.log.Debugf("Handling message from castai") - go c.handleMessage(in, messageRespCh) + go c.handleMessage(stream.Context(), in, sendCh) } }() @@ -188,15 +185,11 @@ func (c *Client) run(ctx context.Context) error { return ctx.Err() case <-stream.Context().Done(): return fmt.Errorf("stream closed %w", stream.Context().Err()) - case req := <-keepAliveCh: + case req := <-sendCh: + c.log.Printf("Sending message to stream") if err := stream.Send(req); err != nil { c.log.WithError(err).Warn("failed to send keep alive") } - case req := <-messageRespCh: - if err := stream.Send(req); err != nil { - c.log.WithError(err).Warn("failed to send message response") - return fmt.Errorf("stream.Send: %w", err) - } case <-time.After(time.Duration(c.keepAlive.Load())): if !c.isAlive() { if err := c.lastSeenError.Load(); err != nil { @@ -208,7 +201,7 @@ func (c *Client) run(ctx context.Context) error { } } -func (c *Client) handleMessage(in *cloudproxyv1alpha.StreamCloudProxyResponse, respCh chan<- *cloudproxyv1alpha.StreamCloudProxyRequest) { +func (c *Client) handleMessage(ctx context.Context, in *cloudproxyv1alpha.StreamCloudProxyResponse, respCh chan<- *cloudproxyv1alpha.StreamCloudProxyRequest) { if in == nil { c.log.Error("nil message") return @@ -230,7 +223,12 @@ func (c *Client) handleMessage(in *cloudproxyv1alpha.StreamCloudProxyResponse, r } else { c.log.Debugf("Proxied request msg_id=%v, sending response to castai", in.GetMessageId()) } - respCh <- &cloudproxyv1alpha.StreamCloudProxyRequest{ + + select { + case <-ctx.Done(): + return + + case respCh <- &cloudproxyv1alpha.StreamCloudProxyRequest{ Request: &cloudproxyv1alpha.StreamCloudProxyRequest_Response{ Response: &cloudproxyv1alpha.ClusterResponse{ ClientMetadata: &cloudproxyv1alpha.ClientMetadata{ @@ -241,6 +239,8 @@ func (c *Client) handleMessage(in *cloudproxyv1alpha.StreamCloudProxyResponse, r HttpResponse: resp, }, }, + }: + return } } diff --git a/internal/proxy/client_test.go b/internal/proxy/client_test.go index cb5297c..099e92d 100644 --- a/internal/proxy/client_test.go +++ b/internal/proxy/client_test.go @@ -266,7 +266,7 @@ func TestClient_handleMessage(t *testing.T) { <-msgStream }() - c.handleMessage(tt.args.in, msgStream) + c.handleMessage(context.Background(), tt.args.in, msgStream) require.Equal(t, tt.wantLastSeenUpdated, c.lastSeen.Load() > 0, "lastSeen: %v", c.lastSeen.Load()) require.Equal(t, tt.wantKeepAlive, c.keepAlive.Load(), "keepAlive: %v", c.keepAlive.Load()) require.Equal(t, tt.wantKeepAliveTimeout, c.keepAliveTimeout.Load(), "keepAliveTimeout: %v", c.keepAliveTimeout.Load()) From f55120c2fcbcebe1003a31526f3a6b8c7427235e Mon Sep 17 00:00:00 2001 From: Damian Czaja Date: Fri, 27 Sep 2024 17:08:37 +0200 Subject: [PATCH 17/29] return on send err --- internal/proxy/client.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/internal/proxy/client.go b/internal/proxy/client.go index e1da8e7..f1aa36a 100644 --- a/internal/proxy/client.go +++ b/internal/proxy/client.go @@ -188,7 +188,8 @@ func (c *Client) run(ctx context.Context) error { case req := <-sendCh: c.log.Printf("Sending message to stream") if err := stream.Send(req); err != nil { - c.log.WithError(err).Warn("failed to send keep alive") + c.log.WithError(err).Warn("failed to send message to stream") + return fmt.Errorf("failed to send message to stream: %w", err) } case <-time.After(time.Duration(c.keepAlive.Load())): if !c.isAlive() { From 15045fd262774d0992f05035cb796601573f28d0 Mon Sep 17 00:00:00 2001 From: Valentyna Bukhalova Date: Fri, 27 Sep 2024 22:15:03 +0200 Subject: [PATCH 18/29] WIP --- cmd/proxy/main.go | 67 +------- internal/proxy/client.go | 284 +++++++++++++++++++++++----------- internal/proxy/client_test.go | 76 ++++++--- 3 files changed, 260 insertions(+), 167 deletions(-) diff --git a/cmd/proxy/main.go b/cmd/proxy/main.go index a77db83..d3bc2a8 100644 --- a/cmd/proxy/main.go +++ b/cmd/proxy/main.go @@ -1,6 +1,12 @@ package main import ( + "cloud-proxy/internal/cloud/gcp" + "cloud-proxy/internal/cloud/gcp/gcpauth" + "cloud-proxy/internal/config" + "cloud-proxy/internal/healthz" + "cloud-proxy/internal/proxy" + "context" "fmt" "path" @@ -8,17 +14,6 @@ import ( "time" "github.com/sirupsen/logrus" - "google.golang.org/grpc" - "google.golang.org/grpc/backoff" - "google.golang.org/grpc/credentials" - "google.golang.org/grpc/credentials/insecure" - "google.golang.org/grpc/encoding/gzip" - - "cloud-proxy/internal/cloud/gcp" - "cloud-proxy/internal/cloud/gcp/gcpauth" - "cloud-proxy/internal/config" - "cloud-proxy/internal/healthz" - "cloud-proxy/internal/proxy" ) var ( @@ -39,54 +34,8 @@ func main() { logger.WithError(err).Panicf("Failed to create GCP credentials source") } - dialOpts := make([]grpc.DialOption, 0) - if cfg.CastAI.DisableGRPCTLS { - // ONLY For testing purposes. - dialOpts = append(dialOpts, grpc.WithTransportCredentials(insecure.NewCredentials())) - } else { - dialOpts = append(dialOpts, grpc.WithTransportCredentials(credentials.NewTLS(nil))) - } - - connectParams := grpc.ConnectParams{ - Backoff: backoff.Config{ - BaseDelay: 2 * time.Second, - Jitter: 0.1, - MaxDelay: 5 * time.Second, - Multiplier: 1.2, - }, - MinConnectTimeout: 10 * time.Second, - } - dialOpts = append(dialOpts, grpc.WithConnectParams(connectParams), grpc.WithIdleTimeout(cfg.KeepAliveTimeout)) - - if cfg.UseCompression { - dialOpts = append(dialOpts, grpc.WithDefaultCallOptions( - grpc.UseCompressor(gzip.Name), - )) - } - - logger.Infof( - "Creating grpc channel against (%s) with connection config (%+v) and TLS enabled=%v", - cfg.CastAI.GrpcURL, - connectParams, - !cfg.CastAI.DisableGRPCTLS, - ) - conn, err := grpc.NewClient(cfg.CastAI.GrpcURL, dialOpts...) - if err != nil { - logger.Panicf("Failed to connect to server: %v", err) - panic(err) - } - - defer func(conn *grpc.ClientConn) { - logger.Info("Closing grpc connection") - err := conn.Close() - if err != nil { - logger.Panicf("Failed to close gRPC connection: %v", err) - panic(err) - } - }(conn) - - client := proxy.New(conn, gcp.New(tokenSource), logger, - cfg.GetPodName(), cfg.ClusterID, GetVersion(), cfg.CastAI.APIKey, cfg.KeepAlive, cfg.KeepAliveTimeout) + client := proxy.New(gcp.New(tokenSource), logger, + GetVersion(), &cfg) go startHealthServer(logger, cfg.HealthAddress) diff --git a/internal/proxy/client.go b/internal/proxy/client.go index f1aa36a..43c5c55 100644 --- a/internal/proxy/client.go +++ b/internal/proxy/client.go @@ -15,9 +15,16 @@ import ( "github.com/samber/lo" "github.com/sirupsen/logrus" "google.golang.org/grpc" + "google.golang.org/grpc/encoding/gzip" "google.golang.org/grpc/metadata" + "cloud-proxy/internal/config" cloudproxyv1alpha "cloud-proxy/proto/gen/proto/v1alpha" + + "golang.org/x/sync/errgroup" + "google.golang.org/grpc/backoff" + "google.golang.org/grpc/credentials" + "google.golang.org/grpc/credentials/insecure" ) const ( @@ -33,8 +40,8 @@ type CloudClient interface { } type Client struct { - grpcConn *grpc.ClientConn - apiKey string + cfg *config.Config + cloudClient CloudClient log *logrus.Logger podName string @@ -43,32 +50,33 @@ type Client struct { errCount atomic.Int64 processedCount atomic.Int64 - lastSeen atomic.Int64 - lastSeenError atomic.Pointer[error] + lastSeenReceive atomic.Int64 + lastSeenSend atomic.Int64 + keepAlive atomic.Int64 keepAliveTimeout atomic.Int64 - version string + + version string } -func New(grpcConn *grpc.ClientConn, cloudClient CloudClient, logger *logrus.Logger, podName, clusterID, version, apiKey string, keepalive, keepaliveTimeout time.Duration) *Client { +func New(cloudClient CloudClient, logger *logrus.Logger, version string, cfg *config.Config) *Client { c := &Client{ - grpcConn: grpcConn, - apiKey: apiKey, + cfg: cfg, cloudClient: cloudClient, log: logger, - podName: podName, - clusterID: clusterID, + podName: cfg.PodMetadata.PodName, + clusterID: cfg.ClusterID, version: version, } - c.keepAlive.Store(int64(keepalive)) - c.keepAliveTimeout.Store(int64(keepaliveTimeout)) + c.keepAlive.Store(int64(cfg.KeepAlive)) + c.keepAliveTimeout.Store(int64(cfg.KeepAliveTimeout)) return c } func (c *Client) Run(ctx context.Context) error { streamCtx := metadata.NewOutgoingContext(ctx, metadata.Pairs( - authorizationMetadataKey, fmt.Sprintf("Token %s", c.apiKey), + authorizationMetadataKey, fmt.Sprintf("Token %s", c.cfg.CastAI.APIKey), clusterIDMetadataKey, c.clusterID, podNameMetadataKey, c.podName, )) @@ -81,7 +89,7 @@ func (c *Client) Run(ctx context.Context) error { return streamCtx.Err() case <-t.C: c.log.Info("Starting proxy client") - err := c.run(streamCtx) + err := c.prepareAndRun(streamCtx) if err != nil { c.log.Errorf("Restarting proxy client in %vs: due to error: %v", time.Duration(c.keepAlive.Load()).Seconds(), err) t.Reset(time.Duration(c.keepAlive.Load())) @@ -92,19 +100,59 @@ func (c *Client) Run(ctx context.Context) error { func (c *Client) getStream(ctx context.Context) (cloudproxyv1alpha.CloudProxyAPI_StreamCloudProxyClient, func(), error) { c.log.Info("Connecting to castai") - apiClient := cloudproxyv1alpha.NewCloudProxyAPIClient(c.grpcConn) - stream, err := apiClient.StreamCloudProxy(ctx) + dialOpts := make([]grpc.DialOption, 0) + if c.cfg.CastAI.DisableGRPCTLS { + // ONLY For testing purposes. + dialOpts = append(dialOpts, grpc.WithTransportCredentials(insecure.NewCredentials())) + } else { + dialOpts = append(dialOpts, grpc.WithTransportCredentials(credentials.NewTLS(nil))) + } + + connectParams := grpc.ConnectParams{ + Backoff: backoff.Config{ + BaseDelay: 2 * time.Second, + Jitter: 0.1, + MaxDelay: 5 * time.Second, + Multiplier: 1.2, + }, + MinConnectTimeout: 2 * time.Minute, + } + dialOpts = append(dialOpts, grpc.WithConnectParams(connectParams)) + + if c.cfg.UseCompression { + dialOpts = append(dialOpts, grpc.WithDefaultCallOptions( + grpc.UseCompressor(gzip.Name), + )) + } + + c.log.Infof( + "Creating grpc channel against (%s) with connection config (%+v) and TLS enabled=%v", + c.cfg.CastAI.GrpcURL, + connectParams, + !c.cfg.CastAI.DisableGRPCTLS, + ) + + conn, err := grpc.NewClient(c.cfg.CastAI.GrpcURL, dialOpts...) if err != nil { - return nil, nil, fmt.Errorf("proxyCastAIClient.StreamCloudProxy: %w", err) + return nil, nil, fmt.Errorf("grpc.NewClient: %w", err) } - c.log.Info("Connected to castai, sending initial metadata") - return stream, func() { - err := stream.CloseSend() + cancelFunc := func() { + c.log.Info("Closing grpc connection") + err := conn.Close() if err != nil { - c.log.Errorf("error closing stream %v", err) + c.log.Errorf("error closing grpc connection %v", err) } - }, nil + } + + apiClient := cloudproxyv1alpha.NewCloudProxyAPIClient(conn) + stream, err := apiClient.StreamCloudProxy(ctx) + if err != nil { + return nil, cancelFunc, fmt.Errorf("proxyCastAIClient.StreamCloudProxy: %w", err) + } + + c.log.Info("Connected to castai, sending initial metadata") + return stream, cancelFunc, nil } func (c *Client) sendInitialRequest(stream cloudproxyv1alpha.CloudProxyAPI_StreamCloudProxyClient) error { @@ -124,59 +172,76 @@ func (c *Client) sendInitialRequest(stream cloudproxyv1alpha.CloudProxyAPI_Strea if err != nil { return fmt.Errorf("stream.Send: initial request %w", err) } - c.lastSeen.Store(time.Now().UnixNano()) - c.lastSeenError.Store(nil) + c.lastSeenReceive.Store(time.Now().UnixNano()) c.log.Info("Stream to castai started successfully") return nil } -func (c *Client) run(ctx context.Context) error { +func (c *Client) prepareAndRun(ctx context.Context) error { ctx, cancel := context.WithCancel(ctx) defer cancel() - stream, closeStream, err := c.getStream(ctx) + stream, closeConnection, err := c.getStream(ctx) if err != nil { return fmt.Errorf("c.getStream: %w", err) } - defer closeStream() + defer closeConnection() + + c.lastSeenReceive.Store(time.Now().UnixNano()) + c.lastSeenSend.Store(time.Now().UnixNano()) - err = c.sendInitialRequest(stream) + return c.sendAndReceive(ctx, stream) +} + +func (c *Client) sendAndReceive(ctx context.Context, stream cloudproxyv1alpha.CloudProxyAPI_StreamCloudProxyClient) error { + err := c.sendInitialRequest(stream) if err != nil { return fmt.Errorf("c.Connect: %w", err) } + eg, egctx := errgroup.WithContext(ctx) + sendCh := make(chan *cloudproxyv1alpha.StreamCloudProxyRequest, 10) defer close(sendCh) - go c.sendKeepAlive(stream, sendCh) - - go func() { - for { - select { - case <-ctx.Done(): - return - case <-stream.Context().Done(): - return - default: - if !c.isAlive() { - return - } - } - c.log.Debugf("Polling stream for messages") + eg.Go(func() error { + err := c.sendKeepAlive(egctx, stream, sendCh) + if err != nil { + c.log.Errorf("stopping keep-alive loop: %v", err) + } + return err + }) - in, err := stream.Recv() - if err != nil { - c.log.Errorf("stream.Recv: got error: %v", err) - c.lastSeen.Store(0) - c.lastSeenError.Store(&err) - return - } + eg.Go(func() error { + err := c.receive(egctx, stream, sendCh) + if err != nil { + c.log.Errorf("stopping receive loop: %v", err) + } + return err + }) - c.log.Debugf("Handling message from castai") - go c.handleMessage(stream.Context(), in, sendCh) + eg.Go(func() error { + err := c.send(egctx, stream, sendCh) + if err != nil { + c.log.Errorf("stopping send loop: %v", err) } + return err + }) + + err = eg.Wait() + if err != nil { + c.log.Errorf("sendAndReceive: closing with error: %v", err) + } + + return err +} + +func (c *Client) send(ctx context.Context, stream cloudproxyv1alpha.CloudProxyAPI_StreamCloudProxyClient, sendCh chan *cloudproxyv1alpha.StreamCloudProxyRequest) error { + defer func() { + c.log.Info("Closing send channel") + _ = stream.CloseSend() }() for { @@ -186,19 +251,45 @@ func (c *Client) run(ctx context.Context) error { case <-stream.Context().Done(): return fmt.Errorf("stream closed %w", stream.Context().Err()) case req := <-sendCh: - c.log.Printf("Sending message to stream") + c.log.Printf("Sending message to stream %v", req.GetResponse().GetMessageId()) if err := stream.Send(req); err != nil { c.log.WithError(err).Warn("failed to send message to stream") return fmt.Errorf("failed to send message to stream: %w", err) } + c.lastSeenSend.Store(time.Now().UnixNano()) + case <-time.After(time.Duration(c.keepAlive.Load())): - if !c.isAlive() { - if err := c.lastSeenError.Load(); err != nil { - return fmt.Errorf("received error: %w", *err) - } - return fmt.Errorf("last seen too old, closing stream") + if err := c.isAlive(); err != nil { + return err + } + } + } +} + +func (c *Client) receive(ctx context.Context, stream cloudproxyv1alpha.CloudProxyAPI_StreamCloudProxyClient, respCh chan<- *cloudproxyv1alpha.StreamCloudProxyRequest) error { + for { + select { + case <-ctx.Done(): + return fmt.Errorf("context ended with %w", ctx.Err()) + case <-stream.Context().Done(): + return fmt.Errorf("stream ended with %w", stream.Context().Err()) + default: + if err := c.isAlive(); err != nil { + return err } } + + c.log.Debugf("Polling stream for messages") + + in, err := stream.Recv() + if err != nil { + c.log.Errorf("stream.Recv: got error: %v", err) + c.lastSeenReceive.Store(0) + return fmt.Errorf("stream.Recv: %w", err) + } + + c.log.Debugf("Handling message from castai") + go c.handleMessage(stream.Context(), in, respCh) } } @@ -208,12 +299,12 @@ func (c *Client) handleMessage(ctx context.Context, in *cloudproxyv1alpha.Stream return } - c.lastSeen.Store(time.Now().UnixNano()) + c.lastSeenReceive.Store(time.Now().UnixNano()) c.processConfigurationRequest(in) // skip processing http request if keep alive message. if in.GetMessageId() == KeepAliveMessageID { - c.log.Debugf("Received keep-alive message from castai for %s", in.GetClientMetadata().GetClusterId()) + c.log.Debugf("Received keep-alive message from castai for %s", in.GetClientMetadata().GetPodName()) return } @@ -257,7 +348,7 @@ func (c *Client) processConfigurationRequest(in *cloudproxyv1alpha.StreamCloudPr c.keepAliveTimeout.Store(in.ConfigurationRequest.GetKeepAliveTimeout()) } - c.log.Debugf("Updated keep-alive configuration to %v and keep-alive timeout to %v", c.keepAlive.Load(), c.keepAliveTimeout.Load()) + c.log.Debugf("Updated keep-alive configuration to %v and keep-alive timeout to %v", time.Duration(c.keepAlive.Load()).Seconds(), time.Duration(c.keepAliveTimeout.Load()).Seconds()) } func (c *Client) processHTTPRequest(req *cloudproxyv1alpha.HTTPRequest) *cloudproxyv1alpha.HTTPResponse { @@ -284,45 +375,64 @@ func (c *Client) processHTTPRequest(req *cloudproxyv1alpha.HTTPRequest) *cloudpr return c.toResponse(resp) } -func (c *Client) isAlive() bool { - lastSeen := c.lastSeen.Load() +var errAlive = fmt.Errorf("client connection is not alive") + +func (c *Client) isAlive() error { + lastSeenReceive := c.lastSeenReceive.Load() + lastSeenSend := c.lastSeenSend.Load() + keepAliveTimeout := c.keepAliveTimeout.Load() + lastSeenReceiveDiff := time.Now().UnixNano() - lastSeenReceive + lastSeenSendDiff := time.Now().UnixNano() - lastSeenSend + + if lastSeenReceiveDiff > keepAliveTimeout || lastSeenSendDiff > keepAliveTimeout { + c.log.Warnf("last seen receive %v, last seen send %v", + time.Duration(lastSeenReceiveDiff).Seconds(), time.Duration(lastSeenSendDiff).Seconds()) + return errAlive + } - return time.Now().UnixNano()-lastSeen <= c.keepAliveTimeout.Load() + return nil } -func (c *Client) sendKeepAlive(stream cloudproxyv1alpha.CloudProxyAPI_StreamCloudProxyClient, sendCh chan<- *cloudproxyv1alpha.StreamCloudProxyRequest) { +func (c *Client) sendKeepAlive(ctx context.Context, stream cloudproxyv1alpha.CloudProxyAPI_StreamCloudProxyClient, sendCh chan<- *cloudproxyv1alpha.StreamCloudProxyRequest) error { ticker := time.NewTimer(time.Duration(c.keepAlive.Load())) defer ticker.Stop() c.log.Info("Starting keep-alive loop") + for { select { - case <-stream.Context().Done(): - c.log.Infof("Stopping keep-alive loop: stream ended with %v", stream.Context().Err()) - return + case <-ctx.Done(): + return fmt.Errorf("context ended with %w", ctx.Err()) case <-ticker.C: - if !c.isAlive() { - c.log.Info("Stopping keep-alive loop: client connection is not alive") - return - } - c.log.Debug("Sending keep-alive to castai") - - sendCh <- &cloudproxyv1alpha.StreamCloudProxyRequest{ - Request: &cloudproxyv1alpha.StreamCloudProxyRequest_ClientStats{ - ClientStats: &cloudproxyv1alpha.ClientStats{ - ClientMetadata: &cloudproxyv1alpha.ClientMetadata{ - PodName: c.podName, - ClusterId: c.clusterID, - }, - Stats: &cloudproxyv1alpha.ClientStats_Stats{ - Status: cloudproxyv1alpha.ClientStats_Stats_OK, - Timestamp: time.Now().UnixNano(), + if time.Now().UnixNano()-c.lastSeenSend.Load() <= c.keepAlive.Load()/2 { + ticker.Reset(time.Duration(c.keepAlive.Load())) + } else { + select { + case sendCh <- &cloudproxyv1alpha.StreamCloudProxyRequest{ + Request: &cloudproxyv1alpha.StreamCloudProxyRequest_ClientStats{ + ClientStats: &cloudproxyv1alpha.ClientStats{ + ClientMetadata: &cloudproxyv1alpha.ClientMetadata{ + PodName: c.podName, + ClusterId: c.clusterID, + }, + Stats: &cloudproxyv1alpha.ClientStats_Stats{ + Status: cloudproxyv1alpha.ClientStats_Stats_OK, + Timestamp: time.Now().UnixNano(), + }, }, }, - }, + }: + ticker.Reset(time.Duration(c.keepAlive.Load())) + + default: + if stream.Context().Err() != nil { + return fmt.Errorf("stream ended with %w", stream.Context().Err()) + } + if err := c.isAlive(); err != nil { + return err + } + } } - - ticker.Reset(time.Duration(c.keepAlive.Load())) } } } diff --git a/internal/proxy/client_test.go b/internal/proxy/client_test.go index 099e92d..b407bed 100644 --- a/internal/proxy/client_test.go +++ b/internal/proxy/client_test.go @@ -83,7 +83,14 @@ func TestClient_toResponse(t *testing.T) { tt := tt t.Run(tt.name, func(t *testing.T) { t.Parallel() - c := New(nil, nil, nil, "podName", "clusterID", "version", "apiKey", time.Second, time.Minute) + c := New(nil, logrus.New(), "version", &config.Config{ + ClusterID: "clusterID", + PodMetadata: config.PodMetadata{ + PodName: "podName", + }, + KeepAlive: time.Second, + KeepAliveTimeout: time.Minute, + }) got := c.toResponse(tt.args.resp) // diff := cmp.Diff(got, tt.want, protocmp.Transform()) // require.Empty(t, diff). @@ -146,7 +153,14 @@ func TestClient_toHTTPRequest(t *testing.T) { tt := tt t.Run(tt.name, func(t *testing.T) { t.Parallel() - c := New(nil, nil, nil, "podName", "clusterID", "version", "apiKey", time.Second, time.Minute) + c := New(nil, logrus.New(), "version", &config.Config{ + ClusterID: "clusterID", + PodMetadata: config.PodMetadata{ + PodName: "podName", + }, + KeepAlive: time.Second, + KeepAliveTimeout: time.Minute, + }) got, err := c.toHTTPRequest(tt.args.req) require.Equal(t, tt.wantErr, err != nil, err) if err != nil { @@ -255,7 +269,14 @@ func TestClient_handleMessage(t *testing.T) { if tt.fields.tuneMockCloudClient != nil { tt.fields.tuneMockCloudClient(cloudClient) } - c := New(nil, cloudClient, logrus.New(), "podName", "clusterID", "version", "apiKey", config.KeepAliveDefault, config.KeepAliveTimeoutDefault) + c := New(cloudClient, logrus.New(), "version", &config.Config{ + ClusterID: "clusterID", + PodMetadata: config.PodMetadata{ + PodName: "podName", + }, + KeepAlive: config.KeepAliveDefault, + KeepAliveTimeout: config.KeepAliveTimeoutDefault, + }) stream := mock_proxy.NewMockCloudProxyAPI_StreamCloudProxyClient(ctrl) if tt.args.tuneMockStream != nil { tt.args.tuneMockStream(stream) @@ -267,7 +288,7 @@ func TestClient_handleMessage(t *testing.T) { }() c.handleMessage(context.Background(), tt.args.in, msgStream) - require.Equal(t, tt.wantLastSeenUpdated, c.lastSeen.Load() > 0, "lastSeen: %v", c.lastSeen.Load()) + require.Equal(t, tt.wantLastSeenUpdated, c.lastSeenReceive.Load() > 0, "lastSeen: %v", c.lastSeenReceive.Load()) require.Equal(t, tt.wantKeepAlive, c.keepAlive.Load(), "keepAlive: %v", c.keepAlive.Load()) require.Equal(t, tt.wantKeepAliveTimeout, c.keepAliveTimeout.Load(), "keepAliveTimeout: %v", c.keepAliveTimeout.Load()) require.Equal(t, tt.wantErrCount, c.errCount.Load(), "errCount: %v", c.errCount.Load()) @@ -345,7 +366,14 @@ func TestClient_processHttpRequest(t *testing.T) { if tt.fields.tuneMockCloudClient != nil { tt.fields.tuneMockCloudClient(cloudClient) } - c := New(nil, cloudClient, logrus.New(), "podName", "clusterID", "version", "apiKey", time.Second, time.Minute) + c := New(cloudClient, logrus.New(), "version", &config.Config{ + ClusterID: "clusterID", + PodMetadata: config.PodMetadata{ + PodName: "podName", + }, + KeepAlive: time.Second, + KeepAliveTimeout: time.Minute, + }) if got := c.processHTTPRequest(tt.args.req); !reflect.DeepEqual(got, tt.want) { t.Errorf("processHttpRequest() = %v, want %v", got, tt.want) } @@ -422,7 +450,7 @@ func TestClient_processHttpRequest(t *testing.T) { // } //}. -func TestClient_run(t *testing.T) { +func TestClient_sendAndReceive(t *testing.T) { t.Parallel() type args struct { @@ -430,10 +458,9 @@ func TestClient_run(t *testing.T) { tuneMockStream func(m *mock_proxy.MockCloudProxyAPI_StreamCloudProxyClient) } tests := []struct { - name string - args args - wantErr bool - wantLastSeenUpdated bool + name string + args args + wantErr bool }{ { name: "send initial error", @@ -445,7 +472,7 @@ func TestClient_run(t *testing.T) { m.EXPECT().Send(gomock.Any()).Return(fmt.Errorf("test error")) }, }, - wantErr: true, + wantErr: false, }, { name: "context done", @@ -456,12 +483,15 @@ func TestClient_run(t *testing.T) { return ctx }, tuneMockStream: func(m *mock_proxy.MockCloudProxyAPI_StreamCloudProxyClient) { - m.EXPECT().Send(gomock.Any()).Return(nil).AnyTimes() // expected 0 or 1 times. - m.EXPECT().Context().Return(context.Background()).AnyTimes() // expected 0 or 1 times. + m.EXPECT().Send(gomock.Any()).Return(nil).AnyTimes() // expected 0 or 1 times. + m.EXPECT().Context().DoAndReturn(func() context.Context { + ctx, cancel := context.WithCancel(context.Background()) + cancel() + return ctx + }).AnyTimes() // expected 0 or 1 times. }, }, - wantLastSeenUpdated: true, - wantErr: true, + wantErr: true, }, { name: "stream not alive", @@ -475,8 +505,7 @@ func TestClient_run(t *testing.T) { m.EXPECT().Recv().Return(nil, fmt.Errorf("test error")) }, }, - wantLastSeenUpdated: false, - wantErr: true, + wantErr: true, }, } for _, tt := range tests { @@ -486,16 +515,21 @@ func TestClient_run(t *testing.T) { ctrl := gomock.NewController(t) defer ctrl.Finish() - c := New(nil, nil, logrus.New(), "podName", "clusterID", "version", "apiKey", time.Second, time.Second) + c := New(nil, logrus.New(), "version", &config.Config{ + ClusterID: "clusterID", + PodMetadata: config.PodMetadata{ + PodName: "podName", + }, + KeepAlive: time.Second, + KeepAliveTimeout: time.Minute, + }) stream := mock_proxy.NewMockCloudProxyAPI_StreamCloudProxyClient(ctrl) if tt.args.tuneMockStream != nil { tt.args.tuneMockStream(stream) } - if err := c.run(tt.args.ctx(), stream, func() {}); (err != nil) != tt.wantErr { + if err := c.sendAndReceive(tt.args.ctx(), stream); (err != nil) != tt.wantErr { t.Errorf("run() error = %v, wantErr %v", err, tt.wantErr) } - - require.Equal(t, tt.wantLastSeenUpdated, c.lastSeen.Load() > 0, "lastSeen: %v", c.lastSeen.Load()) }) } } From 5ee1623222e5757a320a5b2c8b499b3e2bcc2d97 Mon Sep 17 00:00:00 2001 From: Valentyna Bukhalova Date: Fri, 27 Sep 2024 22:37:29 +0200 Subject: [PATCH 19/29] fixed wait on send --- internal/proxy/client.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/internal/proxy/client.go b/internal/proxy/client.go index 43c5c55..50e30b3 100644 --- a/internal/proxy/client.go +++ b/internal/proxy/client.go @@ -222,13 +222,13 @@ func (c *Client) sendAndReceive(ctx context.Context, stream cloudproxyv1alpha.Cl return err }) - eg.Go(func() error { + // send loop is separate because it can block on sending messages. + go func() { err := c.send(egctx, stream, sendCh) if err != nil { - c.log.Errorf("stopping send loop: %v", err) + c.log.Errorf("stopped send loop: %v", err) } - return err - }) + }() err = eg.Wait() if err != nil { From c25f54980ae47832c8081f0988aab0d975f7244f Mon Sep 17 00:00:00 2001 From: Valentyna Bukhalova Date: Fri, 27 Sep 2024 22:39:46 +0200 Subject: [PATCH 20/29] lint --- internal/proxy/client.go | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/internal/proxy/client.go b/internal/proxy/client.go index 50e30b3..c3f22bc 100644 --- a/internal/proxy/client.go +++ b/internal/proxy/client.go @@ -5,6 +5,8 @@ package proxy import ( "bytes" + "cloud-proxy/internal/config" + cloudproxyv1alpha "cloud-proxy/proto/gen/proto/v1alpha" "context" "fmt" "io" @@ -14,17 +16,13 @@ import ( "github.com/samber/lo" "github.com/sirupsen/logrus" - "google.golang.org/grpc" - "google.golang.org/grpc/encoding/gzip" - "google.golang.org/grpc/metadata" - - "cloud-proxy/internal/config" - cloudproxyv1alpha "cloud-proxy/proto/gen/proto/v1alpha" - "golang.org/x/sync/errgroup" + "google.golang.org/grpc" "google.golang.org/grpc/backoff" "google.golang.org/grpc/credentials" "google.golang.org/grpc/credentials/insecure" + "google.golang.org/grpc/encoding/gzip" + "google.golang.org/grpc/metadata" ) const ( From 2e9fb0093067801227a5dcee8d0ddb8e1a24d60c Mon Sep 17 00:00:00 2001 From: Valentyna Bukhalova Date: Fri, 27 Sep 2024 22:44:56 +0200 Subject: [PATCH 21/29] fix --- internal/proxy/client.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/internal/proxy/client.go b/internal/proxy/client.go index c3f22bc..418ddda 100644 --- a/internal/proxy/client.go +++ b/internal/proxy/client.go @@ -170,7 +170,7 @@ func (c *Client) sendInitialRequest(stream cloudproxyv1alpha.CloudProxyAPI_Strea if err != nil { return fmt.Errorf("stream.Send: initial request %w", err) } - c.lastSeenReceive.Store(time.Now().UnixNano()) + c.lastSeenSend.Store(time.Now().UnixNano()) c.log.Info("Stream to castai started successfully") @@ -286,6 +286,7 @@ func (c *Client) receive(ctx context.Context, stream cloudproxyv1alpha.CloudProx return fmt.Errorf("stream.Recv: %w", err) } + c.lastSeenReceive.Store(time.Now().UnixNano()) c.log.Debugf("Handling message from castai") go c.handleMessage(stream.Context(), in, respCh) } @@ -297,7 +298,6 @@ func (c *Client) handleMessage(ctx context.Context, in *cloudproxyv1alpha.Stream return } - c.lastSeenReceive.Store(time.Now().UnixNano()) c.processConfigurationRequest(in) // skip processing http request if keep alive message. From c2df16d40e3fdbde062ac766a865645343c6f7dd Mon Sep 17 00:00:00 2001 From: Valentyna Bukhalova Date: Mon, 30 Sep 2024 09:59:23 +0200 Subject: [PATCH 22/29] fix --- internal/proxy/client_test.go | 5 ----- 1 file changed, 5 deletions(-) diff --git a/internal/proxy/client_test.go b/internal/proxy/client_test.go index b407bed..c5f0319 100644 --- a/internal/proxy/client_test.go +++ b/internal/proxy/client_test.go @@ -187,14 +187,12 @@ func TestClient_handleMessage(t *testing.T) { name string fields fields args args - wantLastSeenUpdated bool wantKeepAlive int64 wantKeepAliveTimeout int64 wantErrCount int64 }{ { name: "nil response", - wantLastSeenUpdated: false, wantKeepAlive: int64(config.KeepAliveDefault), wantKeepAliveTimeout: int64(config.KeepAliveTimeoutDefault), }, @@ -205,7 +203,6 @@ func TestClient_handleMessage(t *testing.T) { MessageId: KeepAliveMessageID, }, }, - wantLastSeenUpdated: true, wantKeepAlive: int64(config.KeepAliveDefault), wantKeepAliveTimeout: int64(config.KeepAliveTimeoutDefault), }, @@ -220,7 +217,6 @@ func TestClient_handleMessage(t *testing.T) { }, }, }, - wantLastSeenUpdated: true, wantKeepAlive: 1, wantKeepAliveTimeout: 2, }, @@ -288,7 +284,6 @@ func TestClient_handleMessage(t *testing.T) { }() c.handleMessage(context.Background(), tt.args.in, msgStream) - require.Equal(t, tt.wantLastSeenUpdated, c.lastSeenReceive.Load() > 0, "lastSeen: %v", c.lastSeenReceive.Load()) require.Equal(t, tt.wantKeepAlive, c.keepAlive.Load(), "keepAlive: %v", c.keepAlive.Load()) require.Equal(t, tt.wantKeepAliveTimeout, c.keepAliveTimeout.Load(), "keepAliveTimeout: %v", c.keepAliveTimeout.Load()) require.Equal(t, tt.wantErrCount, c.errCount.Load(), "errCount: %v", c.errCount.Load()) From 474fba94dce3727f7a38bd92ccc479feb7fbe547 Mon Sep 17 00:00:00 2001 From: Damian Czaja Date: Mon, 30 Sep 2024 14:57:11 +0200 Subject: [PATCH 23/29] fix tests --- internal/proxy/client_test.go | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/internal/proxy/client_test.go b/internal/proxy/client_test.go index c5f0319..06021b5 100644 --- a/internal/proxy/client_test.go +++ b/internal/proxy/client_test.go @@ -467,7 +467,7 @@ func TestClient_sendAndReceive(t *testing.T) { m.EXPECT().Send(gomock.Any()).Return(fmt.Errorf("test error")) }, }, - wantErr: false, + wantErr: true, }, { name: "context done", @@ -484,12 +484,13 @@ func TestClient_sendAndReceive(t *testing.T) { cancel() return ctx }).AnyTimes() // expected 0 or 1 times. + m.EXPECT().CloseSend().Return(nil) }, }, wantErr: true, }, { - name: "stream not alive", + name: "receive not alive", args: args{ ctx: func() context.Context { return context.Background() @@ -497,7 +498,8 @@ func TestClient_sendAndReceive(t *testing.T) { tuneMockStream: func(m *mock_proxy.MockCloudProxyAPI_StreamCloudProxyClient) { m.EXPECT().Send(gomock.Any()).Return(nil).AnyTimes() // expected 0 or 1 times. m.EXPECT().Context().Return(context.Background()).AnyTimes() // expected 0 or 1 times. - m.EXPECT().Recv().Return(nil, fmt.Errorf("test error")) + m.EXPECT().Recv().Return(nil, fmt.Errorf("test error")).AnyTimes() + m.EXPECT().CloseSend().Return(nil).AnyTimes() }, }, wantErr: true, From 6c328525b76dbca2c95107c2897c36f1c00e2ea3 Mon Sep 17 00:00:00 2001 From: Valentyna Bukhalova Date: Tue, 1 Oct 2024 09:54:21 +0200 Subject: [PATCH 24/29] cleaned proto and fixed tests --- internal/proxy/client.go | 65 +-- internal/proxy/client_test.go | 18 +- proto/gen/proto/v1alpha/proxy.pb.go | 760 ++++++++++++---------------- proto/v1alpha/proxy.proto | 38 +- 4 files changed, 358 insertions(+), 523 deletions(-) diff --git a/internal/proxy/client.go b/internal/proxy/client.go index 418ddda..0268d03 100644 --- a/internal/proxy/client.go +++ b/internal/proxy/client.go @@ -40,10 +40,11 @@ type CloudClient interface { type Client struct { cfg *config.Config - cloudClient CloudClient - log *logrus.Logger - podName string - clusterID string + cloudClient CloudClient + log *logrus.Logger + podName string + clusterID string + streamRuntimeName string errCount atomic.Int64 processedCount atomic.Int64 @@ -153,30 +154,6 @@ func (c *Client) getStream(ctx context.Context) (cloudproxyv1alpha.CloudProxyAPI return stream, cancelFunc, nil } -func (c *Client) sendInitialRequest(stream cloudproxyv1alpha.CloudProxyAPI_StreamCloudProxyClient) error { - c.log.Info("Sending initial request to castai") - - err := stream.Send(&cloudproxyv1alpha.StreamCloudProxyRequest{ - Request: &cloudproxyv1alpha.StreamCloudProxyRequest_InitialRequest{ - InitialRequest: &cloudproxyv1alpha.InitialCloudProxyRequest{ - ClientMetadata: &cloudproxyv1alpha.ClientMetadata{ - PodName: c.podName, - ClusterId: c.clusterID, - }, - Version: c.version, - }, - }, - }) - if err != nil { - return fmt.Errorf("stream.Send: initial request %w", err) - } - c.lastSeenSend.Store(time.Now().UnixNano()) - - c.log.Info("Stream to castai started successfully") - - return nil -} - func (c *Client) prepareAndRun(ctx context.Context) error { ctx, cancel := context.WithCancel(ctx) defer cancel() @@ -187,6 +164,7 @@ func (c *Client) prepareAndRun(ctx context.Context) error { } defer closeConnection() + c.streamRuntimeName = fmt.Sprintf("stream-%s-%v", c.podName, time.Now().UnixNano()) c.lastSeenReceive.Store(time.Now().UnixNano()) c.lastSeenSend.Store(time.Now().UnixNano()) @@ -194,11 +172,6 @@ func (c *Client) prepareAndRun(ctx context.Context) error { } func (c *Client) sendAndReceive(ctx context.Context, stream cloudproxyv1alpha.CloudProxyAPI_StreamCloudProxyClient) error { - err := c.sendInitialRequest(stream) - if err != nil { - return fmt.Errorf("c.Connect: %w", err) - } - eg, egctx := errgroup.WithContext(ctx) sendCh := make(chan *cloudproxyv1alpha.StreamCloudProxyRequest, 10) @@ -228,7 +201,7 @@ func (c *Client) sendAndReceive(ctx context.Context, stream cloudproxyv1alpha.Cl } }() - err = eg.Wait() + err := eg.Wait() if err != nil { c.log.Errorf("sendAndReceive: closing with error: %v", err) } @@ -249,7 +222,7 @@ func (c *Client) send(ctx context.Context, stream cloudproxyv1alpha.CloudProxyAP case <-stream.Context().Done(): return fmt.Errorf("stream closed %w", stream.Context().Err()) case req := <-sendCh: - c.log.Printf("Sending message to stream %v", req.GetResponse().GetMessageId()) + c.log.Printf("Sending message to stream %v len=%v", req.GetResponse().GetMessageId(), len(req.GetResponse().GetHttpResponse().GetBody())) if err := stream.Send(req); err != nil { c.log.WithError(err).Warn("failed to send message to stream") return fmt.Errorf("failed to send message to stream: %w", err) @@ -288,7 +261,7 @@ func (c *Client) receive(ctx context.Context, stream cloudproxyv1alpha.CloudProx c.lastSeenReceive.Store(time.Now().UnixNano()) c.log.Debugf("Handling message from castai") - go c.handleMessage(stream.Context(), in, respCh) + go c.handleMessage(ctx, in, respCh) } } @@ -322,7 +295,7 @@ func (c *Client) handleMessage(ctx context.Context, in *cloudproxyv1alpha.Stream Request: &cloudproxyv1alpha.StreamCloudProxyRequest_Response{ Response: &cloudproxyv1alpha.ClusterResponse{ ClientMetadata: &cloudproxyv1alpha.ClientMetadata{ - PodName: c.podName, + PodName: c.streamRuntimeName, ClusterId: c.clusterID, }, MessageId: in.GetMessageId(), @@ -335,15 +308,15 @@ func (c *Client) handleMessage(ctx context.Context, in *cloudproxyv1alpha.Stream } func (c *Client) processConfigurationRequest(in *cloudproxyv1alpha.StreamCloudProxyResponse) { - if in.ConfigurationRequest == nil { + if in.GetConfigurationRequest() == nil { return } - if in.ConfigurationRequest.GetKeepAlive() != 0 { - c.keepAlive.Store(in.ConfigurationRequest.GetKeepAlive()) + if in.GetConfigurationRequest().GetKeepAlive() != 0 { + c.keepAlive.Store(in.GetConfigurationRequest().GetKeepAlive()) } - if in.ConfigurationRequest.GetKeepAliveTimeout() != 0 { - c.keepAliveTimeout.Store(in.ConfigurationRequest.GetKeepAliveTimeout()) + if in.GetConfigurationRequest().GetKeepAliveTimeout() != 0 { + c.keepAliveTimeout.Store(in.GetConfigurationRequest().GetKeepAliveTimeout()) } c.log.Debugf("Updated keep-alive configuration to %v and keep-alive timeout to %v", time.Duration(c.keepAlive.Load()).Seconds(), time.Duration(c.keepAliveTimeout.Load()).Seconds()) @@ -383,8 +356,8 @@ func (c *Client) isAlive() error { lastSeenSendDiff := time.Now().UnixNano() - lastSeenSend if lastSeenReceiveDiff > keepAliveTimeout || lastSeenSendDiff > keepAliveTimeout { - c.log.Warnf("last seen receive %v, last seen send %v", - time.Duration(lastSeenReceiveDiff).Seconds(), time.Duration(lastSeenSendDiff).Seconds()) + c.log.Warnf("last seen receive %v, last seen send %v %v", + time.Duration(lastSeenReceiveDiff).Seconds(), time.Duration(lastSeenSendDiff).Seconds(), errAlive) return errAlive } @@ -410,11 +383,11 @@ func (c *Client) sendKeepAlive(ctx context.Context, stream cloudproxyv1alpha.Clo Request: &cloudproxyv1alpha.StreamCloudProxyRequest_ClientStats{ ClientStats: &cloudproxyv1alpha.ClientStats{ ClientMetadata: &cloudproxyv1alpha.ClientMetadata{ - PodName: c.podName, + PodName: c.streamRuntimeName, ClusterId: c.clusterID, + Version: c.version, }, Stats: &cloudproxyv1alpha.ClientStats_Stats{ - Status: cloudproxyv1alpha.ClientStats_Stats_OK, Timestamp: time.Now().UnixNano(), }, }, diff --git a/internal/proxy/client_test.go b/internal/proxy/client_test.go index 06021b5..2572c99 100644 --- a/internal/proxy/client_test.go +++ b/internal/proxy/client_test.go @@ -211,9 +211,11 @@ func TestClient_handleMessage(t *testing.T) { args: args{ in: &cloudproxyv1alpha.StreamCloudProxyResponse{ MessageId: KeepAliveMessageID, - ConfigurationRequest: &cloudproxyv1alpha.ConfigurationRequest{ - KeepAlive: 1, - KeepAliveTimeout: 2, + Response: &cloudproxyv1alpha.StreamCloudProxyResponse_ConfigurationRequest{ + ConfigurationRequest: &cloudproxyv1alpha.ConfigurationRequest{ + KeepAlive: 1, + KeepAliveTimeout: 2, + }, }, }, }, @@ -465,6 +467,12 @@ func TestClient_sendAndReceive(t *testing.T) { }, tuneMockStream: func(m *mock_proxy.MockCloudProxyAPI_StreamCloudProxyClient) { m.EXPECT().Send(gomock.Any()).Return(fmt.Errorf("test error")) + m.EXPECT().Recv().DoAndReturn(func() (*cloudproxyv1alpha.StreamCloudProxyResponse, error) { + time.Sleep(time.Millisecond) + return &cloudproxyv1alpha.StreamCloudProxyResponse{}, nil + }).AnyTimes() + m.EXPECT().Context().Return(context.Background()).AnyTimes() + m.EXPECT().CloseSend().Return(nil) }, }, wantErr: true, @@ -518,8 +526,10 @@ func TestClient_sendAndReceive(t *testing.T) { PodName: "podName", }, KeepAlive: time.Second, - KeepAliveTimeout: time.Minute, + KeepAliveTimeout: time.Second * 2, }) + c.lastSeenReceive.Store(time.Now().UnixNano()) + c.lastSeenSend.Store(time.Now().UnixNano()) stream := mock_proxy.NewMockCloudProxyAPI_StreamCloudProxyClient(ctrl) if tt.args.tuneMockStream != nil { tt.args.tuneMockStream(stream) diff --git a/proto/gen/proto/v1alpha/proxy.pb.go b/proto/gen/proto/v1alpha/proxy.pb.go index 1f09b50..7c40c9f 100644 --- a/proto/gen/proto/v1alpha/proxy.pb.go +++ b/proto/gen/proto/v1alpha/proxy.pb.go @@ -20,56 +20,6 @@ const ( _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) ) -// Status of the cluster client. -type ClientStats_Stats_Status int32 - -const ( - ClientStats_Stats_UNKNOWN ClientStats_Stats_Status = 0 - ClientStats_Stats_OK ClientStats_Stats_Status = 1 - ClientStats_Stats_CLOSING ClientStats_Stats_Status = 2 -) - -// Enum value maps for ClientStats_Stats_Status. -var ( - ClientStats_Stats_Status_name = map[int32]string{ - 0: "UNKNOWN", - 1: "OK", - 2: "CLOSING", - } - ClientStats_Stats_Status_value = map[string]int32{ - "UNKNOWN": 0, - "OK": 1, - "CLOSING": 2, - } -) - -func (x ClientStats_Stats_Status) Enum() *ClientStats_Stats_Status { - p := new(ClientStats_Stats_Status) - *p = x - return p -} - -func (x ClientStats_Stats_Status) String() string { - return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) -} - -func (ClientStats_Stats_Status) Descriptor() protoreflect.EnumDescriptor { - return file_proto_v1alpha_proxy_proto_enumTypes[0].Descriptor() -} - -func (ClientStats_Stats_Status) Type() protoreflect.EnumType { - return &file_proto_v1alpha_proxy_proto_enumTypes[0] -} - -func (x ClientStats_Stats_Status) Number() protoreflect.EnumNumber { - return protoreflect.EnumNumber(x) -} - -// Deprecated: Use ClientStats_Stats_Status.Descriptor instead. -func (ClientStats_Stats_Status) EnumDescriptor() ([]byte, []int) { - return file_proto_v1alpha_proxy_proto_rawDescGZIP(), []int{2, 0, 0} -} - type StreamCloudProxyRequest struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -77,7 +27,6 @@ type StreamCloudProxyRequest struct { // Types that are assignable to Request: // - // *StreamCloudProxyRequest_InitialRequest // *StreamCloudProxyRequest_ClientStats // *StreamCloudProxyRequest_Response Request isStreamCloudProxyRequest_Request `protobuf_oneof:"request"` @@ -122,13 +71,6 @@ func (m *StreamCloudProxyRequest) GetRequest() isStreamCloudProxyRequest_Request return nil } -func (x *StreamCloudProxyRequest) GetInitialRequest() *InitialCloudProxyRequest { - if x, ok := x.GetRequest().(*StreamCloudProxyRequest_InitialRequest); ok { - return x.InitialRequest - } - return nil -} - func (x *StreamCloudProxyRequest) GetClientStats() *ClientStats { if x, ok := x.GetRequest().(*StreamCloudProxyRequest_ClientStats); ok { return x.ClientStats @@ -147,11 +89,6 @@ type isStreamCloudProxyRequest_Request interface { isStreamCloudProxyRequest_Request() } -type StreamCloudProxyRequest_InitialRequest struct { - // Initial request to establish the connection. - InitialRequest *InitialCloudProxyRequest `protobuf:"bytes,1,opt,name=initial_request,json=initialRequest,proto3,oneof"` -} - type StreamCloudProxyRequest_ClientStats struct { ClientStats *ClientStats `protobuf:"bytes,2,opt,name=client_stats,json=clientStats,proto3,oneof"` } @@ -160,67 +97,10 @@ type StreamCloudProxyRequest_Response struct { Response *ClusterResponse `protobuf:"bytes,3,opt,name=response,proto3,oneof"` } -func (*StreamCloudProxyRequest_InitialRequest) isStreamCloudProxyRequest_Request() {} - func (*StreamCloudProxyRequest_ClientStats) isStreamCloudProxyRequest_Request() {} func (*StreamCloudProxyRequest_Response) isStreamCloudProxyRequest_Request() {} -type InitialCloudProxyRequest struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - ClientMetadata *ClientMetadata `protobuf:"bytes,1,opt,name=client_metadata,json=clientMetadata,proto3" json:"client_metadata,omitempty"` - Version string `protobuf:"bytes,2,opt,name=version,proto3" json:"version,omitempty"` -} - -func (x *InitialCloudProxyRequest) Reset() { - *x = InitialCloudProxyRequest{} - if protoimpl.UnsafeEnabled { - mi := &file_proto_v1alpha_proxy_proto_msgTypes[1] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *InitialCloudProxyRequest) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*InitialCloudProxyRequest) ProtoMessage() {} - -func (x *InitialCloudProxyRequest) ProtoReflect() protoreflect.Message { - mi := &file_proto_v1alpha_proxy_proto_msgTypes[1] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use InitialCloudProxyRequest.ProtoReflect.Descriptor instead. -func (*InitialCloudProxyRequest) Descriptor() ([]byte, []int) { - return file_proto_v1alpha_proxy_proto_rawDescGZIP(), []int{1} -} - -func (x *InitialCloudProxyRequest) GetClientMetadata() *ClientMetadata { - if x != nil { - return x.ClientMetadata - } - return nil -} - -func (x *InitialCloudProxyRequest) GetVersion() string { - if x != nil { - return x.Version - } - return "" -} - type ClientStats struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -233,7 +113,7 @@ type ClientStats struct { func (x *ClientStats) Reset() { *x = ClientStats{} if protoimpl.UnsafeEnabled { - mi := &file_proto_v1alpha_proxy_proto_msgTypes[2] + mi := &file_proto_v1alpha_proxy_proto_msgTypes[1] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -246,7 +126,7 @@ func (x *ClientStats) String() string { func (*ClientStats) ProtoMessage() {} func (x *ClientStats) ProtoReflect() protoreflect.Message { - mi := &file_proto_v1alpha_proxy_proto_msgTypes[2] + mi := &file_proto_v1alpha_proxy_proto_msgTypes[1] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -259,7 +139,7 @@ func (x *ClientStats) ProtoReflect() protoreflect.Message { // Deprecated: Use ClientStats.ProtoReflect.Descriptor instead. func (*ClientStats) Descriptor() ([]byte, []int) { - return file_proto_v1alpha_proxy_proto_rawDescGZIP(), []int{2} + return file_proto_v1alpha_proxy_proto_rawDescGZIP(), []int{1} } func (x *ClientStats) GetClientMetadata() *ClientMetadata { @@ -289,7 +169,7 @@ type ClusterResponse struct { func (x *ClusterResponse) Reset() { *x = ClusterResponse{} if protoimpl.UnsafeEnabled { - mi := &file_proto_v1alpha_proxy_proto_msgTypes[3] + mi := &file_proto_v1alpha_proxy_proto_msgTypes[2] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -302,7 +182,7 @@ func (x *ClusterResponse) String() string { func (*ClusterResponse) ProtoMessage() {} func (x *ClusterResponse) ProtoReflect() protoreflect.Message { - mi := &file_proto_v1alpha_proxy_proto_msgTypes[3] + mi := &file_proto_v1alpha_proxy_proto_msgTypes[2] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -315,7 +195,7 @@ func (x *ClusterResponse) ProtoReflect() protoreflect.Message { // Deprecated: Use ClusterResponse.ProtoReflect.Descriptor instead. func (*ClusterResponse) Descriptor() ([]byte, []int) { - return file_proto_v1alpha_proxy_proto_rawDescGZIP(), []int{3} + return file_proto_v1alpha_proxy_proto_rawDescGZIP(), []int{2} } func (x *ClusterResponse) GetClientMetadata() *ClientMetadata { @@ -344,14 +224,14 @@ type CloudProxyRequest struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - MessageId string `protobuf:"bytes,3,opt,name=message_id,json=messageId,proto3" json:"message_id,omitempty"` - HttpRequest *HTTPRequest `protobuf:"bytes,4,opt,name=http_request,json=httpRequest,proto3,oneof" json:"http_request,omitempty"` + MessageId string `protobuf:"bytes,1,opt,name=message_id,json=messageId,proto3" json:"message_id,omitempty"` + HttpRequest *HTTPRequest `protobuf:"bytes,2,opt,name=http_request,json=httpRequest,proto3,oneof" json:"http_request,omitempty"` } func (x *CloudProxyRequest) Reset() { *x = CloudProxyRequest{} if protoimpl.UnsafeEnabled { - mi := &file_proto_v1alpha_proxy_proto_msgTypes[4] + mi := &file_proto_v1alpha_proxy_proto_msgTypes[3] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -364,7 +244,7 @@ func (x *CloudProxyRequest) String() string { func (*CloudProxyRequest) ProtoMessage() {} func (x *CloudProxyRequest) ProtoReflect() protoreflect.Message { - mi := &file_proto_v1alpha_proxy_proto_msgTypes[4] + mi := &file_proto_v1alpha_proxy_proto_msgTypes[3] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -377,7 +257,7 @@ func (x *CloudProxyRequest) ProtoReflect() protoreflect.Message { // Deprecated: Use CloudProxyRequest.ProtoReflect.Descriptor instead. func (*CloudProxyRequest) Descriptor() ([]byte, []int) { - return file_proto_v1alpha_proxy_proto_rawDescGZIP(), []int{4} + return file_proto_v1alpha_proxy_proto_rawDescGZIP(), []int{3} } func (x *CloudProxyRequest) GetMessageId() string { @@ -399,16 +279,19 @@ type StreamCloudProxyResponse struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - ClientMetadata *ClientMetadata `protobuf:"bytes,1,opt,name=client_metadata,json=clientMetadata,proto3,oneof" json:"client_metadata,omitempty"` - MessageId string `protobuf:"bytes,2,opt,name=message_id,json=messageId,proto3" json:"message_id,omitempty"` - HttpRequest *HTTPRequest `protobuf:"bytes,3,opt,name=http_request,json=httpRequest,proto3,oneof" json:"http_request,omitempty"` - ConfigurationRequest *ConfigurationRequest `protobuf:"bytes,4,opt,name=configuration_request,json=configurationRequest,proto3,oneof" json:"configuration_request,omitempty"` + ClientMetadata *ClientMetadata `protobuf:"bytes,1,opt,name=client_metadata,json=clientMetadata,proto3,oneof" json:"client_metadata,omitempty"` + MessageId string `protobuf:"bytes,2,opt,name=message_id,json=messageId,proto3" json:"message_id,omitempty"` + // Types that are assignable to Response: + // + // *StreamCloudProxyResponse_HttpRequest + // *StreamCloudProxyResponse_ConfigurationRequest + Response isStreamCloudProxyResponse_Response `protobuf_oneof:"response"` } func (x *StreamCloudProxyResponse) Reset() { *x = StreamCloudProxyResponse{} if protoimpl.UnsafeEnabled { - mi := &file_proto_v1alpha_proxy_proto_msgTypes[5] + mi := &file_proto_v1alpha_proxy_proto_msgTypes[4] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -421,7 +304,7 @@ func (x *StreamCloudProxyResponse) String() string { func (*StreamCloudProxyResponse) ProtoMessage() {} func (x *StreamCloudProxyResponse) ProtoReflect() protoreflect.Message { - mi := &file_proto_v1alpha_proxy_proto_msgTypes[5] + mi := &file_proto_v1alpha_proxy_proto_msgTypes[4] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -434,7 +317,7 @@ func (x *StreamCloudProxyResponse) ProtoReflect() protoreflect.Message { // Deprecated: Use StreamCloudProxyResponse.ProtoReflect.Descriptor instead. func (*StreamCloudProxyResponse) Descriptor() ([]byte, []int) { - return file_proto_v1alpha_proxy_proto_rawDescGZIP(), []int{5} + return file_proto_v1alpha_proxy_proto_rawDescGZIP(), []int{4} } func (x *StreamCloudProxyResponse) GetClientMetadata() *ClientMetadata { @@ -451,20 +334,43 @@ func (x *StreamCloudProxyResponse) GetMessageId() string { return "" } +func (m *StreamCloudProxyResponse) GetResponse() isStreamCloudProxyResponse_Response { + if m != nil { + return m.Response + } + return nil +} + func (x *StreamCloudProxyResponse) GetHttpRequest() *HTTPRequest { - if x != nil { + if x, ok := x.GetResponse().(*StreamCloudProxyResponse_HttpRequest); ok { return x.HttpRequest } return nil } func (x *StreamCloudProxyResponse) GetConfigurationRequest() *ConfigurationRequest { - if x != nil { + if x, ok := x.GetResponse().(*StreamCloudProxyResponse_ConfigurationRequest); ok { return x.ConfigurationRequest } return nil } +type isStreamCloudProxyResponse_Response interface { + isStreamCloudProxyResponse_Response() +} + +type StreamCloudProxyResponse_HttpRequest struct { + HttpRequest *HTTPRequest `protobuf:"bytes,3,opt,name=http_request,json=httpRequest,proto3,oneof"` +} + +type StreamCloudProxyResponse_ConfigurationRequest struct { + ConfigurationRequest *ConfigurationRequest `protobuf:"bytes,4,opt,name=configuration_request,json=configurationRequest,proto3,oneof"` +} + +func (*StreamCloudProxyResponse_HttpRequest) isStreamCloudProxyResponse_Response() {} + +func (*StreamCloudProxyResponse_ConfigurationRequest) isStreamCloudProxyResponse_Response() {} + type ConfigurationRequest struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -477,7 +383,7 @@ type ConfigurationRequest struct { func (x *ConfigurationRequest) Reset() { *x = ConfigurationRequest{} if protoimpl.UnsafeEnabled { - mi := &file_proto_v1alpha_proxy_proto_msgTypes[6] + mi := &file_proto_v1alpha_proxy_proto_msgTypes[5] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -490,7 +396,7 @@ func (x *ConfigurationRequest) String() string { func (*ConfigurationRequest) ProtoMessage() {} func (x *ConfigurationRequest) ProtoReflect() protoreflect.Message { - mi := &file_proto_v1alpha_proxy_proto_msgTypes[6] + mi := &file_proto_v1alpha_proxy_proto_msgTypes[5] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -503,7 +409,7 @@ func (x *ConfigurationRequest) ProtoReflect() protoreflect.Message { // Deprecated: Use ConfigurationRequest.ProtoReflect.Descriptor instead. func (*ConfigurationRequest) Descriptor() ([]byte, []int) { - return file_proto_v1alpha_proxy_proto_rawDescGZIP(), []int{6} + return file_proto_v1alpha_proxy_proto_rawDescGZIP(), []int{5} } func (x *ConfigurationRequest) GetKeepAlive() int64 { @@ -534,7 +440,7 @@ type HTTPRequest struct { func (x *HTTPRequest) Reset() { *x = HTTPRequest{} if protoimpl.UnsafeEnabled { - mi := &file_proto_v1alpha_proxy_proto_msgTypes[7] + mi := &file_proto_v1alpha_proxy_proto_msgTypes[6] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -547,7 +453,7 @@ func (x *HTTPRequest) String() string { func (*HTTPRequest) ProtoMessage() {} func (x *HTTPRequest) ProtoReflect() protoreflect.Message { - mi := &file_proto_v1alpha_proxy_proto_msgTypes[7] + mi := &file_proto_v1alpha_proxy_proto_msgTypes[6] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -560,7 +466,7 @@ func (x *HTTPRequest) ProtoReflect() protoreflect.Message { // Deprecated: Use HTTPRequest.ProtoReflect.Descriptor instead. func (*HTTPRequest) Descriptor() ([]byte, []int) { - return file_proto_v1alpha_proxy_proto_rawDescGZIP(), []int{7} + return file_proto_v1alpha_proxy_proto_rawDescGZIP(), []int{6} } func (x *HTTPRequest) GetMethod() string { @@ -605,7 +511,7 @@ type HTTPResponse struct { func (x *HTTPResponse) Reset() { *x = HTTPResponse{} if protoimpl.UnsafeEnabled { - mi := &file_proto_v1alpha_proxy_proto_msgTypes[8] + mi := &file_proto_v1alpha_proxy_proto_msgTypes[7] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -618,7 +524,7 @@ func (x *HTTPResponse) String() string { func (*HTTPResponse) ProtoMessage() {} func (x *HTTPResponse) ProtoReflect() protoreflect.Message { - mi := &file_proto_v1alpha_proxy_proto_msgTypes[8] + mi := &file_proto_v1alpha_proxy_proto_msgTypes[7] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -631,7 +537,7 @@ func (x *HTTPResponse) ProtoReflect() protoreflect.Message { // Deprecated: Use HTTPResponse.ProtoReflect.Descriptor instead. func (*HTTPResponse) Descriptor() ([]byte, []int) { - return file_proto_v1alpha_proxy_proto_rawDescGZIP(), []int{8} + return file_proto_v1alpha_proxy_proto_rawDescGZIP(), []int{7} } func (x *HTTPResponse) GetBody() []byte { @@ -673,7 +579,7 @@ type HeaderValue struct { func (x *HeaderValue) Reset() { *x = HeaderValue{} if protoimpl.UnsafeEnabled { - mi := &file_proto_v1alpha_proxy_proto_msgTypes[9] + mi := &file_proto_v1alpha_proxy_proto_msgTypes[8] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -686,7 +592,7 @@ func (x *HeaderValue) String() string { func (*HeaderValue) ProtoMessage() {} func (x *HeaderValue) ProtoReflect() protoreflect.Message { - mi := &file_proto_v1alpha_proxy_proto_msgTypes[9] + mi := &file_proto_v1alpha_proxy_proto_msgTypes[8] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -699,7 +605,7 @@ func (x *HeaderValue) ProtoReflect() protoreflect.Message { // Deprecated: Use HeaderValue.ProtoReflect.Descriptor instead. func (*HeaderValue) Descriptor() ([]byte, []int) { - return file_proto_v1alpha_proxy_proto_rawDescGZIP(), []int{9} + return file_proto_v1alpha_proxy_proto_rawDescGZIP(), []int{8} } func (x *HeaderValue) GetValue() []string { @@ -721,7 +627,7 @@ type SendToProxyRequest struct { func (x *SendToProxyRequest) Reset() { *x = SendToProxyRequest{} if protoimpl.UnsafeEnabled { - mi := &file_proto_v1alpha_proxy_proto_msgTypes[10] + mi := &file_proto_v1alpha_proxy_proto_msgTypes[9] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -734,7 +640,7 @@ func (x *SendToProxyRequest) String() string { func (*SendToProxyRequest) ProtoMessage() {} func (x *SendToProxyRequest) ProtoReflect() protoreflect.Message { - mi := &file_proto_v1alpha_proxy_proto_msgTypes[10] + mi := &file_proto_v1alpha_proxy_proto_msgTypes[9] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -747,7 +653,7 @@ func (x *SendToProxyRequest) ProtoReflect() protoreflect.Message { // Deprecated: Use SendToProxyRequest.ProtoReflect.Descriptor instead. func (*SendToProxyRequest) Descriptor() ([]byte, []int) { - return file_proto_v1alpha_proxy_proto_rawDescGZIP(), []int{10} + return file_proto_v1alpha_proxy_proto_rawDescGZIP(), []int{9} } func (x *SendToProxyRequest) GetClientMetadata() *ClientMetadata { @@ -776,7 +682,7 @@ type SendToProxyResponse struct { func (x *SendToProxyResponse) Reset() { *x = SendToProxyResponse{} if protoimpl.UnsafeEnabled { - mi := &file_proto_v1alpha_proxy_proto_msgTypes[11] + mi := &file_proto_v1alpha_proxy_proto_msgTypes[10] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -789,7 +695,7 @@ func (x *SendToProxyResponse) String() string { func (*SendToProxyResponse) ProtoMessage() {} func (x *SendToProxyResponse) ProtoReflect() protoreflect.Message { - mi := &file_proto_v1alpha_proxy_proto_msgTypes[11] + mi := &file_proto_v1alpha_proxy_proto_msgTypes[10] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -802,7 +708,7 @@ func (x *SendToProxyResponse) ProtoReflect() protoreflect.Message { // Deprecated: Use SendToProxyResponse.ProtoReflect.Descriptor instead. func (*SendToProxyResponse) Descriptor() ([]byte, []int) { - return file_proto_v1alpha_proxy_proto_rawDescGZIP(), []int{11} + return file_proto_v1alpha_proxy_proto_rawDescGZIP(), []int{10} } func (x *SendToProxyResponse) GetHttpResponse() *HTTPResponse { @@ -827,12 +733,13 @@ type ClientMetadata struct { ClusterId string `protobuf:"bytes,1,opt,name=cluster_id,json=clusterId,proto3" json:"cluster_id,omitempty"` OrganizationId *string `protobuf:"bytes,2,opt,name=organization_id,json=organizationId,proto3,oneof" json:"organization_id,omitempty"` PodName string `protobuf:"bytes,3,opt,name=pod_name,json=podName,proto3" json:"pod_name,omitempty"` + Version string `protobuf:"bytes,4,opt,name=version,proto3" json:"version,omitempty"` } func (x *ClientMetadata) Reset() { *x = ClientMetadata{} if protoimpl.UnsafeEnabled { - mi := &file_proto_v1alpha_proxy_proto_msgTypes[12] + mi := &file_proto_v1alpha_proxy_proto_msgTypes[11] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -845,7 +752,7 @@ func (x *ClientMetadata) String() string { func (*ClientMetadata) ProtoMessage() {} func (x *ClientMetadata) ProtoReflect() protoreflect.Message { - mi := &file_proto_v1alpha_proxy_proto_msgTypes[12] + mi := &file_proto_v1alpha_proxy_proto_msgTypes[11] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -858,7 +765,7 @@ func (x *ClientMetadata) ProtoReflect() protoreflect.Message { // Deprecated: Use ClientMetadata.ProtoReflect.Descriptor instead. func (*ClientMetadata) Descriptor() ([]byte, []int) { - return file_proto_v1alpha_proxy_proto_rawDescGZIP(), []int{12} + return file_proto_v1alpha_proxy_proto_rawDescGZIP(), []int{11} } func (x *ClientMetadata) GetClusterId() string { @@ -882,28 +789,34 @@ func (x *ClientMetadata) GetPodName() string { return "" } +func (x *ClientMetadata) GetVersion() string { + if x != nil { + return x.Version + } + return "" +} + type ClientStats_Stats struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - Status ClientStats_Stats_Status `protobuf:"varint,2,opt,name=status,proto3,enum=castai.cloud.proxy.v1alpha.ClientStats_Stats_Status" json:"status,omitempty"` - Timestamp int64 `protobuf:"varint,3,opt,name=timestamp,proto3" json:"timestamp,omitempty"` + Timestamp int64 `protobuf:"varint,2,opt,name=timestamp,proto3" json:"timestamp,omitempty"` // The total number of RPCs that started. - NumCallsStarted int64 `protobuf:"varint,4,opt,name=num_calls_started,json=numCallsStarted,proto3" json:"num_calls_started,omitempty"` + NumCallsStarted int64 `protobuf:"varint,3,opt,name=num_calls_started,json=numCallsStarted,proto3" json:"num_calls_started,omitempty"` // The total number of RPCs that finished. - NumCallsFinished int64 `protobuf:"varint,5,opt,name=num_calls_finished,json=numCallsFinished,proto3" json:"num_calls_finished,omitempty"` + NumCallsFinished int64 `protobuf:"varint,4,opt,name=num_calls_finished,json=numCallsFinished,proto3" json:"num_calls_finished,omitempty"` // The total number of RPCs that failed to reach a server except dropped RPCs. - NumCallsFinishedWithClientFailedToSend int64 `protobuf:"varint,6,opt,name=num_calls_finished_with_client_failed_to_send,json=numCallsFinishedWithClientFailedToSend,proto3" json:"num_calls_finished_with_client_failed_to_send,omitempty"` + NumCallsFinishedWithClientFailedToSend int64 `protobuf:"varint,5,opt,name=num_calls_finished_with_client_failed_to_send,json=numCallsFinishedWithClientFailedToSend,proto3" json:"num_calls_finished_with_client_failed_to_send,omitempty"` // The total number of RPCs that finished and are known to have been received // by a server. - NumCallsFinishedKnownReceived int64 `protobuf:"varint,7,opt,name=num_calls_finished_known_received,json=numCallsFinishedKnownReceived,proto3" json:"num_calls_finished_known_received,omitempty"` + NumCallsFinishedKnownReceived int64 `protobuf:"varint,6,opt,name=num_calls_finished_known_received,json=numCallsFinishedKnownReceived,proto3" json:"num_calls_finished_known_received,omitempty"` } func (x *ClientStats_Stats) Reset() { *x = ClientStats_Stats{} if protoimpl.UnsafeEnabled { - mi := &file_proto_v1alpha_proxy_proto_msgTypes[13] + mi := &file_proto_v1alpha_proxy_proto_msgTypes[12] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -916,7 +829,7 @@ func (x *ClientStats_Stats) String() string { func (*ClientStats_Stats) ProtoMessage() {} func (x *ClientStats_Stats) ProtoReflect() protoreflect.Message { - mi := &file_proto_v1alpha_proxy_proto_msgTypes[13] + mi := &file_proto_v1alpha_proxy_proto_msgTypes[12] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -929,14 +842,7 @@ func (x *ClientStats_Stats) ProtoReflect() protoreflect.Message { // Deprecated: Use ClientStats_Stats.ProtoReflect.Descriptor instead. func (*ClientStats_Stats) Descriptor() ([]byte, []int) { - return file_proto_v1alpha_proxy_proto_rawDescGZIP(), []int{2, 0} -} - -func (x *ClientStats_Stats) GetStatus() ClientStats_Stats_Status { - if x != nil { - return x.Status - } - return ClientStats_Stats_UNKNOWN + return file_proto_v1alpha_proxy_proto_rawDescGZIP(), []int{1, 0} } func (x *ClientStats_Stats) GetTimestamp() int64 { @@ -980,135 +886,128 @@ var file_proto_v1alpha_proxy_proto_rawDesc = []byte{ 0x0a, 0x19, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x2f, 0x70, 0x72, 0x6f, 0x78, 0x79, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x1a, 0x63, 0x61, 0x73, 0x74, 0x61, 0x69, 0x2e, 0x63, 0x6c, 0x6f, 0x75, 0x64, 0x2e, 0x70, 0x72, 0x6f, 0x78, 0x79, 0x2e, - 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x22, 0x9e, 0x02, 0x0a, 0x17, 0x53, 0x74, 0x72, 0x65, + 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x22, 0xbd, 0x01, 0x0a, 0x17, 0x53, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x43, 0x6c, 0x6f, 0x75, 0x64, 0x50, 0x72, 0x6f, 0x78, 0x79, 0x52, 0x65, 0x71, 0x75, - 0x65, 0x73, 0x74, 0x12, 0x5f, 0x0a, 0x0f, 0x69, 0x6e, 0x69, 0x74, 0x69, 0x61, 0x6c, 0x5f, 0x72, - 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x34, 0x2e, 0x63, - 0x61, 0x73, 0x74, 0x61, 0x69, 0x2e, 0x63, 0x6c, 0x6f, 0x75, 0x64, 0x2e, 0x70, 0x72, 0x6f, 0x78, - 0x79, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x2e, 0x49, 0x6e, 0x69, 0x74, 0x69, 0x61, - 0x6c, 0x43, 0x6c, 0x6f, 0x75, 0x64, 0x50, 0x72, 0x6f, 0x78, 0x79, 0x52, 0x65, 0x71, 0x75, 0x65, - 0x73, 0x74, 0x48, 0x00, 0x52, 0x0e, 0x69, 0x6e, 0x69, 0x74, 0x69, 0x61, 0x6c, 0x52, 0x65, 0x71, - 0x75, 0x65, 0x73, 0x74, 0x12, 0x4c, 0x0a, 0x0c, 0x63, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x5f, 0x73, - 0x74, 0x61, 0x74, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x27, 0x2e, 0x63, 0x61, 0x73, - 0x74, 0x61, 0x69, 0x2e, 0x63, 0x6c, 0x6f, 0x75, 0x64, 0x2e, 0x70, 0x72, 0x6f, 0x78, 0x79, 0x2e, - 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x2e, 0x43, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x53, 0x74, - 0x61, 0x74, 0x73, 0x48, 0x00, 0x52, 0x0b, 0x63, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x53, 0x74, 0x61, - 0x74, 0x73, 0x12, 0x49, 0x0a, 0x08, 0x72, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x18, 0x03, - 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2b, 0x2e, 0x63, 0x61, 0x73, 0x74, 0x61, 0x69, 0x2e, 0x63, 0x6c, - 0x6f, 0x75, 0x64, 0x2e, 0x70, 0x72, 0x6f, 0x78, 0x79, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, - 0x61, 0x2e, 0x43, 0x6c, 0x75, 0x73, 0x74, 0x65, 0x72, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, - 0x65, 0x48, 0x00, 0x52, 0x08, 0x72, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x42, 0x09, 0x0a, - 0x07, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x22, 0x89, 0x01, 0x0a, 0x18, 0x49, 0x6e, 0x69, - 0x74, 0x69, 0x61, 0x6c, 0x43, 0x6c, 0x6f, 0x75, 0x64, 0x50, 0x72, 0x6f, 0x78, 0x79, 0x52, 0x65, - 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x53, 0x0a, 0x0f, 0x63, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x5f, - 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2a, - 0x2e, 0x63, 0x61, 0x73, 0x74, 0x61, 0x69, 0x2e, 0x63, 0x6c, 0x6f, 0x75, 0x64, 0x2e, 0x70, 0x72, - 0x6f, 0x78, 0x79, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x2e, 0x43, 0x6c, 0x69, 0x65, - 0x6e, 0x74, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x52, 0x0e, 0x63, 0x6c, 0x69, 0x65, - 0x6e, 0x74, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x12, 0x18, 0x0a, 0x07, 0x76, 0x65, - 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x76, 0x65, 0x72, - 0x73, 0x69, 0x6f, 0x6e, 0x22, 0xcc, 0x04, 0x0a, 0x0b, 0x43, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x53, - 0x74, 0x61, 0x74, 0x73, 0x12, 0x53, 0x0a, 0x0f, 0x63, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x5f, 0x6d, - 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2a, 0x2e, - 0x63, 0x61, 0x73, 0x74, 0x61, 0x69, 0x2e, 0x63, 0x6c, 0x6f, 0x75, 0x64, 0x2e, 0x70, 0x72, 0x6f, - 0x78, 0x79, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x2e, 0x43, 0x6c, 0x69, 0x65, 0x6e, - 0x74, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x52, 0x0e, 0x63, 0x6c, 0x69, 0x65, 0x6e, - 0x74, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x12, 0x43, 0x0a, 0x05, 0x73, 0x74, 0x61, - 0x74, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2d, 0x2e, 0x63, 0x61, 0x73, 0x74, 0x61, - 0x69, 0x2e, 0x63, 0x6c, 0x6f, 0x75, 0x64, 0x2e, 0x70, 0x72, 0x6f, 0x78, 0x79, 0x2e, 0x76, 0x31, - 0x61, 0x6c, 0x70, 0x68, 0x61, 0x2e, 0x43, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x53, 0x74, 0x61, 0x74, - 0x73, 0x2e, 0x53, 0x74, 0x61, 0x74, 0x73, 0x52, 0x05, 0x73, 0x74, 0x61, 0x74, 0x73, 0x1a, 0xa2, - 0x03, 0x0a, 0x05, 0x53, 0x74, 0x61, 0x74, 0x73, 0x12, 0x4c, 0x0a, 0x06, 0x73, 0x74, 0x61, 0x74, - 0x75, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x34, 0x2e, 0x63, 0x61, 0x73, 0x74, 0x61, - 0x69, 0x2e, 0x63, 0x6c, 0x6f, 0x75, 0x64, 0x2e, 0x70, 0x72, 0x6f, 0x78, 0x79, 0x2e, 0x76, 0x31, - 0x61, 0x6c, 0x70, 0x68, 0x61, 0x2e, 0x43, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x53, 0x74, 0x61, 0x74, - 0x73, 0x2e, 0x53, 0x74, 0x61, 0x74, 0x73, 0x2e, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x06, - 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x1c, 0x0a, 0x09, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, - 0x61, 0x6d, 0x70, 0x18, 0x03, 0x20, 0x01, 0x28, 0x03, 0x52, 0x09, 0x74, 0x69, 0x6d, 0x65, 0x73, - 0x74, 0x61, 0x6d, 0x70, 0x12, 0x2a, 0x0a, 0x11, 0x6e, 0x75, 0x6d, 0x5f, 0x63, 0x61, 0x6c, 0x6c, - 0x73, 0x5f, 0x73, 0x74, 0x61, 0x72, 0x74, 0x65, 0x64, 0x18, 0x04, 0x20, 0x01, 0x28, 0x03, 0x52, - 0x0f, 0x6e, 0x75, 0x6d, 0x43, 0x61, 0x6c, 0x6c, 0x73, 0x53, 0x74, 0x61, 0x72, 0x74, 0x65, 0x64, - 0x12, 0x2c, 0x0a, 0x12, 0x6e, 0x75, 0x6d, 0x5f, 0x63, 0x61, 0x6c, 0x6c, 0x73, 0x5f, 0x66, 0x69, - 0x6e, 0x69, 0x73, 0x68, 0x65, 0x64, 0x18, 0x05, 0x20, 0x01, 0x28, 0x03, 0x52, 0x10, 0x6e, 0x75, - 0x6d, 0x43, 0x61, 0x6c, 0x6c, 0x73, 0x46, 0x69, 0x6e, 0x69, 0x73, 0x68, 0x65, 0x64, 0x12, 0x5d, - 0x0a, 0x2d, 0x6e, 0x75, 0x6d, 0x5f, 0x63, 0x61, 0x6c, 0x6c, 0x73, 0x5f, 0x66, 0x69, 0x6e, 0x69, - 0x73, 0x68, 0x65, 0x64, 0x5f, 0x77, 0x69, 0x74, 0x68, 0x5f, 0x63, 0x6c, 0x69, 0x65, 0x6e, 0x74, - 0x5f, 0x66, 0x61, 0x69, 0x6c, 0x65, 0x64, 0x5f, 0x74, 0x6f, 0x5f, 0x73, 0x65, 0x6e, 0x64, 0x18, - 0x06, 0x20, 0x01, 0x28, 0x03, 0x52, 0x26, 0x6e, 0x75, 0x6d, 0x43, 0x61, 0x6c, 0x6c, 0x73, 0x46, - 0x69, 0x6e, 0x69, 0x73, 0x68, 0x65, 0x64, 0x57, 0x69, 0x74, 0x68, 0x43, 0x6c, 0x69, 0x65, 0x6e, - 0x74, 0x46, 0x61, 0x69, 0x6c, 0x65, 0x64, 0x54, 0x6f, 0x53, 0x65, 0x6e, 0x64, 0x12, 0x48, 0x0a, - 0x21, 0x6e, 0x75, 0x6d, 0x5f, 0x63, 0x61, 0x6c, 0x6c, 0x73, 0x5f, 0x66, 0x69, 0x6e, 0x69, 0x73, - 0x68, 0x65, 0x64, 0x5f, 0x6b, 0x6e, 0x6f, 0x77, 0x6e, 0x5f, 0x72, 0x65, 0x63, 0x65, 0x69, 0x76, - 0x65, 0x64, 0x18, 0x07, 0x20, 0x01, 0x28, 0x03, 0x52, 0x1d, 0x6e, 0x75, 0x6d, 0x43, 0x61, 0x6c, - 0x6c, 0x73, 0x46, 0x69, 0x6e, 0x69, 0x73, 0x68, 0x65, 0x64, 0x4b, 0x6e, 0x6f, 0x77, 0x6e, 0x52, - 0x65, 0x63, 0x65, 0x69, 0x76, 0x65, 0x64, 0x22, 0x2a, 0x0a, 0x06, 0x53, 0x74, 0x61, 0x74, 0x75, - 0x73, 0x12, 0x0b, 0x0a, 0x07, 0x55, 0x4e, 0x4b, 0x4e, 0x4f, 0x57, 0x4e, 0x10, 0x00, 0x12, 0x06, - 0x0a, 0x02, 0x4f, 0x4b, 0x10, 0x01, 0x12, 0x0b, 0x0a, 0x07, 0x43, 0x4c, 0x4f, 0x53, 0x49, 0x4e, - 0x47, 0x10, 0x02, 0x22, 0xed, 0x01, 0x0a, 0x0f, 0x43, 0x6c, 0x75, 0x73, 0x74, 0x65, 0x72, 0x52, - 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x58, 0x0a, 0x0f, 0x63, 0x6c, 0x69, 0x65, 0x6e, - 0x74, 0x5f, 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, - 0x32, 0x2a, 0x2e, 0x63, 0x61, 0x73, 0x74, 0x61, 0x69, 0x2e, 0x63, 0x6c, 0x6f, 0x75, 0x64, 0x2e, - 0x70, 0x72, 0x6f, 0x78, 0x79, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x2e, 0x43, 0x6c, - 0x69, 0x65, 0x6e, 0x74, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x48, 0x00, 0x52, 0x0e, - 0x63, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x88, 0x01, - 0x01, 0x12, 0x1d, 0x0a, 0x0a, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x5f, 0x69, 0x64, 0x18, - 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x49, 0x64, - 0x12, 0x4d, 0x0a, 0x0d, 0x68, 0x74, 0x74, 0x70, 0x5f, 0x72, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, - 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x28, 0x2e, 0x63, 0x61, 0x73, 0x74, 0x61, 0x69, - 0x2e, 0x63, 0x6c, 0x6f, 0x75, 0x64, 0x2e, 0x70, 0x72, 0x6f, 0x78, 0x79, 0x2e, 0x76, 0x31, 0x61, - 0x6c, 0x70, 0x68, 0x61, 0x2e, 0x48, 0x54, 0x54, 0x50, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, - 0x65, 0x52, 0x0c, 0x68, 0x74, 0x74, 0x70, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x42, - 0x12, 0x0a, 0x10, 0x5f, 0x63, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x5f, 0x6d, 0x65, 0x74, 0x61, 0x64, - 0x61, 0x74, 0x61, 0x22, 0x94, 0x01, 0x0a, 0x11, 0x43, 0x6c, 0x6f, 0x75, 0x64, 0x50, 0x72, 0x6f, - 0x78, 0x79, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x1d, 0x0a, 0x0a, 0x6d, 0x65, 0x73, - 0x73, 0x61, 0x67, 0x65, 0x5f, 0x69, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x6d, - 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x49, 0x64, 0x12, 0x4f, 0x0a, 0x0c, 0x68, 0x74, 0x74, 0x70, - 0x5f, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x27, - 0x2e, 0x63, 0x61, 0x73, 0x74, 0x61, 0x69, 0x2e, 0x63, 0x6c, 0x6f, 0x75, 0x64, 0x2e, 0x70, 0x72, - 0x6f, 0x78, 0x79, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x2e, 0x48, 0x54, 0x54, 0x50, - 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x48, 0x00, 0x52, 0x0b, 0x68, 0x74, 0x74, 0x70, 0x52, - 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x88, 0x01, 0x01, 0x42, 0x0f, 0x0a, 0x0d, 0x5f, 0x68, 0x74, - 0x74, 0x70, 0x5f, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x22, 0x8f, 0x03, 0x0a, 0x18, 0x53, - 0x74, 0x72, 0x65, 0x61, 0x6d, 0x43, 0x6c, 0x6f, 0x75, 0x64, 0x50, 0x72, 0x6f, 0x78, 0x79, 0x52, - 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x58, 0x0a, 0x0f, 0x63, 0x6c, 0x69, 0x65, 0x6e, + 0x65, 0x73, 0x74, 0x12, 0x4c, 0x0a, 0x0c, 0x63, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x5f, 0x73, 0x74, + 0x61, 0x74, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x27, 0x2e, 0x63, 0x61, 0x73, 0x74, + 0x61, 0x69, 0x2e, 0x63, 0x6c, 0x6f, 0x75, 0x64, 0x2e, 0x70, 0x72, 0x6f, 0x78, 0x79, 0x2e, 0x76, + 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x2e, 0x43, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x53, 0x74, 0x61, + 0x74, 0x73, 0x48, 0x00, 0x52, 0x0b, 0x63, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x53, 0x74, 0x61, 0x74, + 0x73, 0x12, 0x49, 0x0a, 0x08, 0x72, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x18, 0x03, 0x20, + 0x01, 0x28, 0x0b, 0x32, 0x2b, 0x2e, 0x63, 0x61, 0x73, 0x74, 0x61, 0x69, 0x2e, 0x63, 0x6c, 0x6f, + 0x75, 0x64, 0x2e, 0x70, 0x72, 0x6f, 0x78, 0x79, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, + 0x2e, 0x43, 0x6c, 0x75, 0x73, 0x74, 0x65, 0x72, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, + 0x48, 0x00, 0x52, 0x08, 0x72, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x42, 0x09, 0x0a, 0x07, + 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x22, 0xd2, 0x03, 0x0a, 0x0b, 0x43, 0x6c, 0x69, 0x65, + 0x6e, 0x74, 0x53, 0x74, 0x61, 0x74, 0x73, 0x12, 0x53, 0x0a, 0x0f, 0x63, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x5f, 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2a, 0x2e, 0x63, 0x61, 0x73, 0x74, 0x61, 0x69, 0x2e, 0x63, 0x6c, 0x6f, 0x75, 0x64, 0x2e, 0x70, 0x72, 0x6f, 0x78, 0x79, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x2e, 0x43, 0x6c, - 0x69, 0x65, 0x6e, 0x74, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x48, 0x00, 0x52, 0x0e, - 0x63, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x88, 0x01, - 0x01, 0x12, 0x1d, 0x0a, 0x0a, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x5f, 0x69, 0x64, 0x18, - 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x49, 0x64, - 0x12, 0x4f, 0x0a, 0x0c, 0x68, 0x74, 0x74, 0x70, 0x5f, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, - 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x27, 0x2e, 0x63, 0x61, 0x73, 0x74, 0x61, 0x69, 0x2e, - 0x63, 0x6c, 0x6f, 0x75, 0x64, 0x2e, 0x70, 0x72, 0x6f, 0x78, 0x79, 0x2e, 0x76, 0x31, 0x61, 0x6c, - 0x70, 0x68, 0x61, 0x2e, 0x48, 0x54, 0x54, 0x50, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x48, - 0x01, 0x52, 0x0b, 0x68, 0x74, 0x74, 0x70, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x88, 0x01, - 0x01, 0x12, 0x6a, 0x0a, 0x15, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x75, 0x72, 0x61, 0x74, 0x69, - 0x6f, 0x6e, 0x5f, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, - 0x32, 0x30, 0x2e, 0x63, 0x61, 0x73, 0x74, 0x61, 0x69, 0x2e, 0x63, 0x6c, 0x6f, 0x75, 0x64, 0x2e, - 0x70, 0x72, 0x6f, 0x78, 0x79, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x2e, 0x43, 0x6f, - 0x6e, 0x66, 0x69, 0x67, 0x75, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, - 0x73, 0x74, 0x48, 0x02, 0x52, 0x14, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x75, 0x72, 0x61, 0x74, - 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x88, 0x01, 0x01, 0x42, 0x12, 0x0a, - 0x10, 0x5f, 0x63, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x5f, 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, - 0x61, 0x42, 0x0f, 0x0a, 0x0d, 0x5f, 0x68, 0x74, 0x74, 0x70, 0x5f, 0x72, 0x65, 0x71, 0x75, 0x65, - 0x73, 0x74, 0x42, 0x18, 0x0a, 0x16, 0x5f, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x75, 0x72, 0x61, - 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x22, 0x63, 0x0a, 0x14, - 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x75, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x71, - 0x75, 0x65, 0x73, 0x74, 0x12, 0x1d, 0x0a, 0x0a, 0x6b, 0x65, 0x65, 0x70, 0x5f, 0x61, 0x6c, 0x69, - 0x76, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x09, 0x6b, 0x65, 0x65, 0x70, 0x41, 0x6c, - 0x69, 0x76, 0x65, 0x12, 0x2c, 0x0a, 0x12, 0x6b, 0x65, 0x65, 0x70, 0x5f, 0x61, 0x6c, 0x69, 0x76, - 0x65, 0x5f, 0x74, 0x69, 0x6d, 0x65, 0x6f, 0x75, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x52, - 0x10, 0x6b, 0x65, 0x65, 0x70, 0x41, 0x6c, 0x69, 0x76, 0x65, 0x54, 0x69, 0x6d, 0x65, 0x6f, 0x75, - 0x74, 0x22, 0x90, 0x02, 0x0a, 0x0b, 0x48, 0x54, 0x54, 0x50, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, - 0x74, 0x12, 0x16, 0x0a, 0x06, 0x6d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, - 0x09, 0x52, 0x06, 0x6d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x12, 0x12, 0x0a, 0x04, 0x70, 0x61, 0x74, - 0x68, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x70, 0x61, 0x74, 0x68, 0x12, 0x17, 0x0a, - 0x04, 0x62, 0x6f, 0x64, 0x79, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0c, 0x48, 0x00, 0x52, 0x04, 0x62, - 0x6f, 0x64, 0x79, 0x88, 0x01, 0x01, 0x12, 0x4e, 0x0a, 0x07, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, - 0x73, 0x18, 0x04, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x34, 0x2e, 0x63, 0x61, 0x73, 0x74, 0x61, 0x69, + 0x69, 0x65, 0x6e, 0x74, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x52, 0x0e, 0x63, 0x6c, + 0x69, 0x65, 0x6e, 0x74, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x12, 0x43, 0x0a, 0x05, + 0x73, 0x74, 0x61, 0x74, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2d, 0x2e, 0x63, 0x61, + 0x73, 0x74, 0x61, 0x69, 0x2e, 0x63, 0x6c, 0x6f, 0x75, 0x64, 0x2e, 0x70, 0x72, 0x6f, 0x78, 0x79, + 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x2e, 0x43, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x53, + 0x74, 0x61, 0x74, 0x73, 0x2e, 0x53, 0x74, 0x61, 0x74, 0x73, 0x52, 0x05, 0x73, 0x74, 0x61, 0x74, + 0x73, 0x1a, 0xa8, 0x02, 0x0a, 0x05, 0x53, 0x74, 0x61, 0x74, 0x73, 0x12, 0x1c, 0x0a, 0x09, 0x74, + 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x52, 0x09, + 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x12, 0x2a, 0x0a, 0x11, 0x6e, 0x75, 0x6d, + 0x5f, 0x63, 0x61, 0x6c, 0x6c, 0x73, 0x5f, 0x73, 0x74, 0x61, 0x72, 0x74, 0x65, 0x64, 0x18, 0x03, + 0x20, 0x01, 0x28, 0x03, 0x52, 0x0f, 0x6e, 0x75, 0x6d, 0x43, 0x61, 0x6c, 0x6c, 0x73, 0x53, 0x74, + 0x61, 0x72, 0x74, 0x65, 0x64, 0x12, 0x2c, 0x0a, 0x12, 0x6e, 0x75, 0x6d, 0x5f, 0x63, 0x61, 0x6c, + 0x6c, 0x73, 0x5f, 0x66, 0x69, 0x6e, 0x69, 0x73, 0x68, 0x65, 0x64, 0x18, 0x04, 0x20, 0x01, 0x28, + 0x03, 0x52, 0x10, 0x6e, 0x75, 0x6d, 0x43, 0x61, 0x6c, 0x6c, 0x73, 0x46, 0x69, 0x6e, 0x69, 0x73, + 0x68, 0x65, 0x64, 0x12, 0x5d, 0x0a, 0x2d, 0x6e, 0x75, 0x6d, 0x5f, 0x63, 0x61, 0x6c, 0x6c, 0x73, + 0x5f, 0x66, 0x69, 0x6e, 0x69, 0x73, 0x68, 0x65, 0x64, 0x5f, 0x77, 0x69, 0x74, 0x68, 0x5f, 0x63, + 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x5f, 0x66, 0x61, 0x69, 0x6c, 0x65, 0x64, 0x5f, 0x74, 0x6f, 0x5f, + 0x73, 0x65, 0x6e, 0x64, 0x18, 0x05, 0x20, 0x01, 0x28, 0x03, 0x52, 0x26, 0x6e, 0x75, 0x6d, 0x43, + 0x61, 0x6c, 0x6c, 0x73, 0x46, 0x69, 0x6e, 0x69, 0x73, 0x68, 0x65, 0x64, 0x57, 0x69, 0x74, 0x68, + 0x43, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x46, 0x61, 0x69, 0x6c, 0x65, 0x64, 0x54, 0x6f, 0x53, 0x65, + 0x6e, 0x64, 0x12, 0x48, 0x0a, 0x21, 0x6e, 0x75, 0x6d, 0x5f, 0x63, 0x61, 0x6c, 0x6c, 0x73, 0x5f, + 0x66, 0x69, 0x6e, 0x69, 0x73, 0x68, 0x65, 0x64, 0x5f, 0x6b, 0x6e, 0x6f, 0x77, 0x6e, 0x5f, 0x72, + 0x65, 0x63, 0x65, 0x69, 0x76, 0x65, 0x64, 0x18, 0x06, 0x20, 0x01, 0x28, 0x03, 0x52, 0x1d, 0x6e, + 0x75, 0x6d, 0x43, 0x61, 0x6c, 0x6c, 0x73, 0x46, 0x69, 0x6e, 0x69, 0x73, 0x68, 0x65, 0x64, 0x4b, + 0x6e, 0x6f, 0x77, 0x6e, 0x52, 0x65, 0x63, 0x65, 0x69, 0x76, 0x65, 0x64, 0x22, 0xed, 0x01, 0x0a, + 0x0f, 0x43, 0x6c, 0x75, 0x73, 0x74, 0x65, 0x72, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, + 0x12, 0x58, 0x0a, 0x0f, 0x63, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x5f, 0x6d, 0x65, 0x74, 0x61, 0x64, + 0x61, 0x74, 0x61, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2a, 0x2e, 0x63, 0x61, 0x73, 0x74, + 0x61, 0x69, 0x2e, 0x63, 0x6c, 0x6f, 0x75, 0x64, 0x2e, 0x70, 0x72, 0x6f, 0x78, 0x79, 0x2e, 0x76, + 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x2e, 0x43, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x4d, 0x65, 0x74, + 0x61, 0x64, 0x61, 0x74, 0x61, 0x48, 0x00, 0x52, 0x0e, 0x63, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x4d, + 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x88, 0x01, 0x01, 0x12, 0x1d, 0x0a, 0x0a, 0x6d, 0x65, + 0x73, 0x73, 0x61, 0x67, 0x65, 0x5f, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, + 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x49, 0x64, 0x12, 0x4d, 0x0a, 0x0d, 0x68, 0x74, 0x74, + 0x70, 0x5f, 0x72, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, + 0x32, 0x28, 0x2e, 0x63, 0x61, 0x73, 0x74, 0x61, 0x69, 0x2e, 0x63, 0x6c, 0x6f, 0x75, 0x64, 0x2e, + 0x70, 0x72, 0x6f, 0x78, 0x79, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x2e, 0x48, 0x54, + 0x54, 0x50, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x52, 0x0c, 0x68, 0x74, 0x74, 0x70, + 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x42, 0x12, 0x0a, 0x10, 0x5f, 0x63, 0x6c, 0x69, + 0x65, 0x6e, 0x74, 0x5f, 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x22, 0x94, 0x01, 0x0a, + 0x11, 0x43, 0x6c, 0x6f, 0x75, 0x64, 0x50, 0x72, 0x6f, 0x78, 0x79, 0x52, 0x65, 0x71, 0x75, 0x65, + 0x73, 0x74, 0x12, 0x1d, 0x0a, 0x0a, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x5f, 0x69, 0x64, + 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x49, + 0x64, 0x12, 0x4f, 0x0a, 0x0c, 0x68, 0x74, 0x74, 0x70, 0x5f, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, + 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x27, 0x2e, 0x63, 0x61, 0x73, 0x74, 0x61, 0x69, 0x2e, 0x63, 0x6c, 0x6f, 0x75, 0x64, 0x2e, 0x70, 0x72, 0x6f, 0x78, 0x79, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x2e, 0x48, 0x54, 0x54, 0x50, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, + 0x48, 0x00, 0x52, 0x0b, 0x68, 0x74, 0x74, 0x70, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x88, + 0x01, 0x01, 0x42, 0x0f, 0x0a, 0x0d, 0x5f, 0x68, 0x74, 0x74, 0x70, 0x5f, 0x72, 0x65, 0x71, 0x75, + 0x65, 0x73, 0x74, 0x22, 0xea, 0x02, 0x0a, 0x18, 0x53, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x43, 0x6c, + 0x6f, 0x75, 0x64, 0x50, 0x72, 0x6f, 0x78, 0x79, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, + 0x12, 0x58, 0x0a, 0x0f, 0x63, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x5f, 0x6d, 0x65, 0x74, 0x61, 0x64, + 0x61, 0x74, 0x61, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2a, 0x2e, 0x63, 0x61, 0x73, 0x74, + 0x61, 0x69, 0x2e, 0x63, 0x6c, 0x6f, 0x75, 0x64, 0x2e, 0x70, 0x72, 0x6f, 0x78, 0x79, 0x2e, 0x76, + 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x2e, 0x43, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x4d, 0x65, 0x74, + 0x61, 0x64, 0x61, 0x74, 0x61, 0x48, 0x01, 0x52, 0x0e, 0x63, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x4d, + 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x88, 0x01, 0x01, 0x12, 0x1d, 0x0a, 0x0a, 0x6d, 0x65, + 0x73, 0x73, 0x61, 0x67, 0x65, 0x5f, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, + 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x49, 0x64, 0x12, 0x4c, 0x0a, 0x0c, 0x68, 0x74, 0x74, + 0x70, 0x5f, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, + 0x27, 0x2e, 0x63, 0x61, 0x73, 0x74, 0x61, 0x69, 0x2e, 0x63, 0x6c, 0x6f, 0x75, 0x64, 0x2e, 0x70, + 0x72, 0x6f, 0x78, 0x79, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x2e, 0x48, 0x54, 0x54, + 0x50, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x48, 0x00, 0x52, 0x0b, 0x68, 0x74, 0x74, 0x70, + 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x67, 0x0a, 0x15, 0x63, 0x6f, 0x6e, 0x66, 0x69, + 0x67, 0x75, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, + 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x30, 0x2e, 0x63, 0x61, 0x73, 0x74, 0x61, 0x69, 0x2e, + 0x63, 0x6c, 0x6f, 0x75, 0x64, 0x2e, 0x70, 0x72, 0x6f, 0x78, 0x79, 0x2e, 0x76, 0x31, 0x61, 0x6c, + 0x70, 0x68, 0x61, 0x2e, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x75, 0x72, 0x61, 0x74, 0x69, 0x6f, + 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x48, 0x00, 0x52, 0x14, 0x63, 0x6f, 0x6e, 0x66, + 0x69, 0x67, 0x75, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, + 0x42, 0x0a, 0x0a, 0x08, 0x72, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x42, 0x12, 0x0a, 0x10, + 0x5f, 0x63, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x5f, 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, + 0x22, 0x63, 0x0a, 0x14, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x75, 0x72, 0x61, 0x74, 0x69, 0x6f, + 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x1d, 0x0a, 0x0a, 0x6b, 0x65, 0x65, 0x70, + 0x5f, 0x61, 0x6c, 0x69, 0x76, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x09, 0x6b, 0x65, + 0x65, 0x70, 0x41, 0x6c, 0x69, 0x76, 0x65, 0x12, 0x2c, 0x0a, 0x12, 0x6b, 0x65, 0x65, 0x70, 0x5f, + 0x61, 0x6c, 0x69, 0x76, 0x65, 0x5f, 0x74, 0x69, 0x6d, 0x65, 0x6f, 0x75, 0x74, 0x18, 0x02, 0x20, + 0x01, 0x28, 0x03, 0x52, 0x10, 0x6b, 0x65, 0x65, 0x70, 0x41, 0x6c, 0x69, 0x76, 0x65, 0x54, 0x69, + 0x6d, 0x65, 0x6f, 0x75, 0x74, 0x22, 0x90, 0x02, 0x0a, 0x0b, 0x48, 0x54, 0x54, 0x50, 0x52, 0x65, + 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x16, 0x0a, 0x06, 0x6d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x18, + 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x6d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x12, 0x12, 0x0a, + 0x04, 0x70, 0x61, 0x74, 0x68, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x70, 0x61, 0x74, + 0x68, 0x12, 0x17, 0x0a, 0x04, 0x62, 0x6f, 0x64, 0x79, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0c, 0x48, + 0x00, 0x52, 0x04, 0x62, 0x6f, 0x64, 0x79, 0x88, 0x01, 0x01, 0x12, 0x4e, 0x0a, 0x07, 0x68, 0x65, + 0x61, 0x64, 0x65, 0x72, 0x73, 0x18, 0x04, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x34, 0x2e, 0x63, 0x61, + 0x73, 0x74, 0x61, 0x69, 0x2e, 0x63, 0x6c, 0x6f, 0x75, 0x64, 0x2e, 0x70, 0x72, 0x6f, 0x78, 0x79, + 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x2e, 0x48, 0x54, 0x54, 0x50, 0x52, 0x65, 0x71, + 0x75, 0x65, 0x73, 0x74, 0x2e, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x73, 0x45, 0x6e, 0x74, 0x72, + 0x79, 0x52, 0x07, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x73, 0x1a, 0x63, 0x0a, 0x0c, 0x48, 0x65, + 0x61, 0x64, 0x65, 0x72, 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, + 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x3d, 0x0a, 0x05, + 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x27, 0x2e, 0x63, 0x61, + 0x73, 0x74, 0x61, 0x69, 0x2e, 0x63, 0x6c, 0x6f, 0x75, 0x64, 0x2e, 0x70, 0x72, 0x6f, 0x78, 0x79, + 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x2e, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x56, + 0x61, 0x6c, 0x75, 0x65, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x42, + 0x07, 0x0a, 0x05, 0x5f, 0x62, 0x6f, 0x64, 0x79, 0x22, 0xa3, 0x02, 0x0a, 0x0c, 0x48, 0x54, 0x54, + 0x50, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x17, 0x0a, 0x04, 0x62, 0x6f, 0x64, + 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x48, 0x00, 0x52, 0x04, 0x62, 0x6f, 0x64, 0x79, 0x88, + 0x01, 0x01, 0x12, 0x19, 0x0a, 0x05, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, + 0x09, 0x48, 0x01, 0x52, 0x05, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x88, 0x01, 0x01, 0x12, 0x16, 0x0a, + 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x18, 0x03, 0x20, 0x01, 0x28, 0x03, 0x52, 0x06, 0x73, + 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x4f, 0x0a, 0x07, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x73, + 0x18, 0x04, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x35, 0x2e, 0x63, 0x61, 0x73, 0x74, 0x61, 0x69, 0x2e, + 0x63, 0x6c, 0x6f, 0x75, 0x64, 0x2e, 0x70, 0x72, 0x6f, 0x78, 0x79, 0x2e, 0x76, 0x31, 0x61, 0x6c, + 0x70, 0x68, 0x61, 0x2e, 0x48, 0x54, 0x54, 0x50, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x2e, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x07, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x73, 0x1a, 0x63, 0x0a, 0x0c, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, @@ -1117,77 +1016,61 @@ var file_proto_v1alpha_proxy_proto_rawDesc = []byte{ 0x2e, 0x63, 0x6c, 0x6f, 0x75, 0x64, 0x2e, 0x70, 0x72, 0x6f, 0x78, 0x79, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x2e, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x42, 0x07, 0x0a, 0x05, 0x5f, - 0x62, 0x6f, 0x64, 0x79, 0x22, 0xa3, 0x02, 0x0a, 0x0c, 0x48, 0x54, 0x54, 0x50, 0x52, 0x65, 0x73, - 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x17, 0x0a, 0x04, 0x62, 0x6f, 0x64, 0x79, 0x18, 0x01, 0x20, - 0x01, 0x28, 0x0c, 0x48, 0x00, 0x52, 0x04, 0x62, 0x6f, 0x64, 0x79, 0x88, 0x01, 0x01, 0x12, 0x19, - 0x0a, 0x05, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x48, 0x01, 0x52, - 0x05, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x88, 0x01, 0x01, 0x12, 0x16, 0x0a, 0x06, 0x73, 0x74, 0x61, - 0x74, 0x75, 0x73, 0x18, 0x03, 0x20, 0x01, 0x28, 0x03, 0x52, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, - 0x73, 0x12, 0x4f, 0x0a, 0x07, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x73, 0x18, 0x04, 0x20, 0x03, - 0x28, 0x0b, 0x32, 0x35, 0x2e, 0x63, 0x61, 0x73, 0x74, 0x61, 0x69, 0x2e, 0x63, 0x6c, 0x6f, 0x75, - 0x64, 0x2e, 0x70, 0x72, 0x6f, 0x78, 0x79, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x2e, - 0x48, 0x54, 0x54, 0x50, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x2e, 0x48, 0x65, 0x61, - 0x64, 0x65, 0x72, 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x07, 0x68, 0x65, 0x61, 0x64, 0x65, - 0x72, 0x73, 0x1a, 0x63, 0x0a, 0x0c, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x73, 0x45, 0x6e, 0x74, - 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, - 0x03, 0x6b, 0x65, 0x79, 0x12, 0x3d, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, - 0x01, 0x28, 0x0b, 0x32, 0x27, 0x2e, 0x63, 0x61, 0x73, 0x74, 0x61, 0x69, 0x2e, 0x63, 0x6c, 0x6f, + 0x62, 0x6f, 0x64, 0x79, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x22, 0x23, + 0x0a, 0x0b, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x14, 0x0a, + 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x01, 0x20, 0x03, 0x28, 0x09, 0x52, 0x05, 0x76, 0x61, + 0x6c, 0x75, 0x65, 0x22, 0xb5, 0x01, 0x0a, 0x12, 0x53, 0x65, 0x6e, 0x64, 0x54, 0x6f, 0x50, 0x72, + 0x6f, 0x78, 0x79, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x53, 0x0a, 0x0f, 0x63, 0x6c, + 0x69, 0x65, 0x6e, 0x74, 0x5f, 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x18, 0x01, 0x20, + 0x01, 0x28, 0x0b, 0x32, 0x2a, 0x2e, 0x63, 0x61, 0x73, 0x74, 0x61, 0x69, 0x2e, 0x63, 0x6c, 0x6f, 0x75, 0x64, 0x2e, 0x70, 0x72, 0x6f, 0x78, 0x79, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, - 0x2e, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x52, 0x05, 0x76, 0x61, - 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x42, 0x07, 0x0a, 0x05, 0x5f, 0x62, 0x6f, 0x64, 0x79, - 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x22, 0x23, 0x0a, 0x0b, 0x48, 0x65, - 0x61, 0x64, 0x65, 0x72, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, - 0x75, 0x65, 0x18, 0x01, 0x20, 0x03, 0x28, 0x09, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22, - 0xb5, 0x01, 0x0a, 0x12, 0x53, 0x65, 0x6e, 0x64, 0x54, 0x6f, 0x50, 0x72, 0x6f, 0x78, 0x79, 0x52, - 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x53, 0x0a, 0x0f, 0x63, 0x6c, 0x69, 0x65, 0x6e, 0x74, - 0x5f, 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, - 0x2a, 0x2e, 0x63, 0x61, 0x73, 0x74, 0x61, 0x69, 0x2e, 0x63, 0x6c, 0x6f, 0x75, 0x64, 0x2e, 0x70, - 0x72, 0x6f, 0x78, 0x79, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x2e, 0x43, 0x6c, 0x69, - 0x65, 0x6e, 0x74, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x52, 0x0e, 0x63, 0x6c, 0x69, - 0x65, 0x6e, 0x74, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x12, 0x4a, 0x0a, 0x0c, 0x68, - 0x74, 0x74, 0x70, 0x5f, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, - 0x0b, 0x32, 0x27, 0x2e, 0x63, 0x61, 0x73, 0x74, 0x61, 0x69, 0x2e, 0x63, 0x6c, 0x6f, 0x75, 0x64, - 0x2e, 0x70, 0x72, 0x6f, 0x78, 0x79, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x2e, 0x48, - 0x54, 0x54, 0x50, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x52, 0x0b, 0x68, 0x74, 0x74, 0x70, - 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x22, 0x7a, 0x0a, 0x13, 0x53, 0x65, 0x6e, 0x64, 0x54, - 0x6f, 0x50, 0x72, 0x6f, 0x78, 0x79, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x4d, - 0x0a, 0x0d, 0x68, 0x74, 0x74, 0x70, 0x5f, 0x72, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x18, - 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x28, 0x2e, 0x63, 0x61, 0x73, 0x74, 0x61, 0x69, 0x2e, 0x63, + 0x2e, 0x43, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x52, + 0x0e, 0x63, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x12, + 0x4a, 0x0a, 0x0c, 0x68, 0x74, 0x74, 0x70, 0x5f, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x18, + 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x27, 0x2e, 0x63, 0x61, 0x73, 0x74, 0x61, 0x69, 0x2e, 0x63, 0x6c, 0x6f, 0x75, 0x64, 0x2e, 0x70, 0x72, 0x6f, 0x78, 0x79, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, - 0x68, 0x61, 0x2e, 0x48, 0x54, 0x54, 0x50, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x52, - 0x0c, 0x68, 0x74, 0x74, 0x70, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x14, 0x0a, - 0x05, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x65, 0x72, - 0x72, 0x6f, 0x72, 0x22, 0x8c, 0x01, 0x0a, 0x0e, 0x43, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x4d, 0x65, - 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x12, 0x1d, 0x0a, 0x0a, 0x63, 0x6c, 0x75, 0x73, 0x74, 0x65, - 0x72, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x63, 0x6c, 0x75, 0x73, - 0x74, 0x65, 0x72, 0x49, 0x64, 0x12, 0x2c, 0x0a, 0x0f, 0x6f, 0x72, 0x67, 0x61, 0x6e, 0x69, 0x7a, - 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, - 0x52, 0x0e, 0x6f, 0x72, 0x67, 0x61, 0x6e, 0x69, 0x7a, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x49, 0x64, - 0x88, 0x01, 0x01, 0x12, 0x19, 0x0a, 0x08, 0x70, 0x6f, 0x64, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, - 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x70, 0x6f, 0x64, 0x4e, 0x61, 0x6d, 0x65, 0x42, 0x12, - 0x0a, 0x10, 0x5f, 0x6f, 0x72, 0x67, 0x61, 0x6e, 0x69, 0x7a, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x5f, - 0x69, 0x64, 0x32, 0x87, 0x02, 0x0a, 0x0d, 0x43, 0x6c, 0x6f, 0x75, 0x64, 0x50, 0x72, 0x6f, 0x78, - 0x79, 0x41, 0x50, 0x49, 0x12, 0x83, 0x01, 0x0a, 0x10, 0x53, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x43, - 0x6c, 0x6f, 0x75, 0x64, 0x50, 0x72, 0x6f, 0x78, 0x79, 0x12, 0x33, 0x2e, 0x63, 0x61, 0x73, 0x74, - 0x61, 0x69, 0x2e, 0x63, 0x6c, 0x6f, 0x75, 0x64, 0x2e, 0x70, 0x72, 0x6f, 0x78, 0x79, 0x2e, 0x76, - 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x2e, 0x53, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x43, 0x6c, 0x6f, - 0x75, 0x64, 0x50, 0x72, 0x6f, 0x78, 0x79, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x34, - 0x2e, 0x63, 0x61, 0x73, 0x74, 0x61, 0x69, 0x2e, 0x63, 0x6c, 0x6f, 0x75, 0x64, 0x2e, 0x70, 0x72, - 0x6f, 0x78, 0x79, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x2e, 0x53, 0x74, 0x72, 0x65, - 0x61, 0x6d, 0x43, 0x6c, 0x6f, 0x75, 0x64, 0x50, 0x72, 0x6f, 0x78, 0x79, 0x52, 0x65, 0x73, 0x70, - 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x28, 0x01, 0x30, 0x01, 0x12, 0x70, 0x0a, 0x0b, 0x53, 0x65, - 0x6e, 0x64, 0x54, 0x6f, 0x50, 0x72, 0x6f, 0x78, 0x79, 0x12, 0x2e, 0x2e, 0x63, 0x61, 0x73, 0x74, - 0x61, 0x69, 0x2e, 0x63, 0x6c, 0x6f, 0x75, 0x64, 0x2e, 0x70, 0x72, 0x6f, 0x78, 0x79, 0x2e, 0x76, - 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x2e, 0x53, 0x65, 0x6e, 0x64, 0x54, 0x6f, 0x50, 0x72, 0x6f, - 0x78, 0x79, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x2f, 0x2e, 0x63, 0x61, 0x73, 0x74, + 0x68, 0x61, 0x2e, 0x48, 0x54, 0x54, 0x50, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x52, 0x0b, + 0x68, 0x74, 0x74, 0x70, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x22, 0x7a, 0x0a, 0x13, 0x53, + 0x65, 0x6e, 0x64, 0x54, 0x6f, 0x50, 0x72, 0x6f, 0x78, 0x79, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, + 0x73, 0x65, 0x12, 0x4d, 0x0a, 0x0d, 0x68, 0x74, 0x74, 0x70, 0x5f, 0x72, 0x65, 0x73, 0x70, 0x6f, + 0x6e, 0x73, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x28, 0x2e, 0x63, 0x61, 0x73, 0x74, 0x61, 0x69, 0x2e, 0x63, 0x6c, 0x6f, 0x75, 0x64, 0x2e, 0x70, 0x72, 0x6f, 0x78, 0x79, 0x2e, 0x76, - 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x2e, 0x53, 0x65, 0x6e, 0x64, 0x54, 0x6f, 0x50, 0x72, 0x6f, - 0x78, 0x79, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x42, 0x49, 0x5a, 0x47, - 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x63, 0x61, 0x73, 0x74, 0x61, - 0x69, 0x2f, 0x63, 0x6c, 0x6f, 0x75, 0x64, 0x2d, 0x70, 0x72, 0x6f, 0x78, 0x79, 0x2f, 0x70, 0x72, - 0x6f, 0x74, 0x6f, 0x2f, 0x67, 0x65, 0x6e, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x76, 0x31, - 0x61, 0x6c, 0x70, 0x68, 0x61, 0x3b, 0x63, 0x6c, 0x6f, 0x75, 0x64, 0x70, 0x72, 0x6f, 0x78, 0x79, - 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x2e, 0x48, 0x54, 0x54, 0x50, 0x52, 0x65, 0x73, 0x70, 0x6f, + 0x6e, 0x73, 0x65, 0x52, 0x0c, 0x68, 0x74, 0x74, 0x70, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, + 0x65, 0x12, 0x14, 0x0a, 0x05, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, + 0x52, 0x05, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x22, 0xa6, 0x01, 0x0a, 0x0e, 0x43, 0x6c, 0x69, 0x65, + 0x6e, 0x74, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x12, 0x1d, 0x0a, 0x0a, 0x63, 0x6c, + 0x75, 0x73, 0x74, 0x65, 0x72, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, + 0x63, 0x6c, 0x75, 0x73, 0x74, 0x65, 0x72, 0x49, 0x64, 0x12, 0x2c, 0x0a, 0x0f, 0x6f, 0x72, 0x67, + 0x61, 0x6e, 0x69, 0x7a, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, + 0x28, 0x09, 0x48, 0x00, 0x52, 0x0e, 0x6f, 0x72, 0x67, 0x61, 0x6e, 0x69, 0x7a, 0x61, 0x74, 0x69, + 0x6f, 0x6e, 0x49, 0x64, 0x88, 0x01, 0x01, 0x12, 0x19, 0x0a, 0x08, 0x70, 0x6f, 0x64, 0x5f, 0x6e, + 0x61, 0x6d, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x70, 0x6f, 0x64, 0x4e, 0x61, + 0x6d, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x04, 0x20, + 0x01, 0x28, 0x09, 0x52, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x42, 0x12, 0x0a, 0x10, + 0x5f, 0x6f, 0x72, 0x67, 0x61, 0x6e, 0x69, 0x7a, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x69, 0x64, + 0x32, 0x87, 0x02, 0x0a, 0x0d, 0x43, 0x6c, 0x6f, 0x75, 0x64, 0x50, 0x72, 0x6f, 0x78, 0x79, 0x41, + 0x50, 0x49, 0x12, 0x83, 0x01, 0x0a, 0x10, 0x53, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x43, 0x6c, 0x6f, + 0x75, 0x64, 0x50, 0x72, 0x6f, 0x78, 0x79, 0x12, 0x33, 0x2e, 0x63, 0x61, 0x73, 0x74, 0x61, 0x69, + 0x2e, 0x63, 0x6c, 0x6f, 0x75, 0x64, 0x2e, 0x70, 0x72, 0x6f, 0x78, 0x79, 0x2e, 0x76, 0x31, 0x61, + 0x6c, 0x70, 0x68, 0x61, 0x2e, 0x53, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x43, 0x6c, 0x6f, 0x75, 0x64, + 0x50, 0x72, 0x6f, 0x78, 0x79, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x34, 0x2e, 0x63, + 0x61, 0x73, 0x74, 0x61, 0x69, 0x2e, 0x63, 0x6c, 0x6f, 0x75, 0x64, 0x2e, 0x70, 0x72, 0x6f, 0x78, + 0x79, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x2e, 0x53, 0x74, 0x72, 0x65, 0x61, 0x6d, + 0x43, 0x6c, 0x6f, 0x75, 0x64, 0x50, 0x72, 0x6f, 0x78, 0x79, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, + 0x73, 0x65, 0x22, 0x00, 0x28, 0x01, 0x30, 0x01, 0x12, 0x70, 0x0a, 0x0b, 0x53, 0x65, 0x6e, 0x64, + 0x54, 0x6f, 0x50, 0x72, 0x6f, 0x78, 0x79, 0x12, 0x2e, 0x2e, 0x63, 0x61, 0x73, 0x74, 0x61, 0x69, + 0x2e, 0x63, 0x6c, 0x6f, 0x75, 0x64, 0x2e, 0x70, 0x72, 0x6f, 0x78, 0x79, 0x2e, 0x76, 0x31, 0x61, + 0x6c, 0x70, 0x68, 0x61, 0x2e, 0x53, 0x65, 0x6e, 0x64, 0x54, 0x6f, 0x50, 0x72, 0x6f, 0x78, 0x79, + 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x2f, 0x2e, 0x63, 0x61, 0x73, 0x74, 0x61, 0x69, + 0x2e, 0x63, 0x6c, 0x6f, 0x75, 0x64, 0x2e, 0x70, 0x72, 0x6f, 0x78, 0x79, 0x2e, 0x76, 0x31, 0x61, + 0x6c, 0x70, 0x68, 0x61, 0x2e, 0x53, 0x65, 0x6e, 0x64, 0x54, 0x6f, 0x50, 0x72, 0x6f, 0x78, 0x79, + 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x42, 0x49, 0x5a, 0x47, 0x67, 0x69, + 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x63, 0x61, 0x73, 0x74, 0x61, 0x69, 0x2f, + 0x63, 0x6c, 0x6f, 0x75, 0x64, 0x2d, 0x70, 0x72, 0x6f, 0x78, 0x79, 0x2f, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x2f, 0x67, 0x65, 0x6e, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x76, 0x31, 0x61, 0x6c, + 0x70, 0x68, 0x61, 0x3b, 0x63, 0x6c, 0x6f, 0x75, 0x64, 0x70, 0x72, 0x6f, 0x78, 0x79, 0x76, 0x31, + 0x61, 0x6c, 0x70, 0x68, 0x61, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( @@ -1202,57 +1085,51 @@ func file_proto_v1alpha_proxy_proto_rawDescGZIP() []byte { return file_proto_v1alpha_proxy_proto_rawDescData } -var file_proto_v1alpha_proxy_proto_enumTypes = make([]protoimpl.EnumInfo, 1) -var file_proto_v1alpha_proxy_proto_msgTypes = make([]protoimpl.MessageInfo, 16) +var file_proto_v1alpha_proxy_proto_msgTypes = make([]protoimpl.MessageInfo, 15) var file_proto_v1alpha_proxy_proto_goTypes = []any{ - (ClientStats_Stats_Status)(0), // 0: castai.cloud.proxy.v1alpha.ClientStats.Stats.Status - (*StreamCloudProxyRequest)(nil), // 1: castai.cloud.proxy.v1alpha.StreamCloudProxyRequest - (*InitialCloudProxyRequest)(nil), // 2: castai.cloud.proxy.v1alpha.InitialCloudProxyRequest - (*ClientStats)(nil), // 3: castai.cloud.proxy.v1alpha.ClientStats - (*ClusterResponse)(nil), // 4: castai.cloud.proxy.v1alpha.ClusterResponse - (*CloudProxyRequest)(nil), // 5: castai.cloud.proxy.v1alpha.CloudProxyRequest - (*StreamCloudProxyResponse)(nil), // 6: castai.cloud.proxy.v1alpha.StreamCloudProxyResponse - (*ConfigurationRequest)(nil), // 7: castai.cloud.proxy.v1alpha.ConfigurationRequest - (*HTTPRequest)(nil), // 8: castai.cloud.proxy.v1alpha.HTTPRequest - (*HTTPResponse)(nil), // 9: castai.cloud.proxy.v1alpha.HTTPResponse - (*HeaderValue)(nil), // 10: castai.cloud.proxy.v1alpha.HeaderValue - (*SendToProxyRequest)(nil), // 11: castai.cloud.proxy.v1alpha.SendToProxyRequest - (*SendToProxyResponse)(nil), // 12: castai.cloud.proxy.v1alpha.SendToProxyResponse - (*ClientMetadata)(nil), // 13: castai.cloud.proxy.v1alpha.ClientMetadata - (*ClientStats_Stats)(nil), // 14: castai.cloud.proxy.v1alpha.ClientStats.Stats - nil, // 15: castai.cloud.proxy.v1alpha.HTTPRequest.HeadersEntry - nil, // 16: castai.cloud.proxy.v1alpha.HTTPResponse.HeadersEntry + (*StreamCloudProxyRequest)(nil), // 0: castai.cloud.proxy.v1alpha.StreamCloudProxyRequest + (*ClientStats)(nil), // 1: castai.cloud.proxy.v1alpha.ClientStats + (*ClusterResponse)(nil), // 2: castai.cloud.proxy.v1alpha.ClusterResponse + (*CloudProxyRequest)(nil), // 3: castai.cloud.proxy.v1alpha.CloudProxyRequest + (*StreamCloudProxyResponse)(nil), // 4: castai.cloud.proxy.v1alpha.StreamCloudProxyResponse + (*ConfigurationRequest)(nil), // 5: castai.cloud.proxy.v1alpha.ConfigurationRequest + (*HTTPRequest)(nil), // 6: castai.cloud.proxy.v1alpha.HTTPRequest + (*HTTPResponse)(nil), // 7: castai.cloud.proxy.v1alpha.HTTPResponse + (*HeaderValue)(nil), // 8: castai.cloud.proxy.v1alpha.HeaderValue + (*SendToProxyRequest)(nil), // 9: castai.cloud.proxy.v1alpha.SendToProxyRequest + (*SendToProxyResponse)(nil), // 10: castai.cloud.proxy.v1alpha.SendToProxyResponse + (*ClientMetadata)(nil), // 11: castai.cloud.proxy.v1alpha.ClientMetadata + (*ClientStats_Stats)(nil), // 12: castai.cloud.proxy.v1alpha.ClientStats.Stats + nil, // 13: castai.cloud.proxy.v1alpha.HTTPRequest.HeadersEntry + nil, // 14: castai.cloud.proxy.v1alpha.HTTPResponse.HeadersEntry } var file_proto_v1alpha_proxy_proto_depIdxs = []int32{ - 2, // 0: castai.cloud.proxy.v1alpha.StreamCloudProxyRequest.initial_request:type_name -> castai.cloud.proxy.v1alpha.InitialCloudProxyRequest - 3, // 1: castai.cloud.proxy.v1alpha.StreamCloudProxyRequest.client_stats:type_name -> castai.cloud.proxy.v1alpha.ClientStats - 4, // 2: castai.cloud.proxy.v1alpha.StreamCloudProxyRequest.response:type_name -> castai.cloud.proxy.v1alpha.ClusterResponse - 13, // 3: castai.cloud.proxy.v1alpha.InitialCloudProxyRequest.client_metadata:type_name -> castai.cloud.proxy.v1alpha.ClientMetadata - 13, // 4: castai.cloud.proxy.v1alpha.ClientStats.client_metadata:type_name -> castai.cloud.proxy.v1alpha.ClientMetadata - 14, // 5: castai.cloud.proxy.v1alpha.ClientStats.stats:type_name -> castai.cloud.proxy.v1alpha.ClientStats.Stats - 13, // 6: castai.cloud.proxy.v1alpha.ClusterResponse.client_metadata:type_name -> castai.cloud.proxy.v1alpha.ClientMetadata - 9, // 7: castai.cloud.proxy.v1alpha.ClusterResponse.http_response:type_name -> castai.cloud.proxy.v1alpha.HTTPResponse - 8, // 8: castai.cloud.proxy.v1alpha.CloudProxyRequest.http_request:type_name -> castai.cloud.proxy.v1alpha.HTTPRequest - 13, // 9: castai.cloud.proxy.v1alpha.StreamCloudProxyResponse.client_metadata:type_name -> castai.cloud.proxy.v1alpha.ClientMetadata - 8, // 10: castai.cloud.proxy.v1alpha.StreamCloudProxyResponse.http_request:type_name -> castai.cloud.proxy.v1alpha.HTTPRequest - 7, // 11: castai.cloud.proxy.v1alpha.StreamCloudProxyResponse.configuration_request:type_name -> castai.cloud.proxy.v1alpha.ConfigurationRequest - 15, // 12: castai.cloud.proxy.v1alpha.HTTPRequest.headers:type_name -> castai.cloud.proxy.v1alpha.HTTPRequest.HeadersEntry - 16, // 13: castai.cloud.proxy.v1alpha.HTTPResponse.headers:type_name -> castai.cloud.proxy.v1alpha.HTTPResponse.HeadersEntry - 13, // 14: castai.cloud.proxy.v1alpha.SendToProxyRequest.client_metadata:type_name -> castai.cloud.proxy.v1alpha.ClientMetadata - 8, // 15: castai.cloud.proxy.v1alpha.SendToProxyRequest.http_request:type_name -> castai.cloud.proxy.v1alpha.HTTPRequest - 9, // 16: castai.cloud.proxy.v1alpha.SendToProxyResponse.http_response:type_name -> castai.cloud.proxy.v1alpha.HTTPResponse - 0, // 17: castai.cloud.proxy.v1alpha.ClientStats.Stats.status:type_name -> castai.cloud.proxy.v1alpha.ClientStats.Stats.Status - 10, // 18: castai.cloud.proxy.v1alpha.HTTPRequest.HeadersEntry.value:type_name -> castai.cloud.proxy.v1alpha.HeaderValue - 10, // 19: castai.cloud.proxy.v1alpha.HTTPResponse.HeadersEntry.value:type_name -> castai.cloud.proxy.v1alpha.HeaderValue - 1, // 20: castai.cloud.proxy.v1alpha.CloudProxyAPI.StreamCloudProxy:input_type -> castai.cloud.proxy.v1alpha.StreamCloudProxyRequest - 11, // 21: castai.cloud.proxy.v1alpha.CloudProxyAPI.SendToProxy:input_type -> castai.cloud.proxy.v1alpha.SendToProxyRequest - 6, // 22: castai.cloud.proxy.v1alpha.CloudProxyAPI.StreamCloudProxy:output_type -> castai.cloud.proxy.v1alpha.StreamCloudProxyResponse - 12, // 23: castai.cloud.proxy.v1alpha.CloudProxyAPI.SendToProxy:output_type -> castai.cloud.proxy.v1alpha.SendToProxyResponse - 22, // [22:24] is the sub-list for method output_type - 20, // [20:22] is the sub-list for method input_type - 20, // [20:20] is the sub-list for extension type_name - 20, // [20:20] is the sub-list for extension extendee - 0, // [0:20] is the sub-list for field type_name + 1, // 0: castai.cloud.proxy.v1alpha.StreamCloudProxyRequest.client_stats:type_name -> castai.cloud.proxy.v1alpha.ClientStats + 2, // 1: castai.cloud.proxy.v1alpha.StreamCloudProxyRequest.response:type_name -> castai.cloud.proxy.v1alpha.ClusterResponse + 11, // 2: castai.cloud.proxy.v1alpha.ClientStats.client_metadata:type_name -> castai.cloud.proxy.v1alpha.ClientMetadata + 12, // 3: castai.cloud.proxy.v1alpha.ClientStats.stats:type_name -> castai.cloud.proxy.v1alpha.ClientStats.Stats + 11, // 4: castai.cloud.proxy.v1alpha.ClusterResponse.client_metadata:type_name -> castai.cloud.proxy.v1alpha.ClientMetadata + 7, // 5: castai.cloud.proxy.v1alpha.ClusterResponse.http_response:type_name -> castai.cloud.proxy.v1alpha.HTTPResponse + 6, // 6: castai.cloud.proxy.v1alpha.CloudProxyRequest.http_request:type_name -> castai.cloud.proxy.v1alpha.HTTPRequest + 11, // 7: castai.cloud.proxy.v1alpha.StreamCloudProxyResponse.client_metadata:type_name -> castai.cloud.proxy.v1alpha.ClientMetadata + 6, // 8: castai.cloud.proxy.v1alpha.StreamCloudProxyResponse.http_request:type_name -> castai.cloud.proxy.v1alpha.HTTPRequest + 5, // 9: castai.cloud.proxy.v1alpha.StreamCloudProxyResponse.configuration_request:type_name -> castai.cloud.proxy.v1alpha.ConfigurationRequest + 13, // 10: castai.cloud.proxy.v1alpha.HTTPRequest.headers:type_name -> castai.cloud.proxy.v1alpha.HTTPRequest.HeadersEntry + 14, // 11: castai.cloud.proxy.v1alpha.HTTPResponse.headers:type_name -> castai.cloud.proxy.v1alpha.HTTPResponse.HeadersEntry + 11, // 12: castai.cloud.proxy.v1alpha.SendToProxyRequest.client_metadata:type_name -> castai.cloud.proxy.v1alpha.ClientMetadata + 6, // 13: castai.cloud.proxy.v1alpha.SendToProxyRequest.http_request:type_name -> castai.cloud.proxy.v1alpha.HTTPRequest + 7, // 14: castai.cloud.proxy.v1alpha.SendToProxyResponse.http_response:type_name -> castai.cloud.proxy.v1alpha.HTTPResponse + 8, // 15: castai.cloud.proxy.v1alpha.HTTPRequest.HeadersEntry.value:type_name -> castai.cloud.proxy.v1alpha.HeaderValue + 8, // 16: castai.cloud.proxy.v1alpha.HTTPResponse.HeadersEntry.value:type_name -> castai.cloud.proxy.v1alpha.HeaderValue + 0, // 17: castai.cloud.proxy.v1alpha.CloudProxyAPI.StreamCloudProxy:input_type -> castai.cloud.proxy.v1alpha.StreamCloudProxyRequest + 9, // 18: castai.cloud.proxy.v1alpha.CloudProxyAPI.SendToProxy:input_type -> castai.cloud.proxy.v1alpha.SendToProxyRequest + 4, // 19: castai.cloud.proxy.v1alpha.CloudProxyAPI.StreamCloudProxy:output_type -> castai.cloud.proxy.v1alpha.StreamCloudProxyResponse + 10, // 20: castai.cloud.proxy.v1alpha.CloudProxyAPI.SendToProxy:output_type -> castai.cloud.proxy.v1alpha.SendToProxyResponse + 19, // [19:21] is the sub-list for method output_type + 17, // [17:19] is the sub-list for method input_type + 17, // [17:17] is the sub-list for extension type_name + 17, // [17:17] is the sub-list for extension extendee + 0, // [0:17] is the sub-list for field type_name } func init() { file_proto_v1alpha_proxy_proto_init() } @@ -1274,18 +1151,6 @@ func file_proto_v1alpha_proxy_proto_init() { } } file_proto_v1alpha_proxy_proto_msgTypes[1].Exporter = func(v any, i int) any { - switch v := v.(*InitialCloudProxyRequest); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_proto_v1alpha_proxy_proto_msgTypes[2].Exporter = func(v any, i int) any { switch v := v.(*ClientStats); i { case 0: return &v.state @@ -1297,7 +1162,7 @@ func file_proto_v1alpha_proxy_proto_init() { return nil } } - file_proto_v1alpha_proxy_proto_msgTypes[3].Exporter = func(v any, i int) any { + file_proto_v1alpha_proxy_proto_msgTypes[2].Exporter = func(v any, i int) any { switch v := v.(*ClusterResponse); i { case 0: return &v.state @@ -1309,7 +1174,7 @@ func file_proto_v1alpha_proxy_proto_init() { return nil } } - file_proto_v1alpha_proxy_proto_msgTypes[4].Exporter = func(v any, i int) any { + file_proto_v1alpha_proxy_proto_msgTypes[3].Exporter = func(v any, i int) any { switch v := v.(*CloudProxyRequest); i { case 0: return &v.state @@ -1321,7 +1186,7 @@ func file_proto_v1alpha_proxy_proto_init() { return nil } } - file_proto_v1alpha_proxy_proto_msgTypes[5].Exporter = func(v any, i int) any { + file_proto_v1alpha_proxy_proto_msgTypes[4].Exporter = func(v any, i int) any { switch v := v.(*StreamCloudProxyResponse); i { case 0: return &v.state @@ -1333,7 +1198,7 @@ func file_proto_v1alpha_proxy_proto_init() { return nil } } - file_proto_v1alpha_proxy_proto_msgTypes[6].Exporter = func(v any, i int) any { + file_proto_v1alpha_proxy_proto_msgTypes[5].Exporter = func(v any, i int) any { switch v := v.(*ConfigurationRequest); i { case 0: return &v.state @@ -1345,7 +1210,7 @@ func file_proto_v1alpha_proxy_proto_init() { return nil } } - file_proto_v1alpha_proxy_proto_msgTypes[7].Exporter = func(v any, i int) any { + file_proto_v1alpha_proxy_proto_msgTypes[6].Exporter = func(v any, i int) any { switch v := v.(*HTTPRequest); i { case 0: return &v.state @@ -1357,7 +1222,7 @@ func file_proto_v1alpha_proxy_proto_init() { return nil } } - file_proto_v1alpha_proxy_proto_msgTypes[8].Exporter = func(v any, i int) any { + file_proto_v1alpha_proxy_proto_msgTypes[7].Exporter = func(v any, i int) any { switch v := v.(*HTTPResponse); i { case 0: return &v.state @@ -1369,7 +1234,7 @@ func file_proto_v1alpha_proxy_proto_init() { return nil } } - file_proto_v1alpha_proxy_proto_msgTypes[9].Exporter = func(v any, i int) any { + file_proto_v1alpha_proxy_proto_msgTypes[8].Exporter = func(v any, i int) any { switch v := v.(*HeaderValue); i { case 0: return &v.state @@ -1381,7 +1246,7 @@ func file_proto_v1alpha_proxy_proto_init() { return nil } } - file_proto_v1alpha_proxy_proto_msgTypes[10].Exporter = func(v any, i int) any { + file_proto_v1alpha_proxy_proto_msgTypes[9].Exporter = func(v any, i int) any { switch v := v.(*SendToProxyRequest); i { case 0: return &v.state @@ -1393,7 +1258,7 @@ func file_proto_v1alpha_proxy_proto_init() { return nil } } - file_proto_v1alpha_proxy_proto_msgTypes[11].Exporter = func(v any, i int) any { + file_proto_v1alpha_proxy_proto_msgTypes[10].Exporter = func(v any, i int) any { switch v := v.(*SendToProxyResponse); i { case 0: return &v.state @@ -1405,7 +1270,7 @@ func file_proto_v1alpha_proxy_proto_init() { return nil } } - file_proto_v1alpha_proxy_proto_msgTypes[12].Exporter = func(v any, i int) any { + file_proto_v1alpha_proxy_proto_msgTypes[11].Exporter = func(v any, i int) any { switch v := v.(*ClientMetadata); i { case 0: return &v.state @@ -1417,7 +1282,7 @@ func file_proto_v1alpha_proxy_proto_init() { return nil } } - file_proto_v1alpha_proxy_proto_msgTypes[13].Exporter = func(v any, i int) any { + file_proto_v1alpha_proxy_proto_msgTypes[12].Exporter = func(v any, i int) any { switch v := v.(*ClientStats_Stats); i { case 0: return &v.state @@ -1431,29 +1296,30 @@ func file_proto_v1alpha_proxy_proto_init() { } } file_proto_v1alpha_proxy_proto_msgTypes[0].OneofWrappers = []any{ - (*StreamCloudProxyRequest_InitialRequest)(nil), (*StreamCloudProxyRequest_ClientStats)(nil), (*StreamCloudProxyRequest_Response)(nil), } + file_proto_v1alpha_proxy_proto_msgTypes[2].OneofWrappers = []any{} file_proto_v1alpha_proxy_proto_msgTypes[3].OneofWrappers = []any{} - file_proto_v1alpha_proxy_proto_msgTypes[4].OneofWrappers = []any{} - file_proto_v1alpha_proxy_proto_msgTypes[5].OneofWrappers = []any{} + file_proto_v1alpha_proxy_proto_msgTypes[4].OneofWrappers = []any{ + (*StreamCloudProxyResponse_HttpRequest)(nil), + (*StreamCloudProxyResponse_ConfigurationRequest)(nil), + } + file_proto_v1alpha_proxy_proto_msgTypes[6].OneofWrappers = []any{} file_proto_v1alpha_proxy_proto_msgTypes[7].OneofWrappers = []any{} - file_proto_v1alpha_proxy_proto_msgTypes[8].OneofWrappers = []any{} - file_proto_v1alpha_proxy_proto_msgTypes[12].OneofWrappers = []any{} + file_proto_v1alpha_proxy_proto_msgTypes[11].OneofWrappers = []any{} type x struct{} out := protoimpl.TypeBuilder{ File: protoimpl.DescBuilder{ GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: file_proto_v1alpha_proxy_proto_rawDesc, - NumEnums: 1, - NumMessages: 16, + NumEnums: 0, + NumMessages: 15, NumExtensions: 0, NumServices: 1, }, GoTypes: file_proto_v1alpha_proxy_proto_goTypes, DependencyIndexes: file_proto_v1alpha_proxy_proto_depIdxs, - EnumInfos: file_proto_v1alpha_proxy_proto_enumTypes, MessageInfos: file_proto_v1alpha_proxy_proto_msgTypes, }.Build() File_proto_v1alpha_proxy_proto = out.File diff --git a/proto/v1alpha/proxy.proto b/proto/v1alpha/proxy.proto index 3db2f15..64be4d1 100644 --- a/proto/v1alpha/proxy.proto +++ b/proto/v1alpha/proxy.proto @@ -19,48 +19,31 @@ service CloudProxyAPI { message StreamCloudProxyRequest { oneof request { - // Initial request to establish the connection. - InitialCloudProxyRequest initial_request = 1; ClientStats client_stats = 2; ClusterResponse response = 3; } } -message InitialCloudProxyRequest { - ClientMetadata client_metadata = 1; - string version = 2; -} - - message ClientStats { ClientMetadata client_metadata = 1; message Stats { - // Status of the cluster client. - enum Status { - UNKNOWN = 0; - OK = 1; - CLOSING = 2; - } - Status status = 2; - - int64 timestamp = 3; + int64 timestamp = 2; // The total number of RPCs that started. - int64 num_calls_started = 4; + int64 num_calls_started = 3; // The total number of RPCs that finished. - int64 num_calls_finished = 5; + int64 num_calls_finished = 4; // The total number of RPCs that failed to reach a server except dropped RPCs. - int64 num_calls_finished_with_client_failed_to_send = 6; + int64 num_calls_finished_with_client_failed_to_send = 5; // The total number of RPCs that finished and are known to have been received // by a server. - int64 num_calls_finished_known_received = 7; + int64 num_calls_finished_known_received = 6; } Stats stats = 2; } - message ClusterResponse { optional ClientMetadata client_metadata = 1; string message_id = 2; @@ -68,15 +51,17 @@ message ClusterResponse { } message CloudProxyRequest { - string message_id = 3; - optional HTTPRequest http_request = 4; + string message_id = 1; + optional HTTPRequest http_request = 2; } message StreamCloudProxyResponse { optional ClientMetadata client_metadata = 1; string message_id = 2; - optional HTTPRequest http_request = 3; - optional ConfigurationRequest configuration_request = 4; + oneof response { + HTTPRequest http_request = 3; + ConfigurationRequest configuration_request = 4; + } } message ConfigurationRequest { @@ -116,4 +101,5 @@ message ClientMetadata { string cluster_id = 1; optional string organization_id = 2; string pod_name = 3; + string version = 4; } From f75172a8c60f17ff16fa9fa6fb4e82d633a30943 Mon Sep 17 00:00:00 2001 From: Valentyna Bukhalova Date: Tue, 1 Oct 2024 11:23:37 +0200 Subject: [PATCH 25/29] fix races --- internal/e2etest/roundtripper.go | 30 +++++++++++++++-------------- internal/proxy/client.go | 33 ++++++++++++++++---------------- internal/proxy/client_test.go | 8 ++------ 3 files changed, 35 insertions(+), 36 deletions(-) diff --git a/internal/e2etest/roundtripper.go b/internal/e2etest/roundtripper.go index 40d2736..6b61a70 100644 --- a/internal/e2etest/roundtripper.go +++ b/internal/e2etest/roundtripper.go @@ -32,20 +32,22 @@ func (p *HTTPOverGrpcRoundTripper) RoundTrip(request *http.Request) (*http.Respo protoReq := &cloudproxyv1alpha.StreamCloudProxyResponse{ MessageId: requestID, - HttpRequest: &cloudproxyv1alpha.HTTPRequest{ - Method: request.Method, - Path: request.URL.String(), - Headers: headers, - Body: func() []byte { - if request.Body == nil { - return []byte{} - } - body, err := io.ReadAll(request.Body) - if err != nil { - panic(fmt.Sprintf("Failed to read body: %v", err)) - } - return body - }(), + Response: &cloudproxyv1alpha.StreamCloudProxyResponse_HttpRequest{ + HttpRequest: &cloudproxyv1alpha.HTTPRequest{ + Method: request.Method, + Path: request.URL.String(), + Headers: headers, + Body: func() []byte { + if request.Body == nil { + return []byte{} + } + body, err := io.ReadAll(request.Body) + if err != nil { + panic(fmt.Sprintf("Failed to read body: %v", err)) + } + return body + }(), + }, }, } waiter, err := p.dispatcher.SendRequest(protoReq) diff --git a/internal/proxy/client.go b/internal/proxy/client.go index 0268d03..f01ab26 100644 --- a/internal/proxy/client.go +++ b/internal/proxy/client.go @@ -40,6 +40,8 @@ type CloudClient interface { type Client struct { cfg *config.Config + sendCh chan *cloudproxyv1alpha.StreamCloudProxyRequest + cloudClient CloudClient log *logrus.Logger podName string @@ -61,6 +63,7 @@ type Client struct { func New(cloudClient CloudClient, logger *logrus.Logger, version string, cfg *config.Config) *Client { c := &Client{ cfg: cfg, + sendCh: make(chan *cloudproxyv1alpha.StreamCloudProxyRequest, 100), cloudClient: cloudClient, log: logger, podName: cfg.PodMetadata.PodName, @@ -74,6 +77,8 @@ func New(cloudClient CloudClient, logger *logrus.Logger, version string, cfg *co } func (c *Client) Run(ctx context.Context) error { + defer close(c.sendCh) + streamCtx := metadata.NewOutgoingContext(ctx, metadata.Pairs( authorizationMetadataKey, fmt.Sprintf("Token %s", c.cfg.CastAI.APIKey), clusterIDMetadataKey, c.clusterID, @@ -172,13 +177,10 @@ func (c *Client) prepareAndRun(ctx context.Context) error { } func (c *Client) sendAndReceive(ctx context.Context, stream cloudproxyv1alpha.CloudProxyAPI_StreamCloudProxyClient) error { - eg, egctx := errgroup.WithContext(ctx) - - sendCh := make(chan *cloudproxyv1alpha.StreamCloudProxyRequest, 10) - defer close(sendCh) + eg, egCtx := errgroup.WithContext(ctx) eg.Go(func() error { - err := c.sendKeepAlive(egctx, stream, sendCh) + err := c.sendKeepAlive(egCtx, stream) if err != nil { c.log.Errorf("stopping keep-alive loop: %v", err) } @@ -186,7 +188,7 @@ func (c *Client) sendAndReceive(ctx context.Context, stream cloudproxyv1alpha.Cl }) eg.Go(func() error { - err := c.receive(egctx, stream, sendCh) + err := c.receive(egCtx, stream) if err != nil { c.log.Errorf("stopping receive loop: %v", err) } @@ -195,7 +197,7 @@ func (c *Client) sendAndReceive(ctx context.Context, stream cloudproxyv1alpha.Cl // send loop is separate because it can block on sending messages. go func() { - err := c.send(egctx, stream, sendCh) + err := c.send(egCtx, stream) if err != nil { c.log.Errorf("stopped send loop: %v", err) } @@ -209,7 +211,7 @@ func (c *Client) sendAndReceive(ctx context.Context, stream cloudproxyv1alpha.Cl return err } -func (c *Client) send(ctx context.Context, stream cloudproxyv1alpha.CloudProxyAPI_StreamCloudProxyClient, sendCh chan *cloudproxyv1alpha.StreamCloudProxyRequest) error { +func (c *Client) send(ctx context.Context, stream cloudproxyv1alpha.CloudProxyAPI_StreamCloudProxyClient) error { defer func() { c.log.Info("Closing send channel") _ = stream.CloseSend() @@ -221,7 +223,7 @@ func (c *Client) send(ctx context.Context, stream cloudproxyv1alpha.CloudProxyAP return ctx.Err() case <-stream.Context().Done(): return fmt.Errorf("stream closed %w", stream.Context().Err()) - case req := <-sendCh: + case req := <-c.sendCh: c.log.Printf("Sending message to stream %v len=%v", req.GetResponse().GetMessageId(), len(req.GetResponse().GetHttpResponse().GetBody())) if err := stream.Send(req); err != nil { c.log.WithError(err).Warn("failed to send message to stream") @@ -237,7 +239,7 @@ func (c *Client) send(ctx context.Context, stream cloudproxyv1alpha.CloudProxyAP } } -func (c *Client) receive(ctx context.Context, stream cloudproxyv1alpha.CloudProxyAPI_StreamCloudProxyClient, respCh chan<- *cloudproxyv1alpha.StreamCloudProxyRequest) error { +func (c *Client) receive(ctx context.Context, stream cloudproxyv1alpha.CloudProxyAPI_StreamCloudProxyClient) error { for { select { case <-ctx.Done(): @@ -261,11 +263,11 @@ func (c *Client) receive(ctx context.Context, stream cloudproxyv1alpha.CloudProx c.lastSeenReceive.Store(time.Now().UnixNano()) c.log.Debugf("Handling message from castai") - go c.handleMessage(ctx, in, respCh) + go c.handleMessage(ctx, in) } } -func (c *Client) handleMessage(ctx context.Context, in *cloudproxyv1alpha.StreamCloudProxyResponse, respCh chan<- *cloudproxyv1alpha.StreamCloudProxyRequest) { +func (c *Client) handleMessage(ctx context.Context, in *cloudproxyv1alpha.StreamCloudProxyResponse) { if in == nil { c.log.Error("nil message") return @@ -291,11 +293,10 @@ func (c *Client) handleMessage(ctx context.Context, in *cloudproxyv1alpha.Stream case <-ctx.Done(): return - case respCh <- &cloudproxyv1alpha.StreamCloudProxyRequest{ + case c.sendCh <- &cloudproxyv1alpha.StreamCloudProxyRequest{ Request: &cloudproxyv1alpha.StreamCloudProxyRequest_Response{ Response: &cloudproxyv1alpha.ClusterResponse{ ClientMetadata: &cloudproxyv1alpha.ClientMetadata{ - PodName: c.streamRuntimeName, ClusterId: c.clusterID, }, MessageId: in.GetMessageId(), @@ -364,7 +365,7 @@ func (c *Client) isAlive() error { return nil } -func (c *Client) sendKeepAlive(ctx context.Context, stream cloudproxyv1alpha.CloudProxyAPI_StreamCloudProxyClient, sendCh chan<- *cloudproxyv1alpha.StreamCloudProxyRequest) error { +func (c *Client) sendKeepAlive(ctx context.Context, stream cloudproxyv1alpha.CloudProxyAPI_StreamCloudProxyClient) error { ticker := time.NewTimer(time.Duration(c.keepAlive.Load())) defer ticker.Stop() @@ -379,7 +380,7 @@ func (c *Client) sendKeepAlive(ctx context.Context, stream cloudproxyv1alpha.Clo ticker.Reset(time.Duration(c.keepAlive.Load())) } else { select { - case sendCh <- &cloudproxyv1alpha.StreamCloudProxyRequest{ + case c.sendCh <- &cloudproxyv1alpha.StreamCloudProxyRequest{ Request: &cloudproxyv1alpha.StreamCloudProxyRequest_ClientStats{ ClientStats: &cloudproxyv1alpha.ClientStats{ ClientMetadata: &cloudproxyv1alpha.ClientMetadata{ diff --git a/internal/proxy/client_test.go b/internal/proxy/client_test.go index 2572c99..0a91cc3 100644 --- a/internal/proxy/client_test.go +++ b/internal/proxy/client_test.go @@ -280,12 +280,7 @@ func TestClient_handleMessage(t *testing.T) { tt.args.tuneMockStream(stream) } - msgStream := make(chan *cloudproxyv1alpha.StreamCloudProxyRequest) - go func() { - <-msgStream - }() - - c.handleMessage(context.Background(), tt.args.in, msgStream) + c.handleMessage(context.Background(), tt.args.in) require.Equal(t, tt.wantKeepAlive, c.keepAlive.Load(), "keepAlive: %v", c.keepAlive.Load()) require.Equal(t, tt.wantKeepAliveTimeout, c.keepAliveTimeout.Load(), "keepAliveTimeout: %v", c.keepAliveTimeout.Load()) require.Equal(t, tt.wantErrCount, c.errCount.Load(), "errCount: %v", c.errCount.Load()) @@ -534,6 +529,7 @@ func TestClient_sendAndReceive(t *testing.T) { if tt.args.tuneMockStream != nil { tt.args.tuneMockStream(stream) } + if err := c.sendAndReceive(tt.args.ctx(), stream); (err != nil) != tt.wantErr { t.Errorf("run() error = %v, wantErr %v", err, tt.wantErr) } From 8ef2d2d89662d5f365b4720dbc4b1c76bac766ac Mon Sep 17 00:00:00 2001 From: Valentyna Bukhalova Date: Tue, 1 Oct 2024 11:37:56 +0200 Subject: [PATCH 26/29] fix --- internal/proxy/client.go | 1 + 1 file changed, 1 insertion(+) diff --git a/internal/proxy/client.go b/internal/proxy/client.go index f01ab26..9e0b046 100644 --- a/internal/proxy/client.go +++ b/internal/proxy/client.go @@ -297,6 +297,7 @@ func (c *Client) handleMessage(ctx context.Context, in *cloudproxyv1alpha.Stream Request: &cloudproxyv1alpha.StreamCloudProxyRequest_Response{ Response: &cloudproxyv1alpha.ClusterResponse{ ClientMetadata: &cloudproxyv1alpha.ClientMetadata{ + PodName: c.streamRuntimeName, ClusterId: c.clusterID, }, MessageId: in.GetMessageId(), From 60d024246251eee6c12342e97d75d6556d826e04 Mon Sep 17 00:00:00 2001 From: Damian Czaja Date: Tue, 1 Oct 2024 14:01:24 +0200 Subject: [PATCH 27/29] fix lint --- cmd/proxy/main.go | 12 ++++++------ internal/proxy/client.go | 5 +++-- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/cmd/proxy/main.go b/cmd/proxy/main.go index d3bc2a8..57fde4f 100644 --- a/cmd/proxy/main.go +++ b/cmd/proxy/main.go @@ -1,12 +1,6 @@ package main import ( - "cloud-proxy/internal/cloud/gcp" - "cloud-proxy/internal/cloud/gcp/gcpauth" - "cloud-proxy/internal/config" - "cloud-proxy/internal/healthz" - "cloud-proxy/internal/proxy" - "context" "fmt" "path" @@ -14,6 +8,12 @@ import ( "time" "github.com/sirupsen/logrus" + + "cloud-proxy/internal/cloud/gcp" + "cloud-proxy/internal/cloud/gcp/gcpauth" + "cloud-proxy/internal/config" + "cloud-proxy/internal/healthz" + "cloud-proxy/internal/proxy" ) var ( diff --git a/internal/proxy/client.go b/internal/proxy/client.go index 9e0b046..d88980a 100644 --- a/internal/proxy/client.go +++ b/internal/proxy/client.go @@ -5,8 +5,6 @@ package proxy import ( "bytes" - "cloud-proxy/internal/config" - cloudproxyv1alpha "cloud-proxy/proto/gen/proto/v1alpha" "context" "fmt" "io" @@ -23,6 +21,9 @@ import ( "google.golang.org/grpc/credentials/insecure" "google.golang.org/grpc/encoding/gzip" "google.golang.org/grpc/metadata" + + "cloud-proxy/internal/config" + cloudproxyv1alpha "cloud-proxy/proto/gen/proto/v1alpha" ) const ( From 5c68ba3d8a4a30fd4bfd99226e072b194b7e37fd Mon Sep 17 00:00:00 2001 From: Valentyna Bukhalova Date: Tue, 1 Oct 2024 15:58:36 +0200 Subject: [PATCH 28/29] revert podname --- internal/proxy/client.go | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/internal/proxy/client.go b/internal/proxy/client.go index d32b40d..a42f51c 100644 --- a/internal/proxy/client.go +++ b/internal/proxy/client.go @@ -43,11 +43,10 @@ type Client struct { sendCh chan *cloudproxyv1alpha.StreamCloudProxyRequest - cloudClient CloudClient - log *logrus.Logger - podName string - clusterID string - streamRuntimeName string + cloudClient CloudClient + log *logrus.Logger + podName string + clusterID string errCount atomic.Int64 processedCount atomic.Int64 @@ -170,7 +169,6 @@ func (c *Client) prepareAndRun(ctx context.Context) error { } defer closeConnection() - c.streamRuntimeName = fmt.Sprintf("stream-%s-%v", c.podName, time.Now().UnixNano()) c.lastSeenReceive.Store(time.Now().UnixNano()) c.lastSeenSend.Store(time.Now().UnixNano()) @@ -298,7 +296,7 @@ func (c *Client) handleMessage(ctx context.Context, in *cloudproxyv1alpha.Stream Request: &cloudproxyv1alpha.StreamCloudProxyRequest_Response{ Response: &cloudproxyv1alpha.ClusterResponse{ ClientMetadata: &cloudproxyv1alpha.ClientMetadata{ - PodName: c.streamRuntimeName, + PodName: c.podName, ClusterId: c.clusterID, }, MessageId: in.GetMessageId(), @@ -386,7 +384,7 @@ func (c *Client) sendKeepAlive(ctx context.Context, stream cloudproxyv1alpha.Clo Request: &cloudproxyv1alpha.StreamCloudProxyRequest_ClientStats{ ClientStats: &cloudproxyv1alpha.ClientStats{ ClientMetadata: &cloudproxyv1alpha.ClientMetadata{ - PodName: c.streamRuntimeName, + PodName: c.podName, ClusterId: c.clusterID, Version: c.version, }, From 8f9cfb5acc2345bdf4bd477f9c93277e83f2c241 Mon Sep 17 00:00:00 2001 From: Valentyna Bukhalova Date: Tue, 1 Oct 2024 18:17:53 +0200 Subject: [PATCH 29/29] lint --- internal/proxy/client.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/proxy/client.go b/internal/proxy/client.go index a42f51c..f3dce8e 100644 --- a/internal/proxy/client.go +++ b/internal/proxy/client.go @@ -19,11 +19,11 @@ import ( "google.golang.org/grpc/backoff" "google.golang.org/grpc/credentials" "google.golang.org/grpc/credentials/insecure" + "google.golang.org/grpc/encoding/gzip" "google.golang.org/grpc/metadata" "cloud-proxy/internal/config" cloudproxyv1alpha "cloud-proxy/proto/gen/proto/v1alpha" - "google.golang.org/grpc/encoding/gzip" ) const (