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

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