fix(controller,backup): select Postgres container by name instead of assuming index#8964
Merged
mnencia merged 2 commits intocloudnative-pg:mainfrom Oct 28, 2025
Merged
fix(controller,backup): select Postgres container by name instead of assuming index#8964mnencia merged 2 commits intocloudnative-pg:mainfrom
mnencia merged 2 commits intocloudnative-pg:mainfrom
Conversation
Contributor
|
❗ By default, the pull request is configured to backport to all release branches.
|
vishnuitta
reviewed
Oct 27, 2025
Member
|
/test limit=local |
Contributor
|
@armru, here's the link to the E2E on CNPG workflow run: https://github.com/cloudnative-pg/cloudnative-pg/actions/runs/18837898508 |
Member
|
Proposed commit message: Ensure backups identify the Postgres container by its name rather than assuming the Postgres container is the first container in the Pod spec/status. Pods may include sidecars or other containers which can shift ordering; relying on index 0 is brittle and caused incorrect containerID/image checks. |
Contributor
Author
|
Thanks, @armru, for the help. |
Member
|
/test limit=local |
Contributor
|
@armru, here's the link to the E2E on CNPG workflow run: https://github.com/cloudnative-pg/cloudnative-pg/actions/runs/18868291076 |
armru
approved these changes
Oct 28, 2025
jbattiato
approved these changes
Oct 28, 2025
The purpose of this PR is to fix backups when there is more than one container in the Pod, which is the case when using Istio, for example.
Error message:
{‘level’:‘debug’,“ts”:" 2025-10-26T07:49:29.003680028Z‘,’msg‘:’Instance not having expected image, discarded as target for backup‘,’controller‘:’backup‘,’controllerGroup‘:’postgresql.cnpg.io‘,’controllerKind‘:“Backup”,’ Backup‘:{’name‘:’postgresql-20251026084856‘,’namespace‘:’databases‘},’namespace‘:’databases‘,“name”:’postgresql-20251026084856‘,’ reconcileID‘:’f4dd8a41-2755-4086-89f8-e1daa10bb2bc‘,“caller”:’internal/controller/backup_controller.go:692"}
Signed-off-by: Joda89 <johan.lore@free.fr>
Signed-off-by: Armando Ruocco <armando.ruocco@enterprisedb.com>
mnencia
approved these changes
Oct 28, 2025
cnpg-bot
pushed a commit
that referenced
this pull request
Oct 28, 2025
…assuming index (#8964) Ensure backups identify the Postgres container by its name rather than assuming the Postgres container is the first container in the Pod spec/status. Pods may include sidecars or other containers, which can shift ordering; relying on index zero is brittle and causes incorrect containerID/image checks. Closes #8966 Signed-off-by: Joda89 <johan.lore@free.fr> Signed-off-by: Armando Ruocco <armando.ruocco@enterprisedb.com> Co-authored-by: Armando Ruocco <armando.ruocco@enterprisedb.com> (cherry picked from commit 603b10d)
cnpg-bot
pushed a commit
that referenced
this pull request
Oct 28, 2025
…assuming index (#8964) Ensure backups identify the Postgres container by its name rather than assuming the Postgres container is the first container in the Pod spec/status. Pods may include sidecars or other containers, which can shift ordering; relying on index zero is brittle and causes incorrect containerID/image checks. Closes #8966 Signed-off-by: Joda89 <johan.lore@free.fr> Signed-off-by: Armando Ruocco <armando.ruocco@enterprisedb.com> Co-authored-by: Armando Ruocco <armando.ruocco@enterprisedb.com> (cherry picked from commit 603b10d)
mnencia
pushed a commit
that referenced
this pull request
Oct 29, 2025
…assuming index (#8964) Ensure backups identify the Postgres container by its name rather than assuming the Postgres container is the first container in the Pod spec/status. Pods may include sidecars or other containers, which can shift ordering; relying on index zero is brittle and causes incorrect containerID/image checks. Closes #8966 Signed-off-by: Joda89 <johan.lore@free.fr> Signed-off-by: Armando Ruocco <armando.ruocco@enterprisedb.com> Co-authored-by: Armando Ruocco <armando.ruocco@enterprisedb.com> (cherry picked from commit 603b10d)
4 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Ensure backups identify the Postgres container by its name rather than assuming the Postgres container is the first container in the Pod spec/status. Pods may include sidecars or other containers which can shift ordering; relying on index 0 is brittle and caused incorrect containerID/image checks.
Closes #8966