| ... | ... |
@@ -63,6 +63,7 @@ type Helper struct {
|
| 63 | 63 |
// StartOptions represent the parameters sent to the start command |
| 64 | 64 |
type StartOptions struct {
|
| 65 | 65 |
ServerIP string |
| 66 |
+ RouterIP string |
|
| 66 | 67 |
DNSPort int |
| 67 | 68 |
UseSharedVolume bool |
| 68 | 69 |
SetPropagationMode bool |
| ... | ... |
@@ -289,7 +290,7 @@ func (h *Helper) Start(opt *StartOptions, out io.Writer) (string, error) {
|
| 289 | 289 |
if err != nil {
|
| 290 | 290 |
return "", errors.NewError("could not copy OpenShift configuration").WithCause(err)
|
| 291 | 291 |
} |
| 292 |
- err = h.updateConfig(configDir, opt.HostConfigDir, opt.ServerIP, opt.MetricsHost) |
|
| 292 |
+ err = h.updateConfig(configDir, opt.HostConfigDir, opt.RouterIP, opt.MetricsHost) |
|
| 293 | 293 |
if err != nil {
|
| 294 | 294 |
cleanupConfig() |
| 295 | 295 |
return "", errors.NewError("could not update OpenShift configuration").WithCause(err)
|
| ... | ... |
@@ -443,7 +444,7 @@ func (h *Helper) copyConfig(hostDir string) (string, error) {
|
| 443 | 443 |
return filepath.Join(tempDir, filepath.Base(hostDir)), nil |
| 444 | 444 |
} |
| 445 | 445 |
|
| 446 |
-func (h *Helper) updateConfig(configDir, hostDir, serverIP, metricsHost string) error {
|
|
| 446 |
+func (h *Helper) updateConfig(configDir, hostDir, routerIP, metricsHost string) error {
|
|
| 447 | 447 |
masterConfig := filepath.Join(configDir, "master", "master-config.yaml") |
| 448 | 448 |
glog.V(1).Infof("Reading master config from %s", masterConfig)
|
| 449 | 449 |
cfg, err := configapilatest.ReadMasterConfig(masterConfig) |
| ... | ... |
@@ -455,7 +456,7 @@ func (h *Helper) updateConfig(configDir, hostDir, serverIP, metricsHost string) |
| 455 | 455 |
if len(h.routingSuffix) > 0 {
|
| 456 | 456 |
cfg.RoutingConfig.Subdomain = h.routingSuffix |
| 457 | 457 |
} else {
|
| 458 |
- cfg.RoutingConfig.Subdomain = fmt.Sprintf("%s.xip.io", serverIP)
|
|
| 458 |
+ cfg.RoutingConfig.Subdomain = fmt.Sprintf("%s.xip.io", routerIP)
|
|
| 459 | 459 |
} |
| 460 | 460 |
|
| 461 | 461 |
if len(metricsHost) > 0 && cfg.AssetConfig != nil {
|
| ... | ... |
@@ -63,7 +63,7 @@ func (h *Helper) startSocatTunnel() error {
|
| 63 | 63 |
if err != nil {
|
| 64 | 64 |
glog.V(1).Infof("error: cannot kill socat: %v", err)
|
| 65 | 65 |
} |
| 66 |
- cmd := exec.Command("socat", "TCP-L:8443,reuseaddr,fork,backlog=20", "SYSTEM:\"docker exec -i origin socat - TCP\\:localhost\\:8443,nodelay\"")
|
|
| 66 |
+ cmd := exec.Command("socat", "TCP-L:8443,reuseaddr,fork,backlog=20,bind=127.0.0.1", "SYSTEM:\"docker exec -i origin socat - TCP\\:localhost\\:8443,nodelay\"")
|
|
| 67 | 67 |
cmd.SysProcAttr = &syscall.SysProcAttr{Setpgid: true}
|
| 68 | 68 |
err = cmd.Start() |
| 69 | 69 |
if err != nil {
|
| ... | ... |
@@ -172,6 +172,7 @@ type ClientStartConfig struct {
|
| 172 | 172 |
Tasks []task |
| 173 | 173 |
HostName string |
| 174 | 174 |
ServerIP string |
| 175 |
+ RouterIP string |
|
| 175 | 176 |
CACert string |
| 176 | 177 |
PublicHostname string |
| 177 | 178 |
RoutingSuffix string |
| ... | ... |
@@ -588,8 +589,14 @@ func (c *ClientStartConfig) DetermineServerIP(out io.Writer) error {
|
| 588 | 588 |
if err != nil {
|
| 589 | 589 |
return errors.NewError("cannot determine a server IP to use").WithCause(err)
|
| 590 | 590 |
} |
| 591 |
- c.ServerIP = ip |
|
| 592 |
- fmt.Fprintf(out, "Using %s as the server IP\n", ip) |
|
| 591 |
+ if c.PortForwarding {
|
|
| 592 |
+ c.ServerIP = "127.0.0.1" |
|
| 593 |
+ c.RouterIP = ip |
|
| 594 |
+ } else {
|
|
| 595 |
+ c.ServerIP = ip |
|
| 596 |
+ c.RouterIP = ip |
|
| 597 |
+ } |
|
| 598 |
+ fmt.Fprintf(out, "Using %s as the server IP\n", c.ServerIP) |
|
| 593 | 599 |
return nil |
| 594 | 600 |
} |
| 595 | 601 |
|
| ... | ... |
@@ -598,6 +605,7 @@ func (c *ClientStartConfig) StartOpenShift(out io.Writer) error {
|
| 598 | 598 |
var err error |
| 599 | 599 |
opt := &openshift.StartOptions{
|
| 600 | 600 |
ServerIP: c.ServerIP, |
| 601 |
+ RouterIP: c.RouterIP, |
|
| 601 | 602 |
UseSharedVolume: !c.UseNsenterMount, |
| 602 | 603 |
SetPropagationMode: c.SetPropagationMode, |
| 603 | 604 |
Images: c.imageFormat(), |
| ... | ... |
@@ -644,7 +652,7 @@ func (c *ClientStartConfig) InstallRouter(out io.Writer) error {
|
| 644 | 644 |
if err != nil {
|
| 645 | 645 |
return err |
| 646 | 646 |
} |
| 647 |
- return c.OpenShiftHelper().InstallRouter(kubeClient, f, c.LocalConfigDir, c.imageFormat(), c.ServerIP, c.PortForwarding, out) |
|
| 647 |
+ return c.OpenShiftHelper().InstallRouter(kubeClient, f, c.LocalConfigDir, c.imageFormat(), c.RouterIP, c.PortForwarding, out) |
|
| 648 | 648 |
} |
| 649 | 649 |
|
| 650 | 650 |
// ImportImageStreams imports default image streams into the server |
| ... | ... |
@@ -814,27 +822,7 @@ func (c *ClientStartConfig) determineIP(out io.Writer) (string, error) {
|
| 814 | 814 |
if err != nil {
|
| 815 | 815 |
return "", errors.NewError("cannot determine local IP address").WithCause(err)
|
| 816 | 816 |
} |
| 817 |
- glog.V(2).Infof("Testing local IP %s", ip4.String())
|
|
| 818 |
- err = c.OpenShiftHelper().TestForwardedIP(ip4.String()) |
|
| 819 |
- if err == nil {
|
|
| 820 |
- return ip4.String(), nil |
|
| 821 |
- } |
|
| 822 |
- glog.V(2).Infof("Failed to use %s: %v", ip4.String(), err)
|
|
| 823 |
- otherIPs, err := cmdutil.AllLocalIP4() |
|
| 824 |
- if err != nil {
|
|
| 825 |
- return "", errors.NewError("cannot find local IP addresses to test").WithCause(err)
|
|
| 826 |
- } |
|
| 827 |
- for _, ip := range otherIPs {
|
|
| 828 |
- if ip.String() == ip4.String() {
|
|
| 829 |
- continue |
|
| 830 |
- } |
|
| 831 |
- err = c.OpenShiftHelper().TestForwardedIP(ip.String()) |
|
| 832 |
- if err == nil {
|
|
| 833 |
- return ip.String(), nil |
|
| 834 |
- } |
|
| 835 |
- glog.V(2).Infof("Failed to use %s: %v", ip.String(), err)
|
|
| 836 |
- } |
|
| 837 |
- return "", errors.NewError("could not determine local IP address to use").WithCause(err)
|
|
| 817 |
+ return ip4.String(), nil |
|
| 838 | 818 |
} |
| 839 | 819 |
|
| 840 | 820 |
// First, try to get the host from the DOCKER_HOST if communicating via tcp |