Skip to content

Commit 52b1265

Browse files
perdasilvaPer Goncalves da Silva
and
Per Goncalves da Silva
authored
Fix webhook service rotation to renew within 24h of expiry (#1997)
Signed-off-by: Per Goncalves da Silva <pegoncal@redhat.com> Co-authored-by: Per Goncalves da Silva <pegoncal@redhat.com>
1 parent 039f613 commit 52b1265

File tree

2 files changed

+9
-0
lines changed

2 files changed

+9
-0
lines changed

internal/operator-controller/rukpak/render/certproviders/certmanager.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ import (
2020
const (
2121
certManagerInjectCAAnnotation = "cert-manager.io/inject-ca-from"
2222
olmv0RotationPeriod = 730 * 24 * time.Hour // 2 year rotation
23+
olmv0RenewBefore = 24 * time.Hour // renew certificate within 24h of expiry
2324
)
2425

2526
var _ render.CertificateProvider = (*CertManagerCertificateProvider)(nil)
@@ -55,6 +56,7 @@ func (p CertManagerCertificateProvider) AdditionalObjects(cfg render.Certificate
5556
// OLMv0 parity:
5657
// - self-signed issuer
5758
// - 2 year rotation period
59+
// - renew 24h before expiry
5860
// - CN: argocd-operator-controller-manager-service.argocd (<deploymentName>-service.<namespace>)
5961
// - CA: false
6062
// - DNS:argocd-operator-controller-manager-service.argocd, DNS:argocd-operator-controller-manager-service.argocd.svc, DNS:argocd-operator-controller-manager-service.argocd.svc.cluster.local
@@ -165,6 +167,9 @@ func (p CertManagerCertificateProvider) AdditionalObjects(cfg render.Certificate
165167
Duration: &metav1.Duration{
166168
Duration: olmv0RotationPeriod,
167169
},
170+
RenewBefore: &metav1.Duration{
171+
Duration: olmv0RenewBefore,
172+
},
168173
},
169174
}
170175
certObj, err := util.ToUnstructured(certificate)

internal/operator-controller/rukpak/render/certproviders/certmanager_test.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,10 @@ func Test_CertManagerProvider_AdditionalObjects(t *testing.T) {
143143
// OLMv0 has a 2 year certificate rotation period
144144
Duration: 730 * 24 * time.Hour,
145145
},
146+
RenewBefore: &metav1.Duration{
147+
// OLMv0 reviews 24h before expiry
148+
Duration: 24 * time.Hour,
149+
},
146150
},
147151
}),
148152
}, objs)

0 commit comments

Comments
 (0)