Skip to content

Commit

Permalink
chore: reduce workflow logging verbosity
Browse files Browse the repository at this point in the history
  • Loading branch information
edreed committed Nov 7, 2022
1 parent c06138d commit 7efd42c
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 13 deletions.
4 changes: 2 additions & 2 deletions pkg/azureutils/azure_disk_utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -1132,7 +1132,7 @@ func UpdateCRIWithRetry(ctx context.Context, informerFactory azdiskinformers.Sha
// if updateFunc doesn't change the object, don't bother making an update request
if reflect.DeepEqual(originalObj, copyForUpdate) {
updatedObj = copyForUpdate
w.Logger().Info("Skip update. No update needed.")
w.Logger().V(5).Info("Skip update. No update needed.")
return nil
}

Expand Down Expand Up @@ -1176,7 +1176,7 @@ func UpdateCRIWithRetry(ctx context.Context, informerFactory azdiskinformers.Sha
}

if updatedObj == nil {
w.Logger().Info("No update applied - returning original object.")
w.Logger().V(5).Info("No update applied - returning original object.")
updatedObj = originalObj.DeepCopyObject().(client.Object)
}

Expand Down
6 changes: 3 additions & 3 deletions pkg/controller/attach_detach.go
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ func (r *ReconcileAttachDetach) triggerAttach(ctx context.Context, azVolumeAttac
}
azVolumeAttachment = updatedObj.(*azdiskv1beta2.AzVolumeAttachment)

w.Logger().Info("Attaching volume")
w.Logger().V(5).Info("Attaching volume")
waitCh := make(chan goSignal)
//nolint:contextcheck // call is asynchronous; context is not inherited by design
go func() {
Expand Down Expand Up @@ -415,7 +415,7 @@ func (r *ReconcileAttachDetach) demote(ctx context.Context, azVolumeAttachment *
ctx, w := workflow.New(ctx)
defer func() { w.Finish(err) }()

w.Logger().Info("Demoting AzVolumeAttachment")
w.Logger().V(5).Info("Demoting AzVolumeAttachment")
// initialize metadata and update status block
updateFunc := func(obj client.Object) error {
azv := obj.(*azdiskv1beta2.AzVolumeAttachment)
Expand Down Expand Up @@ -484,7 +484,7 @@ func (r *ReconcileAttachDetach) Recover(ctx context.Context) error {
ctx, w := workflow.New(ctx)
defer func() { w.Finish(err) }()

w.Logger().Info("Recovering AzVolumeAttachment CRIs...")
w.Logger().V(5).Info("Recovering AzVolumeAttachment CRIs...")
// try to recreate missing AzVolumeAttachment CRI
var syncedVolumeAttachments, volumesToSync map[string]bool

Expand Down
6 changes: 3 additions & 3 deletions pkg/controller/azvolume.go
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ func (r *ReconcileAzVolume) triggerCreate(ctx context.Context, azVolume *azdiskv
}
azVolume = updatedObj.(*azdiskv1beta2.AzVolume)

w.Logger().Info("Creating Volume...")
w.Logger().V(5).Info("Creating Volume...")
waitCh := make(chan goSignal)
// create volume
//nolint:contextcheck // call is asynchronous; context is not inherited by design
Expand Down Expand Up @@ -248,7 +248,7 @@ func (r *ReconcileAzVolume) triggerDelete(ctx context.Context, azVolume *azdiskv
azVolume = updatedObj.(*azdiskv1beta2.AzVolume)

if volumeDeleteRequested {
w.Logger().Info("Deleting Volume...")
w.Logger().V(5).Info("Deleting Volume...")
}

waitCh := make(chan goSignal)
Expand Down Expand Up @@ -607,7 +607,7 @@ func (r *ReconcileAzVolume) Recover(ctx context.Context) error {
defer func() { w.Finish(err) }()

// recover CRI if possible
w.Logger().Info("Recovering AzVolume CRIs...")
w.Logger().V(5).Info("Recovering AzVolume CRIs...")
if err = r.recreateAzVolumes(ctx); err != nil {
w.Logger().Error(err, "failed to recreate missing AzVolume CRI")
}
Expand Down
2 changes: 1 addition & 1 deletion pkg/controller/shared_state.go
Original file line number Diff line number Diff line change
Expand Up @@ -1099,7 +1099,7 @@ func (c *SharedState) manageReplicas(ctx context.Context, volumeName string) err
var azVolume *azdiskv1beta2.AzVolume
azVolume, err = azureutils.GetAzVolume(ctx, c.cachedClient, c.azClient, volumeName, c.objectNamespace, true)
if apiErrors.IsNotFound(err) {
w.Logger().Info("Volume no longer exists. Aborting manage replica operation")
w.Logger().V(5).Info("Volume no longer exists. Aborting manage replica operation")
return nil
} else if err != nil {
w.Logger().Error(err, "failed to get AzVolume")
Expand Down
8 changes: 4 additions & 4 deletions pkg/provisioner/crdprovisioner.go
Original file line number Diff line number Diff line change
Expand Up @@ -321,7 +321,7 @@ func (c *CrdProvisioner) CreateVolume(
}
// if volume creation was unsuccessful, delete the AzVolume CRI and return error
go func() {
w.Logger().Info("Deleting volume due to failed volume creation")
w.Logger().V(5).Info("Deleting volume due to failed volume creation")
conditionFunc := func() (bool, error) {
if err := azVolumeClient.Delete(context.Background(), azVolumeName, metav1.DeleteOptions{}); err != nil && !apiErrors.IsNotFound(err) {
w.Logger().Error(err, "failed to make a delete request for AzVolume CRI")
Expand Down Expand Up @@ -369,7 +369,7 @@ func (c *CrdProvisioner) DeleteVolume(ctx context.Context, volumeID string, secr

if err != nil {
if apiErrors.IsNotFound(err) {
w.Logger().Logger.WithValues(consts.VolumeNameLabel, volumeName).Info("Deletion successful: could not find the AzVolume CRI")
w.Logger().Logger.WithValues(consts.VolumeNameLabel, volumeName).V(5).Info("Deletion successful: could not find the AzVolume CRI")
return nil
}
w.Logger().Logger.WithValues(consts.VolumeNameLabel, volumeName).Error(err, "failed to get AzVolume CRI")
Expand All @@ -378,7 +378,7 @@ func (c *CrdProvisioner) DeleteVolume(ctx context.Context, volumeID string, secr

// we don't want to delete pre-provisioned volumes
if azureutils.MapContains(azVolumeInstance.Status.Annotations, consts.PreProvisionedVolumeAnnotation) {
w.Logger().Info("AzVolume is pre-provisioned and won't be deleted.")
w.Logger().V(5).Info("AzVolume is pre-provisioned and won't be deleted.")
return nil
}

Expand Down Expand Up @@ -838,7 +838,7 @@ func (c *CrdProvisioner) UnpublishVolume(

if err != nil {
if apiErrors.IsNotFound(err) {
w.Logger().WithValues(consts.VolumeNameLabel, volumeName, consts.NodeNameLabel, nodeID).Info("Volume detach successful")
w.Logger().WithValues(consts.VolumeNameLabel, volumeName, consts.NodeNameLabel, nodeID).V(5).Info("Volume detach successful")
err = nil
return nil
}
Expand Down

0 comments on commit 7efd42c

Please sign in to comment.