Skip to content

Commit

Permalink
feat: add config flag for grpc endpoint
Browse files Browse the repository at this point in the history
Signed-off-by: Artur Troian <[email protected]>
  • Loading branch information
troian committed Jan 29, 2024
1 parent fa15f8a commit 444dac7
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 5 deletions.
2 changes: 2 additions & 0 deletions _docs/kustomize/akash-provider/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -358,6 +358,8 @@ spec:
ports:
- name: gateway
containerPort: 8443
- name: grpc
containerPort: 8444
volumeMounts:
- name: home
mountPath: /home
Expand Down
2 changes: 2 additions & 0 deletions _docs/kustomize/akash-provider/service.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,5 @@ spec:
ports:
- name: gateway
port: 8443
- name: gateway
port: 8444
13 changes: 8 additions & 5 deletions cmd/provider-services/cmd/run.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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 != "" {
Expand Down Expand Up @@ -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)
})
Expand Down

0 comments on commit 444dac7

Please sign in to comment.