Skip to content

Add dns ports to the master service - #5094

Merged
openshift-bot merged 2 commits into
openshift:masterfrom
abutcher:extra-ports
Oct 30, 2015
Merged

openshift-bot merged 2 commits into
openshift:masterfrom
abutcher:extra-ports

Conversation

@abutcher

Copy link
Copy Markdown
Member

Provides a load balanced endpoint for dns in a clustered environment via the master service. Relies on #5046.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

only do this if the master is configured to be a DNS server (options.DNSConfig != nil, I think)

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

@liggitt nice! on it

@abutcher
abutcher force-pushed the extra-ports branch 2 times, most recently from d43be15 to 017e61f Compare October 14, 2015 13:39
@abutcher abutcher changed the title [do not merge] Add dns ports to the master service Add dns ports to the master service Oct 14, 2015
@abutcher

Copy link
Copy Markdown
Member Author

@liggitt PTAL

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

shouldn't we be using the port from DNSConfig.BindAddress? It is typically port 53, but not in some integration test scenarios (like test/integration/dns_test.go)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

should there be an integration test added for this to dns_test.go?

@abutcher
abutcher force-pushed the extra-ports branch 2 times, most recently from fcd2e0b to b303ee4 Compare October 14, 2015 15:09
@abutcher

Copy link
Copy Markdown
Member Author

@liggitt Something like this ☝️ ?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

don't swallow the error?... not sure what 0 would do here

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

@liggitt similar message as the first error or is there a better way to chain the splithostport and strconv?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Or some catch all "unexpected error"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

"invalid port"? not sure

@abutcher

Copy link
Copy Markdown
Member Author

@liggitt went with "invalid DNS port"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Append your ports, don't stomp in case anything was already added

@abutcher

Copy link
Copy Markdown
Member Author

@liggitt Appended

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

m.ExtraServicePorts = append(m.ExtraServicePorts,
  {Name: "dns", Port: dnsPort, Protocol: kapi.ProtocolUDP, TargetPort: util.NewIntOrStringFromInt(dnsPort)},
  {Name: "dns-tcp", Port: dnsPort, Protocol: kapi.ProtocolTCP, TargetPort: util.NewIntOrStringFromInt(dnsPort)},
)

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Each will need type but I've changed it to

m.ExtraServicePorts = append(m.ExtraServicePorts,
    kapi.ServicePort{Name: "dns", Port: dnsPort, Protocol: kapi.ProtocolUDP, TargetPort: util.NewIntOrStringFromInt(dnsPort)},
    kapi.ServicePort{Name: "dns-tcp", Port: dnsPort, Protocol: kapi.ProtocolTCP, TargetPort: util.NewIntOrStringFromInt(dnsPort)},
)
m.ExtraEndpointPorts = append(m.ExtraEndpointPorts,
    kapi.EndpointPort{Name: "dns", Port: dnsPort, Protocol: kapi.ProtocolUDP},
    kapi.EndpointPort{Name: "dns-tcp", Port: dnsPort, Protocol: kapi.ProtocolTCP},
)

Comment thread test/integration/dns_test.go Outdated

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

you need to recreate the stop channel... the block above closes it, right?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

@liggitt

liggitt commented Oct 14, 2015

Copy link
Copy Markdown
Contributor

[test]

Comment thread test/end-to-end/core.sh Outdated

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

s/MASTER_IP/MASTER_SERVICE_IP/

@abutcher
abutcher force-pushed the extra-ports branch 2 times, most recently from fff4149 to 66b43ed Compare October 14, 2015 22:50
@abutcher

Copy link
Copy Markdown
Member Author

@liggitt think we got it nailed down 🔨

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

DNSConfig.BindAddress won't be meaningful to them, since that's not what the config field is named. What about unable to parse DNS bind address %s: %v", options.DNSConfig.BindAddress, err)

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Replaced

@liggitt

liggitt commented Oct 15, 2015

Copy link
Copy Markdown
Contributor

what's here looks ok... wondering how this connects to the dnsIP value in the node config. Does it make sense to always set these service ports and endpoint ports when the dnsIP in the node points at the master IP by default? Do we want/need a way to avoid always sticking this extra HA-related stuff in the master service

@openshift-bot openshift-bot removed needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. labels Oct 22, 2015
@smarterclayton

Copy link
Copy Markdown
Contributor

Where are we on this?

Comment thread pkg/cmd/server/kubernetes/node.go Outdated

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

@smarterclayton, if they specified a port named "dns" on port 53, should we even ping it or just use it?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Failing to ping 53 will fall back to the endpoint which is what we want without sdn?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Just use it

On Oct 29, 2015, at 8:00 AM, Jordan Liggitt [email protected]
wrote:

