`isWALArchiever` is ignored when multiple Barman Cloud plugins defined
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 48/100
Research direction
Start with internal/cnpgi/operator/config/config.go, especially NewPlugin and NewFromCluster, and reproduce the duplicate-name configuration from the issue. Compare that resolution with the CNPG validation and WAL-archiver selection references. Done means the duplicate-entry behavior is explicitly handled and covered by an appropriate test or documented as intentional.
Written by the indexing model from the issue text.
Description
Summary
When defining multiple entries with the same plugin name (barman-cloud.cloudnative-pg.io) in Cluster.spec.plugins, WAL archiving appears to use the parameters of the last matching entry.
In practice, isWALArchiver can look ignored because WALs are pushed using barmanObjectName from the last plugin entry.
Environment
- CloudNativePG:
1.29.1 - plugin-barman-cloud:
0.12.0 - Kubernetes: Kind (local)
Minimal reproduction
Create two object stores:
store-a(intended WAL target)store-b(intended backup-only target)
Then use a Cluster with duplicate plugin entries:
apiVersion: postgresql.cnpg.io/v1
kind: Cluster
metadata:
name: pg
spec:
instances: 1
imageName: ghcr.io/cloudnative-pg/postgresql:16
storage:
size: 1Gi
plugins:
- name: barman-cloud.cloudnative-pg.io
isWALArchiver: true
parameters:
barmanObjectName: store-a
- name: barman-cloud.cloudnative-pg.io
parameters:
barmanObjectName: store-b
Generate write traffic and inspect object stores.
Expected behavior
WALs should go to store-a because that entry has isWALArchiver: true.
Actual behavior
WALs are pushed to store-b (the last plugin entry in spec.plugins).
Why this seems to happen
From source review:
- CNPG validates "at most one WAL archiver" but does not reject duplicate plugin names.
- CNPG selects WAL archiver by plugin name.
plugin-barman-cloudconfig extraction overwrites parameters on each matching plugin name while iterating, so the last matching entry wins.
Relevant source references
- CNPG webhook validation (
at most one WAL archiver):internal/webhook/v1/cluster_webhook.go(validatePluginConfiguration) [1]
- CNPG WAL archiver plugin name selection:
api/v1/cluster_funcs.go(GetEnabledWALArchivePluginName) [2]
- plugin-barman-cloud parameter resolution (
last match wins):internal/cnpgi/operator/config/config.go(NewPlugin,NewFromCluster) [3]
Conclusion / Questions for maintainers
Could you please confirm whether this is the intended behavior when multiple
spec.plugins entries share the same plugin name?
If this behavior is intentional:
- Is it documented somewhere (especially the effective "last matching entry wins"
parameter resolution)?
If this behavior is not intentional:
- Are there plans to fix it (for example by rejecting duplicate plugin names in
validation or by making plugin resolution deterministic and explicit)?
Thanks for your time and for maintaining these projects.
[1] https://github.com/cloudnative-pg/cloudnative-pg/blob/758532a6f4bc148f7f73a769e3abbfe3ffbc710c/internal/webhook/v1/cluster_webhook.go#L2788
[2] https://github.com/cloudnative-pg/cloudnative-pg/blob/758532a6f4bc148f7f73a769e3abbfe3ffbc710c/api/v1/cluster_funcs.go#L1547
[3] https://github.com/cloudnative-pg/plugin-barman-cloud/blob/0bb78879ce8202addf1f0d3bbfbf4485f81a1290/internal/cnpgi/operator/config/config.go#L282
- Dominant language
- Go
- Stars
- 192
- Forks
- 75
- Avg merge
- 1d 7h
- Merged PRs (30d)
- 17
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from cloudnative-pg/plugin-barman-cloud
-
Difficulty 2/5 1-3 hours Newbie friendliness 86/100
cloudnative-pg/plugin-barman-cloud#1104 · 4 reactions ·
-
Difficulty 1/5 Under an hour Newbie friendliness 82/100
-
Difficulty 3/5 1-2 days Newbie friendliness 65/100
cloudnative-pg/plugin-barman-cloud#1113 · 2 comments ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 15/100
-
Difficulty 3/5 1-2 days Newbie friendliness 68/100
All issues in cloudnative-pg/plugin-barman-cloud
Similar issues
-
Difficulty 1/5 Under an hour Newbie friendliness 90/100
-
Bob Shell support Openenhancement
Difficulty 2/5 1-3 hours Newbie friendliness 65/100
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
santhosh-tekuri/jsonschema#276 ·