Merge pull request #25972 from luxas/remove_arch_constants
Automatic merge from submit-queue Use pause image depending on the server's platform when testing Removed all pause image constant strings, now the pause image is chosen by arch. Part of the effort of making e2e arch-agnostic. The pause image name and version is also now only in two places, and it's documented to bump both Also removed "amd64" constants in the code. Such constants should be replaced by `runtime.GOARCH` or by looking up the server platform Fixes: #22876 and #15140 Makes it easier for: #25730 Related: #17981 This is for `v1.3` @ixdy @thockin @vishh @kubernetes/sig-testing @andyzheng0831 @pensu
This commit is contained in:
@@ -30,6 +30,7 @@ import (
|
||||
"os/exec"
|
||||
"path"
|
||||
"path/filepath"
|
||||
goRuntime "runtime"
|
||||
"sort"
|
||||
"strconv"
|
||||
"strings"
|
||||
@@ -129,12 +130,42 @@ const (
|
||||
|
||||
// How long claims have to become dynamically provisioned
|
||||
ClaimProvisionTimeout = 5 * time.Minute
|
||||
|
||||
// When these values are updated, also update cmd/kubelet/app/options/options.go
|
||||
currentPodInfraContainerImageName = "gcr.io/google_containers/pause"
|
||||
currentPodInfraContainerImageVersion = "3.0"
|
||||
)
|
||||
|
||||
// Label allocated to the image puller static pod that runs on each node
|
||||
// before e2es.
|
||||
var ImagePullerLabels = map[string]string{"name": "e2e-image-puller"}
|
||||
|
||||
// GetServerArchitecture fetches the architecture of the target cluster.
|
||||
func GetServerArchitecture(c *client.Client) string {
|
||||
arch := ""
|
||||
sVer, err := c.Discovery().ServerVersion()
|
||||
if err != nil || sVer.Platform == "" {
|
||||
// If we failed to get the server version for some reason, default to amd64.
|
||||
arch = "amd64"
|
||||
} else {
|
||||
// Split the platform string into OS and Arch separately.
|
||||
// The platform string may for example be "linux/amd64", "linux/arm" or "windows/amd64".
|
||||
osArchArray := strings.Split(sVer.Platform, "/")
|
||||
arch = osArchArray[1]
|
||||
}
|
||||
return arch
|
||||
}
|
||||
|
||||
// GetPauseImageName fetches the architecture of the target cluster and chooses the pause image to use.
|
||||
func GetPauseImageName(c *client.Client) string {
|
||||
return currentPodInfraContainerImageName + "-" + GetServerArchitecture(c) + ":" + currentPodInfraContainerImageVersion
|
||||
}
|
||||
|
||||
// GetPauseImageNameForHostArch() fetches the pause image for the same architecture the machine is running on.
|
||||
func GetPauseImageNameForHostArch() string {
|
||||
return currentPodInfraContainerImageName + "-" + goRuntime.GOARCH + ":" + currentPodInfraContainerImageVersion
|
||||
}
|
||||
|
||||
// SubResource proxy should have been functional in v1.0.0, but SubResource
|
||||
// proxy via tunneling is known to be broken in v1.0. See
|
||||
// https://github.com/kubernetes/kubernetes/pull/15224#issuecomment-146769463
|
||||
|
Reference in New Issue
Block a user