-
Notifications
You must be signed in to change notification settings - Fork 40k
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
Handle federated service name lookups in kube-dns. #25727
Conversation
@@ -33,6 +33,7 @@ type KubeDNSConfig struct { | |||
KubeConfigFile string | |||
KubeMasterURL string | |||
HealthzPort int | |||
Federations map[string]string |
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.
Need a comment to explain what the key and value are here.
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.
Added a short comment. Please let me know if you think it is sufficient.
@quinton-hoole thanks for the review. I will address your comments. In the meantime, I have pushed additional commits that implement tests and include some code refactor. PTAL. @ArtfulCoder @thockin I think you should take a look too. |
|
||
// If the name query is not an exact query and does not match any records in the local store, | ||
// attempt to send a federation redirect (CNAME) response. | ||
if !exact { |
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.
I don't understand what an 'exact' query is, and why you would not want to handle it like any other request. Can you add a comment to explain?
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.
It's not very well documented, but if I understand it correctly, it means that SkyDNS wants the query names to be interpreted as is, without any modifications. Since we are going to modify the query name and send it as a CNAME response I think it is not appropriate to do it when it is true.
I could be wrong here and will be happy to modify the code if this is not the behavior we want.
@ArtfulCoder @thockin please correct me if I am wrong.
@quinton-hoole addressed the comments, PTAL. |
@madhusudancs LGTM. This will need a rebase now that #23930 is in. Adding LGTM in the mean time. Feel free to re-add yourself once the rebase against #23930 is in. |
And you also have a godep license issue. Best fix that up during the rebase too...
If I'm reading the error log correctly, it's caused by this:
|
For the domain name queries that fail to match any records in the local kube-dns cache, we check if the queried name matches the federation pattern. If it does, we send a CNAME response to the federated name. For more details look at the comments in the code.
…notation. Also, use the cluster zone information while generating the CNAME response for federation queries.
I think this wasn't in my code because I did not touch anything in the vendor directory. I guess that was coming from the base "one container ..." PR. I have rebased to master now, so hopefully this error is gone. |
Everything looks good, adding LGTM back. |
@k8s-bot test this [submit-queue is verifying that this PR is safe to merge] |
GCE e2e build/test passed for commit 006580a. |
Automatic merge from submit-queue |
Automatic merge from submit-queue federation: Updating KubeDNS to try finding a local service first for federation query Ref #26762 Updating KubeDNS to try to find a local service first for federation query. Without this change, KubeDNS always returns the DNS hostname, even if a local service exists. Have updated the code to first remove federation name from path if it exists, so that the default search for local service happens. If we dont find a local service, then we try to find the DNS hostname. Will appreciate a strong review since this is my first change to KubeDNS. #25727 was the original PR that added federation support to KubeDNS. cc @kubernetes/sig-cluster-federation @quinton-hoole @madhusudancs @bprashanth @mml
For the domain name queries that fail to match any records in the local
kube-dns cache, we check if the queried name matches the federation
pattern. If it does, we send a CNAME response to the federated name.
For more details look at the comments in the code.
Tests are coming ...
Also, this PR is based on @ArtfulCoder's PR #23930. So please review only the last commit here.
PTAL @ArtfulCoder @thockin @quinton-hoole @nikhiljindal