Rename PodSecurityPolicy fields
In podSecurityPolicy: 1. Rename .seLinuxContext to .seLinux 2. Rename .seLinux.type to .seLinux.rule 3. Rename .runAsUser.type to .runAsUser.rule 4. Rename .seLinux.SELinuxOptions 1,2,3 as suggested by thockin in #22159. I added 3 for consistency with 2.
This commit is contained in:
@@ -47,16 +47,16 @@ func HasCapabilitiesRequest(container *api.Container) bool {
|
||||
return len(container.SecurityContext.Capabilities.Add) > 0 || len(container.SecurityContext.Capabilities.Drop) > 0
|
||||
}
|
||||
|
||||
const expectedSELinuxContextFields = 4
|
||||
const expectedSELinuxFields = 4
|
||||
|
||||
// ParseSELinuxOptions parses a string containing a full SELinux context
|
||||
// (user, role, type, and level) into an SELinuxOptions object. If the
|
||||
// context is malformed, an error is returned.
|
||||
func ParseSELinuxOptions(context string) (*api.SELinuxOptions, error) {
|
||||
fields := strings.SplitN(context, ":", expectedSELinuxContextFields)
|
||||
fields := strings.SplitN(context, ":", expectedSELinuxFields)
|
||||
|
||||
if len(fields) != expectedSELinuxContextFields {
|
||||
return nil, fmt.Errorf("expected %v fields in selinuxcontext; got %v (context: %v)", expectedSELinuxContextFields, len(fields), context)
|
||||
if len(fields) != expectedSELinuxFields {
|
||||
return nil, fmt.Errorf("expected %v fields in selinux; got %v (context: %v)", expectedSELinuxFields, len(fields), context)
|
||||
}
|
||||
|
||||
return &api.SELinuxOptions{
|
||||
|
Reference in New Issue
Block a user