From 1da9edd2cc7257f7d96ea77aae061d65150da500 Mon Sep 17 00:00:00 2001 From: Daishan Peng Date: Mon, 25 Jun 2018 15:55:28 -0700 Subject: [PATCH] fix capability mapping --- mapper/container_security_context.go | 16 ++-------------- 1 file changed, 2 insertions(+), 14 deletions(-) diff --git a/mapper/container_security_context.go b/mapper/container_security_context.go index 199ab777..f24037a3 100644 --- a/mapper/container_security_context.go +++ b/mapper/container_security_context.go @@ -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") - } } }