Skip to content
This repository has been archived by the owner on Oct 11, 2023. It is now read-only.

Add ipxe support #3065

Closed
wants to merge 16 commits into from
Closed
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
4 changes: 2 additions & 2 deletions .drone.yml
Original file line number Diff line number Diff line change
Expand Up @@ -114,8 +114,8 @@ steps:
from_secret: docker_password
platforms:
- linux/amd64
target: "rancher/os:${DRONE_TAG}"
template: "rancher/os:${DRONE_TAG}-ARCH"
target: "rancher/os2:${DRONE_TAG}"
template: "rancher/os2:${DRONE_TAG}-ARCH"
when:
instance:
- drone-publish.rancher.io
Expand Down
16 changes: 16 additions & 0 deletions .github/workflows/docs.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
name: docs
on:
push:
branches:
- v2-test
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
with:
python-version: 3.x
- run: pip install mkdocs-material
- run: pip install mkdocs-markdownextradata-plugin
- run: mkdocs gh-deploy --force --strict
63 changes: 48 additions & 15 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,41 +1,60 @@
FROM opensuse/leap:15.3 AS build
RUN zypper ref
RUN zypper in -y squashfs xorriso go1.16 upx busybox-static curl
RUN curl -Lo /usr/bin/luet https://github.com/mudler/luet/releases/download/0.18.1/luet-0.18.1-linux-$(go env GOARCH) && \
chmod +x /usr/bin/luet
RUN zypper in -y squashfs xorriso go1.16 upx busybox-static curl tar git gzip
RUN curl -Lo /usr/bin/luet https://github.com/mudler/luet/releases/download/0.20.6/luet-0.20.6-linux-$(go env GOARCH) && \
chmod +x /usr/bin/luet && \
upx /usr/bin/luet
RUN curl -Lo /usr/bin/rancherd https://github.com/rancher/rancherd/releases/download/v0.0.1-alpha11/rancherd-$(go env GOARCH) && \
chmod +x /usr/bin/rancherd && \
upx /usr/bin/rancherd
RUN curl -L https://get.helm.sh/helm-v3.7.1-linux-$(go env GOARCH).tar.gz | tar xzf - -C /usr/bin --strip-components=1 && \
upx /usr/bin/helm
COPY go.mod go.sum /usr/src/
COPY cmd /usr/src/cmd
COPY pkg /usr/src/pkg
COPY scripts /usr/src/scripts
COPY chart /usr/src/chart
ARG IMAGE_TAG=latest
RUN TAG=${IMAGE_TAG} /usr/src/scripts/package-helm && \
cp /usr/src/dist/artifacts/rancheros-operator-*.tgz /usr/src/dist/rancheros-operator-chart.tgz
RUN cd /usr/src && \
CGO_ENABLED=0 go build -ldflags "-extldflags -static -s" -o /usr/sbin/ros-operator ./cmd/ros-operator && \
upx /usr/sbin/ros-operator
RUN cd /usr/src && \
CGO_ENABLED=0 go build -ldflags "-extldflags -static -s" -o /usr/sbin/ros-installer ./cmd/ros-installer && \
upx /usr/sbin/ros-installer

FROM scratch AS framework
COPY --from=build /usr/bin/busybox-static /usr/bin/busybox
COPY --from=build /usr/bin/rancherd /usr/bin/rancherd
COPY --from=build /usr/bin/luet /usr/bin/luet
COPY --from=build /usr/bin/helm /usr/bin/helm
COPY --from=build /usr/src/dist/rancheros-operator-chart.tgz /usr/share/rancher/os2/
COPY framework/files/etc/luet/luet.yaml /etc/luet/luet.yaml
COPY --from=build /etc/ssl/certs /etc/ssl/certs

ARG CACHEBUST
ENV LUET_NOLOCK=true
RUN ["/usr/bin/busybox", "sh", "-c", "if [ -e /etc/luet/luet.yaml.$(busybox uname -m) ]; then busybox mv -f /etc/luet/luet.yaml.$(busybox uname -m) /etc/luet/luet.yaml; fi && busybox rm -f /etc/luet/luet.yaml.*"]
RUN ["luet", \
"install", "--no-spinner", "-d", "-y", \
"selinux/k3s", \
"selinux/rancher", \
"meta/cos-minimal", \
"utils/k9s", \
"utils/rancherd", \
"utils/nerdctl"]

COPY --from=build /usr/sbin/ros-installer /usr/sbin/ros-installer
COPY --from=build /usr/sbin/ros-operator /usr/sbin/ros-operator
COPY framework/files/ /
RUN ["/usr/bin/busybox", "sh", "-c", "if [ -e /etc/luet/luet.yaml.$(busybox uname -m) ]; then busybox mv -f /etc/luet/luet.yaml.$(busybox uname -m) /etc/luet/luet.yaml; fi && busybox rm -f /etc/luet/luet.yaml.*"]
RUN ["/usr/bin/busybox", "rm", "-rf", "/var", "/etc/ssl", "/usr/bin/busybox"]

