Exposing sample 'game' port correctly now
Some checks failed
Ansible Linting / ansible-lint (push) Failing after 2s
Secops Linting and Safety Checks / checkov-scan-s3 (push) Failing after 14s

This commit is contained in:
shockrah 2024-12-10 18:00:26 -08:00
parent 5d03f6b218
commit f9c73b1e4a
4 changed files with 15 additions and 7 deletions

View File

@ -15,5 +15,5 @@ resource vultr_firewall_rule game-server-inbound {
ip_type = "v4"
subnet = "0.0.0.0"
subnet_size = 0
port = each.value.port
port = each.value.port.expose
}

View File

@ -25,7 +25,7 @@ resource kubernetes_pod game {
}
}
port {
container_port = each.value.port
container_port = each.value.port.internal
protocol = coalesce(each.value.proto, "TCP")
}
}
@ -37,15 +37,17 @@ resource kubernetes_service game {
metadata {
name = each.key
namespace = var.game_servers.namespace
labels = {
app = each.key
}
}
spec {
selector = {
app = each.key
}
port {
target_port = each.value.port
port = each.value.port
node_port = each.value.port
target_port = each.value.port.internal
port = each.value.port.expose
}
type = "NodePort"
}

View File

@ -42,7 +42,10 @@ variable game_servers {
image = string
cpu = string
mem = string
port = number
port = object({
internal = number
expose = number
})
proto = optional(string)
})
)

View File

@ -17,7 +17,10 @@ game_servers = {
image = "nginx:latest"
cpu = "200m"
mem = "64Mi"
port = 30808
port = {
expose = 30808
internal = 80
}
}
}
}