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

Automated cherry pick of #55448: Adjust GKE spec to validate images with kernel version 4.10+ #58481

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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions test/e2e_node/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,7 @@ go_test(
"//test/e2e_node/services:go_default_library",
"//test/e2e_node/system:go_default_library",
"//test/utils/image:go_default_library",
"//vendor/github.com/blang/semver:go_default_library",
"//vendor/github.com/coreos/go-systemd/util:go_default_library",
"//vendor/github.com/davecgh/go-spew/spew:go_default_library",
"//vendor/github.com/golang/glog:go_default_library",
Expand Down
28 changes: 28 additions & 0 deletions test/e2e_node/gke_environment_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ import (

"k8s.io/kubernetes/test/e2e/framework"

"github.com/blang/semver"
. "github.com/onsi/ginkgo"
)

Expand Down Expand Up @@ -122,6 +123,18 @@ func checkDockerConfig() error {
}
missing = map[string]bool{}
)

// Whitelists CONFIG_DEVPTS_MULTIPLE_INSTANCES (meaning allowing it to be
// absent) if the kernel version is >= 4.8, because this option has been
// removed from the 4.8 kernel.
kernelVersion, err := getKernelVersion()
if err != nil {
return err
}
if kernelVersion.GTE(semver.MustParse("4.8.0")) {
whitelist["CONFIG_DEVPTS_MULTIPLE_INSTANCES"] = true
}

for _, bin := range bins {
if _, err := os.Stat(bin); os.IsNotExist(err) {
continue
Expand Down Expand Up @@ -400,3 +413,18 @@ func getCmdToProcessMap() (map[string][]process, error) {
}
return result, nil
}

// getKernelVersion returns the kernel version in the semantic version format.
func getKernelVersion() (*semver.Version, error) {
output, err := runCommand("uname", "-r")
if err != nil {
return nil, err
}
// An example 'output' could be "4.13.0-1001-gke".
v := strings.TrimSpace(strings.Split(output, "-")[0])
kernelVersion, err := semver.Make(v)
if err != nil {
return nil, fmt.Errorf("failed to convert %q to semantic version: %s", v, err)
}
return &kernelVersion, nil
}
4 changes: 3 additions & 1 deletion test/e2e_node/system/specs/gke.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@ os: Linux
kernelSpec:
versions:
# GKE requires kernel version 4.4+.
- 4\.[4-9].*
- '4\.[4-9].*'
- '4\.[1-9][0-9].*'
- '[5-9].*'

# Required kernel configurations -- the configuration must be set to "y" or
# "m".
Expand Down