mirror of
https://github.com/truecharts/charts.git
synced 2026-07-08 14:44:27 -03:00
feat(common): BREAKING CHANGE allow gitops cnpg recovery without editing values (#33786)
**Description** Currently CNPG requires backup and recovery revision to be different As CNPG errors out when you try to backup towards a target that was used by an old instance of the cluster/app. This patch adds an annotation that disables this check on the CNPG level. Which means CNPG-backed applications can be recovered and backed-up in a gitops compatible way, just like volsync. Just configure backup and restore to the same settings and let it rip. If users want extra security, as this feature disables a security precaution, users should think about enabling s3 snapshots as well. **⚙️ Type of change** - [x] ⚙️ Feature/App addition - [ ] 🪛 Bugfix - [x] ⚠️ Breaking change (fix or feature that would cause existing functionality to not work as expected) - [x] 🔃 Refactor of current code - [ ] 📜 Documentation Changes **🧪 How Has This Been Tested?** <!-- Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce. Please also list any relevant details for your test configuration --> **📃 Notes:** It also moves around the pgVersion fallbackDefault, which is technically a breaking change **✔️ Checklist:** - [ ] ⚖️ My code follows the style guidelines of this project - [ ] 👀 I have performed a self-review of my own code - [ ] #️⃣ I have commented my code, particularly in hard-to-understand areas - [ ] 📄 I have made changes to the documentation - [ ] 🧪 I have added tests to this description that prove my fix is effective or that my feature works - [ ] ⬆️ I increased versions for any altered app according to semantic versioning - [ ] I made sure the title starts with `feat(chart-name):`, `fix(chart-name):`, `chore(chart-name):`, `docs(chart-name):` or `fix(docs):` **➕ App addition** If this PR is an app addition please make sure you have done the following. - [ ] 🖼️ I have added an icon in the Chart's root directory called `icon.png` --- _Please don't blindly check all the boxes. Read them and only check those that apply. Those checkboxes are there for the reviewer to see what is this all about and the status of this PR with a quick glance._ --------- Signed-off-by: Kjeld Schouten <info@kjeldschouten.nl>
This commit is contained in:
@@ -147,7 +147,8 @@ tests:
|
||||
tag: "15.6"
|
||||
global:
|
||||
fallbackDefaults:
|
||||
pgVersion: 15
|
||||
cnpg:
|
||||
pgVersion: 15
|
||||
vctAccessModes:
|
||||
- ReadWriteMany
|
||||
- ReadWriteOnce
|
||||
|
||||
@@ -24,6 +24,7 @@
|
||||
{{- $logLevel := "info" -}}
|
||||
{{- $accessModes := $rootCtx.Values.global.fallbackDefaults.vctAccessModes -}}
|
||||
{{- $walAccessModes := $rootCtx.Values.global.fallbackDefaults.vctAccessModes -}}
|
||||
{{- $skipEmptyWalArchiveCheck := $rootCtx.Values.global.fallbackDefaults.cnpg.skipEmptyWalArchiveCheck -}}
|
||||
|
||||
{{/* Make sure keys exist before try to access any sub keys */}}
|
||||
{{- if not (hasKey $objectData "cluster") -}}
|
||||
@@ -140,6 +141,10 @@
|
||||
{{- $walAccessModes = . -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- with $objectData.cluster.skipEmptyWalArchiveCheck -}}
|
||||
{{- $skipEmptyWalArchiveCheck = . -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- $imageName := $objectData.cluster.imageName -}}
|
||||
{{- if not $imageName -}}
|
||||
{{/* Ensure version and container tracking */}}
|
||||
@@ -171,6 +176,7 @@ metadata:
|
||||
annotations:
|
||||
cnpg.io/hibernation: {{ $hibernation | quote }}
|
||||
checksum/secrets: {{ toJson $rootCtx.Values.secret | sha256sum }}
|
||||
cnpg.io/skipEmptyWalArchiveCheck: $skipEmptyWalArchiveCheck
|
||||
{{- $annotations := (mustMerge $clusterAnnotations (include "tc.v1.common.lib.metadata.allAnnotations" $rootCtx | fromYaml)) -}}
|
||||
{{- with (include "tc.v1.common.lib.metadata.render" (dict "rootCtx" $rootCtx "annotations" $annotations) | trim) }}
|
||||
{{- . | nindent 4 }}
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
{{- if eq $enabled "true" -}}
|
||||
|
||||
{{/* Handle version string */}}
|
||||
{{- $pgVersion := ($objectData.pgVersion | default $.Values.global.fallbackDefaults.pgVersion) | toString -}}
|
||||
{{- $pgVersion := ($objectData.pgVersion | default $.Values.global.fallbackDefaults.cnpg.pgVersion) | toString -}}
|
||||
|
||||
{{/* Set the updated pgVersion version to objectData */}}
|
||||
{{- $_ := set $objectData "pgVersion" $pgVersion -}}
|
||||
|
||||
@@ -56,10 +56,13 @@ global:
|
||||
# -- Define a postgresql version for CNPG
|
||||
# will be used for all CNPG objects
|
||||
# Can be overruled per CNPG objects
|
||||
pgVersion: 16
|
||||
|
||||
# -- Define a topologyKey for default topologySpreadConstraints
|
||||
# Will be used when defaultSpread: true
|
||||
topologyKey: kubernetes.io/hostname
|
||||
cnpg:
|
||||
pgVersion: 16
|
||||
skipEmptyWalArchiveCheck: true
|
||||
metallb:
|
||||
# -- Adds metalLB annotations to services
|
||||
addServiceAnnotations: true
|
||||
@@ -1051,6 +1054,9 @@ cnpg:
|
||||
|
||||
# set to true on single-node clusters to allow PVCs to be kept on instance restart
|
||||
singleNode: false
|
||||
|
||||
## set to configure the skipEmptyWalArchiveCheck annotation
|
||||
# skipEmptyWalArchiveCheck: true
|
||||
# # -- storage size for the data pvc's
|
||||
# # Follows the same spec as .Values.Persistence type=PVC
|
||||
# storage:
|
||||
|
||||
Reference in New Issue
Block a user