File tree 5 files changed +30
-2
lines changed 5 files changed +30
-2
lines changed Original file line number Diff line number Diff line change @@ -128,6 +128,7 @@ resource "null_resource" "kustomization" {
128
128
# Redeploy when versions of addons need to be updated
129
129
versions = join (" \n " , [
130
130
coalesce (var. initial_k3s_channel , " N/A" ),
131
+ coalesce (var. install_k3s_version , " N/A" ),
131
132
coalesce (var. cluster_autoscaler_version , " N/A" ),
132
133
coalesce (var. hetzner_ccm_version , " N/A" ),
133
134
coalesce (var. hetzner_csi_version , " N/A" ),
@@ -233,6 +234,7 @@ resource "null_resource" "kustomization" {
233
234
" ${ path . module } /templates/plans.yaml.tpl" ,
234
235
{
235
236
channel = var.initial_k3s_channel
237
+ version = var.install_k3s_version
236
238
disable_eviction = ! var.system_upgrade_enable_eviction
237
239
})
238
240
destination = " /var/post_install/plans.yaml"
Original file line number Diff line number Diff line change @@ -590,6 +590,10 @@ module "kube-hetzner" {
590
590
# The default is "v1.29".
591
591
# initial_k3s_channel = "stable"
592
592
593
+ # Allows you to specify the k3s version. If defined, supersedes initial_k3s_channel.
594
+ # See https://github.com/k3s-io/k3s/releases
595
+ # install_k3s_version = "v1.30.2+k3s2"
596
+
593
597
# The cluster name, by default "k3s"
594
598
# cluster_name = ""
595
599
Original file line number Diff line number Diff line change @@ -125,10 +125,18 @@ locals {
125
125
swap_node_label = [" node.kubernetes.io/server-swap=enabled" ]
126
126
127
127
install_k3s_server = concat (local. common_pre_install_k3s_commands , [
128
- " curl -sfL https://get.k3s.io | INSTALL_K3S_SKIP_START=true INSTALL_K3S_SKIP_SELINUX_RPM=true INSTALL_K3S_CHANNEL=${ var . initial_k3s_channel } INSTALL_K3S_EXEC='server ${ var . k3s_exec_server_args } ' sh -"
128
+ var . install_k3s_version == " " ? (
129
+ " curl -sfL https://get.k3s.io | INSTALL_K3S_SKIP_START=true INSTALL_K3S_SKIP_SELINUX_RPM=true INSTALL_K3S_CHANNEL=${ var . initial_k3s_channel } INSTALL_K3S_EXEC='server ${ var . k3s_exec_server_args } ' sh -"
130
+ ) : (
131
+ " curl -sfL https://get.k3s.io | INSTALL_K3S_SKIP_START=true INSTALL_K3S_SKIP_SELINUX_RPM=true INSTALL_K3S_VERSION=${ var . install_k3s_version } INSTALL_K3S_EXEC='server ${ var . k3s_exec_server_args } ' sh -"
132
+ )
129
133
], (var. disable_selinux ? [] : local. apply_k3s_selinux ), local. common_post_install_k3s_commands )
130
134
install_k3s_agent = concat (local. common_pre_install_k3s_commands , [
131
- " curl -sfL https://get.k3s.io | INSTALL_K3S_SKIP_START=true INSTALL_K3S_SKIP_SELINUX_RPM=true INSTALL_K3S_CHANNEL=${ var . initial_k3s_channel } INSTALL_K3S_EXEC='agent ${ var . k3s_exec_agent_args } ' sh -"
135
+ var . install_k3s_version == " " ? (
136
+ " curl -sfL https://get.k3s.io | INSTALL_K3S_SKIP_START=true INSTALL_K3S_SKIP_SELINUX_RPM=true INSTALL_K3S_CHANNEL=${ var . initial_k3s_channel } INSTALL_K3S_EXEC='agent ${ var . k3s_exec_agent_args } ' sh -"
137
+ ) : (
138
+ " curl -sfL https://get.k3s.io | INSTALL_K3S_SKIP_START=true INSTALL_K3S_SKIP_SELINUX_RPM=true INSTALL_K3S_VERSION=${ var . install_k3s_version } INSTALL_K3S_EXEC='agent ${ var . k3s_exec_agent_args } ' sh -"
139
+ )
132
140
], (var. disable_selinux ? [] : local. apply_k3s_selinux ), local. common_post_install_k3s_commands )
133
141
134
142
control_plane_nodes = merge ([
Original file line number Diff line number Diff line change @@ -10,7 +10,11 @@ metadata:
10
10
k3s_upgrade: agent
11
11
spec:
12
12
concurrency: 1
13
+ %{ ~ if version == " " ~}
13
14
channel: https://update.k3s.io/v1-release/channels/${ channel}
15
+ %{ ~ else ~}
16
+ version: ${ version}
17
+ %{ ~ endif ~}
14
18
serviceAccountName: system-upgrade
15
19
nodeSelector:
16
20
matchExpressions:
@@ -41,7 +45,11 @@ metadata:
41
45
k3s_upgrade: server
42
46
spec:
43
47
concurrency: 1
48
+ %{ ~ if version == " " ~}
44
49
channel: https://update.k3s.io/v1-release/channels/${ channel}
50
+ %{ ~ else ~}
51
+ version: ${ version}
52
+ %{ ~ endif ~}
45
53
serviceAccountName: system-upgrade
46
54
nodeSelector:
47
55
matchExpressions:
Original file line number Diff line number Diff line change @@ -545,6 +545,12 @@ variable "initial_k3s_channel" {
545
545
}
546
546
}
547
547
548
+ variable "install_k3s_version" {
549
+ type = string
550
+ default = " "
551
+ description = " Allows you to specify the k3s version (Example: v1.29.6+k3s2). Supersedes initial_k3s_channel."
552
+ }
553
+
548
554
variable "system_upgrade_enable_eviction" {
549
555
type = bool
550
556
default = true
You can’t perform that action at this time.
0 commit comments