From d63a4674317497fd6700c52c705649ce85ac3725 Mon Sep 17 00:00:00 2001 From: Tomasz Wrobel Date: Tue, 13 Jul 2021 16:47:08 +0200 Subject: [OOM-K8S-CERT-EXTERNAL-PROVIDER] Add send update request functionality Issue-ID: OOM-2753 Signed-off-by: Tomasz Wrobel Change-Id: I0637ded5c870cc66c7dc27dff269dab0f7d9015b --- .../src/cmpv2controller/certificate_request_controller.go | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) (limited to 'certServiceK8sExternalProvider/src/cmpv2controller') diff --git a/certServiceK8sExternalProvider/src/cmpv2controller/certificate_request_controller.go b/certServiceK8sExternalProvider/src/cmpv2controller/certificate_request_controller.go index 1032ee00..9d266854 100644 --- a/certServiceK8sExternalProvider/src/cmpv2controller/certificate_request_controller.go +++ b/certServiceK8sExternalProvider/src/cmpv2controller/certificate_request_controller.go @@ -3,7 +3,7 @@ * oom-certservice-k8s-external-provider * ================================================================================ * Copyright 2019 The cert-manager authors. - * Modifications copyright (C) 2020-2021 Nokia. All rights reserved. + * Copyright (C) 2020-2021 Nokia. All rights reserved. * ================================================================================ * This source code was copied from the following git repository: * https://github.com/smallstep/step-issuer @@ -43,6 +43,7 @@ import ( "onap.org/oom-certservice/k8s-external-provider/src/cmpv2controller/util" provisioners "onap.org/oom-certservice/k8s-external-provider/src/cmpv2provisioner" "onap.org/oom-certservice/k8s-external-provider/src/leveledlogger" + "onap.org/oom-certservice/k8s-external-provider/src/model" x509utils "onap.org/oom-certservice/k8s-external-provider/src/x509" ) @@ -142,12 +143,18 @@ func (controller *CertificateRequestController) Reconcile(k8sRequest ctrl.Reques isUpdateRevision, oldCertificate, oldPrivateKey := util.CheckIfCertificateUpdateAndRetrieveOldCertificateAndPk( controller.Client, certificateRequest, ctx) if isUpdateRevision { - log.Debug("Certificate will be updated.", "old-certificate", oldCertificate, - "old-private-key", oldPrivateKey) //TODO: remove private key from logger + log.Info("Update revision detected") + } + signCertificateModel := model.SignCertificateModel{ + CertificateRequest: certificateRequest, + PrivateKeyBytes: privateKeyBytes, + IsUpdateRevision: isUpdateRevision, + OldCertificate: oldCertificate, + OldPrivateKey: oldPrivateKey, } // 11. Sign CertificateRequest - signedPEM, trustedCAs, err := provisioner.Sign(ctx, certificateRequest, privateKeyBytes) + signedPEM, trustedCAs, err := provisioner.Sign(ctx, signCertificateModel) if err != nil { controller.handleErrorFailedToSignCertificate(certUpdater, log, err) return ctrl.Result{}, nil -- cgit 1.2.3-korg