Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PLZ: add tolerations #428

Open
wants to merge 6 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions api/v1alpha1/privateloadzone_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ import (
type PrivateLoadZoneSpec struct {
Token string `json:"token"`
Resources corev1.ResourceRequirements `json:"resources"`
Tolerations []corev1.Toleration `json:"tolerations,omitempty"`
ServiceAccountName string `json:"serviceAccountName,omitempty"`
NodeSelector map[string]string `json:"nodeSelector,omitempty"`
Image string `json:"image,omitempty"`
Expand Down
7 changes: 7 additions & 0 deletions api/v1alpha1/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 16 additions & 0 deletions charts/k6-operator/templates/crds/plz.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,22 @@ spec:
x-kubernetes-int-or-string: true
type: object
type: object
tolerations:
items:
properties:
effect:
type: string
key:
type: string
operator:
type: string
tolerationSeconds:
format: int64
type: integer
value:
type: string
type: object
type: array
serviceAccountName:
type: string
token:
Expand Down
16 changes: 16 additions & 0 deletions config/crd/bases/k6.io_privateloadzones.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,22 @@ spec:
type: string
token:
type: string
tolerations:
items:
properties:
effect:
type: string
key:
type: string
operator:
type: string
tolerationSeconds:
format: int64
type: integer
value:
type: string
type: object
type: array
required:
- resources
- token
Expand Down
2 changes: 2 additions & 0 deletions pkg/testrun/plz.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ func NewPLZTestRun(plz *v1alpha1.PrivateLoadZone, trData *cloud.TestRunData, ing
ServiceAccountName: plz.Spec.ServiceAccountName,
NodeSelector: plz.Spec.NodeSelector,
Resources: plz.Spec.Resources,
Tolerations: plz.Spec.Tolerations,
Volumes: []corev1.Volume{
volume,
},
Expand All @@ -66,6 +67,7 @@ func NewPLZTestRun(plz *v1alpha1.PrivateLoadZone, trData *cloud.TestRunData, ing
ServiceAccountName: plz.Spec.ServiceAccountName,
NodeSelector: plz.Spec.NodeSelector,
ImagePullSecrets: plz.Spec.ImagePullSecrets,
Tolerations: plz.Spec.Tolerations,
},
Script: v1alpha1.K6Script{
LocalFile: "/test/archive.tar",
Expand Down
11 changes: 11 additions & 0 deletions pkg/testrun/plz_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,14 @@ func Test_NewPLZTestRun(t *testing.T) {
corev1.ResourceCPU: resource.MustParse("200m"),
corev1.ResourceMemory: resource.MustParse("1G"),
}
tolerations = []corev1.Toleration{
{
Key: "someKey",
Operator: corev1.TolerationOpEqual,
Value: "someValue",
Effect: corev1.TaintEffectNoSchedule,
},
}
someTestRunID = 6543
someRunnerImage = "grafana/k6:0.52.0"
someInstances = 10
Expand All @@ -95,8 +103,10 @@ func Test_NewPLZTestRun(t *testing.T) {
optionalFieldsTestRun.Namespace = someNS
optionalFieldsTestRun.Spec.Runner.ServiceAccountName = someSA
optionalFieldsTestRun.Spec.Runner.NodeSelector = someNodeSelector
optionalFieldsTestRun.Spec.Runner.Tolerations = tolerations
optionalFieldsTestRun.Spec.Starter.ServiceAccountName = someSA
optionalFieldsTestRun.Spec.Starter.NodeSelector = someNodeSelector
optionalFieldsTestRun.Spec.Starter.Tolerations = tolerations

cloudFieldsTestRun = requiredFieldsTestRun // build up on top of required field case
cloudFieldsTestRun.ObjectMeta.Name = TestName(fmt.Sprintf("%d", someTestRunID))
Expand Down Expand Up @@ -166,6 +176,7 @@ func Test_NewPLZTestRun(t *testing.T) {
Resources: corev1.ResourceRequirements{
Limits: resourceLimits,
},
Tolerations: tolerations,
ServiceAccountName: someSA,
NodeSelector: someNodeSelector,
},
Expand Down
Loading