30
30
_ = initializer .WantsExternalKubeInformerFactory (& performantSecurityPolicy {})
31
31
_ = admission .MutationInterface (& performantSecurityPolicy {})
32
32
_ = initializer .WantsFeatures (& performantSecurityPolicy {})
33
+
34
+ fsGroupPolicyPodAuditLabel = fmt .Sprintf ("%s-pod" , fsGroupChangePolicyLabel )
35
+ selinuxPolicyPodAuditLabel = fmt .Sprintf ("%s-pod" , selinuxChangePolicyLabel )
33
36
)
34
37
35
38
func Register (plugins * admission.Plugins ) {
@@ -98,7 +101,7 @@ func (c *performantSecurityPolicy) Admit(ctx context.Context, attributes admissi
98
101
currentFSGroupChangePolicy = getDefaultFSGroupChangePolicy (ctx , ns )
99
102
if currentFSGroupChangePolicy != nil {
100
103
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 )
102
105
if pod .Spec .SecurityContext != nil {
103
106
pod .Spec .SecurityContext .FSGroupChangePolicy = currentFSGroupChangePolicy
104
107
} else {
@@ -114,7 +117,7 @@ func (c *performantSecurityPolicy) Admit(ctx context.Context, attributes admissi
114
117
currentSELinuxChangePolicy = getDefaultSELinuxChangePolicy (ctx , ns )
115
118
if currentSELinuxChangePolicy != nil {
116
119
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 )
118
121
if pod .Spec .SecurityContext != nil {
119
122
pod .Spec .SecurityContext .SELinuxChangePolicy = currentSELinuxChangePolicy
120
123
} else {
0 commit comments