github.com/argoproj/argo-cd/v3@v3.2.1/resource_customizations/rabbitmq.com/RabbitmqCluster/health.lua (about)

     1  hs = {}
     2  clusterAvailable = {}
     3  allReplicasReady = {}
     4  
     5  if obj.status ~= nil then
     6    if obj.status.conditions ~= nil then
     7  
     8      for i, condition in ipairs(obj.status.conditions) do
     9        if condition.type == "ReconcileSuccess" and condition.status == "False" then
    10          hs.status = "Degraded"
    11          hs.message = condition.message
    12          return hs
    13        end
    14        if condition.type == "ClusterAvailable" then
    15          clusterAvailable.status = condition.status
    16          clusterAvailable.message = condition.message
    17        end
    18        if condition.type == "AllReplicasReady" then
    19          allReplicasReady.status = condition.status
    20          allReplicasReady.message = condition.message
    21        end
    22      end
    23  
    24      if clusterAvailable.status == "Unknown" or allReplicasReady.status == "Unknown" then
    25        hs.status = "Degraded"
    26        hs.message = "No statefulset or endpoints found"
    27        return hs
    28      end
    29  
    30      if clusterAvailable.status == "False" then
    31        hs.status = "Progressing"
    32        hs.message = "Waiting for RabbitMQ cluster formation"
    33        return hs
    34      end
    35  
    36      if allReplicasReady.status == "False" then
    37        hs.status = "Progressing"
    38        hs.message = "Waiting for RabbitMQ instances ready"
    39        return hs
    40      end
    41  
    42      if clusterAvailable.status == "True" and allReplicasReady.status == "True" then
    43        hs.status = "Healthy"
    44        hs.message = "RabbitMQ cluster ready"
    45        return hs
    46      end
    47  
    48    end
    49  end
    50  
    51  hs.status = "Progressing"
    52  hs.message = "Waiting for RabbitMQ Operator"
    53  return hs