github.com/argoproj/argo-cd/v3@v3.2.1/resource_customizations/image.toolkit.fluxcd.io/ImagePolicy/health.lua (about)

     1  local hs = {}
     2  if obj.status ~= nil then
     3    if obj.status.conditions ~= nil then
     4      local numProgressing = 0
     5      local numSucceeded = 0
     6      local message = ""
     7      for _, condition in ipairs(obj.status.conditions) do
     8        if condition.type == "Ready" then
     9          if condition.status == "True" then
    10            numSucceeded = numSucceeded + 1
    11          elseif condition.status == "False" then
    12            numProgressing = numProgressing + 1
    13          end
    14          message = condition.reason
    15        elseif condition.type == "Reconciling" and condition.status == "True" then
    16          if condition.reason == "NewGeneration" or condition.reason == "AccessingRepository" or condition.reason == "ApplyingPolicy" then
    17            numProgressing = numProgressing + 1
    18          end
    19        end
    20      end
    21      if(numProgressing == 2) then
    22        hs.message = message
    23        hs.status = "Progressing"
    24        return hs
    25      elseif(numSucceeded == 1) then
    26        hs.message = message
    27        hs.status = "Healthy"
    28        return hs
    29      else
    30        hs.message = message
    31        hs.status = "Degraded"
    32        return hs
    33      end
    34    end
    35  end
    36  hs.message = "Status unknown"
    37  hs.status = "Progressing"
    38  return hs