mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-27 13:37:30 +00:00
Corrected cassandra example's indent.
This commit is contained in:
parent
b930d58fcb
commit
59bab9bde4
@ -65,12 +65,10 @@ public class KubernetesSeedProvider implements SeedProvider {
|
|||||||
*/
|
*/
|
||||||
private List<InetAddress> defaultSeeds;
|
private List<InetAddress> defaultSeeds;
|
||||||
|
|
||||||
|
|
||||||
private TrustManager[] trustAll;
|
private TrustManager[] trustAll;
|
||||||
|
|
||||||
private HostnameVerifier trustAllHosts;
|
private HostnameVerifier trustAllHosts;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create new Seeds
|
* Create new Seeds
|
||||||
* @param params
|
* @param params
|
||||||
@ -96,7 +94,6 @@ public class KubernetesSeedProvider implements SeedProvider {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Call kubernetes API to collect a list of seed providers
|
* Call kubernetes API to collect a list of seed providers
|
||||||
* @return list of seed providers
|
* @return list of seed providers
|
||||||
@ -133,14 +130,10 @@ public class KubernetesSeedProvider implements SeedProvider {
|
|||||||
Endpoints endpoints = mapper.readValue(conn.getInputStream(), Endpoints.class);
|
Endpoints endpoints = mapper.readValue(conn.getInputStream(), Endpoints.class);
|
||||||
|
|
||||||
if (endpoints != null) {
|
if (endpoints != null) {
|
||||||
|
|
||||||
// Here is a problem point, endpoints.subsets can be null in first node cases.
|
// Here is a problem point, endpoints.subsets can be null in first node cases.
|
||||||
|
|
||||||
if (endpoints.subsets != null && !endpoints.subsets.isEmpty()){
|
if (endpoints.subsets != null && !endpoints.subsets.isEmpty()){
|
||||||
|
|
||||||
for (Subset subset : endpoints.subsets) {
|
for (Subset subset : endpoints.subsets) {
|
||||||
if (subset.addresses != null && !subset.addresses.isEmpty()) {
|
if (subset.addresses != null && !subset.addresses.isEmpty()) {
|
||||||
|
|
||||||
for (Address address : subset.addresses) {
|
for (Address address : subset.addresses) {
|
||||||
seeds.add(InetAddress.getByName(address.ip));
|
seeds.add(InetAddress.getByName(address.ip));
|
||||||
|
|
||||||
@ -151,16 +144,11 @@ public class KubernetesSeedProvider implements SeedProvider {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
logger.info("Available num endpoints: " + seeds.size());
|
logger.info("Available num endpoints: " + seeds.size());
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
logger.warn("Endpoints are not available using default seeds in cassandra.yaml");
|
logger.warn("Endpoints are not available using default seeds in cassandra.yaml");
|
||||||
return Collections.unmodifiableList(defaultSeeds);
|
return Collections.unmodifiableList(defaultSeeds);
|
||||||
|
|
||||||
}
|
}
|
||||||
} catch (IOException | NoSuchAlgorithmException | KeyManagementException ex) {
|
} catch (IOException | NoSuchAlgorithmException | KeyManagementException ex) {
|
||||||
logger.warn("Request to kubernetes apiserver failed, using default seeds in cassandra.yaml", ex);
|
logger.warn("Request to kubernetes apiserver failed, using default seeds in cassandra.yaml", ex);
|
||||||
@ -168,12 +156,10 @@ public class KubernetesSeedProvider implements SeedProvider {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (seeds.size() == 0) {
|
if (seeds.size() == 0) {
|
||||||
|
|
||||||
// If we got nothing, we might be the first instance, in that case
|
// If we got nothing, we might be the first instance, in that case
|
||||||
// fall back on the seeds that were passed in cassandra.yaml.
|
// fall back on the seeds that were passed in cassandra.yaml.
|
||||||
logger.warn("Seeds are not available using default seeds in cassandra.yaml");
|
logger.warn("Seeds are not available using default seeds in cassandra.yaml");
|
||||||
return Collections.unmodifiableList(defaultSeeds);
|
return Collections.unmodifiableList(defaultSeeds);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return Collections.unmodifiableList(seeds);
|
return Collections.unmodifiableList(seeds);
|
||||||
@ -187,24 +173,19 @@ public class KubernetesSeedProvider implements SeedProvider {
|
|||||||
protected List<InetAddress> createDefaultSeeds()
|
protected List<InetAddress> createDefaultSeeds()
|
||||||
{
|
{
|
||||||
Config conf;
|
Config conf;
|
||||||
try
|
try {
|
||||||
{
|
|
||||||
conf = loadConfig();
|
conf = loadConfig();
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e) {
|
||||||
{
|
|
||||||
throw new AssertionError(e);
|
throw new AssertionError(e);
|
||||||
}
|
}
|
||||||
String[] hosts = conf.seed_provider.parameters.get("seeds").split(",", -1);
|
String[] hosts = conf.seed_provider.parameters.get("seeds").split(",", -1);
|
||||||
List<InetAddress> seeds = new ArrayList<InetAddress>();
|
List<InetAddress> seeds = new ArrayList<InetAddress>();
|
||||||
for (String host : hosts)
|
for (String host : hosts) {
|
||||||
{
|
try {
|
||||||
try
|
|
||||||
{
|
|
||||||
seeds.add(InetAddress.getByName(host.trim()));
|
seeds.add(InetAddress.getByName(host.trim()));
|
||||||
}
|
}
|
||||||
catch (UnknownHostException ex)
|
catch (UnknownHostException ex) {
|
||||||
{
|
|
||||||
// not fatal... DD will bark if there end up being zero seeds.
|
// not fatal... DD will bark if there end up being zero seeds.
|
||||||
logger.warn("Seed provider couldn't lookup host {}", host);
|
logger.warn("Seed provider couldn't lookup host {}", host);
|
||||||
}
|
}
|
||||||
@ -269,6 +250,4 @@ public class KubernetesSeedProvider implements SeedProvider {
|
|||||||
static class Endpoints {
|
static class Endpoints {
|
||||||
public List<Subset> subsets;
|
public List<Subset> subsets;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user