Creating OSBA Namespaced Service Instances
A TypeScript function to provision namespaced Service Instances with Service Catalog and the Open Service Broker for Azure.
This particular example provisions a Blob Storage named foobar
in the
Kubernetes namespace named default
(ServiceBroker must already exist in this
namespace) and in the Azure resource group named testing
(Azure will create if
not present) in westus2
data-center.
const provision = (
name: string,
namespace: string,
location: string,
resourceGroup: string
) =>
fetch(
`http://localhost:8001/apis/servicecatalog.k8s.io/v1beta1/namespaces/${namespace}/serviceinstances`,
{
method: "POST",
headers: {
"Content-Type": "application/json"
},
body: JSON.stringify({
apiVersion: "servicecatalog.k8s.io/v1beta1",
kind: "ServiceInstance",
metadata: {
name
},
spec: {
serviceClassExternalName: "azure-storage",
servicePlanExternalName: "blob-container",
parameters: {
location,
resourceGroup
}
}
})
}
);
provision("foobar", "default", "westus2", "testing");