Merge pull request #65179 from shyamjvs/reduce-service-endpoints-in-load-test

Automatic merge from submit-queue (batch tested with PRs 65152, 65199, 65179, 64598, 65216). 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>.

Make no. of services in load test configurable

Experimenting with https://github.com/kubernetes/kubernetes/issues/48107#issuecomment-398018717

/cc @wojtek-t 

```release-note
NONE
```

/kind bug
/sig scalability
/priority important-soon
This commit is contained in:
Kubernetes Submit Queue 2018-06-21 18:20:12 -07:00 committed by GitHub
commit 80da69b07f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -492,6 +492,17 @@ func GenerateConfigsForGroup(
secretConfigs := make([]*testutils.SecretConfig, 0, count*secretsPerPod) secretConfigs := make([]*testutils.SecretConfig, 0, count*secretsPerPod)
configMapConfigs := make([]*testutils.ConfigMapConfig, 0, count*configMapsPerPod) configMapConfigs := make([]*testutils.ConfigMapConfig, 0, count*configMapsPerPod)
savedKind := kind savedKind := kind
// We assume by default that every RC is part of its own service.
// However, you can override it using SERVICE_TO_RC_RATIO env var.
serviceToRCRatio := 1.0
if serviceToRCRatioEnv := os.Getenv("SERVICE_TO_RC_RATIO"); serviceToRCRatioEnv != "" {
if value, err := strconv.ParseFloat(serviceToRCRatioEnv, 64); err == nil {
serviceToRCRatio = value
}
}
numServices := int(float64(count) * serviceToRCRatio)
for i := 1; i <= count; i++ { for i := 1; i <= count; i++ {
kind = savedKind kind = savedKind
namespace := nss[i%len(nss)].Name namespace := nss[i%len(nss)].Name
@ -535,8 +546,11 @@ func GenerateConfigsForGroup(
MemRequest: 26214400, // 25MB MemRequest: 26214400, // 25MB
SecretNames: secretNames, SecretNames: secretNames,
ConfigMapNames: configMapNames, ConfigMapNames: configMapNames,
// Define a label to group every 2 RCs into one service. }
Labels: map[string]string{svcLabelKey: groupName + "-" + strconv.Itoa((i+1)/2)},
// Add a label to first 'numServices' RCs (to include them in services).
if i <= numServices {
baseConfig.Labels = map[string]string{svcLabelKey: groupName + "-" + strconv.Itoa(i)}
} }
if kind == randomKind { if kind == randomKind {