Add multiple init pods to perf test cases

Add test case with several init pods with affinity or antiaffinity.

Signed-off-by: Aldo Culquicondor <acondor@google.com>
This commit is contained in:
Aldo Culquicondor 2020-03-23 14:55:12 -04:00
parent 0e66e56e70
commit 5adc4c41e3
6 changed files with 113 additions and 86 deletions

View File

@ -1,15 +1,15 @@
- template: - template:
desc: SchedulingBasic desc: SchedulingBasic
initPods: initPods:
podTemplatePath: config/pod-default.yaml - podTemplatePath: config/pod-default.yaml
podsToSchedule: podsToSchedule:
podTemplatePath: config/pod-default.yaml podTemplatePath: config/pod-default.yaml
params: params:
- numNodes: 500 - numNodes: 500
numInitPods: 500 numInitPods: [500]
numPodsToSchedule: 1000 numPodsToSchedule: 1000
- numNodes: 5000 - numNodes: 5000
numInitPods: 5000 numInitPods: [5000]
numPodsToSchedule: 1000 numPodsToSchedule: 1000
- template: - template:
desc: SchedulingPodAntiAffinity desc: SchedulingPodAntiAffinity
@ -17,43 +17,43 @@
uniqueNodeLabelStrategy: uniqueNodeLabelStrategy:
labelKey: kubernetes.io/hostname labelKey: kubernetes.io/hostname
initPods: initPods:
podTemplatePath: config/pod-with-pod-anti-affinity.yaml - podTemplatePath: config/pod-with-pod-anti-affinity.yaml
podsToSchedule: podsToSchedule:
podTemplatePath: config/pod-with-pod-anti-affinity.yaml podTemplatePath: config/pod-with-pod-anti-affinity.yaml
params: params:
- numNodes: 500 - numNodes: 500
numInitPods: 100 numInitPods: [100]
numPodsToSchedule: 400 numPodsToSchedule: 400
- numNodes: 5000 - numNodes: 5000
numInitPods: 1000 numInitPods: [1000]
numPodsToSchedule: 1000 numPodsToSchedule: 1000
- template: - template:
desc: SchedulingSecrets desc: SchedulingSecrets
initPods: initPods:
podTemplatePath: config/pod-with-secret-volume.yaml - podTemplatePath: config/pod-with-secret-volume.yaml
podsToSchedule: podsToSchedule:
podTemplatePath: config/pod-with-secret-volume.yaml podTemplatePath: config/pod-with-secret-volume.yaml
params: params:
- numNodes: 500 - numNodes: 500
numInitPods: 500 numInitPods: [500]
numPodsToSchedule: 1000 numPodsToSchedule: 1000
- numNodes: 5000 - numNodes: 5000
numInitPods: 5000 numInitPods: [5000]
numPodsToSchedule: 1000 numPodsToSchedule: 1000
- template: - template:
desc: SchedulingInTreePVs desc: SchedulingInTreePVs
initPods: initPods:
persistentVolumeTemplatePath: config/pv-aws.yaml - persistentVolumeTemplatePath: config/pv-aws.yaml
persistentVolumeClaimTemplatePath: config/pvc.yaml persistentVolumeClaimTemplatePath: config/pvc.yaml
podsToSchedule: podsToSchedule:
persistentVolumeTemplatePath: config/pv-aws.yaml persistentVolumeTemplatePath: config/pv-aws.yaml
persistentVolumeClaimTemplatePath: config/pvc.yaml persistentVolumeClaimTemplatePath: config/pvc.yaml
params: params:
- numNodes: 500 - numNodes: 500
numInitPods: 500 numInitPods: [500]
numPodsToSchedule: 1000 numPodsToSchedule: 1000
- numNodes: 5000 - numNodes: 5000
numInitPods: 5000 numInitPods: [5000]
numPodsToSchedule: 1000 numPodsToSchedule: 1000
- template: - template:
desc: SchedulingMigratedInTreePVs desc: SchedulingMigratedInTreePVs
@ -68,7 +68,7 @@
migratedPlugins: migratedPlugins:
- "kubernetes.io/aws-ebs" - "kubernetes.io/aws-ebs"
initPods: initPods:
persistentVolumeTemplatePath: config/pv-aws.yaml - persistentVolumeTemplatePath: config/pv-aws.yaml
persistentVolumeClaimTemplatePath: config/pvc.yaml persistentVolumeClaimTemplatePath: config/pvc.yaml
podsToSchedule: podsToSchedule:
persistentVolumeTemplatePath: config/pv-aws.yaml persistentVolumeTemplatePath: config/pv-aws.yaml
@ -78,10 +78,10 @@
CSIMigrationAWS: true CSIMigrationAWS: true
params: params:
- numNodes: 500 - numNodes: 500
numInitPods: 500 numInitPods: [500]
numPodsToSchedule: 1000 numPodsToSchedule: 1000
- numNodes: 5000 - numNodes: 5000
numInitPods: 5000 numInitPods: [5000]
numPodsToSchedule: 1000 numPodsToSchedule: 1000
- template: - template:
desc: SchedulingCSIPVs desc: SchedulingCSIPVs
@ -94,17 +94,17 @@
ebs.csi.aws.com: ebs.csi.aws.com:
count: 39 count: 39
initPods: initPods:
persistentVolumeTemplatePath: config/pv-csi.yaml - persistentVolumeTemplatePath: config/pv-csi.yaml
persistentVolumeClaimTemplatePath: config/pvc.yaml persistentVolumeClaimTemplatePath: config/pvc.yaml
podsToSchedule: podsToSchedule:
persistentVolumeTemplatePath: config/pv-csi.yaml persistentVolumeTemplatePath: config/pv-csi.yaml
persistentVolumeClaimTemplatePath: config/pvc.yaml persistentVolumeClaimTemplatePath: config/pvc.yaml
params: params:
- numNodes: 500 - numNodes: 500
numInitPods: 500 numInitPods: [500]
numPodsToSchedule: 1000 numPodsToSchedule: 1000
- numNodes: 5000 - numNodes: 5000
numInitPods: 5000 numInitPods: [5000]
numPodsToSchedule: 1000 numPodsToSchedule: 1000
- template: - template:
desc: SchedulingPodAffinity desc: SchedulingPodAffinity
@ -114,15 +114,15 @@
labelKey: "failure-domain.beta.kubernetes.io/zone" labelKey: "failure-domain.beta.kubernetes.io/zone"
labelValue: "zone1" labelValue: "zone1"
initPods: initPods:
podTemplatePath: config/pod-with-pod-affinity.yaml - podTemplatePath: config/pod-with-pod-affinity.yaml
podsToSchedule: podsToSchedule:
podTemplatePath: config/pod-with-pod-affinity.yaml podTemplatePath: config/pod-with-pod-affinity.yaml
params: params:
- numNodes: 500 - numNodes: 500
numInitPods: 500 numInitPods: [500]
numPodsToSchedule: 1000 numPodsToSchedule: 1000
- numNodes: 5000 - numNodes: 5000
numInitPods: 5000 numInitPods: [5000]
numPodsToSchedule: 1000 numPodsToSchedule: 1000
- template: - template:
desc: SchedulingPreferredPodAffinity desc: SchedulingPreferredPodAffinity
@ -130,15 +130,15 @@
uniqueNodeLabelStrategy: uniqueNodeLabelStrategy:
labelKey: kubernetes.io/hostname labelKey: kubernetes.io/hostname
initPods: initPods:
podTemplatePath: config/pod-with-preferred-pod-affinity.yaml - podTemplatePath: config/pod-with-preferred-pod-affinity.yaml
podsToSchedule: podsToSchedule:
podTemplatePath: config/pod-with-preferred-pod-affinity.yaml podTemplatePath: config/pod-with-preferred-pod-affinity.yaml
params: params:
- numNodes: 500 - numNodes: 500
numInitPods: 500 numInitPods: [500]
numPodsToSchedule: 1000 numPodsToSchedule: 1000
- numNodes: 5000 - numNodes: 5000
numInitPods: 5000 numInitPods: [5000]
numPodsToSchedule: 1000 numPodsToSchedule: 1000
- template: - template:
desc: SchedulingPreferredPodAntiAffinity desc: SchedulingPreferredPodAntiAffinity
@ -146,15 +146,15 @@
uniqueNodeLabelStrategy: uniqueNodeLabelStrategy:
labelKey: kubernetes.io/hostname labelKey: kubernetes.io/hostname
initPods: initPods:
podTemplatePath: config/pod-with-preferred-pod-anti-affinity.yaml - podTemplatePath: config/pod-with-preferred-pod-anti-affinity.yaml
podsToSchedule: podsToSchedule:
podTemplatePath: config/pod-with-preferred-pod-anti-affinity.yaml podTemplatePath: config/pod-with-preferred-pod-anti-affinity.yaml
params: params:
- numNodes: 500 - numNodes: 500
numInitPods: 500 numInitPods: [500]
numPodsToSchedule: 1000 numPodsToSchedule: 1000
- numNodes: 5000 - numNodes: 5000
numInitPods: 5000 numInitPods: [5000]
numPodsToSchedule: 1000 numPodsToSchedule: 1000
- template: - template:
desc: SchedulingNodeAffinity desc: SchedulingNodeAffinity
@ -164,13 +164,30 @@
labelKey: "failure-domain.beta.kubernetes.io/zone" labelKey: "failure-domain.beta.kubernetes.io/zone"
labelValue: "zone1" labelValue: "zone1"
initPods: initPods:
podTemplatePath: config/pod-with-node-affinity.yaml - podTemplatePath: config/pod-with-node-affinity.yaml
podsToSchedule: podsToSchedule:
podTemplatePath: config/pod-with-node-affinity.yaml podTemplatePath: config/pod-with-node-affinity.yaml
params: params:
- numNodes: 500 - numNodes: 500
numInitPods: 500 numInitPods: [500]
numPodsToSchedule: 1000 numPodsToSchedule: 1000
- numNodes: 5000 - numNodes: 5000
numInitPods: 5000 numInitPods: [5000]
numPodsToSchedule: 1000
- template:
desc: MixedSchedulingBasePod
initPods:
- podTemplatePath: config/pod-default.yaml
- podTemplatePath: config/pod-with-pod-affinity.yaml
- podTemplatePath: config/pod-with-pod-anti-affinity.yaml
- podTemplatePath: config/pod-with-preferred-pod-affinity.yaml
- podTemplatePath: config/pod-with-preferred-pod-anti-affinity.yaml
podsToSchedule:
podTemplatePath: config/pod-default.yaml
params:
- numNodes: 500
numInitPods: [200, 200, 200, 200, 200]
numPodsToSchedule: 1000
- numNodes: 5000
numInitPods: [2000, 2000, 2000, 2000, 2000]
numPodsToSchedule: 1000 numPodsToSchedule: 1000

