aboutsummaryrefslogtreecommitdiffstats
path: root/recipes-containers/k3s/k3s_git.bb
diff options
context:
space:
mode:
Diffstat (limited to 'recipes-containers/k3s/k3s_git.bb')
-rw-r--r--recipes-containers/k3s/k3s_git.bb59
1 files changed, 51 insertions, 8 deletions
diff --git a/recipes-containers/k3s/k3s_git.bb b/recipes-containers/k3s/k3s_git.bb
index c9779eaa..b88b8349 100644
--- a/recipes-containers/k3s/k3s_git.bb
+++ b/recipes-containers/k3s/k3s_git.bb
@@ -4,7 +4,7 @@ HOMEPAGE = "https://k3s.io/"
LICENSE = "Apache-2.0"
LIC_FILES_CHKSUM = "file://${S}/src/import/LICENSE;md5=2ee41112a44fe7014dce33e26468ba93"
-SRC_URI = "git://github.com/rancher/k3s.git;branch=release-1.22;name=k3s;protocol=https \
+SRC_URI = "git://github.com/rancher/k3s.git;branch=release-1.28;name=k3s;protocol=https \
file://k3s.service \
file://k3s-agent.service \
file://k3s-agent \
@@ -12,11 +12,16 @@ SRC_URI = "git://github.com/rancher/k3s.git;branch=release-1.22;name=k3s;protoco
file://cni-containerd-net.conf \
file://0001-Finding-host-local-in-usr-libexec.patch;patchdir=src/import \
file://k3s-killall.sh \
+ file://modules.txt \
"
+
SRC_URI[k3s.md5sum] = "363d3a08dc0b72ba6e6577964f6e94a5"
-SRCREV_k3s = "61a2aab25eeb97c26fa3f2b177e4355a7654c991"
+SRCREV_k3s = "051b14b248655896fdfd7ba6c93db6182cde7431"
+
+SRCREV_FORMAT = "k3s_fuse"
+PV = "v1.28.7+k3s1+git${SRCREV_k3s}"
-PV = "v1.22.3+k3s1"
+include src_uri.inc
CNI_NETWORKING_FILES ?= "${WORKDIR}/cni-containerd-net.conf"
@@ -25,11 +30,13 @@ inherit goarch
inherit systemd
inherit cni_networking
+COMPATIBLE_HOST = "^(?!mips).*"
+
PACKAGECONFIG = ""
PACKAGECONFIG[upx] = ",,upx-native"
GO_IMPORT = "import"
-GO_BUILD_LDFLAGS = "-X github.com/rancher/k3s/pkg/version.Version=${PV} \
- -X github.com/rancher/k3s/pkg/version.GitCommit=${@d.getVar('SRCREV_k3s', d, 1)[:8]} \
+GO_BUILD_LDFLAGS = "-X github.com/k3s-io/k3s/pkg/version.Version=${PV} \
+ -X github.com/k3s-io/k3s/pkg/version.GitCommit=${@d.getVar('SRCREV_k3s', d, 1)[:8]} \
-w -s \
"
BIN_PREFIX ?= "${exec_prefix}/local"
@@ -37,15 +44,40 @@ BIN_PREFIX ?= "${exec_prefix}/local"
inherit features_check
REQUIRED_DISTRO_FEATURES ?= "seccomp"
+DEPENDS += "rsync-native"
+
+include relocation.inc
+
do_compile() {
export GOPATH="${S}/src/import/.gopath:${S}/src/import/vendor:${STAGING_DIR_TARGET}/${prefix}/local/go"
export CGO_ENABLED="1"
export GOFLAGS="-mod=vendor"
- TAGS="static_build ctrd no_btrfs netcgo osusergo providerless"
+ # TAGS="static_build ctrd no_btrfs netcgo osusergo providerless"
+ TAGS="static_build netcgo osusergo providerless"
cd ${S}/src/import
- ${GO} build -tags "$TAGS" -ldflags "${GO_BUILD_LDFLAGS} -w -s" -o ./dist/artifacts/k3s ./cmd/server/main.go
+
+ if ! [ -e vendor/.noclobber ]; then
+ ln -sf vendor.copy vendor
+ else
+ echo "[INFO]: no clobber on vendor"
+ fi
+
+ # these are bad symlinks, go validates them and breaks the build if they are present
+ rm -f vendor/go.etcd.io/etcd/client/v*/example_*
+ rm -f vendor/go.etcd.io/etcd/client/v*/concurrency/example_*.go
+
+ # Note: if no_brtfs is used in the tags, we'll violate build
+ # constraints, and the following files need to have them
+ # removed for the build to continue:
+ #
+ # vendor/github.com/containerd/containerd/snapshots/btrfs/plugin/*.go
+
+ cp ${WORKDIR}/modules.txt vendor/
+
+ VERSION_GOLANG="$(go version | cut -d" " -f3)"
+ ${GO} build -trimpath -tags "$TAGS" -ldflags "-X github.com/k3s-io/k3s/pkg/version.UpstreamGolang=$VERSION_GOLANG ${GO_BUILD_LDFLAGS} -w -s" -o ./dist/artifacts/k3s ./cmd/server/main.go
# Use UPX if it is enabled (and thus exists) to compress binary
if command -v upx > /dev/null 2>&1; then
@@ -69,6 +101,9 @@ do_install() {
sed -i "s#\(Exec\)\(.*\)=\(.*\)\(k3s\)#\1\2=${BIN_PREFIX}/bin/\4#g" "${D}${systemd_system_unitdir}/k3s.service" "${D}${systemd_system_unitdir}/k3s-agent.service"
install -m 755 "${WORKDIR}/k3s-agent" "${D}${BIN_PREFIX}/bin"
fi
+
+ mkdir -p ${D}${datadir}/k3s/
+ install -m 0755 ${S}/src/import/contrib/util/check-config.sh ${D}${datadir}/k3s/
}
PACKAGES =+ "${PN}-server ${PN}-agent"
@@ -100,9 +135,17 @@ RRECOMMENDS:${PN} = "\
kernel-module-xt-nflog \
kernel-module-xt-limit \
kernel-module-nfnetlink-log \
+ kernel-module-ip-vs \
+ kernel-module-ip-vs-rr \
+ kernel-module-ip-vs-sh \
+ kernel-module-ip-vs-wrr \
"
RCONFLICTS:${PN} = "kubectl"
+PACKAGES =+ "${PN}-contrib"
+FILES:${PN}-contrib += "${datadir}/k3s/check-config.sh"
+RDEPENDS:${PN}-contrib += "bash"
+
INHIBIT_PACKAGE_STRIP = "1"
-INSANE_SKIP:${PN} += "ldflags already-stripped"
+INSANE_SKIP:${PN} += "ldflags already-stripped textrel"