You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@streampark.apache.org by "caicancai (via GitHub)" <gi...@apache.org> on 2023/09/25 09:17:05 UTC

[GitHub] [incubator-streampark] caicancai opened a new pull request, #3186: [Feature] Add KubernetesApplicationClient.shutdown on Flink-Kubernetes-V2

caicancai opened a new pull request, #3186:
URL: https://github.com/apache/incubator-streampark/pull/3186

   …Kubernetes-V2
   
   <!--
   Thank you for contributing to StreamPark! Please make sure that your code changes
   are covered with tests. And in case of new features or big changes
   remember to adjust the documentation.
   
   ## Contribution Checklist
   
     - If this is your first time, please read our contributor guidelines: [Submit Code](https://streampark.apache.org/community/submit_guide/submit_code).
   
     - Make sure that the pull request corresponds to a [GITHUB issue](https://github.com/apache/incubator-streampark/issues).
   
     - Name the pull request in the form "[Feature] Title of the pull request", where *Feature* can be replaced by `Hotfix`, `Bug`, etc.
   
     - Fill out the template below to describe the changes contributed by the pull request. That will give reviewers the context they need to do the review.
   
     - If the PR is unfinished, add `[WIP]` in your PR title, e.g., `[WIP][Feature] Title of the pull request`.
   
   -->
   
   ## What changes were proposed in this pull request
   
   Issue Number: close #xxx <!-- REMOVE this line if no issue to close -->
   
   <!--(For example: This pull request proposed to add checkstyle plugin).-->
   
   ## Brief change log
   
   <!--*(for example:)*
   - *Add maven-checkstyle-plugin to root pom.xml*
   -->
   
   ## Verifying this change
   
   <!--*(Please pick either of the following options)*-->
   
   This change is a trivial rework / code cleanup without any test coverage.
   
   *(or)*
   
   This change is already covered by existing tests, such as *(please describe tests)*.
   
   *(or)*
   
   This change added tests and can be verified as follows:
   
   <!--*(example:)*
   - *Added integration tests for end-to-end.*
   - *Added *Test to verify the change.*
   - *Manually verified the change by testing locally.* -->
   
   ## Does this pull request potentially affect one of the following parts
    - Dependencies (does it add or upgrade a dependency): (yes / no)
   


-- 
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: issues-unsubscribe@streampark.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-streampark] caicancai commented on pull request #3186: [Feature][Flink-K8s-V2] Add KubernetesApplicationClient.shutdown on Flink-Kubernetes-V2

Posted by "caicancai (via GitHub)" <gi...@apache.org>.
caicancai commented on PR #3186:
URL: https://github.com/apache/incubator-streampark/pull/3186#issuecomment-1736539502

   cc @Al-assad 


-- 
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: issues-unsubscribe@streampark.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-streampark] Al-assad commented on a diff in pull request #3186: [Feature] Add KubernetesApplicationClient.shutdown on Flink-Kubernetes-V2

Posted by "Al-assad (via GitHub)" <gi...@apache.org>.
Al-assad commented on code in PR #3186:
URL: https://github.com/apache/incubator-streampark/pull/3186#discussion_r1335861783


