diff --git a/cluster-operator/src/main/java/io/strimzi/operator/cluster/model/KRaftUtils.java b/cluster-operator/src/main/java/io/strimzi/operator/cluster/model/KRaftUtils.java index c1a459b8ec1..13e6e0c1076 100644 --- a/cluster-operator/src/main/java/io/strimzi/operator/cluster/model/KRaftUtils.java +++ b/cluster-operator/src/main/java/io/strimzi/operator/cluster/model/KRaftUtils.java @@ -152,7 +152,7 @@ public static void validateVersionsForKRaftMigration(String kafkaVersionFromCr, MetadataVersion kafkaVersion = MetadataVersion.fromVersionString(kafkaVersionFromCr); // this should check that spec.kafka.version is >= 3.7.0 - boolean isMigrationSupported = kafkaVersion.isMigrationSupported(); + boolean isMigrationSupported = kafkaVersion.isAtLeast(MetadataVersion.IBP_3_7_IV0); MetadataVersion metadataVersion = MetadataVersion.fromVersionString(metadataVersionFromCr); MetadataVersion interBrokerProtocolVersion = MetadataVersion.fromVersionString(interBrokerProtocolVersionFromCr); diff --git a/cluster-operator/src/test/java/io/strimzi/operator/cluster/model/KRaftUtilsTest.java b/cluster-operator/src/test/java/io/strimzi/operator/cluster/model/KRaftUtilsTest.java index 80e290f3a7b..00928aba1a9 100644 --- a/cluster-operator/src/test/java/io/strimzi/operator/cluster/model/KRaftUtilsTest.java +++ b/cluster-operator/src/test/java/io/strimzi/operator/cluster/model/KRaftUtilsTest.java @@ -281,7 +281,7 @@ public void testZooKeeperWarnings() { @ParallelTest public void testsVersionsForKRaftMigrationValidation() { // Valid values - assertDoesNotThrow(() -> KRaftUtils.validateVersionsForKRaftMigration("3.6.1", "3.6-IV2", "3.6", "3.6")); + assertDoesNotThrow(() -> KRaftUtils.validateVersionsForKRaftMigration("3.7.0", "3.7-IV4", "3.7", "3.7")); // Invalid Values InvalidResourceException e = assertThrows(InvalidResourceException.class, () -> KRaftUtils.validateVersionsForKRaftMigration("3.6.1", "3.6-IV2", "3.5", "3.5")); diff --git a/cluster-operator/src/test/java/io/strimzi/operator/cluster/model/KafkaClusterTest.java b/cluster-operator/src/test/java/io/strimzi/operator/cluster/model/KafkaClusterTest.java index 8904d529097..a98e855b774 100644 --- a/cluster-operator/src/test/java/io/strimzi/operator/cluster/model/KafkaClusterTest.java +++ b/cluster-operator/src/test/java/io/strimzi/operator/cluster/model/KafkaClusterTest.java @@ -3990,13 +3990,13 @@ public void withTolerations() throws IOException { public void testInvalidInterBrokerProtocolAndLogMessageFormatOnKRaftMigration() { // invalid values ... metadata missing (it gets the Kafka version), inter broker protocol and log message format lower than Kafka version Map config = new HashMap<>(); - config.put("inter.broker.protocol.version", "3.5"); - config.put("log.message.format.version", "3.5"); + config.put("inter.broker.protocol.version", "3.6"); + config.put("log.message.format.version", "3.6"); Kafka kafka = new KafkaBuilder(KAFKA) .editSpec() .editKafka() - .withVersion("3.6.1") + .withVersion("3.7.0") .withConfig(config) .endKafka() .endSpec() @@ -4009,14 +4009,14 @@ public void testInvalidInterBrokerProtocolAndLogMessageFormatOnKRaftMigration() KafkaVersionChange kafkaVersionChange = new KafkaVersionChange( kafkaVersion, kafkaVersion, - VERSIONS.version("3.5.0").protocolVersion(), - VERSIONS.version("3.5.0").messageVersion(), + VERSIONS.version("3.6.0").protocolVersion(), + VERSIONS.version("3.6.0").messageVersion(), // as per ZooKeeperVersionChangeCreator, when migration, we set missing metadata version to the Kafka version kafkaVersion.metadataVersion()); KafkaCluster.fromCrd(Reconciliation.DUMMY_RECONCILIATION, kafka, pools, VERSIONS, kafkaVersionChange, KafkaMetadataConfigurationState.PRE_MIGRATION, null, SHARED_ENV_PROVIDER); }); - assertThat(ex.getMessage(), containsString("Migration cannot be performed with Kafka version 3.6-IV2, metadata version 3.6-IV2, inter.broker.protocol.version 3.5-IV2, log.message.format.version 3.5-IV2.")); + assertThat(ex.getMessage(), containsString("Migration cannot be performed with Kafka version 3.7-IV4, metadata version 3.7-IV4, inter.broker.protocol.version 3.6-IV2, log.message.format.version 3.6-IV2.")); } @ParallelTest @@ -4025,8 +4025,8 @@ public void testInvalidMetadataVersionOnKRaftMigration() { Kafka kafka = new KafkaBuilder(KAFKA) .editSpec() .editKafka() - .withVersion("3.6.1") - .withMetadataVersion("3.5-IV2") + .withVersion("3.7.0") + .withMetadataVersion("3.6-IV2") .withConfig(Map.of()) .endKafka() .endSpec() @@ -4046,20 +4046,20 @@ public void testInvalidMetadataVersionOnKRaftMigration() { KafkaCluster.fromCrd(Reconciliation.DUMMY_RECONCILIATION, kafka, pools, VERSIONS, kafkaVersionChange, KafkaMetadataConfigurationState.PRE_MIGRATION, null, SHARED_ENV_PROVIDER); }); - assertThat(ex.getMessage(), containsString("Migration cannot be performed with Kafka version 3.6-IV2, metadata version 3.5-IV2, inter.broker.protocol.version 3.6-IV2, log.message.format.version 3.6-IV2.")); + assertThat(ex.getMessage(), containsString("Migration cannot be performed with Kafka version 3.7-IV4, metadata version 3.6-IV2, inter.broker.protocol.version 3.7-IV4, log.message.format.version 3.7-IV4.")); } @ParallelTest public void testValidVersionsOnKRaftMigration() { Map config = new HashMap<>(); - config.put("inter.broker.protocol.version", "3.6"); - config.put("log.message.format.version", "3.6"); + config.put("inter.broker.protocol.version", "3.7"); + config.put("log.message.format.version", "3.7"); Kafka kafka = new KafkaBuilder(KAFKA) .editSpec() .editKafka() - .withVersion("3.6.1") - .withMetadataVersion("3.6-IV2") + .withVersion("3.7.0") + .withMetadataVersion("3.7-IV4") .withConfig(config) .endKafka() .endSpec()