Skip to content

Commit

Permalink
Add duration to certificate creation logs
Browse files Browse the repository at this point in the history
  • Loading branch information
rzetelskik committed Jul 29, 2024
1 parent a30cf34 commit 11d6b50
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion pkg/kubecrypto/certs.go
Original file line number Diff line number Diff line change
Expand Up @@ -198,12 +198,13 @@ func makeCertificate(ctx context.Context, name string, certCreator ocrypto.CertC
}

if len(refreshReason) != 0 {
startTime := time.Now()
klog.V(2).InfoS("Creating certificate", "Secret", naming.ObjRef(tlsSecret.GetSecret()), "Reason", refreshReason)
cert, key, err := certCreator.MakeCertificate(ctx, keyGetter, signer, validity)
if err != nil {
return nil, fmt.Errorf("can't create certificate: %w", err)
}
klog.V(2).InfoS("Certificate created", "Secret", naming.ObjRef(tlsSecret.GetSecret()))
klog.V(2).InfoS("Certificate created", "Secret", naming.ObjRef(tlsSecret.GetSecret()), "Duration", time.Now().Sub(startTime))

certBytes, err := ocrypto.EncodeCertificates(cert)
if err != nil {
Expand Down

0 comments on commit 11d6b50

Please sign in to comment.