github.com/argoproj/argo-cd/v2@v2.10.9/resource_customizations/elasticsearch.k8s.elastic.co/Elasticsearch/health.lua (about)

     1  local hs = {}
     2  if obj.status ~= nil then
     3    if obj.status.availableNodes ~= nil then
     4      local sum = 0
     5      for _,node in pairs(obj.spec.nodeSets) do
     6        sum = sum + node.count
     7      end
     8      if obj.status.availableNodes < sum then
     9        hs.status = "Progressing"
    10        hs.message = "The desired amount of availableNodes is " .. sum .. " but the current amount is " .. obj.status.availableNodes
    11        return hs
    12      elseif obj.status.availableNodes == sum then
    13        if obj.status.phase ~= nil and obj.status.health ~= nil then
    14          if obj.status.phase == "Ready" then
    15            if obj.status.health == "green" then
    16              hs.status = "Healthy"
    17              hs.message = "Elasticsearch Cluster status is Green"
    18              return hs
    19            elseif obj.status.health == "yellow" then
    20              hs.status = "Progressing"
    21              hs.message = "Elasticsearch Cluster status is Yellow. Check the status of indices, replicas and shards"
    22              return hs
    23            elseif obj.status.health == "red" then
    24              hs.status = "Degraded"
    25              hs.message = "Elasticsearch Cluster status is Red. Check the status of indices, replicas and shards"
    26              return hs
    27            end
    28          elseif obj.status.phase == "ApplyingChanges" then
    29            hs.status = "Progressing"
    30            hs.message = "Elasticsearch phase is ApplyingChanges"
    31            return hs
    32          elseif obj.status.phase == "MigratingData" then
    33            hs.status = "Progressing"
    34            hs.message = "Elasticsearch phase is MigratingData"
    35            return hs
    36          elseif obj.status.phase == "Invalid" then
    37            hs.status = "Degraded"
    38            hs.message = "Elasticsearch phase is Invalid"
    39            return hs
    40          end
    41        end
    42      end
    43    end
    44  end
    45  
    46  hs.status = "Unknown"
    47  hs.message = "Elasticsearch Cluster status is unknown. Ensure your ArgoCD is current and then check for/file a bug report: https://github.com/argoproj/argo-cd/issues"
    48  return hs