From a3d26068adf222acea9128b1c31bb9d28beeb2a9 Mon Sep 17 00:00:00 2001
From: Gage Hugo <gagehugo@gmail.com>
Date: Fri, 23 Apr 2021 17:03:11 -0500
Subject: [PATCH] Update helm hook conditionals

Updated the db job annotation hooks to be wrapped with
conditionals for helm v2 support.

Change-Id: I069fe3572b837714e263252646e56471c81745d5
---
 keystone/Chart.yaml                 | 2 +-
 keystone/templates/job-db-init.yaml | 2 ++
 keystone/templates/job-db-sync.yaml | 2 ++
 releasenotes/notes/keystone.yaml    | 1 +
 4 files changed, 6 insertions(+), 1 deletion(-)

diff --git a/keystone/Chart.yaml b/keystone/Chart.yaml
index 362df9fa90..1cc76546de 100644
--- a/keystone/Chart.yaml
+++ b/keystone/Chart.yaml
@@ -14,7 +14,7 @@ apiVersion: v1
 appVersion: v1.0.0
 description: OpenStack-Helm Keystone
 name: keystone
-version: 0.1.13
+version: 0.1.14
 home: https://docs.openstack.org/keystone/latest/
 icon: https://www.openstack.org/themes/openstack/images/project-mascots/Keystone/OpenStack_Project_Keystone_vertical.png
 sources:
diff --git a/keystone/templates/job-db-init.yaml b/keystone/templates/job-db-init.yaml
index 6f91176b12..6302d6a1c2 100644
--- a/keystone/templates/job-db-init.yaml
+++ b/keystone/templates/job-db-init.yaml
@@ -13,8 +13,10 @@ limitations under the License.
 */}}
 
 {{- define "metadata.annotations.job.db_init" }}
+{{- if .Values.helm3_hook -}}
 helm.sh/hook: post-install,post-upgrade
 helm.sh/hook-weight: "-5"
+{{- end -}}
 {{- end }}
 
 {{- if .Values.manifests.job_db_init }}
diff --git a/keystone/templates/job-db-sync.yaml b/keystone/templates/job-db-sync.yaml
index 818d4a471e..8700ce1355 100644
--- a/keystone/templates/job-db-sync.yaml
+++ b/keystone/templates/job-db-sync.yaml
@@ -13,8 +13,10 @@ limitations under the License.
 */}}
 
 {{- define "metadata.annotations.job.db_sync" }}
+{{- if .Values.helm3_hook -}}
 helm.sh/hook: post-install,post-upgrade
 helm.sh/hook-weight: "-4"
+{{- end -}}
 {{- end }}
 
 {{- define "keystone.templates._job_db_sync.env_vars" -}}
diff --git a/releasenotes/notes/keystone.yaml b/releasenotes/notes/keystone.yaml
index ef6ae96789..ff2226635e 100644
--- a/releasenotes/notes/keystone.yaml
+++ b/releasenotes/notes/keystone.yaml
@@ -14,4 +14,5 @@ keystone:
   - 0.1.11 Remove congress residue
   - 0.1.12 Add helm hook conditional
   - 0.1.13 Fix Error - wrong number of args for set
+  - 0.1.14 Remove setup helm hooks
 ...