public List getSeeds()

in cassandra/java/src/main/java/io/k8s/cassandra/KubernetesSeedProvider.java [63:90]


	public List<InetAddress> getSeeds() {
		GoInterface go = (GoInterface) Native.loadLibrary("cassandra-seed.so", GoInterface.class);

		String service = getEnvOrDefault("CASSANDRA_SERVICE", "cassandra");
		String namespace = getEnvOrDefault("POD_NAMESPACE", "default");

		String initialSeeds = getEnvOrDefault("CASSANDRA_SEEDS", "");

		if ("".equals(initialSeeds)) {
			initialSeeds = getEnvOrDefault("POD_IP", "");
		}

		String seedSizeVar = getEnvOrDefault("CASSANDRA_SERVICE_NUM_SEEDS", "8");
		Integer seedSize = Integer.valueOf(seedSizeVar);

		String data = go.GetEndpoints(namespace, service, initialSeeds);
		ObjectMapper mapper = new ObjectMapper();

		try {
			Endpoints endpoints = mapper.readValue(data, Endpoints.class);
			logger.info("cassandra seeds: {}", endpoints.ips.toString());
			return Collections.unmodifiableList(endpoints.ips);
		} catch (IOException e) {
			// This should not happen
			logger.error("unexpected error building cassandra seeds: {}" , e.getMessage());
			return Collections.emptyList();
		}
	}