//package org.springblade.etl.engine.flink.client.session;
//
//import java.nio.file.Path;
//
//import org.apache.flink.api.java.tuple.Tuple2;
//import org.apache.flink.client.deployment.ClusterDeploymentException;
//import org.apache.flink.client.deployment.ClusterSpecification;
//import org.apache.flink.client.program.ClusterClient;
//import org.apache.flink.client.program.ClusterClientProvider;
//import org.apache.flink.configuration.Configuration;
//import org.apache.flink.kubernetes.KubernetesClusterDescriptor;
//import org.springblade.etl.engine.flink.util.FlinkKit;
//
//import lombok.extern.slf4j.Slf4j;
//
///**
// * Native Kubernetes 部署需要利用 ${user.home}/.kube/config 信息获取 Kubernetes 信息
// */
//@Slf4j
//public class KubernetesSessionCreateCommand implements SessionCommand {
//
//    @Override
//    public Tuple2<String, ClusterClient> create(Path flinkHome, Configuration configuration) throws Exception {
//        KubernetesClusterDescriptor clusterDescriptor = (KubernetesClusterDescriptor) FlinkKit.createClusterDescriptor(configuration);
//        ClusterSpecification clusterSpecification = FlinkKit.createClusterSpecification(configuration);
//        ClusterClient<String> clusterClient = createClusterClient(clusterDescriptor, clusterSpecification);
//        return new Tuple2<>(clusterClient.getClusterId().toString(), clusterClient);
//    }
//
//    private ClusterClient<String> createClusterClient(KubernetesClusterDescriptor clusterDescriptor,
//                                                      ClusterSpecification clusterSpecification) throws ClusterDeploymentException {
//        ClusterClientProvider<String> provider = clusterDescriptor.deploySessionCluster(clusterSpecification);
//        ClusterClient<String> clusterClient = provider.getClusterClient();
//        log.info("deploy session with clusterId: {}", clusterClient.getClusterId());
//        return clusterClient;
//    }
//}
