1
0
Fork 0
mirror of https://github.com/external-secrets/external-secrets.git synced 2024-12-14 11:57:59 +00:00

Fix exit with no error when cert violates lookahead (#2395)

Add an exit message when the certificate check triggers a fatal exit
(via cancel()). When cancel() is called, this cancels the main
context which causes the webhook to shutdown.

A return is also added to ensure the message "valid" comes out right
after "invalid" like so:

"certs are not valid at..."
"certs are valid"

Signed-off-by: Eric Stokes <fernferret@gmail.com>
This commit is contained in:
Eric 2023-06-07 20:27:17 +01:00 committed by GitHub
parent 5a6d661c9e
commit fb944d599d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -98,7 +98,9 @@ var webhookCmd = &cobra.Command{
setupLog.Info("validating certs")
err = crds.CheckCerts(c, dnsName, time.Now().Add(certLookaheadInterval))
if err != nil {
setupLog.Error(err, "certs are not valid at now + lookahead, triggering shutdown", "certLookahead", certLookaheadInterval.String())
cancel()
return
}
setupLog.Info("certs are valid")
}