-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Share the PostgreSQL socket with the sidecars containers #962
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
6db0ddc to
5b98809
Compare
|
Looking forward to this. Found that the hard way I cannot use unix socket with sidecar postgres_exporter now :( |
5b98809 to
8dd07c2
Compare
|
@lebenitza I did a rebase to the current master to have the merge cleanly. |
8dd07c2 to
a903bde
Compare
|
@FxKu @CyberDem0n are you still interested in this change? |
|
tbh: I have not really a clue what this is about. Seems like documentation for this parameter is missing. Maybe you can add it + rebasing and we can merge. |
a903bde to
7fc649c
Compare
@FxKu I rebased the change and added the missing piece of documentation on this config flag. |
7fc649c to
1009173
Compare
|
|
Excuse my late reply @FxKu
I certainly could rename it. I named it
That's a valid point. I naively assumed at sidecars of a postgresql database pod would likely be talking psql to it.
I believe yes. But this comes down to the But mind you trust does not mean "only superuser" within the database (https://www.postgresql.org/docs/14/auth-trust.html). But still, maybe switching this to password/md5 (https://www.postgresql.org/docs/14/auth-password.html) for local might make sense. Looking at all three questions and thinking my idea through again I believe there is a MUCH simpler approach:
No options, no exclude list, no exposure of the socket to all sidecars. Just a tiny bit of documentation to the sidecar section (https://github.com/zalando/postgres-operator/blob/master/docs/user.md#sidecar-support) explaining how to configure the VolumeMount. Let me know if I totally wrong or if you like the idea. If so, I gladly push an update to the PR just changing the PodSpec in regards to the postgresql container and be done with it. |
1009173 to
cd88ead
Compare
39a11d1 to
96f840c
Compare
|
@frittentheke (what a funny handle ;-) wrote:
I have verified today that this approach indeed does work: I was able access the DB from the sidecar via the socket in I propose to document this under https://postgres-operator.readthedocs.io/en/refactoring-sidecars/user/#sidecar-support . OK @FxKu ? |
96f840c to
dc403f8
Compare
…ptyDir with the sidecar containers
dc403f8 to
f4e2f09
Compare
@tpo just added the missing documentation on accessing the socket from sidecars. |
|
@frittentheke this looks nice to me now. Thanks a lot for pushing and sorry again for the huge delay. I would like to merge. Can we have one unit test in k8sres_test.go where we check that the volume mounts are created when the option is enabled and that it's not when disabled? Ideally with a mocked cluster, but if you lack time than something like |
|
👍 |
|
@FxKu if you are happy, could you kindly tell me if this can be merged as is or if you want any changes? |
|
👍 |
|
@frittentheke in August I wished for a unit test that I did not get from you 😃 So I decided to merge it now and provide the test myself. |
Uhh sorry, I did not even scroll up to your previous comments when I noticed some movement in the PR. |
While PR #736 already enabled any additional volumes, including emptyDirs, this is intended to be per-cluster, so it needs to be specified in the postgresql spec of every cluster.
This PR creates an emptyDir for
/var/runto be shared between the postgresql container and the (potential) sidecars. This allows tools like the postgres-exporter (https://github.com/wrouesnel/postgres_exporter) to be used without any configuration or handling of credentials.Certainly another option would be to port the additionalVolumes functionality to also accept some global configuration via the operator config. But it seems that there are not that many cases for volume configurations that can be the same for every cluster, so I figured a switch to just enable the socket sharing could be an helpful addition.