Merge pull request #3367 from aledbf/503-restart
Remove reloads when there is no endpoints
This commit is contained in:
commit
08d5ffabbf
2 changed files with 12 additions and 11 deletions
|
@ -423,15 +423,14 @@ func (n *NGINXController) getBackendServers(ingresses []*extensions.Ingress) ([]
|
|||
aUpstreams := make([]*ingress.Backend, 0, len(upstreams))
|
||||
|
||||
for _, upstream := range upstreams {
|
||||
aUpstreams = append(aUpstreams, upstream)
|
||||
|
||||
isHTTPSfrom := []*ingress.Server{}
|
||||
for _, server := range servers {
|
||||
for _, location := range server.Locations {
|
||||
if upstream.Name == location.Backend {
|
||||
if len(upstream.Endpoints) == 0 {
|
||||
glog.V(3).Infof("Upstream %q has no active Endpoint", upstream.Name)
|
||||
|
||||
location.Backend = "" // for nginx.tmpl checking
|
||||
|
||||
// check if the location contains endpoints and a custom default backend
|
||||
if location.DefaultBackend != nil {
|
||||
sp := location.DefaultBackend.Spec.Ports[0]
|
||||
|
@ -468,14 +467,6 @@ func (n *NGINXController) getBackendServers(ingresses []*extensions.Ingress) ([]
|
|||
}
|
||||
}
|
||||
|
||||
// create the list of upstreams and skip those without Endpoints
|
||||
for _, upstream := range upstreams {
|
||||
if len(upstream.Endpoints) == 0 {
|
||||
continue
|
||||
}
|
||||
aUpstreams = append(aUpstreams, upstream)
|
||||
}
|
||||
|
||||
aServers := make([]*ingress.Server, 0, len(servers))
|
||||
for _, value := range servers {
|
||||
sort.SliceStable(value.Locations, func(i, j int) bool {
|
||||
|
@ -552,6 +543,11 @@ func (n *NGINXController) createUpstreams(data []*extensions.Ingress, du *ingres
|
|||
}
|
||||
}
|
||||
|
||||
s, err := n.store.GetService(svcKey)
|
||||
if err != nil {
|
||||
glog.Warningf("Error obtaining Service %q: %v", svcKey, err)
|
||||
}
|
||||
upstreams[defBackend].Service = s
|
||||
}
|
||||
|
||||
for _, rule := range ing.Spec.Rules {
|
||||
|
|
|
@ -68,6 +68,11 @@ local function format_ipv6_endpoints(endpoints)
|
|||
end
|
||||
|
||||
local function sync_backend(backend)
|
||||
if not backend.endpoints or #backend.endpoints == 0 then
|
||||
ngx.log(ngx.INFO, string.format("there is no endpoint for backend %s. Skipping...", backend.name))
|
||||
return
|
||||
end
|
||||
|
||||
local implementation = get_implementation(backend)
|
||||
local balancer = balancers[backend.name]
|
||||
|
||||
|
|
Loading…
Reference in a new issue