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

Commit

Permalink
Merge pull request #327 from dweomer/fix-upgrade-scripts
Browse files Browse the repository at this point in the history
fix the upgrade scripts
  • Loading branch information
dweomer authored Dec 13, 2019
2 parents f054b94 + 146f8d1 commit e0c7f87
Show file tree
Hide file tree
Showing 18 changed files with 414 additions and 45 deletions.
2 changes: 1 addition & 1 deletion Dockerfile.dapper
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM golang:1.12-alpine
FROM golang:1.13-alpine

ARG DAPPER_HOST_ARCH
ENV ARCH $DAPPER_HOST_ARCH
Expand Down
16 changes: 16 additions & 0 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,29 @@ go 1.13

require (
github.com/docker/docker v1.13.1
github.com/docker/go-units v0.4.0 // indirect
github.com/ghodss/yaml v1.0.0
github.com/konsorten/go-windows-terminal-sequences v1.0.2 // indirect
github.com/mattn/go-isatty v0.0.10
github.com/pkg/errors v0.8.1
github.com/rancher/mapper v0.0.0-20190814232720-058a8b7feb99
github.com/rancher/wrangler v0.3.1 // indirect
github.com/sirupsen/logrus v1.4.2
github.com/stretchr/testify v1.4.0 // indirect
github.com/urfave/cli v1.22.2
golang.org/x/crypto v0.0.0-20191122220453-ac88ee75c92c
golang.org/x/sys v0.0.0-20191127021746-63cb32ae39b2
gopkg.in/freddierice/go-losetup.v1 v1.0.0-20170407175016-fc9adea44124
)

replace (
k8s.io/api => github.com/rancher/kubernetes/staging/src/k8s.io/api v1.16.3-k3s.2
k8s.io/apiextensions-apiserver => github.com/rancher/kubernetes/staging/src/k8s.io/apiextensions-apiserver v1.16.3-k3s.2
k8s.io/apimachinery => github.com/rancher/kubernetes/staging/src/k8s.io/apimachinery v1.16.3-k3s.2
k8s.io/apiserver => github.com/rancher/kubernetes/staging/src/k8s.io/apiserver v1.16.3-k3s.2
k8s.io/client-go => github.com/rancher/kubernetes/staging/src/k8s.io/client-go v1.16.3-k3s.2
k8s.io/code-generator => github.com/rancher/kubernetes/staging/src/k8s.io/code-generator v1.16.3-k3s.2
k8s.io/component-base => github.com/rancher/kubernetes/staging/src/k8s.io/component-base v1.16.3-k3s.2
k8s.io/kube-aggregator => github.com/rancher/kubernetes/staging/src/k8s.io/kube-aggregator v1.16.3-k3s.2
k8s.io/metrics => github.com/rancher/kubernetes/staging/src/k8s.io/metrics v1.16.3-k3s.2
)
274 changes: 265 additions & 9 deletions go.sum

Large diffs are not rendered by default.

11 changes: 4 additions & 7 deletions images/03-bin/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,20 +1,17 @@
ARG REPO
ARG TAG
FROM ${REPO}/k3os-rootfs:${TAG} as rootfs
RUN echo

ARG REPO
ARG TAG
FROM ${REPO}/k3os-progs:${TAG} as progs
RUN echo

ARG REPO
ARG TAG
FROM ${REPO}/k3os-base:${TAG}

ARG REPO
ARG TAG
COPY --from=rootfs /output/rootfs.squashfs /usr/src/
COPY --from=rootfs /output/rootfs.squashfs /usr/src/
COPY install.sh /output/k3os-install.sh
COPY --from=progs /output/k3os /output/k3os
RUN echo -n "_sqmagic_" >> /output/k3os && \
cat /usr/src/rootfs.squashfs >> /output/k3os
RUN echo -n "_sqmagic_" >> /output/k3os
RUN cat /usr/src/rootfs.squashfs >> /output/k3os
1 change: 1 addition & 0 deletions images/03-bin/root
28 changes: 15 additions & 13 deletions overlay/sbin/k3os-upgrade-kernel
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
#!/bin/bash

set -e

if [ $(whoami) != "root" ]
then
echo "This script must be run as root."
Expand All @@ -11,7 +13,7 @@ PROC=$(uname -m)
# Take a parameter of the version number (i.e. v0.4.0) if it is given, otherwise use latest
if [ -z $K3OS_VERSION ]
then
K3OS_VERSION=latest
K3OS_VERSION=$(curl -sL api.github.com/repos/rancher/k3os/releases/latest | jq .tag_name -r)
fi

if [ ! -d /k3os/system/kernel ]
Expand All @@ -24,7 +26,7 @@ then
elif [ $PROC == "aarch64" ]
then
ARCH="arm64"
elif [ $PROC == "armv7l" ]
elif [[ $PROC == arm* ]] # catches armv7l and armhf
then
ARCH="arm"
echo "k3os for 32-bit ARM architecture only provides rootfs, no kernel updates available."
Expand All @@ -34,23 +36,23 @@ else
exit 1
fi

