-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathconfigure-app.yaml
75 lines (69 loc) · 1.59 KB
/
configure-app.yaml
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
68
69
70
71
72
73
74
75
apiVersion: dapr.io/v1alpha1
kind: Configuration
metadata:
name: opa-test
#This is in the default namespace and is whts applied to BONES... a more specific name is recommended
spec:
httpPipeline:
handlers:
- name: opa-policy
type: middleware.http.opa
metric:
enabled: true
mtls:
enabled: true
workloadCertTTL: 24h
allowedClockSkew: 15m
---
apiVersion: dapr.io/v1alpha1
kind: Component
metadata:
name: opa-policy
spec:
type: middleware.http.opa
version: v1
metadata:
# `defaultStatus` is the status code to return for denied responses
- name: defaultStatus
value: 403
# `rego` is the open policy agent policy to evaluate. required
# The policy package must be http and the policy must set data.http.allow
- name: rego
value: |
package http
#we should get denied more than not because of this
default allow = false
allow = {
"allow": false,
"additional_headers": {
"rejected-by": "opa-policy"
}
}
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: sample
labels:
app: sample
spec:
replicas: 1
selector:
matchLabels:
app: sample
template:
metadata:
labels:
app: sample
annotations:
dapr.io/app-id: "backend"
dapr.io/enabled: "true"
dapr.io/config: "opa-test"
dapr.io/app-port: "80"
dapr.io/sidecar-listen-addresses: "0.0.0.0"
spec:
containers:
- name: sample
image: mendhak/http-https-echo
ports:
- containerPort: 80