From 0ca26dd0fd64352908730c0ea8a2e3c8eacda1b9 Mon Sep 17 00:00:00 2001 From: Lee Yarwood Date: Wed, 16 Aug 2023 11:41:46 +0100 Subject: [PATCH] DNM: Add additional logging to help debug issue Signed-off-by: Lee Yarwood --- internal/common/resource.go | 2 ++ internal/operands/common-instancetypes/reconcile.go | 4 ++++ 2 files changed, 6 insertions(+) diff --git a/internal/common/resource.go b/internal/common/resource.go index c5ca94857..70cb8eb88 100644 --- a/internal/common/resource.go +++ b/internal/common/resource.go @@ -420,6 +420,8 @@ func isResourceOwned(request *Request, expectedObj, foundObj client.Object) (boo } } + request.Logger.Info(fmt.Sprintf("lyarwood isResourceOwned False %s foundObj.GetAnnotations() %v vs %s expectedObj.GetAnnotations() %v", foundObj.GetName(), foundObj.GetAnnotations(), expectedObj.GetName(), expectedObj.GetAnnotations())) + return false, nil } diff --git a/internal/operands/common-instancetypes/reconcile.go b/internal/operands/common-instancetypes/reconcile.go index bc8f44f4e..94433bcd3 100644 --- a/internal/operands/common-instancetypes/reconcile.go +++ b/internal/operands/common-instancetypes/reconcile.go @@ -290,13 +290,17 @@ func (c *CommonInstancetypes) Reconcile(request *common.Request) ([]common.Recon func (c *CommonInstancetypes) Cleanup(request *common.Request) ([]common.CleanupResult, error) { var objects []client.Object + request.Logger.Info(fmt.Sprintf("lyarwood common-instancetypes Cleanup")) + // Before collecting resources to clean up ensure the corresponding CRD is available if request.CrdList.CrdExists(virtualMachineClusterInstancetypeCrd) { + request.Logger.Info(fmt.Sprintf("lyarwood common-instancetypes removing %d virtualMachineClusterInstancetypes", len(c.virtualMachineClusterInstancetypes))) for i := range c.virtualMachineClusterInstancetypes { objects = append(objects, &c.virtualMachineClusterInstancetypes[i]) } } if request.CrdList.CrdExists(virtualMachineClusterPreferenceCrd) { + request.Logger.Info(fmt.Sprintf("lyarwood common-instancetypes %d removing virtualMachineClusterPreferences", len(c.virtualMachineClusterPreferences))) for i := range c.virtualMachineClusterPreferences { objects = append(objects, &c.virtualMachineClusterPreferences[i]) }