With the SAP Cloud Platform (SAP CP) Operator, you can provision and bind SAP CP services to your Kubernetes cluster in a Kubernetes-native way. The SAP CP Service Operator is based on the Kubernetes custom resource definition (CRD) API so that your applications can create, update, and delete SAP CP services from within the cluster by calling Kubnernetes APIs.
Table of content
Prerequisites
Back to top
Setup
-
Install cert-manager
-
Obtain access credentials for the SAP CP Service Operator:
-
Using SAP CP 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 sapcp-service-operator in the cluster using the obtained access credentials:
helm upgrade --install sapcp-operator https://github.com/sm-operator/sapcp-operator/releases/download/<release>/sapcp-operator-<release>.tgz \
--create-namespace \
--namespace=sapcp-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: sapcp-operator releases
Back to top
Using the SAP CP Service Operator
Step 1: Create a service instance
- To create an instance of a SAP CP 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 CP service that you want to create.
You can find the list of available services in the SAP CP 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 CP 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 CP, 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 CP 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 CP 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 CP Service Management |
bindingID |
string |
The service binding ID in SAP CP 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 CP Service Operator project maintainers will respond to the best of their abilities.
Contributions
We currently do not accept community contributions.
SAP CP kubectl Plugin (Experimental)
The SAP CP kubectl plugin extends kubectl with commands for getting the available services in your SAP CP account,
using the access credentials stored in the cluster.
Prerequisites
Limitations
- The SAP CP kubectl plugin is currently based on
bash
. If using Windows, you should use the SAP CP plugin commands from a linux shell (e.g. Cygwin).
Installation
Usage
kubectl sapcp marketplace -n <namespace>
kubectl sapcp plans -n <namespace>
kubectl sapcp services -n <namespace>
Use the namespace
parameter to specify the location of the secret containing the SAP CP access credentials, usually the namespace in which you installed the operator.
If not specified the default
namespace is used.
Back to top