Skip to content

Commit 5ff2939

Browse files
authored
Merge pull request #18063 from spowelljr/gvisorArm64
addons gvisor: Add arm64 support
2 parents f9e3939 + 9a5d814 commit 5ff2939

File tree

3 files changed

+18
-19
lines changed

3 files changed

+18
-19
lines changed

pkg/addons/config.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ var Addons = []*Addon{
7171
{
7272
name: "gvisor",
7373
set: SetBool,
74-
validations: []setFn{SupportsAmd64, IsRuntimeContainerd},
74+
validations: []setFn{IsRuntimeContainerd},
7575
callbacks: []setFn{EnableOrDisableAddon, verifyAddonStatus},
7676
},
7777
{

pkg/addons/validations.go

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -18,14 +18,12 @@ package addons
1818

1919
import (
2020
"fmt"
21-
"runtime"
2221
"strconv"
2322

2423
"github.com/spf13/viper"
2524
"k8s.io/minikube/pkg/minikube/assets"
2625
"k8s.io/minikube/pkg/minikube/config"
2726
"k8s.io/minikube/pkg/minikube/cruntime"
28-
"k8s.io/minikube/pkg/minikube/driver"
2927
"k8s.io/minikube/pkg/minikube/out"
3028
)
3129

@@ -95,15 +93,3 @@ func contains(slice []string, val string) bool {
9593
}
9694
return false
9795
}
98-
99-
// SupportsAmd64 ensures that the cluster supports running amd64 images
100-
func SupportsAmd64(cc *config.ClusterConfig, name, _ string) error {
101-
// KIC can run amd64 images on a non-amd64 environment
102-
if driver.IsKIC(cc.Driver) {
103-
return nil
104-
}
105-
if runtime.GOARCH == "amd64" {
106-
return nil
107-
}
108-
return fmt.Errorf("the %q addon requires a cluster that supports running amd64 images", name)
109-
}

pkg/gvisor/enable.go

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ import (
2525
"os/exec"
2626
"os/signal"
2727
"path/filepath"
28+
"runtime"
2829
"syscall"
2930

3031
"github.com/docker/machine/libmachine/mcnutils"
@@ -36,17 +37,29 @@ const (
3637
containerdConfigPath = "/etc/containerd/config.toml"
3738
containerdConfigBackupPath = "/tmp/containerd-config.toml.bak"
3839

39-
releaseURL = "https://storage.googleapis.com/gvisor/releases/release/latest/x86_64/"
40-
shimURL = releaseURL + "containerd-shim-runsc-v1"
41-
gvisorURL = releaseURL + "runsc"
42-
4340
configFragment = `
4441
[plugins."io.containerd.grpc.v1.cri".containerd.runtimes.runsc]
4542
runtime_type = "io.containerd.runsc.v1"
4643
pod_annotations = [ "dev.gvisor.*" ]
4744
`
4845
)
4946

47+
var (
48+
shimURL = releaseURL() + "containerd-shim-runsc-v1"
49+
gvisorURL = releaseURL() + "runsc"
50+
)
51+
52+
func releaseURL() string {
53+
arch := runtime.GOARCH
54+
switch arch {
55+
case "amd64":
56+
arch = "x86_64"
57+
case "arm64":
58+
arch = "aarch64"
59+
}
60+
return fmt.Sprintf("https://storage.googleapis.com/gvisor/releases/release/latest/%s/", arch)
61+
}
62+
5063
// Enable follows these steps for enabling gvisor in minikube:
5164
// 1. creates necessary directories for storing binaries and runsc logs
5265
// 2. downloads runsc and gvisor-containerd-shim

0 commit comments

Comments
 (0)