in nuvolaris/patcher.py [0:0]
def patch(diff, status, owner=None, name=None):
"""
Implements the patching logic of the nuvolaris operator by analyzing the kopf
provided diff object to identify which components needs to be added/removed.
"""
logging.info(status)
what_to_do = kopf_util.detect_component_changes(diff)
if len(what_to_do) == 0:
logging.warn("*** no relevant changes identified by the operator patcher. Skipping processing")
return None
for key in what_to_do.keys():
logging.info(f"{key}={what_to_do[key]}")
components_updated = False
# components 1st
if "postgres" in what_to_do:
postgres.patch(status,what_to_do['postgres'], owner)
components_updated = True
if "mongodb" in what_to_do:
mongodb.patch(status,what_to_do['mongodb'], owner)
components_updated = True
if "redis" in what_to_do:
redis.patch(status,what_to_do['redis'], owner)
components_updated = True
if "cron" in what_to_do:
cron.patch(status,what_to_do['cron'], owner)
components_updated = True
if "minio" in what_to_do:
minio.patch(status,what_to_do['minio'], owner)
components_updated = True
if "static" in what_to_do:
static.patch(status,what_to_do['static'], owner)
components_updated = True
if "quota" in what_to_do:
quota.patch(status,what_to_do['quota'], owner)
components_updated = True
if "etcd" in what_to_do:
etcd.patch(status,what_to_do['etcd'], owner)
components_updated = True
if "milvus" in what_to_do:
milvus.patch(status,what_to_do['milvus'], owner)
components_updated = True
# handle update action on openwhisk
if "openwhisk" in what_to_do and what_to_do['openwhisk'] == "update":
redeploy_whisk(owner)
components_updated = True
# handle update action on endpoint
if "endpoint" in what_to_do and what_to_do['endpoint'] == "update":
issuer.patch(status,what_to_do['endpoint'], owner)
endpoint.patch(status,what_to_do['endpoint'], owner)
if "minio-ingresses" in what_to_do and what_to_do['minio-ingresses'] == "update":
minio.patch_ingresses(status,what_to_do['minio-ingresses'], owner)
if components_updated:
operator_util.whisk_post_create(name)