Give a container the names, rather than a resolver to ask
The commit before this said "told where to resolve names" and passed --dns, which is not what it ended up doing. This is that correction: a container is given the names themselves, written into its own hosts file by the runtime. The reason for the change is the decision the mesh already made about names — a file rather than a resolver, because it works on every runtime, needs no package and has no failure mode of its own. Passing a resolver address would have required a resolver to exist, which at that point none did. A resolver is coming, for the case a file genuinely cannot express: a service named under a machine, postgres.novox.internal, where the wildcard cannot be enumerated in advance. When it arrives it will need this field back under its own name. It is not being kept in the meantime — a field nothing fills is a field nobody can trust, and the vocabulary is asserted by a count for exactly that reason.
This commit is contained in:
@@ -812,12 +812,12 @@ func applyContainer(ctx context.Context, r *declaration.Container, run Runner) (
|
||||
for _, v := range r.Volumes {
|
||||
args = append(args, "--volume", v)
|
||||
}
|
||||
for _, n := range r.Nameservers {
|
||||
// Per container rather than by changing the machine's resolver configuration. That file
|
||||
// belongs to something else on most machines, and a host that edited it would be fighting
|
||||
// whatever owns it on every boot — the fault this host exists to avoid, in the one place
|
||||
// it would be hardest to see.
|
||||
args = append(args, "--dns", n)
|
||||
for _, h := range r.Hosts {
|
||||
// Written into the container's own hosts file by the runtime. Per container rather than
|
||||
// by editing the machine's resolver configuration: that file belongs to something else on
|
||||
// most machines, and a host that edited it would be fighting whatever owns it on every
|
||||
// boot — the fault this host exists to avoid, in the place it would be hardest to see.
|
||||
args = append(args, "--add-host", h)
|
||||
}
|
||||
args = append(args, r.Image)
|
||||
args = append(args, r.Args...)
|
||||
|
||||
Reference in New Issue
Block a user