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

Allow securityContext.Privileged to be configurable #15643

Merged
merged 3 commits into from
Dec 30, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions config/core/300-resources/configuration.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,9 @@ spec:
automountServiceAccountToken:
description: AutomountServiceAccountToken indicates whether a service account token should be automatically mounted.
type: boolean
Privileged:
description: Indicates whether to run container in privileged mode.
type: boolean
containerConcurrency:
description: |-
ContainerConcurrency specifies the maximum allowed in-flight (concurrent)
Expand Down
3 changes: 3 additions & 0 deletions config/core/300-resources/revision.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,9 @@ spec:
automountServiceAccountToken:
description: AutomountServiceAccountToken indicates whether a service account token should be automatically mounted.
type: boolean
Privileged:
description: Indicates whether to run container in privileged mode.
type: boolean
containerConcurrency:
description: |-
ContainerConcurrency specifies the maximum allowed in-flight (concurrent)
Expand Down
3 changes: 3 additions & 0 deletions config/core/300-resources/service.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,9 @@ spec:
automountServiceAccountToken:
description: AutomountServiceAccountToken indicates whether a service account token should be automatically mounted.
type: boolean
Privileged:
description: Indicates whether to run container in privileged mode.
type: boolean
containerConcurrency:
description: |-
ContainerConcurrency specifies the maximum allowed in-flight (concurrent)
Expand Down
1 change: 1 addition & 0 deletions hack/schemapatch-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ k8s.io/api/core/v1.PodSpec:
- ImagePullSecrets
- EnableServiceLinks
- AutomountServiceAccountToken
- Privileged
KapilSareen marked this conversation as resolved.
Show resolved Hide resolved
# Properties behind feature flags
- Affinity
- DNSConfig
Expand Down
6 changes: 4 additions & 2 deletions pkg/apis/serving/fieldmask.go
Original file line number Diff line number Diff line change
Expand Up @@ -710,10 +710,12 @@ func SecurityContextMask(ctx context.Context, in *corev1.SecurityContext) *corev
// SeccompProfile defaults to "unconstrained", but the safe values are
// "RuntimeDefault" or "Localhost" (with localhost path set)
out.SeccompProfile = in.SeccompProfile

// Allow setting Privileged to only false
KapilSareen marked this conversation as resolved.
Show resolved Hide resolved
if in.Privileged != nil && !*in.Privileged {
KapilSareen marked this conversation as resolved.
Show resolved Hide resolved
out.Privileged = in.Privileged
}
// Disallowed
// This list is unnecessary, but added here for clarity
out.Privileged = nil
out.SELinuxOptions = nil
out.ProcMount = nil

Expand Down