Skip to content

Commit

Permalink
Updated query Service Does Not Target Pod #2793
Browse files Browse the repository at this point in the history
Signed-off-by: João Reigota <[email protected]>
  • Loading branch information
cx-joao-reigota committed Apr 19, 2021
1 parent 1193d92 commit f317e45
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions assets/queries/k8s/service_does_not_target_pod/query.rego
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,12 @@ confirmPorts(servicePorts) {
types := {"initContainers", "containers"}
containers := pod.spec[types[x]][j]
containers.ports[k].containerPort == servicePorts.targetPort
} else {
stateful_set := input.document[i]
stateful_set.kind == "StatefulSet"
types := {"initContainers", "containers"}
containers := stateful_set.spec.template.spec[types[x]][j]
containers.ports[k].containerPort == servicePorts.targetPort
} else = false {
true
}
Expand All @@ -47,6 +53,10 @@ contains(string) {
pod := input.document[i]
pod.kind == "Pod"
pod.metadata.labels[_] == string
} else {
stateful_set := input.document[i]
stateful_set.kind == "StatefulSet"
stateful_set.metadata.labels[_] == string
} else = false {
true
}

0 comments on commit f317e45

Please sign in to comment.