diff --git a/CHANGELOG.md b/CHANGELOG.md index 056960f..588657f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] +### Changed + +- Add more logs to improve debugging. + ## [0.3.0] - 2024-07-24 ### Changed diff --git a/controllers/vspherecluster_controller.go b/controllers/vspherecluster_controller.go index 0307261..f97552c 100644 --- a/controllers/vspherecluster_controller.go +++ b/controllers/vspherecluster_controller.go @@ -100,6 +100,7 @@ func (r *VSphereClusterReconciler) SetupWithManager(mgr ctrl.Manager) error { } func (r *VSphereClusterReconciler) reconcileNormal(ctx context.Context, log logr.Logger, vsphereCluster *capv.VSphereCluster) (reconcile.Result, error) { + log.V(1).Info("Reconciling for normal state") // If the vsphereCluster doesn't have the finalizer, add it. err := r.addFinalizer(ctx, log, vsphereCluster) if err != nil { @@ -124,8 +125,10 @@ func (r *VSphereClusterReconciler) reconcileNormal(ctx context.Context, log logr } func (r *VSphereClusterReconciler) reconcileDelete(ctx context.Context, log logr.Logger, vsphereCluster *capv.VSphereCluster) (reconcile.Result, error) { + log.V(1).Info("Reconciling for deletion") if !controllerutil.ContainsFinalizer(vsphereCluster, key.CleanerFinalizerName) { - // no-op in case the finalizer is not there (it could have been deleted manually) + // the cleanup is already done + log.V(1).Info("There is no finalizer on VsphereCluster CR. Deletion should have already been done") return ctrl.Result{}, nil } @@ -139,6 +142,7 @@ func (r *VSphereClusterReconciler) reconcileDelete(ctx context.Context, log logr sess, err := r.getVCenterSession(ctx, vsphereCluster) if err != nil { + log.V(1).Error(err, "Error while getting vcenter session") return reconcile.Result{}, microerror.Mask(err) }