Versions used
Akka version: 2.6.13
Description
Currently KubernetesApiServiceDiscovery.readConfigVarFromFilesystem method returns None in case of an error reading from a file. This causes complications down the line when trying to identify what is going on. For example, I had an issue where reading the file threw permissions errors. Discovery process proceeds and simply fails to make k8s API requests because it no longer provides Bearer tokens. Error is still logged, but it gets quickly obscured by all the error logs about permissions for anonymous user account, so the root cause gets effectively hidden, making this a gotcha that each developer has to learn. I think this kind of exception should be treated more severely, maybe even by terminating the application, because this is basically a fatal error. Would implementing that make sense?
|
private def readConfigVarFromFilesystem(path: String, name: String): Option[String] = { |
|
val file = Paths.get(path) |
|
if (Files.exists(file)) { |
|
try { |
|
Some(new String(Files.readAllBytes(file), "utf-8")) |
|
} catch { |
|
case NonFatal(e) => |
|
log.error(e, "Error reading {} from {}", name, path) |
|
None |
|
} |
|
} else { |
|
log.warning("Unable to read {} from {} because it doesn't exist.", name, path) |
|
None |
|
} |
|
} |
Versions used
Akka version: 2.6.13
Description
Currently
KubernetesApiServiceDiscovery.readConfigVarFromFilesystemmethod returnsNonein case of an error reading from a file. This causes complications down the line when trying to identify what is going on. For example, I had an issue where reading the file threw permissions errors. Discovery process proceeds and simply fails to make k8s API requests because it no longer provides Bearer tokens. Error is still logged, but it gets quickly obscured by all the error logs about permissions for anonymous user account, so the root cause gets effectively hidden, making this a gotcha that each developer has to learn. I think this kind of exception should be treated more severely, maybe even by terminating the application, because this is basically a fatal error. Would implementing that make sense?akka-management/discovery-kubernetes-api/src/main/scala/akka/discovery/kubernetes/KubernetesApiServiceDiscovery.scala
Lines 211 to 225 in 178497c