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

Addon gvisor: Add building arm64 image #18453

Merged
merged 1 commit into from
Mar 20, 2024
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 7 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ SHA512SUM=$(shell command -v sha512sum || echo "shasum -a 512")

# gvisor tag to automatically push changes to
# to update minikubes default, update deploy/addons/gvisor
GVISOR_TAG ?= latest
GVISOR_TAG ?= v0.0.1

# auto-pause-hook tag to push changes to
AUTOPAUSE_HOOK_TAG ?= v0.0.5
Expand Down Expand Up @@ -787,13 +787,15 @@ out/gvisor-addon: ## Build gvisor addon
$(Q)GOOS=linux GOARCH=amd64 CGO_ENABLED=0 go build -o $@ cmd/gvisor/gvisor.go

.PHONY: gvisor-addon-image
gvisor-addon-image: out/gvisor-addon ## Build docker image for gvisor
docker build --platform=linux/amd64 -t $(REGISTRY)/gvisor-addon:$(GVISOR_TAG) -f deploy/gvisor/Dockerfile .
gvisor-addon-image:
docker build -t $(REGISTRY)/gvisor-addon:$(GVISOR_TAG) -f deploy/gvisor/Dockerfile .

.PHONY: push-gvisor-addon-image
push-gvisor-addon-image: gvisor-addon-image
push-gvisor-addon-image: docker-multi-arch-build
docker login gcr.io/k8s-minikube
$(MAKE) push-docker IMAGE=$(REGISTRY)/gvisor-addon:$(GVISOR_TAG)
docker buildx create --name multiarch --bootstrap
docker buildx build --push --builder multiarch --platform linux/amd64,linux/arm64 -t $(REGISTRY)/gvisor-addon:$(GVISOR_TAG) -t $(REGISTRY)/gvisor-addon:latest -f deploy/gvisor/Dockerfile .
docker buildx rm multiarch

.PHONY: release-iso
release-iso: minikube-iso-aarch64 minikube-iso-x86_64 checksum ## Build and release .iso files
Expand Down
9 changes: 8 additions & 1 deletion deploy/gvisor/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,15 @@
# See the License for the specific language governing permissions and
# limitations under the License.

FROM golang:1.22.1 AS builder
WORKDIR /app
COPY go.mod go.sum ./
RUN go mod download
COPY ./ ./
RUN GOOS=linux CGO_ENABLED=0 go build -o gvisor-addon cmd/gvisor/gvisor.go

# Need an image with chroot
FROM alpine:3
RUN apk -U add ca-certificates
COPY out/gvisor-addon /gvisor-addon
COPY --from=builder /app/gvisor-addon /gvisor-addon
CMD ["/gvisor-addon"]
5 changes: 5 additions & 0 deletions hack/update/golang_version/update_golang_version.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,11 @@ var (
`golang:.* AS`: `golang:{{.StableVersion}} AS`,
},
},
"deploy/gvisor/Dockerfile": {
Replace: map[string]string{
`golang:.* AS`: `golang:{{.StableVersion}} AS`,
},
},
}
)

Expand Down
2 changes: 1 addition & 1 deletion pkg/minikube/assets/addons.go
Original file line number Diff line number Diff line change
Expand Up @@ -521,7 +521,7 @@ var Addons = map[string]*Addon{
"gvisor-runtimeclass.yaml",
"0640"),
}, false, "gvisor", "minikube", "", "https://github.com/kubernetes/minikube/blob/master/deploy/addons/gvisor/README.md", map[string]string{
"GvisorAddon": "k8s-minikube/gvisor-addon:4@sha256:4bdc0bec3f36a32e534d9da98552810c832dd58fd0a361e5c0b836606b164bc2",
"GvisorAddon": "k8s-minikube/gvisor-addon:v0.0.1@sha256:d29adbddc7a44dab4c675c0eaea398907fe1f33f5f723274b0d40195b3076cae",
}, map[string]string{
"GvisorAddon": "gcr.io",
}),
Expand Down
Loading