# Make OS image
FROM opensuse/leap:15.3 as os
RUN sed -i -s 's/^# rpm.install.excludedocs/rpm.install.excludedocs/' /etc/zypp/zypp.conf
RUN zypper ref
RUN zypper in -y \
RUN zypper dup -y
RUN zypper in -y -- \
apparmor-parser \
avahi \
bash-completion \
Expand All @@ -55,7 +74,6 @@ RUN zypper in -y \
grub2-x86_64-efi \
haveged \
hdparm \
iotop \
iproute2 \
iptables \
iputils \
Expand All @@ -76,50 +94,56 @@ RUN zypper in -y \
kernel-firmware-qlogic \
kernel-firmware-realtek \
kernel-firmware-usb-network \
-kubic-locale-archive \
less \
lshw \
lsof \
lsscsi \
lvm2 \
mdadm \
multipath-tools \
nano \
netcat-openbsd \
nfs-utils \
open-iscsi \
open-vm-tools \
openssh \
parted \
-perl \
pciutils \
pigz \
policycoreutils \
procps \
psmisc \
python-azure-agent \
qemu-guest-agent \
rng-tools \
rsync \
squashfs \
strace \
SUSEConnect \
sysstat \
systemd \
systemd-presets-branding-openSUSE \
-systemd-presets-branding-MicroOS \
systemd-sysvinit \
tar \
tcpdump \
timezone \
vim \
vim-small \
which \
zstd

# Copy in some local OS customizations
COPY opensuse/files /

ARG IMAGE_TAG=latest
RUN cat /etc/os-release.tmpl | env \
"VERSION=${IMAGE_TAG}" \
"VERSION_ID=$(echo ${IMAGE_TAG} | sed s/^v//)" \
"PRETTY_NAME=RancherOS ${IMAGE_TAG}" \
envsubst > /etc/os-release && \
rm /etc/os-release.tmpl

# Starting from here are the lines needed for RancherOS to work

# IMPORTANT: Setup rancheros-release used for versioning/upgrade. The
# values here should reflect the tag of the image being built
ARG IMAGE_REPO=norepo
ARG IMAGE_TAG=latest
RUN echo "IMAGE_REPO=${IMAGE_REPO}" > /usr/lib/rancheros-release && \
echo "IMAGE_TAG=${IMAGE_TAG}" >> /usr/lib/rancheros-release && \
echo "IMAGE=${IMAGE_REPO}:${IMAGE_TAG}" >> /usr/lib/rancheros-release
Expand All @@ -132,3 +156,12 @@ RUN mkinitrd && \
# aarch64 has an uncompressed kernel so we need to link it to vmlinuz
kernel=$(ls /boot/Image-* | head -n1) && \
if [ -e "$kernel" ]; then ln -sf "${kernel#/boot/}" /boot/vmlinuz; fi

# Save some space
RUN zypper clean --all && \
rm -rf /var/log/update* && \
>/var/log/lastlog && \
rm -rf /boot/vmlinux*

FROM scratch as default
COPY --from=os / /
6 changes: 3 additions & 3 deletions Dockerfile.dapper
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
FROM opensuse/leap
FROM opensuse/leap:15.3
RUN zypper ref

ARG DAPPER_HOST_ARCH
ENV ARCH $DAPPER_HOST_ARCH

RUN zypper in -y bash git gcc docker vim less file curl wget ca-certificates make mkisofs go1.16
RUN zypper in -y bash git gcc docker vim less file curl wget ca-certificates make mkisofs go1.16 qemu-tools trousers-devel
RUN go get golang.org/x/tools/cmd/goimports
RUN if [ "${ARCH}" == "amd64" ]; then \
curl -sL https://install.goreleaser.com/github.com/golangci/golangci-lint.sh | sh -s v1.40.1; \
Expand All @@ -13,7 +13,7 @@ RUN if [ "${ARCH}" == "amd64" ]; then \
ENV DOCKER_BUILDKIT 1
ENV DOCKER_CLI_EXPERIMENTAL enabled
ENV DAPPER_ENV REPO TAG DRONE_TAG CROSS DOCKER_USERNAME DOCKER_PASSWORD AWS_ACCESS_KEY_ID AWS_SECRET_ACCESS_KEY AWS_DEFAULT_REGION
ENV DAPPER_SOURCE /go/src/github.com/rancher/os/
ENV DAPPER_SOURCE /go/src/github.com/rancher/os2/
ENV DAPPER_OUTPUT ./bin ./dist
ENV DAPPER_DOCKER_SOCKET true
ENV DAPPER_RUN_ARGS "-v ros-go16-pkg-1:/go/pkg -v ros-go16-cache-1:/root/.cache/go-build"
Expand Down
3 changes: 3 additions & 0 deletions Dockerfile.docs
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
FROM squidfunk/mkdocs-material
RUN pip install mkdocs-markdownextradata-plugin
RUN apk add -U git openssh
30 changes: 30 additions & 0 deletions Dockerfile.kvm
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
FROM opensuse/leap:15.3
RUN zypper ref
RUN zypper install -y socat net-tools-deprecated libtasn1-devel gnutls-devel libseccomp-devel json-glib-devel system-user-tss git
RUN zypper install -y autoconf
RUN zypper install -y automake
RUN git clone https://github.com/stefanberger/swtpm.git /usr/src/swtpm
RUN zypper install -y libtool
RUN zypper install -y gcc
RUN zypper install -y libopenssl-devel
RUN git clone https://github.com/stefanberger/libtpms.git /usr/src/libtpms
RUN zypper install -y gcc-c++
RUN zypper install -y make
RUN zypper install -y expect
RUN zypper install -y sudo
RUN cd /usr/src/libtpms && \
./autogen.sh --with-openssl --with-tpm2 && \
make -j4 && \
make install
RUN cd /usr/src/swtpm && \
./autogen.sh --prefix=/usr --libdir=/usr/lib64 --with-openssl --with-tss-user=root --with-tss-group=tss && \
make -j4 && \
sudo make -j4 && \
sudo make install
RUN zypper install -y qemu-x86 qemu-arm qemu-tools

COPY scripts/qemu-in-container /usr/bin/
ENTRYPOINT ["/usr/bin/qemu-in-container"]

RUN chmod +s /usr/lib/qemu-bridge-helper
RUN echo 'allow all' > /etc/qemu/bridge.conf
Loading