Skip to content

Commit

Permalink
comments from Jakub
Browse files Browse the repository at this point in the history
Signed-off-by: Lukas Kral <lukywill16@gmail.com>
  • Loading branch information
im-konge committed Feb 9, 2024
1 parent bab416e commit 78c2100
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
import io.strimzi.api.kafka.model.nodepool.ProcessRoles;

import java.util.List;
import java.util.Optional;
import java.util.stream.IntStream;

/**
Expand Down Expand Up @@ -49,7 +48,7 @@ public static KafkaNodePool convertKafkaToVirtualNodePool(Kafka kafka, Integer e
.withLabels(kafka.getMetadata().getLabels())
.endMetadata()
.withNewSpec()
.withReplicas(Optional.ofNullable(kafka.getSpec().getKafka().getReplicas()).orElse(0))
.withReplicas(kafka.getSpec().getKafka().getReplicas())
.withStorage(kafka.getSpec().getKafka().getStorage())
.withRoles(List.of(ProcessRoles.BROKER)) // We do not need to care about the controller role here since this is only used with ZooKeeper based clusters
.withResources(kafka.getSpec().getKafka().getResources())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.Optional;
import java.util.Set;
import java.util.stream.Collectors;

Expand Down Expand Up @@ -209,7 +208,7 @@ private Future<KafkaAndNodePools> revertScaleDown(KafkaCluster kafka, Kafka kafk
if (scaleDownCheckFailed) {
if (nodePoolCrs == null || nodePoolCrs.isEmpty()) {
// There are no node pools => the Kafka CR is used
int newReplicasCount = Optional.ofNullable(kafkaCr.getSpec().getKafka().getReplicas()).orElse(0) + kafka.removedNodes().size();
int newReplicasCount = kafkaCr.getSpec().getKafka().getReplicas() + kafka.removedNodes().size();
LOGGER.warnCr(reconciliation, "Reverting scale-down of Kafka {} by changing number of replicas to {}", kafkaCr.getMetadata().getName(), newReplicasCount);

Kafka newKafkaCr = new KafkaBuilder(kafkaCr)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,7 @@ public static Secret createInitialCaKeySecret(String clusterNamespace, String cl
.build();
}

public static Kafka createKafka(String namespace, String name, Integer replicas,
public static Kafka createKafka(String namespace, String name, int replicas,
String image, int healthDelay, int healthTimeout,
MetricsConfig metricsConfig,
Map<String, Object> kafkaConfigurationJson,
Expand All @@ -251,7 +251,7 @@ healthTimeout, metricsConfig, kafkaConfigurationJson, emptyMap()))
}

@SuppressWarnings({"checkstyle:ParameterNumber"})
public static Kafka createKafka(String namespace, String name, Integer replicas,
public static Kafka createKafka(String namespace, String name, int replicas,
String image, int healthDelay, int healthTimeout,
MetricsConfig metricsConfig,
Map<String, Object> kafkaConfiguration,
Expand Down

0 comments on commit 78c2100

Please sign in to comment.