View File

@ -3,14 +3,14 @@ kind: Pod
metadata: metadata:
generateName: affinity-pod- generateName: affinity-pod-
labels: labels:
foo: "" color: blue
spec: spec:
affinity: affinity:
podAffinity: podAffinity:
requiredDuringSchedulingIgnoredDuringExecution: requiredDuringSchedulingIgnoredDuringExecution:
- labelSelector: - labelSelector:
matchLabels: matchLabels:
foo: "" color: blue
topologyKey: failure-domain.beta.kubernetes.io/zone topologyKey: failure-domain.beta.kubernetes.io/zone
namespaces: ["sched-test", "sched-setup"] namespaces: ["sched-test", "sched-setup"]
containers: containers:

View File

@ -4,7 +4,6 @@ metadata:
generateName: anti-affinity-pod- generateName: anti-affinity-pod-
labels: labels:
color: green color: green
name: test
spec: spec:
affinity: affinity:
podAntiAffinity: podAntiAffinity:

View File

@ -3,7 +3,7 @@ kind: Pod
metadata: metadata:
generateName: preferred-affinity-pod- generateName: preferred-affinity-pod-
labels: labels:
foo: "" color: red
spec: spec:
affinity: affinity:
podAffinity: podAffinity:
@ -11,7 +11,7 @@ spec:
- podAffinityTerm: - podAffinityTerm:
labelSelector: labelSelector:
matchLabels: matchLabels:
foo: "" color: red
topologyKey: kubernetes.io/hostname topologyKey: kubernetes.io/hostname
namespaces: ["sched-test", "sched-setup"] namespaces: ["sched-test", "sched-setup"]
weight: 1 weight: 1

