Commit 1997403
authored
fix(pvc): prevent PV rebinding on upgrade and fix missing annotations block (#102)
* fix(pvc): prevent PV rebinding on upgrade and fix missing annotations block
Add `helm.sh/resource-policy: keep` unconditionally so the PVC survives
helm uninstall, fix the annotations block which was previously absent when
no custom annotations were set, and use `lookup` to pin `volumeName` on
upgrades to prevent the PVC from being re-bound to a different PV.
Also add some test coverage.
Fixes #74
* Address CodeRabbit review comments.
- Renamed `$volumeName` → `$pvcName` (line 2) — accurately reflects it holds the PVC name
- Extracted `lookup` into `$existingPvc` (line 3) at the top level — called once, outside the `storageClass` guard
- Moved `volumeName` block (lines 32-34) outside the `storageClass` guard — now always evaluated regardless of whether `storageClass`` is set1 parent 0171885 commit 1997403
2 files changed
Lines changed: 33 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
| 2 | + | |
| 3 | + | |
2 | 4 | | |
3 | 5 | | |
4 | 6 | | |
| |||
7 | 9 | | |
8 | 10 | | |
9 | 11 | | |
10 | | - | |
11 | 12 | | |
| 13 | + | |
| 14 | + | |
12 | 15 | | |
13 | | - | |
| 16 | + | |
14 | 17 | | |
15 | 18 | | |
16 | 19 | | |
| |||
26 | 29 | | |
27 | 30 | | |
28 | 31 | | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
29 | 35 | | |
30 | 36 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
181 | 181 | | |
182 | 182 | | |
183 | 183 | | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
184 | 209 | | |
185 | 210 | | |
186 | 211 | | |
| |||
0 commit comments