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

Append both the zone and the region to the federation query responses, not just the zone. #27960

Merged

Conversation

madhusudancs
Copy link
Contributor

@madhusudancs madhusudancs commented Jun 23, 2016

This PR is based on @mml's #27896. I will rebase once that PR is merged.

Analytics

@madhusudancs madhusudancs added priority/critical-urgent Highest priority. Must be actively worked on as someone's top priority right now. area/cluster-federation release-note-none Denotes a PR that doesn't merit a release note. labels Jun 23, 2016
@madhusudancs madhusudancs added this to the v1.3 milestone Jun 23, 2016
@k8s-github-robot k8s-github-robot added the size/M Denotes a PR that changes 30-99 lines, ignoring generated files. label Jun 23, 2016
@madhusudancs madhusudancs force-pushed the fed-kube-dns-append-region branch from 02e8ad0 to 6894e74 Compare June 23, 2016 18:54
@madhusudancs
Copy link
Contributor Author

Rebased.

@nikhiljindal
Copy link
Contributor

cc @girishkalele

// that complexity is going to buy us. So taking a simpler approach here.
// Also note that zone here means the zone in cloud provider terminology, not
// the DNS zone.
func (kd *KubeDNS) getClusterZoneAndRegion() (string, string, error) {
Copy link

Choose a reason for hiding this comment

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

Two notes on this:

  1. A cluster can exist in more than 1 zone.
  2. The code to find all zones and the region already exists in https://github.com/kubernetes/kubernetes/blob/master/federation/pkg/federation-controller/service/dns.go#L79 . It's not currently in a form where you can call it directly here, but we should refactor it so that you can (in a followup, non v1.3 PR).

Happy to leave as is for this PR.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

For some additional context and clarification, the actual code that fetches the zones and regions is here - https://github.com/kubernetes/kubernetes/blob/master/federation/pkg/federation-controller/cluster/cluster_client.go#L143. It is doing the same thing we do here (except it stores all the zones and regions and we arbitrarily pick one here). We should definitely merge the two implementations.

@ghost
Copy link

ghost commented Jun 23, 2016

LGTM. Please open an issue for the nit.

@ghost ghost added lgtm "Looks good to me", indicates that a PR is ready to be merged. team/control-plane labels Jun 23, 2016
@@ -643,31 +646,37 @@ func (kd *KubeDNS) getClusterZone() (string, error) {
// TODO(madhusudancs): Move this to external/v1 API.
nodeList, err := kd.kubeClient.Core().Nodes().List(kapi.ListOptions{})
if err != nil || len(nodeList.Items) == 0 {
return "", fmt.Errorf("failed to retrieve the cluster nodes: %v", err)
return "", "", fmt.Errorf("failed to retrieve the cluster nodes: %v", err)
}

// Select a node (arbitrarily the first node) that has `LabelZoneFailureDomain` set.
Copy link
Member

Choose a reason for hiding this comment

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

femto nit : Update comment that we are looking for both LabelZoneRegion and LabelZoneFailureDomain has to be set?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done.

@madhusudancs
Copy link
Contributor Author

@quinton-hoole filed the issue here - #27966

@madhusudancs
Copy link
Contributor Author

@quinton-hoole @dims Addressed the comments. PTAL again.

@@ -661,6 +662,8 @@ func (kd *KubeDNS) getClusterZoneAndRegion() (string, string, error) {
if err := kd.nodesStore.Add(node); err != nil {
return "", "", fmt.Errorf("couldn't add the retrieved node to the cache: %v", err)
}
// Node is found, break out of the loop.
break
Copy link
Member

Choose a reason for hiding this comment

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

Thanks for incorporating the feedback @madhusudancs !

@k8s-github-robot k8s-github-robot removed the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Jun 23, 2016
@ghost ghost added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Jun 23, 2016
@k8s-bot
Copy link

k8s-bot commented Jun 23, 2016

GCE e2e build/test passed for commit a827ef0.

@k8s-github-robot
Copy link

Automatic merge from submit-queue

@k8s-github-robot k8s-github-robot merged commit 38182e9 into kubernetes:master Jun 23, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
lgtm "Looks good to me", indicates that a PR is ready to be merged. priority/critical-urgent Highest priority. Must be actively worked on as someone's top priority right now. release-note-none Denotes a PR that doesn't merit a release note. size/M Denotes a PR that changes 30-99 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants