diff --git a/pkg/sidecar/config.go b/pkg/sidecar/config.go index e83c30bd..c6af3202 100644 --- a/pkg/sidecar/config.go +++ b/pkg/sidecar/config.go @@ -17,6 +17,7 @@ type Config struct { CmdArgsDeprecated string `hcl:"cmdArgs"` CertDir string `hcl:"cert_dir"` CertDirDeprecated string `hcl:"certDir"` + ExitWhenReady bool `hcl:"exit_when_ready"` // Merge intermediate certificates into Bundle file instead of SVID file, // it is useful is some scenarios like MySQL, // where this is the expected format for presented certificates and bundles diff --git a/pkg/sidecar/sidecar.go b/pkg/sidecar/sidecar.go index a9a31a49..54d7b70f 100644 --- a/pkg/sidecar/sidecar.go +++ b/pkg/sidecar/sidecar.go @@ -144,6 +144,10 @@ func (s *Sidecar) updateCertificates(svidResponse *workloadapi.X509Context) { } } + if s.config.ExitWhenReady { + os.Exit(0) + } + select { case s.certReadyChan <- struct{}{}: default: