plugin/federation: handle missing avail-zone/region labels better (#2092)

* handle missing avail-zone/region labels better

* oops forgot a file
This commit is contained in:
Chris O'Haver 2018-09-12 02:07:24 -04:00 committed by Miek Gieben
parent b42eae7a04
commit 0bf8b81cb7
3 changed files with 49 additions and 5 deletions

View file

@ -1,6 +1,8 @@
package kubernetes
import (
"errors"
"github.com/coredns/coredns/plugin/etcd/msg"
"github.com/coredns/coredns/plugin/pkg/dnsutil"
"github.com/coredns/coredns/request"
@ -37,6 +39,10 @@ func (k *Kubernetes) Federations(state request.Request, fname, fzone string) (ms
lz := node.Labels[LabelZone]
lr := node.Labels[LabelRegion]
if lz == "" || lr == "" {
return msg.Service{}, errors.New("local node missing zone/region labels")
}
if r.endpoint == "" {
return msg.Service{Host: dnsutil.Join([]string{r.service, r.namespace, fname, r.podOrSvc, lz, lr, fzone})}, nil
}