Add TOML configuration for default DNS nameservers, search, options#1614
Add TOML configuration for default DNS nameservers, search, options#16140xMH wants to merge 3 commits into
Conversation
| } | ||
|
|
||
| final public class DNSConfig: Codable, Sendable { | ||
| public static let defaultNameservers: [String] = [] |
There was a problem hiding this comment.
Today there is a subtle difference between what the default DNS settings are for container aka the apiserver itself, which would determine the hostname resolution (aka the A record) for a given container on the host, and the DNS settings for setting up the resolv.conf in a container. I think we should maintain this distinction. There could be scenarios where a user does not want the default DNS domain on the host to necessarily match the default DNS domain that the container application uses in the container itself.
I think we should add a new field on the ContainerConfig type that has the default DNS settings for running a container.
Essentially we'd end up with something like this in the TOML:
[dns] <-------- default DNS settings for the APIServer
domain = "test"
[container.dns] <----------- default DNS settings for containers
server = "8.8.8.8"
domain = "foo"
search = ["foo", "test"]
options = ["haha"]
There was a problem hiding this comment.
Thanks, good insight. I removed that extra builder startup call.
6af7693 to
b010238
Compare
Code Coverage
|
b010238 to
3eb0a7e
Compare
Type of Change
Motivation and Context
Closes #1449. Adds default values for
--dns,--dns-search,--dns-option, and--dns-domainto the[dns]section of~/.config/container/config.toml, so users hitting macOSmDNSResponderconflicts can set the workaround once instead of repeating it on every invocation. Depends on the merged TOML configuration introduced by #1425.Defaults are read by
container run,container build, andcontainer builder startvia a sharedUtility.dnsConfiguration(from:defaults:)helper. CLI flags take precedence;--no-dnsstill disables DNS. Two pre-existing bugs in the build path were fixed to make the feature work end-to-end:BuildCommandwas forwarding onlydnsNameserversto the builder (now forwards all four DNS fields), andBuilderStart'sdnsChangedcheck only compared the first non-empty field (now compares all four).Testing