io.vertx.servicediscovery.hazelcast

## Class HazelcastKubernetesDiscoveryStrategyFactory

- java.lang.Object
- - io.vertx.servicediscovery.hazelcast.HazelcastKubernetesDiscoveryStrategyFactory

- All Implemented Interfaces:
    com.hazelcast.spi.discovery.DiscoveryStrategyFactory

      public class HazelcastKubernetesDiscoveryStrategyFactory
      extends Object
      implements com.hazelcast.spi.discovery.DiscoveryStrategyFactory

  Discovery SPI implementation of Hazelcast to support Kubernetes-based discovery. This implementation is very close to the "official" hazelcast plugin, when remove some limitations such as the Kubernetes master url, and does not rely on DNS (but on service lookup), and is specific to vert.x.

  It works as follows:

  * when the discovery strategy is instantiated, it resolved the known nodes * known nodes are found by doing a Kubernetes query: it looks for all endpoints (~services) with a specific label (`vertx-cluster`=`true`). The query is made on the label name and label value.

  By default it uses the port 5701 to connected. If the endpoints defines the `hazelcast-service-port`, the indicated value is used.

  Can be configured:

  * "namespace" : the kubernetes namespace / project, by default it tries to read the `OPENSHIFT_BUILD_NAMESPACE` environment variable. If not defined, it uses "default" * "service-label-name" : the name of the label to look for, "vertx-cluster" by default. * "service-label-name" : the name of the label to look for, "true" by default. * "kubernetes-master" : the url of the Kubernetes master, by default it builds the url from the `KUBERNETES_SERVICE_HOST` and `KUBERNETES_SERVICE_PORT`. * "kubernetes-token" : the bearer token to use to connect to Kubernetes, it uses the content of the `/var/run/secrets/kubernetes.io/serviceaccount/token` file by default.

  If you use Openshift and follow the service name convention, you just need to configure the `namespace`.

  Author:
    Clement Escoffier

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `HazelcastKubernetesDiscoveryStrategyFactory()`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `Collection<com.hazelcast.config.properties.PropertyDefinition>` | `getConfigurationProperties()`
    `Class<? extends com.hazelcast.spi.discovery.DiscoveryStrategy>` | `getDiscoveryStrategyType()`
    `com.hazelcast.spi.discovery.DiscoveryStrategy` | `newDiscoveryStrategy(com.hazelcast.spi.discovery.DiscoveryNode discovery, ILogger logger, Map<String,Comparable> configuration)` Creates a new instance of the strategy.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### HazelcastKubernetesDiscoveryStrategyFactory

          public HazelcastKubernetesDiscoveryStrategyFactory()

  - ### Method Detail

    - #### getDiscoveryStrategyType

          public Class<? extends com.hazelcast.spi.discovery.DiscoveryStrategy> getDiscoveryStrategyType()

      Specified by:
        `getDiscoveryStrategyType` in interface `com.hazelcast.spi.discovery.DiscoveryStrategyFactory`
      Returns:
        the `HazelcastKubernetesDiscoveryStrategy` class.

    - #### newDiscoveryStrategy

          public com.hazelcast.spi.discovery.DiscoveryStrategy newDiscoveryStrategy(com.hazelcast.spi.discovery.DiscoveryNode discovery,
                                                                                    ILogger logger,
                                                                                    Map<String,Comparable> configuration)

      Creates a new instance of the strategy.
      Specified by:
        `newDiscoveryStrategy` in interface `com.hazelcast.spi.discovery.DiscoveryStrategyFactory`
      Parameters:
        `discovery` - the discovery node
        `logger` - the logger
        `configuration` - the configuration
      Returns:
        the created instance

    - #### getConfigurationProperties

          public Collection<com.hazelcast.config.properties.PropertyDefinition> getConfigurationProperties()

      Specified by:
        `getConfigurationProperties` in interface `com.hazelcast.spi.discovery.DiscoveryStrategyFactory`
      Returns:
        the configuration properties.

Copyright © 2016. All rights reserved.