|
@@ -17,6 +17,7 @@ package etcdmain
|
|
|
import (
|
|
import (
|
|
|
"fmt"
|
|
"fmt"
|
|
|
"net"
|
|
"net"
|
|
|
|
|
+ "net/url"
|
|
|
"os"
|
|
"os"
|
|
|
"time"
|
|
"time"
|
|
|
|
|
|
|
@@ -77,6 +78,20 @@ func newGatewayStartCommand() *cobra.Command {
|
|
|
return &cmd
|
|
return &cmd
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+func stripSchema(eps []string) []string {
|
|
|
|
|
+ var endpoints []string
|
|
|
|
|
+
|
|
|
|
|
+ for _, ep := range eps {
|
|
|
|
|
+
|
|
|
|
|
+ if u, err := url.Parse(ep); err == nil && u.Host != "" {
|
|
|
|
|
+ ep = u.Host
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ endpoints = append(endpoints, ep)
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ return endpoints
|
|
|
|
|
+}
|
|
|
func startGateway(cmd *cobra.Command, args []string) {
|
|
func startGateway(cmd *cobra.Command, args []string) {
|
|
|
endpoints := gatewayEndpoints
|
|
endpoints := gatewayEndpoints
|
|
|
if gatewayDNSCluster != "" {
|
|
if gatewayDNSCluster != "" {
|
|
@@ -101,6 +116,9 @@ func startGateway(cmd *cobra.Command, args []string) {
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ // Strip the schema from the endpoints because we start just a TCP proxy
|
|
|
|
|
+ endpoints = stripSchema(endpoints)
|
|
|
|
|
+
|
|
|
if len(endpoints) == 0 {
|
|
if len(endpoints) == 0 {
|
|
|
plog.Fatalf("no endpoints found")
|
|
plog.Fatalf("no endpoints found")
|
|
|
}
|
|
}
|