fix(shard): set numeric runAsUser defaults for pool containers#467
Open
luizfelmach wants to merge 1 commit into
Open
fix(shard): set numeric runAsUser defaults for pool containers#467luizfelmach wants to merge 1 commit into
luizfelmach wants to merge 1 commit into
Conversation
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.
Summary
runAsNonRoot=trueand images use non-numeric users (postgres/nobody), which prevented kubelet non-root verification.runAsNonRoot=trueand now sets numeric defaultrunAsUser/runAsGroupfor pool containers (postgres,postgres-exporter,multipooler) whenfsGroupis not set.fsGroupis provided inPoolSpec, it still takes precedence forrunAsUser/runAsGroup.Problem
Applying
config/samples/minimal.yamlcould fail to start pool pods with:container has runAsNonRoot and image has non-numeric user ... cannot verify user is non-rootAfter the initial fix, a shared-volume permission issue appeared:
failed to write pgbackrest-server.conf: permission deniedRoot Cause
runAsNonRoot=truewithout numeric UID/GID whenfsGroupwasnil.runAsNonRoot=true, kubelet requires a numeric user to verify non-root./var/lib/poolercaused write permission conflicts.Changes
buildContainerSecurityContextto accept a fallback UID and always set numericrunAsUser/runAsGroupwhenfsGroupis unset.postgres:999postgres-exporter:65534multipooler:999(aligned withpostgresto avoid shared-volume permission issues)Validation
go test ./pkg/resource-handler/controller/shardgo test ./...make check(lint passes; any remaining failure was local toolchain/env related)Impact
minimal.yamlworks out of the box without requiringfsGroupedits.runAsNonRoot=trueremains default).Backward Compatibility
fsGroupcontinue to work and still override fallback IDs.Issue
Closes #466