mirror of
https://github.com/k3s-io/kubernetes.git
synced 2026-07-17 20:00:07 +00:00
kubectl: remove context.TODO from daemonSetFilter
Replace the context.TODO with getContext to prefer the Helper's context when it is set. This is consistent with the rest of the package now. Since contextual logging or timeouts may be included as part of the Helper's context, using context.TODO will silently ignore these features, producing unexpected behaviors. Signed-off-by: Kirsten Laskoski <klaskosk@redhat.com>
This commit is contained in:
@@ -17,7 +17,6 @@ limitations under the License.
|
||||
package drain
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"strings"
|
||||
"time"
|
||||
@@ -193,7 +192,7 @@ func (d *Helper) daemonSetFilter(pod corev1.Pod) PodDeleteStatus {
|
||||
return MakePodDeleteStatusOkay()
|
||||
}
|
||||
|
||||
if _, err := d.Client.AppsV1().DaemonSets(pod.Namespace).Get(context.TODO(), controllerRef.Name, metav1.GetOptions{}); err != nil {
|
||||
if _, err := d.Client.AppsV1().DaemonSets(pod.Namespace).Get(d.getContext(), controllerRef.Name, metav1.GetOptions{}); err != nil {
|
||||
// remove orphaned pods with a warning if --force is used
|
||||
if apierrors.IsNotFound(err) && d.Force {
|
||||
return MakePodDeleteStatusWithWarning(true, err.Error())
|
||||
|
||||
Reference in New Issue
Block a user