@@ -499,8 +499,10 @@ func (m *Manager) handleRequest(ctx context.Context, volumeID string, meta metad
499
499
// Poll every 200ms for the CertificateRequest to be ready
500
500
lastFailureReason := ""
501
501
if err := wait .PollUntilWithContext (ctx , time .Millisecond * 200 , func (ctx context.Context ) (done bool , err error ) {
502
+ log .V (4 ).Info ("Reading CertificateRequest from lister cache" )
502
503
updatedReq , err := m .lister .CertificateRequests (req .Namespace ).Get (req .Name )
503
504
if apierrors .IsNotFound (err ) {
505
+ log .V (4 ).Info ("Failed to read CertificateRequest from lister cache" , "error" , err )
504
506
// A NotFound error implies something deleted the resource - fail
505
507
// early to allow a retry to occur at a later time if needed.
506
508
return false , err
@@ -524,6 +526,7 @@ func (m *Manager) handleRequest(ctx context.Context, volumeID string, meta metad
524
526
525
527
isApproved := apiutil .CertificateRequestIsApproved (updatedReq )
526
528
if ! isApproved {
529
+ log .V (4 ).Info ("CertificateRequest is not explicitly approved - continuing to check if the request has been issued anyway" )
527
530
lastFailureReason = fmt .Sprintf ("request %q has not yet been approved by approval plugin" , updatedReq .Name )
528
531
// we don't stop execution here, as some versions of cert-manager (and some external issuer plugins)
529
532
// may not be aware/utilise approval.
@@ -533,6 +536,7 @@ func (m *Manager) handleRequest(ctx context.Context, volumeID string, meta metad
533
536
534
537
readyCondition := apiutil .GetCertificateRequestCondition (updatedReq , cmapi .CertificateRequestConditionReady )
535
538
if readyCondition == nil {
539
+ log .V (4 ).Info ("Ready condition not found - will recheck..." )
536
540
// only overwrite the approval failure message if the request is actually approved
537
541
// otherwise we may hide more useful information from the user by accident.
538
542
if isApproved {
@@ -543,10 +547,12 @@ func (m *Manager) handleRequest(ctx context.Context, volumeID string, meta metad
543
547
544
548
switch readyCondition .Reason {
545
549
case cmapi .CertificateRequestReasonIssued :
550
+ log .V (4 ).Info ("CertificateRequest has been issued!" )
546
551
break
547
552
case cmapi .CertificateRequestReasonFailed :
548
553
return false , fmt .Errorf ("request %q has failed: %s" , updatedReq .Name , readyCondition .Message )
549
554
case cmapi .CertificateRequestReasonPending :
555
+ log .V (4 ).Info ("CertificateRequest is still pending..." )
550
556
if isApproved {
551
557
lastFailureReason = fmt .Sprintf ("request %q is pending: %v" , updatedReq .Name , readyCondition .Message )
552
558
}
@@ -578,6 +584,7 @@ func (m *Manager) handleRequest(ctx context.Context, volumeID string, meta metad
578
584
return fmt .Errorf ("calculating next issuance time: %w" , err )
579
585
}
580
586
meta .NextIssuanceTime = & renewalPoint
587
+ log .V (4 ).Info ("Persisting next issuance time to metadata store" , "next_issuance_time" , renewalPoint )
581
588
582
589
if err := m .writeKeypair (meta , key , req .Status .Certificate , req .Status .CA ); err != nil {
583
590
return fmt .Errorf ("writing keypair: %w" , err )
@@ -589,6 +596,7 @@ func (m *Manager) handleRequest(ctx context.Context, volumeID string, meta metad
589
596
// Without this, the renewal would pick up the existing issued certificate and re-issue, rather than requesting
590
597
// a new certificate.
591
598
m .deletePendingRequestPrivateKey (req .UID )
599
+ log .V (4 ).Info ("Removed pending request private key from internal cache" )
592
600
593
601
return nil
594
602
}
0 commit comments