Skip to content

Commit f8fda7e

Browse files
authored
fix: Naming conventions pre/post install/upgrade hooks (#209)
1 parent c351fdc commit f8fda7e

13 files changed

+41
-137
lines changed

.github/workflows/deploy-opencrvs.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,11 @@ on:
1414
core-image-tag:
1515
description: "Tag of the core image"
1616
required: true
17-
default: "v1.9.1"
17+
default: "v1.9.6"
1818
countryconfig-image-tag:
1919
description: "Tag of the countryconfig image"
2020
required: true
21-
default: "v1.9.1"
21+
default: "v1.9.6"
2222
environment:
2323
description: "Target environment"
2424
required: true

.github/workflows/k8s-reset-data.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,9 +82,9 @@ jobs:
8282
matrix:
8383
job-name:
8484
- data-cleanup
85-
- postgres-on-update-core
85+
- postgres-on-deploy
8686
- data-migration
87-
- postgres-on-update-analytics
87+
- data-migration-analytics
8888
steps:
8989
- name: Download helm release values file into /tmp/opencrvs-${{ inputs.environment }}.json
9090
uses: actions/download-artifact@v5

charts/opencrvs-services/Chart.yaml

Lines changed: 2 additions & 2 deletions
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.26
6-
appVersion: 1.9.5
5+
version: 0.1.28
6+
appVersion: 1.9.6

charts/opencrvs-services/README.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -800,3 +800,19 @@ In this example:
800800
- `KIBANA_SYSTEM`, `METRICBEAT`, and `APM` will use the specified usernames (`kibana_system`, `beats_system`, `apm_system`) with random passwords.
801801

802802
The generated credentials can be accessed from the `elasticsearch-opencrvs-users` secret.
803+
804+
# Additional information
805+
806+
## Helm chart hooks
807+
808+
Helm chart has following pre-install/upgrade hooks:
809+
- elasticsearch-on-deploy: create elasticsearch users and configure permissions, see `elasticsearch` configuration options for more details how to configure users and permissions
810+
- influxdb-on-deploy: create database
811+
- mongo-on-deploy: create databases and users with correct permissions, see `mongodb` configuration options for more details how to configure users and permissions
812+
- postgres-on-deploy: create database, schemas and users with correct permissions
813+
814+
Helm chart has following post-install/upgrade hooks:
815+
- data-migration: apply data migrations to postgres, mongodb, influxdb
816+
- data-migration-analytics: apply data migrations to postgres, this hook use Countryconfig assets docker image, see documentation on how to create own analytics dashboards.
817+
- data-seed: initial data seed, runs only on post-install
818+
- elasticsearch-reindex: reindex data after deployment

charts/opencrvs-services/files/setup-analytics.sh

Lines changed: 0 additions & 86 deletions
This file was deleted.

charts/opencrvs-services/templates/dashboards-deployment.yaml

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
# FIXME: Feature to Temporary disable dashboards on m1
2-
# Defaults: dashboards.enabled = true
31
{{- if .Values.dashboards.enabled }}
42
---
53
apiVersion: traefik.io/v1alpha1
@@ -54,17 +52,11 @@ spec:
5452
initContainers:
5553
- name: copy-assets
5654
image: "{{ .Values.countryconfig.image.name }}:{{ .Values.countryconfig.image.tag }}-assets"
57-
# TODO: [[ -d /assets/metabase ]]: condition was added temporary
58-
# to avoid failures until PR will be shipped as part of release to everyone
59-
# ETA: OpenCRVS v2.0
60-
# Related PR: https://github.com/opencrvs/opencrvs-countryconfig/pull/1184
61-
# Related Issue: https://github.com/opencrvs/opencrvs-core/issues/11192
6255
command:
6356
- sh
6457
- -c
6558
- >
66-
[[ -d /assets/metabase ]] && cp -R /assets/metabase/* /data-assets/ ||
67-
cp -R /assets/* /data-assets/;
59+
cp -R /assets/metabase/* /data-assets/ && \
6860
chmod +x /data-assets/*.sh
6961
volumeMounts:
7062
- name: assets
@@ -140,5 +132,5 @@ spec:
140132

141133
{{- include "pdb-helper" (dict "service_name" "dashboards" "Values" .Values) }}
142134

143-
# FIXME: Feature to Temporary disable dashboards on m1
135+
144136
{{- end }}

charts/opencrvs-services/templates/postgres-on-update-analytics-job.yaml renamed to charts/opencrvs-services/templates/data-migration-analytics-job.yaml

Lines changed: 5 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,18 @@
11
---
2-
# TODO: REVIEW: Refactor job move to countryconfig assets
3-
# - delete setup-analytics.sh from helm chart
4-
# - remove configmap reference: postgres-on-update-script
5-
# - Remove related logic
6-
# ETA: OpenCRVS v2.0
7-
# Related PR: https://github.com/opencrvs/opencrvs-countryconfig/pull/1184
8-
# Related Issue: https://github.com/opencrvs/opencrvs-core/issues/11192
92
apiVersion: batch/v1
103
kind: Job
114
metadata:
125
annotations:
136
"helm.sh/hook": pre-install,pre-upgrade
147
"helm.sh/hook-weight": "3"
158
labels:
16-
app: postgres-on-update-analytics
17-
name: postgres-on-update-analytics
9+
app: data-migration-analytics
10+
name: data-migration-analytics
1811
spec:
1912
template:
2013
metadata:
2114
labels:
22-
app: postgres-on-update-analytics
15+
app: data-migration-analytics
2316
spec:
2417
{{- with .Values.imagePullSecrets }}
2518
imagePullSecrets:
@@ -32,17 +25,13 @@ spec:
3225
- sh
3326
- -c
3427
- >
35-
[[ -d /assets/postgres/ ]] && cp -R /assets/postgres/* /data-assets/ ||
36-
cp -LR /scripts/* /data-assets/;
28+
cp -R /assets/postgres/* /data-assets/ &&
3729
chmod +x /data-assets/*.sh || true
3830
volumeMounts:
3931
- name: assets
4032
mountPath: /data-assets
41-
# TODO: See comment at the top of this file
42-
- mountPath: /scripts
43-
name: postgres-on-update-script
4433
containers:
45-
- name: postgres-on-update-analytics
34+
- name: data-migration-analytics
4635
command: ["bash", "-c", "/data-assets/setup-analytics.sh"]
4736
image: postgres:17
4837
env:
@@ -102,11 +91,6 @@ spec:
10291
- name: assets
10392
mountPath: /data-assets
10493
volumes:
105-
# TODO: See comment at the top of this file
106-
- name: postgres-on-update-script
107-
configMap:
108-
name: postgres-on-update-script
109-
defaultMode: 0755
11094
- name: assets
11195
emptyDir: {}
11296
restartPolicy: "OnFailure"

charts/opencrvs-services/templates/elasticsearch-on-update-configmap.yaml renamed to charts/opencrvs-services/templates/elasticsearch-on-deploy-configmap.yaml

File renamed without changes.

charts/opencrvs-services/templates/elasticsearch-on-update.yaml renamed to charts/opencrvs-services/templates/elasticsearch-on-deploy.yaml

File renamed without changes.

charts/opencrvs-services/templates/mongo-on-update-configmap.yaml renamed to charts/opencrvs-services/templates/mongo-on-deploy-configmap.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,5 +10,5 @@ metadata:
1010
annotations:
1111
"helm.sh/hook": pre-install,pre-upgrade
1212
"helm.sh/hook-weight": "0"
13-
name: mongo-on-update-script
13+
name: mongo-on-deploy-script
1414
{{- end }}

0 commit comments

Comments
 (0)