Compare commits
4 Commits
homepage-0
...
postgres-c
Author | SHA1 | Date | |
---|---|---|---|
eb79c0ba68 | |||
466b67581f | |||
031b1dec3a | |||
41282e79e8 |
13
charts/postgres-cluster/Chart.yaml
Normal file
13
charts/postgres-cluster/Chart.yaml
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
apiVersion: v2
|
||||||
|
name: postgres-cluster
|
||||||
|
version: 0.0.4
|
||||||
|
description: Chart for cloudnative-pg cluster
|
||||||
|
keywords:
|
||||||
|
- database
|
||||||
|
- postgres
|
||||||
|
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.1
|
17
charts/postgres-cluster/README.md
Normal file
17
charts/postgres-cluster/README.md
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
## 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 on a [Kubernetes](https://kubernetes.io) cluster using the [Helm](https://helm.sh) package manager.
|
||||||
|
|
||||||
|
## Prerequisites
|
||||||
|
|
||||||
|
- Kubernetes
|
||||||
|
- Helm
|
||||||
|
- CloudNative PG Operator
|
||||||
|
|
||||||
|
## Parameters
|
||||||
|
|
||||||
|
See the [values files](values.yaml).
|
82
charts/postgres-cluster/templates/postgresql-cluster.yaml
Normal file
82
charts/postgres-cluster/templates/postgresql-cluster.yaml
Normal file
@@ -0,0 +1,82 @@
|
|||||||
|
apiVersion: postgresql.cnpg.io/v1
|
||||||
|
kind: Cluster
|
||||||
|
metadata:
|
||||||
|
name: "postgresql-{{ .Release.Name }}-cluster"
|
||||||
|
namespace: {{ .Release.Namespace }}
|
||||||
|
labels:
|
||||||
|
app.kubernetes.io/name: postgresql
|
||||||
|
app.kubernetes.io/instance: {{ .Release.Name }}
|
||||||
|
app.kubernetes.io/version: {{ .Chart.AppVersion }}
|
||||||
|
app.kubernetes.io/component: database
|
||||||
|
app.kubernetes.io/part-of: {{ .Release.Name }}
|
||||||
|
app.kubernetes.io/managed-by: helm
|
||||||
|
spec:
|
||||||
|
imageName: {{ .Values.cluster.imageName }}
|
||||||
|
instances: {{ .Values.cluster.instances }}
|
||||||
|
replicationSlots:
|
||||||
|
highAvailability:
|
||||||
|
enabled: true
|
||||||
|
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
|
||||||
|
|
||||||
|
{{- if .Values.bootstrap.initdbEnabled }}
|
||||||
|
bootstrap:
|
||||||
|
initdb:
|
||||||
|
{{- toYaml .Values.bootstrap.initdb | nindent 6 }}
|
||||||
|
{{- end }}
|
||||||
|
|
||||||
|
{{- if .Values.backup.recoveryEnabled }}
|
||||||
|
bootstrap:
|
||||||
|
recovery:
|
||||||
|
source: "postgresql-{{ .Release.Name }}-cluster-recovery-index-{{ .Values.backup.recoveryIndex }}"
|
||||||
|
externalClusters:
|
||||||
|
- name: "postgresql-{{ .Release.Name }}-cluster-recovery-index-{{ .Values.backup.recoveryIndex }}"
|
||||||
|
barmanObjectStore:
|
||||||
|
endpointURL: {{ .Values.backup.endpointURL }}
|
||||||
|
destinationPath: "s3://{{ .Values.backup.bucket }}/{{ .Values.cluster.name }}/postgresql/{{ .Release.Name }}-cluster"
|
||||||
|
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.backup.compression }}
|
||||||
|
wal:
|
||||||
|
compression: {{ .Values.backup.compression }}
|
||||||
|
{{- end }}
|
||||||
|
|
||||||
|
{{- 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.backup.compression }}
|
||||||
|
wal:
|
||||||
|
compression: {{ .Values.backup.compression }}
|
||||||
|
{{- end }}
|
17
charts/postgres-cluster/templates/scheduled-backup.yaml
Normal file
17
charts/postgres-cluster/templates/scheduled-backup.yaml
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
apiVersion: postgresql.cnpg.io/v1
|
||||||
|
kind: ScheduledBackup
|
||||||
|
metadata:
|
||||||
|
name: "postgresql-{{ .Release.Name }}-cluster-backup"
|
||||||
|
namespace: {{ .Release.Namespace }}
|
||||||
|
labels:
|
||||||
|
app.kubernetes.io/name: postgresql
|
||||||
|
app.kubernetes.io/instance: {{ .Release.Name }}
|
||||||
|
app.kubernetes.io/version: {{ .Chart.AppVersion }}
|
||||||
|
app.kubernetes.io/component: database
|
||||||
|
app.kubernetes.io/part-of: {{ .Release.Name }}
|
||||||
|
app.kubernetes.io/managed-by: helm
|
||||||
|
spec:
|
||||||
|
schedule: {{ .Values.backup.schedule }}
|
||||||
|
backupOwnerReference: self
|
||||||
|
cluster:
|
||||||
|
name: "postgresql-{{ .Release.Name }}-cluster"
|
38
charts/postgres-cluster/values.yaml
Normal file
38
charts/postgres-cluster/values.yaml
Normal file
@@ -0,0 +1,38 @@
|
|||||||
|
cluster:
|
||||||
|
name: cl01tl
|
||||||
|
imageName: ghcr.io/cloudnative-pg/postgresql:16.0
|
||||||
|
instances: 2
|
||||||
|
parameters:
|
||||||
|
shared_buffers: 128MB
|
||||||
|
max_slot_wal_keep_size: 2000MB
|
||||||
|
hot_standby_feedback: "on"
|
||||||
|
resources:
|
||||||
|
requests:
|
||||||
|
memory: 512Mi
|
||||||
|
cpu: 100m
|
||||||
|
limits:
|
||||||
|
memory: 2Gi
|
||||||
|
cpu: 1500m
|
||||||
|
hugepages-2Mi: 512Mi
|
||||||
|
storage:
|
||||||
|
data:
|
||||||
|
storageClass: ceph-block
|
||||||
|
size: 10Gi
|
||||||
|
wal:
|
||||||
|
storageClass: ceph-block
|
||||||
|
size: 2Gi
|
||||||
|
bootstrap:
|
||||||
|
initdbEnabled: false
|
||||||
|
initdb:
|
||||||
|
database: app
|
||||||
|
owner: app
|
||||||
|
backup:
|
||||||
|
backupEnabled: true
|
||||||
|
recoveryEnabled: false
|
||||||
|
schedule: "0 0 0 * * *"
|
||||||
|
retentionPolicy: 14d
|
||||||
|
backupIndex: 1
|
||||||
|
recoveryIndex: 1
|
||||||
|
endpointURL: https://nyc3.digitaloceanspaces.com
|
||||||
|
bucket: net-infra
|
||||||
|
compression: snappy
|
Reference in New Issue
Block a user