github.com/argoproj/argo-cd/v3@v3.2.1/resource_customizations/image.toolkit.fluxcd.io/ImageRepository/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  if obj.status ~= nil then
     8    if obj.status.conditions ~= nil then
     9      local numProgressing = 0
    10      local numSucceeded = 0
    11      local message = ""
    12      for _, condition in ipairs(obj.status.conditions) do
    13        if condition.type == "Ready" then
    14          if condition.status == "True" then
    15            numSucceeded = numSucceeded + 1
    16          elseif condition.status == "False" then
    17            numProgressing = numProgressing + 1
    18          end
    19          message = condition.reason
    20        elseif condition.type == "Reconciling" and condition.status == "True" then
    21          if condition.reason == "NewGeneration" or condition.reason == "Scanning" then
    22            numProgressing = numProgressing + 1
    23          end
    24        end
    25      end
    26      if(numProgressing == 2) then
    27        hs.message = message
    28        hs.status = "Progressing"
    29        return hs
    30      elseif(numSucceeded == 1) then
    31        hs.message = message
    32        hs.status = "Healthy"
    33        return hs
    34      else
    35        hs.message = message
    36        hs.status = "Degraded"
    37        return hs
    38      end
    39    end
    40  end
    41  hs.message = "Status unknown"
    42  hs.status = "Progressing"
    43  return hs