mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-23 03:41:45 +00:00
Merge pull request #48908 from shyamjvs/reduce-services-loadtest
Automatic merge from submit-queue (batch tested with PRs 48991, 48908) Group every two services into one in load test Ref https://github.com/kubernetes/kubernetes/issues/48938 Following from discussion with @bowei and @freehan . This reduces #services to 8200 while keeping no. of backends same. /cc @wojtek-t @gmarek
This commit is contained in:
commit
5c32b7d1eb
@ -61,6 +61,7 @@ const (
|
||||
nodeCountPerNamespace = 100
|
||||
// How many threads will be used to create/delete services during this test.
|
||||
serviceOperationsParallelism = 1
|
||||
svcLabelKey = "svc-label"
|
||||
)
|
||||
|
||||
var randomKind = schema.GroupKind{Kind: "Random"}
|
||||
@ -458,6 +459,8 @@ func GenerateConfigsForGroup(
|
||||
MemRequest: 26214400, // 25MB
|
||||
SecretNames: secretNames,
|
||||
ConfigMapNames: configMapNames,
|
||||
// Define a label to group every 2 RCs into one service.
|
||||
Labels: map[string]string{svcLabelKey: groupName + "-" + strconv.Itoa((i+1)/2)},
|
||||
}
|
||||
|
||||
if kind == randomKind {
|
||||
@ -483,10 +486,19 @@ func GenerateConfigsForGroup(
|
||||
}
|
||||
|
||||
func generateServicesForConfigs(configs []testutils.RunObjectConfig) []*v1.Service {
|
||||
services := make([]*v1.Service, 0, len(configs))
|
||||
services := make([]*v1.Service, 0)
|
||||
currentSvcLabel := ""
|
||||
for _, config := range configs {
|
||||
svcLabel, found := config.GetLabelValue(svcLabelKey)
|
||||
if !found || svcLabel == currentSvcLabel {
|
||||
continue
|
||||
}
|
||||
currentSvcLabel = svcLabel
|
||||
serviceName := config.GetName() + "-svc"
|
||||
labels := map[string]string{"name": config.GetName()}
|
||||
labels := map[string]string{
|
||||
"name": config.GetName(),
|
||||
svcLabelKey: currentSvcLabel,
|
||||
}
|
||||
service := &v1.Service{
|
||||
ObjectMeta: metav1.ObjectMeta{
|
||||
Name: serviceName,
|
||||
|
@ -108,6 +108,7 @@ type RunObjectConfig interface {
|
||||
SetClient(clientset.Interface)
|
||||
SetInternalClient(internalclientset.Interface)
|
||||
GetReplicas() int
|
||||
GetLabelValue(string) (string, bool)
|
||||
}
|
||||
|
||||
type RCConfig struct {
|
||||
@ -500,6 +501,11 @@ func (config *RCConfig) GetReplicas() int {
|
||||
return config.Replicas
|
||||
}
|
||||
|
||||
func (config *RCConfig) GetLabelValue(key string) (string, bool) {
|
||||
value, found := config.Labels[key]
|
||||
return value, found
|
||||
}
|
||||
|
||||
func (config *RCConfig) create() error {
|
||||
dnsDefault := v1.DNSDefault
|
||||
if config.DNSPolicy == nil {
|
||||
|
Loading…
Reference in New Issue
Block a user