From 8e66c548fff938e2b1484ac8958ea4b0193b541c Mon Sep 17 00:00:00 2001 From: Lukas Piwowarski Date: Mon, 25 Nov 2024 07:41:45 -0500 Subject: [PATCH] Add ResourceLimits for test pods The test pods spawned by the test operator prior to this change were executed without any resource limits. This ultimately meant that the pods could consume an unlimited amount of resources until the limit for a worker node was reached. This commit introduces default resource limits for each test pod spawned by the test operator (tempest, tobiko, ansibletest, horizontest pod). The default value can be overridden using .Spec.Resources parameter which is introduced as part of this commit as well [1]: spec: resources: requests: memory: 1Gi cpu: 250m limits: memory: 2Gi cpu: 500M [1] https://pkg.go.dev/k8s.io/api/core/v1#ResourceRequirements Depends-On: https://github.com/openstack-k8s-operators/ci-framework/pull/2617 --- .../test.openstack.org_ansibletests.yaml | 114 ++++++++++++++++++ .../test.openstack.org_horizontests.yaml | 56 +++++++++ api/bases/test.openstack.org_tempests.yaml | 113 +++++++++++++++++ api/bases/test.openstack.org_tobikoes.yaml | 105 +++++++++++++++- api/v1beta1/ansibletest_types.go | 13 +- api/v1beta1/horizontest_types.go | 6 + api/v1beta1/tempest_types.go | 6 + api/v1beta1/tempest_types_workflow.go | 11 +- api/v1beta1/tobiko_types.go | 14 ++- api/v1beta1/zz_generated.deepcopy.go | 19 +++ .../test.openstack.org_ansibletests.yaml | 114 ++++++++++++++++++ .../test.openstack.org_horizontests.yaml | 56 +++++++++ .../bases/test.openstack.org_tempests.yaml | 113 +++++++++++++++++ .../bases/test.openstack.org_tobikoes.yaml | 105 +++++++++++++++- .../test-operator.clusterserviceversion.yaml | 10 ++ controllers/ansibletest_controller.go | 4 + controllers/tempest_controller.go | 4 + controllers/tobiko_controller.go | 4 + pkg/ansibletest/job.go | 1 + pkg/horizontest/job.go | 1 + pkg/tempest/job.go | 1 + pkg/tobiko/job.go | 1 + 22 files changed, 864 insertions(+), 7 deletions(-) diff --git a/api/bases/test.openstack.org_ansibletests.yaml b/api/bases/test.openstack.org_ansibletests.yaml index b5a110a5..4f8eff27 100644 --- a/api/bases/test.openstack.org_ansibletests.yaml +++ b/api/bases/test.openstack.org_ansibletests.yaml @@ -146,6 +146,62 @@ spec: to work properly (e.g.: extraRPMs in Tempest CR, or certain set of tobiko tests).' type: boolean + resources: + default: + limits: + cpu: 4000m + memory: 4Gi + requests: + cpu: 2000m + memory: 2Gi + description: The desired amount of resources that should be assigned + to each test pod spawned using the AnsibleTest CR. https://pkg.go.dev/k8s.io/api/core/v1#ResourceRequirements + properties: + claims: + description: "Claims lists the names of resources, defined in + spec.resourceClaims, that are used by this container. \n This + is an alpha field and requires enabling the DynamicResourceAllocation + feature gate. \n This field is immutable. It can only be set + for containers." + items: + description: ResourceClaim references one entry in PodSpec.ResourceClaims. + properties: + name: + description: Name must match the name of one entry in pod.spec.resourceClaims + of the Pod where this field is used. It makes that resource + available inside a container. + type: string + required: + - name + type: object + type: array + x-kubernetes-list-map-keys: + - name + x-kubernetes-list-type: map + limits: + additionalProperties: + anyOf: + - type: integer + - type: string + pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ + x-kubernetes-int-or-string: true + description: 'Limits describes the maximum amount of compute resources + allowed. More info: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/' + type: object + requests: + additionalProperties: + anyOf: + - type: integer + - type: string + pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ + x-kubernetes-int-or-string: true + description: 'Requests describes the minimum amount of compute + resources required. If Requests is omitted for a container, + it defaults to Limits if that is explicitly specified, otherwise + to an implementation-defined value. Requests cannot exceed Limits. + More info: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/' + type: object + type: object storageClass: default: local-storage description: StorageClass used to create any test-operator related @@ -290,6 +346,64 @@ spec: test-operator functionalities to work properly (e.g.: extraRPMs in Tempest CR, or certain set of tobiko tests).' type: boolean + resources: + default: + limits: + cpu: 2000m + memory: 2Gi + requests: + cpu: 1000m + memory: 2Gi + description: The desired amount of resources that should be + assigned to each test pod spawned using the AnsibleTest CR. + https://pkg.go.dev/k8s.io/api/core/v1#ResourceRequirements + properties: + claims: + description: "Claims lists the names of resources, defined + in spec.resourceClaims, that are used by this container. + \n This is an alpha field and requires enabling the DynamicResourceAllocation + feature gate. \n This field is immutable. It can only + be set for containers." + items: + description: ResourceClaim references one entry in PodSpec.ResourceClaims. + properties: + name: + description: Name must match the name of one entry + in pod.spec.resourceClaims of the Pod where this + field is used. It makes that resource available + inside a container. + type: string + required: + - name + type: object + type: array + x-kubernetes-list-map-keys: + - name + x-kubernetes-list-type: map + limits: + additionalProperties: + anyOf: + - type: integer + - type: string + pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ + x-kubernetes-int-or-string: true + description: 'Limits describes the maximum amount of compute + resources allowed. More info: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/' + type: object + requests: + additionalProperties: + anyOf: + - type: integer + - type: string + pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ + x-kubernetes-int-or-string: true + description: 'Requests describes the minimum amount of compute + resources required. If Requests is omitted for a container, + it defaults to Limits if that is explicitly specified, + otherwise to an implementation-defined value. Requests + cannot exceed Limits. More info: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/' + type: object + type: object stepName: description: Name of a workflow step. The step name will be used for example to create a logs directory. diff --git a/api/bases/test.openstack.org_horizontests.yaml b/api/bases/test.openstack.org_horizontests.yaml index 46eae217..b7e9aa57 100644 --- a/api/bases/test.openstack.org_horizontests.yaml +++ b/api/bases/test.openstack.org_horizontests.yaml @@ -167,6 +167,62 @@ spec: default: https://review.opendev.org/openstack/horizon description: RepoUrl is the URL of the Horizon repository. type: string + resources: + default: + limits: + cpu: 2000m + memory: 4Gi + requests: + cpu: 1000m + memory: 2Gi + description: The desired amount of resources that should be assigned + to each test pod spawned using the HorizonTest CR. https://pkg.go.dev/k8s.io/api/core/v1#ResourceRequirements + properties: + claims: + description: "Claims lists the names of resources, defined in + spec.resourceClaims, that are used by this container. \n This + is an alpha field and requires enabling the DynamicResourceAllocation + feature gate. \n This field is immutable. It can only be set + for containers." + items: + description: ResourceClaim references one entry in PodSpec.ResourceClaims. + properties: + name: + description: Name must match the name of one entry in pod.spec.resourceClaims + of the Pod where this field is used. It makes that resource + available inside a container. + type: string + required: + - name + type: object + type: array + x-kubernetes-list-map-keys: + - name + x-kubernetes-list-type: map + limits: + additionalProperties: + anyOf: + - type: integer + - type: string + pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ + x-kubernetes-int-or-string: true + description: 'Limits describes the maximum amount of compute resources + allowed. More info: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/' + type: object + requests: + additionalProperties: + anyOf: + - type: integer + - type: string + pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ + x-kubernetes-int-or-string: true + description: 'Requests describes the minimum amount of compute + resources required. If Requests is omitted for a container, + it defaults to Limits if that is explicitly specified, otherwise + to an implementation-defined value. Requests cannot exceed Limits. + More info: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/' + type: object + type: object storageClass: default: local-storage description: StorageClass used to create any test-operator related diff --git a/api/bases/test.openstack.org_tempests.yaml b/api/bases/test.openstack.org_tempests.yaml index 5ee54c99..f7cc4318 100644 --- a/api/bases/test.openstack.org_tempests.yaml +++ b/api/bases/test.openstack.org_tempests.yaml @@ -149,6 +149,62 @@ spec: to work properly (e.g.: extraRPMs in Tempest CR, or certain set of tobiko tests).' type: boolean + resources: + default: + limits: + cpu: 8000m + memory: 4Gi + requests: + cpu: 4000m + memory: 2Gi + description: The desired amount of resources that should be assigned + to each test pod spawned using the Tempest CR. https://pkg.go.dev/k8s.io/api/core/v1#ResourceRequirements + properties: + claims: + description: "Claims lists the names of resources, defined in + spec.resourceClaims, that are used by this container. \n This + is an alpha field and requires enabling the DynamicResourceAllocation + feature gate. \n This field is immutable. It can only be set + for containers." + items: + description: ResourceClaim references one entry in PodSpec.ResourceClaims. + properties: + name: + description: Name must match the name of one entry in pod.spec.resourceClaims + of the Pod where this field is used. It makes that resource + available inside a container. + type: string + required: + - name + type: object + type: array + x-kubernetes-list-map-keys: + - name + x-kubernetes-list-type: map + limits: + additionalProperties: + anyOf: + - type: integer + - type: string + pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ + x-kubernetes-int-or-string: true + description: 'Limits describes the maximum amount of compute resources + allowed. More info: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/' + type: object + requests: + additionalProperties: + anyOf: + - type: integer + - type: string + pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ + x-kubernetes-int-or-string: true + description: 'Requests describes the minimum amount of compute + resources required. If Requests is omitted for a container, + it defaults to Limits if that is explicitly specified, otherwise + to an implementation-defined value. Requests cannot exceed Limits. + More info: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/' + type: object + type: object storageClass: default: local-storage description: StorageClass used to create any test-operator related @@ -584,6 +640,63 @@ spec: test-operator functionalities to work properly (e.g.: extraRPMs in Tempest CR, or certain set of tobiko tests).' type: boolean + resources: + default: + limits: + cpu: 8000m + memory: 4Gi + requests: + cpu: 4000m + memory: 2Gi + description: The desired amount of resources that should be + assigned to each test pod spawned using the Tempest CR. https://pkg.go.dev/k8s.io/api/core/v1#ResourceRequirements + properties: + claims: + description: "Claims lists the names of resources, defined + in spec.resourceClaims, that are used by this container. + \n This is an alpha field and requires enabling the DynamicResourceAllocation + feature gate. \n This field is immutable. It can only + be set for containers." + items: + description: ResourceClaim references one entry in PodSpec.ResourceClaims. + properties: + name: + description: Name must match the name of one entry + in pod.spec.resourceClaims of the Pod where this + field is used. It makes that resource available + inside a container. + type: string + required: + - name + type: object + type: array + x-kubernetes-list-map-keys: + - name + x-kubernetes-list-type: map + limits: + additionalProperties: + anyOf: + - type: integer + - type: string + pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ + x-kubernetes-int-or-string: true + description: 'Limits describes the maximum amount of compute + resources allowed. More info: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/' + type: object + requests: + additionalProperties: + anyOf: + - type: integer + - type: string + pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ + x-kubernetes-int-or-string: true + description: 'Requests describes the minimum amount of compute + resources required. If Requests is omitted for a container, + it defaults to Limits if that is explicitly specified, + otherwise to an implementation-defined value. Requests + cannot exceed Limits. More info: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/' + type: object + type: object stepName: description: Name of a workflow step. The step name will be used for example to create a logs directory. diff --git a/api/bases/test.openstack.org_tobikoes.yaml b/api/bases/test.openstack.org_tobikoes.yaml index 35f4dd8a..96e5f549 100644 --- a/api/bases/test.openstack.org_tobikoes.yaml +++ b/api/bases/test.openstack.org_tobikoes.yaml @@ -111,7 +111,7 @@ spec: to test pods spawned by the test operator. type: object numProcesses: - default: 0 + default: 4 description: Number of processes/workers used to run tobiko tests - value 0 results in automatic decission type: integer @@ -149,6 +149,57 @@ spec: description: String including any options to pass to pytest when it runs tobiko tests type: string + resources: + description: 'The desired amount of resources that should be assigned + to each test pod spawned using the Tobiko CR. https://pkg.go.dev/k8s.io/api/core/v1#ResourceRequirements + kubebuilder:default:={limits: {cpu: "8000m", memory: "8Gi"}, requests: + {cpu: "4000m", memory: "4Gi"}}' + properties: + claims: + description: "Claims lists the names of resources, defined in + spec.resourceClaims, that are used by this container. \n This + is an alpha field and requires enabling the DynamicResourceAllocation + feature gate. \n This field is immutable. It can only be set + for containers." + items: + description: ResourceClaim references one entry in PodSpec.ResourceClaims. + properties: + name: + description: Name must match the name of one entry in pod.spec.resourceClaims + of the Pod where this field is used. It makes that resource + available inside a container. + type: string + required: + - name + type: object + type: array + x-kubernetes-list-map-keys: + - name + x-kubernetes-list-type: map + limits: + additionalProperties: + anyOf: + - type: integer + - type: string + pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ + x-kubernetes-int-or-string: true + description: 'Limits describes the maximum amount of compute resources + allowed. More info: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/' + type: object + requests: + additionalProperties: + anyOf: + - type: integer + - type: string + pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ + x-kubernetes-int-or-string: true + description: 'Requests describes the minimum amount of compute + resources required. If Requests is omitted for a container, + it defaults to Limits if that is explicitly specified, otherwise + to an implementation-defined value. Requests cannot exceed Limits. + More info: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/' + type: object + type: object storageClass: default: local-storage description: StorageClass used to create any test-operator related @@ -292,6 +343,58 @@ spec: description: String including any options to pass to pytest when it runs tobiko tests type: string + resources: + description: 'The desired amount of resources that should be + assigned to each test pod spawned using the Tobiko CR. https://pkg.go.dev/k8s.io/api/core/v1#ResourceRequirements + kubebuilder:default:={limits: {cpu: "8000m", memory: "8Gi"}, + requests: {cpu: "4000m", memory: "4Gi"}}' + properties: + claims: + description: "Claims lists the names of resources, defined + in spec.resourceClaims, that are used by this container. + \n This is an alpha field and requires enabling the DynamicResourceAllocation + feature gate. \n This field is immutable. It can only + be set for containers." + items: + description: ResourceClaim references one entry in PodSpec.ResourceClaims. + properties: + name: + description: Name must match the name of one entry + in pod.spec.resourceClaims of the Pod where this + field is used. It makes that resource available + inside a container. + type: string + required: + - name + type: object + type: array + x-kubernetes-list-map-keys: + - name + x-kubernetes-list-type: map + limits: + additionalProperties: + anyOf: + - type: integer + - type: string + pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ + x-kubernetes-int-or-string: true + description: 'Limits describes the maximum amount of compute + resources allowed. More info: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/' + type: object + requests: + additionalProperties: + anyOf: + - type: integer + - type: string + pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ + x-kubernetes-int-or-string: true + description: 'Requests describes the minimum amount of compute + resources required. If Requests is omitted for a container, + it defaults to Limits if that is explicitly specified, + otherwise to an implementation-defined value. Requests + cannot exceed Limits. More info: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/' + type: object + type: object stepName: default: "" description: A parameter that contains a definition of a single diff --git a/api/v1beta1/ansibletest_types.go b/api/v1beta1/ansibletest_types.go index 25ce10b7..0cabca2b 100644 --- a/api/v1beta1/ansibletest_types.go +++ b/api/v1beta1/ansibletest_types.go @@ -18,6 +18,7 @@ package v1beta1 import ( "github.com/openstack-k8s-operators/lib-common/modules/common/condition" + corev1 "k8s.io/api/core/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" ) @@ -29,6 +30,11 @@ type AnsibleTestSpec struct { CommonOptions `json:",inline"` CommonOpenstackConfig `json:",inline"` + // The desired amount of resources that should be assigned to each test pod + // spawned using the AnsibleTest CR. https://pkg.go.dev/k8s.io/api/core/v1#ResourceRequirements + // +kubebuilder:default:={limits: {cpu: "4000m", memory: "4Gi"}, requests: {cpu: "2000m", memory: "2Gi"}} + Resources corev1.ResourceRequirements `json:"resources,omitempty"` + // +operator-sdk:csv:customresourcedefinitions:type=spec // +kubebuilder:validation:Optional // +kubebuilder:default:="dataplane-ansible-ssh-private-key-secret" @@ -94,7 +100,7 @@ type AnsibleTestSpec struct { type AnsibleTestWorkflowSpec struct { WorkflowCommonParameters `json:",inline"` - CommonOpenstackConfig `json:",inline"` + CommonOpenstackConfig `json:",inline"` // +operator-sdk:csv:customresourcedefinitions:type=spec // +kubebuilder:validation:Required @@ -103,6 +109,11 @@ type AnsibleTestWorkflowSpec struct { // a logs directory. StepName string `json:"stepName"` + // The desired amount of resources that should be assigned to each test pod + // spawned using the AnsibleTest CR. https://pkg.go.dev/k8s.io/api/core/v1#ResourceRequirements + // +kubebuilder:default:={limits: {cpu: "2000m", memory: "2Gi"}, requests: {cpu: "1000m", memory: "2Gi"}} + Resources *corev1.ResourceRequirements `json:"resources,omitempty"` + // +operator-sdk:csv:customresourcedefinitions:type=spec // +kubebuilder:validation:Optional // ComputeSSHKeySecretName is the name of the k8s secret that contains an ssh key for computes. diff --git a/api/v1beta1/horizontest_types.go b/api/v1beta1/horizontest_types.go index 61988b24..22fb38a3 100644 --- a/api/v1beta1/horizontest_types.go +++ b/api/v1beta1/horizontest_types.go @@ -18,6 +18,7 @@ package v1beta1 import ( "github.com/openstack-k8s-operators/lib-common/modules/common/condition" + corev1 "k8s.io/api/core/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" ) @@ -28,6 +29,11 @@ import ( type HorizonTestSpec struct { CommonOptions `json:",inline"` + // The desired amount of resources that should be assigned to each test pod + // spawned using the HorizonTest CR. https://pkg.go.dev/k8s.io/api/core/v1#ResourceRequirements + // +kubebuilder:default:={limits: {cpu: "2000m", memory: "4Gi"}, requests: {cpu: "1000m", memory: "2Gi"}} + Resources corev1.ResourceRequirements `json:"resources,omitempty"` + // +kubebuilder:validation:Optional // +kubebuilder:default=false // Activate debug mode. When debug mode is activated any error encountered diff --git a/api/v1beta1/tempest_types.go b/api/v1beta1/tempest_types.go index 017e1647..930afb6b 100644 --- a/api/v1beta1/tempest_types.go +++ b/api/v1beta1/tempest_types.go @@ -25,6 +25,7 @@ package v1beta1 import ( "github.com/openstack-k8s-operators/lib-common/modules/common/condition" + corev1 "k8s.io/api/core/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" ) @@ -378,6 +379,11 @@ type TempestSpec struct { CommonOptions `json:",inline"` CommonOpenstackConfig `json:",inline"` + // The desired amount of resources that should be assigned to each test pod + // spawned using the Tempest CR. https://pkg.go.dev/k8s.io/api/core/v1#ResourceRequirements + // +kubebuilder:default:={limits: {cpu: "8000m", memory: "4Gi"}, requests: {cpu: "4000m", memory: "2Gi"}} + Resources corev1.ResourceRequirements `json:"resources,omitempty"` + // +kubebuilder:validation:Optional // +operator-sdk:csv:customresourcedefinitions:type=spec // +kubebuilder:default:=false diff --git a/api/v1beta1/tempest_types_workflow.go b/api/v1beta1/tempest_types_workflow.go index c7adeb96..1767b8c1 100644 --- a/api/v1beta1/tempest_types_workflow.go +++ b/api/v1beta1/tempest_types_workflow.go @@ -16,6 +16,8 @@ limitations under the License. package v1beta1 +import corev1 "k8s.io/api/core/v1" + // TempestRunSpec - is used to configure execution of tempest. Please refer to // Please refer to https://docs.openstack.org/tempest/latest/ for the further // explanation of the CLI parameters. @@ -225,8 +227,13 @@ type WorkflowTempestconfRunSpec struct { // TempestSpec - configuration of execution of tempest. For specific configuration // of tempest see TempestRunSpec and for discover-tempest-config see TempestconfRunSpec. type WorkflowTempestSpec struct { - WorkflowCommonParameters `json:",inline"` - CommonOpenstackConfig `json:",inline"` + WorkflowCommonParameters `json:",inline"` + CommonOpenstackConfig `json:",inline"` + + // The desired amount of resources that should be assigned to each test pod + // spawned using the Tempest CR. https://pkg.go.dev/k8s.io/api/core/v1#ResourceRequirements + // +kubebuilder:default:={limits: {cpu: "8000m", memory: "4Gi"}, requests: {cpu: "4000m", memory: "2Gi"}} + Resources *corev1.ResourceRequirements `json:"resources,omitempty"` // +kubebuilder:validation:Required // +kubebuilder:validation:MaxLength:=100 diff --git a/api/v1beta1/tobiko_types.go b/api/v1beta1/tobiko_types.go index c4ee8a16..30a50d83 100644 --- a/api/v1beta1/tobiko_types.go +++ b/api/v1beta1/tobiko_types.go @@ -18,6 +18,7 @@ package v1beta1 import ( "github.com/openstack-k8s-operators/lib-common/modules/common/condition" + corev1 "k8s.io/api/core/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" ) @@ -28,6 +29,11 @@ import ( type TobikoSpec struct { CommonOptions `json:",inline"` + // The desired amount of resources that should be assigned to each test pod + // spawned using the Tobiko CR. https://pkg.go.dev/k8s.io/api/core/v1#ResourceRequirements + // kubebuilder:default:={limits: {cpu: "8000m", memory: "8Gi"}, requests: {cpu: "4000m", memory: "4Gi"}} + Resources corev1.ResourceRequirements `json:"resources,omitempty"` + // +kubebuilder:validation:Optional // +kubebuilder:default=false // Activate debug mode. When debug mode is activated any error encountered @@ -56,7 +62,7 @@ type TobikoSpec struct { // +kubebuilder:validation:Optional // +operator-sdk:csv:customresourcedefinitions:type=spec - // +kubebuilder:default:=0 + // +kubebuilder:default:=4 // Number of processes/workers used to run tobiko tests - value 0 results in automatic decission NumProcesses uint8 `json:"numProcesses"` @@ -115,6 +121,11 @@ type TobikoSpec struct { type TobikoWorkflowSpec struct { WorkflowCommonParameters `json:",inline"` + // The desired amount of resources that should be assigned to each test pod + // spawned using the Tobiko CR. https://pkg.go.dev/k8s.io/api/core/v1#ResourceRequirements + // kubebuilder:default:={limits: {cpu: "8000m", memory: "8Gi"}, requests: {cpu: "4000m", memory: "4Gi"}} + Resources *corev1.ResourceRequirements `json:"resources,omitempty"` + // +kubebuilder:validation:Optional // +operator-sdk:csv:customresourcedefinitions:type=spec // Test environment @@ -175,7 +186,6 @@ type TobikoWorkflowSpec struct { StepName string `json:"stepName"` } - //+kubebuilder:object:root=true //+kubebuilder:subresource:status //+kubebuilder:printcolumn:name="Status",type="string",JSONPath=".status.conditions[0].status",description="Status" diff --git a/api/v1beta1/zz_generated.deepcopy.go b/api/v1beta1/zz_generated.deepcopy.go index 0f1882d7..1183d193 100644 --- a/api/v1beta1/zz_generated.deepcopy.go +++ b/api/v1beta1/zz_generated.deepcopy.go @@ -91,6 +91,7 @@ func (in *AnsibleTestSpec) DeepCopyInto(out *AnsibleTestSpec) { *out = *in in.CommonOptions.DeepCopyInto(&out.CommonOptions) out.CommonOpenstackConfig = in.CommonOpenstackConfig + in.Resources.DeepCopyInto(&out.Resources) if in.Workflow != nil { in, out := &in.Workflow, &out.Workflow *out = make([]AnsibleTestWorkflowSpec, len(*in)) @@ -115,6 +116,11 @@ func (in *AnsibleTestWorkflowSpec) DeepCopyInto(out *AnsibleTestWorkflowSpec) { *out = *in in.WorkflowCommonParameters.DeepCopyInto(&out.WorkflowCommonParameters) out.CommonOpenstackConfig = in.CommonOpenstackConfig + if in.Resources != nil { + in, out := &in.Resources, &out.Resources + *out = new(v1.ResourceRequirements) + (*in).DeepCopyInto(*out) + } } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new AnsibleTestWorkflowSpec. @@ -349,6 +355,7 @@ func (in *HorizonTestList) DeepCopyObject() runtime.Object { func (in *HorizonTestSpec) DeepCopyInto(out *HorizonTestSpec) { *out = *in in.CommonOptions.DeepCopyInto(&out.CommonOptions) + in.Resources.DeepCopyInto(&out.Resources) } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new HorizonTestSpec. @@ -470,6 +477,7 @@ func (in *TempestSpec) DeepCopyInto(out *TempestSpec) { *out = *in in.CommonOptions.DeepCopyInto(&out.CommonOptions) out.CommonOpenstackConfig = in.CommonOpenstackConfig + in.Resources.DeepCopyInto(&out.Resources) if in.NetworkAttachments != nil { in, out := &in.NetworkAttachments, &out.NetworkAttachments *out = make([]string, len(*in)) @@ -581,6 +589,7 @@ func (in *TobikoList) DeepCopyObject() runtime.Object { func (in *TobikoSpec) DeepCopyInto(out *TobikoSpec) { *out = *in in.CommonOptions.DeepCopyInto(&out.CommonOptions) + in.Resources.DeepCopyInto(&out.Resources) if in.NetworkAttachments != nil { in, out := &in.NetworkAttachments, &out.NetworkAttachments *out = make([]string, len(*in)) @@ -609,6 +618,11 @@ func (in *TobikoSpec) DeepCopy() *TobikoSpec { func (in *TobikoWorkflowSpec) DeepCopyInto(out *TobikoWorkflowSpec) { *out = *in in.WorkflowCommonParameters.DeepCopyInto(&out.WorkflowCommonParameters) + if in.Resources != nil { + in, out := &in.Resources, &out.Resources + *out = new(v1.ResourceRequirements) + (*in).DeepCopyInto(*out) + } if in.PreventCreate != nil { in, out := &in.PreventCreate, &out.PreventCreate *out = new(bool) @@ -789,6 +803,11 @@ func (in *WorkflowTempestSpec) DeepCopyInto(out *WorkflowTempestSpec) { *out = *in in.WorkflowCommonParameters.DeepCopyInto(&out.WorkflowCommonParameters) out.CommonOpenstackConfig = in.CommonOpenstackConfig + if in.Resources != nil { + in, out := &in.Resources, &out.Resources + *out = new(v1.ResourceRequirements) + (*in).DeepCopyInto(*out) + } if in.Parallel != nil { in, out := &in.Parallel, &out.Parallel *out = new(bool) diff --git a/config/crd/bases/test.openstack.org_ansibletests.yaml b/config/crd/bases/test.openstack.org_ansibletests.yaml index b5a110a5..4f8eff27 100644 --- a/config/crd/bases/test.openstack.org_ansibletests.yaml +++ b/config/crd/bases/test.openstack.org_ansibletests.yaml @@ -146,6 +146,62 @@ spec: to work properly (e.g.: extraRPMs in Tempest CR, or certain set of tobiko tests).' type: boolean + resources: + default: + limits: + cpu: 4000m + memory: 4Gi + requests: + cpu: 2000m + memory: 2Gi + description: The desired amount of resources that should be assigned + to each test pod spawned using the AnsibleTest CR. https://pkg.go.dev/k8s.io/api/core/v1#ResourceRequirements + properties: + claims: + description: "Claims lists the names of resources, defined in + spec.resourceClaims, that are used by this container. \n This + is an alpha field and requires enabling the DynamicResourceAllocation + feature gate. \n This field is immutable. It can only be set + for containers." + items: + description: ResourceClaim references one entry in PodSpec.ResourceClaims. + properties: + name: + description: Name must match the name of one entry in pod.spec.resourceClaims + of the Pod where this field is used. It makes that resource + available inside a container. + type: string + required: + - name + type: object + type: array + x-kubernetes-list-map-keys: + - name + x-kubernetes-list-type: map + limits: + additionalProperties: + anyOf: + - type: integer + - type: string + pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ + x-kubernetes-int-or-string: true + description: 'Limits describes the maximum amount of compute resources + allowed. More info: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/' + type: object + requests: + additionalProperties: + anyOf: + - type: integer + - type: string + pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ + x-kubernetes-int-or-string: true + description: 'Requests describes the minimum amount of compute + resources required. If Requests is omitted for a container, + it defaults to Limits if that is explicitly specified, otherwise + to an implementation-defined value. Requests cannot exceed Limits. + More info: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/' + type: object + type: object storageClass: default: local-storage description: StorageClass used to create any test-operator related @@ -290,6 +346,64 @@ spec: test-operator functionalities to work properly (e.g.: extraRPMs in Tempest CR, or certain set of tobiko tests).' type: boolean + resources: + default: + limits: + cpu: 2000m + memory: 2Gi + requests: + cpu: 1000m + memory: 2Gi + description: The desired amount of resources that should be + assigned to each test pod spawned using the AnsibleTest CR. + https://pkg.go.dev/k8s.io/api/core/v1#ResourceRequirements + properties: + claims: + description: "Claims lists the names of resources, defined + in spec.resourceClaims, that are used by this container. + \n This is an alpha field and requires enabling the DynamicResourceAllocation + feature gate. \n This field is immutable. It can only + be set for containers." + items: + description: ResourceClaim references one entry in PodSpec.ResourceClaims. + properties: + name: + description: Name must match the name of one entry + in pod.spec.resourceClaims of the Pod where this + field is used. It makes that resource available + inside a container. + type: string + required: + - name + type: object + type: array + x-kubernetes-list-map-keys: + - name + x-kubernetes-list-type: map + limits: + additionalProperties: + anyOf: + - type: integer + - type: string + pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ + x-kubernetes-int-or-string: true + description: 'Limits describes the maximum amount of compute + resources allowed. More info: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/' + type: object + requests: + additionalProperties: + anyOf: + - type: integer + - type: string + pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ + x-kubernetes-int-or-string: true + description: 'Requests describes the minimum amount of compute + resources required. If Requests is omitted for a container, + it defaults to Limits if that is explicitly specified, + otherwise to an implementation-defined value. Requests + cannot exceed Limits. More info: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/' + type: object + type: object stepName: description: Name of a workflow step. The step name will be used for example to create a logs directory. diff --git a/config/crd/bases/test.openstack.org_horizontests.yaml b/config/crd/bases/test.openstack.org_horizontests.yaml index 46eae217..b7e9aa57 100644 --- a/config/crd/bases/test.openstack.org_horizontests.yaml +++ b/config/crd/bases/test.openstack.org_horizontests.yaml @@ -167,6 +167,62 @@ spec: default: https://review.opendev.org/openstack/horizon description: RepoUrl is the URL of the Horizon repository. type: string + resources: + default: + limits: + cpu: 2000m + memory: 4Gi + requests: + cpu: 1000m + memory: 2Gi + description: The desired amount of resources that should be assigned + to each test pod spawned using the HorizonTest CR. https://pkg.go.dev/k8s.io/api/core/v1#ResourceRequirements + properties: + claims: + description: "Claims lists the names of resources, defined in + spec.resourceClaims, that are used by this container. \n This + is an alpha field and requires enabling the DynamicResourceAllocation + feature gate. \n This field is immutable. It can only be set + for containers." + items: + description: ResourceClaim references one entry in PodSpec.ResourceClaims. + properties: + name: + description: Name must match the name of one entry in pod.spec.resourceClaims + of the Pod where this field is used. It makes that resource + available inside a container. + type: string + required: + - name + type: object + type: array + x-kubernetes-list-map-keys: + - name + x-kubernetes-list-type: map + limits: + additionalProperties: + anyOf: + - type: integer + - type: string + pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ + x-kubernetes-int-or-string: true + description: 'Limits describes the maximum amount of compute resources + allowed. More info: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/' + type: object + requests: + additionalProperties: + anyOf: + - type: integer + - type: string + pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ + x-kubernetes-int-or-string: true + description: 'Requests describes the minimum amount of compute + resources required. If Requests is omitted for a container, + it defaults to Limits if that is explicitly specified, otherwise + to an implementation-defined value. Requests cannot exceed Limits. + More info: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/' + type: object + type: object storageClass: default: local-storage description: StorageClass used to create any test-operator related diff --git a/config/crd/bases/test.openstack.org_tempests.yaml b/config/crd/bases/test.openstack.org_tempests.yaml index 5ee54c99..f7cc4318 100644 --- a/config/crd/bases/test.openstack.org_tempests.yaml +++ b/config/crd/bases/test.openstack.org_tempests.yaml @@ -149,6 +149,62 @@ spec: to work properly (e.g.: extraRPMs in Tempest CR, or certain set of tobiko tests).' type: boolean + resources: + default: + limits: + cpu: 8000m + memory: 4Gi + requests: + cpu: 4000m + memory: 2Gi + description: The desired amount of resources that should be assigned + to each test pod spawned using the Tempest CR. https://pkg.go.dev/k8s.io/api/core/v1#ResourceRequirements + properties: + claims: + description: "Claims lists the names of resources, defined in + spec.resourceClaims, that are used by this container. \n This + is an alpha field and requires enabling the DynamicResourceAllocation + feature gate. \n This field is immutable. It can only be set + for containers." + items: + description: ResourceClaim references one entry in PodSpec.ResourceClaims. + properties: + name: + description: Name must match the name of one entry in pod.spec.resourceClaims + of the Pod where this field is used. It makes that resource + available inside a container. + type: string + required: + - name + type: object + type: array + x-kubernetes-list-map-keys: + - name + x-kubernetes-list-type: map + limits: + additionalProperties: + anyOf: + - type: integer + - type: string + pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ + x-kubernetes-int-or-string: true + description: 'Limits describes the maximum amount of compute resources + allowed. More info: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/' + type: object + requests: + additionalProperties: + anyOf: + - type: integer + - type: string + pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ + x-kubernetes-int-or-string: true + description: 'Requests describes the minimum amount of compute + resources required. If Requests is omitted for a container, + it defaults to Limits if that is explicitly specified, otherwise + to an implementation-defined value. Requests cannot exceed Limits. + More info: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/' + type: object + type: object storageClass: default: local-storage description: StorageClass used to create any test-operator related @@ -584,6 +640,63 @@ spec: test-operator functionalities to work properly (e.g.: extraRPMs in Tempest CR, or certain set of tobiko tests).' type: boolean + resources: + default: + limits: + cpu: 8000m + memory: 4Gi + requests: + cpu: 4000m + memory: 2Gi + description: The desired amount of resources that should be + assigned to each test pod spawned using the Tempest CR. https://pkg.go.dev/k8s.io/api/core/v1#ResourceRequirements + properties: + claims: + description: "Claims lists the names of resources, defined + in spec.resourceClaims, that are used by this container. + \n This is an alpha field and requires enabling the DynamicResourceAllocation + feature gate. \n This field is immutable. It can only + be set for containers." + items: + description: ResourceClaim references one entry in PodSpec.ResourceClaims. + properties: + name: + description: Name must match the name of one entry + in pod.spec.resourceClaims of the Pod where this + field is used. It makes that resource available + inside a container. + type: string + required: + - name + type: object + type: array + x-kubernetes-list-map-keys: + - name + x-kubernetes-list-type: map + limits: + additionalProperties: + anyOf: + - type: integer + - type: string + pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ + x-kubernetes-int-or-string: true + description: 'Limits describes the maximum amount of compute + resources allowed. More info: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/' + type: object + requests: + additionalProperties: + anyOf: + - type: integer + - type: string + pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ + x-kubernetes-int-or-string: true + description: 'Requests describes the minimum amount of compute + resources required. If Requests is omitted for a container, + it defaults to Limits if that is explicitly specified, + otherwise to an implementation-defined value. Requests + cannot exceed Limits. More info: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/' + type: object + type: object stepName: description: Name of a workflow step. The step name will be used for example to create a logs directory. diff --git a/config/crd/bases/test.openstack.org_tobikoes.yaml b/config/crd/bases/test.openstack.org_tobikoes.yaml index 35f4dd8a..96e5f549 100644 --- a/config/crd/bases/test.openstack.org_tobikoes.yaml +++ b/config/crd/bases/test.openstack.org_tobikoes.yaml @@ -111,7 +111,7 @@ spec: to test pods spawned by the test operator. type: object numProcesses: - default: 0 + default: 4 description: Number of processes/workers used to run tobiko tests - value 0 results in automatic decission type: integer @@ -149,6 +149,57 @@ spec: description: String including any options to pass to pytest when it runs tobiko tests type: string + resources: + description: 'The desired amount of resources that should be assigned + to each test pod spawned using the Tobiko CR. https://pkg.go.dev/k8s.io/api/core/v1#ResourceRequirements + kubebuilder:default:={limits: {cpu: "8000m", memory: "8Gi"}, requests: + {cpu: "4000m", memory: "4Gi"}}' + properties: + claims: + description: "Claims lists the names of resources, defined in + spec.resourceClaims, that are used by this container. \n This + is an alpha field and requires enabling the DynamicResourceAllocation + feature gate. \n This field is immutable. It can only be set + for containers." + items: + description: ResourceClaim references one entry in PodSpec.ResourceClaims. + properties: + name: + description: Name must match the name of one entry in pod.spec.resourceClaims + of the Pod where this field is used. It makes that resource + available inside a container. + type: string + required: + - name + type: object + type: array + x-kubernetes-list-map-keys: + - name + x-kubernetes-list-type: map + limits: + additionalProperties: + anyOf: + - type: integer + - type: string + pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ + x-kubernetes-int-or-string: true + description: 'Limits describes the maximum amount of compute resources + allowed. More info: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/' + type: object + requests: + additionalProperties: + anyOf: + - type: integer + - type: string + pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ + x-kubernetes-int-or-string: true + description: 'Requests describes the minimum amount of compute + resources required. If Requests is omitted for a container, + it defaults to Limits if that is explicitly specified, otherwise + to an implementation-defined value. Requests cannot exceed Limits. + More info: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/' + type: object + type: object storageClass: default: local-storage description: StorageClass used to create any test-operator related @@ -292,6 +343,58 @@ spec: description: String including any options to pass to pytest when it runs tobiko tests type: string + resources: + description: 'The desired amount of resources that should be + assigned to each test pod spawned using the Tobiko CR. https://pkg.go.dev/k8s.io/api/core/v1#ResourceRequirements + kubebuilder:default:={limits: {cpu: "8000m", memory: "8Gi"}, + requests: {cpu: "4000m", memory: "4Gi"}}' + properties: + claims: + description: "Claims lists the names of resources, defined + in spec.resourceClaims, that are used by this container. + \n This is an alpha field and requires enabling the DynamicResourceAllocation + feature gate. \n This field is immutable. It can only + be set for containers." + items: + description: ResourceClaim references one entry in PodSpec.ResourceClaims. + properties: + name: + description: Name must match the name of one entry + in pod.spec.resourceClaims of the Pod where this + field is used. It makes that resource available + inside a container. + type: string + required: + - name + type: object + type: array + x-kubernetes-list-map-keys: + - name + x-kubernetes-list-type: map + limits: + additionalProperties: + anyOf: + - type: integer + - type: string + pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ + x-kubernetes-int-or-string: true + description: 'Limits describes the maximum amount of compute + resources allowed. More info: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/' + type: object + requests: + additionalProperties: + anyOf: + - type: integer + - type: string + pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ + x-kubernetes-int-or-string: true + description: 'Requests describes the minimum amount of compute + resources required. If Requests is omitted for a container, + it defaults to Limits if that is explicitly specified, + otherwise to an implementation-defined value. Requests + cannot exceed Limits. More info: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/' + type: object + type: object stepName: default: "" description: A parameter that contains a definition of a single diff --git a/config/manifests/bases/test-operator.clusterserviceversion.yaml b/config/manifests/bases/test-operator.clusterserviceversion.yaml index 0ba88774..bc5e224e 100644 --- a/config/manifests/bases/test-operator.clusterserviceversion.yaml +++ b/config/manifests/bases/test-operator.clusterserviceversion.yaml @@ -398,6 +398,11 @@ spec: - description: A content of exclude.txt file that is passed to tempest via --exclude-list displayName: Exclude List path: tempestRun.excludeList + - description: The expectedFailuresList parameter contains tests that should + not count as failures. When a test from this list fails, the test pod ends + with Completed state rather than with Error state. + displayName: Expected Failures List + path: tempestRun.expectedFailuresList - description: ExternalPlugin contains information about plugin that should be installed within the tempest test pod. If this option is specified then only tests that are part of the external plugin can be executed. @@ -662,6 +667,11 @@ spec: - description: A content of exclude.txt file that is passed to tempest via --exclude-list displayName: Exclude List path: workflow[0].tempestRun.excludeList + - description: The expectedFailuresList parameter contains tests that should + not count as failures. When a test from this list fails, the test pod ends + with Completed state rather than with Error state. + displayName: Expected Failures List + path: workflow[0].tempestRun.expectedFailuresList - description: ExternalPlugin contains information about plugin that should be installed within the tempest test pod. If this option is specified then only tests that are part of the external plugin can be executed. diff --git a/controllers/ansibletest_controller.go b/controllers/ansibletest_controller.go index c31ccc5a..b80d5849 100644 --- a/controllers/ansibletest_controller.go +++ b/controllers/ansibletest_controller.go @@ -234,6 +234,10 @@ func (r *AnsibleTestReconciler) Reconcile(ctx context.Context, req ctrl.Request) if instance.Spec.Workflow[nextWorkflowStep].SELinuxLevel != nil { instance.Spec.SELinuxLevel = *instance.Spec.Workflow[nextWorkflowStep].SELinuxLevel } + + if instance.Spec.Workflow[nextWorkflowStep].Resources != nil { + instance.Spec.Resources = *instance.Spec.Workflow[nextWorkflowStep].Resources + } } // Service account, role, binding diff --git a/controllers/tempest_controller.go b/controllers/tempest_controller.go index d82ff242..512e6a0f 100644 --- a/controllers/tempest_controller.go +++ b/controllers/tempest_controller.go @@ -354,6 +354,10 @@ func (r *TempestReconciler) Reconcile(ctx context.Context, req ctrl.Request) (re if instance.Spec.Workflow[nextWorkflowStep].SELinuxLevel != nil { instance.Spec.SELinuxLevel = *instance.Spec.Workflow[nextWorkflowStep].SELinuxLevel } + + if instance.Spec.Workflow[nextWorkflowStep].Resources != nil { + instance.Spec.Resources = *instance.Spec.Workflow[nextWorkflowStep].Resources + } } jobDef := tempest.Job( diff --git a/controllers/tobiko_controller.go b/controllers/tobiko_controller.go index ee602985..7d1e9e46 100644 --- a/controllers/tobiko_controller.go +++ b/controllers/tobiko_controller.go @@ -405,6 +405,10 @@ func (r *TobikoReconciler) PrepareTobikoEnvVars( if instance.Spec.Workflow[step].SELinuxLevel != nil { instance.Spec.SELinuxLevel = *instance.Spec.Workflow[step].SELinuxLevel } + + if instance.Spec.Workflow[step].Resources != nil { + instance.Spec.Resources = *instance.Spec.Workflow[step].Resources + } } // Prepare env vars diff --git a/pkg/ansibletest/job.go b/pkg/ansibletest/job.go index b88e9aab..f8263937 100644 --- a/pkg/ansibletest/job.go +++ b/pkg/ansibletest/job.go @@ -64,6 +64,7 @@ func Job( Env: env.MergeEnvs([]corev1.EnvVar{}, envVars), VolumeMounts: GetVolumeMounts(mountCerts, instance, externalWorkflowCounter), SecurityContext: &securityContext, + Resources: instance.Spec.Resources, }, }, Volumes: GetVolumes( diff --git a/pkg/horizontest/job.go b/pkg/horizontest/job.go index 5a9123d5..86eb6334 100644 --- a/pkg/horizontest/job.go +++ b/pkg/horizontest/job.go @@ -63,6 +63,7 @@ func Job( Env: env.MergeEnvs([]corev1.EnvVar{}, envVars), VolumeMounts: GetVolumeMounts(mountCerts, mountKeys, mountKubeconfig, instance), SecurityContext: &securityContext, + Resources: instance.Spec.Resources, }, }, Volumes: GetVolumes( diff --git a/pkg/tempest/job.go b/pkg/tempest/job.go index 6e73a112..70aefb84 100644 --- a/pkg/tempest/job.go +++ b/pkg/tempest/job.go @@ -60,6 +60,7 @@ func Job( Env: env.MergeEnvs([]corev1.EnvVar{}, envVars), VolumeMounts: GetVolumeMounts(mountCerts, mountSSHKey, instance), SecurityContext: &securityContext, + Resources: instance.Spec.Resources, EnvFrom: []corev1.EnvFromSource{ { ConfigMapRef: &corev1.ConfigMapEnvSource{ diff --git a/pkg/tobiko/job.go b/pkg/tobiko/job.go index 21c2f971..a2653258 100644 --- a/pkg/tobiko/job.go +++ b/pkg/tobiko/job.go @@ -68,6 +68,7 @@ func Job( Env: env.MergeEnvs([]corev1.EnvVar{}, envVars), VolumeMounts: GetVolumeMounts(mountCerts, mountKeys, mountKubeconfig, instance), SecurityContext: &securityContext, + Resources: instance.Spec.Resources, }, }, Volumes: GetVolumes(