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

Enforce privileged PSA by default #4832

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
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
Original file line number Diff line number Diff line change
Expand Up @@ -67,5 +67,24 @@ func reconcileConfig(cfg *openshiftcpv1.OpenShiftControllerManagerConfig, minTLS
CipherSuites: cipherSuites,
},
}

// disables automatically setting the `pod-security.kubernetes.io/enforce` label on namespaces by the pod-security-admission-label-synchronization-controller
// see https://github.com/openshift/cluster-policy-controller/blob/50c2a8337f08856bbae4cd419bb8ffcbdf92567c/pkg/cmd/controller/psalabelsyncer.go#L19
index := -1
for i := range cfg.FeatureGates {
fg := cfg.FeatureGates[i]
if strings.HasPrefix(fg, "OpenShiftPodSecurityAdmission") {
index = i
break
}
}

if index != -1 {
// overwrite
cfg.FeatureGates[index] = "OpenShiftPodSecurityAdmission=false"
} else {
cfg.FeatureGates = append(cfg.FeatureGates, "OpenShiftPodSecurityAdmission=false")
}

return nil
}
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ func generateConfig(p KubeAPIServerConfigParams) *kcpv1.KubeAPIServerConfig {
Kind: "PodSecurityConfiguration",
},
Defaults: podsecurityadmissionv1beta1.PodSecurityDefaults{
Enforce: "restricted",
Enforce: "privileged",
EnforceVersion: "latest",
Audit: "restricted",
AuditVersion: "latest",
Expand Down