From d11ac36c05ca361184f45357dd7be7956268780a Mon Sep 17 00:00:00 2001 From: Venkat Date: Mon, 9 Mar 2026 04:02:56 +0000 Subject: [PATCH 1/2] fix: preserve externalTrafficPolicy when syncing services --- webhook-server/app/main.py | 1 + 1 file changed, 1 insertion(+) diff --git a/webhook-server/app/main.py b/webhook-server/app/main.py index 4333415..73f59a2 100644 --- a/webhook-server/app/main.py +++ b/webhook-server/app/main.py @@ -174,6 +174,7 @@ def sync(request: dict): ports=service_ports, type="ClusterIP", external_i_ps=public_ips+private_ips, + external_traffic_policy=service['spec'].get('externalTrafficPolicy'), ip_family_policy=service['spec'].get('ipFamilyPolicy'), session_affinity=service['spec'].get('sessionAffinity') ) From 91f5b38a128b9e102388ddfe0ccc6c9e60874015 Mon Sep 17 00:00:00 2001 From: Bazmahou Date: Mon, 9 Mar 2026 15:19:31 +0000 Subject: [PATCH 2/2] feat: use replace instead of patch for kubernetes services --- webhook-server/app/main.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/webhook-server/app/main.py b/webhook-server/app/main.py index 73f59a2..667c53a 100644 --- a/webhook-server/app/main.py +++ b/webhook-server/app/main.py @@ -35,7 +35,7 @@ def apply_custom_object(group, version, namespace, plural, body): if e.status == 409: print(f"{resource_name} already exists. Patching (updating)...") try: - custom_api.patch_namespaced_custom_object( + custom_api.replace_namespaced_custom_object( group=group, version=version, namespace=namespace, @@ -187,16 +187,16 @@ def sync(request: dict): print(f"Successfully created internal service {internal_service.metadata.name}") except ApiException as e: if e.status == 409: - print(f"Internal service {internal_service.metadata.name} already exists. Patching (updating)...") + print(f"Internal service {internal_service.metadata.name} already exists. Replacing (updating)...") try: - v1.patch_namespaced_service( + v1.replace_namespaced_service( name=internal_service.metadata.name, namespace=service['metadata']['namespace'], body=internal_service ) print(f"Successfully updated internal service {internal_service.metadata.name}") except ApiException as e_patch: - print(f"Failed to patch internal service: {e_patch}") + print(f"Failed to replace internal service: {e_patch}") else: print(f"Failed to create internal service: {e}") raise e