Skip to content

Commit 42e91dd

Browse files
Merge pull request #2004 from vrutkovs/stop-on-empty-cabundle
OCPBUGS-60045: certrotation: exit when received cabundle is empty
2 parents c60a9f2 + 85a6e3e commit 42e91dd

File tree

2 files changed

+490
-1
lines changed

2 files changed

+490
-1
lines changed

pkg/operator/certrotation/client_cert_rotation_controller.go

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,14 +138,22 @@ func (c CertRotationController) getSigningCertKeyPairLocation() string {
138138

139139
func (c CertRotationController) SyncWorker(ctx context.Context) error {
140140
signingCertKeyPair, _, err := c.RotatedSigningCASecret.EnsureSigningCertKeyPair(ctx)
141-
if err != nil || signingCertKeyPair == nil {
141+
if err != nil {
142142
return err
143143
}
144+
// If no signingCertKeyPair returned due to update conflict or otherwise, return an error
145+
if signingCertKeyPair == nil {
146+
return fmt.Errorf("signingCertKeyPair is nil")
147+
}
144148

145149
cabundleCerts, err := c.CABundleConfigMap.EnsureConfigMapCABundle(ctx, signingCertKeyPair, c.getSigningCertKeyPairLocation())
146150
if err != nil {
147151
return err
148152
}
153+
// If no ca bundle returned due to update conflict or otherwise, return an error
154+
if cabundleCerts == nil {
155+
return fmt.Errorf("cabundleCerts is nil")
156+
}
149157

150158
if _, err := c.RotatedSelfSignedCertKeySecret.EnsureTargetCertKeyPair(ctx, signingCertKeyPair, cabundleCerts); err != nil {
151159
return err

0 commit comments

Comments
 (0)