Merge pull request #65599 from chrisohaver/splitsvcs

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
```
This commit is contained in:
Kubernetes Submit Queue 2018-07-02 16:52:09 -07:00 committed by GitHub
commit 5fa5b7d6fc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -34,6 +34,7 @@ import (
const (
parallelCreateServiceWorkers = 1
maxServicesPerCluster = 10000
maxServicesPerNamespace = 5000
checkServicePercent = 0.05
)
@ -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)
@ -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{{