Class HazelcastKubernetesDiscoveryStrategyFactory

    • Constructor Detail

      • HazelcastKubernetesDiscoveryStrategyFactory

        public HazelcastKubernetesDiscoveryStrategyFactory()
    • Method Detail

      • newDiscoveryStrategy

        public DiscoveryStrategy newDiscoveryStrategy​(DiscoveryNode discoveryNode,
                                                      ILogger logger,
                                                      java.util.Map<java.lang.String,​java.lang.Comparable> properties)
        Description copied from interface: DiscoveryStrategyFactory
        Instantiates a new instance of the DiscoveryStrategy with the given configuration properties. The provided HazelcastInstance can be used to register instances in a service registry whenever the discovery strategy is started.
        Specified by:
        newDiscoveryStrategy in interface DiscoveryStrategyFactory
        discoveryNode - the current local DiscoveryNode, representing the local connection information if running on a Hazelcast member, otherwise on Hazelcast clients always null
        logger - the logger instance
        properties - the properties parsed from the configuration
        a new instance of the discovery strategy
      • getConfigurationProperties

        public java.util.Collection<PropertyDefinition> getConfigurationProperties()
        Description copied from interface: DiscoveryStrategyFactory
        Returns 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:
        getConfigurationProperties in interface DiscoveryStrategyFactory
        a set of expected configuration properties
      • isAutoDetectionApplicable

        public boolean isAutoDetectionApplicable()
        In all Kubernetes environments the file "/var/run/secrets/" 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:
        isAutoDetectionApplicable in interface DiscoveryStrategyFactory
        true if running in the Kubernetes environment