@@ -94,6 +94,7 @@ func init() {
9494 configFlags .String ("dapi-cert" , "" , "path to data api tls cert for Data API" )
9595 configFlags .String ("dapi-key" , "" , "path to data api private tls key for Data API" )
9696 configFlags .Int ("rate-limit" , 0 , "specifies the maximum requests per second to allow" )
97+ configFlags .Duration ("shutdown-timeout" , 30 * time .Second , "the graceful shutdown timeout" )
9798 configFlags .String ("otlp-endpoint" , "" , "opentelemetry endpoint to send telemetry to" )
9899 configFlags .Bool ("disable-traces" , false , "disable tracing" )
99100 configFlags .Bool ("disable-metrics" , false , "disable metrics" )
@@ -269,6 +270,7 @@ type config struct {
269270 clusterCaCertPath string
270271 clientCaCertPath string
271272 rateLimit int
273+ shutdownTimeout time.Duration
272274 otlpEndpoint string
273275 disableTraces bool
274276 disableMetrics bool
@@ -312,6 +314,7 @@ func readConfig(logger *zap.Logger) *config {
312314 clusterCaCertPath : viper .GetString ("cluster-cert" ),
313315 clientCaCertPath : viper .GetString ("client-ca-cert" ),
314316 rateLimit : viper .GetInt ("rate-limit" ),
317+ shutdownTimeout : viper .GetDuration ("shutdown-timeout" ),
315318 otlpEndpoint : viper .GetString ("otlp-endpoint" ),
316319 disableTraces : viper .GetBool ("disable-traces" ),
317320 disableMetrics : viper .GetBool ("disable-metrics" ),
@@ -354,6 +357,7 @@ func readConfig(logger *zap.Logger) *config {
354357 zap .String ("dapiKeyPath" , config .dapiKeyPath ),
355358 zap .String ("clusterCaCertPath" , config .clusterCaCertPath ),
356359 zap .Int ("rateLimit" , config .rateLimit ),
360+ zap .Duration ("shutdownTimeout" , config .shutdownTimeout ),
357361 zap .String ("otlpEndpoint" , config .otlpEndpoint ),
358362 zap .Bool ("disableTraces" , config .disableTraces ),
359363 zap .Bool ("disableMetrics" , config .disableMetrics ),
@@ -645,6 +649,7 @@ func startGateway() {
645649 BindDapiPort : config .dapiPort ,
646650 BindAddress : config .bindAddress ,
647651 RateLimit : config .rateLimit ,
652+ ShutdownTimeout : config .shutdownTimeout ,
648653 GrpcCertificate : grpcCertificate ,
649654 DapiCertificate : dapiCertificate ,
650655 ClusterCaCert : caCertPool ,
@@ -684,8 +689,9 @@ func startGateway() {
684689
685690 if newConfig .bindAddress != config .bindAddress ||
686691 newConfig .dataPort != config .dataPort ||
687- newConfig .dapiPort != config .dapiPort {
688- logger .Warn ("config changes for bindAddress, dataPort or dapiPort require a restart" )
692+ newConfig .dapiPort != config .dapiPort ||
693+ newConfig .shutdownTimeout != config .shutdownTimeout {
694+ logger .Warn ("config changes for bindAddress, dataPort, dapiPort or shutdownTimeout require a restart" )
689695 }
690696
691697 if newConfig .selfSign != config .selfSign {
0 commit comments