Skip to content

Commit 761cb01

Browse files
ShyamsundarRBenamarMk
authored andcommitted
Add some logging for adoption functions
Signed-off-by: Shyamsundar Ranganathan <[email protected]> (cherry picked from commit 01470b0)
1 parent e811948 commit 761cb01

File tree

1 file changed

+16
-7
lines changed

1 file changed

+16
-7
lines changed

controllers/drplacementcontrol_controller.go

+16-7
Original file line numberDiff line numberDiff line change
@@ -2469,7 +2469,8 @@ func ensureVRGsManagedByDRPC(
24692469

24702470
for cluster, viewVRG := range vrgs {
24712471
if !viewVRG.GetDeletionTimestamp().IsZero() {
2472-
log.Info("VRG reported by view undergoing deletion, during adoption")
2472+
log.Info("VRG reported by view undergoing deletion, during adoption",
2473+
"cluster", cluster, "namespace", viewVRG.Namespace, "name", viewVRG.Name)
24732474

24742475
continue
24752476
}
@@ -2503,7 +2504,7 @@ func adoptVRG(
25032504
mw, err := mwu.FindManifestWorkByType(rmnutil.MWTypeVRG, cluster)
25042505
if err != nil {
25052506
if !errors.IsNotFound(err) {
2506-
log.Info("error fetching VRG ManifestWork during adoption", "error", err)
2507+
log.Info("error fetching VRG ManifestWork during adoption", "error", err, "cluster", cluster)
25072508

25082509
return !adopted
25092510
}
@@ -2514,14 +2515,14 @@ func adoptVRG(
25142515
}
25152516

25162517
if !mw.GetDeletionTimestamp().IsZero() {
2517-
log.Info("VRG ManifestWork found deleted during adoption")
2518+
log.Info("VRG ManifestWork found deleted during adoption", "cluster", cluster)
25182519

25192520
return adopted
25202521
}
25212522

25222523
vrg, err := rmnutil.ExtractVRGFromManifestWork(mw)
25232524
if err != nil {
2524-
log.Info("error extracting VRG from ManifestWork during adoption", "error", err)
2525+
log.Info("error extracting VRG from ManifestWork during adoption", "error", err, "cluster", cluster)
25252526

25262527
return !adopted
25272528
}
@@ -2541,12 +2542,17 @@ func adoptExistingVRGManifestWork(
25412542
drpc *rmn.DRPlacementControl,
25422543
vrgNamespace string,
25432544
) {
2545+
log.Info("adopting existing VRG ManifestWork", "cluster", cluster, "namespace", vrg.Namespace, "name", vrg.Name)
2546+
25442547
if vrg.GetAnnotations() == nil {
25452548
vrg.Annotations = make(map[string]string)
25462549
}
25472550

25482551
if v, ok := vrg.Annotations[DRPCUIDAnnotation]; ok && v == string(drpc.UID) {
25492552
// Annotation may already be set but not reflected on the resource view yet
2553+
log.Info("detected VRGs DRPC UID annotation as existing",
2554+
"cluster", cluster, "namespace", vrg.Namespace, "name", vrg.Name)
2555+
25502556
return
25512557
}
25522558

@@ -2558,7 +2564,7 @@ func adoptExistingVRGManifestWork(
25582564

25592565
err := mwu.CreateOrUpdateVRGManifestWork(drpc.Name, vrgNamespace, cluster, *vrg, annotations)
25602566
if err != nil {
2561-
log.Info("error updating VRG via ManifestWork during adoption", "error", err)
2567+
log.Info("error updating VRG via ManifestWork during adoption", "error", err, "cluster", cluster)
25622568
}
25632569
}
25642570

@@ -2571,14 +2577,17 @@ func adoptOrphanVRG(
25712577
drpc *rmn.DRPlacementControl,
25722578
vrgNamespace string,
25732579
) {
2580+
log.Info("adopting orphaned VRG ManifestWork",
2581+
"cluster", cluster, "namespace", viewVRG.Namespace, "name", viewVRG.Name)
2582+
25742583
annotations := make(map[string]string)
25752584
annotations[DRPCNameAnnotation] = drpc.Name
25762585
annotations[DRPCNamespaceAnnotation] = drpc.Namespace
25772586

25782587
// Adopt the namespace as well
25792588
err := mwu.CreateOrUpdateNamespaceManifest(drpc.Name, vrgNamespace, cluster, annotations)
25802589
if err != nil {
2581-
log.Info("error creating namespace via ManifestWork during adoption", "error", err)
2590+
log.Info("error creating namespace via ManifestWork during adoption", "error", err, "cluster", cluster)
25822591

25832592
return
25842593
}
@@ -2593,7 +2602,7 @@ func adoptOrphanVRG(
25932602
if err := mwu.CreateOrUpdateVRGManifestWork(
25942603
drpc.Name, vrgNamespace,
25952604
cluster, *vrg, annotations); err != nil {
2596-
log.Info("error creating VRG via ManifestWork during adoption", "error", err)
2605+
log.Info("error creating VRG via ManifestWork during adoption", "error", err, "cluster", cluster)
25972606
}
25982607
}
25992608

0 commit comments

Comments
 (0)