Move deploy_memcache to utils

Change-Id: I52eb33da08025834b73dcccbf4428afa31026b13
This commit is contained in:
Mohammed Naser 2020-08-09 08:48:06 -04:00
parent 67e6c49f60
commit 46ba8104c9
2 changed files with 12 additions and 11 deletions
openstack_operator

@ -55,16 +55,6 @@ def operator_configmap(namespace, name, **_):
and name == "operator-config"
async def deploy_memcached(item, **_):
"""
Deploy a generic instance of Memcached
This function deploys a generic instance of Memcached with sane defaults,
it's meant to be here to be consumed/called by the function below.
"""
utils.create_or_update('operator/memcached.yml.j2', name=item, adopt=True)
@kopf.on.resume('', 'v1', 'configmaps', when=operator_configmap)
@kopf.on.create('', 'v1', 'configmaps', when=operator_configmap)
@kopf.on.update('', 'v1', 'configmaps', when=operator_configmap)
@ -85,7 +75,8 @@ async def deploy_memcacheds(body, **_):
module = entry_point.load()
if hasattr(module, 'MEMCACHED') and module.MEMCACHED:
fns[entry_point.name] = \
functools.partial(deploy_memcached, item=entry_point.name)
functools.partial(utils.deploy_memcached,
item=entry_point.name)
await kopf.execute(fns=fns)

@ -285,3 +285,13 @@ def get_backup_schedule(name):
if name not in BACKUP_SCHEDULE:
return "0 0 * * * *"
return BACKUP_SCHEDULE[name]
async def deploy_memcached(item, **_):
"""
Deploy a generic instance of Memcached
This function deploys a generic instance of Memcached with sane defaults,
it's meant to be here to be consumed/called by the serices.
"""
create_or_update('operator/memcached.yml.j2', name=item, adopt=True)