forked from plexsystems/konstraint
-
Notifications
You must be signed in to change notification settings - Fork 0
/
pods_test.rego
67 lines (49 loc) · 1.05 KB
/
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
58
59
60
61
62
63
64
65
66
67
package lib.pods
test_input_as_other {
input := {
"kind": "Other",
"spec": {"containers": [{}]},
}
resource := pod with input as input
not resource
}
test_input_as_pod {
input := {
"kind": "Pod",
"spec": {"containers": [{}]},
}
resource := pod with input as input
resource.spec.containers
}
test_input_as_deployment {
input := {
"kind": "Deployment",
"spec": {"template": {"spec": {"containers": [{}]}}},
}
resource := pod with input as input
resource.spec.containers
}
test_input_as_cronjob {
input := {
"kind": "CronJob",
"spec": {"jobTemplate": {"spec": {"template": {"spec": {"containers": [{}]}}}}},
}
resource := pod with input as input
resource.spec.containers
}
test_containers {
input := {
"kind": "Pod",
"spec": {"containers": [{"name": "container"}]},
}
podcontainers := containers with input as input
podcontainers[_].name == "container"
}
test_volumes {
input := {
"kind": "Pod",
"spec": {"volumes": [{"name": "volume"}]},
}
podvolumes := volumes with input as input
podvolumes[_].name == "volume"
}