-
Notifications
You must be signed in to change notification settings - Fork 226
Conversation
@stealthybox I think this one's ready for review. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I tried the image myself and it works as expected.
root@cb6c15853793e78a:~# k3s kubectl version
Client Version: version.Info{Major:"1", Minor:"19", GitVersion:"v1.19.4+k3s1", GitCommit:"2532c10faad43e2b6e728fdcc01662dc13d37764", GitTreeState:"clean", BuildDate:"2020-11-18T22:11:18Z", GoVersion:"go1.15.2", Compiler:"gc", Platform:"linux/amd64"}
Server Version: version.Info{Major:"1", Minor:"19", GitVersion:"v1.19.4+k3s1", GitCommit:"2532c10faad43e2b6e728fdcc01662dc13d37764", GitTreeState:"clean", BuildDate:"2020-11-18T22:11:18Z", GoVersion:"go1.15.2", Compiler:"gc", Platform:"linux/amd64"}
Had to set 2GB memory for the VM, else k3s fails with out of memory error. The default 512MB of memory is not enough. We can document it better, similar to the README in images/kubeadm/README.md.
We can also add docs for multi-node HA setup separately, similar to kubeadm, in the future.
Thanks for working on this.
images/Makefile
Outdated
@@ -161,6 +161,9 @@ build-centos: | |||
$(MAKE) ${OP} WHAT=centos RELEASE=7 | |||
$(MAKE) ${OP} WHAT=centos RELEASE=8 IS_LATEST=true | |||
|
|||
build-k3s: | |||
$(MAKE) ${OP} WHAT=k3s RELEASE=v1.0.1 IS_LATEST=true |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I tried changing RELEASE
to a docker hub image tag found in https://hub.docker.com/r/rancher/k3s/tags?page=1&ordering=last_updated , v1.19.4-k3s1
and as you mentioned, it failed because the official k3s version has a +
in the name.
[INFO] Downloading hash https://github.com/rancher/k3s/releases/download/v1.19.4-k3s1/sha256sum-amd64.txt
The command '/bin/sh -c curl -sfL https://get.k3s.io | INSTALL_K3S_SKIP_ENABLE=true INSTALL_K3S_VERSION="${RELEASE}" sh -' returned a non-zero code: 22
Makefile:68: recipe for target 'build' failed
The download URL isn't correct.
Since we need +
in the version but just not in the docker image tag, I tried escaping the RELEASE
variable with something like:
diff --git a/images/Makefile b/images/Makefile
index 716610f9..fd6fd2c2 100644
--- a/images/Makefile
+++ b/images/Makefile
@@ -32,14 +32,15 @@ DOCKER_USER?=weaveworks
VERSION?=$(shell git describe HEAD --tags)
RELEASE?=latest
FULL_IMAGE_NAME=${DOCKER_USER}/ignite-${WHAT}:${TAG}
-RELEASE_IMAGE_NAME=${DOCKER_USER}/ignite-${WHAT}:${RELEASE}
+escaped_RELEASE:=$(subst +,-,$(RELEASE))
+RELEASE_IMAGE_NAME:=${DOCKER_USER}/ignite-${WHAT}:${escaped_RELEASE}
LATEST_IMAGE_NAME=${DOCKER_USER}/ignite-${WHAT}:latest
GOARCH?=amd64
GOARCH_LIST=amd64 arm64
# Set this flag to build a multiarch image
IS_MANIFEST_LIST?=0
-TAG:=${RELEASE}$(if $(strip $(VERSION)),-${VERSION})
+TAG:=${escaped_RELEASE}$(if $(strip $(VERSION)),-${VERSION})
OP:=build
TMPDIR?=/tmp
@@ -162,7 +163,7 @@ build-centos:
$(MAKE) ${OP} WHAT=centos RELEASE=8 IS_LATEST=true
build-k3s:
- $(MAKE) ${OP} WHAT=k3s RELEASE=v1.0.1 IS_LATEST=true
+ $(MAKE) ${OP} WHAT=k3s RELEASE=v1.19.4+k3s1 IS_LATEST=true
build-kubeadm:
That made it work properly.
We don't run the OS image builds in the regular CI, so the build failure is unrelated. Don't need to worry about it 🙂 |
@darkowlzz Thank you for the feedback! I've patched the Makefile with the changes you mentioned, and added a simple README. |
LGTM -- thanks for fixing the tag problem |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM! Thanks.
This change adds an image for k3s, a lightweight Kubernetes distribution, as per #329.
A few notes:
rancher/k3s
image seems to be too minimal to function correctly—for example, it wouldn't mount/proc
, etc. Thus, this image is based on Ubuntu 20.04, with k3s installed via the provided Rancher script+
symbol in them, so the version of k3s used for this image is the highest version before+
was introduced into the release tags, i.e. v1.0.1.hello-kubernetes
Service.