From 9d2f0eb299e74e15d4504e09976cc02d512e6dc9 Mon Sep 17 00:00:00 2001 From: Daniel Caires Date: Mon, 19 Aug 2024 14:51:57 -0300 Subject: [PATCH] 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 --- .../fm-rest-api/templates/job-pre-apply-cleanup.yaml | 10 ++++++++++ .../fm-rest-api/helm-charts/fm-rest-api/values.yaml | 2 ++ 2 files changed, 12 insertions(+) create mode 100644 fm-rest-api/fm-rest-api/helm-charts/fm-rest-api/templates/job-pre-apply-cleanup.yaml diff --git a/fm-rest-api/fm-rest-api/helm-charts/fm-rest-api/templates/job-pre-apply-cleanup.yaml b/fm-rest-api/fm-rest-api/helm-charts/fm-rest-api/templates/job-pre-apply-cleanup.yaml new file mode 100644 index 0000000..b08bb79 --- /dev/null +++ b/fm-rest-api/fm-rest-api/helm-charts/fm-rest-api/templates/job-pre-apply-cleanup.yaml @@ -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 }} \ No newline at end of file diff --git a/fm-rest-api/fm-rest-api/helm-charts/fm-rest-api/values.yaml b/fm-rest-api/fm-rest-api/helm-charts/fm-rest-api/values.yaml index e546bf2..a860569 100644 --- a/fm-rest-api/fm-rest-api/helm-charts/fm-rest-api/values.yaml +++ b/fm-rest-api/fm-rest-api/helm-charts/fm-rest-api/values.yaml @@ -25,6 +25,7 @@ images: db_init: 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 + pre_apply_cleanup: docker.io/starlingx/stx-vault-manager:master-debian-stable-latest pullPolicy: IfNotPresent local_registry: active: false @@ -183,6 +184,7 @@ manifests: configmap_etc: true deployment_fm_rest_api: true ingress: true + job_pre_apply_cleanup: true job_ks_endpoints: true job_db_init: true job_db_sync: true