From e3cbbd16118349eb67b13800af1904bda4dbdb35 Mon Sep 17 00:00:00 2001 From: Thales Elero Cervi Date: Wed, 21 Sep 2022 16:48:54 -0300 Subject: [PATCH] Fixing cinder helm release hooks weights (helmv3) The relation of dependency for cinder release resources is not working with helmv3 since several jobs have post-install hooks and are dependencies of other jobs and deployments that have no hooks. The jobs/deployments without hooks are deployed during an installation phase that is never complete since the dependency jobs are hooked to be deployed on post-install phase. This change includes helm-hooks for the boostrap job and the api, scheduler and volume deployments. The weights will define the order each one will be deployed. Signed-off-by: Thales Elero Cervi Change-Id: I74dd271d065a7b4668845accae7476d5cbd7d363 --- cinder/templates/deployment-api.yaml | 4 ++++ cinder/templates/deployment-scheduler.yaml | 4 ++++ cinder/templates/deployment-volume.yaml | 4 ++++ cinder/templates/job-bootstrap.yaml | 7 ++++++- 4 files changed, 18 insertions(+), 1 deletion(-) diff --git a/cinder/templates/deployment-api.yaml b/cinder/templates/deployment-api.yaml index 85fc19d7..eebdae8f 100644 --- a/cinder/templates/deployment-api.yaml +++ b/cinder/templates/deployment-api.yaml @@ -27,6 +27,10 @@ metadata: name: cinder-api 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 }} labels: {{ tuple $envAll "cinder" "api" | include "helm-toolkit.snippets.kubernetes_metadata_labels" | indent 4 }} spec: diff --git a/cinder/templates/deployment-scheduler.yaml b/cinder/templates/deployment-scheduler.yaml index 17f379e3..9a3d4764 100644 --- a/cinder/templates/deployment-scheduler.yaml +++ b/cinder/templates/deployment-scheduler.yaml @@ -27,6 +27,10 @@ metadata: name: cinder-scheduler 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 }} labels: {{ tuple $envAll "cinder" "scheduler" | include "helm-toolkit.snippets.kubernetes_metadata_labels" | indent 4 }} spec: diff --git a/cinder/templates/deployment-volume.yaml b/cinder/templates/deployment-volume.yaml index 6f15f7ce..498146c9 100755 --- a/cinder/templates/deployment-volume.yaml +++ b/cinder/templates/deployment-volume.yaml @@ -29,6 +29,10 @@ metadata: name: cinder-volume 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 }} labels: {{ tuple $envAll "cinder" "volume" | include "helm-toolkit.snippets.kubernetes_metadata_labels" | indent 4 }} spec: diff --git a/cinder/templates/job-bootstrap.yaml b/cinder/templates/job-bootstrap.yaml index 571b50bd..aa74bfe0 100644 --- a/cinder/templates/job-bootstrap.yaml +++ b/cinder/templates/job-bootstrap.yaml @@ -12,8 +12,13 @@ See the License for the specific language governing permissions and limitations under the License. */}} +{{- define "metadata.annotations.job.bootstrap" }} +helm.sh/hook: post-install,post-upgrade +helm.sh/hook-weight: "5" +{{- end }} + {{- if and .Values.manifests.job_bootstrap .Values.bootstrap.enabled }} -{{- $bootstrapJob := dict "envAll" . "serviceName" "cinder" "keystoneUser" .Values.bootstrap.ks_user "logConfigFile" .Values.conf.cinder.DEFAULT.log_config_append -}} +{{- $bootstrapJob := dict "envAll" . "serviceName" "cinder" "keystoneUser" .Values.bootstrap.ks_user "logConfigFile" .Values.conf.cinder.DEFAULT.log_config_append "jobAnnotations" (include "metadata.annotations.job.bootstrap" . | fromYaml) -}} {{- if .Values.manifests.certificates -}} {{- $_ := set $bootstrapJob "tlsSecret" .Values.secrets.tls.volume.api.public -}} {{- end -}} -- 2.25.1