Skip to content

Commit 978862d

Browse files
authored
Merge pull request #26 from AbsaOSS/remove-default-k3sversion
k3d-action user specifies k3s version explicitly
2 parents 9b30931 + a3f96f9 commit 978862d

File tree

8 files changed

+33
-17
lines changed

8 files changed

+33
-17
lines changed

.github/workflows/assets/1.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
apiVersion: k3d.io/v1alpha2
22
kind: Simple
3+
image: docker.io/rancher/k3s:v1.20.4-k3s1
34
servers: 1
45
agents: 3
56
ports:

.github/workflows/assets/2.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
apiVersion: k3d.io/v1alpha2
22
kind: Simple
3+
image: docker.io/rancher/k3s:v1.20.5-k3s1
34
servers: 1
45
agents: 3
56
ports:

.github/workflows/assets/3.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
apiVersion: k3d.io/v1alpha2
22
kind: Simple
3+
image: docker.io/rancher/k3s:v1.20.5-k3s1
34
servers: 1
45
agents: 3
56
ports:

.github/workflows/assets/4.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
apiVersion: k3d.io/v1alpha2
22
kind: Simple
3+
# image: default k3s version
34
servers: 1
45
agents: 3
56
ports:

.github/workflows/multi-cluster-config.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ jobs:
1919
name: "Create 2nd k3d Cluster"
2020
with:
2121
cluster-name: "test-cluster-2"
22-
args: --config=.github/workflows/assets/2.yaml
22+
args: --config=.github/workflows/assets/2.yaml # test: k3s version is different from 1.yaml
2323

2424
- name: Cluster info
2525
run: |

.github/workflows/multi-cluster-two-piars-registry.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ jobs:
2020
args: >-
2121
--agents 1
2222
--no-lb
23+
--image docker.io/rancher/k3s:v1.20.4-k3s1
2324
--k3s-server-arg "--no-deploy=traefik,servicelb,metrics-server"
2425
2526
- uses: ./
@@ -33,6 +34,7 @@ jobs:
3334
args: >-
3435
--agents 1
3536
--no-lb
37+
--image docker.io/rancher/k3s:v1.20.4-k3s1
3638
--k3s-server-arg "--no-deploy=traefik,servicelb,metrics-server"
3739
3840
- uses: ./
@@ -47,6 +49,7 @@ jobs:
4749
args: >-
4850
--agents 1
4951
--no-lb
52+
--image docker.io/rancher/k3s:v1.20.4-k3s1
5053
--k3s-server-arg "--no-deploy=traefik,servicelb,metrics-server"
5154
5255
- uses: ./
@@ -60,6 +63,7 @@ jobs:
6063
args: >-
6164
--agents 1
6265
--no-lb
66+
--image docker.io/rancher/k3s:v1.20.4-k3s1
6367
--k3s-server-arg "--no-deploy=traefik,servicelb,metrics-server"
6468
6569
- name: Cluster info

README.md

