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