Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion charts/cluster/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -258,7 +258,7 @@ refer to the [CloudNativePG Documentation](https://cloudnative-pg.io/documentat
| recovery.pgBaseBackup.source.sslRootCertSecret.key | string | `""` | |
| recovery.pgBaseBackup.source.sslRootCertSecret.name | string | `""` | |
| recovery.pgBaseBackup.source.username | string | `""` | |
| recovery.pitrTarget.time | string | `""` | Time in RFC3339 format |
| recovery.recoveryTarget | object | `{}` | Recovery target, e.g. targetTime. See: https://cloudnative-pg.io/documentation/current/cloudnative-pg.v1/#postgresql-cnpg-io-v1-RecoveryTarget |
| recovery.provider | string | `"s3"` | One of `s3`, `azure` or `google` |
| recovery.s3.accessKey | string | `""` | |
| recovery.s3.bucket | string | `""` | |
Expand Down
2 changes: 1 addition & 1 deletion charts/cluster/docs/Recovery.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ To begin, create a `values.yaml` that contains the following:
1. Set `mode: recovery` to indicate that you want to perform bootstrap the new cluster from an existing one.
2. Set the `recovery.method` to the type of recovery you want to perform.
3. Set either the `recovery.backupName` or the Barman Object Store configuration - i.e. `recovery.provider` and appropriate S3, Azure or GCS configuration. In case of `pg_basebackup` complete the `recovery.pgBaseBackup` section.
4. Optionally set the `recovery.pitrTarget.time` in RFC3339 format to perform a point-in-time recovery (not applicable for `pgBaseBackup`).
4. Optionally set the `recovery.recoveryTarget.targetTime` in RFC3339 format to perform a point-in-time recovery (not applicable for `pgBaseBackup`).
5. Retain the identical PostgreSQL version and configuration as the original cluster.
6. Make sure you don't use the same backup section name as the original cluster. We advise you change the `path` within the storage location if you want to reuse the same storage location/bucket.
One pattern is adding a version number at the end of the path, e.g. `/v1` or `/v2` after each recovery procedure.
Expand Down
5 changes: 5 additions & 0 deletions charts/cluster/templates/NOTES.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,11 @@
{{ fail ".Values.cluster.postgresql has been deprecated. Use .Values.cluster.postgresql.parameters instead." }}
{{- end -}}

{{/* Parentheses are needed to avoid nil pointer errors */}}
{{- if (((.Values.recovery).pitrTarget).time) -}}
{{/* We don't fail here, otherwise that would be a breaking change */}}
DEPRECATION NOTICE: .Values.recovery.pitrTarget.time has been deprecated. Use .Values.recovery.recoveryTarget.targetTime instead.
{{- end -}}

{{ if .Release.IsInstall }}
The {{ include "cluster.color-info" (include "cluster.fullname" .) }} has been installed successfully.
Expand Down
12 changes: 10 additions & 2 deletions charts/cluster/templates/_bootstrap.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -82,10 +82,18 @@ externalClusters:

{{- else }}
recovery:
{{- with .Values.recovery.pitrTarget.time }}
{{- with .Values.recovery.recoveryTarget }}
recoveryTarget:
targetTime: {{ . }}
{{- toYaml . | nindent 6 }}
{{- end }}

{{/* DEPRECATED, replaced by .Values.recovery.recoveryTarget above */}}
{{/* Will fail if both pitrTarget.time and recoveryTarget are specified */}}
{{- with .Values.recovery.pitrTarget.time }}
recoveryTarget:
targetTime: {{ . }}
{{- end }}

{{- if eq .Values.recovery.method "backup" }}
backup:
name: {{ .Values.recovery.backupName }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ spec:
--install \
--namespace $NAMESPACE \
--values ./09-recovery_backup_pitr_cluster.yaml \
--set recovery.pitrTarget.time="$DATE_NO_BAD_TABLE" \
--set recovery.recoveryTarget.targetTime="$DATE_NO_BAD_TABLE" \
--wait \
recovery-backup-pitr ../../
- assert:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ spec:
--install \
--namespace $NAMESPACE \
--values ./07-recovery_backup_pitr_cluster.yaml \
--set recovery.pitrTarget.time="$DATE_NO_BAD_TABLE" \
--set recovery.recoveryTarget.targetTime="$DATE_NO_BAD_TABLE" \
--wait \
recovery-backup-pitr ../../
- assert:
Expand Down
3 changes: 3 additions & 0 deletions charts/cluster/values.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -623,6 +623,9 @@
}
}
},
"recoveryTarget": {
"type": "object"
},
"pitrTarget": {
"type": "object",
"properties": {
Expand Down
7 changes: 7 additions & 0 deletions charts/cluster/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,14 @@ recovery:
# * `import` - Import one or more databases from an existing Postgres cluster.
method: backup

##
# -- Recovery target:
# It is passed directly to the CR. For example, for point in time recovery,
# specify `targetTime`.
recoveryTarget: {}

## -- Point in time recovery target. Specify one of the following:
# DEPRECATED: Use `recoveryTarget` instead.
pitrTarget:
# -- Time in RFC3339 format
time: ""
Expand Down