Skip to content

Commit 3e6b4de

Browse files
committed
added basic policy (not applying for some reason)
1 parent ac74c24 commit 3e6b4de

File tree

3 files changed

+28
-1
lines changed

3 files changed

+28
-1
lines changed

examples/multi-tenacy/open-policy-agent/deployment.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ spec:
2727
ports:
2828
- name: https
2929
containerPort: 443
30-
image: openpolicyagent/opa:0.32.0
30+
image: openpolicyagent/opa:0.32.1
3131
imagePullPolicy: IfNotPresent
3232
resources:
3333
{}

examples/multi-tenacy/open-policy-agent/kustomization.yaml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,3 +9,13 @@ resources:
99
- service.yaml
1010
- webhookconfiguration.yaml
1111
- deployment.yaml
12+
13+
configMapGenerator:
14+
- name: opa-default-system-main
15+
files:
16+
- policies/main.rego
17+
18+
generatorOptions:
19+
disableNameSuffixHash: true
20+
labels:
21+
openpolicyagent.org/policy: rego
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
package system
2+
import data.kubernetes.admission
3+
main = {
4+
"apiVersion": "admission.k8s.io/v1beta1",
5+
"kind": "AdmissionReview",
6+
"response": response,
7+
}
8+
default response = {"allowed": true}
9+
response = {
10+
"allowed": false,
11+
"status": {
12+
"reason": reason,
13+
},
14+
} {
15+
reason = concat(", ", admission.deny)
16+
reason != ""
17+
}

0 commit comments

Comments
 (0)