-
-
Notifications
You must be signed in to change notification settings - Fork 31
/
kubernetes.example.yml
254 lines (254 loc) · 6.65 KB
/
kubernetes.example.yml
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
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
---
apiVersion: v1
kind: Service
metadata:
name: yente
labels:
app: yente
spec:
selector:
app: yente
ports:
- port: 8000
targetPort: 8000
name: http
---
apiVersion: v1
kind: ConfigMap
metadata:
name: yente-manifest
data:
manifest.yml: |
catalogs:
- url: "https://data.opensanctions.org/datasets/latest/index.json"
scope: default
resource_name: entities.ftm.json
# - url: "https://data.opensanctions.org/graph/catalog.json"
# resource_name: entities.ftm.json
datasets: []
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: yente
labels:
app: yente
annotations:
"cluster-autoscaler.kubernetes.io/safe-to-evict": "true"
spec:
replicas: 3
strategy:
type: RollingUpdate
rollingUpdate:
maxSurge: 2
maxUnavailable: 60%
selector:
matchLabels:
app: yente
template:
metadata:
labels:
app: yente
annotations:
deploy: "v1"
spec:
containers:
- name: yente
image: ghcr.io/opensanctions/yente:latest
imagePullPolicy: Always
ports:
- containerPort: 8000
name: http
resources:
requests:
memory: 800Mi
cpu: 200m
limits:
memory: 800Mi
cpu: 200m
securityContext:
readOnlyRootFilesystem: true
allowPrivilegeEscalation: false
volumeMounts:
- mountPath: /app/manifests/production.yml
name: manifest-volume
subPath: manifest.yml
- mountPath: /tmp
name: tmp-volume
env:
- name: YENTE_PORT
value: "8000"
- name: YENTE_TITLE
value: "OpenSanctions API"
- name: YENTE_LOG_JSON
value: "true"
- name: YENTE_UPDATE_TOKEN
value: "unsafe-default"
# This can be used to trigger a data update forcefully. It should be
# kept secret and only used in a secure environment.
# valueFrom:
# secretKeyRef:
# name: api-test-secrets
# key: update-token
- name: YENTE_INDEX_URL
value: http://yente-index-es-default:9200
- name: YENTE_MANIFEST
value: /app/manifests/production.yml
- name: YENTE_CRONTAB
value: "*/30 * * * *"
- name: YENTE_AUTO_REINDEX
value: "false"
- name: YENTE_INDEX_NAME
value: "yente"
- name: FORWARDED_ALLOW_IPS
value: "*"
readinessProbe:
httpGet:
path: /healthz
port: 8000
initialDelaySeconds: 5
failureThreshold: 3
timeoutSeconds: 15
livenessProbe:
httpGet:
path: /healthz
port: 8000
initialDelaySeconds: 5
failureThreshold: 3
timeoutSeconds: 15
volumes:
- name: manifest-volume
configMap:
name: yente-manifest
- name: tmp-volume
emptyDir: {}
restartPolicy: Always
securityContext:
runAsUser: 1000
runAsGroup: 1000
fsGroup: 1000
---
apiVersion: policy/v1
kind: PodDisruptionBudget
metadata:
name: yente-pdb
spec:
maxUnavailable: 60%
selector:
matchLabels:
app: yente
---
# This separates the re-indexing job from the API workers so that a crash in the
# API service can never lead to a failure to re-index.
#
# This relates to the YENTE_AUTO_REINDEX setting above.
apiVersion: batch/v1
kind: CronJob
metadata:
name: yente-indexer
spec:
schedule: "0 * * * *"
concurrencyPolicy: Forbid
jobTemplate:
spec:
template:
metadata:
annotations:
deploy: "v1"
spec:
containers:
- name: yente
image: ghcr.io/opensanctions/yente:latest
imagePullPolicy: Always
command:
- yente
- reindex
resources:
requests:
memory: 800M
cpu: 400m
limits:
memory: 800M
cpu: 400m
securityContext:
readOnlyRootFilesystem: true
allowPrivilegeEscalation: false
volumeMounts:
- mountPath: /app/manifests/production.yml
name: manifest-volume
subPath: manifest.yml
- mountPath: /tmp
name: tmp-volume
env:
- name: YENTE_PORT
value: "8000"
- name: YENTE_LOG_JSON
value: "true"
- name: YENTE_INDEX_URL
value: http://yente-index-es-default:9200
- name: YENTE_MANIFEST
value: /app/manifests/production.yml
- name: YENTE_INDEX_NAME
value: "yente"
restartPolicy: OnFailure
volumes:
- name: manifest-volume
configMap:
name: yente-manifest
- name: tmp-volume
emptyDir: {}
---
# Use the ElasticSearch Kubernetes Operator:
#
# helm upgrade --install elastic-operator elastic/eck-operator \
# --namespace elastic-system --create-namespace
#
# kubectl port-forward service/yente-index-es-http 9200 9200
apiVersion: elasticsearch.k8s.elastic.co/v1
kind: Elasticsearch
metadata:
name: yente-index
spec:
version: 8.14.3
http:
tls:
selfSignedCertificate:
disabled: true
nodeSets:
- name: default
count: 3
config:
node.store.allow_mmap: false
xpack.security.enabled: false
# xpack.security.authc:
# anonymous:
# username: anonymous
# roles: superuser
# authz_exception: false
podTemplate:
spec:
containers:
- name: elasticsearch
resources:
requests:
memory: 1500Mi
cpu: 2000m
limits:
memory: 1500Mi
cpu: 2000m
volumeClaimTemplates:
- metadata:
name: elasticsearch-data
spec:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 20Gi
storageClassName: premium-rwo
podDisruptionBudget:
spec:
minAvailable: 2
selector:
matchLabels:
elasticsearch.k8s.elastic.co/cluster-name: yente-index