Search in sources :

Example 1 with KafkaRebalanceStatusBuilder

use of io.strimzi.api.kafka.model.status.KafkaRebalanceStatusBuilder in project strimzi-kafka-operator by strimzi.

the class KafkaRebalanceAssemblyOperator method buildRebalanceStatusFromPreviousStatus.

private KafkaRebalanceStatus buildRebalanceStatusFromPreviousStatus(KafkaRebalanceStatus currentStatus, Set<Condition> validation) {
    List<Condition> conditions = new ArrayList<>();
    conditions.addAll(validation);
    Condition currentState = rebalanceStateCondition(currentStatus);
    conditions.add(currentState);
    return new KafkaRebalanceStatusBuilder().withSessionId(currentStatus.getSessionId()).withOptimizationResult(currentStatus.getOptimizationResult()).withConditions(conditions).build();
}
Also used : Condition(io.strimzi.api.kafka.model.status.Condition) ArrayList(java.util.ArrayList) KafkaRebalanceStatusBuilder(io.strimzi.api.kafka.model.status.KafkaRebalanceStatusBuilder)

Example 2 with KafkaRebalanceStatusBuilder

use of io.strimzi.api.kafka.model.status.KafkaRebalanceStatusBuilder in project strimzi-kafka-operator by strimzi.

the class KafkaRebalanceAssemblyOperator method buildRebalanceStatus.

private MapAndStatus<ConfigMap, KafkaRebalanceStatus> buildRebalanceStatus(KafkaRebalance kafkaRebalance, String sessionID, KafkaRebalanceState cruiseControlState, JsonObject proposalJson, Set<Condition> validation) {
    List<Condition> conditions = new ArrayList<>();
    conditions.add(StatusUtils.buildRebalanceCondition(cruiseControlState.toString()));
    conditions.addAll(validation);
    MapAndStatus<ConfigMap, Map<String, Object>> optimizationProposalMapAndStatus = processOptimizationProposal(kafkaRebalance, proposalJson);
    return new MapAndStatus<>(optimizationProposalMapAndStatus.getLoadMap(), new KafkaRebalanceStatusBuilder().withSessionId(sessionID).withConditions(conditions).withOptimizationResult(optimizationProposalMapAndStatus.getStatus()).build());
}
Also used : Condition(io.strimzi.api.kafka.model.status.Condition) ConfigMap(io.fabric8.kubernetes.api.model.ConfigMap) ArrayList(java.util.ArrayList) KafkaRebalanceStatusBuilder(io.strimzi.api.kafka.model.status.KafkaRebalanceStatusBuilder) Map(java.util.Map) HashMap(java.util.HashMap) ConfigMap(io.fabric8.kubernetes.api.model.ConfigMap)

Example 3 with KafkaRebalanceStatusBuilder

use of io.strimzi.api.kafka.model.status.KafkaRebalanceStatusBuilder in project strimzi by strimzi.

the class KafkaRebalanceAssemblyOperator method buildRebalanceStatusFromPreviousStatus.

private KafkaRebalanceStatus buildRebalanceStatusFromPreviousStatus(KafkaRebalanceStatus currentStatus, Set<Condition> validation) {
    List<Condition> conditions = new ArrayList<>();
    conditions.addAll(validation);
    Condition currentState = rebalanceStateCondition(currentStatus);
    conditions.add(currentState);
    return new KafkaRebalanceStatusBuilder().withSessionId(currentStatus.getSessionId()).withOptimizationResult(currentStatus.getOptimizationResult()).withConditions(conditions).build();
}
Also used : Condition(io.strimzi.api.kafka.model.status.Condition) ArrayList(java.util.ArrayList) KafkaRebalanceStatusBuilder(io.strimzi.api.kafka.model.status.KafkaRebalanceStatusBuilder)

Example 4 with KafkaRebalanceStatusBuilder

use of io.strimzi.api.kafka.model.status.KafkaRebalanceStatusBuilder in project strimzi by strimzi.

the class KafkaRebalanceAssemblyOperator method buildRebalanceStatus.

private MapAndStatus<ConfigMap, KafkaRebalanceStatus> buildRebalanceStatus(KafkaRebalance kafkaRebalance, String sessionID, KafkaRebalanceState cruiseControlState, JsonObject proposalJson, Set<Condition> validation) {
    List<Condition> conditions = new ArrayList<>();
    conditions.add(StatusUtils.buildRebalanceCondition(cruiseControlState.toString()));
    conditions.addAll(validation);
    MapAndStatus<ConfigMap, Map<String, Object>> optimizationProposalMapAndStatus = processOptimizationProposal(kafkaRebalance, proposalJson);
    return new MapAndStatus<>(optimizationProposalMapAndStatus.getLoadMap(), new KafkaRebalanceStatusBuilder().withSessionId(sessionID).withConditions(conditions).withOptimizationResult(optimizationProposalMapAndStatus.getStatus()).build());
}
Also used : Condition(io.strimzi.api.kafka.model.status.Condition) ConfigMap(io.fabric8.kubernetes.api.model.ConfigMap) ArrayList(java.util.ArrayList) KafkaRebalanceStatusBuilder(io.strimzi.api.kafka.model.status.KafkaRebalanceStatusBuilder) Map(java.util.Map) HashMap(java.util.HashMap) ConfigMap(io.fabric8.kubernetes.api.model.ConfigMap)

Aggregations

Condition (io.strimzi.api.kafka.model.status.Condition)4 KafkaRebalanceStatusBuilder (io.strimzi.api.kafka.model.status.KafkaRebalanceStatusBuilder)4 ArrayList (java.util.ArrayList)4 ConfigMap (io.fabric8.kubernetes.api.model.ConfigMap)2 HashMap (java.util.HashMap)2 Map (java.util.Map)2