Ian Wienand 64a60ea377
ensure-kubernetes: move testing into common path
Currently we start a test pod for cri-o, but not for docker.  Move
this into post so both get coverage.

Change-Id: I768130982e22cb50e360646043ac095d77cca963
2022-11-08 08:26:36 +11:00

43 lines
1.1 KiB
YAML

- hosts: all
name: Post testing
tasks:
# 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
- hosts: all
roles:
- collect-container-logs
- collect-kubernetes-logs
tasks:
- name: Get minikube logs
become: true
shell: "/tmp/minikube logs > {{ ansible_user_dir }}/zuul-output/logs/minikube.txt"
environment:
MINIKUBE_HOME: "{{ ansible_user_dir }}"