Files
velero/changelogs
Tiger KaovilaiandGitHub ced051b72f Fix restore-wait init container ignoring pod-level securityContext (#10047)
restore-wait's securityContext fallback chain checked the fs-restore
ConfigMap, then the first container's SecurityContext, then hardcoded
runAsUser 1000. It never consulted pod.Spec.SecurityContext, so pods
that set identity only at the pod level got a helper running as uid
1000 regardless of the workload's actual uid. On volumes where restored
content is owner-only-visible to a non-1000 uid, the helper's stat on
the done-file returns EACCES forever and the pod deadlocks at Init:0/1.

Add pod-level spec.securityContext.runAsUser/runAsGroup as a fallback
between the container-level check and the hardcoded default, since the
workload's own identity is the one that can read what it restored.
Defer to the pod's own RunAsNonRoot setting when runAsUser is 0, since
the hardcoded RunAsNonRoot: true would otherwise contradict a root uid.

Also add a test case covering both container-level and pod-level
SecurityContext set together, confirming container-level still wins.

Fixes #10046

Signed-off-by: Tiger Kaovilai <tkaovila@redhat.com>
2026-08-10 15:36:14 -04:00
..