From b8ca4543758120ded942c632d6b4aadb1c2a4042 Mon Sep 17 00:00:00 2001 From: Kevin Fox Date: Mon, 18 Dec 2023 17:28:55 -0800 Subject: [PATCH] Add an option to exit on success Signed-off-by: Kevin Fox --- pkg/sidecar/config.go | 1 + pkg/sidecar/sidecar.go | 4 ++++ 2 files changed, 5 insertions(+) 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: