This repository has been archived by the owner on Mar 6, 2023. It is now read-only.
forked from AthenZ/k8s-athenz-identity
-
Notifications
You must be signed in to change notification settings - Fork 0
/
identityd.yaml
75 lines (73 loc) · 1.75 KB
/
identityd.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: apps/v1
kind: Deployment
metadata:
labels:
app: identityd
name: identityd
spec:
replicas: 1
selector:
matchLabels:
app: identityd
template:
metadata:
labels:
app: identityd
spec:
containers:
- args:
- run
- --server
- /config/system-main.rego
image: openpolicyagent/opa:0.14.0
imagePullPolicy: IfNotPresent
name: opa
volumeMounts:
- mountPath: /config
name: config
readOnly: true
- args:
- --opa-url=http://127.0.0.1:8181/v1
- --enable-policies=true
- --replicate-path=kubernetes
- --replicate=v1/pods
image: openpolicyagent/kube-mgmt:0.10
imagePullPolicy: IfNotPresent
name: mgmt
lifecycle:
postStart:
exec:
command:
- sh
- -c
- >
apk add curl openssl &&
echo | openssl s_client -connect kubernetes.default.svc:443 2>&1 | sed -ne '/-BEGIN CERTIFICATE-/,/-END CERTIFICATE-/p' | awk 'NF {sub(/\r/, ""); printf "%s\\n",$0;}' > /tmp/api-pubkey.pem &&
echo {\"cert\"":" \"$(cat /tmp/api-pubkey.pem)\"} > /tmp/cert.json &&
curl "localhost:8181/v1/data/kubernetes/keys" -X PUT -d @/tmp/cert.json
serviceAccountName: identityd
volumes:
- configMap:
name: identity-validation.rego
name: config
---
apiVersion: v1
kind: ServiceAccount
metadata:
labels:
app: identityd
name: identityd
---
apiVersion: v1
kind: Service
metadata:
labels:
app: identityd
name: identityd
spec:
selector:
app: identityd
ports:
- protocol: TCP
port: 8181
targetPort: 8181