github.com/argoproj/argo-cd/v2@v2.10.9/resource_customizations/kubevirt.io/VirtualMachineInstance/health.lua (about)

     1  local hs = { status="Progressing", message="No status available"}
     2  if obj.status ~= nil then
     3    if obj.status.phase ~= nil then
     4      hs.message = obj.status.phase
     5      if hs.message == "Failed" then
     6        hs.status = "Degraded"
     7        return hs
     8      elseif hs.message == "Pending" or hs.message == "Scheduling" or hs.message == "Scheduled" then
     9        return hs
    10      elseif hs.message == "Succeeded" then
    11        hs.status = "Suspended"
    12        return hs
    13      elseif hs.message == "Unknown" then
    14        hs.status = "Unknown"
    15        return hs
    16      end
    17    end
    18    if obj.status.conditions ~= nil then
    19      for i, condition in ipairs(obj.status.conditions) do
    20        if condition.type == "Ready" then
    21          if condition.status == "True" then
    22            hs.status = "Healthy"
    23            hs.message = "Running"
    24          else
    25            hs.status = "Degraded"
    26            hs.message = condition.message
    27          end
    28        elseif condition.type == "Paused" and condition.status == "True" then
    29          hs.status = "Suspended"
    30          hs.message = condition.message
    31          return hs
    32        end
    33      end
    34    end
    35  end
    36  return hs