##########
streampark-flink/streampark-flink-client/streampark-flink-client-core/src/main/scala/org/apache/streampark/flink/client/FlinkClientEndpoint.scala:
##########
@@ -80,10 +80,15 @@ object FlinkClientEndpoint {
   def shutdown(request: ShutDownRequest): ShutDownResponse = {
     request.executionMode match {
       case YARN_SESSION => YarnSessionClient.shutdown(request)
-      case KUBERNETES_NATIVE_SESSION => {
-        if (K8sFlinkConfig.isV2Enabled) KubernetesSessionClientV2.shutdown(request)
-        else KubernetesNativeSessionClient.shutdown(request)
-      }
+      case KUBERNETES_NATIVE_SESSION =>
+        K8sFlinkConfig.isV2Enabled match {
+          case true => KubernetesSessionClientV2.shutdown(request)
+          case _ => KubernetesNativeSessionClient.shutdown(request)
+        }
+      case KUBERNETES_NATIVE_APPLICATION =>
+        K8sFlinkConfig.isV2Enabled match {

Review Comment:
   This is still an incorrect pattern matching branch line.
   When KUBERNETES_NATIVE_APPLICATION = true and K8sFlinkConfig.isV2Enables = false, a match missing error will be thrown here.



##########
streampark-flink/streampark-flink-client/streampark-flink-client-core/src/main/scala/org/apache/streampark/flink/client/impl/KubernetesApplicationClientV2.scala:
##########
@@ -241,4 +242,21 @@ object KubernetesApplicationClientV2 extends KubernetesClientV2Trait with Logger
       ))
   }
 
+  @throws[Throwable]
+  def shutdown(shutDownRequest: ShutDownRequest): ShutDownResponse = {
+    val name = shutDownRequest.clusterId
+    val namespace = shutDownRequest.kubernetesDeployParam.kubernetesNamespace
+
+    def richMsg: String => String = s"[flink-shutdown][clusterId=$name][namespace=$namespace] " + _
+
+    FlinkK8sOperator.k8sCrOpr.deleteDeployment(namespace, name).runIOAsTry match {

Review Comment:
    If you directly use the `CROperator` internal API, you need to manually untrack the corresponding resources with `FlinkK8sObserver.untrack`.



-- 
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: issues-unsubscribe@streampark.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [Feature][Flink-K8s-V2] Add KubernetesApplicationClient.shutdown on Flink-Kubernetes-V2 [incubator-streampark]

Posted by "Al-assad (via GitHub)" <gi...@apache.org>.
Al-assad commented on PR #3186:
URL: https://github.com/apache/incubator-streampark/pull/3186#issuecomment-1751987350

   @caicancai  This PR and PR#3216 have the same logical issue. I have fixed it in commit a993111.


-- 
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: issues-unsubscribe@streampark.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [Feature][Flink-K8s-V2] Add KubernetesApplicationClient.shutdown on Flink-Kubernetes-V2 [incubator-streampark]

Posted by "caicancai (via GitHub)" <gi...@apache.org>.
caicancai commented on PR #3186:
URL: https://github.com/apache/incubator-streampark/pull/3186#issuecomment-1751989697

   > @caicancai This PR and PR#3216 have the same logical issue. I have fixed it in commit [a993111](https://github.com/apache/incubator-streampark/commit/a99311195cb1d85c5575368448e964aa6f1ff117).
   
   thank you


-- 
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: issues-unsubscribe@streampark.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-streampark] Al-assad commented on a diff in pull request #3186: [Feature] Add KubernetesApplicationClient.shutdown on Flink-Kubernetes-V2

Posted by "Al-assad (via GitHub)" <gi...@apache.org>.
Al-assad commented on code in PR #3186:
URL: https://github.com/apache/incubator-streampark/pull/3186#discussion_r1335632064


##########
streampark-flink/streampark-flink-client/streampark-flink-client-core/src/main/scala/org/apache/streampark/flink/client/FlinkClientEndpoint.scala:
##########
@@ -84,6 +84,10 @@ object FlinkClientEndpoint {
         if (K8sFlinkConfig.isV2Enabled) KubernetesSessionClientV2.shutdown(request)
         else KubernetesNativeSessionClient.shutdown(request)
       }
+      case KUBERNETES_NATIVE_APPLICATION => {
+        if (K8sFlinkConfig.isV2Enabled) KubernetesApplicationClientV2.shutdown(request)
+        else _

Review Comment:
   The "else _" here will return a runtime error, Modify in pattern matching to `case KUBERNETES_NATIVE_APPLICATION if K8sFlinkConfig.isV2Enabled` 



##########
streampark-flink/streampark-flink-client/streampark-flink-client-core/src/main/scala/org/apache/streampark/flink/client/impl/KubernetesApplicationClientV2.scala:
##########
@@ -241,4 +241,21 @@ object KubernetesApplicationClientV2 extends KubernetesClientV2Trait with Logger
       ))
   }
 
+  @throws[Throwable]
+  def shutdown(shutDownRequest: ShutDownRequest): ShutDownResponse = {
+    val name = shutDownRequest.clusterId
+    val namespace = shutDownRequest.kubernetesDeployParam.kubernetesNamespace
+
+    def richMsg: String => String = s"[flink-shutdown][clusterId=$name][namespace=$namespace] " + _
+
+    FlinkK8sOperator.k8sCrOpr.deleteSessionJob(namespace, name).runIOAsTry match {

Review Comment:
   It should be implemented that in KubernetesApplicationClientV2, the task of removing the Application mode is actually removing the FlinkDeployment CR, not the SessionJob CR



-- 
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: issues-unsubscribe@streampark.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-streampark] Al-assad commented on pull request #3186: [Feature] Add KubernetesApplicationClient.shutdown on Flink-Kubernetes-V2

Posted by "Al-assad (via GitHub)" <gi...@apache.org>.
Al-assad commented on PR #3186:
URL: https://github.com/apache/incubator-streampark/pull/3186#issuecomment-1733353185

   @caicancai  It seems that some errors occurred in the compilation


-- 
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: issues-unsubscribe@streampark.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-streampark] caicancai commented on pull request #3186: [Feature] Add KubernetesApplicationClient.shutdown on Flink-Kubernetes-V2

Posted by "caicancai (via GitHub)" <gi...@apache.org>.
caicancai commented on PR #3186:
URL: https://github.com/apache/incubator-streampark/pull/3186#issuecomment-1733249983

   cc @Al-assad @wolfboys 


-- 
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: issues-unsubscribe@streampark.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [Feature][Flink-K8s-V2] Add KubernetesApplicationClient.shutdown on Flink-Kubernetes-V2 [incubator-streampark]

Posted by "Al-assad (via GitHub)" <gi...@apache.org>.
Al-assad merged PR #3186:
URL: https://github.com/apache/incubator-streampark/pull/3186


-- 
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: issues-unsubscribe@streampark.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-streampark] caicancai commented on pull request #3186: [Feature] Add KubernetesApplicationClient.shutdown on Flink-Kubernetes-V2

Posted by "caicancai (via GitHub)" <gi...@apache.org>.
caicancai commented on PR #3186:
URL: https://github.com/apache/incubator-streampark/pull/3186#issuecomment-1733296542

   This function takes into account whether the user's intention to delete Application in SP is to delete deploy at the same time. The specific method must refer to other projects, so it is currently implemented separately in the v2 module.


-- 
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: issues-unsubscribe@streampark.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-streampark] caicancai commented on pull request #3186: [Feature] Add KubernetesApplicationClient.shutdown on Flink-Kubernetes-V2

Posted by "caicancai (via GitHub)" <gi...@apache.org>.
caicancai commented on PR #3186:
URL: https://github.com/apache/incubator-streampark/pull/3186#issuecomment-1733555078

   @Al-assad  tested


-- 
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: issues-unsubscribe@streampark.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org