Allow overriding forwading host through env variable
MansurAshraf opened this issue · 1 comments
MansurAshraf commented
Genie allows overriding forwarding port through genie.jobs.forwarding.port
, it should allow the same for forwarding host as on some Kubernetes clusters InetAddress.getLocalHost().getCanonicalHostName()
returns a hostname that is not DNS resolvable.
example:
public static String getHostname() throws UnknownHostException {
final String hostname;
if (StringUtils.isNotBlank(System.getenv("genie.jobs.forwarding.host"))) {
hostname = System.getenv("genie.jobs.forwarding.host");
} else if (AwsCloudEnvironmentCheckUtils.isRunningOnCloudEnvironment()) {
hostname = EC2MetadataUtils.getPrivateIpAddress();
} else {
// Fallback if not on AWS
hostname = InetAddress.getLocalHost().getCanonicalHostName();
}
if (StringUtils.isBlank(hostname)) {
throw new IllegalStateException("Unable to create a Genie Host Info instance as hostname is blank");
}
return hostname;
}
mprimi commented
Hello @MansurAshraf
If you want the hostname stored in the database (for routing, including forwarding) to be computed with a different strategy than the one we currently use, you can do so by providing your own GenieHostInfo
bean.