test: Restructure zuul-operator-functional-k8s layout

This change is a precursor to introducing a Helm-based functional test
so that we can also exercise the Helm charts.  It consists of the
following:

(1) the template install is factored out as a distinct pre-run step so
    as to enable us to swap it out later

(2) the kubernetes node setup is moved to pre-k8s.yaml so that it
    happens before we attempt to install the operator to make it
    re-usable in the subsequent Helm-based test

Change-Id: I16d0ceda8446f18038e318b8503fa49388c95d97
This commit is contained in:
Michael Kelly 2022-11-03 20:44:49 -07:00
parent 391ac1d25a
commit c2947e607b
No known key found for this signature in database
GPG Key ID: 77F7FE93040ECF3E
4 changed files with 32 additions and 25 deletions

View File

@ -17,7 +17,9 @@
description: Operator integration tests with Kubernetes
name: zuul-operator-functional-k8s
parent: zuul-operator-functional
pre-run: playbooks/zuul-operator-functional/pre-k8s.yaml
pre-run:
- playbooks/zuul-operator-functional/pre-k8s.yaml
- playbooks/zuul-operator-functional/install_templates.yaml
nodeset: ubuntu-bionic
vars:
namespace: 'default'

View File

@ -0,0 +1,22 @@
- name: install and start zuul operator
hosts: all
vars:
# Override this if you are running the operator interactively
# locally for development.
install_operator: true
zuul_work_dir: "{{ zuul.projects['opendev.org/zuul/zuul-operator'].src_dir }}"
tasks:
- name: Setup CRD
command: kubectl apply -f deploy/crds/zuul-ci_v1alpha2_zuul_crd.yaml -f deploy/rbac.yaml
args:
chdir: "{{ zuul_work_dir }}"
- name: Install operator
when: install_operator
command: kubectl apply -f deploy/operator.yaml
args:
chdir: "{{ zuul_work_dir }}"
- name: Wait for operator deployment
when: install_operator
command: timeout 8m kubectl rollout status deployment/zuul-operator

View File

@ -1,5 +1,8 @@
- name: start kubernetes and install all dependencies
hosts: all
vars:
runtime: minikube
zuul_work_dir: "{{ zuul.projects['opendev.org/zuul/zuul-operator'].src_dir }}"
roles:
- role: clear-firewall
- role: ensure-pip
@ -28,3 +31,7 @@
until: _api_ready.rc == 0
retries: 6
delay: 10
- name: Create static node
include_tasks: ./tasks/create_static_node.yaml

View File

@ -1,33 +1,9 @@
- name: install and start zuul operator
hosts: all
vars:
# Override this if you are running the operator interactively
# locally for development.
install_operator: true
zuul_work_dir: "{{ zuul.projects['opendev.org/zuul/zuul-operator'].src_dir }}"
runtime: minikube
tasks:
- name: Setup CRD
command: kubectl apply -f deploy/crds/zuul-ci_v1alpha2_zuul_crd.yaml -f deploy/rbac.yaml
args:
chdir: "{{ zuul_work_dir }}"
- name: Install operator
when: install_operator
command: kubectl apply -f deploy/operator.yaml
args:
chdir: "{{ zuul_work_dir }}"
- name: Create static node
include_tasks: ./tasks/create_static_node.yaml
- name: Create required secret
include_tasks: ./tasks/create_test_secrets.yaml
- name: Wait for operator deployment
when: install_operator
command: timeout 8m kubectl rollout status deployment/zuul-operator
- name: Deploy CR
include_tasks: tasks/apply_cr.yaml
vars: