Wait for available API token in a new namespace (#7045)
Just after creating a namespace, the corresponding token could not be created and sometimes the pod creation might be failed. This adds check of the token in the new namespace to make this test case stable.
This commit is contained in:
parent
9a05037352
commit
275c54e810
1 changed files with 10 additions and 0 deletions
|
@ -43,6 +43,16 @@
|
||||||
command: "{{ bin_dir }}/kubectl create namespace test"
|
command: "{{ bin_dir }}/kubectl create namespace test"
|
||||||
changed_when: false
|
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.find('<none>') == -1
|
||||||
|
retries: 5
|
||||||
|
delay: 5
|
||||||
|
|
||||||
- name: Run 2 busybox pods in test ns
|
- name: Run 2 busybox pods in test ns
|
||||||
command: "{{ bin_dir }}/kubectl run {{ item }} --image={{ test_image_repo }}:{{ test_image_tag }} --namespace test --command -- tail -f /dev/null"
|
command: "{{ bin_dir }}/kubectl run {{ item }} --image={{ test_image_repo }}:{{ test_image_tag }} --namespace test --command -- tail -f /dev/null"
|
||||||
changed_when: false
|
changed_when: false
|
||||||
|
|
Loading…
Reference in a new issue