From 57406ed0b523a571c6b17c59766f17b22cf6cbcd Mon Sep 17 00:00:00 2001 From: Tobias Klauser Date: Thu, 27 Apr 2023 16:48:51 +0200 Subject: [PATCH] sysdump: replace deprecated methods Use k8s.io/apimachinery/pkg/util/wait.PollUntilContextTimeout instead of .PollWithContext. The latter is deprecated in favor of the former. Signed-off-by: Tobias Klauser --- sysdump/k8sutils.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sysdump/k8sutils.go b/sysdump/k8sutils.go index 20367dd5c2..0ad1213a86 100644 --- a/sysdump/k8sutils.go +++ b/sysdump/k8sutils.go @@ -69,7 +69,7 @@ func (c *Collector) ensureExecTarget(ctx context.Context, pod *corev1.Pod, conta c.logDebug("Created EphemeralContainer %q on pod %q in namespace %q", ec.Name, pod.Name, pod.Namespace) // Ephemeral container created, wait for it to enter Running status. - err = wait.PollWithContext(ctx, 10*time.Second, 30*time.Second, func(ctx context.Context) (bool, error) { + err = wait.PollUntilContextTimeout(ctx, 10*time.Second, 30*time.Second, false, func(ctx context.Context) (bool, error) { var err error targetPod, err = c.Client.GetPod(ctx, targetPod.Namespace, targetPod.Name, metav1.GetOptions{}) if err != nil { @@ -141,7 +141,7 @@ func (c *Collector) ensureExecTarget(ctx context.Context, pod *corev1.Pod, conta } // Wait up to 2 minutes for pod to be available - err = wait.PollWithContext(ctx, 10*time.Second, 2*time.Minute, func(ctx context.Context) (bool, error) { + err = wait.PollUntilContextTimeout(ctx, 10*time.Second, 2*time.Minute, false, func(ctx context.Context) (bool, error) { var err error targetPod, err = c.Client.GetPod(ctx, targetPod.Namespace, targetPod.Name, metav1.GetOptions{}) if err != nil {