Added the helm hook for create user job for exporter

exporter-jpb-create-user was failing due to the field immutability
which was resulting in the manual delete of the job for every helm
upgrade to be successful. Reason being job being upgraded before the
other manifest that are required been updated. It can be avoided by
using helm-hook post-install and post-upgrade which will force the
job manifest to be applied only after all other manifest are applied.
Hook annotation is provided "5" so that the if other jobs are annotated,
exporter job will be last to created.
helm3_hook value is used for the condition which will enable the disable
of the hook.

Change-Id: I2039abb5bad07a19fd09fc5e245485c3c772beca
This commit is contained in:
xuxant02@gmail.com 2021-06-24 18:48:09 +05:45
parent 62f5cab770
commit 9133218e83
4 changed files with 12 additions and 1 deletions

View File

@ -15,7 +15,7 @@ apiVersion: v1
appVersion: v10.2.31 appVersion: v10.2.31
description: OpenStack-Helm MariaDB description: OpenStack-Helm MariaDB
name: mariadb name: mariadb
version: 0.2.4 version: 0.2.5
home: https://mariadb.com/kb/en/ home: https://mariadb.com/kb/en/
icon: http://badges.mariadb.org/mariadb-badge-180x60.png icon: http://badges.mariadb.org/mariadb-badge-180x60.png
sources: sources:

View File

@ -22,6 +22,12 @@ apiVersion: batch/v1
kind: Job kind: Job
metadata: metadata:
name: exporter-create-sql-user name: exporter-create-sql-user
{{- if .Values.helm3_hook }}
annotations:
"helm.sh/hook": "post-install,post-upgrade"
"helm.sh/hook-weight": "5"
"helm.sh/hook-delete-policy": "before-hook-creation"
{{- end }}
spec: spec:
backoffLimit: {{ .Values.jobs.exporter_create_sql_user.backoffLimit }} backoffLimit: {{ .Values.jobs.exporter_create_sql_user.backoffLimit }}
template: template:

View File

@ -619,6 +619,10 @@ network_policy:
egress: egress:
- {} - {}
# Helm hook breaks for helm2.
# Set helm3_hook: false in case helm2 is used.
helm3_hook: true
manifests: manifests:
certificates: false certificates: false
configmap_bin: true configmap_bin: true

View File

@ -20,4 +20,5 @@ mariadb:
- 0.2.2 remove deprecated svc annotation tolerate-unready-endpoints - 0.2.2 remove deprecated svc annotation tolerate-unready-endpoints
- 0.2.3 Remove panko residue - 0.2.3 Remove panko residue
- 0.2.4 Use full image ref for docker official images - 0.2.4 Use full image ref for docker official images
- 0.2.5 Added helm hook for post-install and post-upgrade in prometheus exporter job.
... ...