View File

@ -3,7 +3,7 @@ kind: Pod
metadata: metadata:
generateName: preferred-anti-affinity-pod- generateName: preferred-anti-affinity-pod-
labels: labels:
foo: "" color: yellow
spec: spec:
affinity: affinity:
podAntiAffinity: podAntiAffinity:
@ -11,7 +11,7 @@ spec:
- podAffinityTerm: - podAffinityTerm:
labelSelector: labelSelector:
matchLabels: matchLabels:
foo: "" color: yellow
topologyKey: kubernetes.io/hostname topologyKey: kubernetes.io/hostname
namespaces: ["sched-test", "sched-setup"] namespaces: ["sched-test", "sched-setup"]
weight: 1 weight: 1

View File

@ -65,7 +65,7 @@ type testCase struct {
// configures nodes in the cluster // configures nodes in the cluster
Nodes nodeCase Nodes nodeCase
// configures pods in the cluster before running the tests // configures pods in the cluster before running the tests
InitPods podCase InitPods []podCase
// pods to be scheduled during the test. // pods to be scheduled during the test.
PodsToSchedule podCase PodsToSchedule podCase
// optional, feature gates to set before running the test // optional, feature gates to set before running the test
@ -100,7 +100,7 @@ type simpleTestCases struct {
type testParams struct { type testParams struct {
NumNodes int NumNodes int
NumInitPods int NumInitPods []int
NumPodsToSchedule int NumPodsToSchedule int
} }
@ -117,7 +117,11 @@ func BenchmarkPerfScheduling(b *testing.B) {
} }
for _, test := range tests { for _, test := range tests {
name := fmt.Sprintf("%v/%vNodes/%vInitPods/%vPodsToSchedule", test.Desc, test.Nodes.Num, test.InitPods.Num, test.PodsToSchedule.Num) initPods := 0
for _, p := range test.InitPods {
initPods += p.Num
}
name := fmt.Sprintf("%v/%vNodes/%vInitPods/%vPodsToSchedule", test.Desc, test.Nodes.Num, initPods, test.PodsToSchedule.Num)
b.Run(name, func(b *testing.B) { b.Run(name, func(b *testing.B) {
for feature, flag := range test.FeatureGates { for feature, flag := range test.FeatureGates {
defer featuregatetesting.SetFeatureGateDuringTest(b, utilfeature.DefaultFeatureGate, feature, flag)() defer featuregatetesting.SetFeatureGateDuringTest(b, utilfeature.DefaultFeatureGate, feature, flag)()
@ -143,10 +147,14 @@ func perfScheduling(test testCase, b *testing.B) []DataItem {
} }
defer nodePreparer.CleanupNodes() defer nodePreparer.CleanupNodes()
if err := createPods(setupNamespace, test.InitPods, clientset); err != nil { total := 0
for _, p := range test.InitPods {
if err := createPods(setupNamespace, p, clientset); err != nil {
b.Fatal(err) b.Fatal(err)
} }
if err := waitNumPodsScheduled(b, test.InitPods.Num, podInformer); err != nil { total += p.Num
}
if err := waitNumPodsScheduled(b, total, podInformer); err != nil {
b.Fatal(err) b.Fatal(err)
} }
@ -164,7 +172,7 @@ func perfScheduling(test testCase, b *testing.B) []DataItem {
if err := createPods(testNamespace, test.PodsToSchedule, clientset); err != nil { if err := createPods(testNamespace, test.PodsToSchedule, clientset); err != nil {
b.Fatal(err) b.Fatal(err)
} }
if err := waitNumPodsScheduled(b, test.InitPods.Num+test.PodsToSchedule.Num, podInformer); err != nil { if err := waitNumPodsScheduled(b, total+test.PodsToSchedule.Num, podInformer); err != nil {
b.Fatal(err) b.Fatal(err)
} }
@ -278,7 +286,10 @@ func parseTestCases(path string) ([]testCase, error) {
testCase := s.Template testCase := s.Template
for _, p := range s.Params { for _, p := range s.Params {
testCase.Nodes.Num = p.NumNodes testCase.Nodes.Num = p.NumNodes
testCase.InitPods.Num = p.NumInitPods testCase.InitPods = append([]podCase(nil), testCase.InitPods...)
for i, v := range p.NumInitPods {
testCase.InitPods[i].Num = v
}
testCase.PodsToSchedule.Num = p.NumPodsToSchedule testCase.PodsToSchedule.Num = p.NumPodsToSchedule
testCases = append(testCases, testCase) testCases = append(testCases, testCase)
} }