Check if etcd service has its port exposed

This commit is contained in:
Murat Kabilov 2017-01-23 17:22:59 +01:00
parent d5a7683a38
commit 5b5a64e55d
1 changed files with 5 additions and 0 deletions

View File

@ -36,6 +36,11 @@ func New(options Options) *SpiloOperator {
} }
ports := etcdService.Spec.Ports[0] ports := etcdService.Spec.Ports[0]
nodeurl, _ := url.Parse(config.Host) nodeurl, _ := url.Parse(config.Host)
if ports.NodePort == 0 {
log.Fatalln("Etcd port is not exposed")
}
etcdHostOutside := fmt.Sprintf("http://%s:%d", strings.Split(nodeurl.Host, ":")[0], ports.NodePort) etcdHostOutside := fmt.Sprintf("http://%s:%d", strings.Split(nodeurl.Host, ":")[0], ports.NodePort)
spiloClient, err := newKubernetesSpiloClient(config) spiloClient, err := newKubernetesSpiloClient(config)