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 <robert.church@windriver.com>
This commit is contained in:
Robert Church 2019-07-17 14:14:45 -04:00
parent a3538d7377
commit 156a254ef8
2 changed files with 18 additions and 17 deletions

View File

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

View File

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