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

Latest commit

 

History

History
103 lines (78 loc) · 4.91 KB

README.md

File metadata and controls

103 lines (78 loc) · 4.91 KB

cephbroker

This is a service broker written in Go Language for Cloud Foundry. This service broker supports creating Distributed File Systems provided by a Ceph cluster.

Getting Started

Get Latest Executable: cephbroker

Assuming you have a valid Golang 1.6 or later installed for your system, you can quickly build and get the latest go_service_broker executable by running the following go command:

$ go get code.cloudfoundry.org/cephbroker

This will build and place the cephbroker executable built for your operating system in your $GOPATH/bin directory.

Working with a specific Ceph Cluster

Running against a cephfs cluster requires a keyring file to allow fuse-mounts to the remote cluster. If you are deploying the ceph broker as a bosh job, then the keyring file is generated by the job's install scripts, and you will need to provide your keyring in a stub file before manifest generation. If you plan to start the broker manually, you will need to create a keyring file to pass as an argument. Keyring file contents should look something like this:

   [osd.0]
           key = REDACTED
   [osd.1]
           key = REDACTED
   [osd.2]
           key = REDACTED
   [client.admin]
           key = REDACTED
           auid = 0
           caps mds = "allow"
           caps mon = "allow *"
           caps osd = "allow *"

Running Broker

The broker can be ran in one of two modes: locally or as a bosh job

Locally

Run the executable to start the service broker.

$ cephbroker -listenAddr=0.0.0.0:8999 -mds=10.0.0.100:6789 -keyringFile=/etc/path/blah.keyring [-serviceName=cephfs] [-serviceId=cephfs-service-guid] [-planName=free] [-planId=free-plan-guid] [-planDesc="free ceph filesystem"] [-baseMountPath=/tmp/share] [-baseRemoteMountPath=/]

Arguments

  • listenAddr: host:port to serve cephfs service broker API
  • mds: host:port for ceph mds server
  • keyringFile: keyring file for ceph authentication
  • configPath: config directory to store book-keeping info
  • serviceName: name of the service to register with cloud controller
  • serviceId: ID of the service to register with cloud controller
  • planName: name of the service plan to register with cloud controller
  • planId: ID of the service plan to register with cloud controller
  • planDesc: description of the service plan to register with cloud controller
  • baseMountPath: local directory to mount within on the service broker host
  • baseRemoteMountPath: directory to mount on ceph file system server

As a Bosh Job

To deploy the ceph filesystem and the cephfs broker using bosh, you will need to git clone the cephfs-bosh-release repository.

Follow the installation instructions for that bosh release, which also includes this broker.

Using Broker

Prerequisites: In order to use this service broker you must have a running cloudfoundry instance deployed with Diego and volume services enabled. You must also have a cephfs file system installed, and a cephdriver bosh job colocated on the diego cell. The easiest way to accomplish these prerequisites is to follow the installation instructions for cephfs-bosh-release

Assuming that the file system and driver are properly installed, you can create a service instance and bind it to your application just as you would with any other cloudfoundry service:

cf create-service-broker <your broker name> <username> <password> <url of your running service broker>
cf enable-service-access cephfs -o <your cf org name>
cf create-service <your broker name> <your service plan name> <your volume name>
cf bind-service <your application name> <your volume name> -c {"path": "<container path>"}
cf restage <your application name>

This will mount your volume to <container path> for your application to use.

Multitenancy

The ceph broker allows multiple service instances to be created for a single broker/filesystem pair. We do this by allocating a GUID for each service instance, and creating a subdirectory of the baseRemoteMountPoint to store content for each instance. The driver then uses that subdirectory as the remote mount point when it mounts the volume into the cell.

We persist state information for the services using the volume in a file on the configPath.

License

cephbroker is licensed under the Apache 2.0 OSS license.