Skip to content

Commit

Permalink
Merge pull request #278 from cben/minishift-and-vcr
Browse files Browse the repository at this point in the history
Openshift VCR-recording script, touch up minishift instructions.
  • Loading branch information
himdel authored Feb 5, 2018
2 parents f632e12 + fa09b06 commit 6684758
Showing 1 changed file with 39 additions and 22 deletions.
61 changes: 39 additions & 22 deletions providers/openshift.md
Original file line number Diff line number Diff line change
Expand Up @@ -83,49 +83,43 @@ will assume that is being used, and updates to some commands might be
necessary (most commands should be virtualization software agnostic and work
regardless of the hypervisor).

1. Download the manageiq.addon for minishift to a directory of your choosing:
1. Download and enable the manageiq addon for minishift:

```console
$ git clone https://gist.github.com/e2fac8be87ea0e9f429b6f5d75e02176.git path/to/minishift-addons/manageiq
$ mkdir -p ~/minishift/addons
$ git clone https://gist.github.com/e2fac8be87ea0e9f429b6f5d75e02176 ~/minishift/addons/manageiq
$ minishift addons install --force ~/minishift/addons/manageiq
$ minishift addons enable manageiq
```

You can inspect the addon here:

https://gist.github.com/NickLaMuro/e2fac8be87ea0e9f429b6f5d75e02176

It is recommended to keep a directory of your addons in one place.

2. Add and enable the manageiq addon to minishift:
2. Start minishift:

```console
$ minishift addons install --force path/to/minishift-addons/manageiq
$ minishift addons enable manageiq
$ minishift start --vm-driver virtualbox --openshift-version "v3.6.1"
```

3. Start minishift:
You might want to add `--metrics --memory 5G`. As of this writing that only supports hawkular and doesn't work on 3.7.0.

```console
$ minishift start --vm-driver virtualbox --openshift-version "v1.5.0-rc.0"
```
See https://hub.docker.com/r/openshift/origin/tags/ for possible versions.

4. Grab the minishift IP:
3. Grab the minishift IP:

```console
$ minishift ip
```

5. Grab the token to access openshift through `manageiq`:
4. Add `oc` and/or `docker` to your PATH, configured to the cluster (auto-detects correct shell):

```console
$ ~/.minishift/cache/oc/v1.5.0-rc.0/oc login -u system:admin
$ ~/.minishift/cache/oc/v1.5.0-rc.0/oc sa get-token -n management-infra management-admin
$ eval $(minishift oc-env)
$ eval $(minishift docker-env)
```

Or in a single command form:
5. Grab the token to access openshift through `manageiq`:

```console
$ (export PATH="~/.minishift/cache/oc/v1.5.0-rc.0/:$PATH"; oc login -u system:admin > /dev/null; oc sa get-token -n management-infra management-admin)
$ oc login -u system:admin
$ oc sa get-token -n management-infra management-admin
```

6. Configure a provider in ManageIQ, filling in your token and IP where
Expand All @@ -141,3 +135,26 @@ regardless of the hypervisor).
```

Or through the UI if you prefer.

### Automated script to record new VCR

https://github.com/ManageIQ/manageiq-providers-openshift/pull/75 added a script that creates things from template, records 1st vcr, deletes some things, records 2nd.

Currently if you want to copy VCR to manageiq-providers-kubernetes, the spec there assumes Hawkular metrics were running.

- Easiest to use script with minishift.
Have `minishift` in your PATH.
As described above, including manageiq addon. Don't need `--metrics`.

- Alternatively bring your own openshift.
Set `OPENSHIFT_MASTER_HOST` env var.
Perform `oc login` as a user having `cluster-admin` role.

Then run in manageiq-providers-openshift repo:
```
./spec/vcr_cassettes/manageiq/providers/openshift/container_manager/test_objects_record.sh
```

You may need to adjust specs if object counts and/or names changed (ideally, figure out why and how to make it more reproducible).

There are text files near the .yml files that help tracking what changed vs previous VCRs, commit them together.

0 comments on commit 6684758

Please sign in to comment.