url string
healthEndpoint string
certEndpoint string
+ updateEndpoint string
caName string
certServiceClient certserviceclient.CertServiceClient
}
ca.caName = cmpv2Issuer.Spec.CaName
ca.healthEndpoint = cmpv2Issuer.Spec.HealthEndpoint
ca.certEndpoint = cmpv2Issuer.Spec.CertEndpoint
+ ca.updateEndpoint = cmpv2Issuer.Spec.UpdateEndpoint
ca.certServiceClient = certServiceClient
log := leveledlogger.GetLoggerWithName("cmpv2-provisioner")
- log.Info("Configuring CA: ", "name", ca.name, "url", ca.url, "caName", ca.caName, "healthEndpoint", ca.healthEndpoint, "certEndpoint", ca.certEndpoint)
+ log.Info("Configuring CA: ", "name", ca.name, "url", ca.url, "caName", ca.caName, "healthEndpoint", ca.healthEndpoint, "certEndpoint", ca.certEndpoint, "updateEndpoint", ca.updateEndpoint)
return &ca, nil
}
var response *certserviceclient.CertificatesResponse
var errAPI error
-
if ca.isCertificateUpdate(signCertificateModel) {
log.Debug("Certificate will be updated.", "old-certificate", signCertificateModel.OldCertificateBytes)
log.Info("Attempt to send certificate update request")
return signedCertificateChain, trustedCertificates, nil
}
+func (ca *CertServiceCA) updateEndpointIsConfigured() bool {
+ log := leveledlogger.GetLoggerWithName("certservice-provisioner")
+ isConfigured := ca.updateEndpoint != ""
+ if !isConfigured {
+ log.Info("Missing 'update endpoint' configuration. Certificates will received by certificate request instead of certificate update request")
+ }
+ return isConfigured
+}
func (ca *CertServiceCA) isCertificateUpdate(signCertificateModel model.SignCertificateModel) bool {
- return len(signCertificateModel.OldCertificateBytes) > 0 && len(signCertificateModel.OldPrivateKeyBytes) > 0
+ return len(signCertificateModel.OldCertificateBytes) > 0 &&
+ len(signCertificateModel.OldPrivateKeyBytes) > 0 &&
+ ca.updateEndpointIsConfigured()
}