feat: add basic pgo
This commit is contained in:
@@ -0,0 +1,31 @@
|
||||
Thank you for deploying a Crunchy PostgreSQL cluster!
|
||||
|
||||
((((((((((((((((((((((
|
||||
(((((((((((((%%%%%%%(((((((((((((((
|
||||
(((((((((((%%% %%%%((((((((((((
|
||||
(((((((((((%%( (((( ( %%%(((((((((((
|
||||
(((((((((((((%% (( ,(( %%%(((((((((((
|
||||
(((((((((((((((%% *%%/ %%%%%%%((((((((((
|
||||
(((((((((((((((((((%%(( %%%%%%%%%%#(((((%%%%%%%%%%#((((((((((((
|
||||
((((((((((((((((((%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%((((((((((((((
|
||||
*((((((((((((((((((((%%%%%% /%%%%%%%%%%%%%%%%%%%((((((((((((((((
|
||||
(((((((((((((((((((((((%%%/ .%, %%%((((((((((((((((((,
|
||||
((((((((((((((((((((((% %#(((((((((((((((((
|
||||
(((((((((((((((%%%%%% #%(((((((((((((((((
|
||||
((((((((((((((%% %%(((((((((((((((,
|
||||
((((((((((((%%%#% % %%(((((((((((((((
|
||||
((((((((((((%. % % #((((((((((((((
|
||||
(((((((((((%% % %%* %(((((((((((((
|
||||
#(###(###(#%% %%% %% %%% #%%#(###(###(#
|
||||
###########%%%%% /%%%%%%%%%%%%% %% %%%%% ,%%#######
|
||||
###############%% %%%%%% %%% %%%%%%%% %%#####
|
||||
################%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %% %%##
|
||||
################%% %%%%%%%%%%%%%%%%% %%%% %
|
||||
##############%# %% (%%%%%%% %%%%%%
|
||||
#############% %%%%% %%%%%%%%%%%
|
||||
###########% %%%%%%%%%%% %%%%%%%%%
|
||||
#########%% %% %%%%%%%%%%%%%%%#
|
||||
########%% %% %%%%%%%%%
|
||||
######%% %% %%%%%%
|
||||
####%%% %%%%% %
|
||||
%% %%%%
|
@@ -0,0 +1,12 @@
|
||||
{{/* Allow for Azure secret information to be stored in a Secret */}}
|
||||
{{- define "postgres.azure" }}
|
||||
[global]
|
||||
{{- if .azure }}
|
||||
{{- if .azure.account }}
|
||||
repo{{ add .index 1 }}-azure-account={{ .azure.account }}
|
||||
{{- end }}
|
||||
{{- if .azure.key }}
|
||||
repo{{ add .index 1 }}-azure-key={{ .azure.key }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{ end }}
|
@@ -0,0 +1,7 @@
|
||||
{{/* Allow for GCS secret information to be stored in a Secret */}}
|
||||
{{- define "postgres.gcs" }}
|
||||
[global]
|
||||
{{- if .gcs }}
|
||||
repo{{ add .index 1 }}-gcs-key=/etc/pgbackrest/conf.d/gcs-key.json
|
||||
{{- end }}
|
||||
{{ end }}
|
@@ -0,0 +1,18 @@
|
||||
{{/* Allow for S3 secret information to be stored in a Secret */}}
|
||||
{{- define "postgres.s3" }}
|
||||
[global]
|
||||
{{- if .s3 }}
|
||||
{{- if .s3.key }}
|
||||
repo{{ add .index 1 }}-s3-key={{ .s3.key }}
|
||||
{{- end }}
|
||||
{{- if .s3.keySecret }}
|
||||
repo{{ add .index 1 }}-s3-key-secret={{ .s3.keySecret }}
|
||||
{{- end }}
|
||||
{{- if .s3.keyType }}
|
||||
repo{{ add .index 1 }}-s3-key-type={{ .s3.keyType }}
|
||||
{{- end }}
|
||||
{{- if .s3.encryptionPassphrase }}
|
||||
repo{{ add .index 1 }}-cipher-pass={{ .s3.encryptionPassphrase }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{ end }}
|
@@ -0,0 +1,41 @@
|
||||
{{- if or .Values.multiBackupRepos .Values.s3 .Values.gcs .Values.azure }}
|
||||
apiVersion: v1
|
||||
kind: Secret
|
||||
metadata:
|
||||
name: {{ default .Release.Name .Values.name }}-pgbackrest-secret
|
||||
type: Opaque
|
||||
data:
|
||||
{{- if .Values.multiBackupRepos }}
|
||||
{{- range $index, $repo := .Values.multiBackupRepos }}
|
||||
{{- if $repo.s3 }}
|
||||
{{- $args := dict "s3" $repo.s3 "index" $index }}
|
||||
s3.conf: |-
|
||||
{{ include "postgres.s3" $args | b64enc }}
|
||||
{{- else if $repo.gcs }}
|
||||
{{- $args := dict "gcs" $repo.gcs "index" $index }}
|
||||
gcs.conf: |-
|
||||
{{ include "postgres.gcs" $args | b64enc }}
|
||||
gcs-key.json: |-
|
||||
{{ $repo.gcs.key | b64enc }}
|
||||
{{- else if $repo.azure }}
|
||||
{{- $args := dict "azure" $repo.azure "index" $index }}
|
||||
azure.conf: |-
|
||||
{{ include "postgres.azure" $args | b64enc }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- else if .Values.s3 }}
|
||||
{{- $args := dict "s3" .Values.s3 "index" 0 }}
|
||||
s3.conf: |-
|
||||
{{ include "postgres.s3" $args | b64enc }}
|
||||
{{- else if .Values.gcs }}
|
||||
{{- $args := dict "gcs" .Values.gcs "index" 0 }}
|
||||
gcs.conf: |-
|
||||
{{ include "postgres.gcs" $args | b64enc }}
|
||||
gcs-key.json: |-
|
||||
{{ .Values.gcs.key | b64enc }}
|
||||
{{- else if .Values.azure }}
|
||||
{{- $args := dict "azure" .Values.azure "index" 0 }}
|
||||
azure.conf: |-
|
||||
{{ include "postgres.azure" $args | b64enc }}
|
||||
{{- end }}
|
||||
{{- end }}
|
@@ -0,0 +1,214 @@
|
||||
apiVersion: postgres-operator.crunchydata.com/v1beta1
|
||||
kind: PostgresCluster
|
||||
metadata:
|
||||
name: {{ default .Release.Name .Values.name }}
|
||||
spec:
|
||||
postgresVersion: {{ required "You must set the version of Postgres to deploy." .Values.postgresVersion }}
|
||||
{{- if .Values.postGISVersion }}
|
||||
postGISVersion: {{ quote .Values.postGISVersion }}
|
||||
{{- end }}
|
||||
{{- if .Values.imagePostgres }}
|
||||
image: {{ .Values.imagePostgres | quote }}
|
||||
{{- end }}
|
||||
{{- if .Values.port }}
|
||||
port: {{ .Values.port }}
|
||||
{{- end }}
|
||||
{{- if .Values.instances }}
|
||||
instances:
|
||||
{{ toYaml .Values.instances | indent 4 }}
|
||||
{{- else }}
|
||||
instances:
|
||||
- name: {{ default "instance1" .Values.instanceName | quote }}
|
||||
replicas: {{ default 1 .Values.instanceReplicas }}
|
||||
dataVolumeClaimSpec:
|
||||
{{- if .Values.instanceStorageClassName }}
|
||||
storageClassName: {{ .Values.instanceStorageClassName | quote }}
|
||||
{{- end }}
|
||||
accessModes:
|
||||
- "ReadWriteOnce"
|
||||
resources:
|
||||
requests:
|
||||
storage: {{ default "1Gi" .Values.instanceSize | quote }}
|
||||
{{- if or .Values.instanceMemory .Values.instanceCPU }}
|
||||
resources:
|
||||
limits:
|
||||
cpu: {{ default "" .Values.instanceCPU | quote }}
|
||||
memory: {{ default "" .Values.instanceMemory | quote }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
backups:
|
||||
pgbackrest:
|
||||
{{- if .Values.imagePgBackRest }}
|
||||
image: {{ .Values.imagePgBackRest | quote }}
|
||||
{{- end }}
|
||||
{{- if .Values.pgBackRestConfig }}
|
||||
{{ toYaml .Values.pgBackRestConfig | indent 6 }}
|
||||
{{- else if .Values.multiBackupRepos }}
|
||||
configuration:
|
||||
- secret:
|
||||
name: {{ default .Release.Name .Values.name }}-pgbackrest-secret
|
||||
global:
|
||||
{{- range $index, $repo := .Values.multiBackupRepos }}
|
||||
{{- if or $repo.s3 $repo.gcs $repo.azure }}
|
||||
repo{{ add $index 1 }}-path: /pgbackrest/{{ $.Release.Namespace }}/{{ default $.Release.Name $.Values.name }}/repo{{ add $index 1 }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
repos:
|
||||
{{- range $index, $repo := .Values.multiBackupRepos }}
|
||||
- name: repo{{ add $index 1 }}
|
||||
{{- if $repo.volume }}
|
||||
volume:
|
||||
volumeClaimSpec:
|
||||
{{- if $repo.volume.backupsStorageClassName }}
|
||||
storageClassName: {{ .Values.backupsStorageClassName | quote }}
|
||||
{{- end }}
|
||||
accessModes:
|
||||
- "ReadWriteOnce"
|
||||
resources:
|
||||
requests:
|
||||
storage: {{ default "1Gi" $repo.volume.backupsSize | quote }}
|
||||
{{- else if $repo.s3 }}
|
||||
s3:
|
||||
bucket: {{ $repo.s3.bucket | quote }}
|
||||
endpoint: {{ $repo.s3.endpoint | quote }}
|
||||
region: {{ $repo.s3.region | quote }}
|
||||
{{- else if $repo.gcs }}
|
||||
gcs:
|
||||
bucket: {{ $repo.gcs.bucket | quote }}
|
||||
{{- else if $repo.azure }}
|
||||
azure:
|
||||
container: {{ $repo.azure.container | quote }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- else if .Values.s3 }}
|
||||
configuration:
|
||||
- secret:
|
||||
name: {{ default .Release.Name .Values.name }}-pgbackrest-secret
|
||||
global:
|
||||
repo1-path: /pgbackrest/{{ .Release.Namespace }}/{{ default .Release.Name .Values.name }}/repo1
|
||||
{{- if .Values.s3.encryptionPassphrase }}
|
||||
repo1-cipher-type: aes-256-cbc
|
||||
{{- end }}
|
||||
repos:
|
||||
- name: repo1
|
||||
s3:
|
||||
bucket: {{ .Values.s3.bucket | quote }}
|
||||
endpoint: {{ .Values.s3.endpoint | quote }}
|
||||
region: {{ .Values.s3.region | quote }}
|
||||
{{- else if .Values.gcs }}
|
||||
configuration:
|
||||
- secret:
|
||||
name: {{ default .Release.Name .Values.name }}-pgbackrest-secret
|
||||
global:
|
||||
repo1-path: /pgbackrest/{{ .Release.Namespace }}/{{ default .Release.Name .Values.name }}/repo1
|
||||
repos:
|
||||
- name: repo1
|
||||
gcs:
|
||||
bucket: {{ .Values.gcs.bucket | quote }}
|
||||
{{- else if .Values.azure }}
|
||||
configuration:
|
||||
- secret:
|
||||
name: {{ default .Release.Name .Values.name }}-pgbackrest-secret
|
||||
global:
|
||||
repo1-path: /pgbackrest/{{ .Release.Namespace }}/{{ default .Release.Name .Values.name }}/repo1
|
||||
repos:
|
||||
- name: repo1
|
||||
azure:
|
||||
container: {{ .Values.azure.container | quote }}
|
||||
{{- else }}
|
||||
repos:
|
||||
- name: repo1
|
||||
volume:
|
||||
volumeClaimSpec:
|
||||
{{- if .Values.backupsStorageClassName }}
|
||||
storageClassName: {{ .Values.backupsStorageClassName | quote }}
|
||||
{{- end }}
|
||||
accessModes:
|
||||
- "ReadWriteOnce"
|
||||
resources:
|
||||
requests:
|
||||
storage: {{ default "1Gi" .Values.backupsSize | quote }}
|
||||
{{- end }}
|
||||
{{- if or .Values.pgBouncerReplicas .Values.pgBouncerConfig }}
|
||||
proxy:
|
||||
pgBouncer:
|
||||
{{- if .Values.imagePgBouncer }}
|
||||
image: {{ .Values.imagePgBouncer | quote }}
|
||||
{{- end }}
|
||||
{{- if .Values.pgBouncerConfig }}
|
||||
{{ toYaml .Values.pgBouncerConfig | indent 6 }}
|
||||
{{- else }}
|
||||
replicas: {{ .Values.pgBouncerReplicas }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- if .Values.patroni }}
|
||||
patroni:
|
||||
{{ toYaml .Values.patroni | indent 4 }}
|
||||
{{- end }}
|
||||
{{- if .Values.users }}
|
||||
users:
|
||||
{{ toYaml .Values.users | indent 4 }}
|
||||
{{- end }}
|
||||
{{- if .Values.service }}
|
||||
service:
|
||||
{{ toYaml .Values.service | indent 4 }}
|
||||
{{- end }}
|
||||
{{- if .Values.dataSource }}
|
||||
dataSource:
|
||||
{{ toYaml .Values.dataSource | indent 4 }}
|
||||
{{- end }}
|
||||
{{- if .Values.databaseInitSQL }}
|
||||
databaseInitSQL:
|
||||
name: {{ required "A ConfigMap name is required for running bootstrap SQL." .Values.databaseInitSQL.name | quote }}
|
||||
key: {{ required "A key in a ConfigMap containing any bootstrap SQL is required." .Values.databaseInitSQL.key | quote }}
|
||||
{{- end }}
|
||||
{{- if .Values.imagePullPolicy }}
|
||||
imagePullPolicy: {{ .Values.imagePullPolicy | quote }}
|
||||
{{- end }}
|
||||
{{- if .Values.imagePullSecrets }}
|
||||
imagePullSecrets:
|
||||
{{ toYaml .Values.imagePullSecrets | indent 4 }}
|
||||
{{- end }}
|
||||
{{- if .Values.disableDefaultPodScheduling }}
|
||||
disableDefaultPodScheduling: true
|
||||
{{- end }}
|
||||
{{- if .Values.metadata }}
|
||||
metadata:
|
||||
{{ toYaml .Values.metadata | indent 4 }}
|
||||
{{- end }}
|
||||
{{- if .Values.monitoring }}
|
||||
monitoring:
|
||||
pgmonitor:
|
||||
exporter:
|
||||
image: {{ default "" .Values.imageExporter | quote }}
|
||||
{{- if .Values.monitoringConfig }}
|
||||
{{ toYaml .Values.monitoringConfig | indent 8 }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- if .Values.shutdown }}
|
||||
shutdown: true
|
||||
{{- end }}
|
||||
{{- if .Values.standby }}
|
||||
standby:
|
||||
enabled: {{ .Values.standby.enabled }}
|
||||
repoName: {{ .Values.standby.repoName }}
|
||||
host: {{ .Values.standby.host }}
|
||||
port: {{ .Values.standby.port }}
|
||||
{{- end }}
|
||||
{{- if .Values.supplementalGroups }}
|
||||
supplementalGroups:
|
||||
{{ toYaml .Values.supplementalGroups | indent 4 }}
|
||||
{{- end }}
|
||||
{{- if .Values.openshift }}
|
||||
openshift: true
|
||||
{{- else if eq .Values.openshift false }}
|
||||
openshift: false
|
||||
{{- end }}
|
||||
{{- if .Values.customTLSSecret }}
|
||||
customTLSSecret:
|
||||
{{ toYaml .Values.customTLSSecret | indent 4 }}
|
||||
{{- end }}
|
||||
{{- if .Values.customReplicationTLSSecret }}
|
||||
customReplicationTLSSecret:
|
||||
{{ toYaml .Values.customReplicationTLSSecret | indent 4 }}
|
||||
{{- end }}
|
Reference in New Issue
Block a user