public class Fabric8FlinkKubeClient extends Object implements FlinkKubeClient
FlinkKubeClient
.FlinkKubeClient.PodCallbackHandler
Constructor and Description |
---|
Fabric8FlinkKubeClient(Configuration flinkConfig,
io.fabric8.kubernetes.client.KubernetesClient client,
java.util.function.Supplier<ExecutorService> asyncExecutorFactory) |
Modifier and Type | Method and Description |
---|---|
void |
close() |
void |
createConfigMap()
Create kubernetes config map, include flink-conf.yaml, log4j.properties.
|
void |
createFlinkMasterDeployment(ClusterSpecification clusterSpecification)
Create flink master deployment with replication of 1.
|
CompletableFuture<KubernetesService> |
createInternalService(String clusterId)
Create kubernetes service for internal use.
|
CompletableFuture<KubernetesService> |
createRestService(String clusterId)
Create kubernetes service for rest port.
|
CompletableFuture<Void> |
createTaskManagerPod(TaskManagerPodParameter parameter)
Create task manager pod.
|
Optional<KubernetesService> |
getInternalService(String clusterId)
Get the kubernetes internal service of the given flink clusterId.
|
List<KubernetesPod> |
getPodsWithLabels(Map<String,String> labels)
List the pods with specified labels.
|
Optional<Endpoint> |
getRestEndpoint(String clusterId)
Get the rest endpoint for access outside cluster.
|
Optional<KubernetesService> |
getRestService(String clusterId)
Get the kubernetes rest service of the given flink clusterId.
|
void |
handleException(Exception e)
Log exceptions.
|
void |
stopAndCleanupCluster(String clusterId)
Stop cluster and clean up all resources, include services, auxiliary services and all running pods.
|
CompletableFuture<Void> |
stopPod(String podName)
Stop a specified pod by name.
|
KubernetesWatch |
watchPodsAndDoCallback(Map<String,String> labels,
FlinkKubeClient.PodCallbackHandler podCallbackHandler)
Watch the pods selected by labels and do the
FlinkKubeClient.PodCallbackHandler . |
public Fabric8FlinkKubeClient(Configuration flinkConfig, io.fabric8.kubernetes.client.KubernetesClient client, java.util.function.Supplier<ExecutorService> asyncExecutorFactory)
public void createConfigMap()
FlinkKubeClient
createConfigMap
in interface FlinkKubeClient
public CompletableFuture<KubernetesService> createInternalService(String clusterId)
FlinkKubeClient
createInternalService
in interface FlinkKubeClient
clusterId
- cluster idpublic CompletableFuture<KubernetesService> createRestService(String clusterId)
FlinkKubeClient
createRestService
in interface FlinkKubeClient
clusterId
- cluster idpublic void createFlinkMasterDeployment(ClusterSpecification clusterSpecification)
FlinkKubeClient
createFlinkMasterDeployment
in interface FlinkKubeClient
clusterSpecification
- ClusterSpecification
to create the flink master deployment.public CompletableFuture<Void> createTaskManagerPod(TaskManagerPodParameter parameter)
FlinkKubeClient
createTaskManagerPod
in interface FlinkKubeClient
parameter
- TaskManagerPodParameter
to create a taskmanager pod.public CompletableFuture<Void> stopPod(String podName)
FlinkKubeClient
stopPod
in interface FlinkKubeClient
podName
- pod namepublic Optional<Endpoint> getRestEndpoint(String clusterId)
FlinkKubeClient
getRestEndpoint
in interface FlinkKubeClient
clusterId
- cluster idpublic List<KubernetesPod> getPodsWithLabels(Map<String,String> labels)
FlinkKubeClient
getPodsWithLabels
in interface FlinkKubeClient
labels
- labels to filter the podspublic void stopAndCleanupCluster(String clusterId)
FlinkKubeClient
stopAndCleanupCluster
in interface FlinkKubeClient
clusterId
- cluster idpublic void handleException(Exception e)
FlinkKubeClient
handleException
in interface FlinkKubeClient
public Optional<KubernetesService> getInternalService(String clusterId)
FlinkKubeClient
getInternalService
in interface FlinkKubeClient
clusterId
- cluster idpublic Optional<KubernetesService> getRestService(String clusterId)
FlinkKubeClient
getRestService
in interface FlinkKubeClient
clusterId
- cluster idpublic KubernetesWatch watchPodsAndDoCallback(Map<String,String> labels, FlinkKubeClient.PodCallbackHandler podCallbackHandler)
FlinkKubeClient
FlinkKubeClient.PodCallbackHandler
.watchPodsAndDoCallback
in interface FlinkKubeClient
labels
- labels to filter the pods to watchpodCallbackHandler
- podCallbackHandler which reacts to pod eventspublic void close()
close
in interface AutoCloseable
Copyright © 2014–2020 The Apache Software Foundation. All rights reserved.