Skip to content
This repository has been archived by the owner on Jan 19, 2022. It is now read-only.

Get Started Developing

Xuebin He edited this page Jul 5, 2017 · 6 revisions

Bosh Cloud Provider Interface for RackHD

Prerequisites

You must have installed RackHD.

Installation steps

Enable MonorailAccess

You must first enable MonorailAccess. Browse to https://yourrackhd.ip/rest/v1/api.html and find the POST /__Internal__/MonorailAccess/{value} and input Enable into the text box and click "Try it out!"

If you then GET /__Internal__/MonorailAccess/ it should return "enable."

You should then be able to query the server for its catalog of nodes with curl "http://$RACKHD_API_URI:8080/api/common/nodes" | jq . (or whatever browser/JSON viewer you choose to use.)

Download Packages

Next, install BOSH init: https://bosh.io/docs/install-bosh-init.html

Download a BOSH OpenStack stemcell for Ubuntu Trusty: https://bosh.io/stemcells/bosh-openstack-kvm-ubuntu-trusty-go_agent-raw.

Download the RackHD CPI release at somewhere.

Create Public Key

$ ssh-keygen -f ssh-key

After prompting you for a passphrase, the command creates a public key, ssh-key.pub, and a matching private key, ssh-key, in your current directory. Later, if you want to log into provisioned machines on your network, you can specify the key explicitly with ssh -i /path/to/director-ssh-key ..., or you can configure a tool like ssh-agent to manage your keys for you.

Prepare Manifest for Deployment

Create a file like redis.yml below. Update the path to the CPI release file, IP addresses, and public key top match your configuration.

name: redis

releases:
- name: rackhd-cpi
  url: file:///path/to/release/rackhd-cpi.tgz
- name: redis
  url: https://bosh.io/d/github.com/cloudfoundry-community/redis-boshrelease

networks:
- name: default
  type: manual

  subnets:
  - range: 192.168.1.0/24
    gateway: 192.168.1.1
    static: [192.168.1.2]

resource_pools:
- name: default
  network: default
  cloud_properties:
    public_key: "YOUR PUBLIC KEY"
  stemcell:
    name: bosh-openstack-kvm-ubuntu-trusty-go_agent-raw
    version: latest
    url: https://bosh.io/d/stemcells/bosh-openstack-kvm-ubuntu-trusty-go_agent-raw

compilation:
  workers: 1
  network: default
  reuse_compilation_vms: true
  cloud_properties:
    public_key: "YOUR PUBLIC KEY"

update:
  canaries: 1
  max_in_flight: 1
  canary_watch_time: 1000 - 30000
  update_watch_time: 1000 - 30000

jobs:
- name: redis
  instances: 1
  resource_pool: default
  networks:
  - name: default
    static_ips: [192.168.1.2]
  templates:
  - {name: redis, release: redis}
  properties:
    redis:
      password: ${REDIS_PASSWORD}
      port: 6379

cloud_provider:
  template: {name: rackhd-cpi, release: rackhd-cpi}

  mbus: https://mbus:${MBUS_PASSWORD}@192.168.1.2:6868

  properties:
    rackhd-cpi:
      apiserver: "RACKHD_SERVER_URL"
      agent:
        mbus: "https://mbus:${MBUS_PASSWORD}@0.0.0.0:6868"
        blobstore:
          provider: local
          options: {blobstore_path: /var/vcap/micro_bosh/data/cache}
        

Deploy Redis

$ bosh-init deploy redis.yml

Redis should be running on one of the nodes now. You can verify this by installing redis-cli and connecting to the deployment

$ redis-cli -h 192.168.1.2
redis> set FOO BAR
OK
redis> get FOO
BAR

Running Tests

  1. Download and install Go
  2. Install direnv
  3. Clone this project
  4. cd bosh-rackhd-cpi-release
  5. Allow direnv to load this .envrc
  6. Install the ginkgo CLI go get github.com/onsi/ginkgo/ginkgo
  7. Install the matcher library go get github.com/onsi/gomega
  8. cd src/github.com/rackhd/rackhd-cpi/
  9. Set variable export RACKHD_API_URL=http://rackhd.server.ip:port
  10. Run tests with ginkgo -r

Running a specific test

You can run a specific suite by cding into that subdirectory (e.g. cd rackhd-api/) of the project and running ginkgo -r.

You can change a test's expectation to use FIt() to focus the test so it is the only case that runs inside that suite.