github.com/argoproj/argo-cd/v3@v3.2.1/resource_customizations/serving.kserve.io/InferenceService/health.lua (about) 1 local health_status = {} 2 3 health_status.status = "Progressing" 4 health_status.message = "Waiting for InferenceService to report status..." 5 6 if obj.status ~= nil then 7 8 local progressing = false 9 local degraded = false 10 local status_false = 0 11 local status_unknown = 0 12 local msg = "" 13 14 if obj.status.modelStatus ~= nil then 15 if obj.status.modelStatus.transitionStatus ~= "UpToDate" then 16 if obj.status.modelStatus.transitionStatus == "InProgress" then 17 progressing = true 18 else 19 degraded = true 20 end 21 msg = msg .. "0: transitionStatus | " .. obj.status.modelStatus.transitionStatus 22 end 23 end 24 25 if obj.status.conditions ~= nil then 26 for i, condition in pairs(obj.status.conditions) do 27 -- Check if the InferenceService is Stopped 28 if condition.type == "Stopped" and condition.status == "True" then 29 health_status.status = "Suspended" 30 health_status.message = "InferenceService is Stopped" 31 return health_status 32 end 33 34 -- Check for unhealthy statuses 35 -- Note: The Stopped condition's healthy status is False 36 if condition.status == "Unknown" then 37 status_unknown = status_unknown + 1 38 elseif condition.status == "False" and condition.type ~= "Stopped" then 39 status_false = status_false + 1 40 end 41 42 -- Add the error messages if the status is unhealthy 43 if condition.status ~= "True" and condition.type ~= "Stopped" then 44 msg = msg .. " | " .. i .. ": " .. condition.type .. " | " .. condition.status 45 if condition.reason ~= nil and condition.reason ~= "" then 46 msg = msg .. " | " .. condition.reason 47 end 48 if condition.message ~= nil and condition.message ~= "" then 49 msg = msg .. " | " .. condition.message 50 end 51 end 52 53 end 54 55 if progressing == false and degraded == false and status_unknown == 0 and status_false == 0 then 56 health_status.status = "Healthy" 57 msg = "InferenceService is healthy." 58 elseif degraded == false and status_unknown >= 0 then 59 health_status.status = "Progressing" 60 else 61 health_status.status = "Degraded" 62 end 63 64 health_status.message = msg 65 end 66 end 67 68 return health_status