// return an error on failure. If retrieval is succesful, the certificate data
// and private key will be stored in the named secret
return an error on failure. If retrieval is succesful, the certificate data
and private key will be stored in the named secret
// return an error on failure . If retrieval is succesful the certificate data // and private key will be stored in the named secret
func (c *Controller) issue(ctx context.Context, issuer issuer.Interface, crt *v1alpha1.Certificate) error {
	resp, err := issuer.Issue(ctx, crt)
	if err != nil {
		klog.Infof("Error issuing certificate for %s/%s: %v", crt.Namespace, crt.Name, err)
		return err
	}
	if resp == nil {
		return nil
	}
	if _, err := c.updateSecret(crt, crt.Namespace, resp.Certificate, resp.PrivateKey, resp.CA); err != nil {
		s := messageErrorSavingCertificate + err.Error()
		klog.Info(s)
		c.Recorder.Event(crt, corev1.EventTypeWarning, errorSavingCertificate, s)
		return err
	}
	if len(resp.Certificate) > 0 {
		c.Recorder.Event(crt, corev1.EventTypeNormal, successCertificateIssued, "Certificate issued successfully")
		c.scheduleRenewal(crt)
	}
	return nil
}
func ( c * Controller ) issue ( ctx context . Context , issuer issuer . Interface , crt * v1alpha1 . Certificate ) error { resp , err := issuer . Issue ( ctx , crt ) if err != nil { klog . Infof ( " " , crt . Namespace , crt . Name , err ) return err } if resp == nil { return nil } if _ , err := c . updateSecret ( crt , crt . Namespace , resp . Certificate , resp . PrivateKey , resp . CA ) ; err != nil { s := messageErrorSavingCertificate + err . Error ( ) klog . Info ( s ) c . Recorder . Event ( crt , corev1 . EventTypeWarning , errorSavingCertificate , s ) return err } if len ( resp . Certificate ) > 0 { c . Recorder . Event ( crt , corev1 . EventTypeNormal , successCertificateIssued , " " ) c . scheduleRenewal ( crt ) } return nil }
return an error on failure.
return an error on failure .
// if the issuer has not returned any data, exit early // as we have just written a certificate, we should schedule it for renewal