Skip to content

Commit a900a67

Browse files
committed
Change the method of installing test-operator
This patch introduces a new way of installing test-operator. Before, we wanted test-operator role to install the test-operator, but now test-operator will be installed the same way as other operators - using openstack-operator. Additionally, there is a need to ensure we can change which version of test-operator is used. This will be necessary for having a way to prevent big issues by changing the versions temporarily.
1 parent 351e999 commit a900a67

File tree

5 files changed

+18
-60
lines changed

5 files changed

+18
-60
lines changed

roles/env_op_images/defaults/main.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,3 +21,4 @@
2121
cifmw_env_op_images_dir: "{{ cifmw_basedir | default(ansible_user_dir ~ '/ci-framework-data') }}"
2222
cifmw_env_op_images_file: operator_images.yaml
2323
cifmw_env_op_images_dryrun: false
24+
cifmw_env_op_test_operator_image: ""

roles/env_op_images/tasks/main.yml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,21 @@
8686
loop_control:
8787
label: "{{ item.name }}"
8888

89+
- name: Patch CSV to change test-operator image if needed
90+
when:
91+
- cifmw_env_op_test_operator_image != ""
92+
ansible.builtin.set_fact:
93+
cifmw_openstack_service_images_content: >-
94+
{{
95+
cifmw_openstack_service_images_content |
96+
default({}) |
97+
combine(
98+
{
99+
"RELATED_IMAGE_TEST_OPERATOR_MANAGER_IMAGE_URL": {{ cifmw_env_op_test_operator_image }}
100+
}
101+
)
102+
}}
103+
89104
- name: Get all the pods in openstack-operator namespace
90105
vars:
91106
csv_items: "{{ (_csvs_out.stdout | from_yaml)['items'] }}"

roles/test_operator/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ Execute tests via the [test-operator](https://openstack-k8s-operators.github.io/
44

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`
7-
* `cifmw_test_operator_namespace`: (String) Namespace inside which all the resources are created. Default value: `openstack`
7+
* `cifmw_test_operator_namespace`: (String) Namespace inside which all the resources are created. Default value: `openstack-opearators`
88
* `cifmw_test_operator_index`: (String) Full name of container image with index that contains the test-operator. Default value: `quay.io/openstack-k8s-operators/test-operator-index:latest`
99
* `cifmw_test_operator_timeout`: (Integer) Timeout in seconds for the execution of the tests. Default value: `3600`
1010
* `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`

roles/test_operator/defaults/main.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ cifmw_test_operator_stages:
2424
type: tempest
2525
cifmw_test_operator_fail_on_test_failure: true
2626
cifmw_test_operator_artifacts_basedir: "{{ cifmw_basedir | default(ansible_user_dir ~ '/ci-framework-data') }}/tests/test_operator"
27-
cifmw_test_operator_namespace: openstack
27+
cifmw_test_operator_namespace: openstack-operators
2828
cifmw_test_operator_index: quay.io/openstack-k8s-operators/test-operator-index:latest
2929
cifmw_test_operator_timeout: 3600
3030
cifmw_test_operator_logs_image: quay.io/quay/busybox

roles/test_operator/tasks/main.yml

Lines changed: 0 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -23,64 +23,6 @@
2323
owner: "{{ ansible_user | default(lookup('env', 'USER')) }}"
2424
group: "{{ ansible_user | default(lookup('env', 'USER')) }}"
2525

26-
- name: Ensure OperatorGroup for the test-operator is present
27-
kubernetes.core.k8s:
28-
kubeconfig: "{{ cifmw_openshift_kubeconfig }}"
29-
api_key: "{{ cifmw_openshift_token | default(omit) }}"
30-
context: "{{ cifmw_openshift_context | default(omit) }}"
31-
state: present
32-
wait: true
33-
definition:
34-
apiVersion: operators.coreos.com/v1
35-
kind: OperatorGroup
36-
metadata:
37-
name: test-operator-operatorgroup
38-
namespace: "{{ cifmw_test_operator_namespace }}"
39-
spec:
40-
targetNamespaces:
41-
- "{{ cifmw_test_operator_namespace }}"
42-
when: not cifmw_test_operator_dry_run | bool
43-
44-
- name: Ensure CatalogSource for the test-operator is present
45-
kubernetes.core.k8s:
46-
kubeconfig: "{{ cifmw_openshift_kubeconfig }}"
47-
api_key: "{{ cifmw_openshift_token | default(omit) }}"
48-
context: "{{ cifmw_openshift_context | default(omit) }}"
49-
state: present
50-
wait: true
51-
definition:
52-
apiVersion: operators.coreos.com/v1alpha1
53-
kind: CatalogSource
54-
metadata:
55-
name: test-operator-catalog
56-
namespace: "{{ cifmw_test_operator_namespace }}"
57-
spec:
58-
sourceType: grpc
59-
image: "{{ cifmw_test_operator_index }}"
60-
when: not cifmw_test_operator_dry_run | bool
61-
62-
- name: Ensure Subscription for the test-operator is present
63-
kubernetes.core.k8s:
64-
kubeconfig: "{{ cifmw_openshift_kubeconfig }}"
65-
api_key: "{{ cifmw_openshift_token | default(omit)}}"
66-
context: "{{ cifmw_openshift_context | default(omit)}}"
67-
state: present
68-
wait: true
69-
definition:
70-
apiVersion: operators.coreos.com/v1alpha1
71-
kind: Subscription
72-
metadata:
73-
name: test-operator
74-
namespace: "{{ cifmw_test_operator_namespace }}"
75-
spec:
76-
name: test-operator
77-
source: test-operator-catalog
78-
sourceNamespace: "{{ cifmw_test_operator_namespace }}"
79-
config:
80-
tolerations: "{{ cifmw_test_operator_tolerations | default(omit) }}"
81-
nodeSelector: "{{ cifmw_test_operator_node_selector | default(omit) }}"
82-
when: not cifmw_test_operator_dry_run | bool
83-
8426
- name: Wait until the test-operator csv is present
8527
kubernetes.core.k8s_info:
8628
kubeconfig: "{{ cifmw_openshift_kubeconfig }}"

0 commit comments

Comments
 (0)