ability to chose k3s install channel

This commit is contained in:
Karim Naufal 2022-02-23 21:35:42 +01:00
parent 40ce7b09a3
commit 0b19d36416
5 changed files with 14 additions and 10 deletions

View File

@ -216,7 +216,7 @@ There is also a branch where openSUSE MicroOS came preinstalled with the k3s RPM
## Contributing
There is something you can do right away to help this project succeed! **Just take a few minutes to send a support request to Hetzner, asking them to please add openSUSE MicroOS as a default image**, not just an ISO. If that succeeds, we will be able to deploy in less than 2 minutes instead of 5, without passing by the rescue mode. The more requests they receive the likelier they are to add it. The official link to openSUSE MicroOS is <https://get.opensuse.org/microos>.
🌱 There is something you can do right away to help this project succeed! **Just take a few minutes to send a support request to Hetzner, asking them to please add openSUSE MicroOS as a default image**, not just an ISO. If that succeeds, we will be able to deploy in less than 2 minutes instead of 5, without passing by the rescue mode. The more requests they receive the likelier they are to add it. The official link to openSUSE MicroOS is <https://get.opensuse.org/microos>.
About code contributions, they are **greatly appreciated**.

View File

@ -110,7 +110,7 @@ resource "null_resource" "kustomization" {
content = templatefile(
"${path.module}/templates/plans.yaml.tpl",
{
channel = var.k3s_upgrade_channel
channel = var.initial_k3s_channel
})
destination = "/tmp/post_install/plans.yaml"
}

View File

@ -27,7 +27,7 @@ locals {
"[ -e /etc/rancher/k3s/k3s.yaml ] && exit 0",
]
install_k3s_server = concat(local.common_commands_install_k3s, ["curl -sfL https://get.k3s.io | INSTALL_K3S_SKIP_SELINUX_RPM=true INSTALL_K3S_SKIP_START=true INSTALL_K3S_EXEC=server sh -"])
install_k3s_server = concat(local.common_commands_install_k3s, ["curl -sfL https://get.k3s.io | INSTALL_K3S_SKIP_SELINUX_RPM=true INSTALL_K3S_SKIP_START=true INSTALL_K3S_CHANNEL=${var.initial_k3s_channel} INSTALL_K3S_EXEC=server sh -"])
install_k3s_agent = concat(local.common_commands_install_k3s, ["curl -sfL https://get.k3s.io | INSTALL_K3S_SKIP_SELINUX_RPM=true INSTALL_K3S_SKIP_START=true INSTALL_K3S_EXEC=agent sh -"])
install_k3s_agent = concat(local.common_commands_install_k3s, ["curl -sfL https://get.k3s.io | INSTALL_K3S_SKIP_SELINUX_RPM=true INSTALL_K3S_SKIP_START=true INSTALL_K3S_CHANNEL=${var.initial_k3s_channel} INSTALL_K3S_EXEC=agent sh -"])
}

View File

@ -30,9 +30,8 @@ agents_num = 2
# If you want to allow non-control-plane workloads to run on the control-plane nodes set "true" below. The default is "false".
# allow_scheduling_on_control_plane = true
# If you want to disable automatic upgrade of k3s (stable channel), you can set this to false, default is "true".
# If you want to disable automatic upgrade of k3s, you can set this to false, default is "true".
# automatically_upgrade_k3s = false
# If you would like to specify the k3s upgrade channel from the get go, you can do so, the default is "stable".
# For a list of available channels, see https://rancher.com/docs/k3s/latest/en/upgrades/basic/ and https://update.k3s.io/v1-release/channels
# k3s_upgrade_channel = "latest"
# Allows you to specify either stable, latest, or testing (defaults to stable), see https://rancher.com/docs/k3s/latest/en/upgrades/basic/
# initial_k3s_channel = "latest"

View File

@ -91,10 +91,15 @@ variable "allow_scheduling_on_control_plane" {
description = "Whether to allow non-control-plane workloads to run on the control-plane nodes"
}
variable "k3s_upgrade_channel" {
variable "initial_k3s_channel" {
type = string
default = "stable"
description = "Allows you to specify the k3s upgrade channel"
description = "Allows you to specify an initial k3s channel"
validation {
condition = contains(["stable", "latest", "testing"], var.initial_k3s_channel)
error_message = "The initial k3s channel must be one of stable, latest or testing."
}
}
variable "automatically_upgrade_k3s" {