The kubernetes master and worker charm both have an import error bug that impacts charm upgrades.
# contents of reactive/kubernetes_master_worker_base.py
@when_any('kubernetes-master.snaps.installed', 'kubernetes-worker.snaps.installed')
@when('snap.refresh.set')
@when('leadership.is_leader')
def process_snapd_timer():
''' Set the snapd refresh timer on the leader so all cluster members
(present and future) will refresh near the same time. '''
# Get the current snapd refresh timer; we know layer-snap has set this
# when the 'snap.refresh.set' flag is present.
timer = snap.get( snapname='core', key='refresh.timer').decode('utf-8').strip()
if not timer:
# The core snap timer is empty. This likely means a subordinate timer
# reset ours. Try to set it back to a previously leader-set value,
# falling back to config if needed. Luckily, this should only happen
# during subordinate install, so this should remain stable afterward.
timer = leader_get('snapd_refresh') or hookenv.config('snapd_refresh') snap.set_refresh_timer(timer)
# Ensure we have the timer known by snapd (it may differ from config).
timer = snap.get( snapname='core', key='refresh.timer').decode('utf-8').strip()
# The first time through, data_changed will be true. Subsequent calls
# should only update leader data if something changed.
if data_changed('snapd_refresh', timer): hookenv.log('setting leader snapd_refresh timer to: {}'.format(timer)) leadership.leader_set({'snapd_refresh': timer})
The kubernetes master and worker charm both have an import error bug that impacts charm upgrades. kubernetes_ master_ worker_ base.py
# contents of reactive/
@when_any( 'kubernetes- master. snaps.installed ',
'kubernetes- worker. snaps.installed ') snap.refresh. set') leadership. is_leader' ) snapd_timer( ):
snapname= 'core', key='refresh. timer') .decode( 'utf-8' ).strip( ) get('snapd_ refresh' ) or hookenv. config( 'snapd_ refresh' )
snap.set_ refresh_ timer(timer)
@when('
@when('
def process_
''' Set the snapd refresh timer on the leader so all cluster members
(present and future) will refresh near the same time. '''
# Get the current snapd refresh timer; we know layer-snap has set this
# when the 'snap.refresh.set' flag is present.
timer = snap.get(
if not timer:
# The core snap timer is empty. This likely means a subordinate timer
# reset ours. Try to set it back to a previously leader-set value,
# falling back to config if needed. Luckily, this should only happen
# during subordinate install, so this should remain stable afterward.
timer = leader_
# Ensure we have the timer known by snapd (it may differ from config).
snapname= 'core', key='refresh. timer') .decode( 'utf-8' ).strip( )
timer = snap.get(
# The first time through, data_changed will be true. Subsequent calls 'snapd_ refresh' , timer):
hookenv. log('setting leader snapd_refresh timer to: {}'.format(timer))
leadership. leader_ set({'snapd_ refresh' : timer})
# should only update leader data if something changed.
if data_changed(