separating game and admin service node pools with pods and what not
Some checks failed
Ansible Linting / ansible-lint (push) Failing after 3s
Secops Linting and Safety Checks / checkov-scan-s3 (push) Failing after 14s

This commit is contained in:
shockrah 2024-12-19 01:28:44 -08:00
parent ac11487feb
commit f2c4506245
5 changed files with 55 additions and 33 deletions

View File

@ -1,4 +1,5 @@
resource kubernetes_namespace admin-servers {
count = length(var.admin_services.configs) > 0 ? 1 : 0
metadata {
name = var.admin_services.namespace
}
@ -15,6 +16,9 @@ resource kubernetes_pod admin {
}
}
spec {
node_selector = {
NodeType = var.admin_services.namespace
}
container {
image = each.value.image
name = coalesce(each.value.name, each.key)

View File

@ -6,15 +6,25 @@ resource vultr_kubernetes athens {
# once the cluster is up, we should comment this out again
# enable_firewall = true
node_pools {
# how many nodes do we want in this pool
node_quantity = 1
plan = var.cluster.metapool.plan
label = var.cluster.label
min_nodes = var.cluster.metapool.min
max_nodes = var.cluster.metapool.max
plan = var.cluster.pools["meta"].plan
label = var.admin_services.namespace
min_nodes = var.cluster.pools["meta"].min
max_nodes = var.cluster.pools["meta"].max
# tag = var.admin_services.namespace
}
}
resource vultr_kubernetes_node_pools games {
cluster_id = vultr_kubernetes.athens.id
node_quantity = var.cluster.pools["games"].min
plan = var.cluster.pools["games"].plan
label = var.game_servers.namespace
min_nodes = var.cluster.pools["games"].min
max_nodes = var.cluster.pools["games"].max
tag = var.admin_services.namespace
}
output k8s_config {
value = vultr_kubernetes.athens.kube_config
sensitive = true

View File

@ -1,4 +1,5 @@
resource kubernetes_namespace game-servers {
count = length(var.game_servers.configs) > 0 ? 1 : 0
metadata {
name = var.game_servers.namespace
}

View File

@ -25,12 +25,12 @@ variable cluster {
region = string
label = string
version = string
metapool = object({
pools = map(object({
plan = string
autoscale = bool
min = number
max = number
})
}))
})
}
@ -47,8 +47,7 @@ variable game_servers {
expose = number
})
proto = optional(string)
})
)
}))
})
}

View File

@ -2,12 +2,20 @@ cluster = {
region = "lax"
label = "athens-cluster"
version = "v1.31.2+1"
metapool = {
pools = {
meta = {
plan = "vc2-1c-2gb"
autoscale = true
min = 1
max = 2
}
games = {
plan = "vc2-1c-2gb"
autoscale = true
min = 1
max = 3
}
}
}
game_servers = {
@ -28,16 +36,16 @@ game_servers = {
admin_services = {
namespace = "admin-services"
configs = {
health = {
image = "nginx:latest"
name = "health"
cpu = "200m"
mem = "64Mi"
port = {
notes = "Basic nginx sanity check service"
expose = 30800
internal = 80
}
}
# health = {
# image = "nginx:latest"
# name = "health"
# cpu = "200m"
# mem = "64Mi"
# port = {
# notes = "Basic nginx sanity check service"
# expose = 30800
# internal = 80
# }
# }
}
}