File tree 1 file changed +13
-0
lines changed
1 file changed +13
-0
lines changed Original file line number Diff line number Diff line change 9
9
"fmt"
10
10
"io"
11
11
"os"
12
+ "reflect"
12
13
"sort"
13
14
"strconv"
14
15
"strings"
@@ -2271,6 +2272,12 @@ func (dm *KubeArmorDaemon) ParseAndUpdateHostSecurityPolicy(event tp.K8sKubeArmo
2271
2272
new := true
2272
2273
for idx , policy := range dm .HostSecurityPolicies {
2273
2274
if policy .Metadata ["policyName" ] == secPolicy .Metadata ["policyName" ] {
2275
+ if reflect .DeepEqual (policy , secPolicy ) {
2276
+ kg .Debugf ("No updates to policy %s" , policy .Metadata ["policyName" ])
2277
+ dm .HostSecurityPoliciesLock .Unlock ()
2278
+ return pb .PolicyStatus_Applied
2279
+ }
2280
+
2274
2281
dm .HostSecurityPolicies [idx ] = secPolicy
2275
2282
event .Type = "MODIFIED"
2276
2283
new = false
@@ -2283,6 +2290,12 @@ func (dm *KubeArmorDaemon) ParseAndUpdateHostSecurityPolicy(event tp.K8sKubeArmo
2283
2290
} else if event .Type == "MODIFIED" {
2284
2291
for idx , policy := range dm .HostSecurityPolicies {
2285
2292
if policy .Metadata ["policyName" ] == secPolicy .Metadata ["policyName" ] {
2293
+ if reflect .DeepEqual (policy , secPolicy ) {
2294
+ kg .Debugf ("No updates to policy %s" , policy .Metadata ["policyName" ])
2295
+ dm .HostSecurityPoliciesLock .Unlock ()
2296
+ return pb .PolicyStatus_Applied
2297
+ }
2298
+
2286
2299
dm .HostSecurityPolicies [idx ] = secPolicy
2287
2300
break
2288
2301
}
You can’t perform that action at this time.
0 commit comments