-
Notifications
You must be signed in to change notification settings - Fork 77
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Kimmo Lehto <klehto@mirantis.com>
- Loading branch information
Showing
6 changed files
with
114 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,6 +6,7 @@ on: | |
- '**.go' | ||
- go.mod | ||
- go.sum | ||
- Makefile | ||
|
||
jobs: | ||
gotest: | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
apiVersion: k0sctl.k0sproject.io/v1beta1 | ||
kind: cluster | ||
spec: | ||
hosts: | ||
- role: controller | ||
uploadBinary: true | ||
os: "$OS_OVERRIDE" | ||
ssh: | ||
address: "127.0.0.1" | ||
port: 9022 | ||
keyPath: ./id_rsa_k0s | ||
- role: worker | ||
uploadBinary: true | ||
os: "$OS_OVERRIDE" | ||
ssh: | ||
address: "127.0.0.1" | ||
port: 9023 | ||
keyPath: ./id_rsa_k0s | ||
k0s: | ||
version: "${K0S_VERSION}" | ||
config: | ||
spec: | ||
telemetry: | ||
enabled: false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
#!/usr/bin/env bash | ||
|
||
K0SCTL_CONFIG=${K0SCTL_CONFIG:-"k0sctl-dryrun.yaml"} | ||
|
||
set -ex | ||
|
||
. ./smoke.common.sh | ||
trap cleanup EXIT | ||
|
||
deleteCluster | ||
createCluster | ||
|
||
remoteCommand() { | ||
local userhost="$1" | ||
shift | ||
echo "* Running command on ${userhost}: $*" | ||
bootloose ssh "${userhost}" -- "$*" | ||
} | ||
|
||
color_echo() { | ||
echo "\033[1;33m$*\033[0m" | ||
} | ||
|
||
# Create config with older version and apply | ||
K0S_VERSION="${K0S_FROM}" | ||
color_echo "* Installing ${K0S_VERSION} using dry-run" | ||
../k0sctl apply --config "${K0SCTL_CONFIG}" --debug --dry-run | tee k0sctl-dry-run.log | ||
remoteCommand "root@manager0" "test ! -d /etc/k0s" | ||
remoteCommand "root@manager0" "test ! -f /etc/k0s/k0s.yaml" | ||
count=$(grep -c "dry-run" k0sctl-dry-run.log) | ||
if [ "${count}" -lt 3 ]; then | ||
echo "Expected at least dry-run lines, got ${count}" | ||
exit 1 | ||
fi | ||
grep -q "write k0s configuration" k0sctl-dry-run.log | ||
echo "* Dry-run filtered log:" | ||
grep "dry-run" k0sctl-dry-run.log | ||
|
||
color_echo "* Installing ${K0S_VERSION} without dry-run" | ||
../k0sctl apply --config "${K0SCTL_CONFIG}" --debug | tee k0sctl.log | ||
remoteCommand "root@manager0" "test -d /etc/k0s" | ||
remoteCommand "root@manager0" "test -f /etc/k0s/k0s.yaml" | ||
remoteCommand "root@manager0" "k0s version | grep -q ${K0S_VERSION}" | ||
grep -q "dry-run" k0sctl.log && exit 1 | ||
|
||
color_echo "* Installing ${K0S_VERSION} with dry-run again" | ||
../k0sctl apply --config "${K0SCTL_CONFIG}" --debug --dry-run | tee k0sctl.log | ||
remoteCommand "root@manager0" "k0s version | grep -q ${K0S_VERSION}" | ||
grep -q "no cluster state altering actions" k0sctl.log | ||
|
||
K0S_VERSION=$(curl -s "https://docs.k0sproject.io/stable.txt") | ||
|
||
color_echo "* Upgrading to k0s latest using dry-run" | ||
../k0sctl apply --config "${K0SCTL_CONFIG}" --debug --dry-run | tee k0sctl-dry-run.log | ||
remoteCommand "root@manager0" "k0s version | grep -q ${K0S_FROM}" | ||
count=$(grep -c "dry-run" k0sctl-dry-run.log) | ||
if [ "${count}" -lt 3 ]; then | ||
echo "Expected at least dry-run lines, got ${count}" | ||
exit 1 | ||
fi | ||
echo "* Dry-run filtered log:" | ||
grep "dry-run" k0sctl-dry-run.log | ||
|
||
color_echo "* Upgrading to k0s latest without dry-run" | ||
../k0sctl apply --config "${K0SCTL_CONFIG}" --debug | tee k0sctl.log | ||
remoteCommand "root@manager0" "k0s version | grep -vq ${K0S_FROM}" | ||
grep -q "dry-run" k0sctl.log && exit 1 | ||
|
||
color_echo "* Upgrading ${K0S_VERSION} with dry-run again" | ||
../k0sctl apply --config "${K0SCTL_CONFIG}" --debug --dry-run | tee k0sctl.log | ||
remoteCommand "root@manager0" "k0s version | grep -q ${K0S_VERSION}" | ||
grep -q "no cluster state altering actions" k0sctl.log | ||
|
||
|