Skip to content
This repository has been archived by the owner on Apr 17, 2019. It is now read-only.

Commit

Permalink
Merge pull request #1258 from aledbf/fix-1233
Browse files Browse the repository at this point in the history
[nginx-ingress-controller]: Avoid sync without a reachable master
  • Loading branch information
bprashanth authored Jun 25, 2016
2 parents e1ba24a + 9a280d5 commit ddc66f4
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 7 deletions.
18 changes: 11 additions & 7 deletions ingress/controllers/nginx/controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -420,13 +420,17 @@ func (lbc *loadBalancerController) sync(key string) error {
return fmt.Errorf("deferring sync till endpoints controller has synced")
}

var cfg *api.ConfigMap

ns, name, _ := parseNsName(lbc.nxgConfigMap)
cfg, err := lbc.getConfigMap(ns, name)
if err != nil {
glog.V(3).Infof("unexpected error searching configmap %v: %v", lbc.nxgConfigMap, err)
cfg = &api.ConfigMap{}
// by default no custom configuration configmap
cfg := &api.ConfigMap{}

if lbc.nxgConfigMap != "" {
// Search for custom configmap (defined in main args)
var err error
ns, name, _ := parseNsName(lbc.nxgConfigMap)
cfg, err = lbc.getConfigMap(ns, name)
if err != nil {
return fmt.Errorf("unexpected error searching configmap %v: %v", lbc.nxgConfigMap, err)
}
}

ngxConfig := lbc.nginx.ReadConfig(cfg)
Expand Down
7 changes: 7 additions & 0 deletions ingress/controllers/nginx/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,13 @@ func main() {
}
glog.Infof("Validated %v as the default backend", *defaultSvc)

if *nxgConfigMap != "" {
_, _, err := parseNsName(*nxgConfigMap)
if err != nil {
glog.Fatalf("configmap error: %v", err)
}
}

lbc, err := newLoadBalancerController(kubeClient, *resyncPeriod, *defaultSvc, *watchNamespace, *nxgConfigMap, *tcpConfigMapName, *udpConfigMapName, runtimePodInfo)
if err != nil {
glog.Fatalf("%v", err)
Expand Down

0 comments on commit ddc66f4

Please sign in to comment.