KERNEL_VERSION=$(curl -sL https://github.com/rancher/k3os/releases/${K3OS_VERSION}/download/k3os-kernel-version-${ARCH})
KERNEL_VERSION=$(curl -sL https://github.com/rancher/k3os/releases/download/${K3OS_VERSION}/k3os-kernel-version-${ARCH})
if [ -z "$KERNEL_VERSION" ]
then
echo "Unable to determine kernel version"
exit 1
fi

echo "Upgrading k3os kernel to ${KERNEL_VERSION}"

cd /k3os/system/
mount -o remount,rw .
cd kernel
mkdir -p ${KERNEL_VERSION}
cd ${KERNEL_VERSION}
curl -sL https://github.com/rancher/k3os/releases/${K3OS_VERSION}/download/k3os-initrd-${ARCH} --output initrd
curl -sL https://github.com/rancher/k3os/releases/${K3OS_VERSION}/download/k3os-kernel-${ARCH}.squashfs --output kernel.squashfs
cd ..

PREVIOUS_KERNEL=$(ls -l current | awk '{print $11}')
ln -s ${PREVIOUS_KERNEL} previous
unlink current
ln -s ${KERNEL_VERSION} current
mkdir -vp ${KERNEL_VERSION}
curl -sL https://github.com/rancher/k3os/releases/download/${K3OS_VERSION}/k3os-initrd-${ARCH} --output ${KERNEL_VERSION}/initrd
curl -sL https://github.com/rancher/k3os/releases/download/${K3OS_VERSION}/k3os-kernel-${ARCH}.squashfs --output ${KERNEL_VERSION}/kernel.squashfs
ln -nsf $(readlink current) previous
ln -nsf ${KERNEL_VERSION} current
sync

echo "Upgrade complete! Please reboot."
10 changes: 5 additions & 5 deletions overlay/sbin/k3os-upgrade-rootfs
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
#!/bin/bash

set -e

if [ $(whoami) != "root" ]
then
echo "This script must be run as root."
Expand All @@ -20,7 +22,7 @@ then
elif [ $PROC == "aarch64" ]
then
ARCH="arm64"
elif [ $PROC == "armv7l" ]
elif [[ $PROC == arm* ]] # catches armv7l and armhf
then
ARCH="arm"
else
Expand All @@ -30,11 +32,9 @@ fi

echo "Upgrading k3os to ${K3OS_VERSION}"

K3OS_ROOTFS_URL="https://github.com/rancher/k3os/releases/download/${K3OS_VERSION}/k3os-rootfs-${ARCH}.tar.gz"

cd /k3os/system/
cd /k3os/system
mount -o remount,rw .
curl -fsSL "${K3OS_ROOTFS_URL}" | tar xz --strip-components=3
curl -fsSL "https://github.com/rancher/k3os/releases/download/${K3OS_VERSION}/k3os-rootfs-${ARCH}.tar.gz" | tar xz --strip-components=3
sync

echo "Upgrade complete! Please reboot."
2 changes: 1 addition & 1 deletion vendor/github.com/docker/go-units/MAINTAINERS

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion vendor/github.com/docker/go-units/circle.yml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion vendor/github.com/docker/go-units/duration.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 7 additions & 2 deletions vendor/github.com/docker/go-units/ulimit.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

26 changes: 26 additions & 0 deletions vendor/github.com/rancher/wrangler/pkg/name/name.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

38 changes: 38 additions & 0 deletions vendor/gopkg.in/yaml.v2/decode.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion vendor/gopkg.in/yaml.v2/resolve.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 16 additions & 0 deletions vendor/gopkg.in/yaml.v2/scannerc.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 4 additions & 4 deletions vendor/modules.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@ github.com/cpuguy83/go-md2man/v2/md2man
# github.com/docker/docker v1.13.1
github.com/docker/docker/pkg/mount
github.com/docker/docker/pkg/reexec
# github.com/docker/go-units v0.3.3
# github.com/docker/go-units v0.4.0
github.com/docker/go-units
# github.com/ghodss/yaml v1.0.0
github.com/ghodss/yaml
# github.com/konsorten/go-windows-terminal-sequences v1.0.1
# github.com/konsorten/go-windows-terminal-sequences v1.0.2
github.com/konsorten/go-windows-terminal-sequences
# github.com/mattn/go-isatty v0.0.10
github.com/mattn/go-isatty
Expand All @@ -22,7 +22,7 @@ github.com/rancher/mapper/convert/merge
github.com/rancher/mapper/definition
github.com/rancher/mapper/mappers
github.com/rancher/mapper/values
# github.com/rancher/wrangler v0.0.0-20190426050201-5946f0eaed19
# github.com/rancher/wrangler v0.3.1
github.com/rancher/wrangler/pkg/name
# github.com/russross/blackfriday/v2 v2.0.1
github.com/russross/blackfriday/v2
Expand All @@ -39,5 +39,5 @@ golang.org/x/sys/unix
golang.org/x/sys/windows
# gopkg.in/freddierice/go-losetup.v1 v1.0.0-20170407175016-fc9adea44124
gopkg.in/freddierice/go-losetup.v1
# gopkg.in/yaml.v2 v2.2.2
# gopkg.in/yaml.v2 v2.2.4
gopkg.in/yaml.v2

0 comments on commit e0c7f87

Please sign in to comment.