File tree 8 files changed +126
-33
lines changed
8 files changed +126
-33
lines changed Original file line number Diff line number Diff line change @@ -31,9 +31,10 @@ variable "api_key_salt" {
31
31
variable "dcu_per_frame" {
32
32
type = map (string )
33
33
default = {
34
- " mainnet" = " 10"
35
- " preprod" = " 5"
36
- " preview" = " 5"
34
+ " mainnet" = " 10"
35
+ " preprod" = " 5"
36
+ " preview" = " 5"
37
+ " vector-testnet" = " 5"
37
38
}
38
39
}
39
40
Original file line number Diff line number Diff line change @@ -55,7 +55,31 @@ variable "resources" {
55
55
}
56
56
}
57
57
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
+ }
Original file line number Diff line number Diff line change @@ -62,7 +62,7 @@ resource "kubernetes_deployment_v1" "ogmios" {
62
62
name = " main"
63
63
image = local. image
64
64
image_pull_policy = " IfNotPresent"
65
- args = local. container_args
65
+ args = local. container_args
66
66
67
67
resources {
68
68
limits = {
@@ -137,24 +137,14 @@ resource "kubernetes_deployment_v1" "ogmios" {
137
137
}
138
138
}
139
139
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
+ }
158
148
}
159
149
}
160
150
}
Original file line number Diff line number Diff line change @@ -32,6 +32,9 @@ module "ogmios_v1_proxy" {
32
32
proxy_image_tag = var. proxy_blue_image_tag
33
33
extension_name = var. extension_name
34
34
networks = var. networks
35
+ cloud_provider = var. cloud_provider
36
+ dns_zone = var. dns_zone
37
+ cluster_issuer = var. cluster_issuer
35
38
name = " proxy"
36
39
}
37
40
@@ -44,6 +47,9 @@ module "ogmios_v1_proxy_green" {
44
47
extension_name = var. extension_name
45
48
networks = [" mainnet" , " preprod" , " preview" , " vector-testnet" ]
46
49
environment = " green"
50
+ cloud_provider = var. cloud_provider
51
+ dns_zone = var. dns_zone
52
+ cluster_issuer = var. cluster_issuer
47
53
name = " proxy-green"
48
54
}
49
55
@@ -69,7 +75,7 @@ module "ogmios_instances" {
69
75
ogmios_image = each. value . ogmios_image
70
76
node_private_dns = each. value . node_private_dns
71
77
ogmios_version = each. value . ogmios_version
72
- compute_arch = each. value . compute_arch
78
+ tolerations = each. value . tolerations
73
79
replicas = each. value . replicas
74
80
}
75
81
Original file line number Diff line number Diff line change @@ -25,7 +25,7 @@ resource "kubernetes_manifest" "certificate_cluster_wildcard_tls" {
25
25
26
26
" issuerRef" = {
27
27
" kind" = " ClusterIssuer"
28
- " name" = " letsencrypt "
28
+ " name" = var.cluster_issuer
29
29
}
30
30
" secretName" = local.cert_secret_name
31
31
}
Original file line number Diff line number Diff line change @@ -80,3 +80,18 @@ variable "dns_zone" {
80
80
type = string
81
81
default = " demeter.run"
82
82
}
83
+
84
+ variable "cluster_issuer" {
85
+ type = string
86
+ default = " letsencrypt"
87
+ }
88
+
89
+ variable "cloud_provider" {
90
+ type = string
91
+ default = " aws"
92
+ }
93
+
94
+ variable "healthcheck_port" {
95
+ type = number
96
+ default = null
97
+ }
Original file line number Diff line number Diff line change 1
- resource "kubernetes_service_v1" "proxy_service" {
1
+ resource "kubernetes_service_v1" "proxy_service_aws" {
2
+ for_each = toset ([for n in toset ([" loadbalancer" ]) : n if var . cloud_provider == " aws" ])
2
3
metadata {
3
4
name = local. name
4
5
namespace = var. namespace
@@ -8,6 +9,7 @@ resource "kubernetes_service_v1" "proxy_service" {
8
9
" service.beta.kubernetes.io/aws-load-balancer-type" : " external"
9
10
" service.beta.kubernetes.io/aws-load-balancer-healthcheck-protocol" : " HTTPS"
10
11
" service.beta.kubernetes.io/aws-load-balancer-healthcheck-path" : " /healthz"
12
+ " service.beta.kubernetes.io/aws-load-balancer-healthcheck-port" : var.healthcheck_port != null ? var.healthcheck_port : " traffic-port"
11
13
}
12
14
}
13
15
@@ -22,6 +24,46 @@ resource "kubernetes_service_v1" "proxy_service" {
22
24
protocol = " TCP"
23
25
}
24
26
27
+
28
+ port {
29
+ name = " health"
30
+ port = 80
31
+ target_port = local. prometheus_port
32
+ protocol = " TCP"
33
+ }
34
+
35
+ type = " LoadBalancer"
36
+ }
37
+ }
38
+
39
+ resource "kubernetes_service_v1" "proxy_service_gcp" {
40
+ for_each = toset ([for n in toset ([" loadbalancer" ]) : n if var . cloud_provider == " gcp" ])
41
+ metadata {
42
+ name = local. name
43
+ namespace = var. namespace
44
+ annotations = {
45
+ " cloud.google.com/l4-rbs" : " enabled"
46
+ }
47
+ }
48
+
49
+ spec {
50
+ external_traffic_policy = " Local"
51
+ selector = local. proxy_labels
52
+
53
+ port {
54
+ name = " proxy"
55
+ port = 443
56
+ target_port = local. proxy_port
57
+ protocol = " TCP"
58
+ }
59
+
60
+ port {
61
+ name = " health"
62
+ port = 80
63
+ target_port = local. prometheus_port
64
+ protocol = " TCP"
65
+ }
66
+
25
67
type = " LoadBalancer"
26
68
}
27
69
}
Original file line number Diff line number Diff line change @@ -7,11 +7,20 @@ variable "dns_zone" {
7
7
default = " demeter.run"
8
8
}
9
9
10
+ variable "cluster_issuer" {
11
+ type = string
12
+ default = " letsencrypt"
13
+ }
14
+
10
15
variable "extension_name" {
11
16
type = string
12
17
default = " ogmios-m1"
13
18
}
14
19
20
+ variable "cloud_provider" {
21
+ type = string
22
+ default = " aws"
23
+ }
15
24
16
25
variable "networks" {
17
26
type = list (string )
@@ -37,9 +46,10 @@ variable "api_key_salt" {
37
46
variable "dcu_per_frame" {
38
47
type = map (string )
39
48
default = {
40
- " mainnet" = " 10"
41
- " preprod" = " 5"
42
- " preview" = " 5"
49
+ " mainnet" = " 10"
50
+ " preprod" = " 5"
51
+ " preview" = " 5"
52
+ " vector-testnet" = " 5"
43
53
}
44
54
}
45
55
@@ -128,7 +138,6 @@ variable "proxy_resources" {
128
138
}
129
139
}
130
140
131
-
132
141
variable "instances" {
133
142
type = map (object ({
134
143
salt = string
@@ -148,5 +157,11 @@ variable "instances" {
148
157
memory = string
149
158
})
150
159
}))
160
+ tolerations = optional (list (object ({
161
+ effect = string
162
+ key = string
163
+ operator = string
164
+ value = optional (string )
165
+ })))
151
166
}))
152
167
}
You can’t perform that action at this time.
0 commit comments