Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

runAsNonRoot in Pod SCC should be nil when oc debug run with --as-root #880

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
7 changes: 7 additions & 0 deletions pkg/cli/debug/debug.go
Expand Up @@ -799,6 +799,13 @@ func (o *DebugOptions) transformPodForDebug(annotations map[string]string) (*cor
container.SecurityContext.RunAsNonRoot = nil
}

// if DebugOptions set container.SecurityContext.RunAsNonRoot to nil,
// pod.Spec.SecurityContext.runAsNonRoot should be nil also.
if container.SecurityContext.RunAsNonRoot == nil &&
pod.Spec.SecurityContext != nil {
pod.Spec.SecurityContext.RunAsNonRoot = nil
}

switch {
case o.OneContainer:
pod.Spec.InitContainers = nil
Expand Down