diff options
author | Jan Malkiewicz <jan.malkiewicz@nokia.com> | 2020-10-14 13:54:17 +0200 |
---|---|---|
committer | Jan Malkiewicz <jan.malkiewicz@nokia.com> | 2020-10-14 14:04:43 +0200 |
commit | 720466562b0ea1e67ff36f44e0d95645837316d4 (patch) | |
tree | 94f2a255b596dee88ab1b08e4d589edeb585afa0 /certServiceK8sExternalProvider/src | |
parent | 9e42e7b6b524034035e94221098d1374f34c5165 (diff) |
[OOM-K8S-CERT-EXTERNAL-PROVIDER] Mock implementaion enhanced
Libs upgraded.
Use v1 version of the resources.
Issue-ID: OOM-2559
Signed-off-by: Jan Malkiewicz <jan.malkiewicz@nokia.com>
Change-Id: I009ff3ca8c3e84863dcf5cea290c8968280ca8ec
Diffstat (limited to 'certServiceK8sExternalProvider/src')
5 files changed, 10 insertions, 5 deletions
diff --git a/certServiceK8sExternalProvider/src/api/groupversion_info.go b/certServiceK8sExternalProvider/src/api/groupversion_info.go index e5cdea12..0a64b25e 100644 --- a/certServiceK8sExternalProvider/src/api/groupversion_info.go +++ b/certServiceK8sExternalProvider/src/api/groupversion_info.go @@ -32,7 +32,7 @@ import ( var ( // GroupVersion is group version used to register these objects - GroupVersion = schema.GroupVersion{Group: "certmanager.onap.org", Version: "v1beta1"} + GroupVersion = schema.GroupVersion{Group: "certmanager.onap.org", Version: "v1"} // SchemeBuilder is used to add go types to the GroupVersionKind scheme SchemeBuilder = &scheme.Builder{GroupVersion: GroupVersion} diff --git a/certServiceK8sExternalProvider/src/certservice-controller/certificaterequest_reconciler.go b/certServiceK8sExternalProvider/src/certservice-controller/certificaterequest_reconciler.go index 92e77960..b744676e 100644 --- a/certServiceK8sExternalProvider/src/certservice-controller/certificaterequest_reconciler.go +++ b/certServiceK8sExternalProvider/src/certservice-controller/certificaterequest_reconciler.go @@ -33,7 +33,7 @@ import ( "github.com/go-logr/logr" apiutil "github.com/jetstack/cert-manager/pkg/api/util" - cmapi "github.com/jetstack/cert-manager/pkg/apis/certmanager/v1alpha2" + cmapi "github.com/jetstack/cert-manager/pkg/apis/certmanager/v1" cmmeta "github.com/jetstack/cert-manager/pkg/apis/meta/v1" core "k8s.io/api/core/v1" apierrors "k8s.io/apimachinery/pkg/api/errors" diff --git a/certServiceK8sExternalProvider/src/certservice-controller/certservice_issuer_reconciler.go b/certServiceK8sExternalProvider/src/certservice-controller/certservice_issuer_reconciler.go index b22abcd4..b826e2dd 100644 --- a/certServiceK8sExternalProvider/src/certservice-controller/certservice_issuer_reconciler.go +++ b/certServiceK8sExternalProvider/src/certservice-controller/certservice_issuer_reconciler.go @@ -59,6 +59,7 @@ func (reconciler *CertServiceIssuerReconciler) Reconcile(req ctrl.Request) (ctrl log.Error(err, "failed to retrieve CertServiceIssuer resource") return ctrl.Result{}, client.IgnoreNotFound(err) } + log.Info("Issuer loaded: ", "issuer", issuer) statusReconciler := newStatusReconciler(reconciler, issuer, log) if err := validateCertServiceIssuerSpec(issuer.Spec); err != nil { @@ -66,6 +67,7 @@ func (reconciler *CertServiceIssuerReconciler) Reconcile(req ctrl.Request) (ctrl statusReconciler.UpdateNoError(ctx, api.ConditionFalse, "Validation", "Failed to validate resource: %v", err) return ctrl.Result{}, err } + log.Info("Issuer validated. ") // Fetch the provisioner password var secret core.Secret @@ -99,6 +101,7 @@ func (reconciler *CertServiceIssuerReconciler) Reconcile(req ctrl.Request) (ctrl } provisioners.Store(req.NamespacedName, provisioner) + log.Info( "CertServiceIssuer verified. Updating status to Verified...") return ctrl.Result{}, statusReconciler.Update(ctx, api.ConditionTrue, "Verified", "CertServiceIssuer verified and ready to sign certificates") } diff --git a/certServiceK8sExternalProvider/src/certservice-controller/certservice_issuer_status_reconciler.go b/certServiceK8sExternalProvider/src/certservice-controller/certservice_issuer_status_reconciler.go index 6dd8baea..f2c0452e 100644 --- a/certServiceK8sExternalProvider/src/certservice-controller/certservice_issuer_status_reconciler.go +++ b/certServiceK8sExternalProvider/src/certservice-controller/certservice_issuer_status_reconciler.go @@ -57,9 +57,11 @@ func (reconciler *certServiceIssuerStatusReconciler) Update(ctx context.Context, if status == api.ConditionFalse { eventType = core.EventTypeWarning } + reconciler.logger.Info("Firing event: ", "issuer", reconciler.issuer, "eventtype", eventType, "reason", reason, "message", completeMessage) reconciler.Recorder.Event(reconciler.issuer, eventType, reason, completeMessage) - return reconciler.Client.Status().Update(ctx, reconciler.issuer) + reconciler.logger.Info("Updating issuer... ") + return reconciler.Client.Update(ctx, reconciler.issuer) } func (reconciler *certServiceIssuerStatusReconciler) UpdateNoError(ctx context.Context, status api.ConditionStatus, reason, message string, args ...interface{}) { diff --git a/certServiceK8sExternalProvider/src/certservice-provisioner/certservice-provisioner.go b/certServiceK8sExternalProvider/src/certservice-provisioner/certservice-provisioner.go index b20e0395..262e708b 100644 --- a/certServiceK8sExternalProvider/src/certservice-provisioner/certservice-provisioner.go +++ b/certServiceK8sExternalProvider/src/certservice-provisioner/certservice-provisioner.go @@ -32,7 +32,7 @@ import ( "encoding/base64" "encoding/pem" "fmt" - certmanager "github.com/jetstack/cert-manager/pkg/apis/certmanager/v1alpha2" + certmanager "github.com/jetstack/cert-manager/pkg/apis/certmanager/v1" "k8s.io/apimachinery/pkg/types" "onap.org/oom-certservice/k8s-external-provider/src/api" ctrl "sigs.k8s.io/controller-runtime" @@ -80,7 +80,7 @@ func (ca *CertServiceCA) Sign(ctx context.Context, certificateRequest *certmanag key, _ := base64.RawStdEncoding.DecodeString(string(ca.key)) log.Info("CA: ", "name", ca.name, "url", ca.url, "key", key) - crPEM := certificateRequest.Spec.CSRPEM + crPEM := certificateRequest.Spec.Request csrBase64 := crPEM log.Info("Csr PEM: ", "bytes", csrBase64) |