From 444dac7848b2ec3e93e54e21352b6d789cd40aa8 Mon Sep 17 00:00:00 2001 From: Artur Troian Date: Mon, 29 Jan 2024 09:50:04 -0500 Subject: [PATCH] feat: add config flag for grpc endpoint Signed-off-by: Artur Troian --- _docs/kustomize/akash-provider/deployment.yaml | 2 ++ _docs/kustomize/akash-provider/service.yaml | 2 ++ cmd/provider-services/cmd/run.go | 13 ++++++++----- 3 files changed, 12 insertions(+), 5 deletions(-) diff --git a/_docs/kustomize/akash-provider/deployment.yaml b/_docs/kustomize/akash-provider/deployment.yaml index 5f9eb6bd..0db82fb3 100644 --- a/_docs/kustomize/akash-provider/deployment.yaml +++ b/_docs/kustomize/akash-provider/deployment.yaml @@ -358,6 +358,8 @@ spec: ports: - name: gateway containerPort: 8443 + - name: grpc + containerPort: 8444 volumeMounts: - name: home mountPath: /home diff --git a/_docs/kustomize/akash-provider/service.yaml b/_docs/kustomize/akash-provider/service.yaml index 4d649f48..284fcbae 100644 --- a/_docs/kustomize/akash-provider/service.yaml +++ b/_docs/kustomize/akash-provider/service.yaml @@ -9,3 +9,5 @@ spec: ports: - name: gateway port: 8443 + - name: gateway + port: 8444 diff --git a/cmd/provider-services/cmd/run.go b/cmd/provider-services/cmd/run.go index e24c8498..355f0f00 100644 --- a/cmd/provider-services/cmd/run.go +++ b/cmd/provider-services/cmd/run.go @@ -57,6 +57,7 @@ const ( // FlagGatewayListenAddress determines listening address for Manifests FlagGatewayListenAddress = "gateway-listen-address" + FlagGatewayGRPCListenAddress = "gateway-grpc-listen-address" FlagBidPricingStrategy = "bid-price-strategy" FlagBidPriceCPUScale = "bid-price-cpu-scale" FlagBidPriceMemoryScale = "bid-price-memory-scale" @@ -180,6 +181,11 @@ func RunCmd() *cobra.Command { panic(err) } + cmd.Flags().String(FlagGatewayGRPCListenAddress, "0.0.0.0:8444", "Gateway listen address") + if err := viper.BindPFlag(FlagGatewayGRPCListenAddress, cmd.Flags().Lookup(FlagGatewayGRPCListenAddress)); err != nil { + panic(err) + } + cmd.Flags().String(FlagBidPricingStrategy, "scale", "Pricing strategy to use") if err := viper.BindPFlag(FlagBidPricingStrategy, cmd.Flags().Lookup(FlagBidPricingStrategy)); err != nil { panic(err) @@ -523,6 +529,7 @@ func doRunCmd(ctx context.Context, cmd *cobra.Command, _ []string) error { } gwaddr := viper.GetString(FlagGatewayListenAddress) + grpcaddr := viper.GetString(FlagGatewayGRPCListenAddress) var certFromFlag io.Reader if val := cmd.Flag(FlagAuthPem).Value.String(); val != "" { @@ -704,15 +711,11 @@ func doRunCmd(ctx context.Context, cmd *cobra.Command, _ []string) error { return err } - err = gwgrpc.NewServer(ctx, ":8081", []tls.Certificate{tlsCert}, service) + err = gwgrpc.NewServer(ctx, grpcaddr, []tls.Certificate{tlsCert}, service) if err != nil { return err } - // clGroup.Go(func() error { - // return group.Wait() - // }) - group.Go(func() error { return events.Publish(ctx, cctx.Client, "provider-cli", bus) })