diff --git a/pkg/controller/certificates/util.go b/pkg/controller/certificates/util.go index b80a67488..2935ff0f4 100644 --- a/pkg/controller/certificates/util.go +++ b/pkg/controller/certificates/util.go @@ -307,6 +307,6 @@ func RenewalTime(notBefore, notAfter time.Time, renewBeforeOverride *metav1.Dura // 2. Calculate when a cert should be renewed - rt := metav1.NewTime(notAfter.Add(-1 * renewBefore)) + rt := metav1.NewTime(notAfter.Add(-1 * renewBefore).Truncate(time.Second)) return &rt } diff --git a/pkg/controller/certificates/util_test.go b/pkg/controller/certificates/util_test.go index 44d4de429..8951914b2 100644 --- a/pkg/controller/certificates/util_test.go +++ b/pkg/controller/certificates/util_test.go @@ -302,7 +302,7 @@ func TestRenewalTime(t *testing.T) { renewBeforeOverride *metav1.Duration expectedRenewalTime *metav1.Time } - now := time.Now() + now := time.Now().Truncate(time.Second) tests := map[string]scenario{ "short lived cert, spec.renewBefore is not set": { notBefore: now,