init
This commit is contained in:
26
terraform/modules/k8s/crunchy-data/operator/helm.tf
Normal file
26
terraform/modules/k8s/crunchy-data/operator/helm.tf
Normal file
@@ -0,0 +1,26 @@
|
||||
resource "helm_release" "pgo" {
|
||||
name = var.release_name
|
||||
namespace = kubernetes_namespace_v1.this.metadata[0].name
|
||||
|
||||
# Crunchy публикует Helm chart в OCI registry
|
||||
# helm install pgo oci://registry.developers.crunchydata.com/crunchydata/pgo :contentReference[oaicite:2]{index=2}
|
||||
repository = "oci://registry.developers.crunchydata.com/crunchydata"
|
||||
chart = "pgo"
|
||||
version = var.chart_version
|
||||
|
||||
create_namespace = false
|
||||
|
||||
values = [
|
||||
yamlencode({
|
||||
# безопасные дефолты, без лишней магии
|
||||
debug = var.debug
|
||||
replicas = var.replicas
|
||||
|
||||
# Если хочешь ограничить оператор только этим namespace:
|
||||
# singleNamespace = true
|
||||
singleNamespace = var.single_namespace
|
||||
|
||||
installCRDs = true
|
||||
})
|
||||
]
|
||||
}
|
||||
5
terraform/modules/k8s/crunchy-data/operator/namespace.tf
Normal file
5
terraform/modules/k8s/crunchy-data/operator/namespace.tf
Normal file
@@ -0,0 +1,5 @@
|
||||
resource "kubernetes_namespace_v1" "this" {
|
||||
metadata {
|
||||
name = var.namespace
|
||||
}
|
||||
}
|
||||
7
terraform/modules/k8s/crunchy-data/operator/outputs.tf
Normal file
7
terraform/modules/k8s/crunchy-data/operator/outputs.tf
Normal file
@@ -0,0 +1,7 @@
|
||||
output "namespace" {
|
||||
value = kubernetes_namespace_v1.this.metadata[0].name
|
||||
}
|
||||
|
||||
output "release_name" {
|
||||
value = helm_release.pgo.name
|
||||
}
|
||||
33
terraform/modules/k8s/crunchy-data/operator/variables.tf
Normal file
33
terraform/modules/k8s/crunchy-data/operator/variables.tf
Normal file
@@ -0,0 +1,33 @@
|
||||
variable "namespace" {
|
||||
type = string
|
||||
description = "Namespace, куда ставим Crunchy operator"
|
||||
default = "postgres-operator"
|
||||
}
|
||||
|
||||
variable "release_name" {
|
||||
type = string
|
||||
description = "Helm release name"
|
||||
default = "pgo"
|
||||
}
|
||||
|
||||
variable "chart_version" {
|
||||
type = string
|
||||
description = "Версия чарта pgo (пинить обязательно для воспроизводимости)"
|
||||
default = "6.0.0"
|
||||
}
|
||||
|
||||
variable "debug" {
|
||||
type = bool
|
||||
default = false
|
||||
}
|
||||
|
||||
variable "replicas" {
|
||||
type = number
|
||||
default = 1
|
||||
}
|
||||
|
||||
variable "single_namespace" {
|
||||
type = bool
|
||||
description = "Если true — оператор управляет кластерами только в этом namespace"
|
||||
default = true
|
||||
}
|
||||
6
terraform/modules/k8s/crunchy-data/operator/versions.tf
Normal file
6
terraform/modules/k8s/crunchy-data/operator/versions.tf
Normal file
@@ -0,0 +1,6 @@
|
||||
terraform {
|
||||
required_providers {
|
||||
helm = { source = "hashicorp/helm" }
|
||||
kubernetes = { source = "hashicorp/kubernetes" }
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user