-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adding
KafkaRebalance
add/remove broker modes for rebalancing after…
…/before scale up/down (#6800) * Added rebalancing mode and brokers to the KafkaRebalance API Signed-off-by: Paolo Patierno <ppatierno@live.com> * Updated KafkaRebalanceAssemblyOperator to handle add-broker and remove-broker rebalancing modes Refactored rebalancing state machine tests to cover all modes Signed-off-by: Paolo Patierno <ppatierno@live.com> * Updated KafkaRebalanceAssemblyOperator tests to cover new add-broker and remove-broker modes Signed-off-by: Paolo Patierno <ppatierno@live.com> * Fixed comments Added rebalance examples for add-broker and remove-broker Signed-off-by: Paolo Patierno <ppatierno@live.com> * Fixed api test Signed-off-by: Paolo Patierno <ppatierno@live.com> * Fixed comments Signed-off-by: Paolo Patierno <ppatierno@live.com> * Renaming modes Fix comments Signed-off-by: Paolo Patierno <ppatierno@live.com> * Fixed system test Signed-off-by: Paolo Patierno <ppatierno@live.com> Co-authored-by: Jakub Scholz <www@scholzj.com>
- Loading branch information
Showing
24 changed files
with
1,323 additions
and
583 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
39 changes: 39 additions & 0 deletions
39
api/src/main/java/io/strimzi/api/kafka/model/balancing/KafkaRebalanceMode.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
/* | ||
* Copyright Strimzi authors. | ||
* License: Apache License 2.0 (see the file LICENSE or http://apache.org/licenses/LICENSE-2.0.html). | ||
*/ | ||
package io.strimzi.api.kafka.model.balancing; | ||
|
||
import com.fasterxml.jackson.annotation.JsonCreator; | ||
import com.fasterxml.jackson.annotation.JsonValue; | ||
|
||
public enum KafkaRebalanceMode { | ||
FULL("full"), | ||
ADD_BROKERS("add-brokers"), | ||
REMOVE_BROKERS("remove-brokers"); | ||
|
||
private String name; | ||
|
||
KafkaRebalanceMode(String name) { | ||
this.name = name; | ||
} | ||
|
||
@JsonCreator | ||
public static KafkaRebalanceMode forValue(String value) { | ||
switch (value) { | ||
case "full": | ||
return FULL; | ||
case "add-brokers": | ||
return ADD_BROKERS; | ||
case "remove-brokers": | ||
return REMOVE_BROKERS; | ||
default: | ||
return null; | ||
} | ||
} | ||
|
||
@JsonValue | ||
public String toValue() { | ||
return this.name; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
7 changes: 7 additions & 0 deletions
7
api/src/test/resources/io/strimzi/api/kafka/model/KafkaRebalance-add-brokers.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
apiVersion: kafka.strimzi.io/v1beta2 | ||
kind: KafkaRebalance | ||
metadata: | ||
name: my-rebalance | ||
spec: | ||
mode: add-brokers | ||
brokers: [3,4] |
7 changes: 7 additions & 0 deletions
7
api/src/test/resources/io/strimzi/api/kafka/model/KafkaRebalance-remove-brokers.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
apiVersion: kafka.strimzi.io/v1beta2 | ||
kind: KafkaRebalance | ||
metadata: | ||
name: my-rebalance | ||
spec: | ||
mode: remove-brokers | ||
brokers: [3,4] |
6 changes: 6 additions & 0 deletions
6
api/src/test/resources/io/strimzi/api/kafka/model/KafkaRebalance-wrong-mode.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
apiVersion: kafka.strimzi.io/v1beta2 | ||
kind: KafkaRebalance | ||
metadata: | ||
name: my-rebalance | ||
spec: | ||
mode: wrong-mode |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.