From 156a254ef851229825dce0b2e6d020e0d67d8347 Mon Sep 17 00:00:00 2001 From: Robert Church Date: Wed, 17 Jul 2019 14:14:45 -0400 Subject: [PATCH] Fix generic application deletions Extend the use of the ArmadaManifestOperator to generic applications even though they are not delivered with helm plugin support. This will provide a unified approach to using a deletion manifest for all applications during 'armada delete' operations. Change-Id: I5a23cdbc940c7fbe1a51a026728893b90a4bdb85 Closes-Bug: #1836922 Signed-off-by: Robert Church --- .../sysinv/sysinv/conductor/kube_app.py | 3 +- sysinv/sysinv/sysinv/sysinv/helm/helm.py | 32 +++++++++---------- 2 files changed, 18 insertions(+), 17 deletions(-) diff --git a/sysinv/sysinv/sysinv/sysinv/conductor/kube_app.py b/sysinv/sysinv/sysinv/sysinv/conductor/kube_app.py index e43e3828cc..f4e670e08a 100644 --- a/sysinv/sysinv/sysinv/sysinv/conductor/kube_app.py +++ b/sysinv/sysinv/sysinv/sysinv/conductor/kube_app.py @@ -2121,10 +2121,11 @@ class DockerHelper(object): cmd = "/bin/bash -c 'set -o pipefail; armada delete --debug " +\ "--manifest " + manifest_delete_file + tiller_host + " | tee " +\ logfile + "'" + LOG.info("Armada delete command = %s" % cmd) (exit_code, exec_logs) = armada_svc.exec_run(cmd) if exit_code == 0: LOG.info("Application charts were successfully " - "deleted.") + "deleted with manifest %s." % manifest_delete_file) else: rc = False if exit_code == CONTAINER_ABNORMAL_EXIT_CODE: diff --git a/sysinv/sysinv/sysinv/sysinv/helm/helm.py b/sysinv/sysinv/sysinv/sysinv/helm/helm.py index 8fe0929240..940bda8450 100644 --- a/sysinv/sysinv/sysinv/sysinv/helm/helm.py +++ b/sysinv/sysinv/sysinv/sysinv/helm/helm.py @@ -482,17 +482,17 @@ class HelmOperator(object): LOG.exception("Application %s not found." % app_name) raise + # Get a manifest operator to provide a single point of manipulation for + # the chart, chart group and manifest schemas + manifest_op = manifest.ArmadaManifestOperator() + + # Load the manifest into the operator + armada_manifest = utils.generate_armada_manifest_filename_abs( + utils.generate_armada_manifest_dir(app.name, app.app_version), + app.name, app.manifest_file) + manifest_op.load(armada_manifest) + if app_name in self.helm_system_applications: - # Get a manifest operator to provide a single point of - # manipulation for the chart, chart group and manifest schemas - manifest_op = manifest.ArmadaManifestOperator() - - # Load the manifest into the operator - armada_manifest = utils.generate_armada_manifest_filename_abs( - utils.generate_armada_manifest_dir(app.name, app.app_version), - app.name, app.manifest_file) - manifest_op.load(armada_manifest) - app_overrides = self._get_helm_application_overrides(app_name, cnamespace) for (chart_name, overrides) in iteritems(app_overrides): @@ -550,12 +550,6 @@ class HelmOperator(object): manifest.platform_mode_manifest_updates( self.dbapi, manifest_op, app_name, mode) - # Write the manifest doc overrides, a summmary file for easy --value - # generation on the apply, and a unified manifest for deletion. - manifest_op.save_overrides() - manifest_op.save_summary(path=path) - manifest_op.save_delete_manifest() - else: # Generic applications for chart in armada_chart_info: @@ -596,6 +590,12 @@ class HelmOperator(object): self._write_chart_overrides(path, chart.name, cnamespace, user_overrides) + # Write the manifest doc overrides, a summmary file for easy --value + # generation on the apply, and a unified manifest for deletion. + manifest_op.save_overrides() + manifest_op.save_summary(path=path) + manifest_op.save_delete_manifest() + def remove_helm_chart_overrides(self, path, chart_name, cnamespace=None): """Remove the overrides files for a chart"""