protokube: support writing AAAA records to /etc/hosts#15931
Conversation
|
This exercises the node -> apiserver ipv6 code path, rather than relying on ipv4. Suggested by @aojea , because then we can get one step closer to a pure-IPv6 world. |
| klog.Warningf("ignoring unexpected lines in /etc/hosts: %v", badLines) | ||
| } | ||
|
|
||
| hostsToAddr := make(map[string][]string) |
There was a problem hiding this comment.
if you make a map then one hostname can only have one IP family, if that is your preference I suggest you to default always to the same one, usually ipv4. Otherwise you can create one mapping per ip familiy, this will give you a cleaner separation in the code between families
There was a problem hiding this comment.
So this is a map from hosts to ip addresses, the addresses can be a mix of ipv4 and ipv6 (i.e. we build this map by appending to the existing map entries).
I actually introduced this map because previously the code did replace the addresses, so ipv4 would overwrite the ipv6 address.
There was a problem hiding this comment.
(It's confusing because this map is "backwards" compared to /etc/hosts; I find the mapping in /etc/hosts unintuitive considering how we are using it, so we try to keep the address -> names mapping isolated in hosts.HostMap)
There was a problem hiding this comment.
osh, so record.Name is an IP address?
|
LGTM |
Though we likely want to stop using this code altogether, it is still used on GCE (for now). dns-controller will "gossip" AAAA records, and they are valid (and work) in /etc/hosts. Co-authored-by: John Gardiner Myers <jgmyers@proofpoint.com>
38a8e4a to
d9d9134
Compare
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: johngmyers The full list of commands accepted by this bot can be found here. The pull request process is described here DetailsNeeds approval from an approver in each of these files:
Approvers can indicate their approval by writing |
Though we likely want to stop using this code altogether, it is still
used on GCE (for now). dns-controller will "gossip" AAAA records, and
they are valid (and work) in /etc/hosts.