Skip to content

Conversation

zimbatm
Copy link
Contributor

@zimbatm zimbatm commented Nov 3, 2019

Setting the FSGroup to match the postgres GID is a requirement for postgres to load the TLS certificates mounted on a secret volume (which will be handled by #690).

So now the question is, why not always set the FSGroup to match the postgres GID?

@zimbatm zimbatm changed the title spilo_fsgroup: always set to 103 spilo_fsgroup: set to 103 by default Nov 3, 2019
@FxKu
Copy link
Member

FxKu commented Nov 4, 2019

Please, add the default for SpiloFSGroup also in the internal struct.

Not sure if I remember the discussion from #531 correctly: Does this work out-of-the-box or is it required to patch the Spilo image? @erthalion

@zimbatm
Copy link
Contributor Author

zimbatm commented Nov 4, 2019

I have a local kind setup to test these changes. I only tested that the master and slave come up properly. Let me know if you want me to do some more testing.

@zimbatm
Copy link
Contributor Author

zimbatm commented Nov 5, 2019

@FxKu the PR is ready for another review

@zimbatm zimbatm mentioned this pull request Nov 5, 2019
@zimbatm
Copy link
Contributor Author

zimbatm commented Nov 14, 2019

rebased

@erthalion
Copy link
Contributor

@zimbatm Could there be any other use cases for this except mentioned in #690 ? The change by itself is fine, but can come with compatibility issues if someone would try to use an image different from Spilo (e.g. one of it's modifications) and system gid for postgres could be different from 103.

@zimbatm
Copy link
Contributor Author

zimbatm commented Nov 19, 2019

How I see things, the operator is tightly coupled with the spilo image and if the user does something custom they would have to override the default gid as well. Most likely their custom spilo image would be a fork from the official spilo project and inherit the gid.

The motivation of this change is to make the TLS setup a tiny bit easier. I don't have other scenarios in mind that could also benefit from this change. Although I suspect that any other volume that is mounted in the spilo pod would probably want to be readable from the postgres group.

@erthalion
Copy link
Contributor

How I see things, the operator is tightly coupled with the spilo image

Sort of, but tight coupling doesn't mean it's not possible to use some modifications, and how far those modifications are coming is up to an author. I would also mention that this is a pod-level parameter, which means all sidecars will also have it. Overall since all this is only for one feature, changing the default value seems questionable for me.

But probably it makes sense to go other way around. I don't see why we can't say in #690 that if we have custom TLS section defined, then also set spilo_fsgroup to some predefined default value, which for now can be just a constant suitable for the original spilo image. What do you think?

@zimbatm
Copy link
Contributor Author

zimbatm commented Nov 20, 2019

Alright. Thanks for looking into this and replying to my questions. I was hoping that this change would simplify the TLS setup and ultimately remove one if-condition branch in the whole system. But like you said, the security context is applied to the whole pod unfortunately and I don't see another route. #690 already checks to make sure that the FSGroup is being set so I will push that to the TLS configuration documentation instead.

@zimbatm zimbatm closed this Nov 20, 2019
@zimbatm zimbatm deleted the set-spilo-fsgroup branch November 20, 2019 21:29
@erthalion
Copy link
Contributor

Thank you.

I will push that to the TLS configuration documentation instead.

But actually I've meant that we can set spilo_fsgroup in this case automatically, without requiring to modify operator configuration. At the end of the day operator generates a pod manifest, so why not set securityContext.FSGroup there?

@zimbatm
Copy link
Contributor Author

zimbatm commented Nov 21, 2019

Okay

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.

3 participants