From f41fc0543f0341c631e8695c8c226f3cb1195d17 Mon Sep 17 00:00:00 2001 From: Vladimir Vagaytsev Date: Thu, 21 Sep 2023 13:37:54 +0200 Subject: [PATCH] fix(k8s): handle AEC-paused resources properly This is a follow-up quickfix for #4846. It reads a specific annotation and checks if it has a special value set by Cloud. This needs to be changed to reply on a more generic and reliable way of k8s resource comparison. --- .../plugins/kubernetes/kubernetes-type/handlers.ts | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/core/src/plugins/kubernetes/kubernetes-type/handlers.ts b/core/src/plugins/kubernetes/kubernetes-type/handlers.ts index c0077af48e..a4e3981ad5 100644 --- a/core/src/plugins/kubernetes/kubernetes-type/handlers.ts +++ b/core/src/plugins/kubernetes/kubernetes-type/handlers.ts @@ -253,9 +253,16 @@ async function getResourceStatuses({ metadata: { name: m.name, namespace: m.namespace }, } return { resource: missingResource, state: "missing" } as ResourceStatus - } else { - return await resolveResourceStatus({ api, namespace, resource, log }) } + + // Check if AEC has paused the resource + const manifestHashAnnotationKey = gardenAnnotationKey("manifest-hash") + const manifestHash = resource.metadata?.annotations?.[manifestHashAnnotationKey] + if (manifestHash === "paused-by-aec") { + return { resource, state: "outdated" } as ResourceStatus + } + + return await resolveResourceStatus({ api, namespace, resource, log }) }) ) }