Skip to content

Commit ec7b2cf

Browse files
committed
feat: Update K3s and Longhorn versions and setup script
1 parent b0fcce2 commit ec7b2cf

File tree

7 files changed

+70
-23
lines changed

7 files changed

+70
-23
lines changed

setup/k3s-versions.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
{
2-
"latestStableVersion": "v1.31",
2+
"prodInstallVersion": "v1.31.3+k3s1",
3+
"canaryInstallVersion": "v1.33.4+k3s1",
34
"prod": [
45
{
56
"version": "v1.31",

setup/longhorn-versions.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
{
2-
"latestStableVersion": "v1.7.2",
2+
"prodInstallVersion": "v1.7.2",
3+
"canaryInstallVersion": "v1.10.1",
34
"prod": [
45
{
56
"version": "v1.7.2",

setup/setup-canary.sh

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -87,10 +87,16 @@ select_network_interface
8787
# !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
8888
# THIS MUST BE INSTALLED ON ALL NODES --> https://longhorn.io/docs/1.7.2/deploy/install/#installing-nfsv4-client
8989
# !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
90-
# install nfs-common and open-iscsi
90+
# install nfs-common, open-iscsi and jq
9191
echo "Installing nfs-common..."
9292
sudo apt-get update
93-
sudo apt-get install open-iscsi nfs-common -y
93+
sudo apt-get install open-iscsi nfs-common jq -y
94+
95+
echo "Fetching version information..."
96+
K3S_VERSION=$(curl -s https://get.quickstack.dev/k3s-versions.json | jq -r '.canaryInstallVersion')
97+
LONGHORN_VERSION=$(curl -s https://get.quickstack.dev/longhorn-versions.json | jq -r '.canaryInstallVersion')
98+
echo "Using K3s version: $K3S_VERSION"
99+
echo "Using Longhorn version: $LONGHORN_VERSION"
94100

95101
# Disable portmapper services --> https://github.com/biersoeckli/QuickStack/issues/18
96102
sudo systemctl stop rpcbind.service rpcbind.socket
@@ -100,15 +106,15 @@ sudo systemctl disable rpcbind.service rpcbind.socket
100106
#curl -sfL https://get.k3s.io | INSTALL_K3S_EXEC="--node-ip=192.168.1.2 --advertise-address=192.168.1.2 --node-external-ip=188.245.236.232 --flannel-iface=enp7s0" INSTALL_K3S_VERSION="v1.31.3+k3s1" sh -
101107

102108
echo "Installing k3s with --flannel-iface=$selected_iface"
103-
curl -sfL https://get.k3s.io | INSTALL_K3S_EXEC="--flannel-iface=$selected_iface" INSTALL_K3S_VERSION="v1.31.3+k3s1" sh -
109+
curl -sfL https://get.k3s.io | INSTALL_K3S_EXEC="--flannel-iface=$selected_iface" INSTALL_K3S_VERSION="$K3S_VERSION" sh -
104110
# Todo: Check for Ready node, takes ~30 seconds
105111
sudo k3s kubectl get node
106112

107113
echo "Waiting for Kubernetes to start..."
108114
wait_until_all_pods_running
109115

110116
# Installation of Longhorn
111-
sudo kubectl apply -f https://raw.githubusercontent.com/longhorn/longhorn/v1.7.2/deploy/longhorn.yaml
117+
sudo kubectl apply -f "https://raw.githubusercontent.com/longhorn/longhorn/${LONGHORN_VERSION}/deploy/longhorn.yaml"
112118
echo "Waiting for Longhorn to start..."
113119
wait_until_all_pods_running
114120

@@ -119,8 +125,7 @@ wait_until_all_pods_running
119125
sudo kubectl -n cert-manager get pod
120126

121127
# Checking installation of Longhorn
122-
sudo apt-get install jq -y
123-
sudo curl -sSfL https://raw.githubusercontent.com/longhorn/longhorn/v1.7.2/scripts/environment_check.sh | sudo bash
128+
sudo curl -sSfL "https://raw.githubusercontent.com/longhorn/longhorn/${LONGHORN_VERSION}/scripts/environment_check.sh" | sudo bash
124129

125130
joinTokenForOtherNodes=$(sudo cat /var/lib/rancher/k3s/server/node-token)
126131

setup/setup-worker.sh

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -64,17 +64,21 @@ select_network_interface
6464
# !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
6565
# THIS MUST BE INSTALLED ON ALL NODES --> https://longhorn.io/docs/1.7.2/deploy/install/#installing-nfsv4-client
6666
# !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
67-
# install nfs-common and open-iscsi
67+
# install nfs-common, open-iscsi and jq
6868
sudo apt-get update
69-
sudo apt-get install open-iscsi nfs-common -y
69+
sudo apt-get install open-iscsi nfs-common jq -y
70+
71+
echo "Fetching version information..."
72+
K3S_VERSION=$(curl -s https://get.quickstack.dev/k3s-versions.json | jq -r '.prodInstallVersion')
73+
echo "Using K3s version: $K3S_VERSION"
7074

7175
# Disable portmapper services --> https://github.com/biersoeckli/QuickStack/issues/18
7276
sudo systemctl stop rpcbind.service rpcbind.socket
7377
sudo systemctl disable rpcbind.service rpcbind.socket
7478

7579
# Installation of k3s
7680
echo "Installing k3s with --flannel-iface=$selected_iface"
77-
curl -sfL https://get.k3s.io | INSTALL_K3S_EXEC="--flannel-iface=$selected_iface" INSTALL_K3S_VERSION="v1.31.3+k3s1" K3S_URL=${K3S_URL} K3S_TOKEN=${JOIN_TOKEN} sh -
81+
curl -sfL https://get.k3s.io | INSTALL_K3S_EXEC="--flannel-iface=$selected_iface" INSTALL_K3S_VERSION="$K3S_VERSION" K3S_URL=${K3S_URL} K3S_TOKEN=${JOIN_TOKEN} sh -
7882

7983
echo ""
8084
echo "-----------------------------------------------------------------------------------------------------------"

setup/setup.sh

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -87,9 +87,15 @@ select_network_interface
8787
# !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
8888
# THIS MUST BE INSTALLED ON ALL NODES --> https://longhorn.io/docs/1.7.2/deploy/install/#installing-nfsv4-client
8989
# !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
90-
echo "Installing nfs-common..."
90+
echo "Installing nfs-common and jq..."
9191
sudo apt-get update
92-
sudo apt-get install open-iscsi nfs-common -y
92+
sudo apt-get install open-iscsi nfs-common jq -y
93+
94+
echo "Fetching version information..."
95+
K3S_VERSION=$(curl -s https://get.quickstack.dev/k3s-versions.json | jq -r '.prodInstallVersion')
96+
LONGHORN_VERSION=$(curl -s https://get.quickstack.dev/longhorn-versions.json | jq -r '.prodInstallVersion')
97+
echo "Using K3s version: $K3S_VERSION"
98+
echo "Using Longhorn version: $LONGHORN_VERSION"
9399

94100
# Disable portmapper services --> https://github.com/biersoeckli/QuickStack/issues/18
95101
sudo systemctl stop rpcbind.service rpcbind.socket
@@ -99,15 +105,15 @@ sudo systemctl disable rpcbind.service rpcbind.socket
99105
#curl -sfL https://get.k3s.io | INSTALL_K3S_EXEC="--node-ip=192.168.1.2 --advertise-address=192.168.1.2 --node-external-ip=188.245.236.232 --flannel-iface=enp7s0" INSTALL_K3S_VERSION="v1.31.3+k3s1" sh -
100106

101107
echo "Installing k3s with --flannel-iface=$selected_iface"
102-
curl -sfL https://get.k3s.io | INSTALL_K3S_EXEC="--flannel-iface=$selected_iface" INSTALL_K3S_VERSION="v1.31.3+k3s1" sh -
108+
curl -sfL https://get.k3s.io | INSTALL_K3S_EXEC="--flannel-iface=$selected_iface" INSTALL_K3S_VERSION="$K3S_VERSION" sh -
103109
# Todo: Check for Ready node, takes ~30 seconds
104110
sudo k3s kubectl get node
105111

106112
echo "Waiting for Kubernetes to start..."
107113
wait_until_all_pods_running
108114

109115
# Installation of Longhorn
110-
sudo kubectl apply -f https://raw.githubusercontent.com/longhorn/longhorn/v1.7.2/deploy/longhorn.yaml
116+
sudo kubectl apply -f "https://raw.githubusercontent.com/longhorn/longhorn/${LONGHORN_VERSION}/deploy/longhorn.yaml"
111117
echo "Waiting for Longhorn to start..."
112118
wait_until_all_pods_running
113119

@@ -117,8 +123,6 @@ echo "Waiting for Cert-Manager to start..."
117123
wait_until_all_pods_running
118124
sudo kubectl -n cert-manager get pod
119125

120-
sudo apt-get install jq -y
121-
122126
# Use this for checking installation of Longhorn
123127
# sudo curl -sSfL https://raw.githubusercontent.com/longhorn/longhorn/v1.7.2/scripts/environment_check.sh | sudo bash
124128

src/server/adapter/qs-versioninfo.adapter.ts

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import { K3sReleaseResponseSchema, LonghornReleaseResponseSchema } from "@/shared/model/generated-zod/k3s-longhorn-release-schemas";
12

23
export interface K3sReleaseInfo {
34
version: string;
@@ -9,14 +10,17 @@ export interface LonghornReleaseInfo {
910
yamlUrl: string;
1011
}
1112

12-
interface K3sReleaseResponse {
13-
latestStableVersion: string;
13+
interface ReleaseResponse {
14+
prodInstallVersion: string;
15+
canaryInstallVersion: string;
16+
}
17+
18+
interface K3sReleaseResponse extends ReleaseResponse {
1419
prod: K3sReleaseInfo[];
1520
canary: K3sReleaseInfo[];
1621
}
1722

18-
interface LonghornReleaseResponse {
19-
latestStableVersion: string;
23+
interface LonghornReleaseResponse extends ReleaseResponse {
2024
prod: LonghornReleaseInfo[];
2125
canary: LonghornReleaseInfo[];
2226
}
@@ -60,7 +64,8 @@ class QsVersionInfoAdapter {
6064
if (!response.ok) {
6165
throw new Error(`Failed to fetch latest QuickStack K3s Prod version from API: HTTP ${response.status} ${response.statusText}`);
6266
}
63-
return await response.json() as K3sReleaseResponse;
67+
const reponseJson = await response.json();
68+
return K3sReleaseResponseSchema.parse(reponseJson);
6469
}
6570

6671
private async getLonghornVersioninfo(): Promise<LonghornReleaseResponse> {
@@ -102,7 +107,8 @@ class QsVersionInfoAdapter {
102107
if (!response.ok) {
103108
throw new Error(`Failed to fetch Longhorn version info from API: HTTP ${response.status} ${response.statusText}`);
104109
}
105-
return await response.json() as LonghornReleaseResponse;
110+
const responseJson = await response.json();
111+
return LonghornReleaseResponseSchema.parse(responseJson);
106112
}
107113

108114
public async getProdK3sReleaseInfo(): Promise<K3sReleaseInfo[]> {
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
import { z } from 'zod';
2+
3+
export const K3sReleaseInfoSchema = z.object({
4+
version: z.string(),
5+
channelUrl: z.string().url(),
6+
});
7+
8+
export const LonghornReleaseInfoSchema = z.object({
9+
version: z.string(),
10+
yamlUrl: z.string().url(),
11+
});
12+
13+
export const ReleaseResponseSchema = z.object({
14+
prodInstallVersion: z.string(),
15+
canaryInstallVersion: z.string(),
16+
});
17+
18+
export const K3sReleaseResponseSchema = ReleaseResponseSchema.extend({
19+
prod: K3sReleaseInfoSchema.array(),
20+
canary: K3sReleaseInfoSchema.array(),
21+
});
22+
23+
export const LonghornReleaseResponseSchema = ReleaseResponseSchema.extend({
24+
prod: LonghornReleaseInfoSchema.array(),
25+
canary: LonghornReleaseInfoSchema.array(),
26+
});

0 commit comments

Comments
 (0)