Barbican: Add conditional wrapper to helm hook

The pre-install hooks for several of the barbican templates [0] cause
upgrade failures when using helm2. Similar to what was done for keystone
[1], this change wraps them in a conditional that can be toggled off for
anyone still using helm2.

0: https://review.opendev.org/c/openstack/openstack-helm/+/782710
1: https://review.opendev.org/c/openstack/openstack-helm/+/785517

Change-Id: I6a160916ec65d73eef1aaffb510c85ee7fb0d501
This commit is contained in:
Phil Sphicas 2021-06-06 02:47:14 +00:00
parent 87011eb8d7
commit 43f24adf57
11 changed files with 22 additions and 1 deletions

View File

@ -14,7 +14,7 @@ apiVersion: v1
appVersion: v1.0.0
description: OpenStack-Helm Barbican
name: barbican
version: 0.2.1
version: 0.2.2
home: https://docs.openstack.org/barbican/latest/
icon: https://www.openstack.org/themes/openstack/images/project-mascots/Barbican/OpenStack_Project_Barbican_vertical.png
sources:

View File

@ -13,9 +13,11 @@ limitations under the License.
*/}}
{{- define "metadata.annotations.job.bootstrap" }}
{{- if .Values.helm3_hook }}
helm.sh/hook: post-install,post-upgrade
helm.sh/hook-weight: "5"
{{- end }}
{{- end }}
{{- if and .Values.manifests.job_bootstrap .Values.bootstrap.enabled }}
{{- $bootstrapJob := dict "envAll" . "serviceName" "barbican" "keystoneUser" .Values.bootstrap.ks_user "logConfigFile" .Values.conf.barbican.DEFAULT.log_config_append "jobAnnotations" (include "metadata.annotations.job.bootstrap" . | fromYaml) -}}

View File

@ -13,9 +13,11 @@ 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 }}
{{- $serviceName := "barbican" -}}

View File

@ -13,9 +13,11 @@ 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 }}
{{- if .Values.manifests.job_db_sync }}
{{- $dbSyncJob := dict "envAll" . "serviceName" "barbican" "podVolMounts" .Values.pod.mounts.barbican_db_sync.barbican_db_sync.volumeMounts "podVols" .Values.pod.mounts.barbican_db_sync.barbican_db_sync.volumes "jobAnnotations" (include "metadata.annotations.job.db_sync" . | fromYaml) -}}

View File

@ -13,8 +13,10 @@ limitations under the License.
*/}}
{{- define "metadata.annotations.job.repo_sync" }}
{{- if .Values.helm3_hook }}
helm.sh/hook: post-install,post-upgrade
{{- end }}
{{- end }}
{{- if and .Values.manifests.job_image_repo_sync .Values.images.local_registry.active }}
{{- $imageRepoSyncJob := dict "envAll" . "serviceName" "barbican" "jobAnnotations" (include "metadata.annotations.job.repo_sync" . | fromYaml) -}}

View File

@ -13,9 +13,11 @@ limitations under the License.
*/}}
{{- define "metadata.annotations.job.ks_endpoints" }}
{{- if .Values.helm3_hook }}
helm.sh/hook: post-install,post-upgrade
helm.sh/hook-weight: "-2"
{{- end }}
{{- end }}
{{- if .Values.manifests.job_ks_endpoints }}
{{- $ksServiceJob := dict "envAll" . "serviceName" "barbican" "serviceTypes" ( tuple "key-manager" ) "jobAnnotations" (include "metadata.annotations.job.ks_endpoints" . | fromYaml) -}}

View File

@ -13,9 +13,11 @@ limitations under the License.
*/}}
{{- define "metadata.annotations.job.ks_service" }}
{{- if .Values.helm3_hook }}
helm.sh/hook: post-install,post-upgrade
helm.sh/hook-weight: "-3"
{{- end }}
{{- end }}
{{- if .Values.manifests.job_ks_service }}
{{- $ksServiceJob := dict "envAll" . "serviceName" "barbican" "serviceTypes" ( tuple "key-manager" ) "jobAnnotations" (include "metadata.annotations.job.ks_service" . | fromYaml) -}}

View File

@ -13,9 +13,11 @@ limitations under the License.
*/}}
{{- define "metadata.annotations.job.ks_user" }}
{{- if .Values.helm3_hook }}
helm.sh/hook: post-install,post-upgrade
helm.sh/hook-weight: "-1"
{{- end }}
{{- end }}
{{- if .Values.manifests.job_ks_user }}
{{- $ksUserJob := dict "envAll" . "serviceName" "barbican" "jobAnnotations" (include "metadata.annotations.job.ks_user" . | fromYaml) -}}

View File

@ -13,9 +13,11 @@ limitations under the License.
*/}}
{{- define "metadata.annotations.job.rabbit_init" }}
{{- if .Values.helm3_hook }}
helm.sh/hook: post-install,post-upgrade
helm.sh/hook-weight: "-4"
{{- end }}
{{- end }}
{{- if .Values.manifests.job_rabbit_init }}
{{- $rmqUserJob := dict "envAll" . "serviceName" "barbican" "jobAnnotations" (include "metadata.annotations.job.rabbit_init" . | fromYaml) -}}

View File

@ -29,6 +29,10 @@ labels:
release_group: null
# NOTE(philsphicas): the pre-install hook breaks upgrade for helm2
# Set to false to upgrade using helm2
helm3_hook: true
images:
tags:
bootstrap: docker.io/openstackhelm/heat:stein-ubuntu_bionic

View File

@ -5,3 +5,4 @@ barbican:
- 0.1.2 Added post-install and post-upgrade helm hook for Jobs
- 0.2.0 Remove support for releases before T
- 0.2.1 Use policies in yaml format
- 0.2.2 Add helm hook conditional