Skip to content

Commit

Permalink
sysdump: replace deprecated methods
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
tklauser committed May 3, 2023
1 parent 40647c6 commit e1d57b3
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions sysdump/k8sutils.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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 {
Expand Down

0 comments on commit e1d57b3

Please sign in to comment.