Package com.hazelcast.kubernetes
Class HazelcastKubernetesDiscoveryStrategyFactory
java.lang.Object
com.hazelcast.kubernetes.HazelcastKubernetesDiscoveryStrategyFactory
- All Implemented Interfaces:
DiscoveryStrategyFactory
public class HazelcastKubernetesDiscoveryStrategyFactory
extends Object
implements DiscoveryStrategyFactory
Just the factory to create the Kubernetes Discovery Strategy
-
Nested Class Summary
Nested classes/interfaces inherited from interface com.hazelcast.spi.discovery.DiscoveryStrategyFactory
DiscoveryStrategyFactory.DiscoveryStrategyLevel -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionLevel of the discovery strategy.Returns a set of the expected configuration properties.Class<? extends DiscoveryStrategy>Returns the type of theDiscoveryStrategyitself.booleanIn all Kubernetes environments the file "/var/run/secrets/kubernetes.io/serviceaccount/token" is injected into the container.newDiscoveryStrategy(DiscoveryNode discoveryNode, ILogger logger, Map<String, Comparable> properties) Instantiates a new instance of theDiscoveryStrategywith the given configuration properties.
-
Constructor Details
-
HazelcastKubernetesDiscoveryStrategyFactory
public HazelcastKubernetesDiscoveryStrategyFactory()
-
-
Method Details
-
getDiscoveryStrategyType
Description copied from interface:DiscoveryStrategyFactoryReturns the type of theDiscoveryStrategyitself.- Specified by:
getDiscoveryStrategyTypein interfaceDiscoveryStrategyFactory- Returns:
- the type of the discovery strategy
-
newDiscoveryStrategy
public DiscoveryStrategy newDiscoveryStrategy(DiscoveryNode discoveryNode, ILogger logger, Map<String, Comparable> properties) Description copied from interface:DiscoveryStrategyFactoryInstantiates a new instance of theDiscoveryStrategywith the given configuration properties. The providedHazelcastInstancecan be used to register instances in a service registry whenever the discovery strategy is started.- Specified by:
newDiscoveryStrategyin interfaceDiscoveryStrategyFactory- Parameters:
discoveryNode- the current localDiscoveryNode, representing the local connection information if running on a Hazelcast member, otherwise on Hazelcast clients alwaysnulllogger- the logger instanceproperties- the properties parsed from the configuration- Returns:
- a new instance of the discovery strategy
-
getConfigurationProperties
Description copied from interface:DiscoveryStrategyFactoryReturns a set of the expected configuration properties. These properties contain information about the value type of the property, if it is required and a possible validator to automatically test and convert values from the XML configuration.- Specified by:
getConfigurationPropertiesin interfaceDiscoveryStrategyFactory- Returns:
- a set of expected configuration properties
-
isAutoDetectionApplicable
public boolean isAutoDetectionApplicable()In all Kubernetes environments the file "/var/run/secrets/kubernetes.io/serviceaccount/token" is injected into the container. That is why we can use it to verify if this code is run in the Kubernetes environment.Note that if the Kubernetes environment is not configured correctly, this file my not exist. However, in such case, this plugin won't work anyway, so it makes perfect sense to return
false.- Specified by:
isAutoDetectionApplicablein interfaceDiscoveryStrategyFactory- Returns:
- true if running in the Kubernetes environment
-
discoveryStrategyLevel
Description copied from interface:DiscoveryStrategyFactoryLevel of the discovery strategy.- Specified by:
discoveryStrategyLevelin interfaceDiscoveryStrategyFactory
-