Skip to content

Commit

Permalink
Merge pull request #1417 from schlichtanders/helmchart_hetzner_csi
Browse files Browse the repository at this point in the history
Helmchart hetzner csi
  • Loading branch information
mysticaltech authored Jul 24, 2024
2 parents 35a13cf + de78930 commit de30526
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 2 deletions.
12 changes: 11 additions & 1 deletion init.tf
Original file line number Diff line number Diff line change
Expand Up @@ -252,6 +252,17 @@ resource "null_resource" "kustomization" {
destination = "/var/post_install/longhorn.yaml"
}

# Upload the csi-driver-smb config
provisioner "file" {
content = templatefile(
"${path.module}/templates/hcloud-csi.yaml.tpl",
{
version = local.csi_version
values = indent(4, trimspace(var.hetzner_csi_values))
})
destination = "/var/post_install/hcloud-csi.yaml"
}

# Upload the csi-driver-smb config
provisioner "file" {
content = templatefile(
Expand Down Expand Up @@ -305,7 +316,6 @@ resource "null_resource" "kustomization" {
"set -ex",
"kubectl -n kube-system create secret generic hcloud --from-literal=token=${var.hcloud_token} --from-literal=network=${data.hcloud_network.k3s.name} --dry-run=client -o yaml | kubectl apply -f -",
"kubectl -n kube-system create secret generic hcloud-csi --from-literal=token=${var.hcloud_token} --dry-run=client -o yaml | kubectl apply -f -",
local.csi_version != null ? "curl https://raw.githubusercontent.com/hetznercloud/csi-driver/${coalesce(local.csi_version, "v2.4.0")}/deploy/kubernetes/hcloud-csi.yml -o /var/post_install/hcloud-csi.yml" : "echo 'Skipping hetzner csi.'"
]
}

Expand Down
2 changes: 1 addition & 1 deletion locals.tf
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ locals {
"https://github.com/kubereboot/kured/releases/download/${local.kured_version}/kured-${local.kured_version}-dockerhub.yaml",
"https://raw.githubusercontent.com/rancher/system-upgrade-controller/9e7e45c1bdd528093da36be1f1f32472469005e6/manifests/system-upgrade-controller.yaml",
],
var.disable_hetzner_csi ? [] : ["hcloud-csi.yml"],
var.disable_hetzner_csi ? [] : ["hcloud-csi.yaml"],
lookup(local.ingress_controller_install_resources, var.ingress_controller, []),
lookup(local.cni_install_resources, var.cni_plugin, []),
var.enable_longhorn ? ["longhorn.yaml"] : [],
Expand Down
14 changes: 14 additions & 0 deletions templates/hcloud-csi.yaml.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
---
apiVersion: helm.cattle.io/v1
kind: HelmChart
metadata:
name: hcloud-csi
namespace: kube-system
spec:
chart: hcloud-csi
repo: https://charts.hetzner.cloud
version: "${version}"
targetNamespace: kube-system
bootstrap: true
valuesContent: |-
${values}
7 changes: 7 additions & 0 deletions variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -357,6 +357,13 @@ variable "hetzner_csi_version" {
description = "Version of Container Storage Interface driver for Hetzner Cloud."
}

variable "hetzner_csi_values" {
type = string
default = ""
description = "Additional helm values file to pass to hetzner csi as 'valuesContent' at the HelmChart."
}


variable "restrict_outbound_traffic" {
type = bool
default = true
Expand Down

0 comments on commit de30526

Please sign in to comment.