diff --git a/roles/use-buildset-registry/tasks/main.yaml b/roles/use-buildset-registry/tasks/main.yaml index e8e663be2..7e592ac0c 100644 --- a/roles/use-buildset-registry/tasks/main.yaml +++ b/roles/use-buildset-registry/tasks/main.yaml @@ -105,3 +105,15 @@ when: buildset_registry_docker_user is not defined block: - include_tasks: user-config.yaml + +- name: Check if cri-o is installed + stat: + path: /etc/crio/crio.conf + register: crio_path +# TODO: with cri-o >= 1.16, change this to a SIGHUP of the crio process +- name: Restart cri-o + when: crio_path.stat.exists + service: + name: crio + state: restarted + become: true diff --git a/test-playbooks/registry/buildset-registry-k8s-crio-post.yaml b/test-playbooks/registry/buildset-registry-k8s-crio-post.yaml new file mode 100644 index 000000000..9bae71f20 --- /dev/null +++ b/test-playbooks/registry/buildset-registry-k8s-crio-post.yaml @@ -0,0 +1,8 @@ +- hosts: all + tasks: + - name: Describe dockertest pod + command: kubectl describe pod/quaytest + ignore_errors: true + - name: Describe upstream-dockertest pod + command: kubectl describe pod/upstream-dockertest + ignore_errors: true diff --git a/test-playbooks/registry/buildset-registry-k8s-crio.yaml b/test-playbooks/registry/buildset-registry-k8s-crio.yaml new file mode 100644 index 000000000..ca2db66a7 --- /dev/null +++ b/test-playbooks/registry/buildset-registry-k8s-crio.yaml @@ -0,0 +1,31 @@ +- hosts: all + roles: + - role: clear-firewall + - role: install-kubernetes + vars: + minikube_dns_resolvers: + - '1.1.1.1' + - '8.8.8.8' + kubernetes_runtime: cri-o + - role: use-buildset-registry + buildset_registry_docker_user: root + tasks: + - name: Wait for cluster to come up + command: kubectl cluster-info + register: result + until: result.rc == 0 + retries: 5 + delay: 30 + - name: Run a local test pod + command: kubectl run --generator=run-pod/v1 --image=quay.io/zuul/quay-testimage quaytest + - name: Wait for the pod to be ready + command: kubectl wait --for=condition=Ready pod/quaytest --timeout=60s + - name: Check the output of the pod + shell: "kubectl logs pod/quaytest | grep 'Zuul container test'" + + - name: Run a remote test pod + command: kubectl run --generator=run-pod/v1 --image=debian:testing upstream-dockertest --command -- /bin/bash -c 'echo Upstream; sleep infinity' + - name: Wait for the pod to be ready + command: kubectl wait --for=condition=Ready pod/upstream-dockertest --timeout=60s + - name: Check the output of the pod + shell: "kubectl logs pod/upstream-dockertest | grep 'Upstream'" diff --git a/zuul-tests.d/container-roles-jobs.yaml b/zuul-tests.d/container-roles-jobs.yaml index 2922ea23e..28f54ae69 100644 --- a/zuul-tests.d/container-roles-jobs.yaml +++ b/zuul-tests.d/container-roles-jobs.yaml @@ -111,6 +111,30 @@ vars: container_command: docker +- job: + name: zuul-jobs-test-registry-buildset-registry-k8s-crio + dependencies: zuul-jobs-test-registry-buildset-registry + description: | + Test a buildset registry with kubernetes and CRIO + + It is not meant to be used directly but rather run on changes + to roles in the zuul-jobs repo. + files: + - roles/pull-from-intermediate-registry/.* + - roles/push-to-intermediate-registry/.* + - roles/install-docker/.* + - roles/install-kubernetes/.* + - roles/build-docker-image/.* + - roles/run-buildset-registry/.* + - roles/use-buildset-registry/.* + - test-playbooks/registry/.* + run: test-playbooks/registry/buildset-registry-k8s-crio.yaml + post-run: + - test-playbooks/registry/buildset-registry-k8s-crio-post.yaml + - test-playbooks/registry/test-registry-post.yaml + vars: + container_command: podman + - job: name: zuul-jobs-test-registry-buildset-registry-openshift-docker dependencies: zuul-jobs-test-registry-buildset-registry @@ -193,6 +217,7 @@ - zuul-jobs-test-registry-podman - zuul-jobs-test-registry-buildset-registry - zuul-jobs-test-registry-buildset-registry-k8s-docker + - zuul-jobs-test-registry-buildset-registry-k8s-crio - zuul-jobs-test-registry-buildset-registry-openshift-docker - zuul-jobs-test-install-kubernetes-docker - zuul-jobs-test-install-kubernetes-crio