With the SAP BTP service operator, you can provision and consume SAP BTP services in your Kubernetes cluster in a Kubernetes-native way. The SAP BTP service operator is based on the Kubernetes operator pattern so that can consume SAP BTP services from within the cluster using Kubernetes native tools.
Table of content
Prerequisites
Back to top
Setup
-
Install cert-manager
-
Obtain access credentials for the SAP BTP Service Operator:
-
Using SAP BTP Cockpit or CLI, create an instance of the Service Management (service-manager
) service, plan service-operator-access
More information about creating service instances is available here:
Cockpit,
CLI
-
Create a binding to the created service instance
More information about creating service bindings is available here:
Cockpit,
CLI
-
Retrieve the generated access credentials from the created binding.
The generated access credentials will available in the created binding, for example:
{
"clientid": "xxxxxxx",
"clientsecret": "xxxxxxx",
"url": "https://mysubaccount.authentication.eu10.hana.ondemand.com",
"xsappname": "b15166|service-manager!b1234",
"sm_url": "https://service-manager.cfapps.eu10.hana.ondemand.com"
}
-
Deploy the sapbtp-service-operator in the cluster using the obtained access credentials:
helm upgrade --install sapbtp-operator https://github.com/SAP/sap-btp-service-operator/releases/download/<release>/sapbtp-operator-<release>.tgz \
--create-namespace \
--namespace=sapbtp-operator \
--set manager.secret.clientid=<clientid> \
--set manager.secret.clientsecret=<clientsecret> \
--set manager.secret.url=<sm_url> \
--set manager.secret.tokenurl=<url>
The list of available releases is available here: sapbtp-operator releases
Back to top
Using the SAP BTP Service Operator
Step 1: Create a service instance
- To create an instance of a SAP BTP service, first create a
ServiceInstance
custom resource file:
apiVersion: services.cloud.sap.com/v1alpha1
kind: ServiceInstance
metadata:
name: my-service-instance
spec:
serviceOfferingName: <offering>
servicePlanName: <plan>
<offering>
is the name of the SAP BTP service that you want to create.
You can find the list of available services in the SAP BTP Cockpit, see Service Marketplace.
<plan>
is the plan of the selected service offering that you want to create.
-
Apply the custom resource file in your cluster to create the instance.
kubectl apply -f path/to/my-service-instance.yaml
-
Check that your service status is Created in your cluster.
//TODO update example output with all fields
kubectl get serviceinstances
NAME STATUS AGE
my-service-instance Created 19s
Back to top
Step 2: Create a Service Binding
-
To get access credentials to your service instance and make them available in the cluster so that your applications can use it, create a ServiceBinding
custom resource, and set the serviceInstanceName
field to the name of the ServiceInstance
resource you created.
apiVersion: services.cloud.sap.com/v1alpha1
kind: ServiceBinding
metadata:
name: my-binding
spec:
serviceInstanceName: my-service-instance
-
Apply the custom resource file in your cluster to create the binding.
kubectl apply -f path/to/my-binding.yaml
-
Check that your binding status is Created.
kubectl get servicebindings
NAME INSTANCE STATUS AGE
my-binding my-service-instance Created 16s
-
Check that a secret of the same name as your binding is created. The secret contains the service credentials that apps in your cluster can use to access the service.
kubectl get secrets
NAME TYPE DATA AGE
my-binding Opaque 5 32s
See Using Secrets for the different options to use the credentials from your application running in the Kubernetes cluster,
Back to top
Reference documentation
Service Instance
Spec
Property |
Type |
Comments |
serviceOfferingName* |
string |
The SAP BTP service offering name |
servicePlanName* |
string |
The plan to use for the service instance |
servicePlanID |
string |
The plan ID in case service offering and plan name are ambiguous |
externalName |
string |
The name for the service instance in SAP BTP, defaults to the binding metadata.name if not specified |
parameters |
[]object |
Provisioning parameters for the instance, check the documentation of the specific service you are using for details |
Status
Property |
Type |
Comments |
instanceID |
string |
The service instance ID in SAP BTP Service Management |
operationURL |
string |
URL of ongoing operation for the service instance |
operationType |
string |
The operation type (CREATE/UPDATE/DELETE) for ongoing operation |
conditions |
[]condition |
An array of conditions describing the status of the service instance. The possible conditions types are: - Ready : set to true if the instance is ready and usable - Failed : set to true when an operation on the service instance fails, in this case the error details will be available in the condition message |
Service Binding
Spec
Parameter |
Type |
Comments |
serviceInstanceName* |
string |
The Kubernetes name of the service instance to bind, should be in the namespace of the binding |
externalName |
string |
The name for the service binding in SAP BTP Service Management, defaults to the binding metadata.name if not specified |
secretName |
string |
The name of the secret where credentials will be stored, defaults to the binding metadata.name if not specified |
parameters |
[]object |
Parameters for the binding |
Status
Property |
Type |
Comments |
instanceID |
string |
The ID of the bound instance in SAP BTP Service Management |
bindingID |
string |
The service binding ID in SAP BTP Service Management |
operationURL |
string |
URL of ongoing operation for the service binding |
operationType |
string |
The operation type (CREATE/UPDATE/DELETE) for ongoing operation |
conditions |
[]condition |
An array of conditions describing the status of the service instance. The possible conditions types are: - Ready : set to true if the binding is ready and usable - Failed : set to true when an operation on the service binding fails, in this case the error details will be available in the condition message |
Back to top
Support
Feel free to open new issues for feature requests, bugs or general feedback on the GitHub issues page of this project.
The SAP BTP Service Operator project maintainers will respond to the best of their abilities.
Contributions
We currently do not accept community contributions.
SAP BTP kubectl Plugin (Experimental)
The SAP BTP kubectl plugin extends kubectl with commands for getting the available services in your SAP BTP account,
using the access credentials stored in the cluster.
Prerequisites
Limitations
- The SAP BTP kubectl plugin is currently based on
bash
. If using Windows, you should use the SAP BTP plugin commands from a linux shell (e.g. Cygwin).
Installation
Usage
kubectl sapbtp marketplace -n <namespace>
kubectl sapbtp plans -n <namespace>
kubectl sapbtp services -n <namespace>
Use the namespace
parameter to specify the location of the secret containing the SAP BTP access credentials, usually the namespace in which you installed the operator.
If not specified the default
namespace is used.
Back to top
Licence
This project is licensed under Apache 2.0 except as noted otherwise in the license file.