github.com/argoproj/argo-cd/v3@v3.2.1/resource_customizations/gateway.solo.io/RouteTable/health.lua (about)

     1  hs = {
     2    status = "Progressing",
     3    message = "Update in progress"
     4  }
     5  
     6  function getStatus(status)
     7    -- Accepted
     8    if status.state == "Accepted" or status.state == 1 then
     9      hs.status = "Healthy"
    10      hs.message = "The resource has been validated"
    11      return hs
    12    end
    13  
    14    -- Warning
    15    if status.state == "Warning" or status.state == 3 then
    16      hs.status = "Degraded"
    17      hs.message = status.reason
    18      return hs
    19    end
    20  
    21    -- Pending
    22    if status.state == "Pending" or status.state == 0 then
    23      hs.status = "Suspended"
    24      hs.message = "The resource has not yet been validated"
    25      return hs
    26    end
    27  
    28    -- Rejected
    29    if status.state == "Rejected" or status.state == 2 then
    30      hs.status = "Degraded"
    31      hs.message = status.reason
    32      return hs
    33    end
    34  
    35    return hs
    36  end
    37  
    38  if obj.status ~= nil then
    39    -- Namespaced version of status
    40    if obj.status.statuses ~= nil then
    41      for i, namespace in pairs(obj.status.statuses) do
    42        hs = getStatus(namespace)
    43        if hs.status ~= "Progressing" then
    44          return hs
    45        end
    46      end
    47    end
    48  
    49    -- Older non-namespaced version of status
    50    if obj.status.state ~= nil then
    51      hs = getStatus(obj.status)
    52    end
    53  end
    54  return hs