Add pre-apply cleanup Job to fm-rest-api

After verification, it was noted that it is not possible
to reapply STX-Openstack after a helm-override that changes
a job template since the template section of a job is
immutable or not updatable

Due to the use of kubernetes-entrypoint DEPENDENCY_JOBS it was
also noted that deleting the jobs after the application is applied
it is not an option. If this happens, the application would not
come back after a host reboot.

This review creates a Job that runs right before the Helm chart is
installed or updated. This Job deletes all jobs that have its status
as completed.

Depends-On: https://review.opendev.org/c/starlingx/openstack-armada-app/+/926561

Test Plan:
PASS - Build fm-rest-api
PASS - Deploy fm-rest-api
PASS - Reconciliate after values change to fm-rest-api
PASS - fm-rest-api pods are up after host reboot

Change-Id: I4d35a1fae339aa6d78d9076065d2613f76f30c69
Signed-off-by: Daniel Caires <DanielMarques.Caires@windriver.com>
This commit is contained in:
Daniel Caires 2024-08-19 14:51:57 -03:00
parent 0a92f83319
commit 9d2f0eb299
2 changed files with 12 additions and 0 deletions

View File

@ -0,0 +1,10 @@
{{/*
#
# SPDX-License-Identifier: Apache-2.0
#
*/}}
{{- if .Values.manifests.job_pre_apply_cleanup }}
{{- $preApplyCleanupJob := dict "envAll" . "serviceName" "fm-rest-api" -}}
{{ $preApplyCleanupJob | include "helm-toolkit.manifests.job_pre_apply_cleanup" }}
{{- end }}

View File

@ -25,6 +25,7 @@ images:
db_init: docker.io/starlingx/stx-heat:master-centos-stable-latest db_init: docker.io/starlingx/stx-heat:master-centos-stable-latest
db_drop: docker.io/starlingx/stx-heat:master-centos-stable-latest db_drop: docker.io/starlingx/stx-heat:master-centos-stable-latest
dep_check: quay.io/stackanetes/kubernetes-entrypoint:v0.3.1 dep_check: quay.io/stackanetes/kubernetes-entrypoint:v0.3.1
pre_apply_cleanup: docker.io/starlingx/stx-vault-manager:master-debian-stable-latest
pullPolicy: IfNotPresent pullPolicy: IfNotPresent
local_registry: local_registry:
active: false active: false
@ -183,6 +184,7 @@ manifests:
configmap_etc: true configmap_etc: true
deployment_fm_rest_api: true deployment_fm_rest_api: true
ingress: true ingress: true
job_pre_apply_cleanup: true
job_ks_endpoints: true job_ks_endpoints: true
job_db_init: true job_db_init: true
job_db_sync: true job_db_sync: true