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

Commit 9a280d5

Browse files
committed
Avoid sync without a reachable master
1 parent cc7b564 commit 9a280d5

File tree

2 files changed

+18
-7
lines changed

2 files changed

+18
-7
lines changed

ingress/controllers/nginx/controller.go

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -420,13 +420,17 @@ func (lbc *loadBalancerController) sync(key string) error {
420420
return fmt.Errorf("deferring sync till endpoints controller has synced")
421421
}
422422

423-
var cfg *api.ConfigMap
424-
425-
ns, name, _ := parseNsName(lbc.nxgConfigMap)
426-
cfg, err := lbc.getConfigMap(ns, name)
427-
if err != nil {
428-
glog.V(3).Infof("unexpected error searching configmap %v: %v", lbc.nxgConfigMap, err)
429-
cfg = &api.ConfigMap{}
423+
// by default no custom configuration configmap
424+
cfg := &api.ConfigMap{}
425+
426+
if lbc.nxgConfigMap != "" {
427+
// Search for custom configmap (defined in main args)
428+
var err error
429+
ns, name, _ := parseNsName(lbc.nxgConfigMap)
430+
cfg, err = lbc.getConfigMap(ns, name)
431+
if err != nil {
432+
return fmt.Errorf("unexpected error searching configmap %v: %v", lbc.nxgConfigMap, err)
433+
}
430434
}
431435

432436
ngxConfig := lbc.nginx.ReadConfig(cfg)

ingress/controllers/nginx/main.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,13 @@ func main() {
130130
}
131131
glog.Infof("Validated %v as the default backend", *defaultSvc)
132132

133+
if *nxgConfigMap != "" {
134+
_, _, err := parseNsName(*nxgConfigMap)
135+
if err != nil {
136+
glog.Fatalf("configmap error: %v", err)
137+
}
138+
}
139+
133140
lbc, err := newLoadBalancerController(kubeClient, *resyncPeriod, *defaultSvc, *watchNamespace, *nxgConfigMap, *tcpConfigMapName, *udpConfigMapName, runtimePodInfo)
134141
if err != nil {
135142
glog.Fatalf("%v", err)

0 commit comments

Comments
 (0)