[ci skip] install CloudNativePG operator as platform module
- CNPG v0.27.1 operator in cnpg-system namespace - CRDs installed: clusters, backups, poolers, databases, etc. - local-path StorageClass already exists (from cloud-init template) - Prerequisite for PostgreSQL migration off NFS
This commit is contained in:
parent
5318761336
commit
3f558bd4da
2 changed files with 62 additions and 0 deletions
|
|
@ -301,6 +301,14 @@ module "vpa" {
|
||||||
tier = local.tiers.cluster
|
tier = local.tiers.cluster
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# -----------------------------------------------------------------------------
|
||||||
|
# CNPG — CloudNativePG Operator + local-path-provisioner for database storage
|
||||||
|
# -----------------------------------------------------------------------------
|
||||||
|
module "cnpg" {
|
||||||
|
source = "./modules/cnpg"
|
||||||
|
tier = local.tiers.cluster
|
||||||
|
}
|
||||||
|
|
||||||
# -----------------------------------------------------------------------------
|
# -----------------------------------------------------------------------------
|
||||||
# NVIDIA — GPU device plugin
|
# NVIDIA — GPU device plugin
|
||||||
# -----------------------------------------------------------------------------
|
# -----------------------------------------------------------------------------
|
||||||
|
|
|
||||||
54
stacks/platform/modules/cnpg/main.tf
Normal file
54
stacks/platform/modules/cnpg/main.tf
Normal file
|
|
@ -0,0 +1,54 @@
|
||||||
|
variable "tier" { type = string }
|
||||||
|
|
||||||
|
# -----------------------------------------------------------------------------
|
||||||
|
# Namespace
|
||||||
|
# -----------------------------------------------------------------------------
|
||||||
|
resource "kubernetes_namespace" "cnpg_system" {
|
||||||
|
metadata {
|
||||||
|
name = "cnpg-system"
|
||||||
|
labels = {
|
||||||
|
tier = var.tier
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
# -----------------------------------------------------------------------------
|
||||||
|
# CloudNativePG Operator — manages PostgreSQL clusters via CRDs
|
||||||
|
# https://cloudnative-pg.io/
|
||||||
|
# -----------------------------------------------------------------------------
|
||||||
|
resource "helm_release" "cnpg" {
|
||||||
|
namespace = kubernetes_namespace.cnpg_system.metadata[0].name
|
||||||
|
create_namespace = false
|
||||||
|
name = "cnpg"
|
||||||
|
atomic = true
|
||||||
|
timeout = 300
|
||||||
|
|
||||||
|
repository = "https://cloudnative-pg.github.io/charts"
|
||||||
|
chart = "cloudnative-pg"
|
||||||
|
version = "0.27.1"
|
||||||
|
|
||||||
|
values = [yamlencode({
|
||||||
|
crds = {
|
||||||
|
create = true
|
||||||
|
}
|
||||||
|
|
||||||
|
replicaCount = 1
|
||||||
|
|
||||||
|
resources = {
|
||||||
|
requests = {
|
||||||
|
cpu = "100m"
|
||||||
|
memory = "128Mi"
|
||||||
|
}
|
||||||
|
limits = {
|
||||||
|
cpu = "500m"
|
||||||
|
memory = "256Mi"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})]
|
||||||
|
}
|
||||||
|
|
||||||
|
# NOTE: local-path-provisioner is already installed in the cluster
|
||||||
|
# (via cloud-init template) with StorageClass "local-path" (default).
|
||||||
|
# ReclaimPolicy is "Delete" — for CNPG clusters, set
|
||||||
|
# .spec.storage.pvcTemplate.storageClassName = "local-path" in the
|
||||||
|
# Cluster CR. CNPG handles PVC lifecycle independently.
|
||||||
Loading…
Add table
Add a link
Reference in a new issue