Skip to content
This repository was archived by the owner on May 3, 2022. It is now read-only.

Commit 033806d

Browse files
nikoloupPanagiotis Nikoloutsopoulos
andauthored
Add more logs to janitor controller to investigate disappearing anchors (#399)
Co-authored-by: Panagiotis Nikoloutsopoulos <[email protected]>
1 parent c922bcf commit 033806d

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

pkg/controller/janitor/janitor_controller.go

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -225,6 +225,14 @@ func (c *Controller) syncAnchor(item *AnchorWorkItem) error {
225225
return shippererrors.NewKubeclientGetError(item.Namespace, item.ReleaseName, err).
226226
WithShipperKind("InstallationTarget")
227227
} else if it != nil && string(it.UID) == item.InstallationTargetUID {
228+
// Check to see if the anchor was recreated at some point and report it
229+
anchorCreationTime := item.ObjectMeta.CreationTimestamp
230+
itCreationTime := it.CreationTimestamp
231+
timeDiff := itCreationTime.Time.Sub(anchorCreationTime.Time)
232+
if timeDiff > 1*time.Minute {
233+
klog.V(4).Infof("Achor %q in namespace %q was recreated at some point, as its creationTimestamp differs from its owning InstallationTarget creationTimestamp",
234+
item.Name, item.Namespace)
235+
}
228236
// The anchor config map's installation target UID and the installation
229237
// target object in the manage cluster match, so we just bail out here.
230238
return nil
@@ -276,13 +284,19 @@ func (c *Controller) syncInstallationTarget(item *InstallationTargetWorkItem) er
276284
"ConfigMapDeleted",
277285
"Config map %q has been deleted from cluster %q",
278286
err.Error())
287+
klog.V(4).Infof(
288+
"Attempted to remove anchor %q in namespace %q because owner installation target was removed, but error %q occurred",
289+
item.AnchorName, item.Namespace, err)
279290
return err
280291
} else if ok {
281292
c.recorder.Eventf(installationTarget,
282293
corev1.EventTypeNormal,
283294
"ConfigMapDeleted",
284295
"Config map %q has been deleted from cluster %q",
285296
item.Key, clusterName)
297+
klog.V(4).Infof(
298+
"Removed anchor %q in namespace %q because owner installation target was removed",
299+
item.AnchorName, item.Namespace)
286300
}
287301
}
288302

0 commit comments

Comments
 (0)