1
0
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:
Daishan Peng 2018-06-25 15:55:28 -07:00 committed by Alena Prokharchyk
parent 6c35a3b3e5
commit 1da9edd2cc

View File

@ -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")
}
}
}