Add helm hook annotation in placement db-sync and db-migrate jobs

Change-Id: I9e64a9e8f5082f23f29ebb831b1ad9cab1975165
This commit is contained in:
josebb 2022-04-05 20:38:07 +03:00
parent dec8f64ebc
commit 1e49055cea
4 changed files with 15 additions and 2 deletions

View File

@ -16,7 +16,7 @@ apiVersion: v1
appVersion: v1.0.0
description: OpenStack-Helm Placement
name: placement
version: 0.2.6
version: 0.2.7
home: https://docs.openstack.org/placement/latest/
icon: https://www.openstack.org/themes/openstack/images/project-mascots/Placement/OpenStack_Project_Placement_vertical.png
sources:

View File

@ -25,6 +25,10 @@ metadata:
labels:
{{ tuple $envAll "placement" "db-migrate" | include "helm-toolkit.snippets.kubernetes_metadata_labels" | indent 4 }}
annotations:
{{- if .Values.helm3_hook }}
helm.sh/hook: post-install,post-upgrade
helm.sh/hook-weight: "-4"
{{- end }}
{{ tuple $envAll | include "helm-toolkit.snippets.release_uuid" }}
spec:
template:

View File

@ -14,13 +14,21 @@ See the License for the specific language governing permissions and
limitations under the License.
*/}}
{{- define "metadata.annotations.job.db_sync" }}
helm.sh/hook: post-install,post-upgrade
helm.sh/hook-weight: "-3"
{{- end }}
{{- if .Values.manifests.job_db_sync }}
{{- $dbSyncJob := dict "envAll" . "serviceName" "placement" -}}
{{- if .Values.manifests.certificates -}}
{{- $_ := set $dbSyncJob "dbAdminTlsSecret" .Values.endpoints.oslo_db.auth.admin.secret.tls.internal -}}
{{- end -}}
{{- if .Values.helm3_hook }}
{{- $_ := set $dbSyncJob "jobAnnotations" (include "metadata.annotations.job.db_sync" . | fromYaml) }}
{{- end }}
{{- if .Values.pod.tolerations.placement.enabled -}}
{{- $_ := set $dbSyncJob "tolerationsEnabled" true -}}
{{- end -}}
{{ $dbSyncJob | include "helm-toolkit.manifests.job_db_sync" }}
{{- end }}
{{- end }}

View File

@ -15,4 +15,5 @@ placement:
- 0.2.4 Helm 3 - Fix Job Labels
- 0.2.5 Update htk requirements repo
- 0.2.6 Enable taint toleration for Openstack services
- 0.2.7 Add helm hook annotations for db-sync job
...