You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@flink.apache.org by "lvyanquan (via GitHub)" <gi...@apache.org> on 2024/03/08 10:06:54 UTC

Re: [PR] [cdc][cli][2934]Submit CDC Job To Flink K8S Native Application Mode [flink-cdc]

lvyanquan commented on code in PR #3093:
URL: https://github.com/apache/flink-cdc/pull/3093#discussion_r1517511917


##########
flink-cdc-composer/src/main/java/org/apache/flink/cdc/composer/flink/executors/K8SApplicationComposeExecutor.java:
##########
@@ -0,0 +1,88 @@
+/*
+ * Copyright 2023 Ververica Inc.
+ *
+ * Licensed 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.flink.cdc.composer.flink.executors;
+
+import org.apache.flink.cdc.composer.PipelineComposeExecutor;
+import org.apache.flink.cdc.composer.PipelineExecution;
+import org.apache.flink.client.deployment.ClusterSpecification;
+import org.apache.flink.client.deployment.application.ApplicationConfiguration;
+import org.apache.flink.client.program.ClusterClient;
+import org.apache.flink.client.program.ClusterClientProvider;
+import org.apache.flink.configuration.Configuration;
+import org.apache.flink.configuration.DeploymentOptions;
+import org.apache.flink.configuration.PipelineOptions;
+import org.apache.flink.kubernetes.KubernetesClusterClientFactory;
+import org.apache.flink.kubernetes.KubernetesClusterDescriptor;
+import org.apache.flink.kubernetes.configuration.KubernetesConfigOptions;
+import org.apache.flink.kubernetes.configuration.KubernetesDeploymentTarget;
+
+import org.apache.commons.cli.CommandLine;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.nio.file.Path;
+import java.util.ArrayList;
+import java.util.List;
+
+public class K8SApplicationComposeExecutor implements PipelineComposeExecutor {
+
+    private static final Logger LOG = LoggerFactory.getLogger(K8SApplicationComposeExecutor.class);
+
+    @Override
+    public PipelineExecution.ExecutionInfo deploy(
+            CommandLine commandLine, Configuration flinkConfig, List<Path> additionalJars) {
+        LOG.info("Submitting application in 'Flink K8S Application Mode'.");
+        flinkConfig.set(DeploymentOptions.TARGET, KubernetesDeploymentTarget.APPLICATION.getName());
+        List<String> jars =
+                new ArrayList<>();
+        // must be added cdc dist jar by default docker container path
+        jars.add("local:///opt/flink-cdc/lib/flink-cdc-dist-3.0-SNAPSHOT.jar");
+        flinkConfig.set(PipelineOptions.JARS, jars);
+        // set the default cdc latest docker image
+        flinkConfig.set(KubernetesConfigOptions.CONTAINER_IMAGE, "flink/flink-cdc:latest");

Review Comment:
   Can we config this using flink-conf.yaml?



-- 
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: commits-unsubscribe@flink.apache.org

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