Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add hcloud csi driver volume support #25

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ $ KUBECONFIG=secrets/admin.conf kubectl expose deploy nginx --port=80 --type Nod
| `kubernetes_version` | `1.18.6` | Kubernetes version that will be installed | No |
| `feature_gates` | `` | Add your own Feature Gates for Kubeadm | No |
| `calico_enabled` | `false` | Installs Calico Network Provider after the master comes up | No |
| `csi_driver_enabled` | `false` | Installs [hcloud-csi driver](https://github.com/hetznercloud/csi-driver) for persistent volume support | No |

All variables cloud be passed through `environment variables` or a `tfvars` file.

Expand Down
20 changes: 20 additions & 0 deletions install-hcloud-csi.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
resource "null_resource" "hcloud-csi" {
count = var.csi_driver_enabled ? 1 : 0

connection {
host = hcloud_server.master.0.ipv4_address
private_key = file(var.ssh_private_key)
}

provisioner "file" {
source = "scripts/install-hcloud-csi.sh"
destination = "/root/install-hcloud-csi.sh"
}

provisioner "remote-exec" {
inline = ["HCLOUD_TOKEN=${var.hcloud_token} bash /root/install-hcloud-csi.sh"]
}

depends_on = [hcloud_server.master]
}

7 changes: 7 additions & 0 deletions scripts/install-hcloud-csi.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#!/usr/bin/bas
set -eu

#create secret with hcloud token for hcloud-csi driver
kubectl -n kube-system create secret generic hcloud-csi --from-literal=token=$HCLOUD_TOKEN --dry-run=client -o yaml | kubectl apply -f -

kubectl apply -f https://raw.githubusercontent.com/hetznercloud/csi-driver/v1.4.0/deploy/kubernetes/hcloud-csi.yml
3 changes: 3 additions & 0 deletions variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -54,3 +54,6 @@ variable "calico_enabled" {
default = false
}

variable "csi_driver_enabled" {
default = false
}