Add appVersion check to Helm (#247)

When upgrading a Helm release include the chart's appVersion in the idempotence check. Fixes #246
This commit is contained in:
Nathan Loika
2020-10-07 13:40:59 -07:00
committed by GitHub
parent b7ec6bf79d
commit 50c82056b3
4 changed files with 87 additions and 6 deletions

View File

@@ -520,12 +520,21 @@ def main():
create_namespace=create_namespace, replace=replace)
changed = True
elif force or release_values != release_status['values'] \
or (chart_info['name'] + '-' + chart_info['version']) != release_status["chart"]:
helm_cmd = deploy(helm_cmd, release_name, release_values, chart_ref, wait, wait_timeout,
disable_hook, force, values_files=values_files, atomic=atomic,
create_namespace=create_namespace, replace=replace)
changed = True
else:
# the 'appVersion' specification is optional in a chart
chart_app_version = chart_info.get('appVersion', None)
released_app_version = release_status.get('app_version', None)
# when deployed without an 'appVersion' chart value the 'helm list' command will return the entry `app_version: ""`
appversion_is_same = (chart_app_version == released_app_version) or (chart_app_version is None and released_app_version == "")
if force or release_values != release_status['values'] \
or (chart_info['name'] + '-' + chart_info['version']) != release_status["chart"] \
or not appversion_is_same:
helm_cmd = deploy(helm_cmd, release_name, release_values, chart_ref, wait, wait_timeout,
disable_hook, force, values_files=values_files, atomic=atomic,
create_namespace=create_namespace, replace=replace)
changed = True
if module.check_mode:
check_status = {'values': {