Skip to content

Commit

Permalink
Added initialization logic in Mesos agent for IPv6 flags.
Browse files Browse the repository at this point in the history
Operators can now set the IPv6 address for the agent using the `--ip6`
and `--ip6_discovery_command` flags. Currently, the only place the agent
will use the IPv6 address would be to advertise v6 addresses for
containers running on the host network.

Review: https://reviews.apache.org/r/59128/
  • Loading branch information
Avinash sridharan authored and benh committed Jul 7, 2017
1 parent 9b91147 commit c90bea8
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions src/slave/main.cpp
Expand Up @@ -296,6 +296,11 @@ int main(int argc, char** argv)
"Only one of `--ip` or `--ip_discovery_command` should be specified");
}

if (flags.ip6_discovery_command.isSome() && flags.ip6.isSome()) {
EXIT(EXIT_FAILURE) << flags.usage(
"Only one of `--ip6` or `--ip6_discovery_command` should be specified");
}

if (flags.ip_discovery_command.isSome()) {
Try<string> ipAddress = os::shell(flags.ip_discovery_command.get());

Expand All @@ -308,6 +313,17 @@ int main(int argc, char** argv)
os::setenv("LIBPROCESS_IP", flags.ip.get());
}

if (flags.ip6_discovery_command.isSome()) {
Try<string> ip6Address = os::shell(flags.ip6_discovery_command.get());
if (ip6Address.isError()) {
EXIT(EXIT_FAILURE) << ip6Address.error();
}

os::setenv("LIBPROCESS_IP6", strings::trim(ip6Address.get()));
} else if (flags.ip6.isSome()) {
os::setenv("LIBPROCESS_IP6", flags.ip.get());
}

os::setenv("LIBPROCESS_PORT", stringify(flags.port));

if (flags.advertise_ip.isSome()) {
Expand Down

0 comments on commit c90bea8

Please sign in to comment.