diff --git a/cluster-operator/src/main/java/io/strimzi/operator/cluster/operator/resource/rolling/Context.java b/cluster-operator/src/main/java/io/strimzi/operator/cluster/operator/resource/rolling/Context.java index d739a54f20d..6150750c4b9 100644 --- a/cluster-operator/src/main/java/io/strimzi/operator/cluster/operator/resource/rolling/Context.java +++ b/cluster-operator/src/main/java/io/strimzi/operator/cluster/operator/resource/rolling/Context.java @@ -60,12 +60,6 @@ State transitionTo(State state, Time time) { return state; } this.state = state; - if (state == State.RESTARTED) { - this.numRestarts++; - } - if (state == State.RECONFIGURED) { - this.numReconfigs++; - } this.lastTransition = time.systemTimeMillis(); return state; } @@ -106,6 +100,14 @@ public int numAttempts() { return numAttempts; } + public void incrementNumRestarts() { + this.numRestarts++; + } + + public void incrementNumReconfigs() { + this.numReconfigs++; + } + public void incrementNumAttempts() { this.numAttempts++; } diff --git a/cluster-operator/src/main/java/io/strimzi/operator/cluster/operator/resource/rolling/RackRolling.java b/cluster-operator/src/main/java/io/strimzi/operator/cluster/operator/resource/rolling/RackRolling.java index 2a8f899d370..3de42283df6 100644 --- a/cluster-operator/src/main/java/io/strimzi/operator/cluster/operator/resource/rolling/RackRolling.java +++ b/cluster-operator/src/main/java/io/strimzi/operator/cluster/operator/resource/rolling/RackRolling.java @@ -280,7 +280,8 @@ private static void restartNode(Reconciliation reconciliation, } catch (RuntimeException e) { LOGGER.warnCr(reconciliation, "An exception thrown during the restart of the node {}", context.nodeRef(), e); } - context.transitionTo(State.RESTARTED, time); + context.transitionTo(State.UNKNOWN, time); + context.incrementNumRestarts(); LOGGER.debugCr(reconciliation, "Node {}: Restarted", context.nodeRef()); } @@ -295,7 +296,8 @@ private static void reconfigureNode(Reconciliation reconciliation, } LOGGER.debugCr(reconciliation, "Node {}: Reconfiguring", context.nodeRef()); rollClient.reconfigureNode(context.nodeRef(), context.brokerConfigDiff(), context.loggingDiff()); - context.transitionTo(State.RECONFIGURED, time); + context.transitionTo(State.UNKNOWN, time); + context.incrementNumReconfigs(); LOGGER.debugCr(reconciliation, "Node {}: Reconfigured", context.nodeRef()); } diff --git a/cluster-operator/src/main/java/io/strimzi/operator/cluster/operator/resource/rolling/State.java b/cluster-operator/src/main/java/io/strimzi/operator/cluster/operator/resource/rolling/State.java index 7bf420f5af6..0fe14ed25a6 100644 --- a/cluster-operator/src/main/java/io/strimzi/operator/cluster/operator/resource/rolling/State.java +++ b/cluster-operator/src/main/java/io/strimzi/operator/cluster/operator/resource/rolling/State.java @@ -8,11 +8,9 @@ * Enumerates the possible "rolling states" of a Kafka node */ enum State { - UNKNOWN, // the initial state + UNKNOWN, // the initial state or the node is successfully restarted/reconfigured NOT_RUNNING, // The pod/process is not running. NOT_READY, // decided to restart right now or broker state < 2 OR == 127 - RESTARTED, // after successful kube pod delete - RECONFIGURED, // after successful reconfig RECOVERING, // broker state == 2 SERVING, // broker state >= 3 AND != 127 LEADING_ALL_PREFERRED // broker state== 3 and leading all preferred replicas