From 1c36941ded1a2d4295e4608ccefcd08b0d76af09 Mon Sep 17 00:00:00 2001 From: jgrusewski Date: Tue, 24 Feb 2026 23:21:14 +0100 Subject: [PATCH] infra(kapsule): add gitlab and ci-build node pools Co-Authored-By: Claude Opus 4.6 --- infra/live/production/kapsule/terragrunt.hcl | 9 ++++++ infra/modules/kapsule/main.tf | 32 ++++++++++++++++++++ infra/modules/kapsule/outputs.tf | 10 ++++++ infra/modules/kapsule/variables.tf | 30 ++++++++++++++++++ 4 files changed, 81 insertions(+) diff --git a/infra/live/production/kapsule/terragrunt.hcl b/infra/live/production/kapsule/terragrunt.hcl index 81a34817c..c91f1a38b 100644 --- a/infra/live/production/kapsule/terragrunt.hcl +++ b/infra/live/production/kapsule/terragrunt.hcl @@ -19,4 +19,13 @@ inputs = { enable_gpu_inference_pool = true gpu_inference_type = "L4-1-24G" gpu_inference_max_size = 1 + + # GitLab CE pool (dedicated for GitLab + Runner manager) + enable_gitlab_pool = true + gitlab_type = "DEV1-L" + + # CI build pool (ephemeral runner pods, scale-to-zero) + enable_ci_build_pool = true + ci_build_type = "GP1-XS" + ci_build_max_size = 2 } diff --git a/infra/modules/kapsule/main.tf b/infra/modules/kapsule/main.tf index 2c826d260..e1849af30 100644 --- a/infra/modules/kapsule/main.tf +++ b/infra/modules/kapsule/main.tf @@ -90,3 +90,35 @@ resource "scaleway_k8s_pool" "gpu_inference" { 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 + region = var.region +} + +# CI build pod pool (scale-to-zero for ephemeral GitLab Runner build pods) +resource "scaleway_k8s_pool" "ci_build" { + count = var.enable_ci_build_pool ? 1 : 0 + cluster_id = scaleway_k8s_cluster.foxhunt.id + name = "ci-build" + node_type = var.ci_build_type + size = 0 + min_size = 0 + max_size = var.ci_build_max_size + autoscaling = true + autohealing = true + region = var.region + + lifecycle { + ignore_changes = [size] + } +} diff --git a/infra/modules/kapsule/outputs.tf b/infra/modules/kapsule/outputs.tf index 1710d1404..312da09e3 100644 --- a/infra/modules/kapsule/outputs.tf +++ b/infra/modules/kapsule/outputs.tf @@ -33,3 +33,13 @@ output "gpu_inference_pool_id" { description = "ID of the GPU inference node pool" value = var.enable_gpu_inference_pool ? scaleway_k8s_pool.gpu_inference[0].id : "" } + +output "gitlab_pool_id" { + description = "ID of the GitLab node pool" + value = var.enable_gitlab_pool ? scaleway_k8s_pool.gitlab[0].id : "" +} + +output "ci_build_pool_id" { + description = "ID of the CI build node pool" + value = var.enable_ci_build_pool ? scaleway_k8s_pool.ci_build[0].id : "" +} diff --git a/infra/modules/kapsule/variables.tf b/infra/modules/kapsule/variables.tf index 631ed2a58..88ec23e6b 100644 --- a/infra/modules/kapsule/variables.tf +++ b/infra/modules/kapsule/variables.tf @@ -68,3 +68,33 @@ variable "gpu_inference_max_size" { type = number default = 1 } + +variable "enable_gitlab_pool" { + description = "Create dedicated node pool for GitLab CE" + type = bool + default = false +} + +variable "gitlab_type" { + description = "Instance type for the GitLab node pool" + type = string + default = "DEV1-L" +} + +variable "enable_ci_build_pool" { + description = "Create dedicated node pool for CI build pods" + type = bool + default = false +} + +variable "ci_build_type" { + description = "Instance type for the CI build node pool" + type = string + default = "GP1-XS" +} + +variable "ci_build_max_size" { + description = "Maximum number of nodes in the CI build pool" + type = number + default = 2 +}