You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@flink.apache.org by GitBox <gi...@apache.org> on 2020/08/19 07:04:41 UTC

[GitHub] [flink] tillrohrmann commented on a change in pull request #13190: [FLINK-18986][kubernetes] Create ClusterClient only for attached deployments

tillrohrmann commented on a change in pull request #13190:
URL: https://github.com/apache/flink/pull/13190#discussion_r472783027



##########
File path: flink-kubernetes/src/main/java/org/apache/flink/kubernetes/cli/KubernetesSessionCli.java
##########
@@ -96,40 +97,51 @@ private int run(String[] args) throws FlinkException, CliArgsException {
 			kubernetesClusterClientFactory.createClusterDescriptor(configuration);
 
 		try {
-			final ClusterClient<String> clusterClient;
+			final ClusterClientProvider<String> clusterClientProvider;
 			String clusterId = kubernetesClusterClientFactory.getClusterId(configuration);
 			final boolean detached = !configuration.get(DeploymentOptions.ATTACHED);
-			final FlinkKubeClient kubeClient = KubeClientFactory.fromConfiguration(configuration);
+
+			boolean connectToExistingCluster = false;
+			try (final FlinkKubeClient kubeClient = KubeClientFactory.fromConfiguration(configuration)) {
+				connectToExistingCluster = clusterId != null && kubeClient.getRestService(clusterId).isPresent();
+			} catch (Exception e) {
+				LOG.info("Could not properly shutdown cluster client.", e);
+			}
 
 			// Retrieve or create a session cluster.
-			if (clusterId != null && kubeClient.getRestService(clusterId).isPresent()) {
-				clusterClient = kubernetesClusterDescriptor.retrieve(clusterId).getClusterClient();

Review comment:
       Why is calling `getClusterClient` a problem? Which call does the `RestClusterClient` do where it cannot reach the cluster?




----------------------------------------------------------------
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:
users@infra.apache.org