Add helm hook for Rally jobs

Change-Id: I983c5c25527761c028f550e5de2a9d8b08d892ce
This commit is contained in:
josebb 2022-02-28 13:01:23 +02:00
parent 32afc483e5
commit 3a39afe890
10 changed files with 51 additions and 1 deletions

View File

@ -14,7 +14,7 @@ apiVersion: v1
appVersion: v1.0.0
description: OpenStack-Helm rally
name: rally
version: 0.2.4
version: 0.2.5
home: https://docs.openstack.org/developer/rally
icon: https://www.openstack.org/themes/openstack/images/project-mascots/rally/OpenStack_Project_rally_vertical.png
sources:

View File

@ -12,7 +12,17 @@ See the License for the specific language governing permissions and
limitations under the License.
*/}}
{{- define "metadata.annotations.job.db_init" }}
helm.sh/hook: post-install,post-upgrade
helm.sh/hook-weight: "-3"
{{- end }}
{{- if .Values.manifests.job_db_init }}
{{- $dbInitJob := dict "envAll" . "serviceName" "rally" -}}
{{- if .Values.helm3_hook }}
{{- $_ := set $dbInitJob "jobAnnotations" (include "metadata.annotations.job.db_init" . | fromYaml) }}
{{- end }}
{{ $dbInitJob | include "helm-toolkit.manifests.job_db_init_mysql" }}
{{- end }}

View File

@ -12,7 +12,16 @@ See the License for the specific language governing permissions and
limitations under the License.
*/}}
{{- define "metadata.annotations.job.repo_sync" }}
helm.sh/hook: post-install,post-upgrade
{{- end }}
{{- if and .Values.manifests.job_image_repo_sync .Values.images.local_registry.active }}
{{- $imageRepoSyncJob := dict "envAll" . "serviceName" "rally" -}}
{{- if .Values.helm3_hook }}
{{- $_ := $imageRepoSyncJob "jobAnnotations" (include "metadata.annotations.job.repo_sync" . | fromYaml) }}
{{- end }}
{{ $imageRepoSyncJob | include "helm-toolkit.manifests.job_image_repo_sync" }}
{{- end }}

View File

@ -24,6 +24,10 @@ metadata:
name: rally-ks-endpoints
annotations:
{{ tuple $envAll | include "helm-toolkit.snippets.release_uuid" }}
{{- if .Values.helm3_hook }}
helm.sh/hook: post-install,post-upgrade
helm.sh/hook-weight: "-1"
{{- end }}
spec:
template:
metadata:

View File

@ -24,6 +24,10 @@ metadata:
name: rally-ks-service
annotations:
{{ tuple $envAll | include "helm-toolkit.snippets.release_uuid" }}
{{- if .Values.helm3_hook }}
helm.sh/hook: post-install,post-upgrade
helm.sh/hook-weight: "-2"
{{- end }}
spec:
template:
metadata:

View File

@ -12,7 +12,17 @@ See the License for the specific language governing permissions and
limitations under the License.
*/}}
{{- define "metadata.annotations.job.ks_user" }}
helm.sh/hook: post-install,post-upgrade
helm.sh/hook-weight: "1"
{{- end }}
{{- if .Values.manifests.job_ks_user }}
{{- $ksUserJob := dict "envAll" . "serviceName" "rally" -}}
{{- if .Values.helm3_hook }}
{{- $_ := set $ksUserJob "jobAnnotations" (include "metadata.annotations.job.ks_user" . | fromYaml) }}
{{- end }}
{{ $ksUserJob | include "helm-toolkit.manifests.job_ks_user" }}
{{- end }}

View File

@ -24,6 +24,10 @@ metadata:
name: rally-manage-db
annotations:
{{ tuple $envAll | include "helm-toolkit.snippets.release_uuid" }}
{{- if .Values.helm3_hook }}
helm.sh/hook: post-install,post-upgrade
helm.sh/hook-weight: "2"
{{- end }}
spec:
template:
metadata:

View File

@ -24,6 +24,10 @@ metadata:
name: rally-run-task
annotations:
{{ tuple $envAll | include "helm-toolkit.snippets.release_uuid" }}
{{- if .Values.helm3_hook }}
helm.sh/hook: post-install,post-upgrade
helm.sh/hook-weight: "3"
{{- end }}
spec:
backoffLimit: {{ .Values.jobs.run_tasks.backoffLimit }}
template:

View File

@ -4001,6 +4001,10 @@ conf:
times: 6
type: constant
# NOTE(helm_hook): helm_hook might break for helm2 binary.
# set helm3_hook: false when using the helm2 binary.
helm3_hook: true
manifests:
configmap_bin: true
configmap_etc: true

View File

@ -7,4 +7,5 @@ rally:
- 0.2.2 Add values for backoffLimit and restartPolicy
- 0.2.3 Update default image values to Wallaby
- 0.2.4 Migrated PodDisruptionBudget resource to policy/v1 API version
- 0.2.5 Add helm hook for jobs
...