-
Notifications
You must be signed in to change notification settings - Fork 0
/
pvc.tf
122 lines (110 loc) · 2.92 KB
/
pvc.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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
resource "kubernetes_persistent_volume_claim" "azurefiles" {
depends_on = [
kubernetes_namespace.default,
kubernetes_persistent_volume.azurefiles
]
for_each = local.azurefiles_services_storage
metadata {
name = "pvc-azurefiles-${each.key}"
namespace = var.namespace.name
}
spec {
access_modes = ["ReadWriteMany"]
selector {
match_labels = {
storage-tier = "azurefiles"
}
}
storage_class_name = each.value.protocol == "nfs" ? "azurefile-csi-premium" : "hpcc-premium-zrs-file-share-sc"
resources {
requests = {
storage = kubernetes_persistent_volume.azurefiles[each.key].spec.0.capacity.storage
}
}
volume_name = kubernetes_persistent_volume.azurefiles[each.key].metadata.0.name
}
}
resource "kubernetes_persistent_volume_claim" "blob_nfs" {
depends_on = [
kubernetes_namespace.default,
kubernetes_persistent_volume.blob_nfs
]
for_each = merge(local.blob_nfs_services_storage, local.blob_nfs_data_storage)
metadata {
name = "pvc-blob-${each.key}"
namespace = var.namespace.name
}
spec {
access_modes = ["ReadWriteMany"]
selector {
match_labels = {
storage-tier = "blobnfs"
}
}
storage_class_name = "blobnfs"
resources {
requests = {
storage = kubernetes_persistent_volume.blob_nfs[each.key].spec.0.capacity.storage
}
}
volume_name = kubernetes_persistent_volume.blob_nfs[each.key].metadata.0.name
}
}
resource "kubernetes_persistent_volume_claim" "spill" {
depends_on = [
kubernetes_namespace.default,
kubernetes_persistent_volume.spill
]
for_each = local.spill_space_enabled ? var.spill_volumes : {}
metadata {
name = "${var.namespace.name}-pvc-${each.value.name}"
namespace = var.namespace.name
}
spec {
access_modes = ["${each.value.access_mode}"]
resources {
requests = {
storage = "${each.value.size}G"
}
}
selector {
match_labels = {
storage-tier = each.value.storage_class
}
}
storage_class_name = each.value.storage_class
volume_name = "${var.namespace.name}-pv-${each.value.name}"
}
}
resource "kubernetes_persistent_volume_claim" "remotedata" {
wait_until_bound = true
for_each = {
for remote_storage in local.remote_storage_plane : "${remote_storage.subscription_name}.${remote_storage.storage_account_name}" => remote_storage
}
metadata {
name = each.value.volume_claim_name
namespace = "hpcc"
}
spec {
access_modes = ["ReadOnlyMany"]
storage_class_name = "blobnfs"
resources {
requests = {
storage = "1T"
}
}
selector {
match_labels = {
storage-tier = "blobnfs"
}
}
volume_name = each.value.volume_name
}
timeouts {
create = "5m"
}
depends_on = [
kubernetes_namespace.default,
kubernetes_persistent_volume.remotedata
]
}