@@ -22,8 +22,8 @@ violation[{"msg": msg}] {
2222
2323 pdb.spec.minAvailable
2424
25- # TODO add support for replicationcontroller group "v1" and restrict to just the four kinds
26- objs := [controllers | controllers := data.inventory.namespace[pdb.metadata.namespace][" apps/v1 " ][_ ]]
25+ pod_controller_group_kind := pod_controller_groups_kinds[_]
26+ objs := [controllers | controllers := data.inventory.namespace[pdb.metadata.namespace][pod_controller_group_kind.group][pod_controller_group_kind.kind ]]
2727 obj := objs[_][_]
2828
2929 not mismatched_selector (pdb, obj)
@@ -39,7 +39,7 @@ violation[{"msg": msg}] {
3939
4040# Reject pod controller if connected PDBs maxUnavailable does not allow at least 1 pod disruption
4141violation[{" msg" : msg}] {
42- input.review.object.kind == podControllerKinds [_]
42+ input.review.object.kind == pod_controller_groups_kinds [_].kind
4343 obj := input.review.object
4444 not replica_set_under_deployment (obj)
4545
@@ -58,7 +58,7 @@ violation[{"msg": msg}] {
5858
5959# Reject pod controller if connected PDBs minAvailable does not allow at least 1 pod disruption
6060violation[{" msg" : msg}] {
61- input.review.object.kind == podControllerKinds [_]
61+ input.review.object.kind == pod_controller_groups_kinds [_].kind
6262 obj := input.review.object
6363 not replica_set_under_deployment (obj)
6464
@@ -76,11 +76,11 @@ violation[{"msg": msg}] {
7676}
7777
7878# The type of pod controller to validate
79- podControllerKinds := [
80- " Deployment" ,
81- " StatefulSet" ,
82- " ReplicaSet" ,
83- " ReplicationController"
79+ pod_controller_groups_kinds := [
80+ { " group " : " apps/v1 " , " kind " : " Deployment" } ,
81+ { " group " : " apps/v1 " , " kind " : " StatefulSet" } ,
82+ { " group " : " apps/v1 " , " kind " : " ReplicaSet" } ,
83+ { " group " : " v1 " , " kind " : " ReplicationController" }
8484]
8585
8686# Do not reject replicasets that are controlled by deployment, instead reject the deploymentd
0 commit comments