openshift-evangelists / oc-cluster-wrapper

oc cluster up bash wrapper
Apache License 2.0
144 stars 72 forks source link

Can't start up a new cluster: --routing-suffix empty on macosx #46

Closed wpernath closed 7 years ago

wpernath commented 7 years ago

When I do a simple on OSX: wanjas-bigmac:OpenShift-3.3 wanja$ oc-cluster up test --metrics --logging

I get the following output:

[INFO] Running a new cluster oc cluster up --public-hostname 127.0.0.1 --routing-suffix --host-data-dir /Users/wanja/.oc/profiles/test/data --host-config-dir /Users/wanja/.oc/profiles/test/config --use-existing-config -e TZ=CET --metrics --logging -- Checking OpenShift client ... OK -- Checking Docker client ... OK -- Checking Docker version ... OK -- Checking for existing OpenShift container ... Deleted existing OpenShift container -- Checking for registry.access.redhat.com/openshift3/ose:v3.4.0.39 image ... OK -- Checking Docker daemon configuration ... OK -- Checking for available ports ... OK -- Checking type of volume mount ... Using Docker shared volumes for OpenShift volumes -- Creating host directories ... OK -- Finding server IP ... Using public hostname IP 127.0.0.1 as the host IP Using 127.0.0.1 as the server IP -- Starting OpenShift container ... Creating initial OpenShift configuration Starting OpenShift using container 'origin' FAIL Error: could not start OpenShift container "origin" Details: Last 10 lines of "origin" container log: W0126 09:01:29.654244 5558 start_master.go:278] Warning: auditConfig.auditFilePath: Required value: audit can now be logged to a separate file, master start will continue. error: Invalid MasterConfig /var/lib/origin/openshift.local.config/master/master-config.yaml routingConfig.subdomain: Invalid value: "--host-data-dir": must be a valid subdomain

[ERROR] There's been an error creating the cluster, the profile [test] will be removed

It seems that --routing-suffix is empty (although the output above states that --host-data-dir must be a valid subdomain).

Current workaround is to check if $OC_CLUSTER_ROUTING_SUFFIX is empty and fill it with 'apps.127.0.0.1.xip.ip' (which is documented to be the default):

I am not a bash scripter, so I just changed the line OC_CLUSTER_ROUTING_SUFFIX=${OC_CLUSTER_ROUTING_SUFFIX}

to OC_CLUSTER_ROUTING_SUFFIX=${OC_CLUSTER_ROUTING_SUFFIX:-apps.127.0.0.1.xip.ip}

Hope that helps.

wpernath commented 7 years ago

The above workaround fixed the oc-cluster up test issue. But unfortunately, at least on macosx, if I specify any non-empty --routing-prefix, DNS doesn't work. Which means, I am not able to access apps via Chrome browser.

So what I did now to come over this issue is to check if the OC_CLUSTER_ROUTING_SUFFIX is empty (which is by default on my osx) and if so ignore the --routing-suffix parameter.

I did this by changing the up() function to:

if [ "$OC_CLUSTER_ROUTING_SUFFIX" != "" ]; then
    echo "routing suffix not empty"
    echo "$OC_CLUSTER_ROUTING_SUFFIX"  > $OPENSHIFT_PROFILES_DIR/$_profile/suffix
fi

and

if [ "$OC_CLUSTER_ROUTING_SUFFIX" != "" ]; then
    CMDLINE+=" --routing-suffix $OC_CLUSTER_ROUTING_SUFFIX"
fi

Now I can create a new cluster and also have working routing from my osx host into the openshift environment.

wkulhanek commented 7 years ago

Interesting. Never had this issue until today. Fixed it by commenting out the line that sets the routing suffix (line #232). Also I have never needed routing-prefix when I was playing around with my own script.

wpernath commented 7 years ago

yep, those issues came all up yesterday morning ;-)

Thank you for fixing it!