Skip to content

Commit

Permalink
Extend load test to cover Jobs
Browse files Browse the repository at this point in the history
  • Loading branch information
mm4tt committed Sep 16, 2019
1 parent 4c0b3af commit a57807c
Show file tree
Hide file tree
Showing 2 changed files with 168 additions and 0 deletions.
129 changes: 129 additions & 0 deletions clusterloader2/testing/load/config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
{{$ENABLE_PROMETHEUS_API_RESPONSIVENESS := DefaultParam .ENABLE_PROMETHEUS_API_RESPONSIVENESS false}}
{{$ENABLE_CONFIGMAPS := DefaultParam .ENABLE_CONFIGMAPS false}}
{{$ENABLE_DAEMONSETS := DefaultParam .ENABLE_DAEMONSETS false}}
{{$ENABLE_JOBS := DefaultParam .ENABLE_JOBS false}}
{{$ENABLE_SECRETS := DefaultParam .ENABLE_SECRETS false}}
{{$ENABLE_STATEFULSETS := DefaultParam .ENABLE_STATEFULSETS false}}
#Variables
Expand All @@ -35,6 +36,10 @@
{{$smallDeploymentsPerNamespace := SubtractInt $smallDeploymentsPerNamespace (IfThenElse $ENABLE_STATEFULSETS $SMALL_STATEFUL_SETS_PER_NAMESPACE 0)}}
{{$mediumDeploymentsPerNamespace := SubtractInt $mediumDeploymentsPerNamespace (IfThenElse $ENABLE_STATEFULSETS $MEDIUM_STATEFUL_SETS_PER_NAMESPACE 0)}}

# If Jobs are enabled reduce the number of small,medium,big deployments per namespace.
{{$smallDeploymentsPerNamespace := SubtractInt $smallDeploymentsPerNamespace (IfThenElse $ENABLE_JOBS 1 0)}}
{{$mediumDeploymentsPerNamespace := SubtractInt $mediumDeploymentsPerNamespace (IfThenElse $ENABLE_JOBS 1 0)}}
{{$bigDeploymentsPerNamespace := SubtractInt $bigDeploymentsPerNamespace (IfThenElse $ENABLE_JOBS 1 0)}}

name: load
automanagedNamespaces: {{$namespaces}}
Expand Down Expand Up @@ -153,6 +158,16 @@ steps:
labelSelector: group = load
operationTimeout: 15m
{{end}}
{{if $ENABLE_JOBS}}
- Identifier: WaitForRunningJobs
Method: WaitForControlledPodsRunning
Params:
action: start
apiVersion: batch/v1
kind: Job
labelSelector: group = load
operationTimeout: 15m
{{end}}

- name: Creating objects
phases:
Expand Down Expand Up @@ -256,6 +271,41 @@ steps:
ReplicasMin: {{$MEDIUM_GROUP_SIZE}}
ReplicasMax: {{$MEDIUM_GROUP_SIZE}}
{{end}}
{{if $ENABLE_JOBS}}
- namespaceRange:
min: 1
max: {{$namespaces}}
replicasPerNamespace: 1
tuningSet: RandomizedSaturationTimeLimited
objectBundle:
- basename: small-job
objectTemplatePath: job.yaml
templateFillMap:
ReplicasMin: {{$SMALL_GROUP_SIZE}}
ReplicasMax: {{$SMALL_GROUP_SIZE}}
- namespaceRange:
min: 1
max: {{$namespaces}}
replicasPerNamespace: 1
tuningSet: RandomizedSaturationTimeLimited
objectBundle:
- basename: medium-job
objectTemplatePath: job.yaml
templateFillMap:
ReplicasMin: {{$MEDIUM_GROUP_SIZE}}
ReplicasMax: {{$MEDIUM_GROUP_SIZE}}
- namespaceRange:
min: 1
max: {{$namespaces}}
replicasPerNamespace: 1
tuningSet: RandomizedSaturationTimeLimited
objectBundle:
- basename: big-job
objectTemplatePath: job.yaml
templateFillMap:
ReplicasMin: {{$BIG_GROUP_SIZE}}
ReplicasMax: {{$BIG_GROUP_SIZE}}
{{end}}

- name: Waiting for pods to be running
measurements:
Expand All @@ -275,6 +325,12 @@ steps:
Params:
action: gather
{{end}}
{{if $ENABLE_JOBS}}
- Identifier: WaitForRunningJobs
Method: WaitForControlledPodsRunning
Params:
action: gather
{{end}}

