From 2ba28a33893322a9ba694a560691dabe9dc1806e Mon Sep 17 00:00:00 2001
From: Max Gautier <mg@max.gautier.name>
Date: Fri, 25 Oct 2024 14:57:25 +0200
Subject: [PATCH] Revert "Wait for available API token in a new namespace
 (#7045)"

This reverts commit 275c54e81051ff73a0b5556717b38d5677f2b0b9.

Static tokens are no longer created automatically for service account in
Kubernetes. Instead, they are dynamically injected into pods using a
projected volume.

Thus there is no longer a need to check for this (it didn't work anyway,
since the describe output actually contains <none> when there is no
tokens:
{
  "attempts": 1,
  "changed": false,
  "cmd": "set -o pipefail && /usr/local/bin/kubectl describe serviceaccounts default --namespace test | grep Tokens | awk '{print $2}'",
  "delta": "0:00:00.075633",
  "end": "2024-10-19 14:25:04.858871",
  "msg": "",
  "rc": 0,
  "start": "2024-10-19 14:25:04.783238",
  "stderr": "",
  "stderr_lines": [],
  "stdout": "<none>",
  "stdout_lines": [
    "<none>"
  ]
}
)
---
 tests/testcases/030_check-network.yml | 10 ----------
 1 file changed, 10 deletions(-)

diff --git a/tests/testcases/030_check-network.yml b/tests/testcases/030_check-network.yml
index e13128dd9..bdb3c53bb 100644
--- a/tests/testcases/030_check-network.yml
+++ b/tests/testcases/030_check-network.yml
@@ -75,16 +75,6 @@
     command: "{{ bin_dir }}/kubectl create namespace test"
     changed_when: false
 
-  - name: Wait for API token of test namespace
-    shell: "set -o pipefail && {{ bin_dir }}/kubectl describe serviceaccounts default --namespace test | grep Tokens | awk '{print $2}'"
-    args:
-      executable: /bin/bash
-    changed_when: false
-    register: default_token
-    until: default_token.stdout | length > 0
-    retries: 5
-    delay: 5
-
   - name: Run 2 agnhost pods in test ns
     shell:
       cmd: |
-- 
GitLab