From 4fa0e1e570e02fb1005f70640686d7bd3e27de44 Mon Sep 17 00:00:00 2001 From: Koen de Laat Date: Mon, 3 Jun 2024 11:03:53 +0000 Subject: [PATCH] fix: Use actual warningPeriod in certmonitor Signed-off-by: Koen de Laat (cherry picked from commit 79ba10f5ec88a2458b44f67d009b4ee071918e4d) Signed-off-by: Brad Davidson --- pkg/certmonitor/certmonitor.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/certmonitor/certmonitor.go b/pkg/certmonitor/certmonitor.go index 85b718f078..a9a2d73e1f 100644 --- a/pkg/certmonitor/certmonitor.go +++ b/pkg/certmonitor/certmonitor.go @@ -126,7 +126,7 @@ func checkCerts(fileMap map[string][]string, warningPeriod time.Duration) error } else if now.After(cert.NotAfter) { errs = append(errs, fmt.Errorf("%s/%s: certificate %s expired at %s", service, basename, cert.Subject, cert.NotAfter.Format(time.RFC3339))) } else if warn.After(cert.NotAfter) { - errs = append(errs, fmt.Errorf("%s/%s: certificate %s will expire within %d days at %s", service, basename, cert.Subject, daemonconfig.CertificateRenewDays, cert.NotAfter.Format(time.RFC3339))) + errs = append(errs, fmt.Errorf("%s/%s: certificate %s will expire within %d days at %s", service, basename, cert.Subject, int(warningPeriod.Hours()/24), cert.NotAfter.Format(time.RFC3339))) } } }