-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
New Plugin: extkubernetes - Expose External IPs of Load Balancers #2337
Conversation
e6a4163
to
170412d
Compare
Codecov Report
@@ Coverage Diff @@
## master #2337 +/- ##
==========================================
- Coverage 56.45% 56.07% -0.39%
==========================================
Files 203 216 +13
Lines 10157 10702 +545
==========================================
+ Hits 5734 6001 +267
- Misses 3986 4238 +252
- Partials 437 463 +26
Continue to review full report at Codecov.
|
FYI, @johnbelamaric |
I should clarify that the state of this PR is that it is functional. I've tested it using minikube + metalLB, and it works as expected. Hence I am not marking this as a work in progress. Awaiting feedback and general acceptance of the approach before continuing. |
This almost duplicates the kubernetes plugin. Please figure out a way to not do that and not fill up pkg/* with kubernetes stuff |
@@ -44,6 +44,7 @@ hosts:hosts | |||
route53:route53 | |||
federation:federation | |||
kubernetes:kubernetes | |||
extkubernetes:extkubernetes |
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.
don't really like the name, should we just go for external, or externelkubernetes or ... something?
|
||
## Description | ||
|
||
Creates A/AAAA, SRV, and PTR records for the External IPs of each LoadBalancer type Service in a Kubernetes cluster. |
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.
Please full sentences. The extkubernernetes plugin ...
} | ||
``` | ||
|
||
* `resyncperiod` specifies the Kubernetes API refresh period to be **DURATION**. |
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.
Just reference the kubernetes plugin here? Removes the need to duplicate all the info here.
func (p *proxyHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) { | ||
upstream := p.Select() | ||
network := "tcp" | ||
address := upstream.Name |
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.
address
is only used in the dial just below? No need to put this in a new var
http.Error(w, fmt.Sprintf("Unable to establish connection to upstream %s://%s: %s", network, address, err), 500) | ||
return | ||
} | ||
hj, ok := w.(http.Hijacker) |
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.
why is this needed?
"context" | ||
|
||
"github.com/coredns/coredns/plugin" | ||
"github.com/coredns/coredns/request" |
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.
fmt
|
||
// ServeDNS implements the plugin.Handler interface. | ||
func (k Kubernetes) ServeDNS(ctx context.Context, w dns.ResponseWriter, r *dns.Msg) (int, error) { | ||
opt := plugin.Options{} |
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.
where is opt used? Please move this closer
meta "k8s.io/apimachinery/pkg/apis/meta/v1" | ||
) | ||
|
||
var dnsTestCases = []test.Case{ |
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.
is this just duplicating stuff?
[ Quoting <notifications@github.com> in "Re: [coredns/coredns] New Plugin: e..." ]
Closed #2337.
Note, Chris: I'm very much in favor of having this, but can we do it in much
less than 3000 lines added?
|
from @johnbelamaric:
from @miekg :
I guess there is too much constraints here. If we want to make 2 separates plugins, then we'd better have common code (throuhg lib), and also maybe share the same connection to K8s API. I am not sure why the number of lines make a difference: I would think the important is to have code that with good design, and maintainable, and UT (which adds line for sure). |
[ Quoting <notifications@github.com> in "Re: [coredns/coredns] New Plugin: e..." ]
I am not sure why the number of lines make a difference: I would think the important is to have code that with good design, and maintainable, and UT (which adds line for sure).
It's not CLOC, but if duplicated, we need something to keep things in sync
(automatically)
/Miek
…--
Miek Gieben
|
I do not find the meaning for CLOC (https://acronyms.thefreedictionary.com/CLOC). Can you translate ?
I guess we do not want to duplicate but rather have a common library, no ? |
[ Quoting <notifications@github.com> in "Re: [coredns/coredns] New Plugin: e..." ]
I do not find the meaning for CLOC (https://acronyms.thefreedictionary.com/CLOC). Can you translate ?
> but if duplicated, we need something to keep things in sync
I guess we do not want to duplicate but rather have a common library, no ?
and the common part, packaged as a lib, is moved to plugin/pkg ... Is it not the purpose of this folder ?
yes, but everything within limits of course; if the entire plugin lives in pkg/
you have to ask what you're doing.
Seems doing this in the kubernets plugins seems more sensible?
(don't know what I said before, but 3000 cloc for a little feature seems to be
pushing it)
|
1. Why is this pull request needed and what does it do?
pkg/kubernetes
(e.g. API connection, watch)."Connection sharing" with the kubernetes plugin is not implemented (that is, if both plugins are active, they do not share the same API connection). I think the general mode of deployment would be to serve external IPs from a separate instance of CoreDNS, not from the internal cluster DNS, so connection sharing would seldom be a factor. But if there is a demand to serve the data from the same instance, then we can implement connection sharing later.
No
coredns/ci
test yet. It will be complicated to implement, but doable. It will involve setting up virtual routers and load balancers (metalLB) in the framework of the test. I'll start on this only if it looks like the plugin will be accepted.2. Which issues (if any) are related?
#1851
kubernetes/dns#242
3. Which documentation changes (if any) need to be made?