-
Notifications
You must be signed in to change notification settings - Fork 99
Fix Auto Detection when Kubernetes Master is not available #271
Conversation
return new File("/var/run/secrets/kubernetes.io/serviceaccount/token").exists(); | ||
} | ||
|
||
private boolean defaultKubernetesMasterReachable() { | ||
try { | ||
InetAddress.getByName("kubernetes.default.svc"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what is a timeout for this call?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
actually, perhaps it's not all that relevant. it's guarded by the fs token check.
So if someone is running a k8s cluster with slow DNS then it's OK if this is slow too.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, it's only for corner cases, like you're running in Kubernetes, but kube-dns is not configured.
@@ -34,6 +37,7 @@ | |||
*/ | |||
public class HazelcastKubernetesDiscoveryStrategyFactory | |||
implements DiscoveryStrategyFactory { | |||
private static final ILogger LOGGER = Logger.getLogger(HazelcastKubernetesDiscoveryStrategyFactory.class); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nitpick: you could move this to the catch branch. as in most cases it wont be needed. and a static logger initialization has some disadvantages so we should avoid it unless necessary.
fix #269