Improve mutating annotation detection logic
This commit is contained in:
parent
136426f326
commit
ff449375da
@ -154,13 +154,14 @@ func IsPSPMutating(pspObj *v1beta1.PodSecurityPolicy) (mutating bool, fields, an
|
|||||||
fields = append(fields, "AllowPrivilegeEscalation")
|
fields = append(fields, "AllowPrivilegeEscalation")
|
||||||
}
|
}
|
||||||
|
|
||||||
mutatingAnnotations := make(map[string]bool)
|
mutatingAnnotations := []string{
|
||||||
mutatingAnnotations["seccomp.security.alpha.kubernetes.io/defaultProfileName"] = true
|
"seccomp.security.alpha.kubernetes.io/defaultProfileName",
|
||||||
mutatingAnnotations["apparmor.security.beta.kubernetes.io/defaultProfileName"] = true
|
"apparmor.security.beta.kubernetes.io/defaultProfileName",
|
||||||
|
}
|
||||||
|
|
||||||
for k, _ := range pspObj.Annotations {
|
for _, a := range mutatingAnnotations {
|
||||||
if _, ok := mutatingAnnotations[k]; ok {
|
if _, ok := pspObj.Annotations[a]; ok {
|
||||||
annotations = append(annotations, k)
|
annotations = append(annotations, a)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user