Skip to content

Commit 4b4f9a0

Browse files
committed
feat(bootstrap): add dynamic support for tolerations
Signed-off-by: Ales Verbic <[email protected]>
1 parent 84fb819 commit 4b4f9a0

File tree

4 files changed

+44
-24
lines changed

4 files changed

+44
-24
lines changed

Diff for: bootstrap/instance/main.tf

+28-4
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,31 @@ variable "resources" {
5555
}
5656
}
5757

58-
59-
variable "compute_arch" {
60-
type = string
61-
}
58+
variable "tolerations" {
59+
description = "List of tolerations for the instance"
60+
type = list(object({
61+
effect = string
62+
key = string
63+
operator = string
64+
value = optional(string)
65+
}))
66+
default = [
67+
{
68+
effect = "NoSchedule"
69+
key = "demeter.run/compute-profile"
70+
operator = "Exists"
71+
},
72+
{
73+
effect = "NoSchedule"
74+
key = "demeter.run/compute-arch"
75+
operator = "Equal"
76+
value = "x86"
77+
},
78+
{
79+
effect = "NoSchedule"
80+
key = "demeter.run/availability-sla"
81+
operator = "Equal"
82+
value = "consistent"
83+
}
84+
]
85+
}

Diff for: bootstrap/instance/ogmios.tf

+9-19
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ resource "kubernetes_deployment_v1" "ogmios" {
6262
name = "main"
6363
image = local.image
6464
image_pull_policy = "IfNotPresent"
65-
args = local.container_args
65+
args = local.container_args
6666

6767
resources {
6868
limits = {
@@ -137,24 +137,14 @@ resource "kubernetes_deployment_v1" "ogmios" {
137137
}
138138
}
139139

140-
toleration {
141-
effect = "NoSchedule"
142-
key = "demeter.run/compute-profile"
143-
operator = "Exists"
144-
}
145-
146-
toleration {
147-
effect = "NoSchedule"
148-
key = "demeter.run/compute-arch"
149-
operator = "Equal"
150-
value = var.compute_arch
151-
}
152-
153-
toleration {
154-
effect = "NoSchedule"
155-
key = "demeter.run/availability-sla"
156-
operator = "Equal"
157-
value = "consistent"
140+
dynamic "toleration" {
141+
for_each = var.tolerations
142+
content {
143+
effect = toleration.value.effect
144+
key = toleration.value.key
145+
operator = toleration.value.operator
146+
value = toleration.value.value
147+
}
158148
}
159149
}
160150
}

Diff for: bootstrap/main.tf

+1-1
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ module "ogmios_instances" {
7575
ogmios_image = each.value.ogmios_image
7676
node_private_dns = each.value.node_private_dns
7777
ogmios_version = each.value.ogmios_version
78-
compute_arch = each.value.compute_arch
78+
tolerations = each.value.tolerations
7979
replicas = each.value.replicas
8080
}
8181

Diff for: bootstrap/variables.tf

+6
Original file line numberDiff line numberDiff line change
@@ -157,5 +157,11 @@ variable "instances" {
157157
memory = string
158158
})
159159
}))
160+
tolerations = optional(list(object({
161+
effect = string
162+
key = string
163+
operator = string
164+
value = optional(string)
165+
})))
160166
}))
161167
}

0 commit comments

Comments
 (0)