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 <thaleselero.cervi@windriver.com>
Change-Id: Ic3833d2f87d9a1502b1a3de2780ba76774d2fa8e
This commit is contained in:
Thales Elero Cervi 2022-09-21 12:58:26 -03:00
parent 02378565cc
commit e60e80155a
4 changed files with 117 additions and 0 deletions

View File

@ -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

View File

@ -0,0 +1,57 @@
From 63ffa8ad9c1e212383190aa4a21bd5999a233b12 Mon Sep 17 00:00:00 2001
From: Thales Elero Cervi <thaleselero.cervi@windriver.com>
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 <thaleselero.cervi@windriver.com>
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

View File

@ -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

View File

@ -0,0 +1,57 @@
From 63ffa8ad9c1e212383190aa4a21bd5999a233b12 Mon Sep 17 00:00:00 2001
From: Thales Elero Cervi <thaleselero.cervi@windriver.com>
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 <thaleselero.cervi@windriver.com>
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