Change the CI setup for K8s to be simpler. Now it just creates a
set of objects via a yaml file, making it very easy to modify
the tests.
Implement PTR for services.
* When no records match, reply with NXDOMAIN
* Implement in IsNameError
* case for unexposed namespace. k8s integation tests
* Fix imports order. Lower case of err strs.
Be more explicit in the logs when a notify fails.
New notify error message looks like:
2016/11/07 18:21:42 [ERROR] Notify for zone "example.org." was not accepted by "8.8.8.8:53": rcode was "SERVFAIL"
Correctly pick up secondaries
When multiple secondary are specified make sure they are picked up.
Fixes#393#398
The watchers were still trying to process raw v1 objects which
failed to be added to the store. This meant new services and
namespaces created after CoreDNS started would not be discoverable.
Add a filter function that converts watch events with v1 objects
to events with api objects.
Add a Reverse method to BackendService because different backends want
to to do diff. things. This allows etc/k8s to share even more code and
we can unify the PTR handling.
* Fix k8s client to use client-go
* Fix Kubernetes Build Issue
The client-go code requires you to vendor. I have done a hack here
in the Makefile to vendor it to version 1.5. But looks like we
will need to do this the 'right' way soon.
* Convert v1 to api Objects in List Functions
Also removed the endpoint controller which was not used for anything.
The Watch functions may still need the same treatment.
* Vendor client-go release-1.5
* Fix basic SRV feature
This is actually not serving SRV records correctly, but this should
get it to work as it did prior to the k8s client changes. Another
fix will be needed to serve SRV records as defined in the spec.
* Add additional output in test result
Add the response to the test output.
* Fix erroneous test data
* Add ServiceBackend interface
This adds a ServiceBackend interface that is shared between etcd/etcd3
(later) and kubernetes, leading to a massive reduction in code. When
returning the specific records from their backend.
Fixes#273
* middleware/metrics: add more metrics
middleware/cache:
Add metrics for number of elements in the cache. Also export the total
size. Update README to detail the new metrics.
middleware/metrics
Move metrics into subpackage called "vars". This breaks the import
cycle and is cleaner. This allows vars.Report to be used in the
the dnsserver to log refused queries.
middleware/metrics: tests
Add tests to the metrics framework. The metrics/test subpackage allows
scraping of the local server. Do a few test scrape of the metrics that
are defined in the metrics middleware.
This also allows metrics integration tests to check if the caching and
dnssec middleware export their metrics correctly.
* update README
* typos
* fix tests
This fix adds several needed comments in
`middleware/kubernetes/nametemplate/nametemplate.go`
to clean up golint output.
There are still 3 places that needs proper docs:
```
middleware/kubernetes/nametemplate/nametemplate.go:64:1: comment on exported type Template should be of the form "Template ..." (with optional leading article)
middleware/kubernetes/nametemplate/nametemplate.go:72:1: comment on exported method Template.SetTemplate should be of the form "SetTemplate ..."
middleware/kubernetes/nametemplate/nametemplate.go:188:1: comment on exported type NameValues should be of the form "NameValues ..." (with optional leading article)
```
Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
This still needs cleanup, but this is a first pass the cleans some
cruft and documents our style (in middleware.md) and makes all the
docs match that style.
* Added TLS to k8s client
Added options for TLS kubernetes client connection.
* Fix k8s TLS config option parsing
Brings config option parsing for kubernetes TLS in line with recent changes.
* Put TLS config on one line
Put kubernetes tls config on one line to match style established in etcd tls config.
* Add tls option to README
* Fix linter errors
* More linting fixes
* More docs and making members private that dont need to be public
* Fix linter errors
* More linting fixes
* More docs and making members private that dont need to be public
* More lint fixes
This leaves:
~~~
middleware/kubernetes/nametemplate/nametemplate.go:64:6: exported type NameTemplate should have comment or be unexported
middleware/kubernetes/nametemplate/nametemplate.go:71:1: exported method NameTemplate.SetTemplate should have comment or be unexported
middleware/kubernetes/nametemplate/nametemplate.go:108:1: exported method NameTemplate.GetZoneFromSegmentArray should have comment or be unexported
middleware/kubernetes/nametemplate/nametemplate.go:116:1: exported method NameTemplate.GetNamespaceFromSegmentArray should have comment or be unexported
middleware/kubernetes/nametemplate/nametemplate.go:120:1: exported method NameTemplate.GetServiceFromSegmentArray should have comment or be unexported
middleware/kubernetes/nametemplate/nametemplate.go:124:1: exported method NameTemplate.GetTypeFromSegmentArray should have comment or be unexported
middleware/kubernetes/nametemplate/nametemplate.go:135:1: exported method NameTemplate.GetSymbolFromSegmentArray should have comment or be unexported
middleware/kubernetes/nametemplate/nametemplate.go:167:1: exported method NameTemplate.IsValid should have comment or be unexported
middleware/kubernetes/nametemplate/nametemplate.go:182:6: exported type NameValues should have comment or be unexported
middleware/kubernetes/util/util.go:1:1: package comment should be of the form "Package util ..."
middleware/kubernetes/util/util.go:27:2: exported const WildcardStar should have comment (or a comment on this block) or be unexported
middleware/proxy/lookup.go:66:1: exported method Proxy.Forward should have comment or be unexported
middleware/proxy/proxy.go:24:6: exported type Client should have comment or be unexported
middleware/proxy/proxy.go:107:1: exported function Clients should have comment or be unexported
middleware/proxy/reverseproxy.go:10:6: exported type ReverseProxy should have comment or be unexported
middleware/proxy/reverseproxy.go:16:1: exported method ReverseProxy.ServeDNS should have comment or be unexported
middleware/proxy/upstream.go:42:6: exported type Options should have comment or be unexported
~~~
I plan on reworking the proxy anyway, so I'll leave that be.
Cleanup the errors and removed deadcode along the way. The leaves
some error laying around, mostly about commenting exported identifier.
We should look hard if those really are needed.
For some reasons there was a dnsserver/middleware.go that defined
the middleware handlers. This code was a repeat from
middleware/middleware.go. Removed dnsserver/middleware.go and replaced
all uses of dnsserver.Middleware with middleware.Middleware.
Added dnsserver/address_test.go to test the zone normalization (and to
improve the test coverage). The deleted file will also improve the test
coverage :)
Kubernetes moves informer and controller to pkg/client/cache, see:
https://github.com/kubernetes/kubernetes/pull/32718
As a result, coredns build is broken.
This fix fixes the build by making related change with kubernetes.
Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
Stop the caddy message and start our own init notifications.
Log the version of CoreDNS when starting up.
Fix all middleware's setup functions so that return the error prefixed
with *which* middleware was failing; leads to better debuggable errors
when starting up.
Move all (almost all) Go files in middleware into their
own packages. This makes for better naming and discoverability.
Lot of changes elsewhere to make this change.
The middleware.State was renamed to request.Request which is better,
but still does not cover all use-cases. It was also moved out middleware
because it is used by `dnsserver` as well.
A pkg/dnsutil packages was added for shared, handy, dns util functions.
All normalize functions are now put in normalize.go
* Adding debug message when starting k8s controller
* Adding work-around for timing issue in k8s integration tests
* Remove unused import
* Fix Makefile for ast package
* Increase k8s verbosity in travis
* Updating TODO list to find root cause of test issue
* go fmt cleanup
* Set version to 001
* Remove k8stest, test fails is k8s is not there: touch luck
* Remove server directory: not used anymore
* Disable k8s test (for now)
* gometalinter changes
* Make CoreDNS a server type plugin for Caddy
Remove code we don't need and port all middleware over. Fix all tests
and rework the documentation.
Also make `go generate` build a caddy binary which we then copy into
our directory. This means `go build`-builds remain working as-is.
And new etc instances in each etcd test for better isolation.
Fix more tests and rework test.Server with the newer support Caddy offers.
Fix Makefile to support new mode of operation.
* Adding pod setup to kubernetes startup scripts
* Adding template description to k8s README.md
* Fix typo.
* Moving kubernetes setup scripts out of go folder
* Fixing script error
* Adding messages to k8s scripts for clarity
* Adding parsing for label selector to Corefile
* Updating comment typo in k8sCorefile
* Adding implementation of label support to filter exposed objects
* Updating TODO list
* Removing old unused inline k8s API code and tests.
* Adding parsing implementation for `resyncperiod` keyword from Corefile.
* Adding tests for parsing `resyncperiod` keyword from Corefile.
8 Updating README.md and conf/k8sCorefile.
* Merge notification code by @aledbf and update for recent changes.
* Fix travis environment to correctly build with k8s.io and forked repositories.
* Refactored kubernetes Corefile parser
* Added lots of Corefile parsing tests
Updating travis yaml file to:
* Force IPv6 to work in their VM environment
* Enable docker (requires VM environment and sudo)
* Run kubernetes integration tests in Travis
* Updating comment to remove references to Caddy
* Updating README to mark TODO items complete
* Changing all debug print statements over to use logging package