openstack-armada-app/openstack-helm/files/0017-Fixing-cinder-helm-release-hooks-weights-helmv3.patch
Thales Elero Cervi 541ba72c88 Partial FluxCD version of stx-openstack: compute
This is continuing previous work [1] of the openstack app
migration to FluxCD, adding compute-kit related charts.
This change includes the following charts:
libvirt, nova, nova-api-proxy, pci-irq-affinity-agent, neutron,
placement and openvswitch.

In order to complete the fluxcd migration it was also necessary to
remove the openstack-helm Patch0016, made to fix an intermttent issue
and only compatible to Armada (helmv2 and old operators). It does not
fix a major issue and should be safe to be removed for a while during
this migration. Its FluxCD version will be tracked by Task 46426,
probably implemented using the current cinder-clean job as an example.

Test Plan:
PASS - build-helm-charts.sh builds a basic FluxCD app tarball
PASS - application upload and overrides generated
PASS - application apply/remove/delete

[1] https://review.opendev.org/c/starlingx/openstack-armada-app/+/848166

Story: 2009138
Task: 45462

Signed-off-by: Thales Elero Cervi <thaleselero.cervi@windriver.com>
Change-Id: I78b78058e874d9eae7051ca0cb5a1fe09b2726a3
2022-09-27 09:45:26 -03:00

94 lines
4.0 KiB
Diff

From e3cbbd16118349eb67b13800af1904bda4dbdb35 Mon Sep 17 00:00:00 2001
From: Thales Elero Cervi <thaleselero.cervi@windriver.com>
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 <thaleselero.cervi@windriver.com>
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