- name: Scaling and updating objects
phases:
Expand Down Expand Up @@ -350,6 +406,41 @@ steps:
templateFillMap:
Image: k8s.gcr.io/pause:3.1
{{end}}
{{if $ENABLE_JOBS}}
- namespaceRange:
min: 1
max: {{$namespaces}}
replicasPerNamespace: 1
tuningSet: RandomizedSaturationTimeLimited
objectBundle:
- basename: small-job
objectTemplatePath: job.yaml
templateFillMap:
ReplicasMin: {{MultiplyInt $SMALL_GROUP_SIZE 0.5}}
ReplicasMax: {{MultiplyInt $SMALL_GROUP_SIZE 1.5}}
- namespaceRange:
min: 1
max: {{$namespaces}}
replicasPerNamespace: 1
tuningSet: RandomizedSaturationTimeLimited
objectBundle:
- basename: medium-job
objectTemplatePath: job.yaml
templateFillMap:
ReplicasMin: {{MultiplyInt $MEDIUM_GROUP_SIZE 0.5}}
ReplicasMax: {{MultiplyInt $MEDIUM_GROUP_SIZE 1.5}}
- namespaceRange:
min: 1
max: {{$namespaces}}
replicasPerNamespace: 1
tuningSet: RandomizedSaturationTimeLimited
objectBundle:
- basename: big-job
objectTemplatePath: job.yaml
templateFillMap:
ReplicasMin: {{MultiplyInt $BIG_GROUP_SIZE 0.5}}
ReplicasMax: {{MultiplyInt $BIG_GROUP_SIZE 1.5}}
{{end}}

- name: Waiting for objects to become scaled
measurements:
Expand All @@ -369,6 +460,12 @@ steps:
Params:
action: gather
{{end}}
{{if $ENABLE_JOBS}}
- Identifier: WaitForRunningJobs
Method: WaitForControlledPodsRunning
Params:
action: gather
{{end}}

- name: Deleting objects
phases:
Expand Down Expand Up @@ -452,6 +549,32 @@ steps:
- basename: daemonset
objectTemplatePath: daemonset.yaml
{{end}}
{{if $ENABLE_JOBS}}
- namespaceRange:
min: 1
max: {{$namespaces}}
replicasPerNamespace: 0
tuningSet: RandomizedSaturationTimeLimited
objectBundle:
- basename: small-job
objectTemplatePath: job.yaml
- namespaceRange:
min: 1
max: {{$namespaces}}
replicasPerNamespace: 0
tuningSet: RandomizedSaturationTimeLimited
objectBundle:
- basename: medium-job
objectTemplatePath: job.yaml
- namespaceRange:
min: 1
max: {{$namespaces}}
replicasPerNamespace: 0
tuningSet: RandomizedSaturationTimeLimited
objectBundle:
- basename: big-job
objectTemplatePath: job.yaml
{{end}}

- name: Waiting for pods to be deleted
measurements:
Expand All @@ -471,6 +594,12 @@ steps:
Params:
action: gather
{{end}}
{{if $ENABLE_JOBS}}
- Identifier: WaitForRunningJobs
Method: WaitForControlledPodsRunning
Params:
action: gather
{{end}}

- name: Deleting SVCs
phases:
Expand Down
39 changes: 39 additions & 0 deletions clusterloader2/testing/load/job.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
apiVersion: batch/v1
kind: Job
metadata:
name: {{.Name}}
labels:
group: load
spec:
manualSelector: true
parallelism: {{RandIntRange .ReplicasMin .ReplicasMax}}
selector:
matchLabels:
name: {{.Name}}
template:
metadata:
labels:
group: load
name: {{.Name}}
spec:
containers:
- name: {{.Name}}
# TODO(#799): We should test the "run-to-completion" worfklow and hence don't use pause pods.
image: k8s.gcr.io/pause:3.1
resources:
requests:
cpu: 10m
memory: "10M"
restartPolicy: Never
terminationGracePeriodSeconds: 1
# Add not-ready/unreachable tolerations for 15 minutes so that node
# failure doesn't trigger pod deletion.
tolerations:
- key: "node.kubernetes.io/not-ready"
operator: "Exists"
effect: "NoExecute"
tolerationSeconds: 900
- key: "node.kubernetes.io/unreachable"
operator: "Exists"
effect: "NoExecute"
tolerationSeconds: 900

0 comments on commit a57807c

Please sign in to comment.