Wrong `ObjectStore` key logged when the backup object store can't be retrieved in the instance sidecar
Les mainteneurs répondent en général sous 1 jour
Évaluation
- Difficulté
- 2/5
- Temps estimé
- 1-3 heures
- Accessibilité débutants
- 88/100
Piste de recherche
Examinez internal/cnpgi/instance/backup.go dans Backup et internal/cnpgi/instance/metrics.go dans Collect. Comparez la clé passée à GetBarmanObjectKey() avec la clé enregistrée dans chaque journal d’erreur, puis vérifiez que les deux chemins signalent la clé ObjectStore du backup demandé lorsque la recherche échoue.
Rédigé par le modèle d'indexation à partir du texte de l'issue.
Description
Description
In the instance sidecar, two code paths fetch the cluster's backup ObjectStore with GetBarmanObjectKey(), but their error log reports GetRecoveryBarmanObjectKey():
internal/cnpgi/instance/backup.go (Backup):
var objectStore barmancloudv1.ObjectStore
if err := b.Client.Get(ctx, configuration.GetBarmanObjectKey(), &objectStore); err != nil {
contextLogger.Error(err, "while getting object store", "key", configuration.GetRecoveryBarmanObjectKey())
return nil, err
}
internal/cnpgi/instance/metrics.go (Collect) has the same lines.
So when the lookup fails, the key field names a different object from the one that was requested:
- on a cluster without a recovery source (the usual case),
RecoveryBarmanObjectNameis empty, sokeyhas an empty name; - on a cluster bootstrapped from an
ObjectStorethroughexternalClusters,keynames the recoveryObjectStore, which exists, pointing the reader at the wrong object.
Impact
Low, but confusing. The error message itself (for example objectstores.barmancloud.cnpg.io "s3-store" not found, or ... is forbidden) still has the right name, so the information is in the log line. But the structured key field contradicts it, and anything that filters or alerts on key gets the wrong value. Collect runs on every metrics scrape, so a missing or forbidden ObjectStore repeats the misleading line on every scrape.
This is the same kind of problem as #539/#504, which were about the operator pre-hook in reconciler.go. These two lines are on the instance side and weren't covered there.
History
The backup.go line dates from e4735a2 (#83, "separate recovery object store from replica source"). The metrics.go one was added in 33172b6 (#459) with the same lines. Open PR #1076 touches the surrounding code in backup.go but leaves this line as it is.
Proposed fix
Log configuration.GetBarmanObjectKey() in both places, the key that is actually passed to Get. I'm happy to send the PR.
How this was found
While working on #1140 on my fork, I ran an AI code review (Claude Code) over my change. It flagged the mismatched key in backup.go, even though my change didn't touch that line. I then searched the code base for the same pattern, which found the copy in metrics.go, and confirmed both on main by reading the code. I haven't triggered the failing lookup on a live cluster, so the error messages quoted above are examples, not captured output.
I used an AI assistant (Claude) to help find this and draft this issue, as the AI policy asks for disclosure.
- Langage dominant
- Go
- Étoiles
- 207
- Forks
- 88
- Merge moyen
- 2 j 16 h
- PR mergées (30 j)
- 45
Préparer son environnement
- Aucun Dockerfile ni fichier Docker Compose
- Aucun modèle de pull request
- Lire le guide de contribution
Par où commencer
- Lisez l'issue en entier, puis le guide de contribution du projet.
- Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
- Forkez le dépôt et travaillez sur une branche.
- Ouvrez une pull request qui référence le numéro de l'issue.
Autres issues de cloudnative-pg/plugin-barman-cloud
-
docs: troubleshooting does not cover "cannot proceed with the backup as the cluster has no backup section"Peut-être pris @fjvbn2003 l’a pris il y a 22 jours. Ouverte
Difficulté 1/5 1-3 heures Accessibilité débutants 85/100
cloudnative-pg/plugin-barman-cloud#1165 ·
Les mainteneurs répondent en général sous 1 jour
-
Difficulté 2/5 1-3 heures Accessibilité débutants 88/100
cloudnative-pg/plugin-barman-cloud#1117 · 1 réaction ·
Les mainteneurs répondent en général sous 1 jour
-
Add RBAC aggregation labels to ObjectStore editor/viewer ClusterRolesPeut-être pris @stefanpeknik l’a pris il y a 52 jours. Ouverte
Difficulté 1/5 Moins d'une heure Accessibilité débutants 82/100
cloudnative-pg/plugin-barman-cloud#1102 ·
Les mainteneurs répondent en général sous 1 jour
-
Difficulté 3/5 1-2 jours Accessibilité débutants 68/100
cloudnative-pg/plugin-barman-cloud#1215 · 1 réaction ·
Les mainteneurs répondent en général sous 1 jour
-
[OperatorHub] Wire ci-machinery for OLM releasesPeut-être pris @GabriFedi97 l’a pris il y a 3 jours. Ouverte
Difficulté 4/5 3-5 jours Accessibilité débutants 47/100
cloudnative-pg/plugin-barman-cloud#1196 ·
Les mainteneurs répondent en général sous 1 jour
Toutes les issues de cloudnative-pg/plugin-barman-cloud
Issues similaires
-
area: metrics area: tracing contribfest enhancement good first issue
Difficulté 2/5 1-3 heures Accessibilité débutants 83/100
open-telemetry/opentelemetry-ebpf-instrumentation#4188 ·
Les mainteneurs répondent en général sous 1 jour
-
Difficulté 2/5 1-3 heures Accessibilité débutants 74/100
blinklabs-io/dingo#6074 ·
Les mainteneurs répondent en général sous 1 jour
-
kind/bug remote
Difficulté 2/5 1-3 heures Accessibilité débutants 68/100
podman-container-tools/podman#30143 ·
Les mainteneurs répondent en général sous 1 jour
-
component/mesheryctl kind/bug language/go
Difficulté 1/5 Moins d'une heure Accessibilité débutants 88/100
meshery/meshery#22993 · 2 commentaires ·
Les mainteneurs répondent en général sous 1 jour
-
enhancement
Difficulté 2/5 1-3 heures Accessibilité débutants 64/100