Related problem
KafkaRebalance CRs drive Cruise Control rebalancing operations. They go through states (New → PendingProposal → ProposalReady → Rebalancing → Ready/NotReady) and provide optimization results. Essential for capacity planning and pre-upgrade checks.
Suggested solution
New Tools
list_kafka_rebalances
- Parameters:
namespace (optional), clusterName (optional)
- Returns: List of rebalances: name, namespace, cluster, mode (full/add-brokers/remove-brokers/remove-disks), current state (from conditions), auto-approval status
- K8s CRD:
kafkarebalances.kafka.strimzi.io
get_kafka_rebalance
- Parameters:
namespace (optional), rebalanceName (required)
- Returns: Detailed rebalance: mode, goals, excluded topics, broker list, concurrency settings, replication throttle, optimization result (data movement summary, load before/after), session ID, progress reference, conditions with timestamps
- Note: Optimization result can be large — use
ResponseSizeLimitFilter naturally
New Prompt
assess-upgrade-readiness
- Parameters:
cluster_name, namespace (optional), target_version (optional)
- Workflow:
- Get Kafka cluster — check current versions (kafkaVersion, kafkaMetadataVersion)
- List node pools — verify all replicas ready, no pending changes
- Get Kafka metrics — check for under-replicated partitions (must be 0)
- Get operator status — verify operator is healthy and correct version
- List rebalances — check no active rebalancing in progress
- Get events — check for recent reconciliation failures
- Assess: all brokers healthy? Replication caught up? No pending operations? Operator ready?
New Files
KafkaRebalanceService.java — @ApplicationScoped
KafkaRebalanceTools.java — @Singleton, @Guarded
KafkaRebalanceSummary.java / KafkaRebalanceDetail.java — DTOs
AssessUpgradeReadinessPrompt.java
KafkaRebalanceServiceTest.java, KafkaRebalanceToolsTest.java
- Update
McpDiscoveryTest.java, PromptCompletions.java
RBAC
Add to 003-ClusterRole.yaml:
- apiGroups: ["kafka.strimzi.io"]
resources: ["kafkarebalances"]
verbs: ["get", "list", "watch"]
Key Notes
- KafkaRebalance state is encoded in conditions, not a dedicated status field. Extract state from condition types.
- Optimization result is a JSON structure within the CR status — extract key metrics (data movement GB, replica movements, leader movements).
- The
strimzi.io/rebalance annotation (approve/stop/refresh) is write-only — we never set it, only report its current value.
Verification
mvn clean test — new tests pass
- Create KafkaRebalance CRs in various states on dev cluster
- Invoke
list_kafka_rebalances, get_kafka_rebalance — verify state and optimization data
- Test
assess-upgrade-readiness prompt against a healthy and unhealthy cluster
Related problem
KafkaRebalance CRs drive Cruise Control rebalancing operations. They go through states (New → PendingProposal → ProposalReady → Rebalancing → Ready/NotReady) and provide optimization results. Essential for capacity planning and pre-upgrade checks.
Suggested solution
New Tools
list_kafka_rebalancesnamespace(optional),clusterName(optional)kafkarebalances.kafka.strimzi.ioget_kafka_rebalancenamespace(optional),rebalanceName(required)ResponseSizeLimitFilternaturallyNew Prompt
assess-upgrade-readinesscluster_name,namespace(optional),target_version(optional)New Files
KafkaRebalanceService.java—@ApplicationScopedKafkaRebalanceTools.java—@Singleton,@GuardedKafkaRebalanceSummary.java/KafkaRebalanceDetail.java— DTOsAssessUpgradeReadinessPrompt.javaKafkaRebalanceServiceTest.java,KafkaRebalanceToolsTest.javaMcpDiscoveryTest.java,PromptCompletions.javaRBAC
Add to
003-ClusterRole.yaml:Key Notes
strimzi.io/rebalanceannotation (approve/stop/refresh) is write-only — we never set it, only report its current value.Verification
mvn clean test— new tests passlist_kafka_rebalances,get_kafka_rebalance— verify state and optimization dataassess-upgrade-readinessprompt against a healthy and unhealthy cluster