Skip to content

Commit faa6983

Browse files
gnufiedjacobsee
authored andcommitted
UPSTREAM: <carry>: Add plugin for storage performant security policy
1 parent 58e0f33 commit faa6983

File tree

1 file changed

+5
-2
lines changed
  • openshift-kube-apiserver/admission/storage/performantsecuritypolicy

1 file changed

+5
-2
lines changed

openshift-kube-apiserver/admission/storage/performantsecuritypolicy/admission.go

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,9 @@ var (
3030
_ = initializer.WantsExternalKubeInformerFactory(&performantSecurityPolicy{})
3131
_ = admission.MutationInterface(&performantSecurityPolicy{})
3232
_ = initializer.WantsFeatures(&performantSecurityPolicy{})
33+
34+
fsGroupPolicyPodAuditLabel = fmt.Sprintf("%s-pod", fsGroupChangePolicyLabel)
35+
selinuxPolicyPodAuditLabel = fmt.Sprintf("%s-pod", selinuxChangePolicyLabel)
3336
)
3437

3538
func Register(plugins *admission.Plugins) {
@@ -98,7 +101,7 @@ func (c *performantSecurityPolicy) Admit(ctx context.Context, attributes admissi
98101
currentFSGroupChangePolicy = getDefaultFSGroupChangePolicy(ctx, ns)
99102
if currentFSGroupChangePolicy != nil {
100103
klog.V(4).Infof("Setting default FSGroupChangePolicy %s for pod %s", *currentFSGroupChangePolicy, podNameKey)
101-
audit.AddAuditAnnotations(ctx, "fsGroupChangePolicy", string(*currentFSGroupChangePolicy), "pod", podNameKey)
104+
audit.AddAuditAnnotations(ctx, fsGroupChangePolicyLabel, string(*currentFSGroupChangePolicy), fsGroupPolicyPodAuditLabel, podNameKey)
102105
if pod.Spec.SecurityContext != nil {
103106
pod.Spec.SecurityContext.FSGroupChangePolicy = currentFSGroupChangePolicy
104107
} else {
@@ -114,7 +117,7 @@ func (c *performantSecurityPolicy) Admit(ctx context.Context, attributes admissi
114117
currentSELinuxChangePolicy = getDefaultSELinuxChangePolicy(ctx, ns)
115118
if currentSELinuxChangePolicy != nil {
116119
klog.V(4).Infof("Setting default SELinuxChangePolicy %s for pod %s", *currentSELinuxChangePolicy, podNameKey)
117-
audit.AddAuditAnnotations(ctx, "selinuxChangePolicy", string(*currentSELinuxChangePolicy), "pod", podNameKey)
120+
audit.AddAuditAnnotations(ctx, selinuxChangePolicyLabel, string(*currentSELinuxChangePolicy), selinuxPolicyPodAuditLabel, podNameKey)
118121
if pod.Spec.SecurityContext != nil {
119122
pod.Spec.SecurityContext.SELinuxChangePolicy = currentSELinuxChangePolicy
120123
} else {

0 commit comments

Comments
 (0)