Improve log nat manager (#1058)

Improvement of nat manager logs to avoid false positives when running on a kubernetes environment.

Signed-off-by: Karim TAAM <karim.t2am@gmail.com>
pull/1061/head
Karim T 5 years ago committed by GitHub
parent 01c02e0741
commit d927446303
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 6
      nat/src/main/java/org/hyperledger/besu/nat/NatService.java
  2. 6
      nat/src/main/java/org/hyperledger/besu/nat/kubernetes/KubernetesNatManager.java

@ -87,7 +87,10 @@ public class NatService {
try {
getNatManager().orElseThrow().start();
} catch (Exception e) {
LOG.debug("Caught exception while trying to start the manager or service.", e);
LOG.debug(
"Nat manager failed to configure itself automatically due to the following reason "
+ e.getMessage()
+ ". NONE mode will be used");
disableNatManager();
}
} else {
@ -185,7 +188,6 @@ public class NatService {
/** Disable the natManager */
private void disableNatManager() {
LOG.warn("Unable to use NAT. Disabling NAT manager");
currentNatMethod = NatMethod.NONE;
currentNatManager = Optional.empty();
}

@ -82,8 +82,7 @@ public class KubernetesNatManager extends AbstractNatManager {
.orElseThrow(() -> new NatInitializationException("Service not found"));
updateUsingBesuService(service);
} catch (Exception e) {
throw new NatInitializationException(
"Failed update information using Kubernetes client SDK.", e);
throw new NatInitializationException(e.getMessage(), e);
}
}
@ -134,7 +133,8 @@ public class KubernetesNatManager extends AbstractNatManager {
}
});
} catch (Exception e) {
throw new RuntimeException("Failed update information using pod metadata.", e);
throw new RuntimeException(
"Failed update information using pod metadata : " + e.getMessage(), e);
}
}

Loading…
Cancel
Save