-
Notifications
You must be signed in to change notification settings - Fork 104
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Feature][scaleph-application-flink] support session job by flink kub…
…ernetes operator (#734) * feature: add doris dependency for seatunnel doris connector * feature: update flink session job handler * feature: update flink session job handler * feature: update flink session job handler --------- Co-authored-by: wangqi <wangqi@xinxuan.net>
- Loading branch information
Showing
14 changed files
with
348 additions
and
35 deletions.
There are no files selected for viewing
70 changes: 70 additions & 0 deletions
70
.github/workflows/release-manual-docker-flink-kubernetes-operator.yml
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,70 @@ | ||
# 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. | ||
|
||
name: Release-Docker-Flink-CDC | ||
|
||
on: | ||
workflow_dispatch: | ||
inputs: | ||
flinkKubernetesOperatorVersion: | ||
description: 'flink-kubernetes operator version' | ||
required: true | ||
default: '1.8.0' | ||
type: choice | ||
options: | ||
- 1.8.0 | ||
|
||
env: | ||
HUB: ghcr.io/flowerfine/flink-kubernetes-operator | ||
FLINK_KUBERNETES_OPERATOR_VERSION: ${{ inputs.flinkKubernetesOperatorVersion }} | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
permissions: | ||
contents: read | ||
packages: write | ||
timeout-minutes: 360 | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 1 | ||
- name: Log in to the Container registry | ||
uses: docker/login-action@3 | ||
with: | ||
registry: ${{ env.HUB }} | ||
username: ${{ github.actor }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
- name: Set up QEMU | ||
uses: docker/setup-qemu-action@v3 | ||
with: | ||
platforms: amd64,arm64 | ||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v3 | ||
- name: Build image | ||
uses: docker/build-push-action@v5 | ||
with: | ||
no-cache: false | ||
cache-from: type=gha | ||
cache-to: type=gha | ||
push: true | ||
context: . | ||
build-args: | | ||
FLINK_KUBERNETES_OPERATOR_VERSION=${{ env.FLINK_KUBERNETES_OPERATOR_VERSION }} | ||
platforms: linux/amd64,linux/arm64 | ||
file: tools/docker/build/flink-kubernetes-operator/Dockerfile | ||
tags: ${{ env.HUB }}:${{ env.FLINK_KUBERNETES_OPERATOR_VERSION }} |
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
66 changes: 66 additions & 0 deletions
66
...ph/application/flink/resource/definition/job/instance/FlinkSessionJobArtifactHandler.java
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,66 @@ | ||
/* | ||
* 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 cn.sliew.scaleph.application.flink.resource.definition.job.instance; | ||
|
||
import cn.sliew.scaleph.application.flink.operator.spec.FlinkSessionJobSpec; | ||
import cn.sliew.scaleph.application.flink.operator.spec.JobSpec; | ||
import cn.sliew.scaleph.application.flink.service.dto.WsFlinkKubernetesJobInstanceDTO; | ||
import cn.sliew.scaleph.common.dict.flink.FlinkJobType; | ||
import cn.sliew.scaleph.common.dict.flink.kubernetes.DeploymentKind; | ||
import cn.sliew.scaleph.dao.entity.master.ws.WsArtifactFlinkJar; | ||
import org.springframework.stereotype.Component; | ||
import org.springframework.util.StringUtils; | ||
|
||
@Component | ||
public class FlinkSessionJobArtifactHandler implements ArtifactHandler { | ||
|
||
@Override | ||
public boolean support(DeploymentKind deploymentKind) { | ||
return deploymentKind == DeploymentKind.FLINK_SESSION_JOB; | ||
} | ||
|
||
@Override | ||
public boolean support(FlinkJobType flinkJobType) { | ||
switch (flinkJobType) { | ||
case JAR: | ||
return true; | ||
default: | ||
return false; | ||
} | ||
} | ||
|
||
public void handle(WsFlinkKubernetesJobInstanceDTO jobInstanceDTO, Object spec) { | ||
FlinkSessionJobSpec flinkSessionJobSpec = (FlinkSessionJobSpec) spec; | ||
switch (jobInstanceDTO.getWsFlinkKubernetesJob().getType()) { | ||
case JAR: | ||
addJarArtifact(jobInstanceDTO, flinkSessionJobSpec); | ||
break; | ||
default: | ||
} | ||
} | ||
|
||
private void addJarArtifact(WsFlinkKubernetesJobInstanceDTO jobInstanceDTO, FlinkSessionJobSpec spec) { | ||
WsArtifactFlinkJar artifactFlinkJar = jobInstanceDTO.getWsFlinkKubernetesJob().getArtifactFlinkJar(); | ||
JobSpec jobSpec = new JobSpec(); | ||
jobSpec.setJarURI(artifactFlinkJar.getPath()); | ||
jobSpec.setEntryClass(artifactFlinkJar.getEntryClass()); | ||
jobSpec.setArgs(StringUtils.split(artifactFlinkJar.getJarParams(), " ")); | ||
spec.setJob(jobSpec); | ||
} | ||
} |
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
40 changes: 40 additions & 0 deletions
40
...main/java/cn/sliew/scaleph/application/flink/resource/handler/FileSystemParamHandler.java
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,40 @@ | ||
/* | ||
* 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 cn.sliew.scaleph.application.flink.resource.handler; | ||
|
||
import cn.sliew.scaleph.application.flink.operator.spec.AbstractFlinkSpec; | ||
import org.springframework.beans.factory.annotation.Autowired; | ||
import org.springframework.stereotype.Component; | ||
|
||
import java.util.HashMap; | ||
import java.util.Map; | ||
import java.util.Optional; | ||
|
||
@Component | ||
public class FileSystemParamHandler { | ||
|
||
@Autowired | ||
private FileSystemPluginHandler fileSystemPluginHandler; | ||
|
||
public void handle(AbstractFlinkSpec spec) { | ||
Map<String, String> configuration = Optional.ofNullable(spec.getFlinkConfiguration()).orElse(new HashMap<>()); | ||
fileSystemPluginHandler.addFileSystemConfigOption(configuration); | ||
spec.setFlinkConfiguration(configuration); | ||
} | ||
} |
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
Oops, something went wrong.