Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Kubetest2 - Add --skip-regex logic #11841

Merged
merged 1 commit into from
Jun 22, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
93 changes: 93 additions & 0 deletions tests/e2e/pkg/tester/skip_regex.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
/*
Copyright 2021 The Kubernetes Authors.

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/

package tester

import (
"regexp"
"strings"
)

const (
skipRegexBase = "[Slow]|[Serial]|[Disruptive]|[Flaky]|[Feature:.+]|[HPA]|[Driver:.nfs]|Dashboard|RuntimeClass|RuntimeHandler"
)

func (t *Tester) setSkipRegexFlag() error {

// Temporarily removing for testing in the PR
// TODO: uncomment before merging
/*if t.SkipRegex != "" {
return nil
}*/

cluster, err := t.getKopsCluster()
if err != nil {
return err
}

skipRegex := skipRegexBase

networking := cluster.Spec.Networking
switch {
case networking.Kubenet != nil, networking.Canal != nil, networking.Weave != nil, networking.Cilium != nil:
skipRegex += "|Services.*rejected.*endpoints"
}
if networking.Cilium != nil {
// https://github.com/cilium/cilium/issues/10002
skipRegex += "|TCP.CLOSE_WAIT"
// https://github.com/cilium/cilium/issues/15361
skipRegex += "|external.IP.is.not.assigned.to.a.node"
// https://github.com/cilium/cilium/issues/14287
skipRegex += "|same.port.number.but.different.protocols|same.hostPort.but.different.hostIP.and.protocol"
} else if networking.Calico != nil {
skipRegex += "|Services.*functioning.*NodePort"
} else if networking.Kuberouter != nil {
skipRegex += "|load-balancer|hairpin|affinity\\stimeout|service\\.kubernetes\\.io|CLOSE_WAIT"
} else if networking.Kubenet != nil {
skipRegex += "|Services.*affinity"
}

if cluster.Spec.CloudProvider == "aws" {
if strings.Contains(cluster.Spec.KubernetesVersion, "v1.21.") {
// TODO(rifelpet): Remove once k8s tags has been created that include
// https://github.com/kubernetes/kubernetes/pull/101443
skipRegex += "|Invalid.AWS.KMS.key"
}
if strings.Contains(cluster.Spec.KubernetesVersion, "v1.22.") {
// TODO(rifelpet): Remove once volume limits tests have been fixed
// https://github.com/kubernetes/kubernetes/issues/79660#issuecomment-854884112
skipRegex += "|Volume.limits.should.verify.that.all.nodes.have.volume.limits"
}
Comment on lines +64 to +73
Copy link
Member Author

@rifelpet rifelpet Jun 22, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not particularly excited about this:

In build_jobs.py we have version markers that we can reference (stable, latest, etc.). kubetest2-kops takes these marker URLs, reads their contents and passes that to kops create cluster so we end up with a specific k8s version URL in the cluster spec like this.

kubetest2-tester-kops doesn't have access to the version marker being passed into kubetest2-kops, so we rely on parsing these known versions from the cluster spec instead. The potential downside is that if these k/k issues aren't fixed in 1.22, we need to remember to add v1.23 to this logic whereas in bulid_jobs.py the stable and latest markers wouldn't need any followup work. Maybe it is better to explicitly require this followup work though to ensure that these tests still need to be skipped.

Other ideas here are welcome

}

igs, err := t.getKopsInstanceGroups()
if err != nil {
return err
}
for _, ig := range igs {
if strings.Contains(ig.Spec.Image, "arm64") {
skipRegex += "|Simple.pod.should.handle.in-cluster.config"
break
}
}

// Ensure it is valid regex
if _, err := regexp.Compile(skipRegex); err != nil {
return err
}
t.SkipRegex = skipRegex
return nil
}
4 changes: 4 additions & 0 deletions tests/e2e/pkg/tester/tester.go
Original file line number Diff line number Diff line change
Expand Up @@ -351,6 +351,10 @@ func (t *Tester) execute() error {
return err
}

if err := t.setSkipRegexFlag(); err != nil {
return err
}

return t.Test()
}

Expand Down