Skip to content

Commit deb0100

Browse files
lpiwowaropenshift-merge-bot[bot]
authored andcommitted
[Test-operator] Set resource limits
This PR exposes the resources parameter in for all test-operator related CRs (Tempest, Tobiko, AnsibleTest, HorizonTest). This parameter can be used to specify amount of resources the test pods spawned by the test-operator should consume [1]. This commit intentionally unsets the value for Tempest test pods as the propagation of the fix for Tempest memory leak bug [1] did not reach the upstream openstack-tempest-all image yet. Once the fix is in place the default value of cifmw_test_operator_tempest_resources can be changed to {}. [1] openstack-k8s-operators/test-operator#253
1 parent 52af24e commit deb0100

File tree

2 files changed

+18
-0
lines changed

2 files changed

+18
-0
lines changed

roles/test_operator/README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@ cifmw_test_operator_stages:
6565
* `cifmw_test_operator_tempest_extra_rpms`: (List) . A list of URLs that point to RPMs that should be installed before the execution of tempest. Note that this parameter has no effect when `cifmw_test_operator_tempest_external_plugin` is used. Default value: `[]`
6666
* `cifmw_test_operator_tempest_extra_configmaps_mounts`: (List) A list of configmaps that should be mounted into the tempest test pods. Default value: `[]`
6767
* `cifmw_test_operator_tempest_debug`: (Bool) Run Tempest in debug mode, it keeps the operator pod sleeping infinity (it must only set to `true`only for debugging purposes). Default value: `false`
68+
* `cifmw_test_operator_tempest_resources`: (Dict) A dictionary that specifies resources (cpu, memory) for the test pods. When untouched it clears the default values set on the test-operator side. This means that the tempest test pods run with unspecified resource limits. Default value: `{requests: {}, limits: {}}`
6869
* `cifmw_tempest_tempestconf_config`: Deprecated, please use `cifmw_test_operator_tempest_tempestconf_config` instead
6970
* `cifmw_test_operator_tempest_tempestconf_config`: (Dict) This parameter can be used to customize the execution of the `discover-tempest-config` run. Please consult the test-operator documentation. For example, to pass a custom configuration for `tempest.conf`, use the `overrides` section:
7071
```
@@ -119,6 +120,7 @@ Default value: {}
119120
* `cifmw_test_operator_tobiko_debug`: (Bool) Run Tobiko in debug mode, it keeps the operator pod sleeping infinity (it must only set to `true`only for debugging purposes). Default value: `false`
120121
* `cifmw_test_operator_tobiko_network_attachments`: (List) List of network attachment definitions to attach to the tobiko pods spawned by test-operator. Default value: `[]`.
121122
* `cifmw_test_operator_tobiko_workflow`: (List) Definition of a Tobiko workflow that consists of multiple steps. Each step can contain all values from Spec section of [Tobiko CR](https://openstack-k8s-operators.github.io/test-operator/crds.html#tobiko-custom-resource).
123+
* `cifmw_test_operator_tobiko_resources`: (Dict) A dictionary that specifies resources (cpu, memory) for the test pods. When kept untouched it defaults to the resource limits specified on the test-operator side. Default value: `{}`
122124
* `cifmw_test_operator_tobiko_config`: (Dict) Definition of Tobiko CRD instance that is passed to the test-operator (see [the test-operator documentation](https://openstack-k8s-operators.github.io/test-operator/crds.html#tobiko-custom-resource)). Default value:
123125
```
124126
apiVersion: test.openstack.org/v1beta1
@@ -165,6 +167,7 @@ Default value: {}
165167
* `cifmw_test_operator_ansibletest_debug`: (Bool) Run ansible playbook with -vvvv. Default value: `false`
166168
* `cifmw_test_operator_ansibletest_workflow`: (List) A parameter that contains a workflow definition. Default value: `[]`
167169
* `cifmw_test_operator_ansibletest_extra_configmaps_mounts`: (List) Extra configmaps for mounting in the pod. Default value: `[]`
170+
* `cifmw_test_operator_ansibletest_resources`: (Dict) A dictionary that specifies resources (cpu, memory) for the test pods. When kept untouched it defaults to the resource limits specified on the test-operator side. Default value: `{}`
168171
* `cifmw_test_operator_ansibletest_config`: Definition of AnsibleTest CRD instance that is passed to the test-operator (see [the test-operator documentation](https://openstack-k8s-operators.github.io/test-operator/crds.html)). Default value:
169172
```
170173
apiVersion: test.openstack.org/v1beta1
@@ -210,6 +213,7 @@ Default value: {}
210213
* `cifmw_test_operator_horizontest_flavor_name`: (String) The name of the OpenStack flavor to create for Horizon tests. Default value: `m1.tiny`
211214
* `cifmw_test_operator_horizontest_logs_directory_name`: (String) The name of the directory to store test logs. Default value: `horizon`
212215
* `cifmw_test_operator_horizontest_horizon_test_dir`: (String) The directory path for Horizon tests. Default value: `/var/lib/horizontest`
216+
* `cifmw_test_operator_horizontest_resources`: (Dict) A dictionary that specifies resources (cpu, memory) for the test pods. When kept untouched it defaults to the resource limits specified on the test-operator side. Default value: `{}`
213217
* `cifmw_test_operator_horizontest_config`: (Dict) Definition of HorizonTest CR instance that is passed to the test-operator (see [the test-operator documentation](https://openstack-k8s-operators.github.io/test-operator/crds.html#horizontest-custom-resource)). Default value:
214218
```
215219
apiVersion: test.openstack.org/v1beta1

roles/test_operator/defaults/main.yml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,13 @@ cifmw_test_operator_tempest_workflow: []
6060
cifmw_test_operator_tempest_cleanup: false
6161
cifmw_test_operator_tempest_tempestconf_config: "{{ cifmw_tempest_tempestconf_config }}"
6262

63+
# TODO: The default value of this parameter should be changed to {} once this fix
64+
# for tempest reaches the upstream build of the openstack-tempest-all image:
65+
# https://review.opendev.org/c/openstack/tempest/+/934980
66+
cifmw_test_operator_tempest_resources:
67+
requests: {}
68+
limits: {}
69+
6370
# Enabling SRBAC by default, in jobs where this does not make sense should be turned off explicitly
6471
#
6572
# auth.tempest_roles is set to an empty value because otherwise
@@ -123,6 +130,7 @@ cifmw_test_operator_tempest_config:
123130
tolerations: "{{ cifmw_test_operator_tolerations | default(omit) }}"
124131
nodeSelector: "{{ cifmw_test_operator_node_selector | default(omit) }}"
125132
extraConfigmapsMounts: "{{ stage_vars_dict.cifmw_test_operator_tempest_extra_configmaps_mounts | default(omit) }}"
133+
resources: "{{ stage_vars_dict.cifmw_test_operator_tempest_resources }}"
126134
tempestRun:
127135
includeList: |
128136
{{ stage_vars_dict.cifmw_test_operator_tempest_include_list | default('') }}
@@ -159,6 +167,7 @@ cifmw_test_operator_tobiko_ssh_keysize: "{{ cifmw_ssh_keysize | default(521) }}"
159167
cifmw_test_operator_tobiko_debug: false
160168
cifmw_test_operator_tobiko_network_attachments: []
161169
cifmw_test_operator_tobiko_workflow: []
170+
cifmw_test_operator_tobiko_resources: {}
162171
cifmw_test_operator_tobiko_config:
163172
apiVersion: test.openstack.org/v1beta1
164173
kind: Tobiko
@@ -178,6 +187,7 @@ cifmw_test_operator_tobiko_config:
178187
nodeSelector: "{{ cifmw_test_operator_node_selector | default(omit) }}"
179188
debug: "{{ stage_vars_dict.cifmw_test_operator_tobiko_debug }}"
180189
networkAttachments: "{{ stage_vars_dict.cifmw_test_operator_tobiko_network_attachments }}"
190+
resources: "{{ stage_vars_dict.cifmw_test_operator_tobiko_resources }}"
181191
# preventCreate: preventCreate is generated by the test_operator role based on the value of stage_vars_dict.cifmw_test_operator_tobiko_prevent_create
182192
# numProcesses: numProcesses is generated by the test_operator role based on the value of stage_vars_dict.cifmw_test_operator_tobiko_num_processes
183193
# privateKey: privateKey is automatically by the test_operator role
@@ -205,6 +215,7 @@ cifmw_test_operator_ansibletest_openstack_config_secret: "openstack-config-secre
205215
cifmw_test_operator_ansibletest_debug: false
206216
cifmw_test_operator_ansibletest_workflow: []
207217
cifmw_test_operator_ansibletest_extra_configmaps_mounts: []
218+
cifmw_test_operator_ansibletest_resources: {}
208219
cifmw_test_operator_ansibletest_config:
209220
apiVersion: test.openstack.org/v1beta1
210221
kind: AnsibleTest
@@ -229,6 +240,7 @@ cifmw_test_operator_ansibletest_config:
229240
openStackConfigSecret: "{{ stage_vars_dict.cifmw_test_operator_ansibletest_openstack_config_secret }}"
230241
workflow: "{{ stage_vars_dict.cifmw_test_operator_ansibletest_workflow }}"
231242
debug: "{{ stage_vars_dict.cifmw_test_operator_ansibletest_debug }}"
243+
resources: "{{ stage_vars_dict.cifmw_test_operator_ansibletest_resources }}"
232244

233245
# Section 5: horizontest parameters - used when run_test_fw is 'horizontest'
234246
cifmw_test_operator_horizontest_name: "horizontest-tests"
@@ -250,6 +262,7 @@ cifmw_test_operator_horizontest_password: "horizontest"
250262
cifmw_test_operator_horizontest_flavor_name: "m1.tiny"
251263
cifmw_test_operator_horizontest_logs_directory_name: "horizon"
252264
cifmw_test_operator_horizontest_horizon_test_dir: "/var/lib/horizontest"
265+
cifmw_test_operator_horizontest_resources: {}
253266
cifmw_test_operator_horizontest_config:
254267
apiVersion: test.openstack.org/v1beta1
255268
kind: HorizonTest
@@ -274,3 +287,4 @@ cifmw_test_operator_horizontest_config:
274287
flavorName: "{{ stage_vars_dict.cifmw_test_operator_horizontest_flavor_name }}"
275288
logsDirectoryName: "{{ stage_vars_dict.cifmw_test_operator_horizontest_logs_directory_name }}"
276289
horizonTestDir: "{{ stage_vars_dict.cifmw_test_operator_horizontest_horizon_test_dir }}"
290+
resources: "{{ stage_vars_dict.cifmw_test_operator_horizontest_resources }}"

0 commit comments

Comments
 (0)