github.com/argoproj/argo-cd/v3@v3.2.1/resource_customizations/k8s.keycloak.org/Keycloak/health.lua (about)

     1  if obj.status == nil or obj.status.conditions == nil then
     2    -- no status info available yet
     3    return {
     4      status = "Progressing",
     5      message = "Waiting for Keycloak status conditions to exist",
     6    }
     7  end
     8  
     9  -- Sort conditions by lastTransitionTime, from old to new.
    10  -- Ensure that conditions with nil lastTransitionTime are always sorted after those with non-nil values.
    11  table.sort(obj.status.conditions, function(a, b)
    12    -- Nil values are considered "less than" non-nil values.
    13    -- This means that conditions with nil lastTransitionTime will be sorted to the end.
    14    if a.lastTransitionTime == nil then
    15      return false
    16    elseif b.lastTransitionTime == nil then
    17      return true
    18    else
    19      -- If both have non-nil lastTransitionTime, compare them normally.
    20      return a.lastTransitionTime < b.lastTransitionTime
    21    end
    22  end)
    23  
    24  for _, condition in ipairs(obj.status.conditions) do
    25    if condition.type == "Ready" and condition.status == "True" then
    26      return {
    27        status = "Healthy",
    28        message = "",
    29      }
    30    elseif condition.type == "HasErrors" and condition.status == "True" then
    31      return {
    32        status = "Degraded",
    33        message = "Has Errors: " .. condition.message,
    34      }
    35    end
    36  end
    37  
    38  -- We couldn't find matching conditions yet, so assume progressing
    39  return {
    40    status = "Progressing",
    41    message = "",
    42  }