Skip to content

Commit

Permalink
Merge pull request #1575 from pat-s/feat/disable-hccm
Browse files Browse the repository at this point in the history
add var `disable_hetzner_ccm`
  • Loading branch information
mysticaltech authored Dec 23, 2024
2 parents 3b2ba2c + 6812a5e commit 09f9c0d
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 20 deletions.
2 changes: 1 addition & 1 deletion data.tf
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
data "github_release" "hetzner_ccm" {
count = var.hetzner_ccm_version == null ? 1 : 0
count = var.hetzner_ccm_version == null && !var.disable_hetzner_ccm ? 1 : 0
repository = "hcloud-cloud-controller-manager"
owner = "hetznercloud"
retrieve_by = "latest"
Expand Down
2 changes: 2 additions & 0 deletions kube.tf.example
Original file line number Diff line number Diff line change
Expand Up @@ -465,6 +465,8 @@ module "kube-hetzner" {

# To disable Hetzner CSI storage, you can set the following to "true", default is "false".
# disable_hetzner_csi = true
# To disable Hetzner Cloud Controller Manager, you can set the following to "true", default is "false".
# disable_hetzner_ccm = true

# If you want to use a specific Hetzner CCM and CSI version, set them below; otherwise, leave them as-is for the latest versions.
# See https://github.com/hetznercloud/hcloud-cloud-controller-manager/releases for the available versions.
Expand Down
39 changes: 20 additions & 19 deletions locals.tf
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ locals {
# if given as a variable, we want to use the given token. This is needed to restore the cluster
k3s_token = var.k3s_token == null ? random_password.k3s_token.result : var.k3s_token

ccm_version = var.hetzner_ccm_version != null ? var.hetzner_ccm_version : data.github_release.hetzner_ccm[0].release_tag
ccm_version = length(data.github_release.hetzner_ccm) == 0 ? var.hetzner_ccm_version : data.github_release.hetzner_ccm[0].release_tag
csi_version = length(data.github_release.hetzner_csi) == 0 ? var.hetzner_csi_version : data.github_release.hetzner_csi[0].release_tag
kured_version = var.kured_version != null ? var.kured_version : data.github_release.kured[0].release_tag
calico_version = length(data.github_release.calico) == 0 ? var.calico_version : data.github_release.calico[0].release_tag
Expand Down Expand Up @@ -74,12 +74,13 @@ locals {
kind = "Kustomization"
resources = concat(
[
"https://github.com/hetznercloud/hcloud-cloud-controller-manager/releases/download/${local.ccm_version}/ccm-networks.yaml",
"https://github.com/kubereboot/kured/releases/download/${local.kured_version}/kured-${local.kured_version}-dockerhub.yaml",
"https://github.com/rancher/system-upgrade-controller/releases/download/${var.sys_upgrade_controller_version}/system-upgrade-controller.yaml",
"https://github.com/rancher/system-upgrade-controller/releases/download/${var.sys_upgrade_controller_version}/crd.yaml"
],
var.disable_hetzner_csi ? [] : ["hcloud-csi.yaml"],
var.disable_hetzner_ccm ? [] : ["ccm.yaml"],
var.disable_hetzner_ccm ? [] : ["https://github.com/hetznercloud/hcloud-cloud-controller-manager/releases/download/${local.ccm_version}/ccm-networks.yaml"],
lookup(local.ingress_controller_install_resources, var.ingress_controller, []),
lookup(local.cni_install_resources, var.cni_plugin, []),
var.enable_longhorn ? ["longhorn.yaml"] : [],
Expand All @@ -88,24 +89,24 @@ locals {
var.enable_rancher ? ["rancher.yaml"] : [],
var.rancher_registration_manifest_url != "" ? [var.rancher_registration_manifest_url] : []
),
patches = [
{
target = {
group = "apps"
version = "v1"
kind = "Deployment"
name = "system-upgrade-controller"
namespace = "system-upgrade"
patches = concat(
[
{
target = {
group = "apps"
version = "v1"
kind = "Deployment"
name = "system-upgrade-controller"
namespace = "system-upgrade"
}
patch = file("${path.module}/kustomize/system-upgrade-controller.yaml")
},
{
path = "kured.yaml"
}
patch = file("${path.module}/kustomize/system-upgrade-controller.yaml")
},
{
path = "kured.yaml"
},
{
path = "ccm.yaml"
}
]
],
var.disable_hetzner_ccm ? [] : [{ path = "ccm.yaml" }]
)
})

apply_k3s_selinux = ["/sbin/semodule -v -i /usr/share/selinux/packages/k3s.pp"]
Expand Down
6 changes: 6 additions & 0 deletions variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -781,6 +781,12 @@ variable "disable_hetzner_csi" {
description = "Disable hetzner csi driver."
}

variable "disable_hetzner_ccm" {
type = bool
default = false
description = "Disable hetzner Cloud Controller Manager."
}

variable "enable_csi_driver_smb" {
type = bool
default = false
Expand Down

0 comments on commit 09f9c0d

Please sign in to comment.