mirror of https://github.com/kubernetes/kops.git
Merge pull request #12194 from justinsb/warn_if_unknown_arch
Warn if KOPS_ARCH is not a recognized value
This commit is contained in:
commit
11af87bf4e
|
|
@ -5,4 +5,5 @@ go_library(
|
||||||
srcs = ["architectures.go"],
|
srcs = ["architectures.go"],
|
||||||
importpath = "k8s.io/kops/util/pkg/architectures",
|
importpath = "k8s.io/kops/util/pkg/architectures",
|
||||||
visibility = ["//visibility:public"],
|
visibility = ["//visibility:public"],
|
||||||
|
deps = ["//vendor/k8s.io/klog/v2:go_default_library"],
|
||||||
)
|
)
|
||||||
|
|
|
||||||
|
|
@ -20,6 +20,8 @@ import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"os"
|
"os"
|
||||||
"runtime"
|
"runtime"
|
||||||
|
|
||||||
|
"k8s.io/klog/v2"
|
||||||
)
|
)
|
||||||
|
|
||||||
type Architecture string
|
type Architecture string
|
||||||
|
|
@ -44,11 +46,15 @@ func GetSupported() []Architecture {
|
||||||
// Kubernetes PR builds only generate AMD64 binaries at the moment
|
// Kubernetes PR builds only generate AMD64 binaries at the moment
|
||||||
// Force support only for AMD64 or ARM64
|
// Force support only for AMD64 or ARM64
|
||||||
arch := os.Getenv("KOPS_ARCH")
|
arch := os.Getenv("KOPS_ARCH")
|
||||||
switch arch {
|
if arch != "" {
|
||||||
case "amd64":
|
switch arch {
|
||||||
return []Architecture{ArchitectureAmd64}
|
case "amd64":
|
||||||
case "arm64":
|
return []Architecture{ArchitectureAmd64}
|
||||||
return []Architecture{ArchitectureArm64}
|
case "arm64":
|
||||||
|
return []Architecture{ArchitectureArm64}
|
||||||
|
default:
|
||||||
|
klog.Warningf("unknown architecture KOPS_ARCH=%q", arch)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return []Architecture{
|
return []Architecture{
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue