Tutorial: Implement a Broker
This tutorial walks you through setting up a service broker that deploys services using CI/CD tools you already know. You'll learn about the Open Service Broker API, available libraries, and practical recommendations for implementation and testing.
Prerequisites
- Familiarity with cloud-native platforms and basic service provisioning concepts.
- Access to a CI/CD pipeline and a supported programming language (Java, Go, .NET, or Python).
- Understanding of your organization's requirements for service lifecycle management.
Step by Step Guide
1. Understand the Open Service Broker API
The Open Service Broker API enables software vendors and developers to provide backing services to workloads running on cloud-native platforms. It defines a set of RESTful endpoints for provisioning, binding, and managing service offerings.
- One broker can host multiple services.
- The API supports synchronous and asynchronous provisioning.
- Service brokers can add features like billing and backup/restore.
2. Choose an Implementation Approach
You can start with an existing project or library, or build your own broker from scratch.
Quickstarts
- Unipipe Service Broker:
Example implementation that connects to a Git repository for catalog and instance management. Integrates with CI/CD pipelines. - Spring Boot & Groovy OSB API:
For Java/Spring developers. - osb-service-broker-example:
Cloud Foundry-focused, requires custom logic for your service. - osb-starter-pack:
Go-based starter for rapid prototyping.
Libraries
- Java:
Spring Cloud Open Service Broker
spring-cloud-app-broker - Go:
brokerapi
osb-broker-lib
Cloud service broker - .NET:
Open Service Broker API for .NET - Python:
openbrokerapi
3. Implement the Required Endpoints
Each service broker must implement the OSBAPI endpoints:
- Catalog: Returns the list of services and plans.
- Provision: Creates a new service instance.
- Bind/Unbind: Connects/disconnects applications to service instances.
- Deprovision: Deletes a service instance.
Follow the OSBAPI specification closely for request/response formats and error handling.
4. Test Your Service Broker
- Use the API Swagger documentation to understand and test endpoints.
- Try the eden CLI for local development and testing.
- Consider the osb-checker tool for compliance checks.
5. Integrate with meshStack and CI/CD
- If using Unipipe, connect your broker to a Git repository and configure your CI/CD pipeline to manage service instances.
- For other implementations, ensure your broker is reachable by meshStack and supports the required endpoints.
6. Maintain and Evolve Your Broker
- Use consistent IDs for services and plans.
- Implement proper error handling and support both synchronous and asynchronous operations.
- Plan for deprecation and removal of services or plans.
- Support multiple bindings per instance and create separate credentials for each binding.
- Provide admin endpoints for handling error states and orphaned resources.
Check out the OSB API Compliant Service Brokers catalog for inspiration and reference implementations.