github.com/argoproj/argo-cd@v1.8.7/resource_customizations/kafka.banzaicloud.io/KafkaCluster/health.lua (about)

     1  health_status = {}
     2  if obj.status ~= nil then
     3    if obj.status.brokersState ~= nil then
     4      counter = 0
     5      brokerReady = 0
     6      for i, broker in pairs(obj.status.brokersState) do
     7          if (brokerReady <= tonumber(i)) then
     8              brokerReady = tonumber(i)+1
     9          else
    10              brokerReady = brokerReady
    11          end
    12          if broker.configurationState == "ConfigInSync" and broker.gracefulActionState.cruiseControlState == "GracefulUpscaleSucceeded" then
    13            counter = counter + 1
    14          end
    15          if broker.configurationState == "ConfigInSync" and broker.gracefulActionState.cruiseControlState == "GracefulDownscaleSucceeded" then
    16            counter = counter + 1
    17          end
    18      end
    19      if counter == brokerReady then
    20        if obj.status.cruiseControlTopicStatus == "CruiseControlTopicReady" and obj.status.state == "ClusterRunning" then
    21          health_status.message = "Kafka Brokers, CruiseControl and cluster are in Healthy State."
    22          health_status.status = "Healthy"
    23          return health_status
    24        end
    25        if obj.status.cruiseControlTopicStatus == "CruiseControlTopicNotReady" or obj.status.cruiseControlTopicStatus == nil then
    26          if obj.status.state == "ClusterReconciling" then
    27            health_status.message = "Kafka Cluster is Reconciling."
    28            health_status.status = "Progressing"
    29            return health_status
    30          end
    31          if obj.status.state == "ClusterRollingUpgrading" then
    32            health_status.message = "Kafka Cluster is Rolling Upgrading."
    33            health_status.status = "Progressing"
    34            return health_status
    35          end
    36        end
    37      else
    38        health_status.message = "Broker Config is out of Sync or CruiseControlState is not Ready"
    39        health_status.status = "Degraded"
    40        return health_status
    41      end
    42    end
    43  end
    44  health_status.status = "Progressing"
    45  health_status.message = "Waiting for KafkaCluster"
    46  return health_status