* plugin/kubernetes: wait until api is ready
Wait for HasSynced before allowing startup to avoid startup race.
Also do a small refactor in findServices() to pull a check out of the
loop - only needs to be done once.
* sigh
* Rename middleware to plugin
first pass; mostly used 'sed', few spots where I manually changed
text.
This still builds a coredns binary.
* fmt error
* Rename AddMiddleware to AddPlugin
* Readd AddMiddleware to remain backwards compat
* mw/kubernetes: move fallthrough tests out
Remove the testcase duplication and put fallthrough tests in separate
file.
Also make some names shorter and more descriptive.
* fix test build
* fix corefile
* mw/kubernetes: split integration tests
* separate file and test for api fallthrough, does not need all other
servers to be started.
* more split ups: make it clear when or when not we need an upstream server,
as just needlessly start it in doIntegrationTests.
* use identifiers from dns package -> "TypeSRV" -> dns.TypeSRV, as there
is no need to reinvent these.
* updates
* deploy work-around
* re-add weird sleep
* mw/kubernetes: add configurable TTL
Add ttl option to kubernetes. This defaults to 5s but allows
configuration to go up to 3600.
Configure the tests so that a few actually check for the 5s, while the
rest use the TTL of 303 which is ignored by the checking code.
Fixes#935
* fix tests
* and more
Based up on: #939, but redone in a new PR with some cherry-picked
commits:
aacb91ef0b5dc34247b7
This removes kPod and Kservice and creates []msg.Service from k.findPods
and k.findServices.
Updated few tests which I *think* are correct; they look correct to me.
* mw/kubernetes: rewrite parseRequest
Stop looking at the qtype in parseRequest and make k.Namespace a map.
Fallout from this is that pkg/strings as it is not used anymore. Also
add a few helper functions to make unexposed namespaces easier to see in
the code.
Add wildcard tests to the middleware tests.
* Fix tests
Add a whole bunch of comments to document what we are trying to do.
* This is now answered
* up coverage
* duh
* Update testcase
* Make it nodata
* mw/federaration
This PR add the federation back as a middleware to keep it more
contained from the main kubernetes code.
It also makes parseRequest less import and pushes this functionlity down
in the k.Entries. This minimizes (or tries to) the importance for the
qtype in the query. In the end the qtype checking should only happen
in ServeDNS - but for k8s this might proof difficult.
Numerous other cleanup in code and kubernetes tests.
* up test coverage
* mw/kubernetes: remove federation and cidr
Remove both as we have a corefile syntax change that handles cidr and
remove federation because that is going to be its own middleware.
* backwards incompat changes
This PR:
* removes cidr from kubernetes (core Corefile feature now)
* removes federation from kubernets (comes back as new middleware)
* [remove autopath - which was already gone, so that already was
backwards incompat]
* adds `fallthrough` to the *etcd* middleware and makes you enable it.
* Fail on unknown properties
* documentation
* Disable TestHealthCheck as it uses realtime and fails
* Support multiple k8s api servers specification and load balance among api servers
This fix adds supports for multiple k8s api servers specification,
load balance among api servers.
When two or more api servers are specified in kubernetes block (endpoint ...),
a proxy is created locally (with randomly generately port). The coredns
will points to the generated proxy so that load balancing could be achieved.
Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
* Setup initial healthcheck at the beginning
Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
* Update README.md for kubernetes middleware and remove whitespaces.
Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
* Use middleware/pkg/healthcheck in middleware/kubernetes
for api proxy
Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
* middleware/kubernetes: pull TXT out of parseRequest
Put the TXT handling one layer higher and remove it from parseRequest.
Also rename the podsvc field in there to podOrSvc. Now that it isn't
used anymore for TXT record (dns-version) that was put in there. We can
make this a boolean (in a future PR).
Make parseRequest get an optional Zone that is from state.Zone and use
that instead of its own code. Removed some tests and other smaller
cleanups.
Fixes#836
* add this reverse
* another check
* readd
* Rename to kPod and kService for some clarity
* Treat absence of port/service in SRV as wildcard
Normally, a SRV-request should have the form
_<service>._<port>.<name>.<zone>. The k8s peer-finder which is used for
bootstrapping by some applications will however query for SRV at
<name>.<zone>.
To compensate for this behaviour, treat the absence of _<service> and
_<port> as wildcards.
* Modified tests with new SRV behaviour
Added a testcase for a SRV request without port & service
Removed now valid query from invalidSRVQueries
* Forgot to run gofmt on test/kubernetes_test.go
* Add external service cnames
* remove cruft
* update CI k8s version
* change CI k8s version
* min k8s ver for ext services
* trying k8s 1.5
* k8s 1.5 requires ports spec
* remove kruft
* update dns schema version
* commit for testing in cluster
* commit for testing in cluster
* refactor and add ns.dns record
* Release 007
* reduce heap allocations
* gofmt
* revert accidental Makefile commits
* restore prior rcode for disabled pod mode
* revert Makefile deltas
* add unit tests
* more unit tests
* make isRequestInReverseRange easier to test
* more unit tests
* addressing review feedback
* commit setup.go
* Add fallthrough support for Kubernetes
This enables registering other services in the same zone as
Kubernetes services. This also re-orders the middleware chain
so that Kubernetes comes before other types, in order to make
this work out-of-the-box.
* Remove extra line
* add cidrs opt
* remove state data from middleware object
* update k8s docs
* Add integration tests
* add unit tests for cidr and pods config
* more README fixes, separate dev notes
* adjust section headers
* fix typo
* dont require/allow "_" prefix for srv wildcard fields
* streamline parse/validation of req name
* removing nametemplate
* error when zone not found, loopify unit tests
Create a small speedup running the tests:
PASS
ok github.com/miekg/coredns/test 10.329s
PASS
ok github.com/miekg/coredns/test 6.079s
Skip the etcd ones. Doing the middleware/*/*_test ones doesn't yield
any speedup as these are still done on a per directory basis.
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.
* 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
Make the cache memory bounded, by using a LRU cache. Also split the
cache in a positive and negative one - each with its own controls.
Extend the cache stanza to allow for this:
cache {
positive limit [ttl]
negative limit [ttl]
}
is now possible. This also add a cache_test.go in the toplevel test/
directory that exercises the caching path.
Fixes#260
This fix updates .travis.yml and Makefile for several places:
- Remove unneeded `docker pull gcr.io/google_containers/hyperkube-amd64:v1.2.4` (only v1.3.7 was used)
- Use docker to deploy etcd (insteadof downloading etcd binary).
- Merge `make testk8s` and `make testk8s-setup` (no need to have multiple targets for a couple of tests)
- Set version of etcd and kubernetes in .travis.yml (so that it is easy to update new version in the future)
Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
* 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.
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
* Commenting out unused functions. TODO: remove when it is not needed
* Update README with namespace and template example
* Adding note about changing the record name format via a template
* Adding test scripts to automate k8s startup
* Automating k8s namespace creation
* Adding automation to start 4 k8s services
* Updating documentation for k8s tests
* Avoid downloading kubectl if already exists
* Adding debug statement when namespace is not exposed.
* Adding basic kubernetes integration tests
* Makefile now contains a "testk8s" target. This target requires k8s to
be running.
* Adding test/kubernetes_test.go file with a couple of basic A record
tests.
* Updating k8s integration tests to only run k8s integration tests
* Adding support for namespace wildcards
* Refactoring to move filtering logic to kubernetes.go file
* go fmt fixes
* Adding wildcard support for namespaces and service names
* Kubernetes integration tests updated for A records.
* Expanded record name assembly for answer section not yet implemented.
* Refactoring to focus k8sclient code just on accessing k8s API.
Filtering now handled in kubernetes.go
* Adding wildcard test cases
* Adding skydns startup script. (To allow side by side testing of wildcards.)
* Commenting out record name assmebly based on NameTemplate. Need to improve template before this makes sense.
* Adding basic SRV integration tests
* Need to add verification for additional answer section
* Fixing comments and formatting
* Moving wildcard constants to vars
* Travis test execution appears to be failing on access to these
constants
* Fixing access to util package
* Trying to work around Travis test bug
* Reverting to access kubernetes/util as "util"
Travis breakage is due to "Infoblox-CTO" in src path