Validate if configmap exist and is in the namespace/name format

Verifiy if watch-namespace option exist
This commit is contained in:
Giancarlo Rubio 2017-03-13 21:50:27 +01:00
parent 0cb8f59f70
commit c6195c44f3
3 changed files with 95 additions and 3 deletions

View file

@ -128,10 +128,20 @@ func NewIngressController(backend ingress.Controller) *GenericController {
glog.Infof("service %v validated as source of Ingress status", *publishSvc)
}
if *configMap != "" {
_, _, err = k8s.ParseNameNS(*configMap)
for _, configMap := range []string{*configMap, *tcpConfigMapName, *udpConfigMapName} {
_, err = k8s.IsValidConfigMap(kubeClient, configMap)
if err != nil {
glog.Fatalf("configmap error: %v", err)
glog.Fatalf("%v", err)
}
}
if *watchNamespace != "" {
_, err = k8s.IsValidNamespace(kubeClient, *watchNamespace)
if err != nil {
glog.Fatalf("no watchNamespace with name %v found: %v", *watchNamespace, err)
}
}