Skip to content

Conversation

guicholeo
Copy link

Problem description

The postgres pods would restart every 30 minutes due to Postgres-Operator applying a rolling update because the container image name was defaulting to the index 0 and the actual name of the container in index 0 was a different one.

In our case, we have Istio injecting the sidecar manually, and when injects the sidecar, it injects it to the top of the container images. When the operator is checking if there has been a change, it detects the image name istio-proxy different than postgres which causes to roll an update every 30 minutes.

Linked issues

Checklist

Thanks for submitting a pull request to the Postgres Operator project.
Please, ensure your contribution matches the following items:

  • Your go code is formatted. Your IDE should do it automatically for you.
  • You have updated generated code when introducing new fields to the acid.zalan.do api package.
  • New configuration options are reflected in CRD validation, helm charts and sample manifests.
  • New functionality is covered by unit and/or e2e tests.
  • You have checked existing open PRs for possible overlay and referenced them.

@guicholeo guicholeo changed the title Added logic to look for container by name instead of defaulting to th… Add logic to look for container by name instead of defaulting to to index 0 Feb 22, 2021
@FxKu
Copy link
Member

FxKu commented Feb 25, 2021

@guicholeo this is a good first step in the right direction. I've checked if we have this hard-coded assumptions in other places and we do:

grep -irn  "\[0\]" pkg/
pkg/cluster/k8sres.go:1456
pkg/cluster/cluster.go:459
pkg/cluster/connection_pooler_test.go
pkg/cluster/k8sres_test.go
pkg/cluster/sync.go

So this would likely be a problem for your setup, too, I think. You're eager to update more Go code? 😃

@FxKu FxKu added this to the 1.7 milestone Feb 25, 2021
@FxKu FxKu modified the milestones: 1.7, 1.8 Mar 26, 2021
@FxKu
Copy link
Member

FxKu commented May 28, 2021

picked it up with #1504 and #1505. Closing this PR then. Thanks again for raising.

@FxKu FxKu closed this May 28, 2021
@FxKu FxKu removed this from the 1.7 milestone May 30, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants