fix
This commit is contained in:
@@ -6,36 +6,21 @@ metadata:
|
||||
name: dolibarr
|
||||
description: null
|
||||
options:
|
||||
postgres:
|
||||
user-groups:
|
||||
default:
|
||||
replicas: 1
|
||||
storage: 5Gi
|
||||
version: '14'
|
||||
- admin: true
|
||||
name: dolibarr-admin
|
||||
examples:
|
||||
- replicas: 1
|
||||
storage: 5Gi
|
||||
version: '14'
|
||||
properties:
|
||||
replicas:
|
||||
default: 1
|
||||
type: integer
|
||||
storage:
|
||||
default: 5Gi
|
||||
type: string
|
||||
version:
|
||||
default: '14'
|
||||
type: string
|
||||
type: object
|
||||
sub-domain:
|
||||
default: erp
|
||||
examples:
|
||||
- erp
|
||||
type: string
|
||||
ingress-class:
|
||||
default: traefik
|
||||
examples:
|
||||
- traefik
|
||||
type: string
|
||||
- - admin: true
|
||||
name: dolibarr-admin
|
||||
items:
|
||||
properties:
|
||||
admin:
|
||||
type: boolean
|
||||
name:
|
||||
type: string
|
||||
type: object
|
||||
type: array
|
||||
parameters:
|
||||
default:
|
||||
MAIN_LANG_DEFAULT: auto
|
||||
@@ -46,39 +31,6 @@ options:
|
||||
default: auto
|
||||
type: string
|
||||
type: object
|
||||
hpa:
|
||||
default:
|
||||
avg-cpu: 50
|
||||
max-replicas: 5
|
||||
min-replicas: 1
|
||||
examples:
|
||||
- avg-cpu: 50
|
||||
max-replicas: 5
|
||||
min-replicas: 1
|
||||
properties:
|
||||
avg-cpu:
|
||||
default: 50
|
||||
type: integer
|
||||
max-replicas:
|
||||
default: 5
|
||||
type: integer
|
||||
min-replicas:
|
||||
default: 1
|
||||
type: integer
|
||||
type: object
|
||||
modules:
|
||||
default:
|
||||
- societe
|
||||
examples:
|
||||
- - societe
|
||||
items:
|
||||
type: string
|
||||
type: array
|
||||
domain-name:
|
||||
default: your_company.com
|
||||
examples:
|
||||
- your_company.com
|
||||
type: string
|
||||
resources:
|
||||
default:
|
||||
limits:
|
||||
@@ -120,42 +72,10 @@ options:
|
||||
type: string
|
||||
type: object
|
||||
type: object
|
||||
storage:
|
||||
default:
|
||||
accessMode: ReadWriteOnce
|
||||
size: 10Gi
|
||||
type: Filesystem
|
||||
domain-name:
|
||||
default: your_company.com
|
||||
examples:
|
||||
- accessMode: ReadWriteOnce
|
||||
size: 10Gi
|
||||
type: Filesystem
|
||||
properties:
|
||||
accessMode:
|
||||
default: ReadWriteOnce
|
||||
enum:
|
||||
- ReadWriteOnce
|
||||
- ReadOnlyMany
|
||||
- ReadWriteMany
|
||||
type: string
|
||||
size:
|
||||
default: 10Gi
|
||||
type: string
|
||||
type:
|
||||
default: Filesystem
|
||||
enum:
|
||||
- Filesystem
|
||||
- block
|
||||
type: string
|
||||
type: object
|
||||
domain:
|
||||
default: your-company
|
||||
examples:
|
||||
- your-company
|
||||
type: string
|
||||
issuer:
|
||||
default: letsencrypt-prod
|
||||
examples:
|
||||
- letsencrypt-prod
|
||||
- your_company.com
|
||||
type: string
|
||||
redis:
|
||||
default:
|
||||
@@ -190,6 +110,86 @@ options:
|
||||
default: 2Gi
|
||||
type: string
|
||||
type: object
|
||||
storage:
|
||||
default:
|
||||
accessMode: ReadWriteOnce
|
||||
size: 10Gi
|
||||
type: Filesystem
|
||||
examples:
|
||||
- accessMode: ReadWriteOnce
|
||||
size: 10Gi
|
||||
type: Filesystem
|
||||
properties:
|
||||
accessMode:
|
||||
default: ReadWriteOnce
|
||||
enum:
|
||||
- ReadWriteOnce
|
||||
- ReadOnlyMany
|
||||
- ReadWriteMany
|
||||
type: string
|
||||
size:
|
||||
default: 10Gi
|
||||
type: string
|
||||
type:
|
||||
default: Filesystem
|
||||
enum:
|
||||
- Filesystem
|
||||
- block
|
||||
type: string
|
||||
type: object
|
||||
ingress-class:
|
||||
default: traefik
|
||||
examples:
|
||||
- traefik
|
||||
type: string
|
||||
modules:
|
||||
default:
|
||||
- societe
|
||||
examples:
|
||||
- - societe
|
||||
items:
|
||||
type: string
|
||||
type: array
|
||||
postgres:
|
||||
default:
|
||||
replicas: 1
|
||||
storage: 5Gi
|
||||
version: '14'
|
||||
examples:
|
||||
- replicas: 1
|
||||
storage: 5Gi
|
||||
version: '14'
|
||||
properties:
|
||||
replicas:
|
||||
default: 1
|
||||
type: integer
|
||||
storage:
|
||||
default: 5Gi
|
||||
type: string
|
||||
version:
|
||||
default: '14'
|
||||
type: string
|
||||
type: object
|
||||
sub-domain:
|
||||
default: erp
|
||||
examples:
|
||||
- erp
|
||||
type: string
|
||||
issuer:
|
||||
default: letsencrypt-prod
|
||||
examples:
|
||||
- letsencrypt-prod
|
||||
type: string
|
||||
domain:
|
||||
default: your-company
|
||||
examples:
|
||||
- your-company
|
||||
type: string
|
||||
log-level:
|
||||
default: 5
|
||||
examples:
|
||||
- 5
|
||||
type: integer
|
||||
images:
|
||||
default:
|
||||
dolibarr:
|
||||
@@ -255,26 +255,26 @@ options:
|
||||
type: string
|
||||
type: object
|
||||
type: object
|
||||
log-level:
|
||||
default: 5
|
||||
examples:
|
||||
- 5
|
||||
type: integer
|
||||
user-groups:
|
||||
hpa:
|
||||
default:
|
||||
- admin: true
|
||||
name: dolibarr-admin
|
||||
avg-cpu: 50
|
||||
max-replicas: 5
|
||||
min-replicas: 1
|
||||
examples:
|
||||
- - admin: true
|
||||
name: dolibarr-admin
|
||||
items:
|
||||
properties:
|
||||
admin:
|
||||
type: boolean
|
||||
name:
|
||||
type: string
|
||||
type: object
|
||||
type: array
|
||||
- avg-cpu: 50
|
||||
max-replicas: 5
|
||||
min-replicas: 1
|
||||
properties:
|
||||
avg-cpu:
|
||||
default: 50
|
||||
type: integer
|
||||
max-replicas:
|
||||
default: 5
|
||||
type: integer
|
||||
min-replicas:
|
||||
default: 1
|
||||
type: integer
|
||||
type: object
|
||||
dependencies:
|
||||
- dist: null
|
||||
category: share
|
||||
|
||||
@@ -2,72 +2,6 @@ locals {
|
||||
pg-labels = merge(local.common-labels, {
|
||||
"app.kubernetes.io/component" = "pg"
|
||||
})
|
||||
postgres-labels = merge(local.common-labels, {
|
||||
"app.kubernetes.io/component" = "postgresql"
|
||||
})
|
||||
}
|
||||
resource "kubectl_manifest" "dolibarr_postgresql" {
|
||||
yaml_body = <<-EOF
|
||||
apiVersion: "acid.zalan.do/v1"
|
||||
kind: "postgresql"
|
||||
metadata:
|
||||
name: "${var.instance}-${var.component}"
|
||||
namespace: "${var.namespace}"
|
||||
labels: ${jsonencode(local.postgres-labels)}
|
||||
spec:
|
||||
databases:
|
||||
${var.component}: "${var.component}"
|
||||
numberOfInstances: ${var.postgres.replicas}
|
||||
podAnnotations:
|
||||
"k8up.io/backupcommand": "pg_dump -U postgres -d ${var.component} --clean"
|
||||
"k8up.io/file-extension": ".sql"
|
||||
postgresql:
|
||||
version: "${var.postgres.version}"
|
||||
teamId: "${var.instance}"
|
||||
users:
|
||||
${var.component}:
|
||||
- "superuser"
|
||||
- "createdb"
|
||||
volume:
|
||||
size: "${var.postgres.storage}"
|
||||
EOF
|
||||
}
|
||||
|
||||
resource "kubectl_manifest" "prj_pre_migrate_pg" {
|
||||
yaml_body = <<-EOF
|
||||
apiVersion: batch/v1
|
||||
kind: Job
|
||||
metadata:
|
||||
name: "${var.instance}-remove-zalando-extensions"
|
||||
namespace: "${var.namespace}"
|
||||
spec:
|
||||
template:
|
||||
spec:
|
||||
restartPolicy: OnFailure
|
||||
containers:
|
||||
- name: clean
|
||||
image: docker.io/postgres:15.3-bookworm
|
||||
imagePullPolicy: IfNotPresent
|
||||
env:
|
||||
- name: USERNAME
|
||||
valueFrom:
|
||||
secretKeyRef:
|
||||
key: username
|
||||
name: postgres.${var.instance}-${var.component}.credentials.postgresql.acid.zalan.do
|
||||
- name: PASSWORD
|
||||
valueFrom:
|
||||
secretKeyRef:
|
||||
key: password
|
||||
name: postgres.${var.instance}-${var.component}.credentials.postgresql.acid.zalan.do
|
||||
- name: DBURL
|
||||
value: "${var.instance}-${var.component}"
|
||||
- name: DBNAME
|
||||
value: "${var.component}"
|
||||
command:
|
||||
- /bin/bash
|
||||
- "-c"
|
||||
- "echo -ne 'drop view if exists metric_helpers.pg_stat_statements;\ndrop function if exists metric_helpers.pg_stat_statements;\nDROP EXTENSION IF EXISTS pg_stat_kcache;\nDROP EXTENSION IF EXISTS pg_stat_statements;\nDROP EXTENSION IF EXISTS set_user;\n'| PGPASSWORD=\"$PASSWORD\" psql -U $USERNAME -d $DBNAME -h $DBURL"
|
||||
EOF
|
||||
}
|
||||
|
||||
resource "kubectl_manifest" "prj_pg" {
|
||||
@@ -83,25 +17,5 @@ resource "kubectl_manifest" "prj_pg" {
|
||||
instances: ${var.postgres.replicas}
|
||||
storage:
|
||||
size: "${var.postgres.storage}"
|
||||
bootstrap:
|
||||
initdb:
|
||||
database: ${var.component}
|
||||
owner: ${var.component}
|
||||
import:
|
||||
type: microservice
|
||||
databases:
|
||||
- ${var.component}
|
||||
source:
|
||||
externalCluster: "${var.instance}-${var.component}"
|
||||
externalClusters:
|
||||
- name: "${var.instance}-${var.component}"
|
||||
connectionParameters:
|
||||
host: "${var.instance}-${var.component}"
|
||||
user: postgres
|
||||
dbname: postgres
|
||||
sslmode: require
|
||||
password:
|
||||
name: "postgres.${var.instance}-${var.component}.credentials.postgresql.acid.zalan.do"
|
||||
key: password
|
||||
EOF
|
||||
}
|
||||
|
||||
@@ -9,51 +9,11 @@ metadata:
|
||||
A painless self-hosted Git service.
|
||||
Gitea is a community managed lightweight code hosting solution written in Go. It is published under the MIT license.
|
||||
options:
|
||||
issuer:
|
||||
default: letsencrypt-prod
|
||||
domain:
|
||||
default: your-company
|
||||
examples:
|
||||
- letsencrypt-prod
|
||||
- your-company
|
||||
type: string
|
||||
theme:
|
||||
default: gitea-modern
|
||||
examples:
|
||||
- gitea-modern
|
||||
type: string
|
||||
default-branch:
|
||||
default: main
|
||||
examples:
|
||||
- main
|
||||
type: string
|
||||
volume:
|
||||
default:
|
||||
size: 10Gi
|
||||
examples:
|
||||
- size: 10Gi
|
||||
properties:
|
||||
size:
|
||||
default: 10Gi
|
||||
type: string
|
||||
type: object
|
||||
ingress-class:
|
||||
default: traefik
|
||||
examples:
|
||||
- traefik
|
||||
type: string
|
||||
sub-domain:
|
||||
default: git
|
||||
examples:
|
||||
- git
|
||||
type: string
|
||||
disable-registration:
|
||||
default: true
|
||||
examples:
|
||||
- true
|
||||
type: boolean
|
||||
replicas:
|
||||
default: 1
|
||||
examples:
|
||||
- 1
|
||||
type: integer
|
||||
postgres:
|
||||
default:
|
||||
replicas: 1
|
||||
@@ -74,61 +34,21 @@ options:
|
||||
default: '14'
|
||||
type: string
|
||||
type: object
|
||||
domain:
|
||||
default: your-company
|
||||
examples:
|
||||
- your-company
|
||||
type: string
|
||||
release:
|
||||
default: 8.3.0
|
||||
examples:
|
||||
- 8.3.0
|
||||
type: string
|
||||
ssh-port:
|
||||
default: 2222
|
||||
examples:
|
||||
- 2222
|
||||
type: integer
|
||||
push-create:
|
||||
webhook:
|
||||
default:
|
||||
org: 'true'
|
||||
private: 'false'
|
||||
user: 'true'
|
||||
allowed-hosts: private
|
||||
skip-tls-verify: false
|
||||
examples:
|
||||
- org: 'true'
|
||||
private: 'false'
|
||||
user: 'true'
|
||||
- allowed-hosts: private
|
||||
skip-tls-verify: false
|
||||
properties:
|
||||
org:
|
||||
default: 'true'
|
||||
type: string
|
||||
private:
|
||||
default: 'false'
|
||||
type: string
|
||||
user:
|
||||
default: 'true'
|
||||
allowed-hosts:
|
||||
default: private
|
||||
type: string
|
||||
skip-tls-verify:
|
||||
default: false
|
||||
type: boolean
|
||||
type: object
|
||||
domain-name:
|
||||
default: your_company.com
|
||||
examples:
|
||||
- your_company.com
|
||||
type: string
|
||||
load-balancer:
|
||||
default:
|
||||
ip: ''
|
||||
examples:
|
||||
- ip: ''
|
||||
properties:
|
||||
ip:
|
||||
default: ''
|
||||
type: string
|
||||
type: object
|
||||
timezone:
|
||||
default: Europe/Paris
|
||||
examples:
|
||||
- Europe/Paris
|
||||
type: string
|
||||
images:
|
||||
default:
|
||||
gitea:
|
||||
@@ -192,6 +112,11 @@ options:
|
||||
type: string
|
||||
type: object
|
||||
type: object
|
||||
ingress-class:
|
||||
default: traefik
|
||||
examples:
|
||||
- traefik
|
||||
type: string
|
||||
admin:
|
||||
default:
|
||||
email: git-admin@git.your_company.com
|
||||
@@ -207,21 +132,96 @@ options:
|
||||
default: gitea_admin
|
||||
type: string
|
||||
type: object
|
||||
webhook:
|
||||
load-balancer:
|
||||
default:
|
||||
allowed-hosts: private
|
||||
skip-tls-verify: false
|
||||
ip: ''
|
||||
examples:
|
||||
- allowed-hosts: private
|
||||
skip-tls-verify: false
|
||||
- ip: ''
|
||||
properties:
|
||||
allowed-hosts:
|
||||
default: private
|
||||
ip:
|
||||
default: ''
|
||||
type: string
|
||||
skip-tls-verify:
|
||||
default: false
|
||||
type: boolean
|
||||
type: object
|
||||
disable-registration:
|
||||
default: true
|
||||
examples:
|
||||
- true
|
||||
type: boolean
|
||||
volume:
|
||||
default:
|
||||
size: 10Gi
|
||||
examples:
|
||||
- size: 10Gi
|
||||
properties:
|
||||
size:
|
||||
default: 10Gi
|
||||
type: string
|
||||
type: object
|
||||
domain-name:
|
||||
default: your_company.com
|
||||
examples:
|
||||
- your_company.com
|
||||
type: string
|
||||
timezone:
|
||||
default: Europe/Paris
|
||||
examples:
|
||||
- Europe/Paris
|
||||
type: string
|
||||
default-branch:
|
||||
default: main
|
||||
examples:
|
||||
- main
|
||||
type: string
|
||||
release:
|
||||
default: 8.3.0
|
||||
examples:
|
||||
- 8.3.0
|
||||
type: string
|
||||
ssh-port:
|
||||
default: 2222
|
||||
examples:
|
||||
- 2222
|
||||
type: integer
|
||||
sub-domain:
|
||||
default: git
|
||||
examples:
|
||||
- git
|
||||
type: string
|
||||
push-create:
|
||||
default:
|
||||
org: 'true'
|
||||
private: 'false'
|
||||
user: 'true'
|
||||
examples:
|
||||
- org: 'true'
|
||||
private: 'false'
|
||||
user: 'true'
|
||||
properties:
|
||||
org:
|
||||
default: 'true'
|
||||
type: string
|
||||
private:
|
||||
default: 'false'
|
||||
type: string
|
||||
user:
|
||||
default: 'true'
|
||||
type: string
|
||||
type: object
|
||||
replicas:
|
||||
default: 1
|
||||
examples:
|
||||
- 1
|
||||
type: integer
|
||||
theme:
|
||||
default: gitea-modern
|
||||
examples:
|
||||
- gitea-modern
|
||||
type: string
|
||||
issuer:
|
||||
default: letsencrypt-prod
|
||||
examples:
|
||||
- letsencrypt-prod
|
||||
type: string
|
||||
dependencies:
|
||||
- dist: null
|
||||
category: share
|
||||
|
||||
@@ -2,72 +2,6 @@ locals {
|
||||
pg-labels = merge(local.common-labels, {
|
||||
"app.kubernetes.io/component" = "pg"
|
||||
})
|
||||
postgres-labels = merge(local.common-labels, {
|
||||
"app.kubernetes.io/component" = "postgresql"
|
||||
})
|
||||
}
|
||||
resource "kubectl_manifest" "gitea_postgresql" {
|
||||
yaml_body = <<-EOF
|
||||
apiVersion: "acid.zalan.do/v1"
|
||||
kind: "postgresql"
|
||||
metadata:
|
||||
name: "${var.instance}-${var.component}"
|
||||
namespace: "${var.namespace}"
|
||||
labels: ${jsonencode(local.postgres-labels)}
|
||||
spec:
|
||||
databases:
|
||||
${var.component}: "${var.component}"
|
||||
numberOfInstances: ${var.postgres.replicas}
|
||||
podAnnotations:
|
||||
"k8up.io/backupcommand": "pg_dump -U postgres -d ${var.component} --clean"
|
||||
"k8up.io/file-extension": ".sql"
|
||||
postgresql:
|
||||
version: "${var.postgres.version}"
|
||||
teamId: "${var.instance}"
|
||||
users:
|
||||
${var.component}:
|
||||
- "superuser"
|
||||
- "createdb"
|
||||
volume:
|
||||
size: "${var.postgres.storage}"
|
||||
EOF
|
||||
}
|
||||
|
||||
resource "kubectl_manifest" "prj_pre_migrate_pg" {
|
||||
yaml_body = <<-EOF
|
||||
apiVersion: batch/v1
|
||||
kind: Job
|
||||
metadata:
|
||||
name: "${var.instance}-remove-zalando-extensions"
|
||||
namespace: "${var.namespace}"
|
||||
spec:
|
||||
template:
|
||||
spec:
|
||||
restartPolicy: OnFailure
|
||||
containers:
|
||||
- name: clean
|
||||
image: docker.io/postgres:15.3-bookworm
|
||||
imagePullPolicy: IfNotPresent
|
||||
env:
|
||||
- name: USERNAME
|
||||
valueFrom:
|
||||
secretKeyRef:
|
||||
key: username
|
||||
name: postgres.${var.instance}-${var.component}.credentials.postgresql.acid.zalan.do
|
||||
- name: PASSWORD
|
||||
valueFrom:
|
||||
secretKeyRef:
|
||||
key: password
|
||||
name: postgres.${var.instance}-${var.component}.credentials.postgresql.acid.zalan.do
|
||||
- name: DBURL
|
||||
value: "${var.instance}-${var.component}"
|
||||
- name: DBNAME
|
||||
value: "${var.component}"
|
||||
command:
|
||||
- /bin/bash
|
||||
- "-c"
|
||||
- "echo -ne 'drop view if exists metric_helpers.pg_stat_statements;\ndrop function if exists metric_helpers.pg_stat_statements;\nDROP EXTENSION IF EXISTS pg_stat_kcache;\nDROP EXTENSION IF EXISTS pg_stat_statements;\nDROP EXTENSION IF EXISTS set_user;\n'| PGPASSWORD=\"$PASSWORD\" psql -U $USERNAME -d $DBNAME -h $DBURL"
|
||||
EOF
|
||||
}
|
||||
|
||||
resource "kubectl_manifest" "prj_pg" {
|
||||
@@ -83,25 +17,5 @@ resource "kubectl_manifest" "prj_pg" {
|
||||
instances: ${var.postgres.replicas}
|
||||
storage:
|
||||
size: "${var.postgres.storage}"
|
||||
bootstrap:
|
||||
initdb:
|
||||
database: ${var.component}
|
||||
owner: ${var.component}
|
||||
import:
|
||||
type: microservice
|
||||
databases:
|
||||
- ${var.component}
|
||||
source:
|
||||
externalCluster: "${var.instance}-${var.component}"
|
||||
externalClusters:
|
||||
- name: "${var.instance}-${var.component}"
|
||||
connectionParameters:
|
||||
host: "${var.instance}-${var.component}"
|
||||
user: postgres
|
||||
dbname: postgres
|
||||
sslmode: require
|
||||
password:
|
||||
name: "postgres.${var.instance}-${var.component}.credentials.postgresql.acid.zalan.do"
|
||||
key: password
|
||||
EOF
|
||||
}
|
||||
|
||||
@@ -6,6 +6,36 @@ metadata:
|
||||
name: nextcloud
|
||||
description: null
|
||||
options:
|
||||
postgres:
|
||||
default:
|
||||
replicas: 1
|
||||
storage: 5Gi
|
||||
version: '14'
|
||||
examples:
|
||||
- replicas: 1
|
||||
storage: 5Gi
|
||||
version: '14'
|
||||
properties:
|
||||
replicas:
|
||||
default: 1
|
||||
type: integer
|
||||
storage:
|
||||
default: 5Gi
|
||||
type: string
|
||||
version:
|
||||
default: '14'
|
||||
type: string
|
||||
type: object
|
||||
ingress-class:
|
||||
default: traefik
|
||||
examples:
|
||||
- traefik
|
||||
type: string
|
||||
domain-name:
|
||||
default: your_company.com
|
||||
examples:
|
||||
- your_company.com
|
||||
type: string
|
||||
apps:
|
||||
default:
|
||||
audioplayer: false
|
||||
@@ -96,21 +126,6 @@ options:
|
||||
default: true
|
||||
type: boolean
|
||||
type: object
|
||||
admin:
|
||||
default:
|
||||
name: nextcloud_admin
|
||||
examples:
|
||||
- name: nextcloud_admin
|
||||
properties:
|
||||
name:
|
||||
default: nextcloud_admin
|
||||
type: string
|
||||
type: object
|
||||
domain-name:
|
||||
default: your_company.com
|
||||
examples:
|
||||
- your_company.com
|
||||
type: string
|
||||
images:
|
||||
default:
|
||||
collabora:
|
||||
@@ -274,10 +289,10 @@ options:
|
||||
type: string
|
||||
type: object
|
||||
type: object
|
||||
ingress-class:
|
||||
default: traefik
|
||||
openid-name:
|
||||
default: vynil
|
||||
examples:
|
||||
- traefik
|
||||
- vynil
|
||||
type: string
|
||||
redis:
|
||||
default:
|
||||
@@ -312,36 +327,11 @@ options:
|
||||
default: 2Gi
|
||||
type: string
|
||||
type: object
|
||||
sub-domain:
|
||||
default: files
|
||||
examples:
|
||||
- files
|
||||
type: string
|
||||
domain:
|
||||
default: your-company
|
||||
examples:
|
||||
- your-company
|
||||
type: string
|
||||
postgres:
|
||||
default:
|
||||
replicas: 1
|
||||
storage: 5Gi
|
||||
version: '14'
|
||||
examples:
|
||||
- replicas: 1
|
||||
storage: 5Gi
|
||||
version: '14'
|
||||
properties:
|
||||
replicas:
|
||||
default: 1
|
||||
type: integer
|
||||
storage:
|
||||
default: 5Gi
|
||||
type: string
|
||||
version:
|
||||
default: '14'
|
||||
type: string
|
||||
type: object
|
||||
storage:
|
||||
default:
|
||||
accessMode: ReadWriteOnce
|
||||
@@ -361,16 +351,26 @@ options:
|
||||
default: 10Gi
|
||||
type: string
|
||||
type: object
|
||||
sub-domain:
|
||||
default: files
|
||||
examples:
|
||||
- files
|
||||
type: string
|
||||
issuer:
|
||||
default: letsencrypt-prod
|
||||
examples:
|
||||
- letsencrypt-prod
|
||||
type: string
|
||||
openid-name:
|
||||
default: vynil
|
||||
admin:
|
||||
default:
|
||||
name: nextcloud_admin
|
||||
examples:
|
||||
- vynil
|
||||
type: string
|
||||
- name: nextcloud_admin
|
||||
properties:
|
||||
name:
|
||||
default: nextcloud_admin
|
||||
type: string
|
||||
type: object
|
||||
hpa:
|
||||
default:
|
||||
avg-cpu: 50
|
||||
|
||||
@@ -2,72 +2,6 @@ locals {
|
||||
pg-labels = merge(local.common-labels, {
|
||||
"app.kubernetes.io/component" = "pg"
|
||||
})
|
||||
postgres-labels = merge(local.common-labels, {
|
||||
"app.kubernetes.io/component" = "postgresql"
|
||||
})
|
||||
}
|
||||
resource "kubectl_manifest" "prj_postgresql" {
|
||||
yaml_body = <<-EOF
|
||||
apiVersion: "acid.zalan.do/v1"
|
||||
kind: "postgresql"
|
||||
metadata:
|
||||
name: "${var.instance}-${var.component}"
|
||||
namespace: "${var.namespace}"
|
||||
labels: ${jsonencode(local.postgres-labels)}
|
||||
spec:
|
||||
databases:
|
||||
${var.component}: "${var.component}"
|
||||
numberOfInstances: ${var.postgres.replicas}
|
||||
podAnnotations:
|
||||
"k8up.io/backupcommand": "pg_dump -U postgres -d ${var.component} --clean"
|
||||
"k8up.io/file-extension": ".sql"
|
||||
postgresql:
|
||||
version: "${var.postgres.version}"
|
||||
teamId: "${var.instance}"
|
||||
users:
|
||||
${var.component}:
|
||||
- "superuser"
|
||||
- "createdb"
|
||||
volume:
|
||||
size: "${var.postgres.storage}"
|
||||
EOF
|
||||
}
|
||||
|
||||
resource "kubectl_manifest" "prj_pre_migrate_pg" {
|
||||
yaml_body = <<-EOF
|
||||
apiVersion: batch/v1
|
||||
kind: Job
|
||||
metadata:
|
||||
name: "${var.instance}-remove-zalando-extensions"
|
||||
namespace: "${var.namespace}"
|
||||
spec:
|
||||
template:
|
||||
spec:
|
||||
restartPolicy: OnFailure
|
||||
containers:
|
||||
- name: clean
|
||||
image: docker.io/postgres:15.3-bookworm
|
||||
imagePullPolicy: IfNotPresent
|
||||
env:
|
||||
- name: USERNAME
|
||||
valueFrom:
|
||||
secretKeyRef:
|
||||
key: username
|
||||
name: postgres.${var.instance}-${var.component}.credentials.postgresql.acid.zalan.do
|
||||
- name: PASSWORD
|
||||
valueFrom:
|
||||
secretKeyRef:
|
||||
key: password
|
||||
name: postgres.${var.instance}-${var.component}.credentials.postgresql.acid.zalan.do
|
||||
- name: DBURL
|
||||
value: "${var.instance}-${var.component}"
|
||||
- name: DBNAME
|
||||
value: "${var.component}"
|
||||
command:
|
||||
- /bin/bash
|
||||
- "-c"
|
||||
- "echo -ne 'drop view if exists metric_helpers.pg_stat_statements;\ndrop function if exists metric_helpers.pg_stat_statements;\nDROP EXTENSION IF EXISTS pg_stat_kcache;\nDROP EXTENSION IF EXISTS pg_stat_statements;\nDROP EXTENSION IF EXISTS set_user;\n'| PGPASSWORD=\"$PASSWORD\" psql -U $USERNAME -d $DBNAME -h $DBURL"
|
||||
EOF
|
||||
}
|
||||
|
||||
resource "kubectl_manifest" "prj_pg" {
|
||||
@@ -83,25 +17,5 @@ resource "kubectl_manifest" "prj_pg" {
|
||||
instances: ${var.postgres.replicas}
|
||||
storage:
|
||||
size: "${var.postgres.storage}"
|
||||
bootstrap:
|
||||
initdb:
|
||||
database: ${var.component}
|
||||
owner: ${var.component}
|
||||
import:
|
||||
type: microservice
|
||||
databases:
|
||||
- ${var.component}
|
||||
source:
|
||||
externalCluster: "${var.instance}-${var.component}"
|
||||
externalClusters:
|
||||
- name: "${var.instance}-${var.component}"
|
||||
connectionParameters:
|
||||
host: "${var.instance}-${var.component}"
|
||||
user: postgres
|
||||
dbname: postgres
|
||||
sslmode: require
|
||||
password:
|
||||
name: "postgres.${var.instance}-${var.component}.credentials.postgresql.acid.zalan.do"
|
||||
key: password
|
||||
EOF
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user