-
Notifications
You must be signed in to change notification settings - Fork 1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Feat][Flink-K8s-V2] Refactor the lifecycle control of Flink K8s application-mode jobs #3037
Merged
Merged
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
75232a8
[Feat] Refactor Flink resource build pipeline for fink-k8s-v2 module.…
Al-assad 252024a
[Feat] Adaptation of the submission client for flink-k8s-v2. #2882
Al-assad cfc7c8c
[Feat][flink-k8s-v2] Migrate ENABLE_V2 to streampark-common module. #…
Al-assad 5cc1a32
[Feat][flink-k8s-v2] Disable Flink job tracking watcher at flink-k8s-…
Al-assad 056fbfc
[Feat][flink-k8s-v2] Adaptation of Flink job canceling and triggering…
Al-assad f39a840
[Feat][flink-k8s-v2] Untrack flink when it is deleted. #2882
Al-assad File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
30 changes: 30 additions & 0 deletions
30
streampark-common/src/main/scala/org/apache/streampark/common/zio/ZIOJavaUtil.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
/* | ||
* Licensed to the Apache Software Foundation (ASF) under one or more | ||
* contributor license agreements. See the NOTICE file distributed with | ||
* this work for additional information regarding copyright ownership. | ||
* The ASF licenses this file to You under the Apache License, Version 2.0 | ||
* (the "License"); you may not use this file except in compliance with | ||
* the License. You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
package org.apache.streampark.common.zio | ||
|
||
import zio.{FiberFailure, IO, UIO} | ||
|
||
/** Util for running ZIO effects in Java. */ | ||
object ZIOJavaUtil { | ||
|
||
@throws[FiberFailure] | ||
def runIO[E, A](zio: IO[E, A]): A = ZIOExt.unsafeRun(zio) | ||
|
||
def runUIO[A](uio: UIO[A]): A = ZIOExt.unsafeRun(uio) | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -294,6 +294,7 @@ public void cancel(Application appParam) throws Exception { | |
|
||
CancelRequest cancelRequest = | ||
new CancelRequest( | ||
application.getId(), | ||
flinkEnv.getFlinkVersion(), | ||
ExecutionMode.of(application.getExecutionMode()), | ||
properties, | ||
|
@@ -413,10 +414,13 @@ public void start(Application appParam, boolean auto) throws Exception { | |
extraParameter.put(ConfigConst.KEY_FLINK_SQL(null), flinkSql.getSql()); | ||
} | ||
|
||
// TODO Need to display more K8s submission parameters in the front-end UI. | ||
// See: org.apache.streampark.flink.client.bean.KubernetesSubmitParam | ||
KubernetesSubmitParam kubernetesSubmitParam = | ||
new KubernetesSubmitParam( | ||
KubernetesSubmitParam.apply( | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. good job |
||
application.getClusterId(), | ||
application.getK8sNamespace(), | ||
application.getFlinkImage(), | ||
application.getK8sRestExposedTypeEnum()); | ||
|
||
Tuple2<String, String> userJarAndAppConf = getUserJarAndAppConf(flinkEnv, application); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
78 changes: 78 additions & 0 deletions
78
...nt-api/src/main/scala/org/apache/streampark/flink/client/bean/KubernetesSubmitParam.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
/* | ||
* Licensed to the Apache Software Foundation (ASF) under one or more | ||
* contributor license agreements. See the NOTICE file distributed with | ||
* this work for additional information regarding copyright ownership. | ||
* The ASF licenses this file to You under the Apache License, Version 2.0 | ||
* (the "License"); you may not use this file except in compliance with | ||
* the License. You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
package org.apache.streampark.flink.client.bean | ||
|
||
import org.apache.streampark.common.enums.FlinkK8sRestExposedType | ||
|
||
import javax.annotation.Nullable | ||
|
||
import java.util | ||
import java.util.{Map => JMap} | ||
|
||
/** | ||
* TODO Need to display more K8s submission parameters in the front-end UI. | ||
* | ||
* It will eventually be converted to | ||
* [[org.apache.streampark.flink.kubernetes.v2.model.FlinkDeploymentDef]] | ||
* | ||
* The logic of conversion is located at: | ||
* [[org.apache.streampark.flink.client.impl.KubernetesApplicationClientV2#genFlinkDeployDef]] | ||
*/ | ||
// todo split into Application mode and SessionJob mode | ||
case class KubernetesSubmitParam( | ||
clusterId: String, | ||
kubernetesNamespace: String, | ||
baseImage: Option[String] = None, | ||
imagePullPolicy: Option[String] = None, | ||
serviceAccount: Option[String] = None, | ||
podTemplate: Option[String] = None, | ||
jobManagerCpu: Option[Double] = None, | ||
jobManagerMemory: Option[String] = None, | ||
jobManagerEphemeralStorage: Option[String] = None, | ||
jobManagerPodTemplate: Option[String] = None, | ||
taskManagerCpu: Option[Double] = None, | ||
taskManagerMemory: Option[String] = None, | ||
taskManagerEphemeralStorage: Option[String] = None, | ||
taskManagerPodTemplate: Option[String] = None, | ||
logConfiguration: JMap[String, String] = new util.HashMap[String, String](), | ||
flinkRestExposedType: Option[FlinkK8sRestExposedType] = None | ||
) | ||
|
||
object KubernetesSubmitParam { | ||
|
||
/** | ||
* Compatible with streampark old native k8s submission parameters. | ||
* | ||
* @param clusterId | ||
* flink cluster id in k8s cluster. | ||
* @param kubernetesNamespace | ||
* k8s namespace. | ||
* @param flinkRestExposedType | ||
* flink rest-service exposed type on k8s cluster. | ||
*/ | ||
def apply( | ||
clusterId: String, | ||
kubernetesNamespace: String, | ||
baseImage: String, | ||
@Nullable flinkRestExposedType: FlinkK8sRestExposedType): KubernetesSubmitParam = | ||
KubernetesSubmitParam( | ||
clusterId = clusterId, | ||
kubernetesNamespace = kubernetesNamespace, | ||
baseImage = Some(baseImage), | ||
flinkRestExposedType = Option(flinkRestExposedType)) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
StreamPark consists of two parts: a development framework and a stream processing platform. The development framework part provides some APIs to users. The parameter InternalOption was originally designed for internal use within the platform, It is a non-public API. Therefore, these parameters can be deleted directly without causing any other impact on users