From f7646ee914052116acc38482fdec7581446e3046 Mon Sep 17 00:00:00 2001 From: Steffen Karlsson Date: Mon, 12 Aug 2024 09:59:46 +0200 Subject: [PATCH 1/2] Rename private `reconcile` method to `reconcileKafkaRebalance` Signed-off-by: Steffen Karlsson --- .../operator/assembly/KafkaRebalanceAssemblyOperator.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/cluster-operator/src/main/java/io/strimzi/operator/cluster/operator/assembly/KafkaRebalanceAssemblyOperator.java b/cluster-operator/src/main/java/io/strimzi/operator/cluster/operator/assembly/KafkaRebalanceAssemblyOperator.java index 54751406312..9c259fff0a0 100644 --- a/cluster-operator/src/main/java/io/strimzi/operator/cluster/operator/assembly/KafkaRebalanceAssemblyOperator.java +++ b/cluster-operator/src/main/java/io/strimzi/operator/cluster/operator/assembly/KafkaRebalanceAssemblyOperator.java @@ -356,9 +356,9 @@ private KafkaRebalanceStatus updateStatus(KafkaRebalance kafkaRebalance, return rebalanceOptionsBuilder; } - private Future reconcile(Reconciliation reconciliation, String host, - CruiseControlApi apiClient, KafkaRebalance kafkaRebalance, - KafkaRebalanceState currentState) { + private Future reconcileKafkaRebalance(Reconciliation reconciliation, String host, + CruiseControlApi apiClient, KafkaRebalance kafkaRebalance, + KafkaRebalanceState currentState) { if (kafkaRebalance != null && kafkaRebalance.getStatus() != null && "Ready".equals(rebalanceStateConditionType(kafkaRebalance.getStatus())) @@ -1133,7 +1133,7 @@ private Future> onReady(Reconcilia } currentState = KafkaRebalanceState.valueOf(rebalanceStateType); } - return reconcile(reconciliation, cruiseControlHost(clusterName, clusterNamespace), + return reconcileKafkaRebalance(reconciliation, cruiseControlHost(clusterName, clusterNamespace), apiClient, currentKafkaRebalance, currentState); }, exception -> Future.failedFuture(exception)); }); From bb19e1c0497b5d70dea1e6ecd31170e16d61e4fc Mon Sep 17 00:00:00 2001 From: Steffen Karlsson Date: Tue, 13 Aug 2024 13:10:17 +0200 Subject: [PATCH 2/2] Updating names to suggested Signed-off-by: Steffen Karlsson --- .../assembly/KafkaRebalanceAssemblyOperator.java | 14 +++++++------- .../KafkaRebalanceAssemblyOperatorTest.java | 2 +- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/cluster-operator/src/main/java/io/strimzi/operator/cluster/operator/assembly/KafkaRebalanceAssemblyOperator.java b/cluster-operator/src/main/java/io/strimzi/operator/cluster/operator/assembly/KafkaRebalanceAssemblyOperator.java index 9c259fff0a0..f5e66e652dc 100644 --- a/cluster-operator/src/main/java/io/strimzi/operator/cluster/operator/assembly/KafkaRebalanceAssemblyOperator.java +++ b/cluster-operator/src/main/java/io/strimzi/operator/cluster/operator/assembly/KafkaRebalanceAssemblyOperator.java @@ -356,9 +356,9 @@ private KafkaRebalanceStatus updateStatus(KafkaRebalance kafkaRebalance, return rebalanceOptionsBuilder; } - private Future reconcileKafkaRebalance(Reconciliation reconciliation, String host, - CruiseControlApi apiClient, KafkaRebalance kafkaRebalance, - KafkaRebalanceState currentState) { + private Future handleRebalance(Reconciliation reconciliation, String host, + CruiseControlApi apiClient, KafkaRebalance kafkaRebalance, + KafkaRebalanceState currentState) { if (kafkaRebalance != null && kafkaRebalance.getStatus() != null && "Ready".equals(rebalanceStateConditionType(kafkaRebalance.getStatus())) @@ -1031,7 +1031,7 @@ private Future> onReady(Reconcilia * Reconcile loop for the KafkaRebalance */ @SuppressWarnings({"checkstyle:NPathComplexity"}) - /* test */ Future reconcileRebalance(Reconciliation reconciliation, KafkaRebalance kafkaRebalance) { + /* test */ Future reconcileKafkaRebalance(Reconciliation reconciliation, KafkaRebalance kafkaRebalance) { if (kafkaRebalance == null) { LOGGER.infoCr(reconciliation, "KafkaRebalance resource deleted"); return Future.succeededFuture(); @@ -1133,7 +1133,7 @@ private Future> onReady(Reconcilia } currentState = KafkaRebalanceState.valueOf(rebalanceStateType); } - return reconcileKafkaRebalance(reconciliation, cruiseControlHost(clusterName, clusterNamespace), + return handleRebalance(reconciliation, cruiseControlHost(clusterName, clusterNamespace), apiClient, currentKafkaRebalance, currentState); }, exception -> Future.failedFuture(exception)); }); @@ -1353,12 +1353,12 @@ private KafkaRebalanceState state(KafkaRebalance kafkaRebalance) { @Override protected Future createOrUpdate(Reconciliation reconciliation, KafkaRebalance resource) { - return reconcileRebalance(reconciliation, resource); + return reconcileKafkaRebalance(reconciliation, resource); } @Override protected Future delete(Reconciliation reconciliation) { - return reconcileRebalance(reconciliation, null).map(v -> Boolean.TRUE); + return reconcileKafkaRebalance(reconciliation, null).map(v -> Boolean.TRUE); } @Override diff --git a/cluster-operator/src/test/java/io/strimzi/operator/cluster/operator/assembly/KafkaRebalanceAssemblyOperatorTest.java b/cluster-operator/src/test/java/io/strimzi/operator/cluster/operator/assembly/KafkaRebalanceAssemblyOperatorTest.java index 58fa113d35f..181dadc3e4f 100644 --- a/cluster-operator/src/test/java/io/strimzi/operator/cluster/operator/assembly/KafkaRebalanceAssemblyOperatorTest.java +++ b/cluster-operator/src/test/java/io/strimzi/operator/cluster/operator/assembly/KafkaRebalanceAssemblyOperatorTest.java @@ -1311,7 +1311,7 @@ public void testKafkaClusterNotMatchingSelector(VertxTestContext context) { Checkpoint checkpoint = context.checkpoint(); krao = createKafkaRebalanceAssemblyOperator(ClusterOperatorConfig.buildFromMap(Map.of(ClusterOperatorConfig.CUSTOM_RESOURCE_SELECTOR.key(), "selector=matching"), KafkaVersionTestUtils.getKafkaVersionLookup())); - krao.reconcileRebalance(new Reconciliation("test-trigger", KafkaRebalance.RESOURCE_KIND, namespace, RESOURCE_NAME), kr) + krao.reconcileKafkaRebalance(new Reconciliation("test-trigger", KafkaRebalance.RESOURCE_KIND, namespace, RESOURCE_NAME), kr) .onComplete(context.succeeding(v -> context.verify(() -> { assertThat(v, is(nullValue())); checkpoint.flag();