Skip to content
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

Add a dnsBindAddress configuration to the node #12805

Merged
merged 2 commits into from
Feb 11, 2017

Conversation

smarterclayton
Copy link
Contributor

Allows the installer to start node DNS without having to set a config
flag. BindAddress is consistent with others of this type.

@sdodson this would be how you could enable DNS and bind it (you could set 0.0.0.0:54, and then configure dnsmasq)

[test]

@smarterclayton smarterclayton force-pushed the dns_args branch 4 times, most recently from 162c5c0 to b3f3316 Compare February 6, 2017 02:50
@smarterclayton
Copy link
Contributor Author

@liggitt this needs review now. I forgot that node config isn't generated anything like master config so had to plumb the new flag in.

This will enable @sdodson to start the node DNS even when DNSmasq is on so that we can get correct PTR record support (right now it's broken because the master isn't recursing and dnsmasq doesn't try other endpoints on failure).

@smarterclayton
Copy link
Contributor Author

Required to fix openshift/openshift-ansible#3017

@sdodson
Copy link
Member

sdodson commented Feb 6, 2017

My only concern is how will the node's dns server know which upstream servers to use when doing recursion if /etc/resolv.conf points to the node's dnsmasq and dnsmasq is sending all in-addr.arpa back to the node's dns server.

@smarterclayton
Copy link
Contributor Author

I may have to accept name servers or an alternate config file for skydns to bootstrap. Will look at that tomorrow morning.

@smarterclayton
Copy link
Contributor Author

Updated to add a dnsNameservers config variable that overrides the default behavior (reads from /etc/resolv.conf). Required to be set if the local proxy is in the resolve.conf.

@@ -112,12 +112,20 @@ type NodeConfig struct {
// MasterClientConnectionOverrides provides overrides to the client connection used to connect to the master.
MasterClientConnectionOverrides *ClientConnectionOverrides

// DNSBindAddress is the ip:port to serve on. If this is not set, the DNS server will not be started.
DNSBindAddress string
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

group DNSNameservers with this param and lay out the two setup scenarios really clearly

@@ -37,12 +37,12 @@ func NewNodeComponentFlag() *utilflags.ComponentFlag {
return utilflags.NewComponentFlag(
map[string][]string{ComponentGroupNetwork: {ComponentProxy, ComponentPlugins}},
ComponentKubelet, ComponentProxy, ComponentPlugins, ComponentDNS,
).DefaultDisable(ComponentDNS)
).DefaultEnable(ComponentDNS)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

aren't all enabled by default?

}

// NewNodeComponentFlag returns a flag capable of handling enabled components for the network
func NewNetworkComponentFlag() *utilflags.ComponentFlag {
return utilflags.NewComponentFlag(nil, ComponentProxy, ComponentPlugins, ComponentDNS).DefaultDisable(ComponentDNS)
return utilflags.NewComponentFlag(nil, ComponentProxy, ComponentPlugins, ComponentDNS).DefaultEnable(ComponentDNS)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same question

@@ -248,6 +248,7 @@ func (o *AllInOneOptions) Complete() error {
if dnsAddr.Provided {
if dnsAddr.Port == 53 {
// the user has set the DNS port to 53, which is the effective default (node on 53, master on 8053)
o.NodeArgs.DNSBindAddr = dnsAddr.URL.Host
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

doesn't this need a port?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Host in a URL is host:port or host.

@smarterclayton smarterclayton force-pushed the dns_args branch 3 times, most recently from d0548f2 to 790a538 Compare February 8, 2017 20:28
@smarterclayton
Copy link
Contributor Author

Flaked on kubernetes/kubernetes#40953

@@ -86,6 +87,7 @@ func NewCommandNodeConfig(commandName string, fullName string, out io.Writer) *c
flags.StringVar(&options.ImageTemplate.Format, "images", options.ImageTemplate.Format, "When fetching the network container image, use this format. The latest release will be used by default.")
flags.BoolVar(&options.ImageTemplate.Latest, "latest-images", options.ImageTemplate.Latest, "If true, attempt to use the latest images for the cluster instead of the latest release.")
flags.BoolVar(&options.AllowDisabledDocker, "allow-disabled-docker", options.AllowDisabledDocker, "Allow the node to start without docker being available.")
flags.StringVar(&options.DNSBindAddress, "dns-bind-address", options.DNSBindAddress, "An address to bind DNS to.")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do we need to surface it as a flag, or only in config?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We could avoid adding it as a flag, it just means that openshift start node will be unable to start DNS.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do we ever run openshift start node without a config?

DNSDomain string

// DNSIP holds the IP
// DNSIP is the IP address that the DNS server will listen on and which will be reported into pods. Defaults
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"DNSIP is the IP address that the DNS server will listen on" isn't accurate, right?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hmm... looks like we try to listen on port 53 of this IP unless DNSBindAddress is specified, in which case it stomps? that is not clear

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We never listen on this IP. I'll update the comment.

DNSIP string

// DNSBindAddress is the ip:port to serve DNS on. If this is not set, the DNS server will not be started.
// Because most DNS resolvers will only listen on port 53, if you select an alternative port you will need
// a DNS proxy like dnsmasq to answer queries for containers. A common configuration is dnsmasq configured
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"if you select an alternative port you will need a DNS proxy like dnsmasq to answer queries for containers, and to point DNSIP at that DNS proxy", right?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Because we say that in the previous field I don't know that it is necessary here (reordered to make that clear).

// queries to the host environments nameservers.
DNSBindAddress string

// DNSNameservers is a list of ip:port values of recursive nameservers to forward queries to.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

only used by the DNS server started if DNSBindAddress is set

DNSBindAddress string

// DNSNameservers is a list of ip:port values of recursive nameservers to forward queries to.
// If this value is empty, the DNS server will default to the nameservers listed in /etc/resolv.conf.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"the DNS server will delegate to nameservers listed in /etc/resolv.conf for queries it cannot satisfy itself"?

if len(config.DNSIP) > 0 {
validationResults.AddErrors(ValidateSpecifiedIP(config.DNSIP, fldPath.Child("dnsIP"))...)
}
for i, nameserver := range config.DNSNameservers {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

error to specify this and not specify DNSBindAddress?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we do that often? It means if you want to temporarily stop listening you have to change a bunch of fields, rather than just one.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess not... just don't want people (more) confused. not a big deal either way

if len(config.DNSIP) > 0 {
validationResults.AddErrors(ValidateSpecifiedIP(config.DNSIP, fldPath.Child("dnsIP"))...)
}
for i, nameserver := range config.DNSNameservers {
validationResults.AddErrors(ValidateSpecifiedIPPort(nameserver, fldPath.Child("dnsNameserver").Index(i))...)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"dnsNameservers"

@@ -317,8 +317,14 @@ func BuildKubernetesNodeConfig(options configapi.NodeConfig, enableProxy, enable
if len(options.DNSIP) > 0 {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if we don't start the dns server unless DNSBindAddress is specified, what's the point of setting it to DNSIP initially?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

are there old configs that just set DNSIP that will break (not start node DNS) if they upgrade and don't update their config to also set DNSBindAddress?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No one has ever started node DNS by default, so only someone using the feature experimentally (outside of our control) would be in that setup.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Before, you had to pass --enable=dns to get DNS. Now you don't. I think we can remove this check.

@smarterclayton
Copy link
Contributor Author

Another commit up.

@liggitt
Copy link
Contributor

liggitt commented Feb 9, 2017

LGTM

@sdodson
Copy link
Member

sdodson commented Feb 9, 2017

So it's on by default now and we need to set the bindaddress to avoid port conflicts? Recursion in the node's dns server was enabled to start with or do I need to do something to enable that as well?

Allows the installer to start node DNS without having to set a config
flag.  BindAddress is consistent with others of this type.
@smarterclayton
Copy link
Contributor Author

No, it's not on by default, you have to set dns-bind-address.

@smarterclayton
Copy link
Contributor Author

Node is recursion by default and you can't disable it.

@smarterclayton
Copy link
Contributor Author

[merge]

@openshift-bot
Copy link
Contributor

Evaluated for origin test up to f97f728

@sdodson
Copy link
Member

sdodson commented Feb 10, 2017 via email

@openshift-bot
Copy link
Contributor

continuous-integration/openshift-jenkins/test FAILURE (https://ci.openshift.redhat.com/jenkins/job/test_pull_requests_origin_future/62/) (Base Commit: 898266a)

@smarterclayton
Copy link
Contributor Author

Known flakes [merge]

@openshift-bot
Copy link
Contributor

Evaluated for origin merge up to f97f728

@smarterclayton
Copy link
Contributor Author

[merge]

@openshift-bot
Copy link
Contributor

openshift-bot commented Feb 11, 2017

continuous-integration/openshift-jenkins/merge SUCCESS (https://ci.openshift.redhat.com/jenkins/job/test_pull_requests_origin_future/132/) (Base Commit: 4e8a130) (Image: devenv-rhel7_5898)

@openshift-bot openshift-bot merged commit 8ac875e into openshift:master Feb 11, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants