Skip to content

Commit 2ceb3a5

Browse files
paladesunil-parida
andauthored
tf added new nlb and route53 entry for vpro cloud orch (#703)
Co-authored-by: Sunil Parida <[email protected]>
1 parent 8f39201 commit 2ceb3a5

File tree

5 files changed

+100
-1
lines changed

5 files changed

+100
-1
lines changed

pod-configs/module/orch-route53/main.tf

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ locals {
77
traefik_lb_name = substr(sha256("${var.orch_name}-traefik"), 0, 32)
88
argocd_lb_name = substr(sha256("${var.orch_name}-argocd"), 0, 32)
99
traefik2_lb_name = substr(sha256("${var.orch_name}-traefik2"), 0, 32)
10+
traefik3_lb_name = substr(sha256("${var.orch_name}-traefik3"), 0, 32)
1011
}
1112

1213
data "aws_route53_zone" "parent_public" {
@@ -85,6 +86,11 @@ data "aws_lb" "traefik2" {
8586
name = "${local.traefik2_lb_name}"
8687
}
8788

89+
data "aws_lb" "traefik3" {
90+
count = var.lb_created ? 1 : 0
91+
name = "${local.traefik3_lb_name}"
92+
}
93+
8894
resource "aws_route53_record" "traetik_public" {
8995
depends_on = [aws_route53_zone.orch_public]
9096
count = var.lb_created ? 1 : 0
@@ -197,6 +203,34 @@ resource "aws_route53_record" "traefik2_private" {
197203
}
198204
}
199205

206+
resource "aws_route53_record" "traefik3_public" {
207+
depends_on = [aws_route53_zone.orch_public]
208+
count = var.lb_created ? 1 : 0
209+
zone_id = var.create_root_domain ? aws_route53_zone.orch_public[0].zone_id : data.aws_route53_zone.orch_public[0].zone_id
210+
name = "traefik3.${local.orch_zone}"
211+
type = "A"
212+
213+
alias {
214+
name = data.aws_lb.traefik3[count.index].dns_name
215+
evaluate_target_health = true
216+
zone_id = data.aws_lb.traefik3[count.index].zone_id
217+
}
218+
}
219+
220+
resource "aws_route53_record" "traefik3_private" {
221+
depends_on = [aws_route53_zone.orch_private]
222+
count = var.lb_created ? 1 : 0
223+
zone_id = var.create_root_domain ? aws_route53_zone.orch_private[0].zone_id : data.aws_route53_zone.orch_private[0].zone_id
224+
name = "traefik3.${local.orch_zone}"
225+
type = "A"
226+
227+
alias {
228+
name = data.aws_lb.traefik3[count.index].dns_name
229+
evaluate_target_health = true
230+
zone_id = data.aws_lb.traefik3[count.index].zone_id
231+
}
232+
}
233+
200234
resource "aws_route53_record" "public_hostname" {
201235
for_each = toset(var.hostname)
202236
name = "${each.value}.${local.orch_zone}"
@@ -232,3 +266,21 @@ resource "aws_route53_record" "private_hostname_traefik2" {
232266
type = "CNAME"
233267
records = ["traefik2.${local.orch_zone}"]
234268
}
269+
270+
resource "aws_route53_record" "public_hostname_traefik3" {
271+
for_each = toset(var.traefik3_hostname)
272+
name = "${each.value}.${local.orch_zone}"
273+
zone_id = var.create_root_domain ? aws_route53_zone.orch_public[0].zone_id : data.aws_route53_zone.orch_public[0].zone_id
274+
ttl = 900
275+
type = "CNAME"
276+
records = ["traefik3.${local.orch_zone}"]
277+
}
278+
279+
resource "aws_route53_record" "private_hostname_traefik3" {
280+
for_each = toset(var.traefik3_hostname)
281+
name = "${each.value}.${local.orch_zone}"
282+
zone_id = var.create_root_domain ? aws_route53_zone.orch_private[0].zone_id : data.aws_route53_zone.orch_private[0].zone_id
283+
ttl = 900
284+
type = "CNAME"
285+
records = ["traefik3.${local.orch_zone}"]
286+
}

pod-configs/module/orch-route53/variable.tf

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,6 @@ variable "hostname" {
3939
"log-query",
4040
"metadata",
4141
"metrics-node",
42-
"mps",
4342
"mps-wss",
4443
"observability-admin",
4544
"observability-ui",
@@ -68,6 +67,12 @@ variable "traefik2_hostname" {
6867
"tinkerbell-nginx"]
6968
}
7069

70+
variable "traefik3_hostname" {
71+
type = list(string)
72+
default = [
73+
"mps"]
74+
}
75+
7176
variable "lb_created" {
7277
type = bool
7378
description = "Whether the LBs for the Orchestrator are created. The CNAME of {orch_name}.{parent_zone} will be created if it is true."

pod-configs/orchestrator/orch-load-balancer/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ This module defines the following:
2020

2121
- **Traefik ALB**: Main application load balancer for HTTP/HTTPS traffic
2222
- **Traefik2 NLB**: Optional network load balancer (created when `create_traefik2_load_balancer = true`)
23+
- **Traefik3 NLB**: Optional network load balancer for vPRO (created when `create_traefik3_load_balancer = true`)
2324
- **ArgoCD ALB**: Optional dedicated load balancer for ArgoCD and Gitea (created when `create_argocd_load_balancer = true`)
2425

2526
### Security

pod-configs/orchestrator/orch-load-balancer/main.tf

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,16 @@ locals {
9595
enable_health_check = true
9696
}
9797
}
98+
99+
vpro_ports = {
100+
"vpro" : {
101+
listen = 4433
102+
target = 4433
103+
type = "ip"
104+
protocol = "TCP"
105+
enable_health_check = true
106+
}
107+
}
98108
}
99109

100110
module "traefik_load_balancer" {
@@ -125,6 +135,21 @@ module "traefik2_load_balancer" {
125135
enable_deletion_protection = var.enable_deletion_protection
126136
}
127137

138+
module "traefik3_load_balancer" {
139+
count = var.create_traefik3_load_balancer ? 1 : 0
140+
141+
source = "../../module/load-balancer"
142+
name = "traefik3"
143+
type = "network"
144+
internal = var.internal
145+
vpc_id = local.vpc_id
146+
cluster_name = var.cluster_name
147+
subnets = local.public_subnet_ids
148+
ip_allow_list = local.ip_allow_list
149+
ports = local.vpro_ports
150+
enable_deletion_protection = var.enable_deletion_protection
151+
}
152+
128153
# This block executes only when `create_argocd_load_balancer` is set to true
129154
# Dedicated load balancer is necessary for integration env
130155
module "argocd_load_balancer" {
@@ -166,6 +191,12 @@ module "traefik_lb_target_group_binding" {
166191
servicePort = 443
167192
target_id = module.traefik2_load_balancer[0].target_groups["https"].arn
168193
},
194+
"traefik-vpro" : {
195+
serviceNamespace = "orch-gateway"
196+
serviceName = "traefik"
197+
servicePort = 4433
198+
target_id = module.traefik3_load_balancer[0].target_groups["vpro"].arn
199+
},
169200
"argocd" : {
170201
serviceNamespace = "argocd"
171202
serviceName = "argocd-server"
@@ -200,6 +231,10 @@ module "aws_lb_security_group_roles" {
200231
"gitea": {
201232
port = 3000,
202233
security_group_id = module.argocd_load_balancer[0].lb_sg_id
234+
},
235+
"vpro": {
236+
port = 4433,
237+
security_group_id = module.traefik3_load_balancer[0].lb_sg_id
203238
}
204239
}
205240
}

pod-configs/orchestrator/orch-load-balancer/variable.tf

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,12 @@ variable "create_traefik2_load_balancer" {
4848
default = true
4949
}
5050

51+
variable "create_traefik3_load_balancer" {
52+
type = bool
53+
description = "Set true to create dedicated load balancer for traefik3"
54+
default = true
55+
}
56+
5157
variable "create_argocd_load_balancer" {
5258
type = bool
5359
description = "Set true to create dedicated load balancer for infra service like ArgoCD and Gitea"

0 commit comments

Comments
 (0)