Al-assad commented on code in PR #2994:
URL: 
https://github.com/apache/incubator-streampark/pull/2994#discussion_r1308703813


##########
streampark-flink/streampark-flink-client/streampark-flink-client-core/src/main/scala/org/apache/streampark/flink/client/impl/KubernetesNativeApplicationClient.scala:
##########
@@ -103,4 +111,40 @@ object KubernetesNativeApplicationClient extends 
KubernetesNativeClientTrait {
     flinkConf.safeSet(DeploymentOptions.TARGET, 
ExecutionMode.KUBERNETES_NATIVE_APPLICATION.getName)
     super.doTriggerSavepoint(request, flinkConf)
   }
+
+  private[this] def convertFlinkDeploymentDef(
+      submitRequest: SubmitRequest,
+      flinkConfig: Configuration): FlinkDeploymentDef = {
+    val spec = FlinkDeploymentDef(
+      name = submitRequest.appName,
+      namespace = submitRequest.k8sSubmitParam.kubernetesNamespace,
+      image = "flink:" + submitRequest.flinkVersion.majorVersion,
+      flinkVersion = 
converFlinkVersion(submitRequest.flinkVersion.majorVersion).getOrElse(null),
+      jobManager = JobManagerDef(
+        cpu = 1,
+        memory = 
flinkConfig.get(JobManagerOptions.TOTAL_PROCESS_MEMORY).toString),
+      taskManager = TaskManagerDef(
+        cpu = 1,
+        memory = 
flinkConfig.get(TaskManagerOptions.TOTAL_PROCESS_MEMORY).toString),
+      job = Some(
+        JobDef(
+          jarURI =
+            
submitRequest.buildResult.asInstanceOf[DockerImageBuildResponse].dockerInnerMainJarPath,
+          parallelism = 
submitRequest.properties.get("parallelism.default").asInstanceOf[Int]
+        )),
+      extJarPaths = Array(submitRequest.userJarFile.getAbsolutePath)
+    )
+    spec
+  }
+
+  private[this] def converFlinkVersion(version: String): Option[FlinkVersion] 
= {

Review Comment:
   When adding support for a new version of Flink in the CRD, this part of the 
code needs to be updated. There is a better way here:
   ```scala
   Option(ubmitRequest.flinkVersion.majorVersion)
       .map(_.replace(".", "_"))
       .map("V" + _ )
       .flatMap(v => Test.values().find(_.name() == v))
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to