clean backends data before sending to Lua endpoint (#2233)

This commit is contained in:
Elvin Efendi 2018-03-21 22:47:39 -04:00 committed by Manuel Alejandro de Brito Fontes
parent 0e26977dca
commit 2b5d4d7928

View file

@ -763,7 +763,15 @@ func (n *NGINXController) IsDynamicallyConfigurable(pcfg *ingress.Configuration)
// ConfigureDynamically JSON encodes new Backends and POSTs it to an internal HTTP endpoint
// that is handled by Lua
func (n *NGINXController) ConfigureDynamically(pcfg *ingress.Configuration) error {
buf, err := json.Marshal(pcfg.Backends)
backends := make([]*ingress.Backend, len(pcfg.Backends))
for i, backend := range pcfg.Backends {
cleanedupBackend := *backend
cleanedupBackend.Service = nil
backends[i] = &cleanedupBackend
}
buf, err := json.Marshal(backends)
if err != nil {
return err
}