github.com/argoproj/argo-cd/v3@v3.2.1/resource_customizations/source.toolkit.fluxcd.io/HelmChart/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 == "Unknown" then
    17            numProgressing = numProgressing + 1
    18          end
    19          message = condition.reason
    20        elseif condition.type == "Reconciling" and condition.status == "True" then
    21          numProgressing = numProgressing + 1
    22        elseif condition.type == "ArtifactOutdated" and condition.status == "True" then
    23          message = message .. " " .. condition.reason
    24        elseif condition.type == "ArtifactInStorage" and condition.status == "True" then
    25          numSucceeded = numSucceeded + 1
    26        end
    27      end
    28      if(numProgressing == 2) then
    29        hs.message = message
    30        hs.status = "Progressing"
    31        return hs
    32      elseif(numSucceeded == 2) then
    33        hs.message = message
    34        hs.status = "Healthy"
    35        return hs
    36      else
    37        hs.message = message
    38        hs.status = "Degraded"
    39        return hs
    40      end
    41    end
    42  end
    43  hs.message = "Status unknown"
    44  hs.status = "Progressing"
    45  return hs