Merge "Allow wait labels without timeout"
This commit is contained in:
commit
f9bb19c52d
|
@ -273,6 +273,8 @@ class Armada(object):
|
||||||
namespace = chart.get('namespace')
|
namespace = chart.get('namespace')
|
||||||
release = chart.get('release')
|
release = chart.get('release')
|
||||||
release_name = release_prefixer(prefix, release)
|
release_name = release_prefixer(prefix, release)
|
||||||
|
LOG.info('Processing Chart, release=%s', release_name)
|
||||||
|
|
||||||
values = chart.get('values', {})
|
values = chart.get('values', {})
|
||||||
pre_actions = {}
|
pre_actions = {}
|
||||||
post_actions = {}
|
post_actions = {}
|
||||||
|
@ -304,23 +306,43 @@ class Armada(object):
|
||||||
self.tiller.uninstall_release(release_name)
|
self.tiller.uninstall_release(release_name)
|
||||||
msg['purge'].append(release_name)
|
msg['purge'].append(release_name)
|
||||||
|
|
||||||
wait_timeout = self.timeout
|
# NOTE(MarshM): Calculating `wait_timeout` is unfortunately
|
||||||
wait_labels = {}
|
# overly complex. The order of precedence is currently:
|
||||||
# Retrieve appropriate timeout value
|
# 1) User provided override via API/CLI (default 0 if not
|
||||||
if wait_timeout <= 0:
|
# provided by client/user).
|
||||||
# TODO(MarshM): chart's `data.timeout` should be deprecated
|
# 2) Chart's `data.wait.timeout`, or...
|
||||||
chart_timeout = chart.get('timeout', 0)
|
# 3) Chart's `data.timeout` (deprecated).
|
||||||
# Favor data.wait.timeout over data.timeout, until removed
|
# 4) const.DEFAULT_CHART_TIMEOUT, if nothing is ever
|
||||||
|
# specified, for use in waiting for final ChartGroup
|
||||||
|
# health and helm tests, but ignored for the actual
|
||||||
|
# install/upgrade of the Chart.
|
||||||
|
# NOTE(MarshM): Not defining a timeout has a side effect of
|
||||||
|
# allowing Armada to install charts with a circular
|
||||||
|
# dependency defined between components.
|
||||||
|
|
||||||
|
# TODO(MarshM): Deprecated, remove the following block
|
||||||
|
deprecated_timeout = chart.get('timeout', None)
|
||||||
|
if isinstance(deprecated_timeout, int):
|
||||||
|
LOG.warn('The `timeout` key is deprecated and support '
|
||||||
|
'for this will be removed soon. Use '
|
||||||
|
'`wait.timeout` instead.')
|
||||||
|
|
||||||
wait_values = chart.get('wait', {})
|
wait_values = chart.get('wait', {})
|
||||||
wait_timeout = wait_values.get('timeout', chart_timeout)
|
|
||||||
wait_labels = wait_values.get('labels', {})
|
wait_labels = wait_values.get('labels', {})
|
||||||
|
wait_timeout = self.timeout
|
||||||
|
if wait_timeout <= 0:
|
||||||
|
wait_timeout = wait_values.get('timeout', wait_timeout)
|
||||||
|
# TODO(MarshM): Deprecated, remove the following check
|
||||||
|
if wait_timeout <= 0:
|
||||||
|
wait_timeout = deprecated_timeout or wait_timeout
|
||||||
|
|
||||||
# Determine wait logic
|
# Determine wait logic
|
||||||
this_chart_should_wait = (cg_sequenced or self.force_wait or
|
this_chart_should_wait = (cg_sequenced or self.force_wait or
|
||||||
wait_timeout > 0 or
|
wait_timeout > 0)
|
||||||
len(wait_labels) > 0)
|
|
||||||
|
|
||||||
if this_chart_should_wait and wait_timeout <= 0:
|
# If there is still no timeout, we need to use a default
|
||||||
|
# (item 4 in note above)
|
||||||
|
if wait_timeout <= 0:
|
||||||
LOG.warn('No Chart timeout specified, using default: %ss',
|
LOG.warn('No Chart timeout specified, using default: %ss',
|
||||||
const.DEFAULT_CHART_TIMEOUT)
|
const.DEFAULT_CHART_TIMEOUT)
|
||||||
wait_timeout = const.DEFAULT_CHART_TIMEOUT
|
wait_timeout = const.DEFAULT_CHART_TIMEOUT
|
||||||
|
@ -489,7 +511,7 @@ class Armada(object):
|
||||||
labels_dict = dict(labels)
|
labels_dict = dict(labels)
|
||||||
timer = int(round(deadline - time.time()))
|
timer = int(round(deadline - time.time()))
|
||||||
LOG.info(
|
LOG.info(
|
||||||
'Final ChartGroup wait for healthy namespace (%s), '
|
'Final ChartGroup wait for healthy namespace=%s, '
|
||||||
'labels=(%s), timeout remaining: %ss.', ns, labels_dict,
|
'labels=(%s), timeout remaining: %ss.', ns, labels_dict,
|
||||||
timer)
|
timer)
|
||||||
if timer <= 0:
|
if timer <= 0:
|
||||||
|
|
Loading…
Reference in New Issue