From 622a311f53c4504405880470b1c5bc8286046b07 Mon Sep 17 00:00:00 2001 From: sadath-12 Date: Tue, 24 Sep 2024 21:25:08 +0530 Subject: [PATCH 1/4] support: backupID in helm chart Signed-off-by: sadath-12 --- charts/cluster/templates/_bootstrap.tpl | 6 +++++- charts/cluster/values.yaml | 4 +++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/charts/cluster/templates/_bootstrap.tpl b/charts/cluster/templates/_bootstrap.tpl index aea7d9429..1ad4d029c 100644 --- a/charts/cluster/templates/_bootstrap.tpl +++ b/charts/cluster/templates/_bootstrap.tpl @@ -71,10 +71,14 @@ externalClusters: {{- else }} recovery: - {{- with .Values.recovery.pitrTarget.time }} + {{- with .Values.recovery.pitrTarget.targetTime }} recoveryTarget: targetTime: {{ . }} {{- end }} + {{- with .Values.recovery.pitrTarget.backupID }} + recoveryTarget: + targetTime: {{ . }} + {{- end }} {{- if eq .Values.recovery.method "backup" }} backup: name: {{ .Values.recovery.backupName }} diff --git a/charts/cluster/values.yaml b/charts/cluster/values.yaml index 8398c74d1..232084b37 100644 --- a/charts/cluster/values.yaml +++ b/charts/cluster/values.yaml @@ -37,7 +37,9 @@ recovery: ## -- Point in time recovery target. Specify one of the following: pitrTarget: # -- Time in RFC3339 format - time: "" + targetTime: "" + # -- immediate target given a backup id + backupID: "" ## # -- Backup Recovery Method From 2c572b7c94c337ae10c4401c2f81bbd9a1eb1905 Mon Sep 17 00:00:00 2001 From: sadath-12 Date: Wed, 25 Sep 2024 00:29:58 +0530 Subject: [PATCH 2/4] fix: correct backupID field Signed-off-by: sadath-12 --- charts/cluster/templates/_bootstrap.tpl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/charts/cluster/templates/_bootstrap.tpl b/charts/cluster/templates/_bootstrap.tpl index 1ad4d029c..661f0f389 100644 --- a/charts/cluster/templates/_bootstrap.tpl +++ b/charts/cluster/templates/_bootstrap.tpl @@ -77,7 +77,7 @@ externalClusters: {{- end }} {{- with .Values.recovery.pitrTarget.backupID }} recoveryTarget: - targetTime: {{ . }} + backupID: {{ . }} {{- end }} {{- if eq .Values.recovery.method "backup" }} backup: From b5fd51e86ed78e84573f05641c5822e532ec2c4e Mon Sep 17 00:00:00 2001 From: sadath-12 Date: Wed, 25 Sep 2024 00:39:03 +0530 Subject: [PATCH 3/4] re-order and add other supported target recoveries Signed-off-by: sadath-12 --- charts/cluster/templates/_bootstrap.tpl | 25 ++++++++++++++++++++----- charts/cluster/values.yaml | 8 ++++++++ 2 files changed, 28 insertions(+), 5 deletions(-) diff --git a/charts/cluster/templates/_bootstrap.tpl b/charts/cluster/templates/_bootstrap.tpl index 661f0f389..9ab47ccda 100644 --- a/charts/cluster/templates/_bootstrap.tpl +++ b/charts/cluster/templates/_bootstrap.tpl @@ -71,14 +71,29 @@ externalClusters: {{- else }} recovery: - {{- with .Values.recovery.pitrTarget.targetTime }} + + {{- if or .Values.recovery.pitrTarget.targetTime .Values.recovery.pitrTarget.backupID .Values.recovery.pitrTarget.targetXID .Values.recovery.pitrTarget.targetName .Values.recovery.pitrTarget.targetLSN .Values.recovery.pitrTarget.targetImmediate }} recoveryTarget: + {{- with .Values.recovery.pitrTarget.targetTime }} targetTime: {{ . }} - {{- end }} - {{- with .Values.recovery.pitrTarget.backupID }} - recoveryTarget: + {{- end }} + {{- with .Values.recovery.pitrTarget.backupID }} backupID: {{ . }} - {{- end }} + {{- end }} + {{- with .Values.recovery.pitrTarget.targetXID }} + targetXID: {{ . }} + {{- end }} + {{- with .Values.recovery.pitrTarget.targetName }} + targetName: {{ . }} + {{- end }} + {{- with .Values.recovery.pitrTarget.targetLSN }} + targetLSN: {{ . }} + {{- end }} + {{- with .Values.recovery.pitrTarget.targetImmediate }} + targetImmediate: {{ . }} + {{- end }} + {{- end }} + {{- if eq .Values.recovery.method "backup" }} backup: name: {{ .Values.recovery.backupName }} diff --git a/charts/cluster/values.yaml b/charts/cluster/values.yaml index 232084b37..beab8f7fc 100644 --- a/charts/cluster/values.yaml +++ b/charts/cluster/values.yaml @@ -40,6 +40,14 @@ recovery: targetTime: "" # -- immediate target given a backup id backupID: "" + # -- Transaction ID up to which recovery proceeds. (The precise stopping point is also influenced by the exclusive option.) + targetXID: "" + # -- Named restore point (created with pg_create_restore_point()) to which recovery proceeds + targetName: "" + # -- LSN of the write-ahead log location up to which recovery proceeds. (The precise stopping point is also influenced by the exclusive option.) + targetLSN: "" + # -- Recovery ends as soon as a consistent state is reached, that is, as early as possible + targetImmediate: "" ## # -- Backup Recovery Method From a409141e8744d1e38aa958ccc7fcd2595319292b Mon Sep 17 00:00:00 2001 From: sadath-12 Date: Wed, 25 Sep 2024 11:10:40 +0530 Subject: [PATCH 4/4] add missing target params Signed-off-by: sadath-12 --- charts/cluster/templates/_bootstrap.tpl | 23 +++++++++++------- charts/cluster/values.yaml | 31 +++++++++++++++++-------- 2 files changed, 35 insertions(+), 19 deletions(-) diff --git a/charts/cluster/templates/_bootstrap.tpl b/charts/cluster/templates/_bootstrap.tpl index 9ab47ccda..d9b337dc3 100644 --- a/charts/cluster/templates/_bootstrap.tpl +++ b/charts/cluster/templates/_bootstrap.tpl @@ -72,27 +72,32 @@ externalClusters: {{- else }} recovery: - {{- if or .Values.recovery.pitrTarget.targetTime .Values.recovery.pitrTarget.backupID .Values.recovery.pitrTarget.targetXID .Values.recovery.pitrTarget.targetName .Values.recovery.pitrTarget.targetLSN .Values.recovery.pitrTarget.targetImmediate }} recoveryTarget: - {{- with .Values.recovery.pitrTarget.targetTime }} - targetTime: {{ . }} - {{- end }} {{- with .Values.recovery.pitrTarget.backupID }} backupID: {{ . }} {{- end }} - {{- with .Values.recovery.pitrTarget.targetXID }} + {{- with .Values.recovery.pitrTarget.exclusive }} + exclusive: {{ . }} + {{- end }} + {{- with .Values.recovery.pitrTarget.time }} + targetTime: {{ . }} + {{- end }} + {{- with .Values.recovery.pitrTarget.xid }} targetXID: {{ . }} {{- end }} - {{- with .Values.recovery.pitrTarget.targetName }} + {{- with .Values.recovery.pitrTarget.name }} targetName: {{ . }} {{- end }} - {{- with .Values.recovery.pitrTarget.targetLSN }} + {{- with .Values.recovery.pitrTarget.lsn }} targetLSN: {{ . }} {{- end }} - {{- with .Values.recovery.pitrTarget.targetImmediate }} + {{- with .Values.recovery.pitrTarget.immediate }} targetImmediate: {{ . }} {{- end }} - {{- end }} + {{- with .Values.recovery.pitrTarget.tli }} + targetTLI: {{ . }} + {{- end }} + {{- if eq .Values.recovery.method "backup" }} backup: diff --git a/charts/cluster/values.yaml b/charts/cluster/values.yaml index beab8f7fc..9267d1d5b 100644 --- a/charts/cluster/values.yaml +++ b/charts/cluster/values.yaml @@ -36,18 +36,29 @@ recovery: ## -- Point in time recovery target. Specify one of the following: pitrTarget: - # -- Time in RFC3339 format - targetTime: "" - # -- immediate target given a backup id + # -- The ID of the backup from which to start the recovery process. + # If empty (default) the operator will automatically detect the backup based on `pitrTarget.time` or `pitrTarget.lsn` if provided. + # Otherwise use the latest available backup in chronological order. backupID: "" - # -- Transaction ID up to which recovery proceeds. (The precise stopping point is also influenced by the exclusive option.) - targetXID: "" - # -- Named restore point (created with pg_create_restore_point()) to which recovery proceeds - targetName: "" - # -- LSN of the write-ahead log location up to which recovery proceeds. (The precise stopping point is also influenced by the exclusive option.) - targetLSN: "" + # -- Recovery ends as soon as a consistent state is reached, that is, as early as possible - targetImmediate: "" + immediate: "" + + # -- The target timeline ("latest" or a positive integer) + tli: "" + + # -- Set the target to be exclusive. If omitted, defaults to false, so that in Postgres, `recovery_target_inclusive` will be true + exclusive: "" + + # Specify EXACTLY ONE of the following options: + # -- Point in time recovery Time target in RFC3339 format + time: "" + # -- Point in time recovery Transaction ID up to which recovery proceeds. (The precise stopping point is also influenced by the exclusive option.) + xid: "" + # -- Named restore point (created with pg_create_restore_point()) to which recovery proceeds + name: "" + # -- LSN (Log Sequence Number) of the write-ahead log location up to which recovery proceeds. (The precise stopping point is also influenced by the exclusive option.) + lsn: "" ## # -- Backup Recovery Method