File tree 6 files changed +109
-34
lines changed 6 files changed +109
-34
lines changed Original file line number Diff line number Diff line change @@ -34,11 +34,13 @@ locals {
34
34
]
35
35
}
36
36
module "dbsync_pvc" {
37
- source = " ../pvc"
38
- namespace = var. namespace
39
- volume_name = var. volume_name
40
- storage_size = var. storage_size
41
- name = local. db_volume_claim
37
+ source = " ../pvc"
38
+ namespace = var. namespace
39
+ access_mode = var. access_mode
40
+ volume_name = var. volume_name
41
+ storage_class_name = var. storage_class_name
42
+ storage_size = var. storage_size
43
+ name = local. db_volume_claim
42
44
}
43
45
44
46
module "dbsync_postgres" {
@@ -53,6 +55,7 @@ module "dbsync_postgres" {
53
55
postgres_secret_name = var. postgres_secret_name
54
56
postgres_resources = var. postgres_resources
55
57
is_blockfrost_backend = var. is_blockfrost_backend
58
+ postgres_tolerations = coalesce (var. postgres_tolerations , local. default_tolerations )
56
59
}
57
60
58
61
module "dbsync_pgbouncer" {
Original file line number Diff line number Diff line change @@ -21,6 +21,14 @@ variable "storage_size" {
21
21
type = string
22
22
}
23
23
24
+ variable "storage_class_name" {
25
+ type = string
26
+ }
27
+
28
+ variable "access_mode" {
29
+ type = string
30
+ }
31
+
24
32
variable "db_volume_claim" {
25
33
type = string
26
34
default = null
@@ -66,6 +74,35 @@ variable "postgres_config_name" {
66
74
default = null
67
75
}
68
76
77
+ variable "postgres_tolerations" {
78
+ type = list (object ({
79
+ key = string
80
+ operator = string
81
+ value = string
82
+ effect = string
83
+ }))
84
+ default = [
85
+ {
86
+ key = " demeter.run/compute-profile"
87
+ operator = " Equal"
88
+ value = " disk-intensive"
89
+ effect = " NoSchedule"
90
+ },
91
+ {
92
+ key = " demeter.run/compute-arch"
93
+ operator = " Equal"
94
+ value = " x86"
95
+ effect = " NoSchedule"
96
+ },
97
+ {
98
+ key = " demeter.run/availability-sla"
99
+ operator = " Equal"
100
+ value = " consistent"
101
+ effect = " NoSchedule"
102
+ }
103
+ ]
104
+ }
105
+
69
106
// PGBouncer
70
107
variable "pgbouncer_image_tag" {
71
108
default = " 1.21.0"
Original file line number Diff line number Diff line change @@ -74,3 +74,32 @@ variable "postgres_settings" {
74
74
}
75
75
}
76
76
77
+ variable "postgres_tolerations" {
78
+ type = list (object ({
79
+ key = string
80
+ operator = string
81
+ value = string
82
+ effect = string
83
+ }))
84
+ default = [
85
+ {
86
+ key = " demeter.run/compute-profile"
87
+ operator = " Equal"
88
+ value = " disk-intensive"
89
+ effect = " NoSchedule"
90
+ },
91
+ {
92
+ key = " demeter.run/compute-arch"
93
+ operator = " Equal"
94
+ value = " x86"
95
+ effect = " NoSchedule"
96
+ },
97
+ {
98
+ key = " demeter.run/availability-sla"
99
+ operator = " Equal"
100
+ value = " consistent"
101
+ effect = " NoSchedule"
102
+ }
103
+ ]
104
+ }
105
+
Original file line number Diff line number Diff line change @@ -149,25 +149,14 @@ resource "kubernetes_stateful_set_v1" "postgres" {
149
149
}
150
150
}
151
151
152
- toleration {
153
- effect = " NoSchedule"
154
- key = " demeter.run/compute-profile"
155
- operator = " Equal"
156
- value = " disk-intensive"
157
- }
158
-
159
- toleration {
160
- effect = " NoSchedule"
161
- key = " demeter.run/compute-arch"
162
- operator = " Equal"
163
- value = " x86"
164
- }
165
-
166
- toleration {
167
- effect = " NoSchedule"
168
- key = " demeter.run/availability-sla"
169
- operator = " Equal"
170
- value = " consistent"
152
+ dynamic "toleration" {
153
+ for_each = var. postgres_tolerations
154
+ content {
155
+ effect = toleration. value . effect
156
+ key = toleration. value . key
157
+ operator = toleration. value . operator
158
+ value = toleration. value . value
159
+ }
171
160
}
172
161
}
173
162
}
Original file line number Diff line number Diff line change 1
1
variable "namespace" {
2
- description = " the namespace where the resources will be created"
2
+ description = " The namespace where the resources will be created. "
3
3
}
4
4
5
5
variable "volume_name" {
6
- description = " the name of the volume"
6
+ description = " The name of the volume. If not specified, the volume will be dynamically provisioned."
7
+ type = string
8
+ default = null
7
9
}
8
10
9
11
variable "name" {
10
- description = " the name of the pvc "
12
+ description = " The name of the PersistentVolumeClaim (PVC). "
11
13
}
12
14
13
15
variable "storage_size" {
14
- description = " the size of the volume"
16
+ description = " The size of the volume."
17
+ }
18
+
19
+ variable "storage_class_name" {
20
+ description = " The name of the storage class to use."
21
+ default = " nvme"
22
+ }
23
+
24
+ variable "access_mode" {
25
+ description = " The access mode for the volume."
26
+ type = string
27
+ default = " ReadWriteMany"
15
28
}
16
29
17
30
resource "kubernetes_persistent_volume_claim" "shared_disk" {
@@ -23,13 +36,15 @@ resource "kubernetes_persistent_volume_claim" "shared_disk" {
23
36
}
24
37
25
38
spec {
26
- access_modes = [" ReadWriteMany" ]
39
+ access_modes = [var . access_mode ]
40
+
27
41
resources {
28
42
requests = {
29
43
storage = var.storage_size
30
44
}
31
45
}
32
- storage_class_name = " nvme"
33
- volume_name = var. volume_name
46
+
47
+ storage_class_name = var. storage_class_name
48
+ volume_name = var. volume_name != null ? var. volume_name : null
34
49
}
35
50
}
Original file line number Diff line number Diff line change @@ -84,9 +84,11 @@ variable "pgbouncer_auth_user_password" {
84
84
variable "cells" {
85
85
type = map (object ({
86
86
pvc = object ({
87
- volume_name = string
88
- storage_size = string
89
- name = optional (string )
87
+ volume_name = string
88
+ storage_size = string
89
+ storage_class_name = string
90
+ access_mode = string
91
+ name = optional (string )
90
92
})
91
93
postgres = object ({
92
94
image_tag = string
You can’t perform that action at this time.
0 commit comments