diff --git a/nginx-controller/controller/controller.go b/nginx-controller/controller/controller.go index 757c21d271..12f106b05a 100644 --- a/nginx-controller/controller/controller.go +++ b/nginx-controller/controller/controller.go @@ -523,21 +523,21 @@ func (lbc *LoadBalancerController) syncCfgm(key string) { cfg.AuthBasicUserFile = authBasicUserFile } - if mainHTTPSnippets, exists, err := nginx.GetMapKeyAsMapStringString(cfgm.Data, "http-snippets", cfgm); exists { + if mainHTTPSnippets, exists, err := nginx.GetMapKeyAsMapIntString(cfgm.Data, "http-snippets", cfgm); exists { if err != nil { glog.Error(err) } else { cfg.MainHTTPSnippets = mainHTTPSnippets } } - if locationSnippets, exists, err := nginx.GetMapKeyAsMapStringString(cfgm.Data, "location-snippets", cfgm); exists { + if locationSnippets, exists, err := nginx.GetMapKeyAsMapIntString(cfgm.Data, "location-snippets", cfgm); exists { if err != nil { glog.Error(err) } else { cfg.LocationSnippets = locationSnippets } } - if serverSnippets, exists, err := nginx.GetMapKeyAsMapStringString(cfgm.Data, "server-snippets", cfgm); exists { + if serverSnippets, exists, err := nginx.GetMapKeyAsMapIntString(cfgm.Data, "server-snippets", cfgm); exists { if err != nil { glog.Error(err) } else { diff --git a/nginx-controller/nginx/configurator.go b/nginx-controller/nginx/configurator.go index 18579e799a..0f9b3e9349 100644 --- a/nginx-controller/nginx/configurator.go +++ b/nginx-controller/nginx/configurator.go @@ -207,14 +207,14 @@ func (cnf *Configurator) createConfig(ingEx *IngressEx) Config { } } - if serverSnippets, exists, err := GetMapKeyAsMapStringString(ingEx.Ingress.Annotations, "nginx.org/server-snippets", ingEx.Ingress); exists { + if serverSnippets, exists, err := GetMapKeyAsMapIntString(ingEx.Ingress.Annotations, "nginx.org/server-snippets", ingEx.Ingress); exists { if err != nil { glog.Error(err) } else { ingCfg.ServerSnippets = serverSnippets } } - if locationSnippets, exists, err := GetMapKeyAsMapStringString(ingEx.Ingress.Annotations, "nginx.org/location-snippets", ingEx.Ingress); exists { + if locationSnippets, exists, err := GetMapKeyAsMapIntString(ingEx.Ingress.Annotations, "nginx.org/location-snippets", ingEx.Ingress); exists { if err != nil { glog.Error(err) } else { diff --git a/nginx-controller/nginx/convert.go b/nginx-controller/nginx/convert.go index ee80a65005..53483730c6 100644 --- a/nginx-controller/nginx/convert.go +++ b/nginx-controller/nginx/convert.go @@ -49,8 +49,8 @@ func GetMapKeyAsStringSlice(m map[string]string, key string, context apiObject) return nil, false, nil } -// GetMapKeyAsMapStringString tries to find and parse a key in the map int as string -func GetMapKeyAsMapStringString(m map[string]string, key string, context apiObject) (map[int]string, bool, error) { +// GetMapKeyAsMapIntString tries to find and parse a key in the map int as string +func GetMapKeyAsMapIntString(m map[string]string, key string, context apiObject) (map[int]string, bool, error) { lines := make(map[int]string, len(m[key])) if str, exists := m[key]; exists { for k, v := range strings.Split(str, "\n") {