Avoid sync without a reachable master
This commit is contained in:
parent
bf9ea5eec4
commit
26fd12a81c
2 changed files with 17 additions and 6 deletions
|
@ -420,13 +420,17 @@ func (lbc *loadBalancerController) sync(key string) error {
|
||||||
return fmt.Errorf("deferring sync till endpoints controller has synced")
|
return fmt.Errorf("deferring sync till endpoints controller has synced")
|
||||||
}
|
}
|
||||||
|
|
||||||
var cfg *api.ConfigMap
|
// by default no custom configuration configmap
|
||||||
|
cfg := &api.ConfigMap{}
|
||||||
|
|
||||||
ns, name, _ := parseNsName(lbc.nxgConfigMap)
|
if lbc.nxgConfigMap != "" {
|
||||||
cfg, err := lbc.getConfigMap(ns, name)
|
// Search for custom configmap (defined in main args)
|
||||||
if err != nil {
|
var err error
|
||||||
glog.V(3).Infof("unexpected error searching configmap %v: %v", lbc.nxgConfigMap, err)
|
ns, name, _ := parseNsName(lbc.nxgConfigMap)
|
||||||
cfg = &api.ConfigMap{}
|
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)
|
ngxConfig := lbc.nginx.ReadConfig(cfg)
|
||||||
|
|
|
@ -130,6 +130,13 @@ func main() {
|
||||||
}
|
}
|
||||||
glog.Infof("Validated %v as the default backend", *defaultSvc)
|
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)
|
lbc, err := newLoadBalancerController(kubeClient, *resyncPeriod, *defaultSvc, *watchNamespace, *nxgConfigMap, *tcpConfigMapName, *udpConfigMapName, runtimePodInfo)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
glog.Fatalf("%v", err)
|
glog.Fatalf("%v", err)
|
||||||
|
|
Loading…
Reference in a new issue