POC Code to provide an Open Service Broker API which provisions Redis and MariaDB instances via crossplane.
See the production implementation: https://github.com/vshn/crossplane-service-broker
export KUBECONFIG=/path/to/kubeconfig
OSB_USERNAME=test OSB_PASSWORD=TEST OSB_SERVICE_ID=id make run
eden can be used to test the OSB integration.
$ export SB_BROKER_URL=http://localhost:8080
$ export SB_BROKER_USERNAME=test
$ export SB_BROKER_PASSWORD=TEST
$ eden catalog
Service Plan Free Description
======= ==== ==== ===========
redis-helm redis-large unspecified
~ redis-medium unspecified
~ redis-small unspecified
$ export SB_INSTANCE=my-test-redis
$ eden provision -s redis-helm -p redis-small
$ eden bind --instance my-test-redis
# output will contain a CLI to retrieve the credentials, execute that
$ eden credentials #...
# ensure to either export or replace the $INSTANCE_UUID/SERVICE_UUID/PLAN_UUID variable:
$ curl -X PATCH 'http://localhost:8080/v2/service_instances/'"$INSTANCE_UUID" -u test:TEST -v -d '{"service_id": "'$SERVICE_UUID'", "plan_id": "'$PLAN_UUID'"}' -H 'X-Broker-API-Version: 2.13'
This implementation contains a couple of custom APIs, not defined by the OSB spec.
# ensure to either export or replace the $INSTANCE_UUID variable:
$ curl 'http://localhost:8080/custom/service_instances/$INSTANCE_UUID/endpoint' -u test:TEST -v|jq
If the env var KUBECONFIG
is set, it will be used to connect to downstream clusters instead of the actual provider config.
This helps to debug locally since downstream clusters are usually not accessible from a workstation.