Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

If --public-hostname is an IP, use it for server IP in cluster up #9103

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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