feat(grpc): add client keepalive config (#112158)

This commit is contained in:
Jean-Philippe Quéméner
2025-10-08 13:22:29 +02:00
committed by GitHub
parent 3f4c9879c9
commit 40dde1d4aa
2 changed files with 27 additions and 13 deletions
@@ -4,6 +4,7 @@ import (
"context"
"fmt"
"net"
"time"
"github.com/spf13/pflag"
"go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc"
@@ -52,6 +53,7 @@ type StorageOptions struct {
GrpcClientAuthenticationTokenExchangeURL string
GrpcClientAuthenticationTokenNamespace string
GrpcClientAuthenticationAllowInsecure bool
GrpcClientKeepaliveTime time.Duration
// Secrets Manager Configuration for InlineSecureValueSupport
SecretsManagerGrpcClientEnable bool
@@ -90,6 +92,7 @@ func NewStorageOptions() *StorageOptions {
Address: "localhost:10000",
GrpcClientAuthenticationTokenNamespace: "*",
GrpcClientAuthenticationAllowInsecure: false,
GrpcClientKeepaliveTime: 0,
BlobThresholdBytes: BlobThresholdDefault,
}
}
@@ -103,6 +106,7 @@ func (o *StorageOptions) AddFlags(fs *pflag.FlagSet) {
fs.StringVar(&o.GrpcClientAuthenticationTokenExchangeURL, "grpc-client-authentication-token-exchange-url", o.GrpcClientAuthenticationTokenExchangeURL, "Token exchange url for grpc client authentication")
fs.StringVar(&o.GrpcClientAuthenticationTokenNamespace, "grpc-client-authentication-token-namespace", o.GrpcClientAuthenticationTokenNamespace, "Token namespace for grpc client authentication")
fs.BoolVar(&o.GrpcClientAuthenticationAllowInsecure, "grpc-client-authentication-allow-insecure", o.GrpcClientAuthenticationAllowInsecure, "Allow insecure grpc client authentication")
fs.DurationVar(&o.GrpcClientKeepaliveTime, "grpc-client-keepalive-time", o.GrpcClientKeepaliveTime, "gRPC client keep-alive ping interval (e.g., 6m).")
// Secrets Manager Configuration flags
fs.BoolVar(&o.SecretsManagerGrpcClientEnable, "grafana.secrets-manager.grpc-client-enable", false, "Enable gRPC client for secrets manager")