Skip to content

Commit

Permalink
If --public-hostname is an IP, use it for server IP in cluster up
Browse files Browse the repository at this point in the history
Otherwise users have no way to force a public IP.
  • Loading branch information
smarterclayton committed Jun 1, 2016
1 parent 504ea97 commit 0b992a2
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
2 changes: 1 addition & 1 deletion docs/generated/oc_by_example_content.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -686,7 +686,7 @@ Start OpenShift on Docker with reasonable defaults
# Start OpenShift using a specific public host name
oc cluster up --public-hostname=my.address.example.com
# Start OpenShift and preserve data and config between restarts
oc cluster up --host-data-dir=/mydata --use-existing-config
Expand Down
8 changes: 7 additions & 1 deletion pkg/bootstrap/docker/up.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package docker
import (
"fmt"
"io"
"net"
"os"
"path/filepath"

Expand Down Expand Up @@ -68,7 +69,7 @@ A public hostname can also be specified for the server with the --public-hostnam
# Start OpenShift using a specific public host name
%[1]s --public-hostname=my.address.example.com
# Start OpenShift and preserve data and config between restarts
%[1]s --host-data-dir=/mydata --use-existing-config
Expand Down Expand Up @@ -633,6 +634,11 @@ func getDockerMachineClient(machine string, out io.Writer) (*docker.Client, erro
}

func (c *ClientStartConfig) determineIP(out io.Writer) (string, error) {
if ip := net.ParseIP(c.PublicHostname); ip != nil && !ip.IsUnspecified() {
fmt.Fprintf(out, "Using public hostname IP %s as the host IP\n", ip)
return ip.String(), nil
}

if len(c.DockerMachine) > 0 {
glog.V(2).Infof("Using docker machine %q to determine server IP", c.DockerMachine)
ip, err := dockermachine.IP(c.DockerMachine)
Expand Down

0 comments on commit 0b992a2

Please sign in to comment.