Skip to content

Commit

Permalink
[Test-operator] Set resource limits
Browse files Browse the repository at this point in the history
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
  • Loading branch information
lpiwowar committed Dec 18, 2024
1 parent 18f4002 commit cdcfd6c
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
4 changes: 4 additions & 0 deletions roles/test_operator/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ cifmw_test_operator_stages:
* `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: `[]`
* `cifmw_test_operator_tempest_extra_configmaps_mounts`: (List) A list of configmaps that should be mounted into the tempest test pods. Default value: `[]`
* `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`
* `cifmw_test_operator_tempest_resources`: (Dict) A dictionary that specifies resources (cpu, memory) for the test pods. When untouched it unsets 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: {}}`
* `cifmw_tempest_tempestconf_config`: Deprecated, please use `cifmw_test_operator_tempest_tempestconf_config` instead
* `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:
```
Expand Down Expand Up @@ -118,6 +119,7 @@ Default value: {}
* `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`
* `cifmw_test_operator_tobiko_network_attachments`: (List) List of network attachment definitions to attach to the tobiko pods spawned by test-operator. Default value: `[]`.
* `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).
* `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: `{}`
* `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:
```
apiVersion: test.openstack.org/v1beta1
Expand Down Expand Up @@ -164,6 +166,7 @@ Default value: {}
* `cifmw_test_operator_ansibletest_debug`: (Bool) Run ansible playbook with -vvvv. Default value: `false`
* `cifmw_test_operator_ansibletest_workflow`: (List) A parameter that contains a workflow definition. Default value: `[]`
* `cifmw_test_operator_ansibletest_extra_configmaps_mounts`: (List) Extra configmaps for mounting in the pod. Default value: `[]`
* `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: `{}`
* `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:
```
apiVersion: test.openstack.org/v1beta1
Expand Down Expand Up @@ -209,6 +212,7 @@ Default value: {}
* `cifmw_test_operator_horizontest_flavor_name`: (String) The name of the OpenStack flavor to create for Horizon tests. Default value: `m1.tiny`
* `cifmw_test_operator_horizontest_logs_directory_name`: (String) The name of the directory to store test logs. Default value: `horizon`
* `cifmw_test_operator_horizontest_horizon_test_dir`: (String) The directory path for Horizon tests. Default value: `/var/lib/horizontest`
* `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: `{}`
* `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:
```
apiVersion: test.openstack.org/v1beta1
Expand Down
14 changes: 14 additions & 0 deletions roles/test_operator/defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,13 @@ cifmw_test_operator_tempest_workflow: []
cifmw_test_operator_tempest_cleanup: false
cifmw_test_operator_tempest_tempestconf_config: "{{ cifmw_tempest_tempestconf_config }}"

# TODO: The default value of this parameter should be changed to {} once this fix
# for tempest reaches the upstream build of the openstack-tempest-all image:
# https://review.opendev.org/c/openstack/tempest/+/934980
cifmw_test_operator_tempest_resources:
requests: {}
limits: {}

# Enabling SRBAC by default, in jobs where this does not make sense should be turned off explicitly
#
# auth.tempest_roles is set to an empty value because otherwise
Expand Down Expand Up @@ -123,6 +130,7 @@ cifmw_test_operator_tempest_config:
tolerations: "{{ cifmw_test_operator_tolerations | default(omit) }}"
nodeSelector: "{{ cifmw_test_operator_node_selector | default(omit) }}"
extraConfigmapsMounts: "{{ stage_vars_dict.cifmw_test_operator_tempest_extra_configmaps_mounts | default(omit) }}"
resources: "{{ stage_vars_dict.cifmw_test_operator_tempest_resources }}"
tempestRun:
includeList: |
{{ stage_vars_dict.cifmw_test_operator_tempest_include_list | default('') }}
Expand Down Expand Up @@ -158,6 +166,7 @@ cifmw_test_operator_tobiko_ssh_keysize: "{{ cifmw_ssh_keysize | default(521) }}"
cifmw_test_operator_tobiko_debug: false
cifmw_test_operator_tobiko_network_attachments: []
cifmw_test_operator_tobiko_workflow: []
cifmw_test_operator_tobiko_resources: {}
cifmw_test_operator_tobiko_config:
apiVersion: test.openstack.org/v1beta1
kind: Tobiko
Expand All @@ -177,6 +186,7 @@ cifmw_test_operator_tobiko_config:
nodeSelector: "{{ cifmw_test_operator_node_selector | default(omit) }}"
debug: "{{ stage_vars_dict.cifmw_test_operator_tobiko_debug }}"
networkAttachments: "{{ stage_vars_dict.cifmw_test_operator_tobiko_network_attachments }}"
resources: "{{ stage_vars_dict.cifmw_test_operator_tobiko_resources }}"
# preventCreate: preventCreate is generated by the test_operator role based on the value of stage_vars_dict.cifmw_test_operator_tobiko_prevent_create
# numProcesses: numProcesses is generated by the test_operator role based on the value of stage_vars_dict.cifmw_test_operator_tobiko_num_processes
# privateKey: privateKey is automatically by the test_operator role
Expand Down Expand Up @@ -204,6 +214,7 @@ cifmw_test_operator_ansibletest_openstack_config_secret: "openstack-config-secre
cifmw_test_operator_ansibletest_debug: false
cifmw_test_operator_ansibletest_workflow: []
cifmw_test_operator_ansibletest_extra_configmaps_mounts: []
cifmw_test_operator_ansibletest_resources: {}
cifmw_test_operator_ansibletest_config:
apiVersion: test.openstack.org/v1beta1
kind: AnsibleTest
Expand All @@ -228,6 +239,7 @@ cifmw_test_operator_ansibletest_config:
openStackConfigSecret: "{{ stage_vars_dict.cifmw_test_operator_ansibletest_openstack_config_secret }}"
workflow: "{{ stage_vars_dict.cifmw_test_operator_ansibletest_workflow }}"
debug: "{{ stage_vars_dict.cifmw_test_operator_ansibletest_debug }}"
resources: "{{ stage_vars_dict.cifmw_test_operator_ansibletest_resources }}"

# Section 5: horizontest parameters - used when run_test_fw is 'horizontest'
cifmw_test_operator_horizontest_name: "horizontest-tests"
Expand All @@ -249,6 +261,7 @@ cifmw_test_operator_horizontest_password: "horizontest"
cifmw_test_operator_horizontest_flavor_name: "m1.tiny"
cifmw_test_operator_horizontest_logs_directory_name: "horizon"
cifmw_test_operator_horizontest_horizon_test_dir: "/var/lib/horizontest"
cifmw_test_operator_horizontest_resources: {}
cifmw_test_operator_horizontest_config:
apiVersion: test.openstack.org/v1beta1
kind: HorizonTest
Expand All @@ -273,3 +286,4 @@ cifmw_test_operator_horizontest_config:
flavorName: "{{ stage_vars_dict.cifmw_test_operator_horizontest_flavor_name }}"
logsDirectoryName: "{{ stage_vars_dict.cifmw_test_operator_horizontest_logs_directory_name }}"
horizonTestDir: "{{ stage_vars_dict.cifmw_test_operator_horizontest_horizon_test_dir }}"
resources: "{{ stage_vars_dict.cifmw_test_operator_horizontest_resources }}"

0 comments on commit cdcfd6c

Please sign in to comment.