github.com/argoproj/argo-cd/v3@v3.2.1/resource_customizations/apps.3scale.net/APIManager/health.lua (about)

     1  local hs = {}
     2  
     3  if obj ~= nil and obj.status ~= nil then
     4    local deployments = obj.status.deployments
     5    if deployments ~= nil then
     6      local has_ready = deployments.ready ~= nil
     7      local has_starting = deployments.starting ~= nil
     8      local has_stopped = deployments.stopped ~= nil
     9  
    10      if has_ready and (not has_starting) and (not has_stopped) then
    11        hs.status = "Healthy"
    12        hs.message = "3scale APIManager is available"
    13        return hs
    14      elseif (has_ready and (has_starting or has_stopped)) or (not has_ready) then
    15        hs.status = "Progressing"
    16        hs.message = "Waiting for 3scale APIManager status..."
    17      end
    18    end
    19  
    20    -- Fallback to condition-based evaluation
    21    if obj.status.conditions ~= nil then
    22      for _, condition in ipairs(obj.status.conditions) do
    23        if condition.type == "Available" then
    24          if condition.status == "True" then
    25            hs.status = "Healthy"
    26            hs.message = "3scale APIManager is available"
    27            return hs
    28          elseif condition.reason ~= nil and condition.reason ~= "" then
    29            local msg = "3scale APIManager is degraded: " .. condition.reason
    30            hs.status = "Degraded"
    31            hs.message = msg
    32            return hs
    33          end
    34        end
    35      end
    36    end
    37  end
    38  
    39  hs.status = "Progressing"
    40  hs.message = "Waiting for 3scale APIManager status..."
    41  return hs