wangyang0918 commented on a change in pull request #12003:
URL: https://github.com/apache/flink/pull/12003#discussion_r421923571



##########
File path: 
flink-kubernetes/src/main/java/org/apache/flink/kubernetes/KubernetesClusterDescriptor.java
##########
@@ -146,8 +148,38 @@ public String getClusterDescription() {
        @Override
        public ClusterClientProvider<String> deployApplicationCluster(
                        final ClusterSpecification clusterSpecification,
-                       final ApplicationConfiguration 
applicationConfiguration) {
-               throw new UnsupportedOperationException("Application Mode not 
supported by Active Kubernetes deployments.");
+                       final ApplicationConfiguration 
applicationConfiguration) throws ClusterDeploymentException {
+               if (client.getRestService(clusterId).isPresent()) {
+                       throw new ClusterDeploymentException("The Flink cluster 
" + clusterId + " already exists.");
+               }
+
+               checkNotNull(clusterSpecification);
+               checkNotNull(applicationConfiguration);
+
+               final String deploymentTarget = 
flinkConfig.get(DeploymentOptions.TARGET);
+
+               if 
(!KubernetesConfigOptions.DeploymentTargetNames.APPLICATION.getName().equalsIgnoreCase(deploymentTarget))
 {
+                       throw new ClusterDeploymentException(
+                               "Couldn't deploy Kubernetes Application 
Cluster." +
+                                       " Expected deployment.target=" + 
KubernetesConfigOptions.DeploymentTargetNames.APPLICATION.getName() +
+                                       " but actual one was \"" + 
deploymentTarget + "\"");
+               }
+
+               applicationConfiguration.applyToConfiguration(flinkConfig);
+               KubernetesUtils.checkJarFileForApplicationMode(flinkConfig);

Review comment:
       Yes, it is a sanity check and to make the submission could fail fast. I 
will also use `Preconditions.checkArgument` to check only one jar is returned 
just like in the `KubernetesApplicationClusterEntrypoint`.




----------------------------------------------------------------
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.

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


Reply via email to