init
This commit is contained in:
@@ -0,0 +1,60 @@
|
||||
resource "kubernetes_manifest" "postgres_cluster" {
|
||||
manifest = {
|
||||
apiVersion = "postgres-operator.crunchydata.com/v1beta1"
|
||||
kind = "PostgresCluster"
|
||||
|
||||
metadata = {
|
||||
name = var.name
|
||||
namespace = var.namespace
|
||||
}
|
||||
|
||||
spec = {
|
||||
postgresVersion = var.postgres_version
|
||||
|
||||
instances = [
|
||||
{
|
||||
name = "instance1"
|
||||
dataVolumeClaimSpec = {
|
||||
storageClassName = var.storage_class_name
|
||||
accessModes = ["ReadWriteOnce"]
|
||||
resources = {
|
||||
requests = {
|
||||
storage = var.instance_storage
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
|
||||
backups = {
|
||||
pgbackrest = {
|
||||
repos = [
|
||||
{
|
||||
name = "repo1"
|
||||
volume = {
|
||||
volumeClaimSpec = {
|
||||
storageClassName = var.storage_class_name
|
||||
accessModes = ["ReadWriteOnce"]
|
||||
resources = {
|
||||
requests = {
|
||||
storage = var.backup_storage
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
users = [
|
||||
{
|
||||
name = var.gitlab_db_user
|
||||
databases = [
|
||||
var.gitlab_db_name
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
output "cluster_name" {
|
||||
value = kubernetes_manifest.postgres_cluster.manifest["metadata"]["name"]
|
||||
}
|
||||
|
||||
output "namespace" {
|
||||
value = kubernetes_manifest.postgres_cluster.manifest["metadata"]["namespace"]
|
||||
}
|
||||
@@ -0,0 +1,46 @@
|
||||
variable "namespace" {
|
||||
type = string
|
||||
description = "Namespace, где будет PostgresCluster"
|
||||
default = "postgres-operator"
|
||||
}
|
||||
|
||||
variable "name" {
|
||||
type = string
|
||||
description = "Имя PostgresCluster"
|
||||
default = "hippo"
|
||||
}
|
||||
|
||||
variable "storage_class_name" {
|
||||
type = string
|
||||
description = "StorageClass для PVC (твой Ceph CSI RBD), например: ceph-rbd"
|
||||
default = "ceph-rbd"
|
||||
}
|
||||
|
||||
variable "postgres_version" {
|
||||
type = number
|
||||
description = "Major версия PostgreSQL (ставь ту, которую поддерживает твой CPK)"
|
||||
default = 16
|
||||
}
|
||||
|
||||
variable "instance_storage" {
|
||||
type = string
|
||||
description = "Размер диска под data"
|
||||
default = "10Gi"
|
||||
}
|
||||
|
||||
variable "backup_storage" {
|
||||
type = string
|
||||
description = "Размер диска под pgBackRest repo"
|
||||
default = "10Gi"
|
||||
}
|
||||
|
||||
variable "gitlab_db_user" {
|
||||
type = string
|
||||
default = "gitlab"
|
||||
}
|
||||
|
||||
variable "gitlab_db_name" {
|
||||
type = string
|
||||
default = "gitlabhq_production"
|
||||
}
|
||||
|
||||
@@ -0,0 +1,7 @@
|
||||
terraform {
|
||||
required_providers {
|
||||
kubernetes = {
|
||||
source = "hashicorp/kubernetes"
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user