diff --git a/api/bases/test.openstack.org_ansibletests.yaml b/api/bases/test.openstack.org_ansibletests.yaml index 5a177047..1d129af4 100644 --- a/api/bases/test.openstack.org_ansibletests.yaml +++ b/api/bases/test.openstack.org_ansibletests.yaml @@ -152,6 +152,70 @@ spec: certain test-operator functionalities 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. + + + This is an alpha field and requires enabling the + DynamicResourceAllocation feature gate. + + + 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 @@ -298,6 +362,70 @@ spec: 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. + + + This is an alpha field and requires enabling the + DynamicResourceAllocation feature gate. + + + 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 diff --git a/api/bases/test.openstack.org_horizontests.yaml b/api/bases/test.openstack.org_horizontests.yaml index 243a1bf6..1a00b646 100644 --- a/api/bases/test.openstack.org_horizontests.yaml +++ b/api/bases/test.openstack.org_horizontests.yaml @@ -174,6 +174,70 @@ 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. + + + This is an alpha field and requires enabling the + DynamicResourceAllocation feature gate. + + + 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 81f54d1c..2c75fd4f 100644 --- a/api/bases/test.openstack.org_tempests.yaml +++ b/api/bases/test.openstack.org_tempests.yaml @@ -159,6 +159,70 @@ spec: certain 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. + + + This is an alpha field and requires enabling the + DynamicResourceAllocation feature gate. + + + 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 @@ -618,6 +682,70 @@ spec: 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. + + + This is an alpha field and requires enabling the + DynamicResourceAllocation feature gate. + + + 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 diff --git a/api/bases/test.openstack.org_tobikoes.yaml b/api/bases/test.openstack.org_tobikoes.yaml index 6b44c6e7..74c03b47 100644 --- a/api/bases/test.openstack.org_tobikoes.yaml +++ b/api/bases/test.openstack.org_tobikoes.yaml @@ -119,7 +119,7 @@ spec: 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 @@ -158,6 +158,70 @@ spec: description: String including any options to pass to pytest when it runs tobiko tests type: string + resources: + default: + limits: + cpu: 8000m + memory: 8Gi + requests: + cpu: 4000m + memory: 4Gi + 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 + properties: + claims: + description: |- + Claims lists the names of resources, defined in spec.resourceClaims, + that are used by this container. + + + This is an alpha field and requires enabling the + DynamicResourceAllocation feature gate. + + + 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 @@ -304,6 +368,70 @@ spec: description: String including any options to pass to pytest when it runs tobiko tests type: string + resources: + default: + limits: + cpu: 8000m + memory: 8Gi + requests: + cpu: 4000m + memory: 4Gi + 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 + properties: + claims: + description: |- + Claims lists the names of resources, defined in spec.resourceClaims, + that are used by this container. + + + This is an alpha field and requires enabling the + DynamicResourceAllocation feature gate. + + + 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..ab55044b 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"` + // +kubebuilder:default:={limits: {cpu: "4000m", memory: "4Gi"}, requests: {cpu: "2000m", memory: "2Gi"}} + // 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 + Resources corev1.ResourceRequirements `json:"resources,omitempty"` + // +operator-sdk:csv:customresourcedefinitions:type=spec // +kubebuilder:validation:Optional // +kubebuilder:default:="dataplane-ansible-ssh-private-key-secret" @@ -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..be92b775 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"` + // +kubebuilder:default:={limits: {cpu: "2000m", memory: "4Gi"}, requests: {cpu: "1000m", memory: "2Gi"}} + // 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 + 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..3204ec7e 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"` + // +kubebuilder:default:={limits: {cpu: "8000m", memory: "4Gi"}, requests: {cpu: "4000m", memory: "2Gi"}} + // 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 + 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..88a59618 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. @@ -228,6 +230,11 @@ type WorkflowTempestSpec struct { 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 // +kubebuilder:validation:Pattern:=^[a-z0-9] diff --git a/api/v1beta1/tobiko_types.go b/api/v1beta1/tobiko_types.go index c4ee8a16..dd68c4b6 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"` + // +kubebuilder:default:={limits: {cpu: "8000m", memory: "8Gi"}, requests: {cpu: "4000m", memory: "4Gi"}} + // 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 + 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"` + // +kubebuilder:default:={limits: {cpu: "8000m", memory: "8Gi"}, requests: {cpu: "4000m", memory: "4Gi"}} + // 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 + 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 0f397057..f03719d0 100644 --- a/api/v1beta1/zz_generated.deepcopy.go +++ b/api/v1beta1/zz_generated.deepcopy.go @@ -90,6 +90,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)) @@ -114,6 +115,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 5a177047..1d129af4 100644 --- a/config/crd/bases/test.openstack.org_ansibletests.yaml +++ b/config/crd/bases/test.openstack.org_ansibletests.yaml @@ -152,6 +152,70 @@ spec: certain test-operator functionalities 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. + + + This is an alpha field and requires enabling the + DynamicResourceAllocation feature gate. + + + 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 @@ -298,6 +362,70 @@ spec: 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. + + + This is an alpha field and requires enabling the + DynamicResourceAllocation feature gate. + + + 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 diff --git a/config/crd/bases/test.openstack.org_horizontests.yaml b/config/crd/bases/test.openstack.org_horizontests.yaml index 243a1bf6..1a00b646 100644 --- a/config/crd/bases/test.openstack.org_horizontests.yaml +++ b/config/crd/bases/test.openstack.org_horizontests.yaml @@ -174,6 +174,70 @@ 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. + + + This is an alpha field and requires enabling the + DynamicResourceAllocation feature gate. + + + 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 81f54d1c..2c75fd4f 100644 --- a/config/crd/bases/test.openstack.org_tempests.yaml +++ b/config/crd/bases/test.openstack.org_tempests.yaml @@ -159,6 +159,70 @@ spec: certain 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. + + + This is an alpha field and requires enabling the + DynamicResourceAllocation feature gate. + + + 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 @@ -618,6 +682,70 @@ spec: 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. + + + This is an alpha field and requires enabling the + DynamicResourceAllocation feature gate. + + + 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 diff --git a/config/crd/bases/test.openstack.org_tobikoes.yaml b/config/crd/bases/test.openstack.org_tobikoes.yaml index 6b44c6e7..74c03b47 100644 --- a/config/crd/bases/test.openstack.org_tobikoes.yaml +++ b/config/crd/bases/test.openstack.org_tobikoes.yaml @@ -119,7 +119,7 @@ spec: 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 @@ -158,6 +158,70 @@ spec: description: String including any options to pass to pytest when it runs tobiko tests type: string + resources: + default: + limits: + cpu: 8000m + memory: 8Gi + requests: + cpu: 4000m + memory: 4Gi + 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 + properties: + claims: + description: |- + Claims lists the names of resources, defined in spec.resourceClaims, + that are used by this container. + + + This is an alpha field and requires enabling the + DynamicResourceAllocation feature gate. + + + 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 @@ -304,6 +368,70 @@ spec: description: String including any options to pass to pytest when it runs tobiko tests type: string + resources: + default: + limits: + cpu: 8000m + memory: 8Gi + requests: + cpu: 4000m + memory: 4Gi + 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 + properties: + claims: + description: |- + Claims lists the names of resources, defined in spec.resourceClaims, + that are used by this container. + + + This is an alpha field and requires enabling the + DynamicResourceAllocation feature gate. + + + 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/samples/test_v1beta1_ansibletest.yaml b/config/samples/test_v1beta1_ansibletest.yaml index b9589e3e..30d8b5dc 100644 --- a/config/samples/test_v1beta1_ansibletest.yaml +++ b/config/samples/test_v1beta1_ansibletest.yaml @@ -33,6 +33,14 @@ spec: # of tobiko tests). # # privileged: false + + # resources: + # limits: + # cpu: 4000m + # memory: 4Gi + # requests: + # cpu: 2000m + # memory: 2Gi workflow: - stepName: beststep ansibleExtraVars: ' -e manual_run=false ' diff --git a/config/samples/test_v1beta1_horizontest.yaml b/config/samples/test_v1beta1_horizontest.yaml index a7fea88d..818ed7b4 100644 --- a/config/samples/test_v1beta1_horizontest.yaml +++ b/config/samples/test_v1beta1_horizontest.yaml @@ -67,3 +67,11 @@ spec: # of tobiko tests). # # privileged: false + + # resources: + # limits: + # cpu: 2000m + # memory: 4Gi + # requests: + # cpu: 1000m + # memory: 2Gi diff --git a/config/samples/test_v1beta1_tempest.yaml b/config/samples/test_v1beta1_tempest.yaml index dcce5ca8..78d6ec5c 100644 --- a/config/samples/test_v1beta1_tempest.yaml +++ b/config/samples/test_v1beta1_tempest.yaml @@ -38,6 +38,14 @@ spec: # or certain set tobiko tests). # # privileged: false + + # resources: + # limits: + # cpu: 8000m + # memory: 4Gi + # requests: + # cpu: 4000m + # memory: 2Gi tempestRun: # NOTE: All parameters have default values (use only when you want to override # the default behaviour) diff --git a/config/samples/test_v1beta1_tobiko.yaml b/config/samples/test_v1beta1_tobiko.yaml index 5de2a284..877e03b9 100644 --- a/config/samples/test_v1beta1_tobiko.yaml +++ b/config/samples/test_v1beta1_tobiko.yaml @@ -32,6 +32,13 @@ spec: # -m # --maxfail # --skipregex + # resources: + # limits: + # cpu: 8000m + # memory: 8Gi + # requests: + # cpu: 4000m + # memory: 4Gi testenv: py3 version: master config: | 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(