From bd9fd49705d3f24121dd2645e87ded1374bbf222 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lauri=20V=C3=B5sandi?= Date: Tue, 13 Sep 2022 10:20:40 +0300 Subject: [PATCH] Use replace rather than patch for most resources --- meta-operator.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/meta-operator.py b/meta-operator.py index b705c71..cd8cc5e 100755 --- a/meta-operator.py +++ b/meta-operator.py @@ -105,7 +105,7 @@ async def apply_changes(operator, item, v1, revision, apps_api, api_instance): # Generate Services for name, body in transform_template(operator["spec"].get("services", [])): try: - await v1.patch_namespaced_service(name, namespace, body) + await v1.replace_namespaced_service(name, namespace, body) logger.info("Updated service %s/%s", namespace, name) except client.exceptions.ApiException: await v1.create_namespaced_service(namespace, body) @@ -114,7 +114,7 @@ async def apply_changes(operator, item, v1, revision, apps_api, api_instance): # Generate ConfigMaps for name, body in transform_template(operator["spec"].get("configmaps", [])): try: - await v1.patch_namespaced_config_map(name, namespace, body) + await v1.replace_namespaced_config_map(name, namespace, body) logger.info("Updated configmap %s/%s", namespace, name) except client.exceptions.ApiException: await v1.create_namespaced_config_map(namespace, body) @@ -125,7 +125,7 @@ async def apply_changes(operator, item, v1, revision, apps_api, api_instance): if replicas: body["spec"]["replicas"] = replicas try: - await apps_api.patch_namespaced_deployment(name, namespace, body) + await apps_api.replace_namespaced_deployment(name, namespace, body) logger.info("Updated deployment %s/%s", namespace, name) except client.exceptions.ApiException: await apps_api.create_namespaced_deployment(namespace, body) @@ -136,7 +136,7 @@ async def apply_changes(operator, item, v1, revision, apps_api, api_instance): if replicas: body["spec"]["replicas"] = replicas try: - await apps_api.patch_namespaced_stateful_set(name, namespace, body) + await apps_api.replace_namespaced_stateful_set(name, namespace, body) logger.info("Updated statefulset %s/%s", namespace, name) except client.exceptions.ApiException: await apps_api.create_namespaced_stateful_set(namespace, body)