Compare commits
5 Commits
postgres-c
...
outline-0.
Author | SHA1 | Date | |
---|---|---|---|
f905b4ccfe | |||
487786455c | |||
585d39657a | |||
e5e2812ed5 | |||
506218210e |
@@ -1,6 +1,6 @@
|
||||
apiVersion: v2
|
||||
name: outline
|
||||
version: 0.4.0
|
||||
version: 0.5.0
|
||||
description: Chart for Outline wiki
|
||||
keywords:
|
||||
- wiki
|
||||
|
@@ -102,41 +102,14 @@ spec:
|
||||
secretKeyRef:
|
||||
name: "{{ .Values.persistence.s3.credentialsSecret }}"
|
||||
key: AWS_SECRET_ACCESS_KEY
|
||||
{{- if .Values.persistence.s3.endpointConfigMap.enabled }}
|
||||
- name: AWS_REGION
|
||||
valueFrom:
|
||||
configMapKeyRef:
|
||||
name: "{{ .Values.persistence.s3.endpointConfigMap.name }}"
|
||||
key: BUCKET_REGION
|
||||
- name: AWS_S3_UPLOAD_BUCKET_NAME
|
||||
valueFrom:
|
||||
configMapKeyRef:
|
||||
name: "{{ .Values.persistence.s3.endpointConfigMap.name }}"
|
||||
key: BUCKET_NAME
|
||||
- name: AWS_S3_UPLOAD_BUCKET_HOST
|
||||
valueFrom:
|
||||
configMapKeyRef:
|
||||
name: "{{ .Values.persistence.s3.endpointConfigMap.name }}"
|
||||
key: BUCKET_HOST
|
||||
- name: AWS_S3_UPLOAD_BUCKET_PORT
|
||||
valueFrom:
|
||||
configMapKeyRef:
|
||||
name: "{{ .Values.persistence.s3.endpointConfigMap.name }}"
|
||||
key: BUCKET_PORT
|
||||
- name: AWS_S3_UPLOAD_BUCKET_URL
|
||||
value: "{{ .Values.persistence.s3.urlProtocol }}://$(AWS_S3_UPLOAD_BUCKET_NAME).$(AWS_S3_UPLOAD_BUCKET_HOST):$(AWS_S3_UPLOAD_BUCKET_PORT)"
|
||||
- name: AWS_S3_ACCELERATE_URL
|
||||
value: "{{ .Values.persistence.s3.urlProtocol }}://$(AWS_S3_UPLOAD_BUCKET_NAME).$(AWS_S3_UPLOAD_BUCKET_HOST):$(AWS_S3_UPLOAD_BUCKET_PORT)"
|
||||
{{- else }}
|
||||
- name: AWS_REGION
|
||||
value: "{{ .Values.persistence.s3.region }}"
|
||||
- name: AWS_S3_UPLOAD_BUCKET_NAME
|
||||
value: "{{ .Values.persistence.s3.bucketName }}"
|
||||
- name: AWS_S3_UPLOAD_BUCKET_URL
|
||||
value: "{{ .Values.persistence.s3.urlProtocol }}://{{ .Values.persistence.s3.bucketName }}.{{ .Values.persistence.s3.host }}"
|
||||
value: "{{ .Values.persistence.s3.bucketUrl }}"
|
||||
- name: AWS_S3_ACCELERATE_URL
|
||||
value: "{{ .Values.persistence.s3.urlProtocol }}://{{ .Values.persistence.s3.bucketName }}.{{ .Values.persistence.s3.host }}"
|
||||
{{- end }}
|
||||
value: "{{ .Values.persistence.s3.bucketUrl }}"
|
||||
- name: AWS_S3_FORCE_PATH_STYLE
|
||||
value: "{{ .Values.persistence.s3.forcePathStyle }}"
|
||||
- name: AWS_S3_ACL
|
||||
|
@@ -24,13 +24,9 @@ persistence:
|
||||
type: s3
|
||||
s3:
|
||||
credentialsSecret:
|
||||
endpointConfigMap:
|
||||
enabled: false
|
||||
name:
|
||||
region:
|
||||
bucketName:
|
||||
host:
|
||||
urlProtocol: http
|
||||
bucketUrl:
|
||||
uploadMaxSize: "26214400"
|
||||
forcePathStyle: false
|
||||
acl: private
|
||||
|
@@ -1,14 +0,0 @@
|
||||
apiVersion: v2
|
||||
name: postgres-cluster-upgrade
|
||||
version: 0.1.2
|
||||
description: Chart for upgrading a cloudnative-pg cluster in the same namespace
|
||||
keywords:
|
||||
- database
|
||||
- postgres
|
||||
- upgrade
|
||||
sources:
|
||||
- https://github.com/cloudnative-pg/cloudnative-pg
|
||||
maintainers:
|
||||
- name: alexlebens
|
||||
icon: https://avatars.githubusercontent.com/u/100373852?s=48&v=4
|
||||
appVersion: v1.22.2
|
@@ -1,19 +0,0 @@
|
||||
## Introduction
|
||||
|
||||
[CloudNative PG](https://github.com/cloudnative-pg/cloudnative-pg)
|
||||
|
||||
CloudNativePG is the Kubernetes operator that covers the full lifecycle of a highly available PostgreSQL database cluster with a primary/standby architecture, using native streaming replication.
|
||||
|
||||
This chart bootstraps a [CNPG](https://github.com/cloudnative-pg/cloudnative-pg) cluster upgraade on a [Kubernetes](https://kubernetes.io) cluster using the [Helm](https://helm.sh) package manager.
|
||||
|
||||
The process is designed to be used in conjunction with the [postgres-cluster](https://github.com/alexlebens/helm-charts/tree/main/charts/postgres-cluster) chart. The cluster in this chart connects to the orignal cluster, peforms an upgrade, then backups to the objectStore endpoint. Afterwards the upgrade cluster is removed and the orignal cluster bootstraps from the upgrade's backup.
|
||||
|
||||
## Prerequisites
|
||||
|
||||
- Kubernetes
|
||||
- Helm
|
||||
- CloudNative PG Operator
|
||||
|
||||
## Parameters
|
||||
|
||||
See the [values files](values.yaml).
|
@@ -1,17 +0,0 @@
|
||||
{{- if .Values.backup.inititeBackup }}
|
||||
apiVersion: postgresql.cnpg.io/v1
|
||||
kind: Backup
|
||||
metadata:
|
||||
name: "postgresql-{{ .Release.Name }}-cluster-upgrade-backup"
|
||||
namespace: {{ .Release.Namespace }}
|
||||
labels:
|
||||
app.kubernetes.io/name: "postgresql-{{ .Release.Name }}-cluster-upgrade-backup"
|
||||
app.kubernetes.io/instance: {{ .Release.Name }}
|
||||
app.kubernetes.io/version: {{ .Chart.AppVersion }}
|
||||
app.kubernetes.io/component: database
|
||||
app.kubernetes.io/part-of: {{ .Release.Name }}
|
||||
spec:
|
||||
method: barmanObjectStore
|
||||
cluster:
|
||||
name: "postgresql-{{ .Release.Name }}-cluster-upgrade"
|
||||
{{- end }}
|
@@ -1,68 +0,0 @@
|
||||
apiVersion: postgresql.cnpg.io/v1
|
||||
kind: Cluster
|
||||
metadata:
|
||||
name: "postgresql-{{ .Release.Name }}-cluster-upgrade"
|
||||
namespace: {{ .Release.Namespace }}
|
||||
labels:
|
||||
app.kubernetes.io/name: "postgresql-{{ .Release.Name }}-cluster-upgrade"
|
||||
app.kubernetes.io/instance: {{ .Release.Name }}
|
||||
app.kubernetes.io/version: {{ .Chart.AppVersion }}
|
||||
app.kubernetes.io/component: database
|
||||
app.kubernetes.io/part-of: {{ .Release.Name }}
|
||||
spec:
|
||||
imageName: "{{ .Values.cluster.image.repository }}:{{ .Values.cluster.image.tag }}"
|
||||
instances: {{ .Values.cluster.instances }}
|
||||
affinity:
|
||||
enablePodAntiAffinity: true
|
||||
topologyKey: kubernetes.io/hostname
|
||||
postgresql:
|
||||
parameters:
|
||||
{{- toYaml .Values.cluster.parameters | nindent 6 }}
|
||||
resources:
|
||||
{{- toYaml .Values.cluster.resources | nindent 4 }}
|
||||
storage:
|
||||
storageClass: {{ .Values.cluster.storage.data.storageClass }}
|
||||
size: {{ .Values.cluster.storage.data.size }}
|
||||
walStorage:
|
||||
storageClass: {{ .Values.cluster.storage.wal.storageClass }}
|
||||
size: {{ .Values.cluster.storage.wal.size }}
|
||||
monitoring:
|
||||
enablePodMonitor: true
|
||||
|
||||
bootstrap:
|
||||
initdb:
|
||||
import:
|
||||
type: {{ .Values.upgrade.importType }}
|
||||
databases:
|
||||
{{- toYaml .Values.upgrade.importDatabases | nindent 10 }}
|
||||
source:
|
||||
externalCluster: "postgresql-{{ .Release.Name }}-cluster"
|
||||
externalClusters:
|
||||
- name: "postgresql-{{ .Release.Name }}-cluster"
|
||||
connectionParameters:
|
||||
host: "postgresql-{{ .Release.Name }}-cluster-rw"
|
||||
user: app
|
||||
dbname: app
|
||||
password:
|
||||
name: "postgresql-{{ .Release.Name }}-cluster-app"
|
||||
key: password
|
||||
|
||||
{{- if .Values.backup.backupEnabled }}
|
||||
backup:
|
||||
retentionPolicy: "{{ .Values.backup.retentionPolicy }}"
|
||||
barmanObjectStore:
|
||||
destinationPath: "s3://{{ .Values.backup.bucket }}/{{ .Values.cluster.name }}/postgresql/{{ .Release.Name }}-cluster"
|
||||
endpointURL: {{ .Values.backup.endpointURL }}
|
||||
serverName: "postgresql-{{ .Release.Name }}-cluster-backup-index-{{ .Values.backup.backupIndex }}"
|
||||
s3Credentials:
|
||||
accessKeyId:
|
||||
name: "postgresql-{{ .Release.Name }}-cluster-backup-secret"
|
||||
key: ACCESS_KEY_ID
|
||||
secretAccessKey:
|
||||
name: "postgresql-{{ .Release.Name }}-cluster-backup-secret"
|
||||
key: ACCESS_SECRET_KEY
|
||||
data:
|
||||
compression: {{ .Values.cluster.compression }}
|
||||
wal:
|
||||
compression: {{ .Values.cluster.compression }}
|
||||
{{- end }}
|
@@ -1,37 +0,0 @@
|
||||
cluster:
|
||||
name:
|
||||
image:
|
||||
repository: ghcr.io/cloudnative-pg/postgresql
|
||||
tag: 16.2
|
||||
instances: 1
|
||||
parameters:
|
||||
shared_buffers: 128MB
|
||||
max_slot_wal_keep_size: 2000MB
|
||||
hot_standby_feedback: "on"
|
||||
compression: snappy
|
||||
resources:
|
||||
requests:
|
||||
memory: 512Mi
|
||||
cpu: 100m
|
||||
limits:
|
||||
memory: 2Gi
|
||||
cpu: 1500m
|
||||
hugepages-2Mi: 512Mi
|
||||
storage:
|
||||
data:
|
||||
storageClass:
|
||||
size: 10Gi
|
||||
wal:
|
||||
storageClass:
|
||||
size: 2Gi
|
||||
upgrade:
|
||||
importType: microservice
|
||||
importDatabases:
|
||||
- app
|
||||
backup:
|
||||
backupEnabled: false
|
||||
inititeBackup: false
|
||||
retentionPolicy: 3d
|
||||
backupIndex: 1
|
||||
endpointURL:
|
||||
bucket:
|
@@ -1,6 +1,6 @@
|
||||
apiVersion: v2
|
||||
name: postgres-cluster
|
||||
version: 1.0.0
|
||||
version: 2.1.0
|
||||
description: Chart for cloudnative-pg cluster
|
||||
keywords:
|
||||
- database
|
||||
|
@@ -3,20 +3,20 @@
|
||||
backup:
|
||||
retentionPolicy: {{ .Values.backup.retentionPolicy }}
|
||||
barmanObjectStore:
|
||||
destinationPath: "s3://{{ .Values.backup.endpointBucket }}/{{ .Values.kubernetesClusterName }}/postgresql/{{ .Release.Name }}"
|
||||
destinationPath: "s3://{{ .Values.backup.endpointBucket }}/{{ .Values.kubernetesClusterName }}/postgresql/{{ include "cluster.name" . }}"
|
||||
endpointURL: {{ .Values.backup.endpointURL }}
|
||||
{{- if .Values.backup.endpointCA }}
|
||||
endpointCA:
|
||||
name: {{ .Values.backup.endpointCA }}
|
||||
key: ca-bundle.crt
|
||||
{{- end }}
|
||||
serverName: "postgresql-{{ .Release.Name }}-cluster-backup-index-{{ .Values.backup.backupIndex }}"
|
||||
serverName: "{{ include "cluster.name" . }}-backup-{{ .Values.backup.backupIndex }}"
|
||||
s3Credentials:
|
||||
accessKeyId:
|
||||
name: {{ include "cluster.backup.credentials" . }}
|
||||
name: {{ include "cluster.backupCredentials" . }}
|
||||
key: ACCESS_KEY_ID
|
||||
secretAccessKey:
|
||||
name: {{ include "cluster.backup.credentials" . }}
|
||||
name: {{ include "cluster.backupCredentials" . }}
|
||||
key: ACCESS_SECRET_KEY
|
||||
wal:
|
||||
compression: {{ .Values.backup.wal.compression }}
|
||||
|
@@ -1,61 +0,0 @@
|
||||
{{- define "cluster.bootstrap" -}}
|
||||
bootstrap:
|
||||
{{- if eq .Values.mode "standalone" }}
|
||||
initdb:
|
||||
{{- with .Values.cluster.initdb }}
|
||||
{{- with (omit . "postInitApplicationSQL") }}
|
||||
{{- . | toYaml | nindent 4 }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
postInitApplicationSQL:
|
||||
{{- if eq .Values.type "postgis" }}
|
||||
- CREATE EXTENSION IF NOT EXISTS postgis;
|
||||
- CREATE EXTENSION IF NOT EXISTS postgis_topology;
|
||||
- CREATE EXTENSION IF NOT EXISTS fuzzystrmatch;
|
||||
- CREATE EXTENSION IF NOT EXISTS postgis_tiger_geocoder;
|
||||
{{- else if eq .Values.type "timescaledb" }}
|
||||
- CREATE EXTENSION IF NOT EXISTS timescaledb;
|
||||
{{- end }}
|
||||
{{- with .Values.cluster.initdb }}
|
||||
{{- range .postInitApplicationSQL }}
|
||||
{{- printf "- %s" . | nindent 6 }}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
{{- else if eq .Values.mode "recovery" }}
|
||||
recovery:
|
||||
{{- with .Values.recovery.pitrTarget.time }}
|
||||
recoveryTarget:
|
||||
targetTime: {{ . }}
|
||||
{{- end }}
|
||||
source: "postgresql-{{ .Release.Name }}-cluster-backup-index-{{ .Values.recovery.recoveryIndex }}"
|
||||
externalClusters:
|
||||
- name: "postgresql-{{ .Release.Name }}-cluster-backup-index-{{ .Values.recovery.recoveryIndex }}"
|
||||
barmanObjectStore:
|
||||
serverName: "postgresql-{{ .Release.Name }}-cluster-backup-index-{{ .Values.recovery.recoveryIndex }}"
|
||||
destinationPath: "s3://{{ .Values.recovery.endpointBucket }}/{{ .Values.kubernetesClusterName }}/postgresql/{{ .Release.Name }}"
|
||||
endpointURL: {{ .Values.recovery.endpointURL }}
|
||||
{{- with .Values.recovery.endpointCA }}
|
||||
endpointCA:
|
||||
name: {{ . }}
|
||||
key: ca-bundle.crt
|
||||
{{- end }}
|
||||
serverName: "postgresql-{{ .Release.Name }}-cluster-backup-index-{{ .Values.recovery.recoveryIndex }}"
|
||||
s3Credentials:
|
||||
accessKeyId:
|
||||
name: {{ include "cluster.recovery.credentials" . }}
|
||||
key: ACCESS_KEY_ID
|
||||
secretAccessKey:
|
||||
name: {{ include "cluster.recovery.credentials" . }}
|
||||
key: ACCESS_SECRET_KEY
|
||||
wal:
|
||||
compression: {{ .Values.recovery.wal.compression }}
|
||||
encryption: {{ .Values.recovery.wal.encryption }}
|
||||
maxParallel: {{ .Values.recovery.wal.maxParallel }}
|
||||
data:
|
||||
compression: {{ .Values.recovery.data.compression }}
|
||||
encryption: {{ .Values.recovery.data.encryption }}
|
||||
jobs: {{ .Values.recovery.data.jobs }}
|
||||
{{- else }}
|
||||
{{ fail "Invalid cluster mode!" }}
|
||||
{{- end }}
|
||||
{{- end }}
|
92
charts/postgres-cluster/templates/_bootstrap.tpl
Normal file
92
charts/postgres-cluster/templates/_bootstrap.tpl
Normal file
@@ -0,0 +1,92 @@
|
||||
{{- define "cluster.bootstrap" -}}
|
||||
bootstrap:
|
||||
{{- if eq .Values.mode "standalone" }}
|
||||
initdb:
|
||||
{{- with .Values.cluster.initdb }}
|
||||
{{- with (omit . "postInitApplicationSQL") }}
|
||||
{{- . | toYaml | nindent 4 }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
postInitApplicationSQL:
|
||||
{{- if eq .Values.type "postgis" }}
|
||||
- CREATE EXTENSION IF NOT EXISTS postgis;
|
||||
- CREATE EXTENSION IF NOT EXISTS postgis_topology;
|
||||
- CREATE EXTENSION IF NOT EXISTS fuzzystrmatch;
|
||||
- CREATE EXTENSION IF NOT EXISTS postgis_tiger_geocoder;
|
||||
{{- else if eq .Values.type "timescaledb" }}
|
||||
- CREATE EXTENSION IF NOT EXISTS timescaledb;
|
||||
{{- end }}
|
||||
{{- with .Values.cluster.initdb }}
|
||||
{{- range .postInitApplicationSQL }}
|
||||
{{- printf "- %s" . | nindent 6 }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- else if eq .Values.mode "replica" }}
|
||||
initdb:
|
||||
import:
|
||||
type: {{ .Values.replica.importType }}
|
||||
databases:
|
||||
{{- if and (len .Values.replica.importDatabases gt 1) (.Values.replica.importType eq "microservice") }}
|
||||
{{ fail "Too many databases in import type of microservice!" }}
|
||||
{{- else}}
|
||||
{{- with .Values.replica.importDatabases }}
|
||||
{{- . | toYaml | nindent 8 }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- if .Values.replica.importType eq "monolith" }}
|
||||
roles:
|
||||
{{- with .Values.replica.importRoles }}
|
||||
{{- . | toYaml | nindent 8 }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- if and (.Values.replica.postImportApplicationSQL) (.Values.replica.importType eq "microservice") }}
|
||||
postImportApplicationSQL:
|
||||
{{- with .Values.replica.postImportApplicationSQL }}
|
||||
{{- . | toYaml | nindent 8 }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
source:
|
||||
externalCluster: "{{ include "cluster.name" . }}-cluster"
|
||||
externalClusters:
|
||||
- name: "{{ include "cluster.name" . }}-cluster"
|
||||
{{- with .Values.replica.externalCluster }}
|
||||
{{- . | toYaml | nindent 4 }}
|
||||
{{- end }}
|
||||
{{- else if eq .Values.mode "recovery" }}
|
||||
recovery:
|
||||
{{- with .Values.recovery.pitrTarget.time }}
|
||||
recoveryTarget:
|
||||
targetTime: {{ . }}
|
||||
{{- end }}
|
||||
source: "{{ include "cluster.name" . }}-backup-{{ .Values.recovery.recoveryIndex }}"
|
||||
externalClusters:
|
||||
- name: "{{ include "cluster.name" . }}-backup-{{ .Values.recovery.recoveryIndex }}"
|
||||
barmanObjectStore:
|
||||
serverName: "{{ include "cluster.name" . }}-backup-{{ .Values.recovery.recoveryIndex }}"
|
||||
destinationPath: "s3://{{ .Values.recovery.endpointBucket }}/{{ .Values.kubernetesClusterName }}/postgresql/{{ .Values.recovery.recoveryName }}"
|
||||
endpointURL: {{ .Values.recovery.endpointURL }}
|
||||
{{- with .Values.recovery.endpointCA }}
|
||||
endpointCA:
|
||||
name: {{ . }}
|
||||
key: ca-bundle.crt
|
||||
{{- end }}
|
||||
serverName: "{{ include "cluster.name" . }}-backup-{{ .Values.recovery.recoveryIndex }}"
|
||||
s3Credentials:
|
||||
accessKeyId:
|
||||
name: {{ include "cluster.recoveryCredentials" . }}
|
||||
key: ACCESS_KEY_ID
|
||||
secretAccessKey:
|
||||
name: {{ include "cluster.recoveryCredentials" . }}
|
||||
key: ACCESS_SECRET_KEY
|
||||
wal:
|
||||
compression: {{ .Values.recovery.wal.compression }}
|
||||
encryption: {{ .Values.recovery.wal.encryption }}
|
||||
maxParallel: {{ .Values.recovery.wal.maxParallel }}
|
||||
data:
|
||||
compression: {{ .Values.recovery.data.compression }}
|
||||
encryption: {{ .Values.recovery.data.encryption }}
|
||||
jobs: {{ .Values.recovery.data.jobs }}
|
||||
{{- else }}
|
||||
{{ fail "Invalid cluster mode!" }}
|
||||
{{- end }}
|
||||
{{- end }}
|
@@ -2,26 +2,13 @@
|
||||
Expand the name of the chart.
|
||||
*/}}
|
||||
{{- define "cluster.name" -}}
|
||||
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" }}
|
||||
{{- end }}
|
||||
|
||||
{{/*
|
||||
Create a default fully qualified app name.
|
||||
We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
|
||||
If release name contains chart name it will be used as a full name.
|
||||
*/}}
|
||||
{{- define "cluster.fullname" -}}
|
||||
{{- if .Values.fullnameOverride }}
|
||||
{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" }}
|
||||
{{- else }}
|
||||
{{- $name := default .Chart.Name .Values.nameOverride }}
|
||||
{{- if contains $name .Release.Name }}
|
||||
{{- .Release.Name | trunc 63 | trimSuffix "-" }}
|
||||
{{- if .Values.nameOverride }}
|
||||
{{- .Values.nameOverride | trunc 63 | trimSuffix "-" }}
|
||||
{{- else }}
|
||||
{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" }}
|
||||
{{ $version := split "." .Values.cluster.image.tag }}
|
||||
{{- printf "postgresql-%s-%s" $version._0 .Release.Name | trunc 63 | trimSuffix "-" -}}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
|
||||
{{/*
|
||||
Create chart name and version as used by the chart label.
|
||||
@@ -54,18 +41,29 @@ app.kubernetes.io/part-of: cloudnative-pg
|
||||
{{/*
|
||||
Generate name for object store credentials
|
||||
*/}}
|
||||
{{- define "cluster.recovery.credentials" -}}
|
||||
{{- define "cluster.recoveryCredentials" -}}
|
||||
{{- if .Values.recovery.endpointCredentials -}}
|
||||
{{- .Values.recovery.endpointCredentials -}}
|
||||
{{- else -}}
|
||||
{{- printf "postgresql-%s-cluster-backup-secret" .Release.Name | trunc 63 | trimSuffix "-" -}}
|
||||
{{- printf "%s-backup-secret" (include "cluster.name" .) | trunc 63 | trimSuffix "-" -}}
|
||||
{{- end }}
|
||||
{{- end -}}
|
||||
{{- end }}
|
||||
|
||||
{{- define "cluster.backup.credentials" -}}
|
||||
{{- define "cluster.backupCredentials" -}}
|
||||
{{- if .Values.backup.endpointCredentials -}}
|
||||
{{- .Values.backup.endpointCredentials -}}
|
||||
{{- else -}}
|
||||
{{- printf "postgresql-%s-cluster-backup-secret" .Release.Name | trunc 63 | trimSuffix "-" -}}
|
||||
{{- printf "%s-backup-secret" (include "cluster.name" .) | trunc 63 | trimSuffix "-" -}}
|
||||
{{- end }}
|
||||
{{- end -}}
|
||||
{{- end }}
|
||||
|
||||
{{/*
|
||||
Generate recovery server name
|
||||
*/}}
|
||||
{{- define "cluster.recoveryName" -}}
|
||||
{{- if .Values.recovery.recoveryName -}}
|
||||
{{- .Values.recovery.recoveryName -}}
|
||||
{{- else -}}
|
||||
{{ include "cluster.name" . }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
|
@@ -1,7 +1,7 @@
|
||||
apiVersion: postgresql.cnpg.io/v1
|
||||
kind: Cluster
|
||||
metadata:
|
||||
name: "postgresql-{{ include "cluster.fullname" . }}-cluster"
|
||||
name: {{ include "cluster.name" . }}-cluster
|
||||
namespace: {{ .Release.Namespace }}
|
||||
{{- with .Values.cluster.annotations }}
|
||||
annotations:
|
||||
|
@@ -2,7 +2,7 @@
|
||||
apiVersion: monitoring.coreos.com/v1
|
||||
kind: PrometheusRule
|
||||
metadata:
|
||||
name: "postgresql-{{ include "cluster.fullname" . }}-alert-rules"
|
||||
name: {{ include "cluster.name" . }}-alert-rules
|
||||
namespace: {{ .Release.Namespace }}
|
||||
labels:
|
||||
{{- include "cluster.labels" . | nindent 4 }}
|
||||
@@ -11,14 +11,14 @@ metadata:
|
||||
{{- end }}
|
||||
spec:
|
||||
groups:
|
||||
- name: cloudnative-pg/{{ include "cluster.fullname" . }}
|
||||
- name: cloudnative-pg/{{ include "cluster.name" . }}
|
||||
rules:
|
||||
{{- $dict := dict "excludeRules" .Values.cluster.monitoring.prometheusRule.excludeRules -}}
|
||||
{{- $_ := set $dict "value" "{{ $value }}" -}}
|
||||
{{- $_ := set $dict "namespace" .Release.Namespace -}}
|
||||
{{- $_ := set $dict "cluster" (include "cluster.fullname" .) -}}
|
||||
{{- $_ := set $dict "cluster" (printf "%s-cluster" (include "cluster.name" .) ) -}}
|
||||
{{- $_ := set $dict "labels" (dict "job" "{{ $labels.job }}" "node" "{{ $labels.node }}" "pod" "{{ $labels.pod }}") -}}
|
||||
{{- $_ := set $dict "podSelector" (printf "%s-([1-9][0-9]*)$" (include "cluster.fullname" .)) -}}
|
||||
{{- $_ := set $dict "podSelector" (printf "%s-cluster-([1-9][0-9]*)$" (include "cluster.name" .) ) -}}
|
||||
{{- $_ := set $dict "Values" .Values -}}
|
||||
{{- $_ := set $dict "Template" .Template -}}
|
||||
{{- range $path, $_ := .Files.Glob "prometheus_rules/**.yaml" }}
|
||||
|
@@ -2,7 +2,7 @@
|
||||
apiVersion: postgresql.cnpg.io/v1
|
||||
kind: ScheduledBackup
|
||||
metadata:
|
||||
name: "postgresql-{{ include "cluster.fullname" . }}-cluster-scheduled-backup"
|
||||
name: {{ include "cluster.name" . }}-scheduled-backup
|
||||
namespace: {{ .Release.Namespace }}
|
||||
labels:
|
||||
{{- include "cluster.labels" . | nindent 4 }}
|
||||
@@ -14,5 +14,5 @@ spec:
|
||||
schedule: {{ .Values.backup.schedule }}
|
||||
backupOwnerReference: self
|
||||
cluster:
|
||||
name: "postgresql-{{ include "cluster.fullname" . }}-cluster"
|
||||
name: {{ include "cluster.name" . }}-cluster
|
||||
{{ end }}
|
||||
|
@@ -1,7 +1,5 @@
|
||||
# -- Override the name of the chart
|
||||
# -- Override the name of the cluster
|
||||
nameOverride: ""
|
||||
# -- Override the full name of the chart
|
||||
fullnameOverride: ""
|
||||
|
||||
###
|
||||
# -- Type of the CNPG database. Available types:
|
||||
@@ -12,8 +10,9 @@ type: postgresql
|
||||
|
||||
###
|
||||
# Cluster mode of operation. Available modes:
|
||||
# * `standalone` - default mode. Creates new or updates an existing CNPG cluster.
|
||||
# * `standalone` - Default mode. Creates new or updates an existing CNPG cluster.
|
||||
# * `recovery` - Same as standalone but creates a cluster from a backup, object store or via pg_basebackup
|
||||
# * `replica` - Create database as a replica from another CNPG cluster
|
||||
mode: standalone
|
||||
|
||||
# Generates bucket name and path for recovery and backup, creates: <endpointBucket>/<clusterName>/postgresql/{{ .Release.Name }}
|
||||
@@ -24,7 +23,7 @@ cluster:
|
||||
|
||||
image:
|
||||
repository: ghcr.io/cloudnative-pg/postgresql
|
||||
tag: 16.2
|
||||
tag: "16.2"
|
||||
pullPolicy: IfNotPresent
|
||||
|
||||
# The UID and GID of the postgres user inside the image
|
||||
@@ -111,6 +110,9 @@ recovery:
|
||||
# Generate external cluster name, uses: postgresql-{{ .Release.Name }}-cluster-backup-index-{{ .Values.recovery.recoveryIndex }}"
|
||||
recoveryIndex: 1
|
||||
|
||||
# Name of the recovery cluster in the object store, defaults to "cluster.name"
|
||||
recoveryName: ""
|
||||
|
||||
wal:
|
||||
# WAL compression method. One of `` (for no compression), `gzip`, `bzip2` or `snappy`.
|
||||
compression: snappy
|
||||
@@ -126,6 +128,32 @@ recovery:
|
||||
# Number of data files to be archived or restored in parallel.
|
||||
jobs: 2
|
||||
|
||||
replica:
|
||||
# See https://cloudnative-pg.io/documentation/current/database_import/
|
||||
# * `microservice` - Single database import as expected from cnpg clusters
|
||||
# * `monolith` - Import multiple databases and roles
|
||||
importType: microservice
|
||||
|
||||
# If type microservice only one database is allowed, default is app as standard in cnpg clusters
|
||||
importDatabases:
|
||||
- app
|
||||
|
||||
# If type microservice no roles are imported and ignored
|
||||
importRoles: []
|
||||
|
||||
# If import type is monolith postImportApplicationSQL is not supported and ignored
|
||||
postImportApplicationSQL: []
|
||||
|
||||
# External cluster connection, password specifies a secret name and the key containing the password value
|
||||
externalCluster:
|
||||
connectionParameters:
|
||||
host: postgresql
|
||||
user: app
|
||||
dbname: app
|
||||
password:
|
||||
name: postgresql
|
||||
key: password
|
||||
|
||||
backup:
|
||||
enabled: false
|
||||
|
||||
|
Reference in New Issue
Block a user