set num-nodes flag automatically (#16176)

Co-authored-by: upodroid <upodroid@users.noreply.github.com>
This commit is contained in:
Mahamed Ali 2024-01-20 14:42:16 +00:00 committed by GitHub
parent 32febfeb01
commit 2cd79934d5
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 13 additions and 6 deletions

View File

@ -26,7 +26,7 @@ import (
) )
const ( const (
skipRegexBase = "\\[Slow\\]|\\[Serial\\]|\\[Disruptive\\]|\\[Flaky\\]|\\[Feature:.+\\]|nfs|NFS|Gluster" skipRegexBase = "\\[Slow\\]|\\[Serial\\]|\\[Disruptive\\]|\\[Flaky\\]|\\[Feature:.+\\]|nfs|NFS|Gluster|NodeProblemDetector"
) )
func (t *Tester) setSkipRegexFlag() error { func (t *Tester) setSkipRegexFlag() error {
@ -81,6 +81,8 @@ func (t *Tester) setSkipRegexFlag() error {
skipRegex += "|same.hostPort.but.different.hostIP.and.protocol" skipRegex += "|same.hostPort.but.different.hostIP.and.protocol"
// https://github.com/cilium/cilium/issues/9207 // https://github.com/cilium/cilium/issues/9207
skipRegex += "|serve.endpoints.on.same.port.and.different.protocols" skipRegex += "|serve.endpoints.on.same.port.and.different.protocols"
// https://github.com/kubernetes/kubernetes/blob/418ae605ec1b788d43bff7ac44af66d8b669b833/test/e2e/network/networking.go#L135
skipRegex += "|should.check.kube-proxy.urls"
if isPre28 { if isPre28 {
// These may be fixed in Cilium 1.13 but skipping for now // These may be fixed in Cilium 1.13 but skipping for now

View File

@ -21,6 +21,7 @@ import (
"fmt" "fmt"
"os" "os"
"os/exec" "os/exec"
"strconv"
"strings" "strings"
"github.com/octago/sflags/gen/gpflag" "github.com/octago/sflags/gen/gpflag"
@ -187,11 +188,6 @@ func (t *Tester) addNodeIG() error {
return err return err
} }
// Skip this function for non gce clusters
if cluster.Spec.LegacyCloudProvider != "gce" {
return nil
}
igs, err := kops.GetInstanceGroups("kops", cluster.Name, nil) igs, err := kops.GetInstanceGroups("kops", cluster.Name, nil)
if err != nil { if err != nil {
return err return err
@ -203,6 +199,15 @@ func (t *Tester) addNodeIG() error {
ig = v ig = v
} }
} }
numNodes := int(*ig.Spec.MaxSize) // we assume that MinSize = Maxsize, this is true for e2e testing
klog.Infof("Setting -num-nodes=%v", numNodes)
t.TestArgs += " -num-nodes=" + strconv.Itoa(numNodes)
// Skip the rest of this function for non gce clusters
if cluster.Spec.LegacyCloudProvider != "gce" {
return nil
}
nodeTag := gce.TagForRole(cluster.ObjectMeta.Name, unversioned.InstanceGroupRoleNode) nodeTag := gce.TagForRole(cluster.ObjectMeta.Name, unversioned.InstanceGroupRoleNode)
klog.Infof("Setting --node-tag=%s", nodeTag) klog.Infof("Setting --node-tag=%s", nodeTag)
t.TestArgs += " --node-tag=" + nodeTag t.TestArgs += " --node-tag=" + nodeTag