From e60e80155a17b2e063e36118c32015a7663a8c3f Mon Sep 17 00:00:00 2001 From: Thales Elero Cervi Date: Wed, 21 Sep 2022 12:58:26 -0300 Subject: [PATCH] OSH Patch: Fixing nova helm release hooks The relation of dependency for nova resources is not working with helmv3 since several jobs have post-install hooks and are dependencies of other jobs that have no hooks. The jobs 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 and cell-setup jobs. The weights will define the order each one will be deployed. Test Plan: PASS - build-helm-charts.sh builds a basic FluxCD app tarball PASS - application upload and overrides generated PASS - application apply/remove/delete Closes-Bug: 1990536 Signed-off-by: Thales Elero Cervi Change-Id: Ic3833d2f87d9a1502b1a3de2780ba76774d2fa8e --- openstack-helm/centos/openstack-helm.spec | 2 + ...-nova-helm-release-hooks-and-weights.patch | 57 +++++++++++++++++++ .../debian/deb_folder/patches/series | 1 + ...-nova-helm-release-hooks-and-weights.patch | 57 +++++++++++++++++++ 4 files changed, 117 insertions(+) create mode 100644 openstack-helm/debian/deb_folder/patches/0020-Fixing-nova-helm-release-hooks-and-weights.patch create mode 100644 openstack-helm/files/0020-Fixing-nova-helm-release-hooks-and-weights.patch diff --git a/openstack-helm/centos/openstack-helm.spec b/openstack-helm/centos/openstack-helm.spec index 1a0a810a..fa29d022 100644 --- a/openstack-helm/centos/openstack-helm.spec +++ b/openstack-helm/centos/openstack-helm.spec @@ -37,6 +37,7 @@ Patch16: 0016-Network-Resources-Cleanup-before-OpenStack-Removal.patch Patch17: 0017-Update-RBAC-authorization-api-to-v1.patch Patch18: 0018-Fixing-cinder-helm-release-hooks-weights-helmv3.patch Patch19: 0019-Fixing-placement-helm-release-hooks.patch +Patch20: 0020-Fixing-nova-helm-release-hooks-and-weights.patch BuildRequires: helm BuildRequires: openstack-helm-infra @@ -66,6 +67,7 @@ Openstack Helm charts %patch17 -p1 %patch18 -p1 %patch19 -p1 +%patch20 -p1 %build # Stage helm-toolkit in the local repo diff --git a/openstack-helm/debian/deb_folder/patches/0020-Fixing-nova-helm-release-hooks-and-weights.patch b/openstack-helm/debian/deb_folder/patches/0020-Fixing-nova-helm-release-hooks-and-weights.patch new file mode 100644 index 00000000..fdd8347f --- /dev/null +++ b/openstack-helm/debian/deb_folder/patches/0020-Fixing-nova-helm-release-hooks-and-weights.patch @@ -0,0 +1,57 @@ +From 63ffa8ad9c1e212383190aa4a21bd5999a233b12 Mon Sep 17 00:00:00 2001 +From: Thales Elero Cervi +Date: Wed, 21 Sep 2022 16:43:01 -0300 +Subject: [PATCH] Fixing nova helm release hooks and weights + +The relation of dependency for nova resources is not working +with helmv3 since several jobs have post-install hooks and are +dependencies of other jobs that have no hooks. + +The jobs 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 and cell-setup jobs. +The weights will define the order each one will be deployed. + +Signed-off-by: Thales Elero Cervi +Change-Id: I924302b6fd41d4fe6fe7bae5577de7d6d590abb2 +--- + nova/templates/job-bootstrap.yaml | 5 +++++ + nova/templates/job-cell-setup.yaml | 4 ++++ + 2 files changed, 9 insertions(+) + +diff --git a/nova/templates/job-bootstrap.yaml b/nova/templates/job-bootstrap.yaml +index 1229acec..f719cb5c 100644 +--- a/nova/templates/job-bootstrap.yaml ++++ b/nova/templates/job-bootstrap.yaml +@@ -30,6 +30,11 @@ metadata: + name: {{ $serviceAccountName | quote }} + labels: + application: {{ $serviceAccountName | quote }} ++ annotations: ++{{- if .Values.helm3_hook }} ++ helm.sh/hook: post-install,post-upgrade ++ helm.sh/hook-weight: "2" ++{{- end }} + spec: + template: + metadata: +diff --git a/nova/templates/job-cell-setup.yaml b/nova/templates/job-cell-setup.yaml +index 6fd8bca4..0fe686b6 100644 +--- a/nova/templates/job-cell-setup.yaml ++++ b/nova/templates/job-cell-setup.yaml +@@ -25,6 +25,10 @@ metadata: + labels: + {{ tuple $envAll "nova" "cell-setup" | 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: "1" ++{{- end }} + {{ tuple $envAll | include "helm-toolkit.snippets.release_uuid" }} + spec: + template: +-- +2.25.1 + diff --git a/openstack-helm/debian/deb_folder/patches/series b/openstack-helm/debian/deb_folder/patches/series index 73fc852b..4f22dd14 100644 --- a/openstack-helm/debian/deb_folder/patches/series +++ b/openstack-helm/debian/deb_folder/patches/series @@ -16,3 +16,4 @@ 0017-Update-RBAC-authorization-api-to-v1.patch 0018-Fixing-cinder-helm-release-hooks-weights-helmv3.patch 0019-Fixing-placement-helm-release-hooks.patch +0020-Fixing-nova-helm-release-hooks-and-weights.patch diff --git a/openstack-helm/files/0020-Fixing-nova-helm-release-hooks-and-weights.patch b/openstack-helm/files/0020-Fixing-nova-helm-release-hooks-and-weights.patch new file mode 100644 index 00000000..fdd8347f --- /dev/null +++ b/openstack-helm/files/0020-Fixing-nova-helm-release-hooks-and-weights.patch @@ -0,0 +1,57 @@ +From 63ffa8ad9c1e212383190aa4a21bd5999a233b12 Mon Sep 17 00:00:00 2001 +From: Thales Elero Cervi +Date: Wed, 21 Sep 2022 16:43:01 -0300 +Subject: [PATCH] Fixing nova helm release hooks and weights + +The relation of dependency for nova resources is not working +with helmv3 since several jobs have post-install hooks and are +dependencies of other jobs that have no hooks. + +The jobs 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 and cell-setup jobs. +The weights will define the order each one will be deployed. + +Signed-off-by: Thales Elero Cervi +Change-Id: I924302b6fd41d4fe6fe7bae5577de7d6d590abb2 +--- + nova/templates/job-bootstrap.yaml | 5 +++++ + nova/templates/job-cell-setup.yaml | 4 ++++ + 2 files changed, 9 insertions(+) + +diff --git a/nova/templates/job-bootstrap.yaml b/nova/templates/job-bootstrap.yaml +index 1229acec..f719cb5c 100644 +--- a/nova/templates/job-bootstrap.yaml ++++ b/nova/templates/job-bootstrap.yaml +@@ -30,6 +30,11 @@ metadata: + name: {{ $serviceAccountName | quote }} + labels: + application: {{ $serviceAccountName | quote }} ++ annotations: ++{{- if .Values.helm3_hook }} ++ helm.sh/hook: post-install,post-upgrade ++ helm.sh/hook-weight: "2" ++{{- end }} + spec: + template: + metadata: +diff --git a/nova/templates/job-cell-setup.yaml b/nova/templates/job-cell-setup.yaml +index 6fd8bca4..0fe686b6 100644 +--- a/nova/templates/job-cell-setup.yaml ++++ b/nova/templates/job-cell-setup.yaml +@@ -25,6 +25,10 @@ metadata: + labels: + {{ tuple $envAll "nova" "cell-setup" | 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: "1" ++{{- end }} + {{ tuple $envAll | include "helm-toolkit.snippets.release_uuid" }} + spec: + template: +-- +2.25.1 +