From 34deecb9ff66706760d2143c849b0436071c061b Mon Sep 17 00:00:00 2001 From: afazekas Date: Wed, 20 Sep 2023 11:39:00 +0200 Subject: [PATCH] Remove TempestRegexp argument Looks like it was not in use since the begning. Users usually finds simpler to have explicit negative list, even tough it is possible to consutuct a singe regexp. Also possible to construct a single regexp on the operator side, in case other way of passing would be prefered later on. Moving the default allowedTests to the defaults. Note: Consider moving the tempest run arguments to sub structure. --- api/bases/test.openstack.org_tempests.yaml | 5 ++--- api/v1beta1/tempest_types.go | 5 +---- config/crd/bases/test.openstack.org_tempests.yaml | 5 ++--- pkg/tempest/job.go | 14 +++----------- templates/tempest/config/include.txt | 2 -- 5 files changed, 8 insertions(+), 23 deletions(-) diff --git a/api/bases/test.openstack.org_tempests.yaml b/api/bases/test.openstack.org_tempests.yaml index 5c0e6dee..8b44cec2 100644 --- a/api/bases/test.openstack.org_tempests.yaml +++ b/api/bases/test.openstack.org_tempests.yaml @@ -36,6 +36,8 @@ spec: description: TempestSpec defines the desired state of Tempest properties: allowedTests: + default: + - tempest.api.identity.v3 description: AllowedTests items: type: string @@ -119,9 +121,6 @@ spec: items: type: string type: array - tempestRegex: - description: TempestRegex - type: string required: - containerImage - openStackConfigMap diff --git a/api/v1beta1/tempest_types.go b/api/v1beta1/tempest_types.go index 31687636..5fa577fd 100644 --- a/api/v1beta1/tempest_types.go +++ b/api/v1beta1/tempest_types.go @@ -64,10 +64,7 @@ type TempestSpec struct { ExternalEndpoints []MetalLBConfig `json:"externalEndpoints,omitempty"` // +kubebuilder:validation:Optional - // TempestRegex - TempestRegex string `json:"tempestRegex,omitempty"` - - // +kubebuilder:validation:Optional + // +kubebuilder:default={"tempest.api.identity.v3"} // AllowedTests AllowedTests []string `json:"allowedTests,omitempty"` diff --git a/config/crd/bases/test.openstack.org_tempests.yaml b/config/crd/bases/test.openstack.org_tempests.yaml index 5c0e6dee..8b44cec2 100644 --- a/config/crd/bases/test.openstack.org_tempests.yaml +++ b/config/crd/bases/test.openstack.org_tempests.yaml @@ -36,6 +36,8 @@ spec: description: TempestSpec defines the desired state of Tempest properties: allowedTests: + default: + - tempest.api.identity.v3 description: AllowedTests items: type: string @@ -119,9 +121,6 @@ spec: items: type: string type: array - tempestRegex: - description: TempestRegex - type: string required: - containerImage - openStackConfigMap diff --git a/pkg/tempest/job.go b/pkg/tempest/job.go index 8b2b114e..6117c98e 100644 --- a/pkg/tempest/job.go +++ b/pkg/tempest/job.go @@ -19,14 +19,6 @@ func Job( runAsUser := int64(42480) runAsGroup := int64(42480) - args := []string{ - "/var/lib/tempest/run_tempest.sh", - } - if instance.Spec.TempestRegex != "" { - args = append(args, "--regex") - args = append(args, instance.Spec.TempestRegex) - } - job := &batchv1.Job{ ObjectMeta: metav1.ObjectMeta{ Name: instance.Name, @@ -40,9 +32,9 @@ func Job( RestartPolicy: corev1.RestartPolicyNever, ServiceAccountName: instance.RbacResourceName(), SecurityContext: &corev1.PodSecurityContext{ - RunAsUser: &runAsUser, + RunAsUser: &runAsUser, RunAsGroup: &runAsGroup, - FSGroup: &runAsGroup, + FSGroup: &runAsGroup, }, Containers: []corev1.Container{ { @@ -51,7 +43,7 @@ func Job( Command: []string{ "/usr/local/bin/container-scripts/invoke_tempest", }, - Args: []string{}, + Args: []string{}, Env: env.MergeEnvs([]corev1.EnvVar{}, envVars), VolumeMounts: GetVolumeMounts(), }, diff --git a/templates/tempest/config/include.txt b/templates/tempest/config/include.txt index c36fd885..3a4f8979 100644 --- a/templates/tempest/config/include.txt +++ b/templates/tempest/config/include.txt @@ -1,5 +1,3 @@ {{range $val := .AllowedTests }} {{$val}} -{{ else }} -tempest.api.identity.v3 {{end}}