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:
parent
b42eae7a04
commit
0bf8b81cb7
3 changed files with 49 additions and 5 deletions
|
@ -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
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue