20.7. Approving an optimization proposal
You can approve an optimization proposal generated by Cruise Control, if its status is ProposalReady. Cruise Control will then apply the optimization proposal to the Kafka cluster, reassigning partitions to brokers and changing partition leadership.
This is not a dry run. Before you approve an optimization proposal, you must:
- Refresh the proposal in case it has become out of date.
- Carefully review the contents of the proposal.
Prerequisites
- You have generated an optimization proposal from Cruise Control.
-
The
KafkaRebalancecustom resource status isProposalReady.
Procedure
Perform these steps for the optimization proposal that you want to approve.
Unless the optimization proposal is newly generated, check that it is based on current information about the state of the Kafka cluster. To do so, refresh the optimization proposal to make sure it uses the latest cluster metrics:
Annotate the
KafkaRebalanceresource in OpenShift withstrimzi.io/rebalance=refresh:oc annotate kafkarebalance <kafka_rebalance_resource_name> strimzi.io/rebalance="refresh"
Wait for the status of the optimization proposal to change to
ProposalReady:oc get kafkarebalance -o wide -w -n <namespace>PendingProposal-
A
PendingProposalstatus means the rebalance operator is polling the Cruise Control API to check if the optimization proposal is ready. ProposalReady-
A
ProposalReadystatus means the optimization proposal is ready for review and approval.
When the status changes to
ProposalReady, the optimization proposal is ready to approve.Approve the optimization proposal that you want Cruise Control to apply.
Annotate the
KafkaRebalanceresource in OpenShift withstrimzi.io/rebalance=approve:oc annotate kafkarebalance <kafka_rebalance_resource_name> strimzi.io/rebalance="approve"- The Cluster Operator detects the annotated resource and instructs Cruise Control to rebalance the Kafka cluster.
Wait for the status of the optimization proposal to change to
Ready:oc get kafkarebalance -o wide -w -n <namespace>Rebalancing-
A
Rebalancingstatus means the rebalancing is in progress. Ready-
A
Readystatus means the rebalance is complete. NotReady-
A
NotReadystatus means an error occurred—see Fixing problems with aKafkaRebalanceresource.
When the status changes to
Ready, the rebalance is complete.To use the same
KafkaRebalancecustom resource to generate another optimization proposal, apply therefreshannotation to the custom resource. This moves the custom resource to thePendingProposalorProposalReadystate. You can then review the optimization proposal and approve it, if desired.