Skip to content

Commit

Permalink
Merge pull request #65599 from chrisohaver/splitsvcs
Browse files Browse the repository at this point in the history
Automatic merge from submit-queue (batch tested with PRs 65348, 65599, 65635, 65688, 65691). If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>.

distribute services between 2 namespaces in e2e DNS scale services test

**What this PR does / why we need it**:

What: Alters the dns scale test, to distribute the scale load of 10K services between 2 namespaces, so that the test does not fail to create the services.
Why: To allow the dns test to proceed.

Expect to Fix #64774 but wont know until it's actually run in e2e tests, so not marking that issue to auto-close on merge.  FWIW, it does pass in local tests using hack/local-up-cluster.sh.

**Which issue(s) this PR fixes** *(optional, in `fixes #<issue number>(, fixes #<issue_number>, ...)` format, will close the issue(s) when PR gets merged)*:

**Special notes for your reviewer**:

**Release note**:
```release-note
NONE
```
  • Loading branch information
Kubernetes Submit Queue committed Jul 2, 2018
2 parents 10c701c + e94304d commit 5fa5b7d
Showing 1 changed file with 14 additions and 4 deletions.
18 changes: 14 additions & 4 deletions test/e2e/network/dns_scale_records.go
Expand Up @@ -34,6 +34,7 @@ import (
const (
parallelCreateServiceWorkers = 1
maxServicesPerCluster = 10000
maxServicesPerNamespace = 5000
checkServicePercent = 0.05
)

Expand All @@ -50,10 +51,19 @@ var _ = SIGDescribe("[Feature:PerformanceDNS]", func() {

// answers dns for service - creates the maximum number of services, and then check dns record for one
It("Should answer DNS query for maximum number of services per cluster", func() {
services := generateServicesInNamespace(f.Namespace.Name, maxServicesPerCluster)
// get integer ceiling of maxServicesPerCluster / maxServicesPerNamespace
numNs := (maxServicesPerCluster + maxServicesPerNamespace - 1) / maxServicesPerNamespace

var namespaces []string
for i := 0; i < numNs; i++ {
ns, _ := f.CreateNamespace(f.BaseName, nil)
namespaces = append(namespaces, ns.Name)
}

services := generateServicesInNamespaces(namespaces, maxServicesPerCluster)
createService := func(i int) {
defer GinkgoRecover()
framework.ExpectNoError(testutils.CreateServiceWithRetries(f.ClientSet, f.Namespace.Name, services[i]))
framework.ExpectNoError(testutils.CreateServiceWithRetries(f.ClientSet, services[i].Namespace, services[i]))
}
framework.Logf("Creating %v test services", maxServicesPerCluster)
workqueue.Parallelize(parallelCreateServiceWorkers, len(services), createService)
Expand Down Expand Up @@ -86,13 +96,13 @@ var _ = SIGDescribe("[Feature:PerformanceDNS]", func() {
})
})

func generateServicesInNamespace(namespace string, num int) []*v1.Service {
func generateServicesInNamespaces(namespaces []string, num int) []*v1.Service {
services := make([]*v1.Service, num)
for i := 0; i < num; i++ {
services[i] = &v1.Service{
ObjectMeta: metav1.ObjectMeta{
Name: "svc-" + strconv.Itoa(i),
Namespace: namespace,
Namespace: namespaces[i%len(namespaces)],
},
Spec: v1.ServiceSpec{
Ports: []v1.ServicePort{{
Expand Down

0 comments on commit 5fa5b7d

Please sign in to comment.