use of org.apache.ignite.kubernetes.configuration.KubernetesConnectionConfiguration in project ignite by apache.
the class KubernetesDiscoveryAbstractTest method getConfiguration.
/**
*/
protected IgniteConfiguration getConfiguration(String instanceName, Boolean clientMode) throws Exception {
IgniteConfiguration cfg = getConfiguration();
KubernetesConnectionConfiguration kccfg = prepareConfiguration();
TcpDiscoveryKubernetesIpFinder ipFinder = new TcpDiscoveryKubernetesIpFinder(kccfg);
TcpDiscoverySpi discoverySpi = new TcpDiscoverySpi();
discoverySpi.setIpFinder(ipFinder);
cfg.setDiscoverySpi(discoverySpi);
cfg.setGridLogger(log);
cfg.setIgniteInstanceName(instanceName);
cfg.setClientMode(clientMode);
return cfg;
}
use of org.apache.ignite.kubernetes.configuration.KubernetesConnectionConfiguration in project ignite by apache.
the class ClientKubernetesPutGetExample method main.
/**
* Entry point.
*
* @param args Command line arguments.
*/
public static void main(String[] args) {
KubernetesConnectionConfiguration kcfg = new KubernetesConnectionConfiguration();
kcfg.setNamespace("ignite");
ClientConfiguration cfg = new ClientConfiguration();
cfg.setAddressesFinder(new ThinClientKubernetesAddressFinder(kcfg));
try (IgniteClient igniteClient = Ignition.startClient(cfg)) {
System.out.println();
System.out.println(">>> Thin client put-get example started.");
final String CACHE_NAME = "put-get-example";
ClientCache<Integer, Address> cache = igniteClient.getOrCreateCache(CACHE_NAME);
System.out.format(">>> Created cache [%s].\n", CACHE_NAME);
Integer key = 1;
Address val = new Address("1545 Jackson Street", 94612);
cache.put(key, val);
System.out.format(">>> Saved [%s] in the cache.\n", val);
Address cachedVal = cache.get(key);
System.out.format(">>> Loaded [%s] from the cache.\n", cachedVal);
}
}
use of org.apache.ignite.kubernetes.configuration.KubernetesConnectionConfiguration in project ignite by apache.
the class KubernetesServiceAddressResolverTest method prepareResolver.
/**
*/
private KubernetesServiceAddressResolver prepareResolver(boolean includeNotReadyAddresses) throws IOException {
File account = File.createTempFile("kubernetes-test-account", "");
FileWriter fw = new FileWriter(account);
fw.write("account-token");
fw.close();
String accountFile = account.getAbsolutePath();
KubernetesConnectionConfiguration cfg = new KubernetesConnectionConfiguration();
cfg.setNamespace(namespace);
cfg.setServiceName(service);
cfg.setMasterUrl("https://localhost:" + mockServer.getLocalPort());
cfg.setAccountToken(accountFile);
cfg.setIncludeNotReadyAddresses(includeNotReadyAddresses);
return new KubernetesServiceAddressResolver(cfg);
}
use of org.apache.ignite.kubernetes.configuration.KubernetesConnectionConfiguration in project ignite by apache.
the class KubernetesDiscoveryAbstractTest method prepareConfiguration.
/**
*/
protected final KubernetesConnectionConfiguration prepareConfiguration() throws IOException {
File account = File.createTempFile("kubernetes-test-account", "");
FileWriter fw = new FileWriter(account);
fw.write("account-token");
fw.close();
String accountFile = account.getAbsolutePath();
KubernetesConnectionConfiguration cfg = new KubernetesConnectionConfiguration();
cfg.setNamespace(namespace);
cfg.setServiceName(service);
cfg.setMasterUrl("https://localhost:" + mockServer.getLocalPort());
cfg.setAccountToken(accountFile);
return cfg;
}
Aggregations