Merge pull request #117201 from pohly/scheduler-perf-node-labels

test/integration: create nodes directly with kubernetes.io/hostname label
This commit is contained in:
Kubernetes Prow Robot 2023-04-11 21:18:12 -07:00 committed by GitHub
commit 251d4a00e6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 15 additions and 17 deletions

View File

@ -22,6 +22,7 @@ import (
v1 "k8s.io/api/core/v1"
"k8s.io/apimachinery/pkg/api/resource"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/util/rand"
clientset "k8s.io/client-go/kubernetes"
"k8s.io/klog/v2"
testutils "k8s.io/kubernetes/test/utils"
@ -89,7 +90,20 @@ func (p *IntegrationTestNodePreparer) PrepareNodes(ctx context.Context, nextNode
for i := 0; i < numNodes; i++ {
var err error
for retry := 0; retry < retries; retry++ {
_, err = p.client.CoreV1().Nodes().Create(ctx, baseNode, metav1.CreateOptions{})
// Create nodes with the usual kubernetes.io/hostname label.
// For that we need to know the name in advance, if we want to
// do it in one request.
node := baseNode.DeepCopy()
name := node.Name
if name == "" {
name = node.GenerateName + rand.String(5)
node.Name = name
}
if node.Labels == nil {
node.Labels = make(map[string]string)
}
node.Labels["kubernetes.io/hostname"] = name
_, err = p.client.CoreV1().Nodes().Create(ctx, node, metav1.CreateOptions{})
if err == nil {
break
}

View File

@ -25,8 +25,6 @@
workloadTemplate:
- opcode: createNodes
countParam: $initNodes
uniqueNodeLabelStrategy:
labelKey: kubernetes.io/hostname
- opcode: createNamespaces
prefix: sched
count: 2
@ -198,8 +196,6 @@
workloadTemplate:
- opcode: createNodes
countParam: $initNodes
uniqueNodeLabelStrategy:
labelKey: kubernetes.io/hostname
- opcode: createNamespaces
prefix: sched
count: 2
@ -227,8 +223,6 @@
workloadTemplate:
- opcode: createNodes
countParam: $initNodes
uniqueNodeLabelStrategy:
labelKey: kubernetes.io/hostname
- opcode: createNamespaces
prefix: sched
count: 2
@ -491,8 +485,6 @@
workloadTemplate:
- opcode: createNodes
countParam: $initNodes
uniqueNodeLabelStrategy:
labelKey: kubernetes.io/hostname
- opcode: createNamespaces
prefix: init-ns
countParam: $initNamespaces
@ -524,8 +516,6 @@
workloadTemplate:
- opcode: createNodes
countParam: $initNodes
uniqueNodeLabelStrategy:
labelKey: kubernetes.io/hostname
- opcode: createNamespaces
prefix: init-ns
countParam: $initNamespaces
@ -591,8 +581,6 @@
workloadTemplate:
- opcode: createNodes
countParam: $initNodes
uniqueNodeLabelStrategy:
labelKey: kubernetes.io/hostname
- opcode: createNamespaces
prefix: init-ns
countParam: $initNamespaces
@ -626,13 +614,9 @@
workloadTemplate:
- opcode: createNodes
countParam: $normalNodes
uniqueNodeLabelStrategy:
labelKey: kubernetes.io/hostname
- opcode: createNodes
nodeTemplatePath: config/node-with-taint.yaml
countParam: $taintNodes
uniqueNodeLabelStrategy:
labelKey: kubernetes.io/hostname
- opcode: createPods
countParam: $measurePods
collectMetrics: true