-
Notifications
You must be signed in to change notification settings - Fork 462
Move api-int record from coredns to /etc/hosts #2236
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
Closed
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| mode: 0644 | ||
| path: "/etc/hosts" | ||
| contents: | ||
| inline: | | ||
| 127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4 | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I guess we should use $cluster_name and $domain_name instead of 'ostest.test.metalkube.org' , right?
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Whoops, yeah. |
||
| ::1 localhost localhost.localdomain localhost6 localhost6.localdomain6 | ||
| {{ onPremPlatformAPIServerInternalIP . }} api-int api-int.ostest.test.metalkube.org | ||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
People may have legitimately added custom content in here before, I don't think we can unilaterally own this file - particularly on upgrades.
I approve the general idea (this also seems related to #2190 right?).
It's too bad there's not a simple
/etc/hosts.dbut I guess everyone who wants this ends up using a local resolver.So that's one option...we could switch to on-host dnsmasq or resolved.
Or we could try to hack in some sort of Ansible-like "lineinfile" support to the MCO just for this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is primarily targeted at enabling openshift/enhancements#524
The problem with using dnsmasq for this is that we already run a local DNS server for the other records. It's possible we could make it work, but it gets tricky and makes the DNS flow even more complicated. Right now we configure a local server that forwards to the previously configured servers in resolv.conf. This would add another dnsmasq somewhere in that flow. I guess if there's no other way to do it then we'll have to eat the complexity, but it's not ideal either.
I also did look at using the append option in ignition and had that working. It's a weird fit for MCO though and I couldn't get it to work so I switched to just templating the whole file. It's another thing I could investigate further though.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK I see. Hum...do we have any offhand guesses around whether my concern about customers injecting
/etc/hostsvia Ignition is a real concern? It may not happen. If it does though, what would we tell them for configuring static resolution?Perhaps we can implement our own "merge /etc/hosts" logic by having code in the MCO that on startup takes the current content, appends this data to it into e.g.
/run/hostsand then doesmount --bind /run/hosts /etc/hostsor so.That said it feels like what we really want to achieve here is switch over the host's resolver to coredns but only if coredns is active and working? Basically if coredns is up, update
/etc/resolv.confto use127.0.0.1:53. It's a bit like where we ended up with #2011 - we have a systemd unit which monitors a pod, and if the pod is down takes action.Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The DNS operator adds an entry for the cluster image registry to
/etc/hostsso that the container runtime can pull from the registry: https://github.com/openshift/cluster-dns-operator/blob/0d46f0303675473ce5d022904ddaff23132bac97/assets/dns/daemonset.yaml#L90-L146Would MCO overwrite
/etc/hostsonly on upgrades, every time the DNS operator modified it (the DNS operator checks minutely for the entry that it adds to/etc/hostsand adds it if it is missing or outdated), or what?Yeah, something similar to
/etc/NetworkManager/dnsmasq.d/. A/etc/hosts.d/or similar would be useful to the DNS operator.That would be terrific— it would obviate the need for the DNS operator to update
/etc/hostsand would solve several related longstanding problems.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oops, I missed these comments. We did discuss the possibility of dynamically switching between dnsmasq and coredns for local resolution. It's still a bit complicated, but certainly an option.
I just pushed an alternate approach that uses a simple service to do the appending. It's fairly primitive, but it does what we need and shouldn't mess with any other customizations to /etc/hosts: #2258