In pkg/cmd/server/kubernetes/node.go
#5094 (comment):

@@ -126,17 +126,29 @@ func (c *NodeConfig) initializeVolumeDir(ce commandExecutor, path string) (strin

// RunKubelet starts the Kubelet.
func (c *NodeConfig) RunKubelet() {

  • // TODO: clean this up and make it more formal (service named 'dns'?). Use multiple ports.
  • clusterDNS := c.KubeletConfig.ClusterDNS
  • if clusterDNS == nil {
  • if service, err := c.Client.Endpoints(kapi.NamespaceDefault).Get("kubernetes"); err == nil {
    
  •     if ip, ok := firstIP(service, 53); ok {
    
  •         if err := cmdutil.WaitForSuccessfulDial(false, "tcp", fmt.Sprintf("%s:%d", ip, 53), 50*time.Millisecond, 0, 2); err == nil {
    
  •             c.KubeletConfig.ClusterDNS = net.ParseIP(ip)
    
  • if c.KubeletConfig.ClusterDNS == nil {
  • // Set ClusterDNS to "kubernetes" master service ip if port 53/tcp can be successfully dialed
    
  • if service, err := c.Client.Services(kapi.NamespaceDefault).Get("kubernetes"); err == nil {
    
  •     if includesServicePort(service.Spec.Ports, 53, "dns-tcp") {
    
  •         serviceIP := service.Spec.ClusterIP
    
  •         if err := cmdutil.WaitForSuccessfulDial(false, "tcp", fmt.Sprintf("%s:%d", serviceIP, 53), 50*time.Millisecond, 0, 2); err == nil {
    

@smarterclayton https://github.com/smarterclayton, if they specified a
port named "dns" on port 53, should we even ping it or just use it?

—
Reply to this email directly or view it on GitHub
https://github.com/openshift/origin/pull/5094/files#r43376225.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Failing to ping 53 will fall back to the endpoint which is what we want without sdn?

Won't port 53 through the service work without SDN?

Just use it

In that case, switch from checking "dns-tcp" to "dns"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I could see keeping the existing fallback to use port 53 on the kubernetes endpoint (regardless of name) if we can ping it. So the priority order would be:

  1. configured dns ip
  2. specified "dns" port 53 for service (no ping test)
  3. specified "dns" port 53 for endpoint (no ping test)
  4. any named port 53 for endpoint (ping test)

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

  1. configured dns ip
  2. specified "dns" port 53 for service (no ping test)
  3. specified "dns" port 53 for endpoint (no ping test)
  4. any named port 53 for endpoint (ping test)

We'll need to test 2 & 3 to fallback to 4?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Why? If they configured a dns port in the service, trust it. We don't ping the IP from the config, do we?

@liggitt

liggitt commented Oct 29, 2015

Copy link
Copy Markdown
Contributor

cherry pick kubernetes/kubernetes#15791 into this as well?

@abutcher

Copy link
Copy Markdown
Member Author

@liggitt Updated the priority of ClusterDNS to match your comments and cherry picked the upstream PR.

@liggitt

liggitt commented Oct 29, 2015

Copy link
Copy Markdown
Contributor

squash non-upstream commits

@liggitt

liggitt commented Oct 29, 2015

Copy link
Copy Markdown
Contributor

origin changes lgtm

@abutcher

Copy link
Copy Markdown
Member Author

Squashed and replaced upstream commit

@liggitt

liggitt commented Oct 29, 2015

Copy link
Copy Markdown
Contributor

[test]

@liggitt

liggitt commented Oct 29, 2015

Copy link
Copy Markdown
Contributor

flake:

/data/src/github.com/openshift/origin/hack/../hack/util.sh: line 78: openshift: command not found

[test]

@openshift-bot

Copy link
Copy Markdown
Contributor

Evaluated for origin test up to ec21c22

@openshift-bot

Copy link
Copy Markdown
Contributor

@liggitt

liggitt commented Oct 30, 2015

Copy link
Copy Markdown
Contributor

[merge]

@pweil- pweil- mentioned this pull request Oct 30, 2015
@openshift-bot

Copy link
Copy Markdown
Contributor

Evaluated for origin merge up to ec21c22

@openshift-bot

Copy link
Copy Markdown
Contributor

continuous-integration/openshift-jenkins/merge SUCCESS (https://ci.openshift.redhat.com/jenkins/job/test_pull_requests_origin/6385/) (Image: devenv-rhel7_2606)

openshift-bot pushed a commit that referenced this pull request Oct 30, 2015
@openshift-bot
openshift-bot merged commit 6da6129 into openshift:master Oct 30, 2015
@abutcher
abutcher deleted the extra-ports branch October 30, 2015 16:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants