Make container securityContext optional for OpenShift compatibility #445
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:
This pull request adds a new configuration option to make the container-level securityContext optional in the CloudNativePG Helm chart. This change improves compatibility with OpenShift by allowing users to disable the container
securityContext
when deploying the operator.Background:
When deploying the CloudNativePG operator on OpenShift, the predefined container
securityContext
can cause conflicts due to OpenShift's strict security policies. OpenShift manages user and group IDs dynamically and does not allow containers to run as a specific user or group unless explicitly permitted. HardcodedrunAsUser
andrunAsGroup
values (values.yaml) in the container securityContext may prevent pods from starting on OpenShift clusters.Changes Introduced:
enableSecurityContext
undercontainerSecurityContext
invalues.yaml
, defaulting totrue
to maintain existing behavior.deployment.yaml
to include the containersecurityContext
only whenenableSecurityContext
is set totrue
.README.md
to document the new configuration option and guide users on how to use it.Benefits:
Usage Example:
To disable the container
securityContext
on OpenShift, setenableSecurityContext
tofalse
in your custom values/override file:Testing: