zuul-jobs/test-playbooks/ensure-kubernetes/crio.yaml
Ian Wienand 4d2c441f40 ensure-kubernetes: workaround slow account creation
Per the referenced link, account creation can be slow and that's just
the way it is.  This should help tests that fail with

  Error from server (Forbidden): error when creating "test-pod.yaml":
  pods "test" is forbidden: error looking up service account
  default/default: serviceaccount "default" not found

Change-Id: I405aa7e58737c7061a471da2e2807c77756c76b8
2020-09-17 13:04:54 +10:00

44 lines
1.1 KiB
YAML

- hosts: all
name: Install kubernetes with minikube
roles:
- role: ensure-kubernetes
vars:
minikube_dns_resolvers:
- '1.1.1.1'
- '8.8.8.8'
kubernetes_runtime: cri-o
post_tasks:
- name: Check crio version
command: crictl version
become: yes
failed_when: false
# The default account is known to take a while to appear; see
# https://github.com/kubernetes/kubernetes/issues/66689
- name: Ensure default account created
command: kubectl -n default get serviceaccount default -o name
retries: 5
delay: 5
register: result
until: result.rc == 0
- name: Create a test pod definition
copy:
dest: test-pod.yaml
content: |
apiVersion: v1
kind: Pod
metadata:
name: test
spec:
restartPolicy: Never
containers:
- name: test
image: k8s.gcr.io/pause:3.1
- name: Start pod
command: kubectl apply -f test-pod.yaml
- name: Check status
shell: sleep 5; kubectl get pods