github.com/argoproj/argo-cd/v3@v3.2.1/resource_customizations/opentelemetry.io/OpenTelemetryCollector/health.lua (about)

     1  hs = {}
     2  hs.status = "Progressing"
     3  hs.message = "Waiting for OpenTelemetry Collector status"
     4  
     5  if obj.status ~= nil then
     6      if obj.status.scale ~= nil and obj.status.scale.statusReplicas ~= nil then
     7          local statusReplicas = obj.status.scale.statusReplicas
     8  
     9          -- Parse the statusReplicas string (e.g., "2/2", "0/2", "1/3")
    10          local ready, total = string.match(statusReplicas, "(%d+)/(%d+)")
    11  
    12          if ready ~= nil and total ~= nil then
    13              ready = tonumber(ready)
    14              total = tonumber(total)
    15  
    16              if ready == 0 then
    17                  hs.status = "Degraded"
    18                  hs.message = "No replicas are ready"
    19              elseif ready == total then
    20                  hs.status = "Healthy"
    21                  hs.message = "All replicas are ready"
    22              else
    23                  hs.status = "Progressing"
    24                  hs.message = "Replicas are starting up"
    25              end
    26          else
    27              hs.status = "Progressing"
    28              hs.message = "Unable to parse replica status: " ..tostring(statusReplicas)
    29          end
    30      else
    31          hs.status = "Progressing"
    32          hs.message = "Scale status not available"
    33      end
    34  end
    35  return hs