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

Update logging to debug to reduce spew #3070

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion pkg/common/cns-lib/vsphere/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -455,7 +455,7 @@ func GetCandidateDatastoresInCluster(ctx context.Context, vc *VirtualCenter, clu
if len(sharedDatastores) == 0 && len(vsanDirectDatastores) == 0 {
return nil, nil, fmt.Errorf("no candidates datastores found in the Kubernetes cluster")
}
log.Infof("Found shared datastores: %+v and vSAN Direct datastores: %+v", sharedDatastores,
log.Debugf("Found shared datastores: %+v and vSAN Direct datastores: %+v", sharedDatastores,
vsanDirectDatastores)
return sharedDatastores, vsanDirectDatastores, nil
}
Expand Down
18 changes: 9 additions & 9 deletions pkg/kubernetes/kubernetes.go
Original file line number Diff line number Diff line change
Expand Up @@ -72,14 +72,14 @@ func GetKubeConfig(ctx context.Context) (*restclient.Config, error) {
var err error
kubecfgPath := getKubeConfigPath(ctx)
if kubecfgPath != "" {
log.Infof("k8s client using kubeconfig from %s", kubecfgPath)
log.Debugf("k8s client using kubeconfig from %s", kubecfgPath)
config, err = clientcmd.BuildConfigFromFlags("", kubecfgPath)
if err != nil {
log.Errorf("BuildConfigFromFlags failed %v", err)
return nil, err
}
} else {
log.Info("k8s client using in-cluster config")
log.Debug("k8s client using in-cluster config")
config, err = restclient.InClusterConfig()
if err != nil {
log.Errorf("InClusterConfig failed %v", err)
Expand All @@ -102,24 +102,24 @@ func getKubeConfigPath(ctx context.Context) string {
flagValue := kubecfgFlag.Value.String()
if flagValue != "" {
kubecfgPath = flagValue
log.Infof("Kubeconfig path obtained from kubeconfig flag: %q", kubecfgPath)
log.Debugf("Kubeconfig path obtained from kubeconfig flag: %q", kubecfgPath)
} else {
log.Info("Kubeconfig flag is set but empty, checking environment variable value")
log.Debug("Kubeconfig flag is set but empty, checking environment variable value")
}
} else {
log.Info("Kubeconfig flag not set, checking environment variable value")
log.Debug("Kubeconfig flag not set, checking environment variable value")
}
if kubecfgPath == "" {
// Get the Kubeconfig path from the environment variable
kubecfgPath = os.Getenv(clientcmd.RecommendedConfigPathEnvVar)
log.Infof("Kubeconfig path obtained from environment variable %q: %q",
log.Debugf("Kubeconfig path obtained from environment variable %q: %q",
clientcmd.RecommendedConfigPathEnvVar, kubecfgPath)
}
// Final logging of the Kubeconfig path used
if kubecfgPath == "" {
log.Info("No Kubeconfig path found, either from environment variable or flag")
log.Debug("No Kubeconfig path found, either from environment variable or flag")
} else {
log.Infof("Final Kubeconfig path used: %q", kubecfgPath)
log.Debugf("Final Kubeconfig path used: %q", kubecfgPath)
}
return kubecfgPath
}
Expand Down Expand Up @@ -431,7 +431,7 @@ func getClientThroughput(ctx context.Context, isSupervisorClient bool) (float32,
burst = value
}
}
log.Infof("Setting client QPS to %f and Burst to %d.", qps, burst)
log.Debugf("Setting client QPS to %f and Burst to %d.", qps, burst)
return qps, burst
}

Expand Down
14 changes: 9 additions & 5 deletions pkg/syncer/fullsync.go
Original file line number Diff line number Diff line change
Expand Up @@ -779,20 +779,24 @@ func validateAndCorrectVolumeInfoSnapshotDetails(ctx context.Context,
continue
}
if cnsVol, ok := cnsVolumeMap[cnsvolumeinfo.Spec.VolumeID]; ok {
log.Infof("validate volume info for storage details for volume %s", cnsVol.VolumeId.Id)
log.Debugf("validate volume info for storage details for volume %s", cnsVol.VolumeId.Id)
var aggregatedSnapshotCapacity int64
if cnsVol.BackingObjectDetails != nil &&
cnsVol.BackingObjectDetails.(*cnstypes.CnsBlockBackingDetails) != nil {
val, ok := cnsVol.BackingObjectDetails.(*cnstypes.CnsBlockBackingDetails)
if ok {
aggregatedSnapshotCapacity = val.AggregatedSnapshotCapacityInMb
}
log.Infof("Received aggregatedSnapshotCapacity %d for volume %q",
aggregatedSnapshotCapacity, cnsVol.VolumeId.Id)
if aggregatedSnapshotCapacity > 0 {
log.Infof("Received aggregatedSnapshotCapacity %d for volume %q",
aggregatedSnapshotCapacity, cnsVol.VolumeId.Id)
}
if cnsvolumeinfo.Spec.AggregatedSnapshotSize == nil || aggregatedSnapshotCapacity !=
cnsvolumeinfo.Spec.AggregatedSnapshotSize.Value() {
// use current time as snapshot completion time is not available in fullsync.
log.Infof("Update aggregatedSnapshotCapacity for volume %q", cnsVol.VolumeId.Id)
log.Infof("Update aggregatedSnapshotCapacity for volume %q from %d to %d",
cnsVol.VolumeId.Id, cnsvolumeinfo.Spec.AggregatedSnapshotSize.Value(),
aggregatedSnapshotCapacity)
currentTime := time.Now()
cnsSnapInfo := &volumes.CnsSnapshotInfo{
SourceVolumeID: cnsvolumeinfo.Spec.VolumeID,
Expand Down Expand Up @@ -1214,7 +1218,7 @@ func fullSyncGetVolumeSpecs(ctx context.Context, vCenterVersion string, pvList [
log.Infof("FullSync for VC %s: update is required for volume: %q", vc, volumeHandle)
operationType = "updateVolume"
} else {
log.Infof("FullSync for VC %s: update is not required for volume: %q", vc, volumeHandle)
log.Debugf("FullSync for VC %s: update is not required for volume: %q", vc, volumeHandle)
}
}
switch operationType {
Expand Down
6 changes: 3 additions & 3 deletions pkg/syncer/storagepool/intended_state.go
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@ func isRemoteVsan(ctx context.Context, dsprops *dsProps,
return false, nil
}

log.Infof("vSAN Datastore %s is remote to this cluster", dsprops.dsName)
log.Debugf("vSAN Datastore %s is remote to this cluster", dsprops.dsName)
return true, nil
}

Expand All @@ -228,7 +228,7 @@ func newIntendedVsanSNAState(ctx context.Context, scWatchCntlr *StorageClassWatc
nodes := make([]string, 0)
nodes = append(nodes, node)

log.Infof("creating vsan sna sp %q", node)
log.Debugf("creating vsan sna sp %q", node)
compatSC := make([]string, 0)
for _, scName := range vsan.compatSC {
if scWatchCntlr.isHostLocal(scName) {
Expand Down Expand Up @@ -356,7 +356,7 @@ func (c *SpController) applyIntendedState(ctx context.Context, state *intendedSt
} else {
// StoragePool already exists, so Update it. We don't expect
// ConflictErrors since updates are synchronized with a lock.
log.Infof("Updating StoragePool instance for %s", state.spName)
log.Debugf("Updating StoragePool instance for %s", state.spName)
sp := state.updateUnstructuredStoragePool(ctx, sp)
newSp, err := spClient.Resource(*spResource).Update(ctx, sp, metav1.UpdateOptions{})
if err != nil {
Expand Down
2 changes: 1 addition & 1 deletion pkg/syncer/storagepool/listener.go
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ func initListener(ctx context.Context, scWatchCntlr *StorageClassWatch,
err := property.WaitForUpdatesEx(ctx, p, filter, func(updates []types.ObjectUpdate) bool {
ctx := logger.NewContextWithLogger(ctx)
log = logger.GetLogger(ctx)
log.Infof("Got %d property collector update(s)", len(updates))
log.Debugf("Got %d property collector update(s)", len(updates))
reconcileAllScheduled := false
for _, update := range updates {
propChange := update.ChangeSet
Expand Down
2 changes: 1 addition & 1 deletion pkg/syncer/storagepool/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ func getDatastoreProperties(ctx context.Context, d *cnsvsphere.DatastoreInfo) *d
freeSpace: resource.NewQuantity(ds.Summary.FreeSpace, resource.DecimalSI),
}

log.Infof("Datastore %s properties: %v", d.Info.Name, p)
log.Debugf("Datastore %s properties: %v", d.Info.Name, p)
return &p
}

Expand Down