Search in sources :

Example 6 with KubernetesException

use of org.apache.flink.kubernetes.kubeclient.resources.KubernetesException in project flink by apache.

the class KubernetesMultipleComponentLeaderElectionDriver method hasLeadership.

@Override
public boolean hasLeadership() {
    Preconditions.checkState(running.get());
    final Optional<KubernetesConfigMap> optionalConfigMap = kubeClient.getConfigMap(configMapName);
    if (optionalConfigMap.isPresent()) {
        return KubernetesLeaderElector.hasLeadership(optionalConfigMap.get(), lockIdentity);
    } else {
        fatalErrorHandler.onFatalError(new KubernetesException(String.format("ConfigMap %s does not exist. This indicates that somebody has interfered with Flink's operation.", configMapName)));
        return false;
    }
}
Also used : KubernetesConfigMap(org.apache.flink.kubernetes.kubeclient.resources.KubernetesConfigMap) KubernetesException(org.apache.flink.kubernetes.kubeclient.resources.KubernetesException)

Aggregations

KubernetesConfigMap (org.apache.flink.kubernetes.kubeclient.resources.KubernetesConfigMap)6 KubernetesException (org.apache.flink.kubernetes.kubeclient.resources.KubernetesException)6 Optional (java.util.Optional)4 FlinkKubeClient (org.apache.flink.kubernetes.kubeclient.FlinkKubeClient)4 KubernetesLeaderElector (org.apache.flink.kubernetes.kubeclient.resources.KubernetesLeaderElector)4 List (java.util.List)3 Map (java.util.Map)3 CompletionException (java.util.concurrent.CompletionException)3 Preconditions.checkNotNull (org.apache.flink.util.Preconditions.checkNotNull)3 Logger (org.slf4j.Logger)3 LoggerFactory (org.slf4j.LoggerFactory)3 ArrayList (java.util.ArrayList)2 HashMap (java.util.HashMap)2 Nullable (javax.annotation.Nullable)2 KubernetesConfigMapSharedWatcher (org.apache.flink.kubernetes.kubeclient.KubernetesConfigMapSharedWatcher)2 LABEL_CONFIGMAP_TYPE_HIGH_AVAILABILITY (org.apache.flink.kubernetes.utils.Constants.LABEL_CONFIGMAP_TYPE_HIGH_AVAILABILITY)2 KubernetesUtils (org.apache.flink.kubernetes.utils.KubernetesUtils)2 IOException (java.io.IOException)1 Serializable (java.io.Serializable)1 Base64 (java.util.Base64)1