Skip to content

Commit c9097d1

Browse files
committed
feat: enhance ogmios bootstrap
- add extra_annotations for proxy service - refactor proxy variables - fix missing image_pull_secret - condition monitoring because it can be hosted Signed-off-by: Ales Verbic <[email protected]>
1 parent cbaf051 commit c9097d1

File tree

4 files changed

+74
-37
lines changed

4 files changed

+74
-37
lines changed

bootstrap/main.tf

+28-23
Original file line numberDiff line numberDiff line change
@@ -27,32 +27,35 @@ module "ogmios_v1_feature" {
2727
}
2828

2929
module "ogmios_v1_proxy" {
30-
depends_on = [kubernetes_namespace.namespace]
31-
source = "./proxy"
32-
namespace = var.namespace
33-
replicas = var.proxy_blue_replicas
34-
proxy_image_tag = var.proxy_blue_image_tag
35-
extension_name = var.extension_name
36-
networks = var.networks
37-
cloud_provider = var.cloud_provider
38-
dns_zone = var.dns_zone
39-
cluster_issuer = var.cluster_issuer
40-
name = "proxy"
30+
depends_on = [kubernetes_namespace.namespace]
31+
source = "./proxy"
32+
cloud_provider = var.cloud_provider
33+
cluster_issuer = var.cluster_issuer
34+
dns_zone = var.dns_zone
35+
environment = var.proxy_blue_environment
36+
extension_name = var.extension_name
37+
extra_annotations = var.proxy_blue_extra_annotations
38+
name = var.proxy_blue_name
39+
namespace = var.namespace
40+
networks = var.networks
41+
proxy_image_tag = var.proxy_blue_image_tag
42+
replicas = var.proxy_blue_replicas
4143
}
4244

4345
module "ogmios_v1_proxy_green" {
44-
depends_on = [kubernetes_namespace.namespace]
45-
source = "./proxy"
46-
namespace = var.namespace
47-
replicas = var.proxy_green_replicas
48-
proxy_image_tag = var.proxy_green_image_tag
49-
extension_name = var.extension_name
50-
networks = ["mainnet", "preprod", "preview", "vector-testnet"]
51-
environment = "green"
52-
cloud_provider = var.cloud_provider
53-
dns_zone = var.dns_zone
54-
cluster_issuer = var.cluster_issuer
55-
name = "proxy-green"
46+
depends_on = [kubernetes_namespace.namespace]
47+
source = "./proxy"
48+
cloud_provider = var.cloud_provider
49+
cluster_issuer = var.cluster_issuer
50+
dns_zone = var.dns_zone
51+
environment = var.proxy_green_environment
52+
extension_name = var.extension_name
53+
extra_annotations = var.proxy_green_extra_annotations
54+
name = var.proxy_green_name
55+
namespace = var.namespace
56+
networks = var.networks
57+
proxy_image_tag = var.proxy_green_image_tag
58+
replicas = var.proxy_green_replicas
5659
}
5760

5861
// mainnet
@@ -113,5 +116,7 @@ module "ogmios_services" {
113116
module "ogmios_monitoring" {
114117
source = "./monitoring"
115118

119+
for_each = var.o11y_datasource_uid != null ? toset(["enabled"]) : toset([])
120+
116121
o11y_datasource_uid = var.o11y_datasource_uid
117122
}

bootstrap/proxy/main.tf

+6
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,12 @@ variable "environment" {
2020
default = null
2121
}
2222

23+
variable "extra_annotations" {
24+
description = "Extra annotations to add to the proxy services"
25+
type = map(string)
26+
default = {}
27+
}
28+
2329
variable "namespace" {
2430
type = string
2531
}

bootstrap/proxy/service.tf

+8-4
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,16 @@ resource "kubernetes_service_v1" "proxy_service_aws" {
33
metadata {
44
name = local.name
55
namespace = var.namespace
6-
annotations = {
6+
annotations = merge({
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"
1010
"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"
13-
}
13+
},
14+
var.extra_annotations
15+
)
1416
}
1517

1618
spec {
@@ -41,9 +43,11 @@ resource "kubernetes_service_v1" "proxy_service_gcp" {
4143
metadata {
4244
name = local.name
4345
namespace = var.namespace
44-
annotations = {
46+
annotations = merge({
4547
"cloud.google.com/l4-rbs" : "enabled"
46-
}
48+
},
49+
var.extra_annotations
50+
)
4751
}
4852

4953
spec {

bootstrap/variables.tf

+32-10
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,8 @@ variable "versions" {
3333
}
3434

3535
variable "o11y_datasource_uid" {
36-
type = string
36+
type = string
37+
default = null
3738
}
3839

3940
// operator settings
@@ -89,16 +90,12 @@ variable "operator_resources" {
8990
}
9091
}
9192
}
92-
// proxy
93-
94-
# variable "proxy_image_tag" {
95-
# type = string
96-
# }
9793

98-
# variable "proxy_replicas" {
99-
# type = number
100-
# default = 1
101-
# }
94+
// proxy green settings
95+
variable "proxy_green_name" {
96+
type = string
97+
default = "proxy-green"
98+
}
10299

103100
variable "proxy_green_image_tag" {
104101
type = string
@@ -109,6 +106,22 @@ variable "proxy_green_replicas" {
109106
default = 1
110107
}
111108

109+
variable "proxy_green_extra_annotations" {
110+
type = map(string)
111+
default = {}
112+
}
113+
114+
variable "proxy_green_environment" {
115+
type = string
116+
default = "green"
117+
}
118+
119+
// proxy blue settings
120+
variable "proxy_blue_name" {
121+
type = string
122+
default = "proxy"
123+
}
124+
112125
variable "proxy_blue_image_tag" {
113126
type = string
114127
}
@@ -118,6 +131,15 @@ variable "proxy_blue_replicas" {
118131
default = 1
119132
}
120133

134+
variable "proxy_blue_extra_annotations" {
135+
type = map(string)
136+
default = {}
137+
}
138+
139+
variable "proxy_blue_environment" {
140+
type = string
141+
default = null
142+
}
121143

122144
variable "proxy_resources" {
123145
type = object({

0 commit comments

Comments
 (0)