Class FlinkUtils
- java.lang.Object
-
- org.apache.flink.kubernetes.operator.utils.FlinkUtils
-
public class FlinkUtils extends java.lang.ObjectFlink Utility methods used by the operator.
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.StringCR_GENERATION_LABEL
-
Constructor Summary
Constructors Constructor Description FlinkUtils()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static booleanclusterShutdownDisabled(FlinkDeploymentSpec spec)static voiddeleteCluster(FlinkDeploymentStatus status, io.fabric8.kubernetes.api.model.ObjectMeta meta, io.fabric8.kubernetes.client.KubernetesClient kubernetesClient, boolean deleteHaConfigmaps, long shutdownTimeout)Delete Flink kubernetes cluster by deleting the kubernetes resources directly.static voiddeleteJobGraphInKubernetesHA(java.lang.String clusterId, java.lang.String namespace, io.fabric8.kubernetes.client.KubernetesClient kubernetesClient)static org.apache.flink.api.common.JobIDgenerateSessionJobFixedJobID(io.fabric8.kubernetes.api.model.ObjectMeta meta)The jobID's lower part is the resource uid, the higher part is the resource generation.static org.apache.flink.api.common.JobIDgenerateSessionJobFixedJobID(java.lang.String uid, java.lang.Long generation)The jobID's lower part is the resource uid, the higher part is the resource generation.static io.fabric8.kubernetes.api.model.PodListgetJmPodList(io.fabric8.kubernetes.client.KubernetesClient kubernetesClient, java.lang.String namespace, java.lang.String clusterId)static intgetNumTaskManagers(org.apache.flink.configuration.Configuration conf)static booleanisHaMetadataAvailable(org.apache.flink.configuration.Configuration conf, io.fabric8.kubernetes.client.KubernetesClient kubernetesClient)static booleanisKubernetesHAActivated(org.apache.flink.configuration.Configuration configuration)static io.fabric8.kubernetes.api.model.PodmergePodTemplates(io.fabric8.kubernetes.api.model.Pod toPod, io.fabric8.kubernetes.api.model.Pod fromPod)static voidsetGenerationAnnotation(org.apache.flink.configuration.Configuration conf, java.lang.Long generation)static voidwaitForClusterShutdown(io.fabric8.kubernetes.client.KubernetesClient kubernetesClient, java.lang.String namespace, java.lang.String clusterId, long shutdownTimeout)Wait until the FLink cluster has completely shut down.static voidwaitForClusterShutdown(io.fabric8.kubernetes.client.KubernetesClient kubernetesClient, org.apache.flink.configuration.Configuration conf, long shutdownTimeout)Wait until the FLink cluster has completely shut down.
-
-
-
Field Detail
-
CR_GENERATION_LABEL
public static final java.lang.String CR_GENERATION_LABEL
- See Also:
- Constant Field Values
-
-
Method Detail
-
mergePodTemplates
public static io.fabric8.kubernetes.api.model.Pod mergePodTemplates(io.fabric8.kubernetes.api.model.Pod toPod, io.fabric8.kubernetes.api.model.Pod fromPod)
-
deleteCluster
public static void deleteCluster(FlinkDeploymentStatus status, io.fabric8.kubernetes.api.model.ObjectMeta meta, io.fabric8.kubernetes.client.KubernetesClient kubernetesClient, boolean deleteHaConfigmaps, long shutdownTimeout)
Delete Flink kubernetes cluster by deleting the kubernetes resources directly. Optionally allows deleting the native kubernetes HA resources as well.- Parameters:
status- Deployment status objectmeta- ObjectMeta of the deploymentkubernetesClient- Kubernetes clientdeleteHaConfigmaps- Flag to indicate whether k8s HA metadata should be removed as wellshutdownTimeout- maximum time allowed for cluster shutdown
-
waitForClusterShutdown
public static void waitForClusterShutdown(io.fabric8.kubernetes.client.KubernetesClient kubernetesClient, java.lang.String namespace, java.lang.String clusterId, long shutdownTimeout)Wait until the FLink cluster has completely shut down.- Parameters:
kubernetesClient- Kubernetes client.namespace- Resource namespace.clusterId- Flink clusterId.shutdownTimeout- Max time allowed for shutdown.
-
waitForClusterShutdown
public static void waitForClusterShutdown(io.fabric8.kubernetes.client.KubernetesClient kubernetesClient, org.apache.flink.configuration.Configuration conf, long shutdownTimeout)Wait until the FLink cluster has completely shut down.- Parameters:
kubernetesClient- Kubernetes client.conf- Flink configuration.shutdownTimeout- Max time allowed for shutdown.
-
getJmPodList
public static io.fabric8.kubernetes.api.model.PodList getJmPodList(io.fabric8.kubernetes.client.KubernetesClient kubernetesClient, java.lang.String namespace, java.lang.String clusterId)
-
deleteJobGraphInKubernetesHA
public static void deleteJobGraphInKubernetesHA(java.lang.String clusterId, java.lang.String namespace, io.fabric8.kubernetes.client.KubernetesClient kubernetesClient)
-
isHaMetadataAvailable
public static boolean isHaMetadataAvailable(org.apache.flink.configuration.Configuration conf, io.fabric8.kubernetes.client.KubernetesClient kubernetesClient)
-
isKubernetesHAActivated
public static boolean isKubernetesHAActivated(org.apache.flink.configuration.Configuration configuration)
-
clusterShutdownDisabled
public static boolean clusterShutdownDisabled(FlinkDeploymentSpec spec)
-
getNumTaskManagers
public static int getNumTaskManagers(org.apache.flink.configuration.Configuration conf)
-
setGenerationAnnotation
public static void setGenerationAnnotation(org.apache.flink.configuration.Configuration conf, java.lang.Long generation)
-
generateSessionJobFixedJobID
public static org.apache.flink.api.common.JobID generateSessionJobFixedJobID(io.fabric8.kubernetes.api.model.ObjectMeta meta)
The jobID's lower part is the resource uid, the higher part is the resource generation.- Parameters:
meta- the meta of the resource.- Returns:
- the generated jobID.
-
generateSessionJobFixedJobID
public static org.apache.flink.api.common.JobID generateSessionJobFixedJobID(java.lang.String uid, java.lang.Long generation)The jobID's lower part is the resource uid, the higher part is the resource generation.- Parameters:
uid- the uid of the resource.generation- the generation of the resource.- Returns:
- the generated jobID.
-
-