-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathlonghorn.tf
57 lines (51 loc) · 1.42 KB
/
longhorn.tf
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
locals {
longhorn_namespace = var.longhorn_enabled ? {
apiVersion = "v1"
kind = "Namespace"
metadata = {
name = data.helm_template.longhorn[0].namespace
labels = {
"pod-security.kubernetes.io/enforce" = "privileged"
"pod-security.kubernetes.io/audit" = "privileged"
"pod-security.kubernetes.io/warn" = "privileged"
}
}
} : null
}
data "helm_template" "longhorn" {
count = var.longhorn_enabled ? 1 : 0
name = "longhorn"
namespace = "longhorn-system"
repository = var.longhorn_helm_repository
chart = var.longhorn_helm_chart
version = var.longhorn_helm_version
kube_version = var.kubernetes_version
disable_webhooks = true
values = [
yamlencode({
defaultSettings = {
allowCollectingLonghornUsageMetrics = false
kubernetesClusterAutoscalerEnabled = local.cluster_autoscaler_enabled
upgradeChecker = false
}
networkPolicies = {
enabled = true
type = "rke1" # rke1 = ingress-nginx
}
persistence = {
defaultClass = !var.hcloud_csi_enabled
}
}),
yamlencode(var.longhorn_helm_values)
]
}
locals {
longhorn_manifest = var.longhorn_enabled ? {
name = "longhorn"
contents = <<-EOF
${yamlencode(local.longhorn_namespace)}
---
${data.helm_template.longhorn[0].manifest}
EOF
} : null
}