mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-24 20:24:09 +00:00
Make no. of services in load test configurable
This commit is contained in:
parent
3768d8a9a3
commit
a01dea5df0
@ -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
|
||||||
@ -537,9 +548,9 @@ func GenerateConfigsForGroup(
|
|||||||
ConfigMapNames: configMapNames,
|
ConfigMapNames: configMapNames,
|
||||||
}
|
}
|
||||||
|
|
||||||
// Add a label to alternate RCs, to include only half of them in services.
|
// Add a label to first 'numServices' RCs (to include them in services).
|
||||||
if i%2 == 0 {
|
if i <= numServices {
|
||||||
baseConfig.Labels = map[string]string{svcLabelKey: groupName + "-" + strconv.Itoa(i/2)}
|
baseConfig.Labels = map[string]string{svcLabelKey: groupName + "-" + strconv.Itoa(i)}
|
||||||
}
|
}
|
||||||
|
|
||||||
if kind == randomKind {
|
if kind == randomKind {
|
||||||
|
Loading…
Reference in New Issue
Block a user