rebase: replace deprecated PollImmediate() with `PollUntilContextTimeout()

Kubernetes 1.27 deprecates `PollImmediate()`, and golangci-lint
complains about the usage of the deprecated function.

Signed-off-by: Niels de Vos <ndevos@ibm.com>
This commit is contained in:
Niels de Vos
2023-06-05 14:01:31 +02:00
committed by mergify[bot]
parent e6627198d4
commit 2884b0dde7
11 changed files with 67 additions and 57 deletions

View File

@ -43,7 +43,7 @@ func createNamespace(c kubernetes.Interface, name string) error {
return fmt.Errorf("failed to create namespace: %w", err)
}
return wait.PollImmediate(poll, timeout, func() (bool, error) {
return wait.PollUntilContextTimeout(context.TODO(), poll, timeout, true, func(_ context.Context) (bool, error) {
_, err := c.CoreV1().Namespaces().Get(context.TODO(), name, metav1.GetOptions{})
if err != nil {
framework.Logf("Error getting namespace: '%s': %v", name, err)
@ -68,7 +68,7 @@ func deleteNamespace(c kubernetes.Interface, name string) error {
return fmt.Errorf("failed to delete namespace: %w", err)
}
return wait.PollImmediate(poll, timeout, func() (bool, error) {
return wait.PollUntilContextTimeout(context.TODO(), poll, timeout, true, func(_ context.Context) (bool, error) {
_, err = c.CoreV1().Namespaces().Get(context.TODO(), name, metav1.GetOptions{})
if err != nil {
if apierrs.IsNotFound(err) {