public class HazelcastKubernetesDiscoveryStrategyFactory extends Object implements com.hazelcast.spi.discovery.DiscoveryStrategyFactory
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
.
Constructor and Description |
---|
HazelcastKubernetesDiscoveryStrategyFactory() |
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.
|
public HazelcastKubernetesDiscoveryStrategyFactory()
public Class<? extends com.hazelcast.spi.discovery.DiscoveryStrategy> getDiscoveryStrategyType()
getDiscoveryStrategyType
in interface com.hazelcast.spi.discovery.DiscoveryStrategyFactory
HazelcastKubernetesDiscoveryStrategy
class.public com.hazelcast.spi.discovery.DiscoveryStrategy newDiscoveryStrategy(com.hazelcast.spi.discovery.DiscoveryNode discovery, ILogger logger, Map<String,Comparable> configuration)
newDiscoveryStrategy
in interface com.hazelcast.spi.discovery.DiscoveryStrategyFactory
discovery
- the discovery nodelogger
- the loggerconfiguration
- the configurationpublic Collection<com.hazelcast.config.properties.PropertyDefinition> getConfigurationProperties()
getConfigurationProperties
in interface com.hazelcast.spi.discovery.DiscoveryStrategyFactory
Copyright © 2016. All rights reserved.