Skip to content

Commit 64db91a

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

File tree

5 files changed

+47
-27
lines changed

5 files changed

+47
-27
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/proxy/service.tf

+3-3
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ resource "kubernetes_service_v1" "proxy_service_aws" {
77
"service.beta.kubernetes.io/aws-load-balancer-nlb-target-type" : "instance"
88
"service.beta.kubernetes.io/aws-load-balancer-scheme" : "internet-facing"
99
"service.beta.kubernetes.io/aws-load-balancer-type" : "external"
10-
"service.beta.kubernetes.io/aws-load-balancer-healthcheck-protocol" : "HTTP"
10+
"service.beta.kubernetes.io/aws-load-balancer-healthcheck-protocol" : "HTTPS"
1111
"service.beta.kubernetes.io/aws-load-balancer-healthcheck-path" : "/healthz"
1212
"service.beta.kubernetes.io/aws-load-balancer-healthcheck-port" : var.healthcheck_port != null ? var.healthcheck_port : "traffic-port"
1313
}
@@ -19,7 +19,7 @@ resource "kubernetes_service_v1" "proxy_service_aws" {
1919

2020
port {
2121
name = "proxy"
22-
port = 9443
22+
port = 443
2323
target_port = local.proxy_port
2424
protocol = "TCP"
2525
}
@@ -52,7 +52,7 @@ resource "kubernetes_service_v1" "proxy_service_gcp" {
5252

5353
port {
5454
name = "proxy"
55-
port = 9443
55+
port = 443
5656
target_port = local.proxy_port
5757
protocol = "TCP"
5858
}

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)