github.com/argoproj/argo-cd/v3@v3.2.1/resource_customizations/source.toolkit.fluxcd.io/HelmRepository/health.lua (about) 1 local hs = {} 2 if obj.spec.suspend ~= nil and obj.spec.suspend == true then 3 hs.message = obj.kind .. " is suspended" 4 hs.status = "Suspended" 5 return hs 6 end 7 -- Helm repositories of type "oci" do not contain any information in the status 8 -- https://fluxcd.io/flux/components/source/helmrepositories/#helmrepository-status 9 if obj.spec.type ~= nil and obj.spec.type == "oci" then 10 hs.message = "Helm repositories of type 'oci' do not contain any information in the status." 11 hs.status = "Healthy" 12 return hs 13 end 14 if obj.status ~= nil then 15 if obj.status.conditions ~= nil then 16 local numProgressing = 0 17 local numSucceeded = 0 18 local message = "" 19 for _, condition in ipairs(obj.status.conditions) do 20 if condition.type == "Ready" then 21 if condition.status == "True" then 22 numSucceeded = numSucceeded + 1 23 elseif condition.status == "Unknown" then 24 numProgressing = numProgressing + 1 25 end 26 message = condition.reason 27 elseif condition.type == "Reconciling" and condition.status == "True" then 28 numProgressing = numProgressing + 1 29 elseif condition.type == "ArtifactOutdated" and condition.status == "True" then 30 message = message .. " " .. condition.reason 31 elseif condition.type == "ArtifactInStorage" and condition.status == "True" then 32 numSucceeded = numSucceeded + 1 33 end 34 end 35 if(numProgressing == 2) then 36 hs.message = message 37 hs.status = "Progressing" 38 return hs 39 elseif(numSucceeded == 2) then 40 hs.message = message 41 hs.status = "Healthy" 42 return hs 43 else 44 hs.message = message 45 hs.status = "Degraded" 46 return hs 47 end 48 end 49 end 50 hs.message = "Status unknown" 51 hs.status = "Progressing" 52 return hs