Files
foxhunt/infra/modules/kapsule/main.tf
jgrusewski c731bef759 feat(infra): split training image into RL + supervised, rename ci-compile → ci-rl
RL models (DQN/PPO) only need basic CUDA runtime (~2GB), while supervised
models need cuDNN (~4GB). Splitting saves ~2GB pull time per RL job.
Rename the L4 GPU pool from ci-compile to ci-rl to reflect its actual use.
Add DaemonSet image pre-puller to cache training images on GPU nodes.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-28 10:16:42 +01:00

159 lines
4.6 KiB
HCL

# Terraform state renames — prevents destroy+recreate of state entries.
# Pool name attribute changes (always-on→services, ci-build→ci-training)
# will still force replacement since Scaleway pool names are immutable.
moved {
from = scaleway_k8s_pool.always_on
to = scaleway_k8s_pool.services
}
moved {
from = scaleway_k8s_pool.ci_build
to = scaleway_k8s_pool.ci_training
}
moved {
from = scaleway_k8s_pool.ci_compile
to = scaleway_k8s_pool.ci_rl
}
resource "scaleway_vpc_private_network" "foxhunt" {
name = "${var.cluster_name}-pn"
region = var.region
}
resource "scaleway_k8s_cluster" "foxhunt" {
name = var.cluster_name
version = var.k8s_version
cni = "cilium"
region = var.region
delete_additional_resources = true
private_network_id = scaleway_vpc_private_network.foxhunt.id
auto_upgrade {
enable = true
maintenance_window_start_hour = 4
maintenance_window_day = "sunday"
}
autoscaler_config {
disable_scale_down = false
scale_down_delay_after_add = "10m"
scale_down_unneeded_time = "10m"
estimator = "binpacking"
ignore_daemonsets_utilization = true
}
}
resource "scaleway_k8s_pool" "services" {
cluster_id = scaleway_k8s_cluster.foxhunt.id
name = "services"
node_type = var.services_type
size = 1
min_size = 1
max_size = var.services_max_size
autoscaling = true
autohealing = true
public_ip_disabled = var.public_ip_disabled
region = var.region
lifecycle {
ignore_changes = [size]
}
}
# GitLab CE node pool (dedicated DEV1-L for GitLab + Runner manager)
resource "scaleway_k8s_pool" "gitlab" {
count = var.enable_gitlab_pool ? 1 : 0
cluster_id = scaleway_k8s_cluster.foxhunt.id
name = "gitlab"
node_type = var.gitlab_type
size = 1
min_size = 1
max_size = 1
autoscaling = false
autohealing = true
public_ip_disabled = var.public_ip_disabled
region = var.region
}
# CI RL pool (L4 — 24GB VRAM, CUDA CC 89, for RL training + hyperopt)
# Nodes auto-labeled: k8s.scaleway.com/pool-name=ci-rl
resource "scaleway_k8s_pool" "ci_rl" {
count = var.enable_ci_rl_pool ? 1 : 0
cluster_id = scaleway_k8s_cluster.foxhunt.id
name = "ci-rl"
node_type = var.ci_rl_type
size = 1
min_size = 0
max_size = var.ci_rl_max_size
autoscaling = true
autohealing = true
public_ip_disabled = var.public_ip_disabled
region = var.region
lifecycle {
ignore_changes = [size]
}
}
# CI training pool (L40S — 48GB VRAM, for supervised hyperopt + training)
# Nodes auto-labeled: k8s.scaleway.com/pool-name=ci-training
resource "scaleway_k8s_pool" "ci_training" {
count = var.enable_ci_training_pool ? 1 : 0
cluster_id = scaleway_k8s_cluster.foxhunt.id
name = "ci-training"
node_type = var.ci_training_type
size = 1
min_size = 0
max_size = var.ci_training_max_size
autoscaling = true
autohealing = true
public_ip_disabled = var.public_ip_disabled
region = var.region
lifecycle {
ignore_changes = [size]
}
}
# CPU compile pool (POP2 — high CPU, no GPU, for cargo check/build)
# Nodes auto-labeled: k8s.scaleway.com/pool-name=ci-compile-cpu
resource "scaleway_k8s_pool" "ci_compile_cpu" {
count = var.enable_ci_compile_cpu_pool ? 1 : 0
cluster_id = scaleway_k8s_cluster.foxhunt.id
name = "ci-compile-cpu"
node_type = var.ci_compile_cpu_type
size = 1
min_size = 0
max_size = var.ci_compile_cpu_max_size
autoscaling = true
autohealing = true
public_ip_disabled = var.public_ip_disabled
region = var.region
lifecycle {
ignore_changes = [size]
}
}
# CPU pool for remote development (DevPod — autoscales to zero)
# Nodes auto-labeled: k8s.scaleway.com/pool-name=gpu-dev
resource "scaleway_k8s_pool" "dev" {
count = var.enable_dev_pool ? 1 : 0
cluster_id = scaleway_k8s_cluster.foxhunt.id
name = "gpu-dev"
node_type = var.dev_pool_type
size = 1
min_size = 0
max_size = var.dev_pool_max_size
autoscaling = true
autohealing = true
public_ip_disabled = var.public_ip_disabled
wait_for_pool_ready = false
region = var.region
lifecycle {
ignore_changes = [size]
}
}