feat: add system and customer node pools, scale default workers to 0
Some checks failed
Terraform / terraform (push) Has been cancelled
Test / test (push) Has been cancelled

This commit is contained in:
Ryan Moon
2026-04-03 07:20:00 -05:00
parent 10528dd7bb
commit 35b78f672c
4 changed files with 37 additions and 16 deletions

View File

@@ -5,17 +5,39 @@ resource "digitalocean_kubernetes_cluster" "main" {
region = var.region
version = var.k8s_version
# Default pool — scaled to 0, workloads run on system/customer pools
node_pool {
name = "workers"
size = var.k8s_node_size
min_nodes = var.k8s_min_nodes
max_nodes = var.k8s_max_nodes
auto_scale = true
size = "s-2vcpu-4gb"
node_count = 0
}
tags = ["lunarfront", "k8s"]
}
# Customer pool — auto-scales for customer app instances
resource "digitalocean_kubernetes_node_pool" "system" {
cluster_id = digitalocean_kubernetes_cluster.main.id
name = "system"
size = var.k8s_system_node_size
node_count = 2
labels = {
role = "system"
}
}
resource "digitalocean_kubernetes_node_pool" "customers" {
cluster_id = digitalocean_kubernetes_cluster.main.id
name = "customers"
size = var.k8s_customer_node_size
min_nodes = 0
max_nodes = var.k8s_max_customer_nodes
auto_scale = true
labels = {
role = "customer"
}
}
# ─── DNS — wildcard for customer subdomains → cluster load balancer ───────────
# Uncomment after the cluster is up and nginx ingress load balancer IP is known.
# Set cluster_lb_ip in terraform.tfvars then re-run terraform apply.

View File

@@ -47,8 +47,8 @@ resource "cloudflare_record" "gitea" {
name = "git"
type = "A"
content = var.cluster_lb_ip
proxied = true
ttl = 1
proxied = false
ttl = 3600
}
# DNS only — no Cloudflare proxy, for SSH git access

View File

@@ -46,22 +46,22 @@ variable "k8s_version" {
default = "1.32.13-do.2"
}
variable "k8s_node_size" {
description = "Node pool droplet size"
variable "k8s_system_node_size" {
description = "System node pool droplet size (infra workloads)"
type = string
default = "s-2vcpu-4gb"
}
variable "k8s_min_nodes" {
description = "Minimum nodes in the pool"
type = number
default = 1
variable "k8s_customer_node_size" {
description = "Customer node pool droplet size (app instances)"
type = string
default = "s-1vcpu-2gb"
}
variable "k8s_max_nodes" {
description = "Maximum nodes in the pool"
variable "k8s_max_customer_nodes" {
description = "Maximum nodes in the customer pool"
type = number
default = 3
default = 10
}
variable "cluster_lb_ip" {

View File

@@ -14,7 +14,6 @@ resource "cloudflare_ruleset" "admin_ip_allowlist" {
expression = <<-EOT
(
http.host in {
"git.${var.domain}"
"vault.${var.domain}"
"argocd.${var.domain}"
}