-
Notifications
You must be signed in to change notification settings - Fork 50
/
Copy pathpods_test.rego
57 lines (44 loc) · 1022 Bytes
/
pods_test.rego
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
package lib.pods
import future.keywords.if
test_input_as_other if {
resource := pod with input as {
"kind": "Other",
"spec": {"containers": [{}]},
}
not resource
}
test_input_as_pod if {
resource := pod with input as {
"kind": "Pod",
"spec": {"containers": [{}]},
}
resource.spec.containers
}
test_input_as_deployment if {
resource := pod with input as {
"kind": "Deployment",
"spec": {"template": {"spec": {"containers": [{}]}}},
}
resource.spec.containers
}
test_input_as_cronjob if {
resource := pod with input as {
"kind": "CronJob",
"spec": {"jobTemplate": {"spec": {"template": {"spec": {"containers": [{}]}}}}},
}
resource.spec.containers
}
test_containers if {
podcontainers := containers with input as {
"kind": "Pod",
"spec": {"containers": [{"name": "container"}]},
}
podcontainers[_].name == "container"
}
test_volumes if {
podvolumes := volumes with input as {
"kind": "Pod",
"spec": {"volumes": [{"name": "volume"}]},
}
podvolumes[_].name == "volume"
}