Lines changed: 22 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -59,20 +59,27 @@ For more details see: [Multi Cluster on isolated networks](#multi-cluster-on-iso
5959

6060
### Version mapping
6161
Implementation of additional features brings complexity and sometimes may happen that extra feature is broken in special cases.
62-
To prevent potential issues due to usage such versions, the k3d, k3s versions are hard-coded.
62+
To prevent potential issues due to usage such versions, the k3d version is predefined.
6363

6464
| k3d-action | k3d | k3s |
6565
|:----------:|:-------:|:-----------------------:|
6666
| v1.1.0 | [v3.4.0](https://github.com/rancher/k3d/releases/tag/v3.4.0) | [rancher/k3s:v1.20.2-k3s1](https://github.com/k3s-io/k3s/releases/tag/v1.20.2%2Bk3s1)|
6767
| v1.2.0 | [v4.2.0](https://github.com/rancher/k3d/releases/tag/v4.2.0) | [rancher/k3s:v1.20.2-k3s1](https://github.com/k3s-io/k3s/releases/tag/v1.20.2%2Bk3s1)|
6868
| v1.3.0 | [v4.2.0](https://github.com/rancher/k3d/releases/tag/v4.2.0) | [rancher/k3s:v1.20.4-k3s1](https://github.com/k3s-io/k3s/releases/tag/v1.20.4%2Bk3s1)|
69+
| v1.4.0 | [v4.4.1](https://github.com/rancher/k3d/releases/tag/v4.4.1) | specified by k3d or [set image explicitly](https://hub.docker.com/r/rancher/k3s/tags?page=1&ordering=last_updated)|
6970

71+
From `v1.4.0` would k3d-action users set k3s version explicitly via [configuration](#config-file-support) or
72+
argument e.g.`--image docker.io/rancher/k3s:v1.20.4-k3s1` otherwise k3d specifies which version will be used.
73+
74+
For further k3s details see:
75+
- docker [rancher/k3s](https://hub.docker.com/r/rancher/k3s/tags?page=2&ordering=last_updated)
76+
- github [k3s/releases](https://github.com/k3s-io/k3s/releases)
7077

7178
## Single Cluster
7279
Although AbsaOSS/k3d-action strongly supports multi-cluster. Single cluster scenarios are very popular. The minimum single-cluster
7380
configuration looks like this :
7481
```yaml
75-
- uses: AbsaOSS/k3d-action@v1.3.1
82+
- uses: AbsaOSS/k3d-action@v1.4.0
7683
name: "Create Single Cluster"
7784
with:
7885
cluster-name: "test-cluster-1"
@@ -82,7 +89,7 @@ k3d creates a cluster with one worker node (with [traefik](https://traefik.io/)
8289
default load-balancer node. In real scenarios you might prefer to do some port mapping and disable default load balancer.
8390
Such an action would look like this:
8491
```yaml
85-
- uses: AbsaOSS/k3d-action@v1.3.1
92+
- uses: AbsaOSS/k3d-action@v1.4.0
8693
name: "Create Single Cluster"
8794
with:
8895
cluster-name: "test-cluster-1"
@@ -92,6 +99,7 @@ Such an action would look like this:
9299
-p "5053:53/udp@agent[0]"
93100
--agents 3
94101
--no-lb
102+
--image docker.io/rancher/k3s:v1.20.4-k3s1
95103
--k3s-server-arg "--no-deploy=traefik,servicelb,metrics-server"
96104
```
97105
The created cluster exposes two TCP (`:8083`,`:8443`) and one UDP (`:5053`) ports. The cluster comprises one server, three
@@ -120,6 +128,7 @@ configured.
120128
```yaml
121129
apiVersion: k3d.io/v1alpha2
122130
kind: Simple
131+
image: docker.io/rancher/k3s:v1.20.5-k3s1
123132
servers: 1
124133
agents: 3 # The action will overwrite this by 1
125134
ports:
@@ -157,7 +166,7 @@ manually.
157166
### Multi Cluster on default network
158167
```yaml
159168
- uses: actions/checkout@v2
160-
- uses: AbsaOSS/k3d-action@v1.3.1
169+
- uses: AbsaOSS/k3d-action@v1.4.0
161170
name: "Create 1st Cluster"
162171
with:
163172
cluster-name: "test-cluster-1"
@@ -168,7 +177,7 @@ manually.
168177
--agents 3
169178
--no-lb
170179
--k3s-server-arg "--no-deploy=traefik,servicelb,metrics-server"
171-
- uses: AbsaOSS/k3d-action@v1.3.1
180+
- uses: AbsaOSS/k3d-action@v1.4.0
172181
name: "Create 2nd Cluster"
173182
with:
174183
cluster-name: "test-cluster-2"
@@ -181,7 +190,7 @@ manually.
181190
--k3s-server-arg "--no-deploy=traefik,servicelb,metrics-server"
182191
```
183192
Both clusters comprise one server node and three agents nodes. Because of port collision, each cluster must expose
184-
different ports.
193+
different ports. Because k3s version is not specified, the clusters will run against latest k3s.
185194

186195
For more details see:
187196
- multi-cluster [Demo](https://github.com/AbsaOSS/k3d-action/actions?query=workflow%3A%22Multi+cluster%3B+two+clusters+on+default+network%22),
@@ -191,7 +200,7 @@ For more details see:
191200

192201
### Multi Cluster on isolated networks
193202
```yaml
194-
- uses: AbsaOSS/k3d-action@v1.3.1
203+
- uses: AbsaOSS/k3d-action@v1.4.0
195204
name: "Create 1st Cluster in 172.20.0.0/24"
196205
id: test-cluster-1
197206
with:
@@ -206,7 +215,7 @@ For more details see:
206215
--no-lb
207216
--k3s-server-arg "--no-deploy=traefik,servicelb,metrics-server"
208217
209-
- uses: AbsaOSS/k3d-action@v1.3.1
218+
- uses: AbsaOSS/k3d-action@v1.4.0
210219
name: "Create 2nd Cluster in 172.20.1.0/24"
211220
id: test-cluster-2
212221
with:
@@ -239,7 +248,7 @@ For more details see: [Demo](https://github.com/AbsaOSS/k3d-action/actions?query
239248
[Source](./.github/workflows/multi-cluster-on-isolated-networks.yaml)
240249
### Two pairs of clusters on two isolated networks
241250
```yaml
242-
- uses: AbsaOSS/k3d-action@v1.3.1
251+
- uses: AbsaOSS/k3d-action@v1.4.0
243252
name: "Create 1st Cluster in 172.20.0.0/24"
244253
with:
245254
cluster-name: "test-cluster-1-a"
@@ -250,7 +259,7 @@ For more details see: [Demo](https://github.com/AbsaOSS/k3d-action/actions?query
250259
--no-lb
251260
--k3s-server-arg "--no-deploy=traefik,servicelb,metrics-server"
252261
253-
- uses: AbsaOSS/k3d-action@v1.3.1
262+
- uses: AbsaOSS/k3d-action@v1.4.0
254263
name: "Create 2nd Cluster in 172.20.0.0/24"
255264
with:
256265
cluster-name: "test-cluster-2-a"
@@ -260,7 +269,7 @@ For more details see: [Demo](https://github.com/AbsaOSS/k3d-action/actions?query
260269
--no-lb
261270
--k3s-server-arg "--no-deploy=traefik,servicelb,metrics-server"
262271
263-
- uses: AbsaOSS/k3d-action@v1.3.1
272+
- uses: AbsaOSS/k3d-action@v1.4.0
264273
name: "Create 1st Cluster in 172.20.1.0/24"
265274
with:
266275
cluster-name: "test-cluster-1-b"
@@ -271,7 +280,7 @@ For more details see: [Demo](https://github.com/AbsaOSS/k3d-action/actions?query
271280
--no-lb
272281
--k3s-server-arg "--no-deploy=traefik,servicelb,metrics-server"
273282
274-
- uses: AbsaOSS/k3d-action@v1.3.1
283+
- uses: AbsaOSS/k3d-action@v1.4.0
275284
name: "Create 2nd Cluster in 172.20.1.0/24"
276285
with:
277286
cluster-name: "test-cluster-2-b"
@@ -300,7 +309,7 @@ Example below demonstrates how to interact with imported docker registry:
300309
```yaml
301310
steps:
302311
- uses: actions/checkout@v2
303-
- uses: AbsaOSS/k3d-action@v1.3.1
312+
- uses: AbsaOSS/k3d-action@v1.4.0
304313
id: single-cluster
305314
name: "Create single k3d Cluster with imported Registry"
306315
with:

run.sh

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,7 @@ CYAN=
2525
RED=
2626
NC=
2727
K3D_URL=https://raw.githubusercontent.com/rancher/k3d/main/install.sh
28-
K3D_VERSION=v4.2.0
29-
K3S_VERSION=docker.io/rancher/k3s:v1.20.4-k3s1
28+
K3D_VERSION=v4.4.1
3029
DEFAULT_NETWORK=k3d-action-bridge-network
3130
DEFAULT_SUBNET=172.16.0.0/24
3231
NOT_FOUND=k3d-not-found-network
@@ -131,7 +130,7 @@ deploy(){
131130
curl --silent --fail ${K3D_URL} | TAG=${K3D_VERSION} bash
132131

133132
echo -e "\existing_network${YELLOW}Deploy cluster ${CYAN}$name ${NC}"
134-
eval "k3d cluster create $name --wait $arguments --image ${K3S_VERSION} --network $network $registryArg"
133+
eval "k3d cluster create $name --wait $arguments --network $network $registryArg"
135134
wait_for_nodes
136135
}
137136

0 commit comments

Comments
 (0)