diff --git a/util/certificate/certificate_manager.go b/util/certificate/certificate_manager.go index 3cadebc6..9df414ab 100644 --- a/util/certificate/certificate_manager.go +++ b/util/certificate/certificate_manager.go @@ -374,6 +374,9 @@ func getCurrentCertificateOrBootstrap( if err != nil { return nil, false, fmt.Errorf("unable to parse certificate data: %v", err) } + if len(certs) < 1 { + return nil, false, fmt.Errorf("no cert data found") + } bootstrapCert.Leaf = certs[0] if _, err := store.Update(bootstrapCertificatePEM, bootstrapKeyPEM); err != nil { diff --git a/util/certificate/csr/csr.go b/util/certificate/csr/csr.go index 9cc4be8e..c763f31c 100644 --- a/util/certificate/csr/csr.go +++ b/util/certificate/csr/csr.go @@ -125,7 +125,7 @@ func WaitForCertificate(ctx context.Context, client certificatesclient.Certifica } } if approved { - if csr.Status.Certificate != nil { + if len(csr.Status.Certificate) > 0 { klog.V(2).Infof("certificate signing request %s is issued", csr.Name) return true, nil }