From 89235710cd2e810955ac0899a3f6af36119cd24c Mon Sep 17 00:00:00 2001 From: Diogo Munhoz Fraga Date: Sun, 15 Feb 2026 14:20:45 -0300 Subject: [PATCH] fix(instances): propagate instance update (image/version/enabled) to kubernetes Call sync_instance after PUT so cluster deployments reflect new image, version and enabled; remove TODO and trigger sync when any of these fields change --- api/app/instances/core/instance_service.py | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/api/app/instances/core/instance_service.py b/api/app/instances/core/instance_service.py index 677efbf..415279e 100644 --- a/api/app/instances/core/instance_service.py +++ b/api/app/instances/core/instance_service.py @@ -105,10 +105,15 @@ def update_instance(self, uuid: UUID, dto: InstanceUpdate) -> Instance: if dto.enabled is not None: instance.enabled = dto.enabled - # TODO: Handle Kubernetes sync when image/version/enabled changes - # This will be implemented when Kubernetes features are migrated + updated = self.repository.update(instance) - return self.repository.update(instance) + # Propagate image/version/enabled changes to Kubernetes + if self.db and ( + dto.image is not None or dto.version is not None or dto.enabled is not None + ): + self.sync_instance(uuid) + + return updated def get_instance(self, uuid: UUID) -> Instance: """Get instance by UUID."""