Skip to content
Permalink
Browse files

patch for PPC64LE and remove dead GetOS code

  • Loading branch information...
BenTheElder committed Apr 30, 2019
1 parent 194cbde commit fbb27eacdccfa8f6f35edc55decdbfa61895b81d
Showing with 3 additions and 36 deletions.
  1. +1 −1 images/base/Dockerfile
  2. +2 −35 pkg/util/osarch.go
@@ -63,7 +63,7 @@ RUN containerd --version \
# TODO(bentheelder): doc why / what here
ARG CNI_VERSION="0.7.5"
ARG CNI_BASE_URL="https://storage.googleapis.com/kubernetes-release/network-plugins/"
RUN export ARCH=$(dpkg --print-architecture) \
RUN export ARCH=$(dpkg --print-architecture| sed 's/ppc64el/ppc64le/') \
&& export CNI_TARBALL="cni-plugins-${ARCH}-v${CNI_VERSION}.tgz" \
&& export CNI_URL="${CNI_BASE_URL}${CNI_TARBALL}" \
&& curl -sSL --retry 5 --output /tmp/cni.tgz "${CNI_URL}" \
@@ -21,48 +21,15 @@ import (
"runtime"
)

// GetOS validates/returns the current operating system if supported and panics otherwise
func GetOS() string {
switch runtime.GOOS {
case "darwin":
return "darwin"
case "linux":
return "linux"
case "windows":
return "windows"
}
panic(fmt.Sprintf("unsupported OS %s", runtime.GOOS))
}

// GetArch validates/returns the current architecture if supported and panics otherwise
func GetArch() string {
switch runtime.GOARCH {
case "amd64":
return "amd64"
case "arm64":
return "arm64"
case "ppc64le":
return "ppc64le"
}
panic(fmt.Sprintf("unsupported architecture %s", runtime.GOARCH))
}

// GetOSandArch validates/returns the current os/arch combination if supported and panics otherwise
func GetOSandArch(separator string) string {
switch runtime.GOOS {
case "darwin":
if runtime.GOARCH == "amd64" {
return "darwin" + separator + "amd64"
}
case "linux":
switch runtime.GOARCH {
case "amd64":
return "linux" + separator + "amd64"
case "arm64":
return "linux" + separator + "arm64"
}
case "windows":
if runtime.GOARCH == "amd64" {
return "windows" + separator + "amd64"
}
}
panic(fmt.Sprintf("unsupported platform %s%s%s", runtime.GOOS, separator, runtime.GOARCH))
}

0 comments on commit fbb27ea

Please sign in to comment.
You can’t perform that action at this time.