From c4eb4550e2423d716baf7e3d380894ac0b917601 Mon Sep 17 00:00:00 2001 From: Marc Lallaouret Date: Wed, 24 Jul 2024 18:05:54 +0200 Subject: [PATCH] fix: Add seconds unit to CSQL_PROXY_MAX_SIGTERM_DELAY value. (#611) The sigterm delay duration needs to include the unit seconds (for example: `30s` instead of `30`). This will allow the value to be parsed as a golang duration. Fixes #610 --- internal/workload/podspec_updates.go | 2 +- internal/workload/podspec_updates_test.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/internal/workload/podspec_updates.go b/internal/workload/podspec_updates.go index 38c6dd2c..b0894b03 100644 --- a/internal/workload/podspec_updates.go +++ b/internal/workload/podspec_updates.go @@ -743,7 +743,7 @@ func (s *updateState) applyContainerSpec(p *cloudsqlapi.AuthProxyWorkload, c *co } if p.Spec.AuthProxyContainer.MaxSigtermDelay != nil && *p.Spec.AuthProxyContainer.MaxSigtermDelay != 0 { - s.addProxyContainerEnvVar(p, "CSQL_PROXY_MAX_SIGTERM_DELAY", fmt.Sprintf("%d", *p.Spec.AuthProxyContainer.MaxSigtermDelay)) + s.addProxyContainerEnvVar(p, "CSQL_PROXY_MAX_SIGTERM_DELAY", fmt.Sprintf("%ds", *p.Spec.AuthProxyContainer.MaxSigtermDelay)) } return diff --git a/internal/workload/podspec_updates_test.go b/internal/workload/podspec_updates_test.go index 495b4684..01bcbf08 100644 --- a/internal/workload/podspec_updates_test.go +++ b/internal/workload/podspec_updates_test.go @@ -696,7 +696,7 @@ func TestProxyCLIArgs(t *testing.T) { "CSQL_PROXY_PROMETHEUS": "true", "CSQL_PROXY_QUOTA_PROJECT": "qp", "CSQL_PROXY_MAX_CONNECTIONS": "10", - "CSQL_PROXY_MAX_SIGTERM_DELAY": "20", + "CSQL_PROXY_MAX_SIGTERM_DELAY": "20s", "CSQL_PROXY_IMPERSONATE_SERVICE_ACCOUNT": "sv1@developer.gserviceaccount.com,sv2@developer.gserviceaccount.com", "CSQL_PROXY_QUIET": "true", "CSQL_PROXY_STRUCTURED_LOGS": "true",