Unblock startup if kubernetes API is unavailable (#2126)

This commit is contained in:
Kevin Nisbet 2018-10-22 09:30:08 -04:00 committed by Chris O'Haver
parent fdb31a27f3
commit 6539a10a62
3 changed files with 67 additions and 8 deletions

View file

@ -65,6 +65,10 @@ func (k Kubernetes) ServeDNS(ctx context.Context, w dns.ResponseWriter, r *dns.M
if k.Fall.Through(state.Name()) {
return plugin.NextOrFailure(k.Name(), k.Next, ctx, w, r)
}
if !k.APIConn.HasSynced() {
// If we haven't synchronized with the kubernetes cluster, return server failure
return plugin.BackendError(&k, zone, dns.RcodeServerFailure, state, nil /* err */, opt)
}
return plugin.BackendError(&k, zone, dns.RcodeNameError, state, nil /* err */, opt)
}
if err != nil {