public class TcpDiscoveryKubernetesIpFinder extends TcpDiscoveryIpFinderAdapter
The implementation is based on a distinct Kubernetes service. The name of the service must be set with
KubernetesConnectionConfiguration
. As for Ignite pods, it's recommended to label them in such way
that the service will target only nodes that are able to be discovered, i.e. server and thick client nodes.
The IP finder, in its turn, will call this service to retrieve Ignite pods IP addresses. The port will be
either the one that is set with TcpDiscoverySpi.setLocalPort(int)
or TcpDiscoverySpi.DFLT_PORT
.
Make sure that all Ignite pods occupy a similar discovery port, otherwise they will not be able to discover each
other using this IP finder.
Both registerAddresses(Collection)
and unregisterAddresses(Collection)
have no effect.
Note, this IP finder is only workable when it used in Kubernetes environment.
Choose another implementation of TcpDiscoveryIpFinder
for local
or home network tests.
ignite
Constructor and Description |
---|
TcpDiscoveryKubernetesIpFinder()
Creates an instance of Kubernetes IP finder.
|
TcpDiscoveryKubernetesIpFinder(KubernetesConnectionConfiguration cfg)
Creates an instance of Kubernetes IP finder.
|
Modifier and Type | Method and Description |
---|---|
Collection<InetSocketAddress> |
getRegisteredAddresses()
Gets all addresses registered in this finder.
|
void |
includeNotReadyAddresses(boolean includeNotReadyAddresses)
Deprecated.
set parameters with
KubernetesConnectionConfiguration instead. |
void |
registerAddresses(Collection<InetSocketAddress> addrs)
Registers new addresses.
|
void |
setAccountToken(String accountToken)
Deprecated.
set parameters with
KubernetesConnectionConfiguration instead. |
void |
setMasterUrl(String master)
Deprecated.
set parameters with
KubernetesConnectionConfiguration instead. |
void |
setNamespace(String namespace)
Deprecated.
set parameters with
KubernetesConnectionConfiguration instead. |
void |
setServiceName(String service)
Deprecated.
set parameters with
KubernetesConnectionConfiguration instead. |
void |
unregisterAddresses(Collection<InetSocketAddress> addrs)
Unregisters provided addresses.
|
close, discoveryClientMode, initializeLocalAddresses, isShared, onSpiContextDestroyed, onSpiContextInitialized, setShared, spiContext, toString
public TcpDiscoveryKubernetesIpFinder()
public TcpDiscoveryKubernetesIpFinder(KubernetesConnectionConfiguration cfg)
cfg
- Kubernetes IP finder configuration.public Collection<InetSocketAddress> getRegisteredAddresses() throws IgniteSpiException
null
.IgniteSpiException
- In case of error.public void registerAddresses(Collection<InetSocketAddress> addrs) throws IgniteSpiException
Implementation should accept duplicates quietly, but should not register address if it is already registered.
addrs
- Addresses to register. Not null
and not empty.IgniteSpiException
- In case of error.public void unregisterAddresses(Collection<InetSocketAddress> addrs) throws IgniteSpiException
Implementation should accept addresses that are currently not registered quietly (just no-op).
addrs
- Addresses to unregister. Not null
and not empty.IgniteSpiException
- In case of error.@Deprecated public void setServiceName(String service)
KubernetesConnectionConfiguration
instead.service
- Kubernetes service name.@Deprecated public void setNamespace(String namespace)
KubernetesConnectionConfiguration
instead.namespace
- Namespace of the Kubernetes service.@Deprecated public void setMasterUrl(String master)
KubernetesConnectionConfiguration
instead.master
- Host name of the Kubernetes API server.@Deprecated public void setAccountToken(String accountToken)
KubernetesConnectionConfiguration
instead.accountToken
- Path to the service token file.@Deprecated public void includeNotReadyAddresses(boolean includeNotReadyAddresses)
KubernetesConnectionConfiguration
instead.includeNotReadyAddresses
- Whether addresses of not-ready pods should be included.
Follow @ApacheIgnite
Ignite Database and Caching Platform : ver. 2.16.0 Release Date : December 15 2023