From 9133218e8386082a28ad18b442ed2cb0aa7c0df3 Mon Sep 17 00:00:00 2001 From: "xuxant02@gmail.com" Date: Thu, 24 Jun 2021 18:48:09 +0545 Subject: [PATCH] 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 --- mariadb/Chart.yaml | 2 +- .../monitoring/prometheus/exporter-job-create-user.yaml | 6 ++++++ mariadb/values.yaml | 4 ++++ releasenotes/notes/mariadb.yaml | 1 + 4 files changed, 12 insertions(+), 1 deletion(-) diff --git a/mariadb/Chart.yaml b/mariadb/Chart.yaml index 88cc6a623..0e6c10086 100644 --- a/mariadb/Chart.yaml +++ b/mariadb/Chart.yaml @@ -15,7 +15,7 @@ apiVersion: v1 appVersion: v10.2.31 description: OpenStack-Helm MariaDB name: mariadb -version: 0.2.4 +version: 0.2.5 home: https://mariadb.com/kb/en/ icon: http://badges.mariadb.org/mariadb-badge-180x60.png sources: diff --git a/mariadb/templates/monitoring/prometheus/exporter-job-create-user.yaml b/mariadb/templates/monitoring/prometheus/exporter-job-create-user.yaml index c897f5d8a..7d9f73f65 100644 --- a/mariadb/templates/monitoring/prometheus/exporter-job-create-user.yaml +++ b/mariadb/templates/monitoring/prometheus/exporter-job-create-user.yaml @@ -22,6 +22,12 @@ apiVersion: batch/v1 kind: Job metadata: 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: backoffLimit: {{ .Values.jobs.exporter_create_sql_user.backoffLimit }} template: diff --git a/mariadb/values.yaml b/mariadb/values.yaml index ba4b9c575..dcc905dc5 100644 --- a/mariadb/values.yaml +++ b/mariadb/values.yaml @@ -619,6 +619,10 @@ network_policy: egress: - {} +# Helm hook breaks for helm2. +# Set helm3_hook: false in case helm2 is used. +helm3_hook: true + manifests: certificates: false configmap_bin: true diff --git a/releasenotes/notes/mariadb.yaml b/releasenotes/notes/mariadb.yaml index 4d6ef9000..8e906878c 100644 --- a/releasenotes/notes/mariadb.yaml +++ b/releasenotes/notes/mariadb.yaml @@ -20,4 +20,5 @@ mariadb: - 0.2.2 remove deprecated svc annotation tolerate-unready-endpoints - 0.2.3 Remove panko residue - 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. ...