Skip to content

Commit

Permalink
re-add k3s without flux (#26)
Browse files Browse the repository at this point in the history
* readd k3s without flux

Signed-off-by: vsoch <vsoch@users.noreply.github.com>
  • Loading branch information
vsoch authored Nov 13, 2023
1 parent cd674b4 commit ddcc008
Show file tree
Hide file tree
Showing 3 changed files with 77 additions and 0 deletions.
58 changes: 58 additions & 0 deletions k3s/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
ARG tag=jammy
FROM ubuntu:${tag}
ENV DEBIAN_FRONTEND=noninteractive
ENV TZ=UTC

# See https://github.com/k3s-io/k3s/blob/master/package/Dockerfile
# We needed k3s in ubuntu with flux
# docker build -t test .

# Dependencies for environment
RUN apt-get update && apt-get install -y ca-certificates \
tar zstd wget tzdata libseccomp-dev curl git \
gcc pkg-config build-essential \
# This is needed for building k3s
libbtrfs-dev btrfs-progs \
software-properties-common && \
add-apt-repository --yes ppa:rmescandon/yq && \
apt-get update && \
apt-get install yq -y

# Install Go (this version is checked in ./validate)
RUN wget https://go.dev/dl/go1.20.10.linux-amd64.tar.gz && \
tar -C /usr/local -xzf go1.20.10.linux-amd64.tar.gz

# This builds k3s
WORKDIR /src
RUN git clone --depth 1 https://github.com/k3s-io/k3s && \
cd k3s && \
export PATH=/usr/local/go/bin:$PATH && \
cd ./scripts && \
./download && \
./validate && \
./build && \
# Remove line that tries to upload to s3
sed -i '$ d' ./package-cli && \
./package-cli

# Move into bins and uninstall go and finalize stuffs
# We have a custom scripts that only copies over executables
# we don't have. I'm worried this was prepared for busybox
# and runtime will have issues.
COPY ./move.sh /src/k3s/move.sh
WORKDIR /src/k3s
RUN mkdir -p /lib/modules /lib/firmware && \
/bin/bash ./move.sh

WORKDIR /
RUN rm -rf /src /usr/local/go && \
echo 'hosts: files dns' > /etc/nsswitch.conf && \
echo "PRETTY_NAME=\"K3s develop\"" > /etc/os-release && \
chmod 1777 /tmp

VOLUME /var/lib/kubelet
VOLUME /var/lib/rancher/k3s
VOLUME /var/lib/cni
VOLUME /var/log
ENV PATH="$PATH:/usr/local/bin/aux"
ENV CRI_CONFIG_FILE="/var/lib/rancher/k3s/agent/etc/crictl.yaml"
13 changes: 13 additions & 0 deletions k3s/move.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#!/bin/bash

set -ex

for f in ./bin/*; do
base=$(basename $f)
dest=/bin/$base
if [[ ! -e "${dest}" ]]; then
echo "Copying $f to ${dest}...";
cp -R $f /bin/
fi
done
mv dist/artifacts/k3s /usr/bin/k3s
6 changes: 6 additions & 0 deletions k3s/uptodate.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
dockerbuild:
build_args:
tag:
key: ubuntu
versions:
- jammy

0 comments on commit ddcc008

Please sign in to comment.