Skip to content

Latest commit

 

History

History
142 lines (98 loc) · 5.55 KB

File metadata and controls

142 lines (98 loc) · 5.55 KB

Connectivity: Accessing a Workload in the Corporate Network or On-Premise System from SAP BTP, Kyma Runtime

Context

If you want to access a workload in the corporate network or on-premise system from SAP BTP, Kyma runtime, you can use Connectivity Proxy from SAP BTP, Connectivity.

The sample demonstrates how to access workloads/APIs in the corporate network or on-premise system from SAP BTP, Kyma runtime and includes:

  • Adding the Connectivity Proxy module in your Kyma runtime. See Connectivity in the Kyma Environment.
  • Starting the sample Node.js application locally.
  • Configuring Cloud Connector to be exposed to the connected SAP BTP account.
  • Deploying a Serverless Function, which is configured to call the sample Node.js application via the Connectivity Proxy, in the Kyma runtime.
  • Using a curl Pod to call the sample Node.js application via the Connectivity Proxy.

Cloud to On-Prem

Prerequisites

Procedure

Starting the Sample Application

  1. Export the environment variable.

    export NS=<your namespace> # e.g. default
  2. Enable Istio sidecar proxy injection in your namespace.

    kubectl label namespaces ${NS} istio-injection=enabled
    
  3. Start the sample Node.js application included in the repository. Clone the repository and run the following commands in the localmock directory:

    npm install
    npm start
  4. Download and install Cloud Connector and establish a connection to the localmock app. See Installation.

Configuring Cloud Connector

  1. Open Cloud Connector.

  2. Choose the relevant subaccount or add a new one.

  3. Choose Cloud To On-Premise.

  4. Under the ACCESS CONTROL tab, choose the + button to add a system.

  5. Set the following configuration options:

    Parameter Value
    Backend Type Non-SAP System
    Protocol HTTP
    Internal Host localhost
    Internal Port 3000
    Virtual Host localhost
    Virtual Port 3000
    Principle Type None
  6. Choose the option to Check Internal Host and choose Finish.

    Result The Check Result column should display that the sample is Reachable.

  7. Set the URL path policy of the sample.

    Under Resources Of localmock:3000 choose the + button to add a resource.

    • Enter the URL Path /.
    • Choose the Access Policy Path And All Sub-Paths.
    • Choose Save.

Deploying the Kyma Function

The provided sample Function calls the on-premise sample application by proxying the call via the connectivity-proxy. Within the function.yaml code you can find this in the proxy object definition of the axios get call. The cc_url defines the URL to call as was defined in the virtual host/port specified in Cloud Connector.

  1. Deploy the sample Function and APIRule custom resources found in the k8s directory:

    kubectl -n ${NS} apply -f function.yaml
    kubectl -n ${NS} apply -f apirule.yaml
  2. Open the APIRule in your namespace. In Kyma dashboard, go to Discovery and Network -> API Rules and choose the host of the cc-sample APIRule. The expected response should be similar to this one:

    {
      "OrderNo": "19",
      "createdBy": "Internal Inc.",
      "buyer": "The Buyer Co.",
      "currency": { "code": "EUR" },
      "Items": [
        { "product_ID": "943735", "quantity": 6, "title": "familiar", "price": 12 }
      ]
    }

Using curl to Test the Connection

  1. Create an interactive Pod with curl installed.

    kubectl run curl --image=curlimages/curl -i --tty
  2. Call the on-premise connection.

    curl --proxy http://connectivity-proxy.kyma-system.svc.cluster.local:20003 http://localhost:3000/orders?OrderNo=123

    [!NOTE] You can access the Connectivity Proxy service using the connectivity-proxy.kyma-system.svc.cluster.local:20003 URL.

  3. Escape the Pod.

    exit
  4. If you want to remove the Pod, run:

    kubectl delete pod curl

Related Information

For more information on principal propagation, see the VeridisQuo. Reaching SAP LOB destinations with connectivity proxy and principal propagation blog post and this sample.