Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: add node relay bootstrap #49

Merged
merged 1 commit into from
Jun 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion bootstrap/instance/node.tf
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ locals {
"3000"
]
arguments = var.is_custom == true ? local.custom_arguments : local.default_arguments

n2n_port_name = contains(["mainnet", "preview", "preprod"], var.network) && var.release == "stable" ? "n2n-${var.network}" : "n2n"
}


Expand Down Expand Up @@ -177,7 +179,7 @@ resource "kubernetes_stateful_set_v1" "node" {
}

port {
name = "n2n"
name = local.n2n_port_name
container_port = 3000
}

Expand Down
6 changes: 6 additions & 0 deletions bootstrap/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -105,3 +105,9 @@ module "services" {
release = each.value.release
active_salt = each.value.active_salt
}

module "node_relay" {
depends_on = [kubernetes_namespace.namespace]
source = "./relay"
namespace = var.namespace
}
18 changes: 9 additions & 9 deletions bootstrap/proxy/config.tf
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ locals {
"max_connections" = 1
"rates" = [
{
"interval" = "1s",
"limit" = 1024 * 1024
"interval" = "1m",
"limit" = 1024 * 1024 * 60
}
]
},
Expand All @@ -21,8 +21,8 @@ locals {
"max_connections" = 5
"rates" = [
{
"interval" = "1s",
"limit" = 1024 * 1024
"interval" = "1m",
"limit" = 1024 * 1024 * 60 * 2
}
]
},
Expand All @@ -31,18 +31,18 @@ locals {
"max_connections" = 25
"rates" = [
{
"interval" = "1s",
"limit" = 1024 * 1024
"interval" = "1m",
"limit" = 1024 * 1024 * 60 * 2
}
]
},
{
"name" = "3",
"max_connections" = 75
"rates" = [
{
"interval" = "1s",
"limit" = 1024 * 1024
{
"interval" = "1m",
"limit" = 1024 * 1024 * 60 * 2
}
]
}
Expand Down
50 changes: 50 additions & 0 deletions bootstrap/relay/main.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
variable "namespace" {
description = "the namespace where the resources will be created"
}

resource "kubernetes_service_v1" "node-relay-n2n" {
metadata {
name = "node-relay-n2n"
namespace = var.namespace
annotations = {
"service.beta.kubernetes.io/aws-load-balancer-nlb-target-type" : "instance"
"service.beta.kubernetes.io/aws-load-balancer-scheme" : "internet-facing"
"service.beta.kubernetes.io/aws-load-balancer-type" : "external"
}
}

spec {
type = "LoadBalancer"
load_balancer_class = "service.k8s.aws/nlb"

selector = {
"role" = "node"
"release" = "stable"
}

port {
name = "mainnet"
protocol = "TCP"
port = 3000
target_port = "n2n-mainnet"
}

port {
name = "preprod"
protocol = "TCP"
port = 3001
target_port = "n2n-preprod"
}

port {
name = "preview"
protocol = "TCP"
port = 3002
target_port = "n2n-preview"
}




}
}
Loading