mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-04 09:49:50 +00:00
Merge pull request #5808 from mikeln/issue-5737
Cassandra Cluster Example Add Check for Null Endpoints (redo2)
This commit is contained in:
commit
9707a944c2
@ -295,10 +295,13 @@ public class KubernetesSeedProvider implements SeedProvider {
|
|||||||
ObjectMapper mapper = new ObjectMapper();
|
ObjectMapper mapper = new ObjectMapper();
|
||||||
Endpoints endpoints = mapper.readValue(url, Endpoints.class);
|
Endpoints endpoints = mapper.readValue(url, Endpoints.class);
|
||||||
if (endpoints != null) {
|
if (endpoints != null) {
|
||||||
|
// Here is a problem point, endpoints.endpoints can be null in first node cases.
|
||||||
|
if (endpoints.endpoints != null){
|
||||||
for (String endpoint : endpoints.endpoints) {
|
for (String endpoint : endpoints.endpoints) {
|
||||||
String[] parts = endpoint.split(":");
|
String[] parts = endpoint.split(":");
|
||||||
list.add(InetAddress.getByName(parts[0]));
|
list.add(InetAddress.getByName(parts[0]));
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} catch (IOException ex) {
|
} catch (IOException ex) {
|
||||||
logger.warn("Request to kubernetes apiserver failed");
|
logger.warn("Request to kubernetes apiserver failed");
|
||||||
|
@ -70,10 +70,13 @@ public class KubernetesSeedProvider implements SeedProvider {
|
|||||||
ObjectMapper mapper = new ObjectMapper();
|
ObjectMapper mapper = new ObjectMapper();
|
||||||
Endpoints endpoints = mapper.readValue(url, Endpoints.class);
|
Endpoints endpoints = mapper.readValue(url, Endpoints.class);
|
||||||
if (endpoints != null) {
|
if (endpoints != null) {
|
||||||
|
// Here is a problem point, endpoints.endpoints can be null in first node cases.
|
||||||
|
if (endpoints.endpoints != null){
|
||||||
for (String endpoint : endpoints.endpoints) {
|
for (String endpoint : endpoints.endpoints) {
|
||||||
String[] parts = endpoint.split(":");
|
String[] parts = endpoint.split(":");
|
||||||
list.add(InetAddress.getByName(parts[0]));
|
list.add(InetAddress.getByName(parts[0]));
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} catch (IOException ex) {
|
} catch (IOException ex) {
|
||||||
logger.warn("Request to kubernetes apiserver failed");
|
logger.warn("Request to kubernetes apiserver failed");
|
||||||
|
Loading…
Reference in New Issue
Block a user