Merge pull request #1310 from aledbf/fix-config

Refactoring nginx configuration configmap
This commit is contained in:
Manuel Alejandro de Brito Fontes 2017-09-07 09:45:32 -07:00 committed by GitHub
commit 6146bc4dc2

View file

@ -465,23 +465,22 @@ Error: %v
// SetConfig sets the configured configmap // SetConfig sets the configured configmap
func (n *NGINXController) SetConfig(cmap *api_v1.ConfigMap) { func (n *NGINXController) SetConfig(cmap *api_v1.ConfigMap) {
n.configmap = cmap n.configmap = cmap
n.isProxyProtocolEnabled = false n.isProxyProtocolEnabled = false
if cmap == nil {
n.backendDefaults = config.NewDefault().Backend m := map[string]string{}
return if cmap != nil {
m = cmap.Data
} }
val, ok := cmap.Data["use-proxy-protocol"] val, ok := m["use-proxy-protocol"]
if ok { if ok {
b, err := strconv.ParseBool(val) b, err := strconv.ParseBool(val)
if err == nil { if err == nil {
n.isProxyProtocolEnabled = b n.isProxyProtocolEnabled = b
return
} }
} }
n.backendDefaults = ngx_template.ReadConfig(n.configmap.Data).Backend n.backendDefaults = ngx_template.ReadConfig(m).Backend
} }
// SetListers sets the configured store listers in the generic ingress controller // SetListers sets the configured store listers in the generic ingress controller