github.com/argoproj/argo-cd/v2@v2.10.9/resource_customizations/work.karmada.io/ResourceBinding/health.lua (about)

     1  local health_status = {}
     2  if obj.status == nil then
     3    health_status.status = "Progressing"
     4    health_status.message = "Current resource status is insufficient"
     5    return health_status
     6  end
     7  
     8  if obj.spec.clusters == nil or #obj.spec.clusters == 0 then
     9    health_status.status = "Progressing"
    10    health_status.message = "Current resource status is insufficient"
    11    return health_status
    12  end
    13  
    14  if obj.status.aggregatedStatus == nil or #obj.spec.clusters ~= #obj.status.aggregatedStatus then
    15    health_status.status = "Progressing"
    16    health_status.message = "Current resource status is insufficient"
    17    return health_status
    18  end
    19  
    20  for i, status in ipairs(obj.status.aggregatedStatus) do
    21    if status.health == "Unhealthy" then
    22      health_status.status = "Degraded"
    23      health_status.message = "Current resource status is unhealthy"
    24      return health_status
    25    end
    26  
    27    if status.health == "Unknown" then
    28      if status.applied ~= true then
    29        health_status.status = "Degraded"
    30        health_status.message = "Current resource status is unhealthy"
    31        return health_status
    32      end
    33    end
    34  end
    35  
    36  health_status.status = "Healthy"
    37  return health_status