mirror of
https://github.com/floci-io/floci.git
synced 2026-11-23 22:11:36 -05:00
Every node of an EMR cluster is an EC2 instance, so any process on it, a bootstrap action, a step or a Spark executor, reads its instance metadata at 169.254.169.254. In the docker runner mode nothing answered there: a bootstrap script reading its availability zone got nothing. A relay container on the cluster's own Docker network now holds that address as a link-local one, as ECS's credentials endpoint is held, and each of the cluster's containers gets a link-local address of its own there, so none needs privileges. The relay forwards to Floci's EC2 metadata server, naming its caller in X-Forwarded-For, which the server reads only from the relays it trusts; the server answers each container as the instance it is: the bootstrap actions and each step as the primary node, each core or task node's container as that node, with the instance id, type, private address and name ListInstances gives, the cluster's availability zone and its JobFlowRole instance profile. The metadata server now starts for the docker runner mode too. DescribeCluster's Ec2InstanceAttributes now gives Ec2AvailabilityZone, the one RunJobFlow's Instances.Placement names, else the Region's first, so the metadata and the cluster agree.