Skip to content

Commit

Permalink
Merge pull request #1415 from schlichtanders/helmchart_version_and_bo…
Browse files Browse the repository at this point in the history
…otstrap

Helmchart version and bootstrap
  • Loading branch information
mysticaltech authored Jul 24, 2024
2 parents 450b7f9 + 12bb7cc commit 9186948
Show file tree
Hide file tree
Showing 7 changed files with 68 additions and 3 deletions.
12 changes: 10 additions & 2 deletions init.tf
Original file line number Diff line number Diff line change
Expand Up @@ -245,6 +245,8 @@ resource "null_resource" "kustomization" {
{
longhorn_namespace = var.longhorn_namespace
longhorn_repository = var.longhorn_repository
version = var.longhorn_version
bootstrap = var.longhorn_helmchart_bootstrap
values = indent(4, trimspace(local.longhorn_values))
})
destination = "/var/post_install/longhorn.yaml"
Expand All @@ -255,7 +257,9 @@ resource "null_resource" "kustomization" {
content = templatefile(
"${path.module}/templates/csi-driver-smb.yaml.tpl",
{
values = indent(4, trimspace(local.csi_driver_smb_values))
version = var.csi_driver_smb_version
bootstrap = var.csi_driver_smb_helmchart_bootstrap
values = indent(4, trimspace(local.csi_driver_smb_values))
})
destination = "/var/post_install/csi-driver-smb.yaml"
}
Expand All @@ -265,7 +269,9 @@ resource "null_resource" "kustomization" {
content = templatefile(
"${path.module}/templates/cert_manager.yaml.tpl",
{
values = indent(4, trimspace(local.cert_manager_values))
version = var.cert_manager_version
bootstrap = var.cert_manager_helmchart_bootstrap
values = indent(4, trimspace(local.cert_manager_values))
})
destination = "/var/post_install/cert_manager.yaml"
}
Expand All @@ -276,6 +282,8 @@ resource "null_resource" "kustomization" {
"${path.module}/templates/rancher.yaml.tpl",
{
rancher_install_channel = var.rancher_install_channel
version = var.rancher_version
bootstrap = var.rancher_helmchart_bootstrap
values = indent(4, trimspace(local.rancher_values))
})
destination = "/var/post_install/rancher.yaml"
Expand Down
3 changes: 2 additions & 1 deletion locals.tf
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,8 @@ locals {
# if we are in a single cluster config, we use the default klipper lb instead of Hetzner LB
control_plane_count = sum([for v in var.control_plane_nodepools : v.count])
agent_count = sum([for v in var.agent_nodepools : length(coalesce(v.nodes, {})) + coalesce(v.count, 0)])
is_single_node_cluster = (local.control_plane_count + local.agent_count) == 1
autoscaler_max_count = sum([for v in var.autoscaler_nodepools : v.max_nodes])
is_single_node_cluster = (local.control_plane_count + local.agent_count + local.autoscaler_max_count) == 1

using_klipper_lb = var.enable_klipper_metal_lb || local.is_single_node_cluster

Expand Down
2 changes: 2 additions & 0 deletions templates/cert_manager.yaml.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ metadata:
spec:
chart: cert-manager
repo: https://charts.jetstack.io
version: "${version}"
targetNamespace: cert-manager
bootstrap: ${bootstrap}
valuesContent: |-
${values}
2 changes: 2 additions & 0 deletions templates/csi-driver-smb.yaml.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ metadata:
spec:
chart: csi-driver-smb
repo: https://raw.githubusercontent.com/kubernetes-csi/csi-driver-smb/master/charts
version: "${version}"
targetNamespace: kube-system
bootstrap: ${bootstrap}
valuesContent: |-
${values}
2 changes: 2 additions & 0 deletions templates/longhorn.yaml.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ metadata:
spec:
chart: longhorn
repo: ${longhorn_repository}
version: "${version}"
targetNamespace: ${longhorn_namespace}
bootstrap: ${bootstrap}
valuesContent: |-
${values}
2 changes: 2 additions & 0 deletions templates/rancher.yaml.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ metadata:
spec:
chart: rancher
repo: https://releases.rancher.com/server-charts/${rancher_install_channel}
version: "${version}"
targetNamespace: cattle-system
bootstrap: ${bootstrap}
valuesContent: |-
${values}
48 changes: 48 additions & 0 deletions variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -696,6 +696,18 @@ variable "enable_longhorn" {
description = "Whether or not to enable Longhorn."
}

variable "longhorn_version" {
type = string
default = "*"
description = "Version of longhorn."
}

variable "longhorn_helmchart_bootstrap" {
type = bool
default = false
description = "Whether the HelmChart longhorn shall be run on control-plane nodes."
}

variable "longhorn_repository" {
type = string
default = "https://charts.longhorn.io"
Expand Down Expand Up @@ -748,6 +760,18 @@ variable "enable_csi_driver_smb" {
description = "Whether or not to enable csi-driver-smb."
}

variable "csi_driver_smb_version" {
type = string
default = "*"
description = "Version of csi_driver_smb."
}

variable "csi_driver_smb_helmchart_bootstrap" {
type = bool
default = false
description = "Whether the HelmChart csi_driver_smb shall be run on control-plane nodes."
}

variable "csi_driver_smb_values" {
type = string
default = ""
Expand All @@ -760,6 +784,18 @@ variable "enable_cert_manager" {
description = "Enable cert manager."
}

variable "cert_manager_version" {
type = string
default = "*"
description = "Version of cert_manager."
}

variable "cert_manager_helmchart_bootstrap" {
type = bool
default = false
description = "Whether the HelmChart cert_manager shall be run on control-plane nodes."
}

variable "cert_manager_values" {
type = string
default = ""
Expand All @@ -772,6 +808,18 @@ variable "enable_rancher" {
description = "Enable rancher."
}

variable "rancher_version" {
type = string
default = "*"
description = "Version of rancher."
}

variable "rancher_helmchart_bootstrap" {
type = bool
default = false
description = "Whether the HelmChart rancher shall be run on control-plane nodes."
}

variable "rancher_install_channel" {
type = string
default = "stable"
Expand Down

0 comments on commit 9186948

Please sign in to comment.