kube-controller-manager: finish conversion to contextual logging
This removes all exceptions and fixes the remaining unconverted log calls.
This commit is contained in:
@@ -272,7 +272,7 @@ func (dsc *DaemonSetsController) deleteDaemonset(logger klog.Logger, obj interfa
|
||||
}
|
||||
|
||||
// Delete expectations for the DaemonSet so if we create a new one with the same name it starts clean
|
||||
dsc.expectations.DeleteExpectations(key)
|
||||
dsc.expectations.DeleteExpectations(logger, key)
|
||||
|
||||
dsc.queue.Add(key)
|
||||
}
|
||||
@@ -518,7 +518,7 @@ func (dsc *DaemonSetsController) addPod(logger klog.Logger, obj interface{}) {
|
||||
return
|
||||
}
|
||||
logger.V(4).Info("Pod added", "pod", klog.KObj(pod))
|
||||
dsc.expectations.CreationObserved(dsKey)
|
||||
dsc.expectations.CreationObserved(logger, dsKey)
|
||||
dsc.enqueueDaemonSet(ds)
|
||||
return
|
||||
}
|
||||
@@ -635,7 +635,7 @@ func (dsc *DaemonSetsController) deletePod(logger klog.Logger, obj interface{})
|
||||
return
|
||||
}
|
||||
logger.V(4).Info("Pod deleted", "pod", klog.KObj(pod))
|
||||
dsc.expectations.DeletionObserved(dsKey)
|
||||
dsc.expectations.DeletionObserved(logger, dsKey)
|
||||
dsc.enqueueDaemonSet(ds)
|
||||
}
|
||||
|
||||
@@ -934,7 +934,7 @@ func (dsc *DaemonSetsController) updateDaemonSet(ctx context.Context, ds *apps.D
|
||||
}
|
||||
|
||||
// Process rolling updates if we're ready.
|
||||
if dsc.expectations.SatisfiedExpectations(key) {
|
||||
if dsc.expectations.SatisfiedExpectations(klog.FromContext(ctx), key) {
|
||||
switch ds.Spec.UpdateStrategy.Type {
|
||||
case apps.OnDeleteDaemonSetStrategyType:
|
||||
case apps.RollingUpdateDaemonSetStrategyType:
|
||||
@@ -1008,7 +1008,7 @@ func (dsc *DaemonSetsController) syncNodes(ctx context.Context, ds *apps.DaemonS
|
||||
deleteDiff = dsc.burstReplicas
|
||||
}
|
||||
|
||||
dsc.expectations.SetExpectations(dsKey, createDiff, deleteDiff)
|
||||
dsc.expectations.SetExpectations(logger, dsKey, createDiff, deleteDiff)
|
||||
|
||||
// error channel to communicate back failures. make the buffer big enough to avoid any blocking
|
||||
errCh := make(chan error, createDiff+deleteDiff)
|
||||
@@ -1057,7 +1057,7 @@ func (dsc *DaemonSetsController) syncNodes(ctx context.Context, ds *apps.DaemonS
|
||||
}
|
||||
if err != nil {
|
||||
logger.V(2).Info("Failed creation, decrementing expectations for daemon set", "daemonset", klog.KObj(ds))
|
||||
dsc.expectations.CreationObserved(dsKey)
|
||||
dsc.expectations.CreationObserved(logger, dsKey)
|
||||
errCh <- err
|
||||
utilruntime.HandleError(err)
|
||||
}
|
||||
@@ -1068,7 +1068,7 @@ func (dsc *DaemonSetsController) syncNodes(ctx context.Context, ds *apps.DaemonS
|
||||
skippedPods := createDiff - (batchSize + pos)
|
||||
if errorCount < len(errCh) && skippedPods > 0 {
|
||||
logger.V(2).Info("Slow-start failure. Skipping creation pods, decrementing expectations for daemon set", "skippedPods", skippedPods, "daemonset", klog.KObj(ds))
|
||||
dsc.expectations.LowerExpectations(dsKey, skippedPods, 0)
|
||||
dsc.expectations.LowerExpectations(logger, dsKey, skippedPods, 0)
|
||||
// The skipped pods will be retried later. The next controller resync will
|
||||
// retry the slow start process.
|
||||
break
|
||||
@@ -1082,7 +1082,7 @@ func (dsc *DaemonSetsController) syncNodes(ctx context.Context, ds *apps.DaemonS
|
||||
go func(ix int) {
|
||||
defer deleteWait.Done()
|
||||
if err := dsc.podControl.DeletePod(ctx, ds.Namespace, podsToDelete[ix], ds); err != nil {
|
||||
dsc.expectations.DeletionObserved(dsKey)
|
||||
dsc.expectations.DeletionObserved(logger, dsKey)
|
||||
if !apierrors.IsNotFound(err) {
|
||||
logger.V(2).Info("Failed deletion, decremented expectations for daemon set", "daemonset", klog.KObj(ds))
|
||||
errCh <- err
|
||||
@@ -1232,7 +1232,7 @@ func (dsc *DaemonSetsController) syncDaemonSet(ctx context.Context, key string)
|
||||
ds, err := dsc.dsLister.DaemonSets(namespace).Get(name)
|
||||
if apierrors.IsNotFound(err) {
|
||||
logger.V(3).Info("Daemon set has been deleted", "daemonset", key)
|
||||
dsc.expectations.DeleteExpectations(key)
|
||||
dsc.expectations.DeleteExpectations(logger, key)
|
||||
return nil
|
||||
}
|
||||
if err != nil {
|
||||
@@ -1277,7 +1277,7 @@ func (dsc *DaemonSetsController) syncDaemonSet(ctx context.Context, key string)
|
||||
}
|
||||
hash := cur.Labels[apps.DefaultDaemonSetUniqueLabelKey]
|
||||
|
||||
if !dsc.expectations.SatisfiedExpectations(dsKey) {
|
||||
if !dsc.expectations.SatisfiedExpectations(logger, dsKey) {
|
||||
// Only update status. Don't raise observedGeneration since controller didn't process object of that generation.
|
||||
return dsc.updateDaemonSetStatus(ctx, ds, nodeList, hash, false)
|
||||
}
|
||||
|
Reference in New Issue
Block a user