Skip to content
This repository was archived by the owner on Dec 9, 2024. It is now read-only.

Fix Auto Detection when Kubernetes Master is not available #271

Merged
merged 3 commits into from
Nov 2, 2020

Conversation

leszko
Copy link

@leszko leszko commented Nov 2, 2020

fix #269

@leszko leszko requested review from jerrinot and hasancelik November 2, 2020 10:54
@leszko leszko requested a review from a team as a code owner November 2, 2020 10:54
@leszko leszko requested review from alparslanavci and removed request for a team November 2, 2020 10:54
@leszko leszko added this to the 2.2 milestone Nov 2, 2020
return new File("/var/run/secrets/kubernetes.io/serviceaccount/token").exists();
}

private boolean defaultKubernetesMasterReachable() {
try {
InetAddress.getByName("kubernetes.default.svc");
Copy link

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?

Copy link

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.

Copy link
Author

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);
Copy link

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.

@leszko leszko merged commit efcf79e into hazelcast:master Nov 2, 2020
@leszko leszko deleted the fix-auto-detection branch November 2, 2020 13:17
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Hazelcast fails to start when k8s does not have CoreDNS service enabled
3 participants