Skip to content

Commit 6251440

Browse files
committed
[Tempest][Tobiko] Add nodeSelector and Tolerations
This patch adds support for specifying tolerations and nodeSelector in both the Tempest and the Tobiko CR.
1 parent fabc0f5 commit 6251440

12 files changed

+505
-20
lines changed

api/bases/test.openstack.org_tempests.yaml

Lines changed: 88 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -74,8 +74,8 @@ spec:
7474
nodeSelector:
7575
additionalProperties:
7676
type: string
77-
description: NodeSelector to target subset of worker nodes running
78-
this service
77+
description: This value contains a nodeSelector value that is applied
78+
to test pods spawned by the test operator.
7979
type: object
8080
openStackConfigMap:
8181
default: openstack-config
@@ -373,6 +373,47 @@ spec:
373373
required:
374374
- timeout
375375
type: object
376+
tolerations:
377+
description: This value contains a toleration that is applied to pods
378+
spawned by the test pods that are spawned by the test-operator.
379+
items:
380+
description: The pod this Toleration is attached to tolerates any
381+
taint that matches the triple <key,value,effect> using the matching
382+
operator <operator>.
383+
properties:
384+
effect:
385+
description: Effect indicates the taint effect to match. Empty
386+
means match all taint effects. When specified, allowed values
387+
are NoSchedule, PreferNoSchedule and NoExecute.
388+
type: string
389+
key:
390+
description: Key is the taint key that the toleration applies
391+
to. Empty means match all taint keys. If the key is empty,
392+
operator must be Exists; this combination means to match all
393+
values and all keys.
394+
type: string
395+
operator:
396+
description: Operator represents a key's relationship to the
397+
value. Valid operators are Exists and Equal. Defaults to Equal.
398+
Exists is equivalent to wildcard for value, so that a pod
399+
can tolerate all taints of a particular category.
400+
type: string
401+
tolerationSeconds:
402+
description: TolerationSeconds represents the period of time
403+
the toleration (which must be of effect NoExecute, otherwise
404+
this field is ignored) tolerates the taint. By default, it
405+
is not set, which means tolerate the taint forever (do not
406+
evict). Zero and negative values will be treated as 0 (evict
407+
immediately) by the system.
408+
format: int64
409+
type: integer
410+
value:
411+
description: Value is the taint value the toleration matches
412+
to. If the operator is Exists, the value should be empty,
413+
otherwise just a regular string.
414+
type: string
415+
type: object
416+
type: array
376417
workflow:
377418
description: Workflow - can be used to specify a multiple executions
378419
of tempest with a different configuration in a single CR. Accepts
@@ -416,8 +457,8 @@ spec:
416457
nodeSelector:
417458
additionalProperties:
418459
type: string
419-
description: NodeSelector to target subset of worker nodes running
420-
this service
460+
description: This value contains a nodeSelector value that is
461+
applied to test pods spawned by the test operator.
421462
type: object
422463
openStackConfigMap:
423464
description: OpenStackConfigMap is the name of the ConfigMap
@@ -687,6 +728,49 @@ spec:
687728
be executed with --verbose
688729
type: boolean
689730
type: object
731+
tolerations:
732+
description: This value contains a toleration that is applied
733+
to pods spawned by the test pods that are spawned by the test-operator.
734+
items:
735+
description: The pod this Toleration is attached to tolerates
736+
any taint that matches the triple <key,value,effect> using
737+
the matching operator <operator>.
738+
properties:
739+
effect:
740+
description: Effect indicates the taint effect to match.
741+
Empty means match all taint effects. When specified,
742+
allowed values are NoSchedule, PreferNoSchedule and
743+
NoExecute.
744+
type: string
745+
key:
746+
description: Key is the taint key that the toleration
747+
applies to. Empty means match all taint keys. If the
748+
key is empty, operator must be Exists; this combination
749+
means to match all values and all keys.
750+
type: string
751+
operator:
752+
description: Operator represents a key's relationship
753+
to the value. Valid operators are Exists and Equal.
754+
Defaults to Equal. Exists is equivalent to wildcard
755+
for value, so that a pod can tolerate all taints of
756+
a particular category.
757+
type: string
758+
tolerationSeconds:
759+
description: TolerationSeconds represents the period of
760+
time the toleration (which must be of effect NoExecute,
761+
otherwise this field is ignored) tolerates the taint.
762+
By default, it is not set, which means tolerate the
763+
taint forever (do not evict). Zero and negative values
764+
will be treated as 0 (evict immediately) by the system.
765+
format: int64
766+
type: integer
767+
value:
768+
description: Value is the taint value the toleration matches
769+
to. If the operator is Exists, the value should be empty,
770+
otherwise just a regular string.
771+
type: string
772+
type: object
773+
type: array
690774
required:
691775
- stepName
692776
type: object

