Adding resyncperiod to Corefile (#205)

* 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.
This commit is contained in:
Michael Richmond 2016-08-08 14:30:04 -07:00 committed by GitHub
parent 51eaefc037
commit c079de65b5
9 changed files with 123 additions and 965 deletions

View file

@ -20,10 +20,6 @@ import (
clientcmdapi "k8s.io/kubernetes/pkg/client/unversioned/clientcmd/api"
)
const (
defaultResyncPeriod = 5 * time.Minute
)
type Kubernetes struct {
Next middleware.Handler
Zones []string
@ -37,7 +33,7 @@ type Kubernetes struct {
func (g *Kubernetes) StartKubeCache() error {
// For a custom api server or running outside a k8s cluster
// set URL in env.KUBERNETES_MASTER
// set URL in env.KUBERNETES_MASTER or set endpoint in Corefile
loadingRules := clientcmd.NewDefaultClientConfigLoadingRules()
overrides := &clientcmd.ConfigOverrides{}
if len(g.APIEndpoint) > 0 {
@ -55,6 +51,7 @@ func (g *Kubernetes) StartKubeCache() error {
log.Printf("[ERROR] Failed to create kubernetes notification controller: %v", err)
return err
}
log.Printf("[debug] Starting kubernetes middleware with k8s API resync period: %s", g.ResyncPeriod)
g.APIConn = newdnsController(kubeClient, g.ResyncPeriod)
go g.APIConn.Run()