fix(pvc): use `ptr.Equal` for `VolumeAttributesClass` equality check … · cloudnative-pg/cloudnative-pg@abb18c6 · GitHub
Skip to content

Commit abb18c6

Browse files
andrew-farriesarmrumnencia
committed
fix(pvc): use ptr.Equal for VolumeAttributesClass equality check (#11196)
The guard in `reconcileVolumeAttributeClass` compared two *string pointers with `==`. Any cluster with a `volumeAttributesClass` set in its `pvcTemplate` failed the check on every reconciliation, issuing a redundant empty `PATCH` against the API server even when the PVC already carried the expected value. Use `ptr.Equal` to compare the values instead and strengthen the existing test: it previously assigned the same pointer to both the PVC and the template, masking the bug. It now uses distinct allocations and asserts that no Patch call is issued for an already-correct PVC. Fixes #11194 Signed-off-by: Andrew Farries <andrew.farries@xata.io> Signed-off-by: Armando Ruocco <armando.ruocco@enterprisedb.com> Signed-off-by: Marco Nenciarini <marco.nenciarini@enterprisedb.com> Co-authored-by: Armando Ruocco <armando.ruocco@enterprisedb.com> Co-authored-by: Marco Nenciarini <marco.nenciarini@enterprisedb.com> (cherry picked from commit 1462ab1)
1 parent 43c4bd3 commit abb18c6

2 files changed

Lines changed: 18 additions & 3 deletions

File tree

‎pkg/reconciler/persistentvolumeclaim/existing.go‎

Lines changed: 2 additions & 1 deletion

‎pkg/reconciler/persistentvolumeclaim/reconciler_test.go‎

Lines changed: 16 additions & 2 deletions

0 commit comments

Comments
 (0)