From f13d94693fc24a3d899b7183fcc7b0135ea1b14e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafael=20Falc=C3=A3o?= Date: Mon, 19 Sep 2022 16:27:41 -0300 Subject: [PATCH] Making stx_admin (osh) helm v3 compatible The patch added by this change will make the stx_admin job syntax compatible with FluxCD (helmv3). It is necessary to add a hook-weight annotation to the resource to guarantee that all required resources will be up and running by the time of the job creation. Test Plan: PASS - build-helm-charts.sh builds a basic FluxCD and a complete Armada app tarball PASS - application upload and overrides generated PASS - application apply and check if the new hooks takes place PASS - application remove/delete Closes-Bug: 1990188 Signed-off-by: Rafael Falcao Change-Id: I83137f54eb18ba01b880e093a77b987283e5d907 --- .../patches/0007-Add-stx_admin-account.patch | 21 ++++++++++++------- .../files/0007-Add-stx_admin-account.patch | 21 ++++++++++++------- 2 files changed, 28 insertions(+), 14 deletions(-) diff --git a/openstack-helm/debian/deb_folder/patches/0007-Add-stx_admin-account.patch b/openstack-helm/debian/deb_folder/patches/0007-Add-stx_admin-account.patch index 640a9a39..f3a0cbd0 100644 --- a/openstack-helm/debian/deb_folder/patches/0007-Add-stx_admin-account.patch +++ b/openstack-helm/debian/deb_folder/patches/0007-Add-stx_admin-account.patch @@ -5,23 +5,25 @@ Subject: [PATCH] Add stx_admin account for host to communicate with openstack app lcavalca: changed content to support tls keystone +rvieiraf: added helm.sh/hook* annotations Signed-off-by: Shuicheng Lin Signed-off-by: Lucas Cavalcante +Signed-off-by: Rafael Falcao Change-Id: Iedcd131578f4e33efd3c3d7c47cbef83331b143a --- - keystone/templates/job-ks-user.yaml | 21 +++++++++++++++++++++ + keystone/templates/job-ks-user.yaml | 29 +++++++++++++++++++++++++ keystone/templates/secret-keystone.yaml | 2 +- - keystone/values.yaml | 17 +++++++++++++++++ - 3 files changed, 39 insertions(+), 1 deletion(-) + keystone/values.yaml | 17 +++++++++++++++ + 3 files changed, 47 insertions(+), 1 deletion(-) create mode 100644 keystone/templates/job-ks-user.yaml diff --git a/keystone/templates/job-ks-user.yaml b/keystone/templates/job-ks-user.yaml new file mode 100644 -index 00000000..91f990f3 +index 00000000..63d6cbb5 --- /dev/null +++ b/keystone/templates/job-ks-user.yaml -@@ -0,0 +1,24 @@ +@@ -0,0 +1,29 @@ +{{/* +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. @@ -36,8 +38,13 @@ index 00000000..91f990f3 +limitations under the License. +*/}} + ++{{- define "metadata.annotations.job.ks_user" }} ++helm.sh/hook: post-install,post-upgrade ++helm.sh/hook-weight: "5" ++{{- end }} ++ +{{- if .Values.manifests.job_ks_user }} -+{{- $ksUserJob := dict "envAll" . "serviceName" "keystone" "serviceUser" "stx_admin" -}} ++{{- $ksUserJob := dict "envAll" . "serviceName" "keystone" "serviceUser" "stx_admin" "jobAnnotations" (include "metadata.annotations.job.ks_user" . | fromYaml) -}} +{{- if .Values.manifests.certificates -}} +{{- $_ := set $ksUserJob "tlsSecret" .Values.secrets.tls.identity.api.internal -}} +{{- end -}} @@ -109,5 +116,5 @@ index 5f0e7aa1..ff4493f3 100644 pdb_api: true pod_rally_test: true -- -2.17.1 +2.25.1 diff --git a/openstack-helm/files/0007-Add-stx_admin-account.patch b/openstack-helm/files/0007-Add-stx_admin-account.patch index 742e43ed..8a11cb38 100644 --- a/openstack-helm/files/0007-Add-stx_admin-account.patch +++ b/openstack-helm/files/0007-Add-stx_admin-account.patch @@ -5,23 +5,25 @@ Subject: [PATCH] Add stx_admin account for host to communicate with openstack app lcavalca: changed content to support tls keystone +rvieiraf: added helm.sh/hook* annotations Signed-off-by: Shuicheng Lin Signed-off-by: Lucas Cavalcante +Signed-off-by: Rafael Falcao Change-Id: Iedcd131578f4e33efd3c3d7c47cbef83331b143a --- - keystone/templates/job-ks-user.yaml | 21 +++++++++++++++++++++ + keystone/templates/job-ks-user.yaml | 29 +++++++++++++++++++++++++ keystone/templates/secret-keystone.yaml | 2 +- - keystone/values.yaml | 17 +++++++++++++++++ - 3 files changed, 39 insertions(+), 1 deletion(-) + keystone/values.yaml | 17 +++++++++++++++ + 3 files changed, 47 insertions(+), 1 deletion(-) create mode 100644 keystone/templates/job-ks-user.yaml diff --git a/keystone/templates/job-ks-user.yaml b/keystone/templates/job-ks-user.yaml new file mode 100644 -index 00000000..91f990f3 +index 00000000..63d6cbb5 --- /dev/null +++ b/keystone/templates/job-ks-user.yaml -@@ -0,0 +1,24 @@ +@@ -0,0 +1,29 @@ +{{/* +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. @@ -36,8 +38,13 @@ index 00000000..91f990f3 +limitations under the License. +*/}} + ++{{- define "metadata.annotations.job.ks_user" }} ++helm.sh/hook: post-install,post-upgrade ++helm.sh/hook-weight: "5" ++{{- end }} ++ +{{- if .Values.manifests.job_ks_user }} -+{{- $ksUserJob := dict "envAll" . "serviceName" "keystone" "serviceUser" "stx_admin" -}} ++{{- $ksUserJob := dict "envAll" . "serviceName" "keystone" "serviceUser" "stx_admin" "jobAnnotations" (include "metadata.annotations.job.ks_user" . | fromYaml) -}} +{{- if .Values.manifests.certificates -}} +{{- $_ := set $ksUserJob "tlsSecret" .Values.secrets.tls.identity.api.public -}} +{{- end -}} @@ -109,5 +116,5 @@ index 5f0e7aa1..ff4493f3 100644 pdb_api: true pod_rally_test: true -- -2.17.1 +2.25.1