Updating Kubernetes Runtime Runner to Avoid Duplicate Alerts.  Only Alert on Parent resource violation
@@ -81,6 +81,12 @@ class Runner(BaseRunner):
else:
continue
+ # Skip entity with parent (metadata["ownerReferences"]) in runtime
+ # We will alert in runtime only
+ if "ownerReferences" in entity_conf["metadata"] and \
+ entity_conf["metadata"]["ownerReferences"] is not None:
+ continue
+
# Append containers and initContainers to definitions list
for type in ["containers", "initContainers"]:
containers = []
@@ -127,6 +133,13 @@ class Runner(BaseRunner):
else:
continue
+ # Skip entity with parent (metadata["ownerReferences"]) in runtime
+ # We will alert in runtime only
+ if "metadata" in entity_conf:
+ if "ownerReferences" in entity_conf["metadata"] and \
+ entity_conf["metadata"]["ownerReferences"] is not None:
+ continue
+
# Skip Kustomization Templates (for now)
if entity_conf["kind"] == "Kustomization":
continue
