Skip to content

Commit

Permalink
Merge pull request #27 from arenadata/feature/ADS-1587
Browse files Browse the repository at this point in the history
Feature/ads 1587
  • Loading branch information
Asmoday authored Nov 20, 2023
2 parents 5307093 + 0cd7e16 commit 0ed9f9d
Show file tree
Hide file tree
Showing 8 changed files with 30 additions and 7 deletions.
5 changes: 4 additions & 1 deletion app/controllers/Logkafka.scala
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,8 @@ class Logkafka (val cc: ControllerComponents, val kafkaManagerContext: KafkaMana
LogkafkaNewConfigs.configMaps(Kafka_2_6_0).map{case(k,v) => LKConfig(k,Some(v))}.toList)
val kafka_2_8_1_Default = CreateLogkafka("","",
LogkafkaNewConfigs.configMaps(Kafka_2_8_1).map{case(k,v) => LKConfig(k,Some(v))}.toList)

val kafka_3_3_2_Default = CreateLogkafka("", "",
LogkafkaNewConfigs.configMaps(Kafka_3_3_2).map { case (k, v) => LKConfig(k, Some(v)) }.toList)

val defaultCreateForm = Form(
mapping(
Expand Down Expand Up @@ -167,6 +168,7 @@ class Logkafka (val cc: ControllerComponents, val kafkaManagerContext: KafkaMana
case Kafka_2_4_0 => (defaultCreateForm.fill(kafka_2_4_0_Default), clusterContext)
case Kafka_2_6_0 => (defaultCreateForm.fill(kafka_2_6_0_Default), clusterContext)
case Kafka_2_8_1 => (defaultCreateForm.fill(kafka_2_8_1_Default), clusterContext)
case Kafka_3_3_2 => (defaultCreateForm.fill(kafka_3_3_2_Default), clusterContext)
}
}
}
Expand Down Expand Up @@ -274,6 +276,7 @@ class Logkafka (val cc: ControllerComponents, val kafkaManagerContext: KafkaMana
case Kafka_2_4_0 => LogkafkaNewConfigs.configNames(Kafka_2_4_0).map(n => (n,LKConfig(n,None))).toMap
case Kafka_2_6_0 => LogkafkaNewConfigs.configNames(Kafka_2_6_0).map(n => (n,LKConfig(n,None))).toMap
case Kafka_2_8_1 => LogkafkaNewConfigs.configNames(Kafka_2_8_1).map(n => (n,LKConfig(n,None))).toMap
case Kafka_3_3_2 => LogkafkaNewConfigs.configNames(Kafka_3_3_2).map(n => (n,LKConfig(n,None))).toMap
}
val identityOption = li.identityMap.get(log_path)
if (identityOption.isDefined) {
Expand Down
4 changes: 4 additions & 0 deletions app/controllers/Topic.scala
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,8 @@ class Topic (val cc: ControllerComponents, val kafkaManagerContext: KafkaManager
val kafka_2_4_0_Default = CreateTopic("",1,1,TopicConfigs.configNamesAndDoc(Kafka_2_4_0).map{ case (n, h) => TConfig(n,None,Option(h))}.toList)
val kafka_2_6_0_Default = CreateTopic("",1,1,TopicConfigs.configNamesAndDoc(Kafka_2_6_0).map{ case (n, h) => TConfig(n,None,Option(h))}.toList)
val kafka_2_8_1_Default = CreateTopic("",1,1,TopicConfigs.configNamesAndDoc(Kafka_2_8_1).map{ case (n, h) => TConfig(n,None,Option(h))}.toList)
val kafka_3_3_2_Default = CreateTopic("",1,1,TopicConfigs.configNamesAndDoc(Kafka_3_3_2).map{ case (n, h) => TConfig(n,None,Option(h))}.toList)


val defaultCreateForm = Form(
mapping(
Expand Down Expand Up @@ -175,6 +177,7 @@ class Topic (val cc: ControllerComponents, val kafkaManagerContext: KafkaManager
case Kafka_2_4_0 => (defaultCreateForm.fill(kafka_2_4_0_Default), clusterContext)
case Kafka_2_6_0 => (defaultCreateForm.fill(kafka_2_6_0_Default), clusterContext)
case Kafka_2_8_1 => (defaultCreateForm.fill(kafka_2_8_1_Default), clusterContext)
case Kafka_3_3_2 => (defaultCreateForm.fill(kafka_3_3_2_Default), clusterContext)
}
}
}
Expand Down Expand Up @@ -428,6 +431,7 @@ class Topic (val cc: ControllerComponents, val kafkaManagerContext: KafkaManager
case Kafka_2_4_0 => TopicConfigs.configNamesAndDoc(Kafka_2_4_0).map { case (n, h) => (n,TConfig(n,None, Option(h))) }
case Kafka_2_6_0 => TopicConfigs.configNamesAndDoc(Kafka_2_6_0).map { case (n, h) => (n,TConfig(n,None, Option(h))) }
case Kafka_2_8_1 => TopicConfigs.configNamesAndDoc(Kafka_2_8_1).map { case (n, h) => (n,TConfig(n,None, Option(h))) }
case Kafka_3_3_2 => TopicConfigs.configNamesAndDoc(Kafka_3_3_2).map { case (n, h) => (n,TConfig(n,None, Option(h))) }
}
val updatedConfigMap = ti.config.toMap
val updatedConfigList = defaultConfigs.map {
Expand Down
2 changes: 1 addition & 1 deletion app/kafka/manager/actor/cluster/KafkaStateActor.scala
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ class KafkaAdminClient(context: => ActorContext, adminClientActorPath: ActorPath


object KafkaManagedOffsetCache {
val supportedVersions: Set[KafkaVersion] = Set(Kafka_0_8_2_0, Kafka_0_8_2_1, Kafka_0_8_2_2, Kafka_0_9_0_0, Kafka_0_9_0_1, Kafka_0_10_0_0, Kafka_0_10_0_1, Kafka_0_10_1_0, Kafka_0_10_1_1, Kafka_0_10_2_0, Kafka_0_10_2_1, Kafka_0_11_0_0, Kafka_0_11_0_2, Kafka_1_0_0, Kafka_1_0_1, Kafka_1_1_0, Kafka_1_1_1, Kafka_2_0_0, Kafka_2_1_0, Kafka_2_1_1, Kafka_2_2_0, Kafka_2_4_0, Kafka_2_6_0, Kafka_2_8_1)
val supportedVersions: Set[KafkaVersion] = Set(Kafka_0_8_2_0, Kafka_0_8_2_1, Kafka_0_8_2_2, Kafka_0_9_0_0, Kafka_0_9_0_1, Kafka_0_10_0_0, Kafka_0_10_0_1, Kafka_0_10_1_0, Kafka_0_10_1_1, Kafka_0_10_2_0, Kafka_0_10_2_1, Kafka_0_11_0_0, Kafka_0_11_0_2, Kafka_1_0_0, Kafka_1_0_1, Kafka_1_1_0, Kafka_1_1_1, Kafka_2_0_0, Kafka_2_1_0, Kafka_2_1_1, Kafka_2_2_0, Kafka_2_4_0, Kafka_2_6_0, Kafka_2_8_1, Kafka_3_3_2)
val ConsumerOffsetTopic = "__consumer_offsets"

def isSupported(version: KafkaVersion) : Boolean = {
Expand Down
7 changes: 6 additions & 1 deletion app/kafka/manager/model/model.scala
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,10 @@ case object Kafka_2_8_1 extends KafkaVersion {
override def toString = "2.8.1"
}

case object Kafka_3_3_2 extends KafkaVersion {
override def toString: String = "3.3.2"
}

object KafkaVersion {
val supportedVersions: Map[String,KafkaVersion] = Map(
"0.8.1.1" -> Kafka_0_8_1_1,
Expand Down Expand Up @@ -139,7 +143,8 @@ object KafkaVersion {
"2.2.0" -> Kafka_2_2_0,
"2.4.0" -> Kafka_2_4_0,
"2.6.0" -> Kafka_2_6_0,
"2.8.1" -> Kafka_2_8_1
"2.8.1" -> Kafka_2_8_1,
"3.3.2" -> Kafka_3_3_2
)

val formSelectList : IndexedSeq[(String,String)] = supportedVersions.toIndexedSeq.filterNot(_._1.contains("beta")).map(t => (t._1,t._2.toString)).sortWith((a, b) => sortVersion(a._1, b._1))
Expand Down
3 changes: 2 additions & 1 deletion app/kafka/manager/utils/LogkafkaNewConfigs.scala
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,8 @@ object LogkafkaNewConfigs {
Kafka_2_2_0 -> logkafka82.LogConfig,
Kafka_2_4_0 -> logkafka82.LogConfig,
Kafka_2_6_0 -> logkafka82.LogConfig,
Kafka_2_8_1 -> logkafka82.LogConfig
Kafka_2_8_1 -> logkafka82.LogConfig,
Kafka_3_3_2 -> logkafka82.LogConfig
)

def configNames(version: KafkaVersion) : Set[String] = {
Expand Down
3 changes: 2 additions & 1 deletion app/kafka/manager/utils/TopicConfigs.scala
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,8 @@ object TopicConfigs {
Kafka_2_2_0 -> two00.LogConfig,
Kafka_2_4_0 -> two00.LogConfig,
Kafka_2_6_0 -> two00.LogConfig,
Kafka_2_8_1 -> two00.LogConfig
Kafka_2_8_1 -> two00.LogConfig,
Kafka_3_3_2 -> two00.LogConfig
)

def configNames(version: KafkaVersion): Seq[String] = {
Expand Down
6 changes: 4 additions & 2 deletions test/kafka/manager/model/KafkaVersionTest.scala
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,8 @@ class KafkaVersionTest extends FunSuite {
"2.2.0" -> Kafka_2_2_0,
"2.4.0" -> Kafka_2_4_0,
"2.6.0" -> Kafka_2_6_0,
"2.8.1" -> Kafka_2_8_1
"2.8.1" -> Kafka_2_8_1,
"3.3.2" -> Kafka_3_3_2
)

test("apply method: supported version.") {
Expand Down Expand Up @@ -81,7 +82,8 @@ class KafkaVersionTest extends FunSuite {
("2.2.0","2.2.0"),
("2.4.0","2.4.0"),
("2.6.0","2.6.0"),
("2.8.1","2.8.1")
("2.8.1","2.8.1"),
("3.3.2", "3.3.2")
)
assertResult(expected)(KafkaVersion.formSelectList)
}
Expand Down
7 changes: 7 additions & 0 deletions test/kafka/manager/utils/TestClusterConfig.scala
Original file line number Diff line number Diff line change
Expand Up @@ -253,4 +253,11 @@ class TestClusterConfig extends FunSuite with Matchers {
assert(cc == deserialize.get)
}

test("serialize and deserialize 3.3.2") {
val cc = ClusterConfig("qa", "3.3.2", "localhost:2181", jmxEnabled = false, pollConsumers = true, filterConsumers = true, activeOffsetCacheEnabled = true, jmxUser = None, jmxPass = None, jmxSsl = false, tuning = None, securityProtocol = "SASL_PLAINTEXT", saslMechanism = Option("PLAIN"), jaasConfig = Option("blah"))
val serialize: String = ClusterConfig.serialize(cc)
val deserialize = ClusterConfig.deserialize(serialize)
assert(deserialize.isSuccess === true)
assert(cc == deserialize.get)
}
}

0 comments on commit 0ed9f9d

Please sign in to comment.