Skip to content

Commit

Permalink
fix: BanzaiCloud KafkaCluster healthcheck to return Progressing durin…
Browse files Browse the repository at this point in the history
…g rolling update (#17994)

* Update ClusterRollingUpgrading state to always be in Progressing state regardless of broker status

Signed-off-by: Ha Van <musubi7726@gmail.com>

* Retrigger CI pipeline

Signed-off-by: Ha Van <musubi7726@gmail.com>

---------

Signed-off-by: Ha Van <musubi7726@gmail.com>
Co-authored-by: Dan Garfield <dan@codefresh.io>
  • Loading branch information
musubi7726 and todaywasawesome committed May 11, 2024
1 parent 5849a06 commit f4fd97d
Show file tree
Hide file tree
Showing 3 changed files with 59 additions and 7 deletions.
@@ -1,5 +1,10 @@
local health_status = {}
if obj.status ~= nil then
if obj.status.state == "ClusterRollingUpgrading" then
health_status.message = "Kafka Cluster is Rolling Upgrading."
health_status.status = "Progressing"
return health_status
end
if obj.status.brokersState ~= nil then
local numberBrokers = 0
local healthyBrokers = 0
Expand All @@ -23,11 +28,6 @@ if obj.status ~= nil then
health_status.status = "Progressing"
return health_status
end
if obj.status.state == "ClusterRollingUpgrading" then
health_status.message = "Kafka Cluster is Rolling Upgrading."
health_status.status = "Progressing"
return health_status
end
end
else
health_status.message = "Broker Config is out of Sync or CruiseControlState is not Ready"
Expand All @@ -38,4 +38,4 @@ if obj.status ~= nil then
end
health_status.status = "Progressing"
health_status.message = "Waiting for KafkaCluster"
return health_status
return health_status
Expand Up @@ -7,11 +7,15 @@ tests:
status: Progressing
message: "Waiting for KafkaCluster"
inputPath: testdata/updating.yaml
- healthStatus:
status: Progressing
message: "Kafka Cluster is Rolling Upgrading."
inputPath: testdata/rollingUpgrade.yaml
- healthStatus:
status: Degraded
message: "Broker Config is out of Sync or CruiseControlState is not Ready"
inputPath: testdata/degraded.yaml
- healthStatus:
status: Healthy
message: "Kafka Brokers, CruiseControl and cluster are in Healthy State."
inputPath: testdata/healthy.yaml
inputPath: testdata/healthy.yaml
@@ -0,0 +1,48 @@
apiVersion: kafka.banzaicloud.io/v1beta1
kind: KafkaCluster
metadata:
finalizers:
- finalizer.kafkaclusters.kafka.banzaicloud.io
- topics.kafkaclusters.kafka.banzaicloud.io
- users.kafkaclusters.kafka.banzaicloud.io
generation: 4
labels:
argocd.argoproj.io/instance: kafka-cluster
controller-tools.k8s.io: "1.0"
name: kafkacluster
namespace: kafka
name: kafkacluster
namespace: kafka
resourceVersion: "31935335"
selfLink: /apis/kafka.banzaicloud.io/v1beta1/namespaces/2269-kafka/kafkaclusters/kafkacluster
uid: c6affef0-651d-44c7-8bff-638961517c8d
spec: {}
status:
alertCount: 0
brokersState:
"0":
configurationState: ConfigInSync
gracefulActionState:
cruiseControlState: GracefulUpscaleSucceeded
errorMessage: CruiseControlTopicReady
rackAwarenessState: |
broker.rack=us-east-1,us-east-1c
"1":
configurationState: ConfigInSync
gracefulActionState:
cruiseControlState: GracefulUpscaleSucceeded
errorMessage: CruiseControlTopicReady
rackAwarenessState: |
broker.rack=us-east-1,us-east-1b
"2":
configurationState: ConfigOutOfSync
gracefulActionState:
cruiseControlState: GracefulUpscaleSucceeded
errorMessage: CruiseControlTopicReady
rackAwarenessState: |
broker.rack=us-east-1,us-east-1a
cruiseControlTopicStatus: CruiseControlTopicReady
rollingUpgradeStatus:
errorCount: 0
lastSuccess: ""
state: ClusterRollingUpgrading

0 comments on commit f4fd97d

Please sign in to comment.