sapcp-operator

command module
v0.1.7-alpha Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 12, 2021 License: Apache-2.0 Imports: 12 Imported by: 0

README

Coverage Status Build Status License Go Report Card

SAPCP Operator

With the SAPCP Operator, you can provision and bind SAPCP services to your Kubernetes cluster in a Kubernetes-native way. The SAPCP Operator is based on the Kubernetes custom resource definition (CRD) API so that your applications can create, update, and delete SAPCP services from within the cluster by calling Kubnernetes APIs.

Table of content

Prerequisites

Setup

  1. Install cert-manager:

    kubectl apply -f https://github.com/jetstack/cert-manager/releases/download/v1.1.0/cert-manager.yaml
    
  2. Deploy the sapcp-operator in the cluster:

    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=$url \
        --set manager.secret.tokenurl=$tokenurl
    

    The list of available releases is available here: sapcp-operator releases

    Back to top

Local setup

Prerequisites
Deploy locally

Edit manager secret section with SM credentials. (DO NOT SUBMIT)

kubectl apply -f https://github.com/jetstack/cert-manager/releases/download/v1.1.0/cert-manager.yaml
make docker-build
kind load docker-image controller:latest
make deploy
Run tests

make test

Back to top

SAPCP kubectl extension (experimental)

Prerequisites

Download https://github.com/sm-operator/sapcp-operator/releases/download/${release}/kubectl-sapcp move its executable file to anywhere on your PATH

Usage

namespace parameter indicates the namespace where to find SM secret, defaulting to default namespace

  kubectl sapcp marketplace -n <namespace>
  kubectl sapcp plans -n <namespace>
  kubectl sapcp services -n <namespace>

Back to top

Using the SAPCP Operator

Step 1: Creating a service instance
  1. To create an instance of SAPCP, first create a ServiceInstance custom resource file.
  • <serviceOfferingName> is the SAPCP service that you want to create. To list SAPCP marketplace, run kubectl sapcp marketplace.
  • <servicePlanName> is the plan for the SAPCP service that you want to create.
    apiVersion: services.cloud.sap.com/v1alpha1
    kind: ServiceInstance
    metadata:
        name: myservice
    spec:
        servicePlanName: <PLAN>
        serviceOfferingName: <SERVICE_CLASS>
  1. Create the service instance in your cluster.

    kubectl apply -f filepath/myservice.yaml
    
  2. Check that your service status is Created in your cluster.

    kubectl get serviceinstances
    NAME        STATUS   AGE
    myservice   Created  12s
    

Back to top

Step 2: Binding the service instance
  1. To bind your service to the cluster so that your apps can use the service, create a ServiceBinding custom resource, where the serviceInstanceName field is the name of the ServiceInstance custom resource that you previously created.

    apiVersion: services.cloud.sap.com/v1alpha1
    kind: ServiceBinding
    metadata:
        name: mybinding
    spec:
        serviceInstanceName: myservice
    
  2. Create the binding in your cluster.

    kubectl apply -f filepath/mybinding.yaml
    
  3. Check that your binding status is Created.

    kubectl get servicebindings
    NAME        INSTANCE    STATUS    AGE
    mybinding   myservice   Created   9s
    
    
  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
    mybinding   Opaque   5      102s
    

Back to top

Reference documentation

Service Instance Properties
Parameter Type Comments
serviceOfferingName* string SAPCP service offering name
servicePlanName* string The plan to use for the service instance, such as free or standard.
servicePlanID string The plan ID in case service offering and plan name are ambiguous
externalName string The name for the service instance in SAPCP
parameters []object Provisioning parameters for the instance
Binding Properties
Parameter Type Comments
serviceInstanceName* string The k8s name of the service instance to bind, should be in the namespace of the binding
servicePlanID string The plan ID in case service offering and plan name are ambiguous
externalName string The name for the service binding in SAPCP
secretName string The name of the secret where credentials will be stored
parameters []object Parameters for the binding

Back to top

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis
api
v1alpha1
Package v1alpha1 contains API Schema definitions for the services v1alpha1 API group +kubebuilder:object:generate=true +groupName=services.cloud.sap.com
Package v1alpha1 contains API Schema definitions for the services v1alpha1 API group +kubebuilder:object:generate=true +groupName=services.cloud.sap.com
internal
auth/authfakes
Code generated by counterfeiter.
Code generated by counterfeiter.
smclient/smclientfakes
Code generated by counterfeiter.
Code generated by counterfeiter.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL