Skip to content

Commit 645a2c4

Browse files
committed
Update CRDs when changing test-operator version
This patch updated the CRDs, if the user wants to patch the test operator version. Until now the CRDs stayed unchanged even after version change, so testing new test-operator parameters was not possible. It is important to point out, that the update will not be triggered in 90% of test-operator use cases. It is primarily used in two situations: 1. When running checks for new PRs in the test-operator repository. 2. When updating the test-operator version in jobs to prevent failures. The approach isn’t the cleanest, but alternative solutions are significantly more complex than the benefits they offer.
1 parent d15dd58 commit 645a2c4

File tree

2 files changed

+41
-1
lines changed

2 files changed

+41
-1
lines changed

roles/test_operator/README.md

+2-1
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,9 @@ Execute tests via the [test-operator](https://openstack-k8s-operators.github.io/
55
## Parameters
66
* `cifmw_test_operator_artifacts_basedir`: (String) Directory where we will have all test-operator related files. Default value: `{{ cifmw_basedir }}/tests/test_operator` which defaults to `~/ci-framework-data/tests/test_operator`
77
* `cifmw_test_operator_namespace`: (String) Namespace inside which all the resources are created. Default value: `openstack`
8-
* `cifmw_test_operator_controller_namespace`: (String) Namespace inside which the test-operator-controller-manager is created. Default value: `openstack-opearators`
8+
* `cifmw_test_operator_controller_namespace`: (String) Namespace inside which the test-operator-controller-manager is created. Default value: `openstack-operators`
99
* `cifmw_test_operator_bundle`: (String) Full name of container image with bundle that contains the test-operator. Default value: `""`
10+
* `cifmw_test_operator_version`: (String) The commit hash corresponding to the version of test-operator the user wants to use. This parameter is only used when `cifmw_test_operator_bundle` is also set.
1011
* `cifmw_test_operator_timeout`: (Integer) Timeout in seconds for the execution of the tests. Default value: `3600`
1112
* `cifmw_test_operator_logs_image`: (String) Image that should be used to collect logs from the pods spawned by the test-operator. Default value: `quay.io/quay/busybox`
1213
* `cifmw_test_operator_concurrency`: (Integer) Tempest concurrency value. As of now this value can not be specified inside `test_vars`. Default value: `8`

roles/test_operator/tasks/main.yml

+39
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,45 @@
118118
)
119119
}}
120120
121+
- name: Update existing CRDs
122+
when: cifmw_test_operator_version is defined
123+
block:
124+
- name: Delete CRDs created by test-operator
125+
kubernetes.core.k8s:
126+
kubeconfig: "{{ cifmw_openshift_kubeconfig }}"
127+
api_key: "{{ cifmw_openshift_token | default(omit)}}"
128+
context: "{{ cifmw_openshift_context | default(omit)}}"
129+
kind: CustomResourceDefinition
130+
state: absent
131+
api_version: v1
132+
name: "{{ item }}"
133+
namespace: "{{ cifmw_test_operator_namespace }}"
134+
wait: true
135+
wait_timeout: 600
136+
loop:
137+
- "{{ cifmw_test_operator_tempest_crd_name }}"
138+
- "{{ cifmw_test_operator_tobiko_crd_name }}"
139+
- "{{ cifmw_test_operator_ansibletest_crd_name }}"
140+
- "{{ cifmw_test_operator_horizontest_crd_name }}"
141+
142+
- name: Clone test-operator repository and checkout into specified version
143+
ansible.builtin.git:
144+
repo: "https://github.com/openstack-k8s-operators/test-operator.git"
145+
dest: /tmp/test-operator
146+
refspec: '+refs/pull/*:refs/heads/*'
147+
version: "{{ cifmw_test_operator_version }}"
148+
force: true
149+
150+
- name: Run make generate manifests install from /tmp/test-operator dir
151+
environment:
152+
KUBECONFIG: "{{ cifmw_openshift_kubeconfig }}"
153+
PATH: "{{ cifmw_path | default(ansible_env.PATH) }}"
154+
ansible.builtin.shell: >-
155+
set -o pipefail;
156+
make generate manifests install
157+
args:
158+
chdir: /tmp/test-operator
159+
121160
- name: Call test stages loop
122161
when: not cifmw_test_operator_dry_run | bool
123162
ansible.builtin.include_tasks: stages.yml

0 commit comments

Comments
 (0)