From 6296b178df436c970b105243c36fa303a2e30b63 Mon Sep 17 00:00:00 2001 From: Adrian Berger <43774417+adberger@users.noreply.github.com> Date: Wed, 14 Aug 2024 20:21:29 +0200 Subject: [PATCH] feat: Add suspended status in custom resource health for flux resources (#19508) Signed-off-by: Adrian Berger --- .../helm.toolkit.fluxcd.io/HelmRelease/health.lua | 5 +++++ .../image.toolkit.fluxcd.io/ImageRepository/health.lua | 5 +++++ .../image.toolkit.fluxcd.io/ImageUpdateAutomation/health.lua | 5 +++++ .../kustomize.toolkit.fluxcd.io/Kustomization/health.lua | 5 +++++ .../notification.toolkit.fluxcd.io/Receiver/health.lua | 5 +++++ .../source.toolkit.fluxcd.io/Bucket/health.lua | 5 +++++ .../source.toolkit.fluxcd.io/GitRepository/health.lua | 5 +++++ .../source.toolkit.fluxcd.io/HelmChart/health.lua | 5 +++++ .../source.toolkit.fluxcd.io/HelmRepository/health.lua | 5 +++++ .../source.toolkit.fluxcd.io/OCIRepository/health.lua | 5 +++++ 10 files changed, 50 insertions(+) diff --git a/resource_customizations/helm.toolkit.fluxcd.io/HelmRelease/health.lua b/resource_customizations/helm.toolkit.fluxcd.io/HelmRelease/health.lua index 292f96c29a..dd062f92e7 100644 --- a/resource_customizations/helm.toolkit.fluxcd.io/HelmRelease/health.lua +++ b/resource_customizations/helm.toolkit.fluxcd.io/HelmRelease/health.lua @@ -1,4 +1,9 @@ local hs = {} +if obj.spec.suspend ~= nil and obj.spec.suspend == true then + hs.message = obj.kind .. " is suspended" + hs.status = "Suspended" + return hs +end if obj.status ~= nil then if obj.status.conditions ~= nil then local numProgressing = 0 diff --git a/resource_customizations/image.toolkit.fluxcd.io/ImageRepository/health.lua b/resource_customizations/image.toolkit.fluxcd.io/ImageRepository/health.lua index c2b6f7b41e..aa65850494 100644 --- a/resource_customizations/image.toolkit.fluxcd.io/ImageRepository/health.lua +++ b/resource_customizations/image.toolkit.fluxcd.io/ImageRepository/health.lua @@ -1,4 +1,9 @@ local hs = {} +if obj.spec.suspend ~= nil and obj.spec.suspend == true then + hs.message = obj.kind .. " is suspended" + hs.status = "Suspended" + return hs +end if obj.status ~= nil then if obj.status.conditions ~= nil then local numProgressing = 0 diff --git a/resource_customizations/image.toolkit.fluxcd.io/ImageUpdateAutomation/health.lua b/resource_customizations/image.toolkit.fluxcd.io/ImageUpdateAutomation/health.lua index c202d98979..b4f27ab073 100644 --- a/resource_customizations/image.toolkit.fluxcd.io/ImageUpdateAutomation/health.lua +++ b/resource_customizations/image.toolkit.fluxcd.io/ImageUpdateAutomation/health.lua @@ -1,4 +1,9 @@ local hs = {} +if obj.spec.suspend ~= nil and obj.spec.suspend == true then + hs.message = obj.kind .. " is suspended" + hs.status = "Suspended" + return hs +end if obj.status ~= nil then if obj.status.conditions ~= nil then local numProgressing = 0 diff --git a/resource_customizations/kustomize.toolkit.fluxcd.io/Kustomization/health.lua b/resource_customizations/kustomize.toolkit.fluxcd.io/Kustomization/health.lua index c202d98979..b4f27ab073 100644 --- a/resource_customizations/kustomize.toolkit.fluxcd.io/Kustomization/health.lua +++ b/resource_customizations/kustomize.toolkit.fluxcd.io/Kustomization/health.lua @@ -1,4 +1,9 @@ local hs = {} +if obj.spec.suspend ~= nil and obj.spec.suspend == true then + hs.message = obj.kind .. " is suspended" + hs.status = "Suspended" + return hs +end if obj.status ~= nil then if obj.status.conditions ~= nil then local numProgressing = 0 diff --git a/resource_customizations/notification.toolkit.fluxcd.io/Receiver/health.lua b/resource_customizations/notification.toolkit.fluxcd.io/Receiver/health.lua index d5ff729520..1586e9d50c 100644 --- a/resource_customizations/notification.toolkit.fluxcd.io/Receiver/health.lua +++ b/resource_customizations/notification.toolkit.fluxcd.io/Receiver/health.lua @@ -1,4 +1,9 @@ local hs = {} +if obj.spec.suspend ~= nil and obj.spec.suspend == true then + hs.message = obj.kind .. " is suspended" + hs.status = "Suspended" + return hs +end if obj.status ~= nil then if obj.status.conditions ~= nil then local numFailing = 0 diff --git a/resource_customizations/source.toolkit.fluxcd.io/Bucket/health.lua b/resource_customizations/source.toolkit.fluxcd.io/Bucket/health.lua index 7aecc389cb..9ad39cb708 100644 --- a/resource_customizations/source.toolkit.fluxcd.io/Bucket/health.lua +++ b/resource_customizations/source.toolkit.fluxcd.io/Bucket/health.lua @@ -1,4 +1,9 @@ local hs = {} +if obj.spec.suspend ~= nil and obj.spec.suspend == true then + hs.message = obj.kind .. " is suspended" + hs.status = "Suspended" + return hs +end if obj.status ~= nil then if obj.status.conditions ~= nil then local numProgressing = 0 diff --git a/resource_customizations/source.toolkit.fluxcd.io/GitRepository/health.lua b/resource_customizations/source.toolkit.fluxcd.io/GitRepository/health.lua index 7aecc389cb..9ad39cb708 100644 --- a/resource_customizations/source.toolkit.fluxcd.io/GitRepository/health.lua +++ b/resource_customizations/source.toolkit.fluxcd.io/GitRepository/health.lua @@ -1,4 +1,9 @@ local hs = {} +if obj.spec.suspend ~= nil and obj.spec.suspend == true then + hs.message = obj.kind .. " is suspended" + hs.status = "Suspended" + return hs +end if obj.status ~= nil then if obj.status.conditions ~= nil then local numProgressing = 0 diff --git a/resource_customizations/source.toolkit.fluxcd.io/HelmChart/health.lua b/resource_customizations/source.toolkit.fluxcd.io/HelmChart/health.lua index 7aecc389cb..9ad39cb708 100644 --- a/resource_customizations/source.toolkit.fluxcd.io/HelmChart/health.lua +++ b/resource_customizations/source.toolkit.fluxcd.io/HelmChart/health.lua @@ -1,4 +1,9 @@ local hs = {} +if obj.spec.suspend ~= nil and obj.spec.suspend == true then + hs.message = obj.kind .. " is suspended" + hs.status = "Suspended" + return hs +end if obj.status ~= nil then if obj.status.conditions ~= nil then local numProgressing = 0 diff --git a/resource_customizations/source.toolkit.fluxcd.io/HelmRepository/health.lua b/resource_customizations/source.toolkit.fluxcd.io/HelmRepository/health.lua index 7aecc389cb..9ad39cb708 100644 --- a/resource_customizations/source.toolkit.fluxcd.io/HelmRepository/health.lua +++ b/resource_customizations/source.toolkit.fluxcd.io/HelmRepository/health.lua @@ -1,4 +1,9 @@ local hs = {} +if obj.spec.suspend ~= nil and obj.spec.suspend == true then + hs.message = obj.kind .. " is suspended" + hs.status = "Suspended" + return hs +end if obj.status ~= nil then if obj.status.conditions ~= nil then local numProgressing = 0 diff --git a/resource_customizations/source.toolkit.fluxcd.io/OCIRepository/health.lua b/resource_customizations/source.toolkit.fluxcd.io/OCIRepository/health.lua index 7aecc389cb..9ad39cb708 100644 --- a/resource_customizations/source.toolkit.fluxcd.io/OCIRepository/health.lua +++ b/resource_customizations/source.toolkit.fluxcd.io/OCIRepository/health.lua @@ -1,4 +1,9 @@ local hs = {} +if obj.spec.suspend ~= nil and obj.spec.suspend == true then + hs.message = obj.kind .. " is suspended" + hs.status = "Suspended" + return hs +end if obj.status ~= nil then if obj.status.conditions ~= nil then local numProgressing = 0