mirror of
https://github.com/rancher/types.git
synced 2025-06-25 21:21:32 +00:00
fix capability mapping
This commit is contained in:
parent
6c35a3b3e5
commit
1da9edd2cc
@ -18,31 +18,19 @@ func (n ContainerSecurityContext) ToInternal(data map[string]interface{}) {
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
if len(sc) > 2 {
|
||||
return
|
||||
}
|
||||
found := false
|
||||
if v, ok := values.GetValue(sc, "capAdd"); ok && v != nil {
|
||||
capAdd := convert.ToStringSlice(v)
|
||||
if len(capAdd) == 0 {
|
||||
found = true
|
||||
values.RemoveValue(data, "securityContext", "capAdd")
|
||||
}
|
||||
}
|
||||
if found {
|
||||
found = false
|
||||
} else {
|
||||
return
|
||||
}
|
||||
|
||||
if v, ok := values.GetValue(sc, "capDrop"); ok && v != nil {
|
||||
capAdd := convert.ToStringSlice(v)
|
||||
if len(capAdd) == 0 {
|
||||
found = true
|
||||
values.RemoveValue(data, "securityContext", "capDrop")
|
||||
}
|
||||
}
|
||||
if found {
|
||||
values.RemoveValue(data, "securityContext")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user