Skip to content

Commit b36397f

Browse files
authored
Merge pull request #193 from opencrvs/ocrvs-11044
feat: Add re-index cronjob to OpenCRVS helm chart
2 parents d8b108e + 009efa4 commit b36397f

File tree

7 files changed

+54
-22
lines changed

7 files changed

+54
-22
lines changed

.github/TEMPLATES/secret-mapping-deps.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
# FIXME: Once real values are populated drop `tmp` suffix
21
backup-encryption-secret:
32
# This is the password that is used to encrypt all the backups that OpenCRVS creates from
43
# a production server and that are stored on the backup server. Use this passphrase to decrypt the backups.

.github/TEMPLATES/secret-mapping-opencrvs.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
# FIXME: Once real values are populated drop `tmp` suffix
21
dashboards-admin-user:
32
# Email address for metabase admin panel login
43
- OPENCRVS_METABASE_ADMIN_EMAIL

charts/opencrvs-services/Chart.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,5 @@ apiVersion: v2
22
name: opencrvs-services
33
description: OpenCRVS Services
44
type: application
5-
version: 0.1.18
5+
version: 0.1.19
66
appVersion: 1.9.0

charts/opencrvs-services/README.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,16 @@ helm upgrade --install opencrvs oci://ghcr.io/opencrvs/opencrvs-services \
8484
<td>9200</td>
8585
<td>Elasticsearch port.</td>
8686
</tr>
87+
<tr>
88+
<td>elasticsearch.reindex.enabled</td>
89+
<td>false</td>
90+
<td>Enable elasticsearch reindex job. Required if database restore is configured.</td>
91+
</tr>
92+
<tr>
93+
<td>elasticsearch.reindex.schedule</td>
94+
<td><pre>0 2 * * *</pre></td>
95+
<td>Schedule time for cronjob. Make sure reindex doesn't overlap with database restore job.</td>
96+
</tr>
8797
<tr>
8898
<td>elasticsearch.auth_mode</td>
8999
<td>disabled</td>
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
{{- define "elasticsearch-reindex.podSpec" -}}
2+
template:
3+
metadata:
4+
labels:
5+
app: elasticsearch-reindex
6+
spec:
7+
containers:
8+
- name: elasticsearch-reindex
9+
command: ["sh", "-c", "apk add --no-cache curl jq && /scripts/reindex.sh"]
10+
image: "alpine"
11+
env:
12+
- name: AUTH_URL
13+
value: "http://auth.{{ .Release.Namespace }}.svc.cluster.local:4040"
14+
- name: EVENTS_URL
15+
value: "http://events.{{ .Release.Namespace }}.svc.cluster.local:5555"
16+
volumeMounts:
17+
- mountPath: /scripts
18+
name: elasticsearch-reindex-script
19+
volumes:
20+
- name: elasticsearch-reindex-script
21+
configMap:
22+
name: elasticsearch-reindex-script
23+
defaultMode: 0755
24+
restartPolicy: "OnFailure"
25+
{{- end }}

charts/opencrvs-services/templates/elasticsearch-reindex-job.yaml

Lines changed: 15 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -13,21 +13,18 @@ spec:
1313
labels:
1414
app: elasticsearch-reindex
1515
spec:
16-
containers:
17-
- name: elasticsearch-reindex
18-
command: ["sh", "-c", "apk add --no-cache curl jq && /scripts/reindex.sh"]
19-
image: "alpine"
20-
env:
21-
- name: AUTH_URL
22-
value: "http://auth.{{ .Release.Namespace }}.svc.cluster.local:4040"
23-
- name: EVENTS_URL
24-
value: "http://events.{{ .Release.Namespace }}.svc.cluster.local:5555"
25-
volumeMounts:
26-
- mountPath: /scripts
27-
name: elasticsearch-reindex-script
28-
volumes:
29-
- name: elasticsearch-reindex-script
30-
configMap:
31-
name: elasticsearch-reindex-script
32-
defaultMode: 0755
33-
restartPolicy: "OnFailure"
16+
{{ include "elasticsearch-reindex.podSpec" . | indent 2 }}
17+
18+
{{- if .Values.elasticsearch.reindex.enabled }}
19+
apiVersion: batch/v1
20+
kind: CronJob
21+
metadata:
22+
labels:
23+
app: elasticsearch
24+
name: elasticsearch-reindex
25+
spec:
26+
schedule: "{{ .Values.elasticsearch.reindex.schedule }}"
27+
jobTemplate:
28+
spec:
29+
{{ include "elasticsearch-reindex.podSpec" . | indent 6 }}
30+
{{- end }}

charts/opencrvs-services/values.yaml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,9 @@
1616
elasticsearch:
1717
host: elasticsearch.opencrvs-deps-dev.svc.cluster.local
1818
port: 9200
19-
19+
reindex:
20+
enabled: false
21+
schedule: "0 2 * * *"
2022
# auth_mode:
2123
# - disabled: No authentication enabled for MongoDB, password-less access to databases
2224
# - auto: Users are managed by OpenCRVS helm chart, this mode requires secret to be created with MongoDB admin user

0 commit comments

Comments
 (0)