Source:
<code>private int run(String[] args) throws FlinkException, CliArgsException { final Configuration configuration = getEffectiveConfiguration(args); final ClusterClientFactory<String> kubernetesClusterClientFactory = clusterClientServiceLoader.getClusterClientFactory(configuration); final ClusterDescriptor<String> kubernetesClusterDescriptor = kubernetesClusterClientFactory.createClusterDescriptor(configuration); try { final ClusterClientProvider<String> clusterClientProvider; String clusterId = kubernetesClusterClientFactory.getClusterId(configuration); final boolean detached = !configuration.get(DeploymentOptions.ATTACHED); boolean connectToExistingCluster = false; try (final FlinkKubeClient kubeClient = KubeClientFactory.fromConfiguration(configuration)) { <START> connectToExistingCluster = clusterId != null && kubeClient.getRestService(clusterId).isPresent(); <END> } catch (Exception e) { LOG.info("Could not properly shutdown cluster client.", e); } if (connectToExistingCluster) { clusterClientProvider = kubernetesClusterDescriptor.retrieve(clusterId); } else { clusterClientProvider = kubernetesClusterDescriptor .deploySessionCluster( kubernetesClusterClientFactory.getClusterSpecification(configuration)); } if (!detached) { if (!connectToExistingCluster) { try (ClusterClient<String> clusterClient = clusterClientProvider.getClusterClient()) { clusterId = clusterClient.getClusterId(); } catch (Exception e) { LOG.info("Could not properly shutdown cluster client.", e); } } Tuple2<Boolean, Boolean> continueRepl = new Tuple2<>(true, false); try (BufferedReader in = new BufferedReader(new InputStreamReader(System.in))) { while (continueRepl.f0) { continueRepl = repStep(in); } } catch (Exception e) { LOG.warn("Exception while running the interactive command line interface.", e); } if (continueRepl.f1) { try { kubernetesClusterDescriptor.killCluster(clusterId); } catch (FlinkException e) { LOG.info("An error occurred while shutting down the cluster {}.", clusterId, e); } } } } finally { try { kubernetesClusterDescriptor.close(); } catch (Exception e) { LOG.info("Could not properly close the kubernetes cluster descriptor.", e); } } return 0; }</code><technical_language>is calling getClusterClient a problem? call RestClusterClient do reach cluster</technical_language>

Target:
private int run(String[] args) throws FlinkException, CliArgsException { final Configuration configuration = getEffectiveConfiguration(args); KubernetesClusterClientFactory.ensureClusterIdIsSet(configuration); final ClusterClientFactory<String> kubernetesClusterClientFactory = clusterClientServiceLoader.getClusterClientFactory(configuration); final ClusterDescriptor<String> kubernetesClusterDescriptor = kubernetesClusterClientFactory.createClusterDescriptor(configuration); try { final String clusterId = kubernetesClusterClientFactory.getClusterId(configuration); final boolean detached = !configuration.get(DeploymentOptions.ATTACHED); boolean connectToExistingCluster = false; try (final FlinkKubeClient kubeClient = KubeClientFactory.fromConfiguration(configuration)) { connectToExistingCluster = kubeClient.getRestService(clusterId).isPresent(); } catch (Exception e) { LOG.info("Could not properly shutdown cluster client.", e); } if (connectToExistingCluster) { kubernetesClusterDescriptor.retrieve(clusterId); } else { kubernetesClusterDescriptor .deploySessionCluster( kubernetesClusterClientFactory.getClusterSpecification(configuration)); } if (!detached) { Tuple2<Boolean, Boolean> continueRepl = new Tuple2<>(true, false); try (BufferedReader in = new BufferedReader(new InputStreamReader(System.in))) { while (continueRepl.f0) { continueRepl = repStep(in); } } catch (Exception e) { LOG.warn("Exception while running the interactive command line interface.", e); } if (continueRepl.f1) { try { kubernetesClusterDescriptor.killCluster(clusterId); } catch (FlinkException e) { LOG.info("An error occurred while shutting down the cluster {}.", clusterId, e); } } } } finally { try { kubernetesClusterDescriptor.close(); } catch (Exception e) { LOG.info("Could not properly close the kubernetes cluster descriptor.", e); } } return 0; }