Repository navigation
Conversation
jedi-tal
requested review from
WentingWu666666,
alaye-ms,
hossain-rayhan and
xgerman
as code owners
December 1, 2026 13:51
jedi-tal
force-pushed
the
fix/openshift-gateway-uid
branch
from
December 1, 2026 14:03
3b9b2d9 to
ce5c04d
Compare
xgerman
approved these changes
Dec 1, 2026
Collaborator
|
Thank you for the contribution. |
On OpenShift, CloudNativePG leaves the instance pod's securityContext unset so that the platform assigns a UID from the namespace's range, but the sidecar injector pinned the gateway to UID/GID 1000, so restricted-v2 rejected every instance pod. The gateway image also could not run as any other UID. - sidecar-injector: gatewaySecurityContext(pod) pins 1000 only when the pod pins its own user (every cluster without SCCs) and leaves the UID to the platform otherwise. - gateway image: /home/documentdb is owned by group 0 and group-writable, so an arbitrary UID (always in group 0 on OpenShift) can read the entrypoint and write its working config. - gateway entrypoint: names the gateway's PostgreSQL role (PG_USER, default documentdb) instead of inheriting the OS user's name, which an arbitrary UID does not have. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01EMu2w11RXcEs2P7xNWD15f Signed-off-by: jedi-tal <289941616+jedi-tal@users.noreply.github.com>
jedi-tal
force-pushed
the
fix/openshift-gateway-uid
branch
from
December 1, 2026 19:29
ce5c04d to
8999307
Compare
|
🤖 Auto-triaged by documentdb-triage-tool. Applied: Reasoningcomponent from path globs (test); effort from diff stats (47+7 LOC, 4 files) If a label is wrong, ping |
This branch has not been deployed
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.
Fixes #531.
On OpenShift, CloudNativePG leaves the instance pod's securityContext unset, so that the platform assigns a UID from the namespace's range. The sidecar injector, however, pins the gateway to UID/GID 1000, so
restricted-v2rejects every instance pod. Separately, the gateway image can't run as any other UID.Changes
gatewaySecurityContext(pod)keeps the 1000 pin when the pod pins its own user, which is every cluster without SCCs, since CNPG always sets the pod'srunAsUserthere. It pins nothing when the pod leaves the UID to the platform.restricted.Dockerfile_gateway_public_image:/home/documentdbis owned by group 0 and group-writable. An arbitrary UID, always in group 0 on OpenShift, can then read the entrypoint and write its working config.gateway_entrypoint.sh: names the gateway's PostgreSQL role (PG_USER, defaultdocumentdb) instead of inheriting the OS user's name, which an arbitrary UID doesn't have.Testing
gofmt,go vet ./...andgo test ./....restricted-v2, using chart 1.2.2 with this injector change, andgateway:1.0.1with the Dockerfile and entrypoint changes layered on:restricted-v2;runAsUser: Invalid value: 1000: must be in the ranges: [...].gateway_entrypoint.sh: Permission denied.FATAL: role "1000890000" does not exist.Diff
lifecycle.go(+16/-4),lifecycle_test.go(+24/-2),.github/dockerfiles/Dockerfile_gateway_public_image(+2/-1) and.github/dockerfiles/gateway_entrypoint.sh(+5).🤖 Generated with Claude Code
https://claude.ai/code/session_01EMu2w11RXcEs2P7xNWD15f