-
Notifications
You must be signed in to change notification settings - Fork 18
/
signing-key-job.yaml
112 lines (111 loc) · 2.6 KB
/
signing-key-job.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
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
---
apiVersion: v1
kind: ServiceAccount
metadata:
name: matrix-signing-key-sa
namespace: matrix
---
apiVersion: rbac.authorization.k8s.io/v1
kind: Role
metadata:
name: matrix-signing-key-sa
namespace: matrix
rules:
- apiGroups:
- ""
resourceNames:
- matrix-signing-key
resources:
- secrets
verbs:
- get
- create
- update
- patch
---
apiVersion: rbac.authorization.k8s.io/v1
kind: RoleBinding
metadata:
name: matrix-signing-key-sa
namespace: matrix
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: Role
name: matrix-signing-key-sa
subjects:
- kind: ServiceAccount
name: matrix-signing-key-sa
namespace: matrix
---
apiVersion: batch/v1
kind: Job
metadata:
labels:
app: matrix-synapse-job
job: signing-key-generation
name: matrix-synapse-signing-key
namespace: matrix
spec:
template:
metadata:
labels:
app: matrix-synapse-job
job: signing-key-generation
spec:
containers:
- command:
- sh
- -c
- |
echo "Copying key upload script..."
cp /key-upload /scripts/
echo "Generating signing key..."
/usr/local/bin/generate_signing_key.py -o /synapse/keys/signing.key
image: ananace/matrix-synapse:1.9.1-test
imagePullPolicy: IfNotExists
name: signing-key-generate
resources:
requests:
memory: 10Mi
cpu: 10m
limits:
memory: 25Mi
cpu: 100m
volumeMounts:
- mountPath: /scripts
name: scripts
- mountPath: /synapse/keys
name: matrix-synapse-keys
- command:
- sh
- -c
- |
echo "Waiting for key upload script"
while ! [ -f /scripts/key-upload ]; do sleep 1; done
/scripts/key-upload
env:
- name: SECRET_NAME
value: matrix-signing-key
image: bitnami/kubectl
name: signing-key-upload
resources:
requests:
memory: 10Mi
cpu: 10m
limits:
memory: 50Mi
cpu: 100m
volumeMounts:
- mountPath: /scripts
name: scripts
readOnly: true
- mountPath: /synapse/keys
name: matrix-synapse-keys
readOnly: true
restartPolicy: Never
serviceAccount: matrix-signing-key-sa
volumes:
- name: scripts
emptyDir: {}
- name: matrix-synapse-keys
emptyDir: {}