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: update services selectors to use node version instead of release #56

Merged
merged 1 commit into from
Aug 30, 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: 4 additions & 0 deletions bootstrap/instance/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -91,3 +91,7 @@ variable "restore" {
variable "is_custom" {
default = false
}

variable "is_relay" {
default = false
}
2 changes: 1 addition & 1 deletion bootstrap/instance/node.tf
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ locals {
]
arguments = var.network == "vector-testnet" ? [] : 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"
n2n_port_name = var.is_relay == true ? "n2n-${var.network}" : "n2n"
}


Expand Down
10 changes: 6 additions & 4 deletions bootstrap/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ module "instances" {
node_version = each.value.node_version
restore = coalesce(each.value.restore, false)
is_custom = coalesce(each.value.is_custom, false)
is_relay = coalesce(each.value.is_relay, false)
}


Expand All @@ -102,10 +103,11 @@ module "services" {
for_each = var.services
source = "./service"

namespace = var.namespace
network = each.value.network
release = each.value.release
active_salt = each.value.active_salt
namespace = var.namespace
network = each.value.network
release = each.value.release
node_version = each.value.node_version
active_salt = each.value.active_salt
}

module "node_relay" {
Expand Down
5 changes: 0 additions & 5 deletions bootstrap/relay/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ resource "kubernetes_service_v1" "node-relay-n2n" {

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

port {
Expand All @@ -42,9 +41,5 @@ resource "kubernetes_service_v1" "node-relay-n2n" {
port = 3002
target_port = "n2n-preview"
}




}
}
18 changes: 11 additions & 7 deletions bootstrap/service/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -15,16 +15,20 @@ variable "active_salt" {
default = ""
}

variable "node_version" {
description = "the version of the node"
}

locals {
selector = length(var.active_salt) > 0 ? {
"role" = "node"
"network" = var.network
"release" = var.release
"salt" = var.active_salt
"role" = "node"
"network" = var.network
"node-version" = var.node_version
"salt" = var.active_salt
} : {
"role" = "node"
"network" = var.network
"release" = var.release
"role" = "node"
"network" = var.network
"node-version" = var.node_version
}
}

Expand Down
8 changes: 5 additions & 3 deletions bootstrap/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -154,13 +154,15 @@ variable "instances" {
compute_profile = optional(string)
availability_sla = optional(string)
is_custom = optional(bool)
is_relay = optional(bool, false)
}))
}

variable "services" {
type = map(object({
network = string
release = string
active_salt = optional(string)
network = string
release = string
node_version = string
active_salt = optional(string)
}))
}
Loading