Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

drpc: add missing logger #1728

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 11 additions & 11 deletions internal/controller/drplacementcontrol_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -1275,7 +1275,7 @@ func (r *DRPlacementControlReconciler) updateDRPCStatus(
) error {
log.Info("Updating DRPC status")

r.updateResourceCondition(ctx, drpc, userPlacement)
r.updateResourceCondition(ctx, drpc, userPlacement, log)

// set metrics if DRPC is not being deleted and if finalizer exists
if !isBeingDeleted(drpc, userPlacement) && controllerutil.ContainsFinalizer(drpc, DRPCFinalizer) {
Expand Down Expand Up @@ -1317,18 +1317,18 @@ func (r *DRPlacementControlReconciler) updateDRPCStatus(
//
//nolint:funlen
func (r *DRPlacementControlReconciler) updateResourceCondition(
ctx context.Context, drpc *rmn.DRPlacementControl, userPlacement client.Object,
ctx context.Context, drpc *rmn.DRPlacementControl, userPlacement client.Object, log logr.Logger,
) {
vrgNamespace, err := selectVRGNamespace(r.Client, r.Log, drpc, userPlacement)
vrgNamespace, err := selectVRGNamespace(r.Client, log, drpc, userPlacement)
if err != nil {
r.Log.Info("Failed to select VRG namespace", "error", err)
log.Info("Failed to select VRG namespace", "error", err)

return
}

clusterName := r.clusterForVRGStatus(drpc, userPlacement, r.Log)
clusterName := r.clusterForVRGStatus(drpc, userPlacement, log)
if clusterName == "" {
r.Log.Info("Unable to determine managed cluster from which to inspect VRG, " +
log.Info("Unable to determine managed cluster from which to inspect VRG, " +
"skipping processing ResourceConditions")

return
Expand All @@ -1341,14 +1341,14 @@ func (r *DRPlacementControlReconciler) updateResourceCondition(
vrg, err := r.MCVGetter.GetVRGFromManagedCluster(drpc.Name, vrgNamespace,
clusterName, annotations)
if err != nil {
r.Log.Info("Failed to get VRG from managed cluster. Trying s3 store...", "errMsg", err.Error())
log.Info("Failed to get VRG from managed cluster. Trying s3 store...", "errMsg", err.Error())

// The VRG from the s3 store might be stale, however, the worst case should be at most around 1 minute.
vrg = GetLastKnownVRGPrimaryFromS3(ctx, r.APIReader,
GetAvailableS3Profiles(ctx, r.Client, drpc, r.Log),
drpc.GetName(), vrgNamespace, r.ObjStoreGetter, r.Log)
GetAvailableS3Profiles(ctx, r.Client, drpc, log),
drpc.GetName(), vrgNamespace, r.ObjStoreGetter, log)
if vrg == nil {
r.Log.Info("Failed to get VRG from s3 store")
log.Info("Failed to get VRG from s3 store")

drpc.Status.ResourceConditions = rmn.VRGConditions{}

Expand All @@ -1358,7 +1358,7 @@ func (r *DRPlacementControlReconciler) updateResourceCondition(
}

if vrg.ResourceVersion < drpc.Status.ResourceConditions.ResourceMeta.ResourceVersion {
r.Log.Info("VRG resourceVersion is lower than the previously recorded VRG's resourceVersion in DRPC")
log.Info("VRG resourceVersion is lower than the previously recorded VRG's resourceVersion in DRPC")
// if the VRG resourceVersion is less, then leave the DRPC ResourceConditions.ResourceMeta.ResourceVersion as is.
return
}
Expand Down