github.com/argoproj/argo-cd/v2@v2.10.9/resource_customizations/operators.coreos.com/Subscription/health.lua (about) 1 local health_status = {} 2 if obj.status ~= nil then 3 if obj.status.conditions ~= nil then 4 local numDegraded = 0 5 local numPending = 0 6 local msg = "" 7 for i, condition in pairs(obj.status.conditions) do 8 msg = msg .. i .. ": " .. condition.type .. " | " .. condition.status .. "\n" 9 if condition.type == "InstallPlanPending" and condition.status == "True" then 10 numPending = numPending + 1 11 elseif (condition.type == "InstallPlanMissing" and condition.reason ~= "ReferencedInstallPlanNotFound") then 12 numDegraded = numDegraded + 1 13 elseif (condition.type == "CatalogSourcesUnhealthy" or condition.type == "InstallPlanFailed" or condition.type == "ResolutionFailed") and condition.status == "True" then 14 numDegraded = numDegraded + 1 15 end 16 end 17 if numDegraded == 0 and numPending == 0 then 18 health_status.status = "Healthy" 19 health_status.message = msg 20 return health_status 21 elseif numPending > 0 and numDegraded == 0 then 22 health_status.status = "Progressing" 23 health_status.message = "An install plan for a subscription is pending installation" 24 return health_status 25 else 26 health_status.status = "Degraded" 27 health_status.message = msg 28 return health_status 29 end 30 end 31 end 32 health_status.status = "Progressing" 33 health_status.message = "An install plan for a subscription is pending installation" 34 return health_status