mirror of
https://github.com/coredns/coredns.git
synced 2025-10-27 08:14:18 -04:00
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:
committed by
Miek Gieben
parent
b42eae7a04
commit
0bf8b81cb7
@@ -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
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user