github.com/argoproj/argo-cd/v2@v2.10.9/resource_customizations/serving.kserve.io/InferenceService/health.lua (about)

     1  local health_status = {}
     2  health_status.status = "Progressing"
     3  health_status.message = "Waiting for status update."
     4  if obj.status ~= nil and obj.status.conditions ~= nil then
     5    local status_true = 0
     6    local status_false = 0
     7    local status_unknown = 0
     8    health_status.message = ""
     9    for i, condition in pairs(obj.status.conditions) do
    10      if condition.status == "True" and (condition.type == "IngressReady" or condition.type == "PredictorConfigurationReady" or condition.type == "PredictorReady" or condition.type == "PredictorRouteReady" or condition.type == "Ready") then
    11        status_true = status_true + 1
    12      elseif condition.status == "False" or condition.status == "Unknown" then
    13        msg = condition.type .. " is " .. condition.status
    14        if condition.reason ~= nil and condition.reason ~= "" then
    15          msg = msg .. ", since " .. condition.reason .. "."
    16        end
    17        if condition.message ~= nil and condition.message ~= "" then
    18          msg = msg .. " " .. condition.message
    19        end
    20        health_status.message = health_status.message .. msg .. "\n"
    21        if condition.status == "False" then
    22          status_false = status_false + 1
    23        else
    24          status_unknown = status_unknown + 1
    25        end
    26      end
    27    end
    28    if status_true == 5 and status_false == 0 and status_unknown == 0 then
    29      health_status.message = "Inference Service is healthy."
    30      health_status.status = "Healthy"
    31      return health_status
    32    elseif status_false > 0 then
    33      health_status.status = "Degraded"
    34      return health_status
    35    else
    36      health_status.status = "Progressing"
    37      return health_status
    38    end
    39  end
    40  return health_status