Categorygithub.com/sm-operator/sapcp-operator
modulepackage
0.1.11-alpha
Repository: https://github.com/sm-operator/sapcp-operator.git
Documentation: pkg.go.dev

# README

Coverage Status Build Status License Go Report Card

SAP Cloud Platform Service Operator

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

  1. Install cert-manager

  2. Obtain access credentials for the SAP CP Service Operator:

    1. 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

    2. Create a binding to the created service instance

      More information about creating service bindings is available here: Cockpit, CLI

    3. 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"
       }
      
  3. 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

  1. 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.
  1. Apply the custom resource file in your cluster to create the instance.

    kubectl apply -f path/to/my-service-instance.yaml
    
  2. 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

  1. 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
    
  2. Apply the custom resource file in your cluster to create the binding.

    kubectl apply -f path/to/my-binding.yaml
    
  3. Check that your binding status is Created.

    kubectl get servicebindings
    NAME         INSTANCE              STATUS    AGE
    my-binding   my-service-instance   Created   16s
    
    
  4. 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

PropertyTypeComments
serviceOfferingName*stringThe SAP CP service offering name
servicePlanName*stringThe plan to use for the service instance
servicePlanIDstringThe plan ID in case service offering and plan name are ambiguous
externalNamestringThe name for the service instance in SAP CP, defaults to the binding metadata.name if not specified
parameters[]objectProvisioning parameters for the instance, check the documentation of the specific service you are using for details

Status

PropertyTypeComments
instanceIDstringThe service instance ID in SAP CP Service Management
operationURLstringURL of ongoing operation for the service instance
operationTypestringThe operation type (CREATE/UPDATE/DELETE) for ongoing operation
conditions[]conditionAn 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

ParameterTypeComments
serviceInstanceName*stringThe Kubernetes name of the service instance to bind, should be in the namespace of the binding
externalNamestringThe name for the service binding in SAP CP Service Management, defaults to the binding metadata.name if not specified
secretNamestringThe name of the secret where credentials will be stored, defaults to the binding metadata.name if not specified
parameters[]objectParameters for the binding

Status

PropertyTypeComments
instanceIDstringThe ID of the bound instance in SAP CP Service Management
bindingIDstringThe service binding ID in SAP CP Service Management
operationURLstringURL of ongoing operation for the service binding
operationTypestringThe operation type (CREATE/UPDATE/DELETE) for ongoing operation
conditions[]conditionAn 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

# Packages

No description provided by the author
No description provided by the author