api/bases/test.openstack.org_tobikoes.yaml

Lines changed: 97 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ apiVersion: apiextensions.k8s.io/v1
33
kind: CustomResourceDefinition
44
metadata:
55
annotations:
6-
controller-gen.kubebuilder.io/version: v0.10.0
6+
controller-gen.kubebuilder.io/version: v0.11.1
77
creationTimestamp: null
88
name: tobikoes.test.openstack.org
99
spec:
@@ -58,6 +58,12 @@ spec:
5858
description: Name of a secret that contains a kubeconfig. The kubeconfig
5959
is mounted under /var/lib/tobiko/.kube/config in the test pod.
6060
type: string
61+
nodeSelector:
62+
additionalProperties:
63+
type: string
64+
description: This value contains a nodeSelector value that is applied
65+
to test pods spawned by the test operator.
66+
type: object
6167
numProcesses:
6268
default: 0
6369
description: Number of processes/workers used to run tobiko tests
@@ -93,6 +99,47 @@ spec:
9399
default: py3
94100
description: Test environment
95101
type: string
102+
tolerations:
103+
description: This value contains a toleration that is applied to pods
104+
spawned by the test pods that are spawned by the test-operator.
105+
items:
106+
description: The pod this Toleration is attached to tolerates any
107+
taint that matches the triple <key,value,effect> using the matching
108+
operator <operator>.
109+
properties:
110+
effect:
111+
description: Effect indicates the taint effect to match. Empty
112+
means match all taint effects. When specified, allowed values
113+
are NoSchedule, PreferNoSchedule and NoExecute.
114+
type: string
115+
key:
116+
description: Key is the taint key that the toleration applies
117+
to. Empty means match all taint keys. If the key is empty,
118+
operator must be Exists; this combination means to match all
119+
values and all keys.
120+
type: string
121+
operator:
122+
description: Operator represents a key's relationship to the
123+
value. Valid operators are Exists and Equal. Defaults to Equal.
124+
Exists is equivalent to wildcard for value, so that a pod
125+
can tolerate all taints of a particular category.
126+
type: string
127+
tolerationSeconds:
128+
description: TolerationSeconds represents the period of time
129+
the toleration (which must be of effect NoExecute, otherwise
130+
this field is ignored) tolerates the taint. By default, it
131+
is not set, which means tolerate the taint forever (do not
132+
evict). Zero and negative values will be treated as 0 (evict
133+
immediately) by the system.
134+
format: int64
135+
type: integer
136+
value:
137+
description: Value is the taint value the toleration matches
138+
to. If the operator is Exists, the value should be empty,
139+
otherwise just a regular string.
140+
type: string
141+
type: object
142+
type: array
96143
version:
97144
default: ""
98145
description: Tobiko version
@@ -120,6 +167,12 @@ spec:
120167
kubeconfig is mounted under /var/lib/tobiko/.kube/config in
121168
the test pod.
122169
type: string
170+
nodeSelector:
171+
additionalProperties:
172+
type: string
173+
description: This value contains a nodeSelector value that is
174+
applied to test pods spawned by the test operator.
175+
type: object
123176
numProcesses:
124177
description: Number of processes/workers used to run tobiko
125178
tests - value 0 results in automatic decission
@@ -150,6 +203,49 @@ spec:
150203
testenv:
151204
description: Test environment
152205
type: string
206+
tolerations:
207+
description: This value contains a toleration that is applied
208+
to pods spawned by the test pods that are spawned by the test-operator.
209+
items:
210+
description: The pod this Toleration is attached to tolerates
211+
any taint that matches the triple <key,value,effect> using
212+
the matching operator <operator>.
213+
properties:
214+
effect:
215+
description: Effect indicates the taint effect to match.
216+
Empty means match all taint effects. When specified,
217+
allowed values are NoSchedule, PreferNoSchedule and
218+
NoExecute.
219+
type: string
220+
key:
221+
description: Key is the taint key that the toleration
222+
applies to. Empty means match all taint keys. If the
223+
key is empty, operator must be Exists; this combination
224+
means to match all values and all keys.
225+
type: string
226+
operator:
227+
description: Operator represents a key's relationship
228+
to the value. Valid operators are Exists and Equal.
229+
Defaults to Equal. Exists is equivalent to wildcard
230+
for value, so that a pod can tolerate all taints of
231+
a particular category.
232+
type: string
233+
tolerationSeconds:
234+
description: TolerationSeconds represents the period of
235+
time the toleration (which must be of effect NoExecute,
236+
otherwise this field is ignored) tolerates the taint.
237+
By default, it is not set, which means tolerate the
238+
taint forever (do not evict). Zero and negative values
239+
will be treated as 0 (evict immediately) by the system.
240+
format: int64
241+
type: integer
242+
value:
243+
description: Value is the taint value the toleration matches
244+
to. If the operator is Exists, the value should be empty,
245+
otherwise just a regular string.
246+
type: string
247+
type: object
248+
type: array
153249
version:
154250
description: Tobiko version
155251
type: string

