fix: restrict WAL directory init container - #142
Merged
Merged
Conversation
dkarter
marked this pull request as ready for review
September 29, 2026 17:37
levkk
reviewed
Sep 29, 2026
|
|
||
| # The WAL init container needs its own privilege settings; these cannot be set | ||
| # through podSecurityContext or the main container's securityContext. | ||
| echo "" |
Contributor
There was a problem hiding this comment.
We should put an instruction into AGENTS.md to stop doing this. We already validate the yaml with kubeconform.
levkk
approved these changes
Sep 29, 2026
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.
Motivation
With
statefulSet.walPvc.enabled, the chart adds acreate-wal-directoryinit container. Kubernetes rejects this pod under the Restricted Pod Security policy because that container does not disable privilege escalation or drop its capabilities. The main PgDog container’s security context does not apply to the init container.When we try to enable 2pc durable storage we're getting:
That's due to our stricter
PodSecuritysecurity policy.Summary of Changes
allowPrivilegeEscalation: falseand drop all capabilities on the WAL init container.Testing
./test/test.shpasses. To check the fix manually, render the chart withtest/values-statefulset.yamland inspectspec.template.spec.initContainers[name=create-wal-directory].securityContext. Deploy to a namespace enforcing Restricted Pod Security with a non-root pod security context and confirm the StatefulSet can create its pods.Dependencies/Special Considerations
This changes only the WAL init container; callers still need to set their pod-level non-root user and seccomp settings to meet the rest of the Restricted policy.