clusterloader2/testing/load/modules/reconcile-objects.yaml (238 lines of code) (raw):
## Input params
# Valid actions: "create", "scale and update", "delete"
{{$actionName := printf "%s objects" .actionName}}
{{$namespaces := .namespaces}}
{{$tuningSet := .tuningSet}}
# Derivative variables
{{$is_deleting := (eq .actionName "delete")}}
{{$randomScaleFactor := DefaultParam .randomScaleFactor 0}}
{{$minReplicaFactor := SubtractFloat 1 $randomScaleFactor}}
{{$maxReplicaFactor := AddFloat 1 $randomScaleFactor}}
{{$testMaxReplicaFactor := AddFloat 1 .testMaxReplicaFactor}}
{{$operationTimeout := .operationTimeout}}
# DaemonSets
{{$daemonSetImage := DefaultParam .daemonSetImage "k8s.gcr.io/pause:3.0"}}
{{$daemonSetReplicas := .daemonSetReplicas}}
{{$daemonSetEnv := .daemonSetEnv}}
# Deployments
{{$bigDeploymentSize := .bigDeploymentSize}}
{{$bigDeploymentsPerNamespace := .bigDeploymentsPerNamespace}}
{{$mediumDeploymentSize := .mediumDeploymentSize}}
{{$mediumDeploymentsPerNamespace := .mediumDeploymentsPerNamespace}}
{{$smallDeploymentSize := .smallDeploymentSize}}
{{$smallDeploymentsPerNamespace := .smallDeploymentsPerNamespace}}
# StatefulSets
{{$smallStatefulSetSize := .smallStatefulSetSize}}
{{$smallStatefulSetsPerNamespace := .smallStatefulSetsPerNamespace}}
{{$mediumStatefulSetSize := .mediumStatefulSetSize}}
{{$mediumStatefulSetsPerNamespace := .mediumStatefulSetsPerNamespace}}
# Jobs
{{$bigJobSize := .bigJobSize}}
{{$bigJobsPerNamespace := .bigJobsPerNamespace}}
{{$mediumJobSize := .mediumJobSize}}
{{$mediumJobsPerNamespace := .mediumJobsPerNamespace}}
{{$smallJobSize := .smallJobSize}}
{{$smallJobsPerNamespace := .smallJobsPerNamespace}}
{{$completionsFactor := MultiplyFloat 2 $testMaxReplicaFactor}}
# PV
{{$pvSmallStatefulSetSize := DefaultParam .pvSmallStatefulSetSize 0}}
{{$pvMediumStatefulSetSize := DefaultParam .pvMediumStatefulSetSize 0}}
## CL2 params
{{$CHECK_IF_PODS_ARE_UPDATED := DefaultParam .CL2_CHECK_IF_PODS_ARE_UPDATED true}}
{{$DISABLE_DAEMONSETS := DefaultParam .CL2_DISABLE_DAEMONSETS false}}
{{$ENABLE_DNSTESTS := DefaultParam .CL2_ENABLE_DNSTESTS false}}
{{$ENABLE_NETWORKPOLICIES := DefaultParam .CL2_ENABLE_NETWORKPOLICIES false}}
{{$ENABLE_PVS := DefaultParam .CL2_ENABLE_PVS true}}
steps:
- name: Starting measurement for '{{$actionName}}'
measurements:
- Method: WaitForControlledPodsRunning
Instances:
- Identifier: WaitForRunningDeployments
Params:
apiVersion: apps/v1
kind: Deployment
- Identifier: WaitForRunningStatefulSets
Params:
apiVersion: apps/v1
kind: StatefulSet
- Identifier: WaitForRunningDaemonSets
Params:
apiVersion: apps/v1
kind: DaemonSet
- Identifier: WaitForRunningJobs
Params:
apiVersion: batch/v1
kind: Job
Params:
action: start
checkIfPodsAreUpdated: {{$CHECK_IF_PODS_ARE_UPDATED}}
labelSelector: group = load
operationTimeout: {{$operationTimeout}}
- name: {{$actionName}}
phases:
{{if not $DISABLE_DAEMONSETS}}
- namespaceRange:
min: 1
max: 1
replicasPerNamespace: {{$daemonSetReplicas}}
tuningSet: {{$tuningSet}}
objectBundle:
- basename: daemonset
objectTemplatePath: daemonset.yaml
templateFillMap:
Image: {{$daemonSetImage}}
Env: {{$daemonSetEnv}}
{{end}}
- namespaceRange:
min: 1
max: {{$namespaces}}
replicasPerNamespace: {{$bigDeploymentsPerNamespace}}
tuningSet: {{$tuningSet}}
objectBundle:
{{if $ENABLE_NETWORKPOLICIES}}
- basename: big-deployment
objectTemplatePath: networkpolicy.yaml
{{end}}
- basename: big-deployment
objectTemplatePath: deployment.yaml
templateFillMap:
# DNS Test clients are enabled only in the medium-size deployment.
EnableDNSTests: false
ReplicasMin: {{MultiplyInt $bigDeploymentSize $minReplicaFactor}}
ReplicasMax: {{MultiplyInt $bigDeploymentSize $maxReplicaFactor}}
SvcName: big-service
- namespaceRange:
min: 1
max: {{$namespaces}}
replicasPerNamespace: {{$mediumDeploymentsPerNamespace}}
tuningSet: {{$tuningSet}}
objectBundle:
{{if $ENABLE_NETWORKPOLICIES}}
- basename: medium-deployment
objectTemplatePath: networkpolicy.yaml
{{end}}
- basename: medium-deployment
objectTemplatePath: deployment.yaml
templateFillMap:
EnableDNSTests: {{$ENABLE_DNSTESTS}}
ReplicasMin: {{MultiplyInt $mediumDeploymentSize $minReplicaFactor}}
ReplicasMax: {{MultiplyInt $mediumDeploymentSize $maxReplicaFactor}}
SvcName: medium-service
- namespaceRange:
min: 1
max: {{$namespaces}}
replicasPerNamespace: {{$smallDeploymentsPerNamespace}}
tuningSet: {{$tuningSet}}
objectBundle:
{{if $ENABLE_NETWORKPOLICIES}}
- basename: small-deployment
objectTemplatePath: networkpolicy.yaml
{{end}}
- basename: small-deployment
objectTemplatePath: deployment.yaml
templateFillMap:
# DNS Test clients are enabled only in the medium-size deployment.
EnableDNSTests: false
ReplicasMin: {{MultiplyInt $smallDeploymentSize $minReplicaFactor}}
ReplicasMax: {{MultiplyInt $smallDeploymentSize $maxReplicaFactor}}
SvcName: small-service
- namespaceRange:
min: 1
max: {{$namespaces}}
replicasPerNamespace: {{$smallStatefulSetsPerNamespace}}
tuningSet: {{$tuningSet}}
objectBundle:
- basename: small-statefulset
objectTemplatePath: statefulset_service.yaml
- basename: small-statefulset
objectTemplatePath: statefulset.yaml
templateFillMap:
ReplicasMin: {{MultiplyInt $smallStatefulSetSize $minReplicaFactor}}
ReplicasMax: {{MultiplyInt $smallStatefulSetSize $maxReplicaFactor}}
- namespaceRange:
min: 1
max: {{$namespaces}}
replicasPerNamespace: {{$mediumStatefulSetsPerNamespace}}
tuningSet: {{$tuningSet}}
objectBundle:
- basename: medium-statefulset
objectTemplatePath: statefulset_service.yaml
- basename: medium-statefulset
objectTemplatePath: statefulset.yaml
templateFillMap:
ReplicasMin: {{MultiplyInt $mediumStatefulSetSize $minReplicaFactor}}
ReplicasMax: {{MultiplyInt $mediumStatefulSetSize $maxReplicaFactor}}
- namespaceRange:
min: 1
max: {{$namespaces}}
replicasPerNamespace: {{$smallJobsPerNamespace}}
tuningSet: {{$tuningSet}}
objectBundle:
- basename: small-job
objectTemplatePath: job.yaml
templateFillMap:
Completions: {{MultiplyInt $smallJobSize $completionsFactor}}
ReplicasMin: {{MultiplyInt $smallJobSize $minReplicaFactor}}
ReplicasMax: {{MultiplyInt $smallJobSize $maxReplicaFactor}}
- namespaceRange:
min: 1
max: {{$namespaces}}
replicasPerNamespace: {{$mediumJobsPerNamespace}}
tuningSet: {{$tuningSet}}
objectBundle:
- basename: medium-job
objectTemplatePath: job.yaml
templateFillMap:
Completions: {{MultiplyInt $mediumJobSize $completionsFactor}}
ReplicasMin: {{MultiplyInt $mediumJobSize $minReplicaFactor}}
ReplicasMax: {{MultiplyInt $mediumJobSize $maxReplicaFactor}}
- namespaceRange:
min: 1
max: {{$namespaces}}
replicasPerNamespace: {{$bigJobsPerNamespace}}
tuningSet: {{$tuningSet}}
objectBundle:
- basename: big-job
objectTemplatePath: job.yaml
templateFillMap:
Completions: {{MultiplyInt $bigJobSize $completionsFactor}}
ReplicasMin: {{MultiplyInt $bigJobSize $minReplicaFactor}}
ReplicasMax: {{MultiplyInt $bigJobSize $maxReplicaFactor}}
{{if and $is_deleting $ENABLE_PVS}}
- namespaceRange:
min: 1
max: {{$namespaces}}
replicasPerNamespace: 0
tuningSet: {{$tuningSet}}
objectBundle:
{{range $ssIndex := Loop $pvSmallStatefulSetSize}}
- basename: pv-small-statefulset-{{$ssIndex}}
objectTemplatePath: pvc.yaml
listUnknownObjectOptions:
labelSelector:
matchLabels:
name: small-statefulset-{{$ssIndex}}
{{end}}
- namespaceRange:
min: 1
max: {{$namespaces}}
replicasPerNamespace: 0
tuningSet: {{$tuningSet}}
objectBundle:
{{range $ssIndex := Loop $pvMediumStatefulSetSize}}
- basename: pv-medium-statefulset-{{$ssIndex}}
objectTemplatePath: pvc.yaml
listUnknownObjectOptions:
labelSelector:
matchLabels:
name: medium-statefulset-{{$ssIndex}}
{{end}}
{{end}}
- name: Waiting for '{{$actionName}}' to be completed
measurements:
- Method: WaitForControlledPodsRunning
Instances:
- Identifier: WaitForRunningDeployments
- Identifier: WaitForRunningStatefulSets
- Identifier: WaitForRunningDaemonSets
- Identifier: WaitForRunningJobs
Params:
action: gather
{{if and $is_deleting $ENABLE_PVS}}
- Identifier: WaitForPVCsToBeDeleted
Method: WaitForBoundPVCs
Params:
desiredPVCCount: 0
labelSelector: group = load
timeout: {{$operationTimeout}}
{{end}}