api/v1beta1/tempest_types.go

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ package v1beta1
2525

2626
import (
2727
"github.com/openstack-k8s-operators/lib-common/modules/common/condition"
28+
corev1 "k8s.io/api/core/v1"
2829
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
2930
)
3031

@@ -346,9 +347,15 @@ type TempestSpec struct {
346347
Parallel bool `json:"parallel,omitempty"`
347348

348349
// +kubebuilder:validation:Optional
349-
// NodeSelector to target subset of worker nodes running this service
350+
// This value contains a nodeSelector value that is applied to test pods
351+
// spawned by the test operator.
350352
NodeSelector map[string]string `json:"nodeSelector,omitempty"`
351353

354+
// +kubebuilder:validation:Optional
355+
// This value contains a toleration that is applied to pods spawned by the
356+
// test pods that are spawned by the test-operator.
357+
Tolerations []corev1.Toleration `json:"tolerations,omitempty"`
358+
352359
// +kubebuilder:validation:Required
353360
// +kubebuilder:default=openstack-config
354361
// OpenStackConfigMap is the name of the ConfigMap containing the clouds.yaml

api/v1beta1/tempest_types_workflow.go

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,10 @@ limitations under the License.
1616

1717
package v1beta1
1818

19+
import (
20+
corev1 "k8s.io/api/core/v1"
21+
)
22+
1923
// TempestRunSpec - is used to configure execution of tempest. Please refer to
2024
// Please refer to https://docs.openstack.org/tempest/latest/ for the further
2125
// explanation of the CLI parameters.
@@ -205,9 +209,16 @@ type WorkflowTempestSpec struct {
205209
Parallel *bool `json:"parallel,omitempty"`
206210

207211
// +kubebuilder:validation:Optional
208-
// NodeSelector to target subset of worker nodes running this service
212+
// This value contains a nodeSelector value that is applied to test pods
213+
// spawned by the test operator.
209214
NodeSelector *map[string]string `json:"nodeSelector,omitempty"`
210215

216+
// +kubebuilder:validation:Optional
217+
// This value contains a toleration that is applied to pods spawned by the
218+
// test pods that are spawned by the test-operator.
219+
Tolerations *[]corev1.Toleration `json:"tolerations,omitempty"`
220+
221+
211222
// +kubebuilder:validation:Optional
212223
// OpenStackConfigMap is the name of the ConfigMap containing the clouds.yaml
213224
OpenStackConfigMap *string `json:"openStackConfigMap"`

api/v1beta1/tobiko_types.go

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ package v1beta1
1818

1919
import (
2020
"github.com/openstack-k8s-operators/lib-common/modules/common/condition"
21+
corev1 "k8s.io/api/core/v1"
2122
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
2223
)
2324

@@ -41,6 +42,16 @@ type TobikoSpec struct {
4142
// StorageClass used to create PVCs that store the logs
4243
StorageClass string `json:"storageClass"`
4344

45+
// +kubebuilder:validation:Optional
46+
// This value contains a nodeSelector value that is applied to test pods
47+
// spawned by the test operator.
48+
NodeSelector map[string]string `json:"nodeSelector,omitempty"`
49+
50+
// +kubebuilder:validation:Optional
51+
// This value contains a toleration that is applied to pods spawned by the
52+
// test pods that are spawned by the test-operator.
53+
Tolerations []corev1.Toleration `json:"tolerations,omitempty"`
54+
4455
// +kubebuilder:validation:Optional
4556
// +kubebuilder:default:=true
4657
// Run tests in parallel
@@ -118,6 +129,16 @@ type TobikoWorkflowSpec struct {
118129
// StorageClass used to create PVCs that store the logs
119130
StorageClass string `json:"storageClass,omitempty"`
120131

132+
// +kubebuilder:validation:Optional
133+
// This value contains a nodeSelector value that is applied to test pods
134+
// spawned by the test operator.
135+
NodeSelector *map[string]string `json:"nodeSelector,omitempty"`
136+
137+
// +kubebuilder:validation:Optional
138+
// This value contains a toleration that is applied to pods spawned by the
139+
// test pods that are spawned by the test-operator.
140+
Tolerations *[]corev1.Toleration `json:"tolerations,omitempty"`
141+
121142
// +kubebuilder:validation:Optional
122143
// Run tests in parallel
123144
Debug bool `json:"debug,omitempty"`

0 commit comments

Comments
 (0)