openshift-evangelists / oc-cluster-wrapper

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

Failed to start using enterprise oc client 3.4.1.5 #65

Closed wpernath closed 7 years ago

wpernath commented 7 years ago

Latest update of oc-cluster-wrapper makes my local setup fail with enterprise oc client v3.4.1.x on my OSX:

$ oc-cluster up workshop --metrics --logging
# Using client for origin v3.4.1.5
[INFO] Running a new cluster
oc cluster up --version v3.4.1.5 --image openshift/origin --public-hostname 127.0.0.1 --routing-suffix apps.127.0.0.1.nip.io --metrics true --logging true --host-data-dir /Users/wanja/.oc/profiles/workshop/data --host-config-dir /Users/wanja/.oc/profiles/workshop/config --use-existing-config -e TZ=CET
-- Checking OpenShift client ... OK
-- Checking Docker client ... OK
-- Checking Docker version ... OK
-- Checking for existing OpenShift container ... OK
-- Checking for openshift/origin:v3.4.1.5 image ...
   Pulling image openshift/origin:v3.4.1.5
FAIL
   Error: error pulling Docker image openshift/origin:v3.4.1.5
   Caused By:
     Error: API error (404): {"message":"manifest for openshift/origin:v3.4.1.5 not found"}

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

It seems that the algorythm of determining the type and version of 'oc' fails. It detects origin although I am using enterprise.

jorgemoralespou commented 7 years ago

Are you using the origin client? "--image openshift/origin" If yes, you need to qualify the image as well.

wpernath commented 7 years ago

Nope, I am using the OCP (enterprise) v3.4.1.5 client. Until the latest git pull my local setup with enterprise client worked.

I don't really understand, why you're determining the version and type of the oc client:

Until now I have switched from OCP to origin client if I wanted to test latest alpha releases. If I am correct, those lines of code in oc-cluster are not needed:

Line 45ff:

# Determine the version and type of client
__VERSION=$(oc version --request-timeout=1 2> /dev/null | grep oc | awk -F'+' '{print $1}'| awk '{print $2}')
if [[ "${__VERSION}" =~ ^v1.[0-9]$  ]]; then
    __TYPE="ocp"
    __IMAGE="registry.access.redhat.com/openshift3/ose"
  else
    __TYPE="origin"
    __IMAGE="openshift/origin"
fi
echo "# Using client for $__TYPE $__VERSION"

Enterprise OC returns:

$ oc version
oc v3.4.1.5
kubernetes v1.4.0+776c994
features: Basic-Auth

So this IF statement returns true if the output of the above would start with "v1.":

if [[ "${__VERSION}" =~ ^v1.[0-9]$ ]]; then

But as OCP oc version returns v3.x.y.z it is not true.

But maybe I am wrong?

Another thing: There is NO "v3.4.1.5" tagged docker image in the enterprise registry. The "v" in front of the number is too much.

wpernath commented 7 years ago

And OCP version of oc cluster up would automatically use the right --image to download openshift. Since OCP 3.4 it has never been necessary to use --image for oc-cluster up any more.

wpernath commented 7 years ago

So if I just remove --image and --version from lines 421 / 422 (building command line) it just runs fine on my osx with enterprise OC version installed.

jorgemoralespou commented 7 years ago

Yes and yes. This seems a bug and it's done so if you create a cluster it will always start the same cluster, otherwise you might start a cluster with ocp client, switch to origin client and will stop working. This was meant to prevent that. So if you create a cluster will always work no matter what client you have.

jorgemoralespou commented 7 years ago

Fixed

jorgemoralespou commented 7 years ago

image