Skip to content

Add securityContext to image volume pod YAML example#112338

Open
asadawar wants to merge 1 commit into
openshift:mainfrom
asadawar:fix/image-volume-securitycontext
Open

Add securityContext to image volume pod YAML example#112338
asadawar wants to merge 1 commit into
openshift:mainfrom
asadawar:fix/image-volume-securitycontext

Conversation

@asadawar
Copy link
Copy Markdown

Summary

  • Add required securityContext fields to both containers in the image volume pod YAML example
  • Without these fields, creating the pod as documented fails with a PodSecurity violation under the default restricted profile
  • Added fields: allowPrivilegeEscalation: false, capabilities.drop: ["ALL"], runAsNonRoot: true, seccompProfile.type: RuntimeDefault

Error without fix

Error from server (Forbidden): pods "image-volume" is forbidden: violates PodSecurity
"restricted:latest": allowPrivilegeEscalation != false, unrestricted capabilities,
runAsNonRoot != true, seccompProfile

Test plan

  • Verified the pod YAML example creates successfully under the default restricted PodSecurity profile with the added securityContext

Bug: https://issues.redhat.com/browse/OCPBUGS-86563

The pod YAML example in the "Adding an image volume to a pod"
procedure is missing securityContext settings. Creating the pod
as documented fails with a PodSecurity violation under the default
restricted profile.

Add the required securityContext fields (allowPrivilegeEscalation,
capabilities, runAsNonRoot, seccompProfile) to both containers.

Bug: https://issues.redhat.com/browse/OCPBUGS-86563

Assisted-by: Claude Code
@openshift-ci openshift-ci Bot added size/S Denotes a PR that changes 10-29 lines, ignoring generated files. needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels May 27, 2026
@openshift-ci
Copy link
Copy Markdown

openshift-ci Bot commented May 27, 2026

Hi @asadawar. Thanks for your PR.

I'm waiting for a openshift member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work.

Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

Details

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. size/S Denotes a PR that changes 10-29 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant