Skip to content

Commit 212ac32

Browse files
committed
Update the connectivity proxy sample
1 parent c704b43 commit 212ac32

1 file changed

Lines changed: 106 additions & 107 deletions

File tree

connectivity-proxy/README.md

Lines changed: 106 additions & 107 deletions
Original file line numberDiff line numberDiff line change
@@ -1,148 +1,147 @@
1-
## SAP Connectivity Proxy
1+
# Connectivity: Accessing a Workload in the Corporate Network From SAP BTP, Kyma Runtime
22

3-
The sample demostrates the use of the SAP Cloud Connector from within SAP BTP, Kyma runtime. This includes...
3+
## Context
44

5-
- The provisioning of the Connectivity Proxy within the Kyma runtime ([SAP Help Portal link](https://help.sap.com/docs/BTP/65de2977205c403bbc107264b8eccf4b/0c035010a9d64cc8a02d872829c7fa75.html?locale=en-US)).
6-
- A sample Nodejs application is ran locally and configured in the SAP Cloud Connector to be exposed to the connected SAP BTP account.
7-
- A Serverless function is deployed within the Kyma runtime, which is configured to call the sample Nodejs application via the Connectivity Proxy.
8-
- Using a curl pod to call the sample Nodejs application via the Connectivity Proxy.
5+
If you want to access a workload in the corporate network from SAP BTP, Kyma runtime, you can use SAP BTP, Connectivity. SAP BTP, Connectivity provides Cloud Connector service channels to connect your on-premises network to specific services on SAP BTP, Kyma runtime.
96

10-
### Enable the Connectivity Service Entitelment
7+
The sample demonstrates the use of Cloud Connector from within SAP BTP, Kyma runtime. This includes...
118

12-
In order to configure the Connectivity Proxy within the Kyma Runtime you must first make sure that the Connectivity Service Entitlement is present within your subaccount. This can be accomplished by
9+
- Provisioning SAP BTP, Connectivity in the Kyma runtime. See [Connectivity in the Kyma Environment](https://help.sap.com/docs/connectivity/sap-btp-connectivity-cf/on-premise-connectivity-in-kyma-environment?version=Cloud).
10+
- Starting the sample Node.js application locally.
11+
- Configuring Cloud Connector to be exposed to the connected SAP BTP account.
12+
- Deploying a Serverless Function, which is configured to call the sample Node.js application via the Connectivity Proxy, in the Kyma runtime.
13+
- Using a curl Pod to call the sample Node.js application via the Connectivity Proxy.
1314

14-
- Within your global account…
15-
- Choose **Entitlements -> Entity Assignments**
16-
- Search **for Connectivity Service**
17-
- Choose **connectivity_proxy** for the plan
18-
- Choose **Add 1 Service Plan**
19-
- Choose **Save**
15+
## Prerequisites
2016

21-
### Provision the Service in the Kyma Runtime
17+
- SAP BTP, Kyma runtime instance
18+
- [curl](https://curl.se/)
19+
- [Kubernetes tooling](../prerequisites/README.md#kubernetes)
20+
- The service plan **connectivity_proxy** of the **connectivity** service is assigned to your subaccount as an entitlement. For more information, see [Configure Entitlements and Quotas for Subaccounts](https://help.sap.com/docs/btp/sap-business-technology-platform/configure-entitlements-and-quotas-for-subaccounts?version=Cloud).
2221

23-
The next step involves creating a service instance of the Connectivity Proxy and a service binding. Once the creation of the sevice binding is detected by the Kyma Control Plane, the Connectivity Proxy will be provisioned in the runtime into the namespace **kyma-system**. From within the Kyma runtime it will be accessible using the URL **connectivity-proxy.kyma-system.svc.cluster.local:20003**
22+
> [!NOTE]
23+
> For subaccounts created after February 15, 2024, this entitlement is assigned automatically.
2424
25-
- Within your desired namespace enable Istio if it is not already enabled.
25+
- You have the Istio, SAP BTP Operator, Serverless, and Connectivity Proxy modules added. For more information, see [Adding and Deleting a Kyma Module](https://help.sap.com/docs/btp/sap-business-technology-platform/enable-and-disable-kyma-module?version=Cloud).
2626

27-
```shell
28-
kubectl label namespaces <your namespace> istio-injection=enabled
29-
```
27+
## Procedure
3028

31-
- Create the Connectivity Proxy Service Instance
29+
### Provisioning SAP BTP, Connectivity in the Kyma Runtime
3230

33-
```shell
34-
kubectl apply -f ./k8s/connectivity-proxy-instance.yaml -n <your namespace>
35-
```
31+
1. Enable Istio sidecar proxy injection in your namespace.
3632

37-
The Kyma Control Plane should now provision the Connectivity Proxy. This will generate the pod **connectivity-proxy-0** which can be found by running.
33+
```shell
34+
kubectl label namespaces <your namespace> istio-injection=enabled
35+
```
3836

39-
```shell
40-
kubectl get pods -n kyma-system
41-
```
37+
2. Create a service instance and a service binding of the Connectivity Proxy service. Once the service instance and the service binding are detected by the Kyma Control Plane, the Connectivity Proxy service is provisioned in the **kyma-system** namespace.
4238

43-
### Configuration of the Sample Application
39+
```shell
40+
kubectl apply -f ./k8s/connectivity-proxy-instance.yaml -n <your namespace>
41+
```
4442

45-
To validate the setup, start the sample application included in the repo and configure it within the SAP Cloud Connector.
43+
**Result**
44+
The Kyma Control Plane provisioned the Connectivity Proxy service and generated the **connectivity-proxy-0** Pod. You can access the service from within the Kyma runtime using the **connectivity-proxy.kyma-system.svc.cluster.local:20003** URL or check if the Pod exists by running:
4645

47-
#### Starting the localmock application
46+
```shell
47+
kubectl get pods -n kyma-system
48+
```
4849

49-
After cloning the repo run the following commands in the directory **localmock**
50+
## Starting the Sample Application
5051

51-
- Run the command
52-
```
53-
npm install
54-
```
55-
- Start the application
56-
```
57-
npm start
58-
```
52+
1. Start the sample Node.js application included in the repository. Clone the repository and run the following commands in the **localmock** directory:
5953

60-
#### SAP Cloud Connector Configuration
54+
```shell
55+
npm install
56+
```
6157

62-
Download and install the [SAP Cloud Connector](https://tools.hana.ondemand.com/#cloud) and establish a connection to the **localmock** app. Please refer to the [help documentation](https://help.sap.com/viewer/cca91383641e40ffbe03bdc78f00f681/Cloud/en-US/e6c7616abb5710148cfcf3e75d96d596.html) for the installation steps. Make sure to also add your user to the appropiate
58+
```shell
59+
npm start
60+
```
6361

64-
- Open the [Cloud Connector](https://localhost:8443/)
65-
- Choose the appropiate Subaccount or add an additional one by...
66-
- Choose **Add Subaccount**
67-
- Choose your Region
68-
- Provide your Subaccount ID
69-
- Provide your Subaccount User and Password
70-
- Choose Save
71-
- Verify that the subaccount is connected. Under the Actions column use the Connect this sub account option
72-
- Choose **Cloud To On-Premise**
73-
- Under the tab **ACCESS CONTROL** choose the **plus** button to add a system
74-
- Choose the Back-end Type **Non-SAP System**, choose Next
75-
- Choose the Protocol **HTTP**, choose Next
76-
- Enter the Internal Host **localhost**
77-
- Enter the Internal Port **3000**, choose Next
78-
- Enter the Virtual Host **localhost**
79-
- Enter the Virtual Port **3000**, choose Next
80-
- Choose the Principle Type **None**, choose Next
81-
- Choose Next
82-
- Choose Next
83-
- Choose the option to **Check Internal Host**, choose Finish
62+
2. Download and install [Cloud Connector](https://tools.hana.ondemand.com/#cloud) and establish a connection to the **localmock** app. See [Installation](https://help.sap.com/docs/connectivity/sap-btp-connectivity-cf/installation?version=Cloud).
8463

85-
At this point the **Check Result** column should display that the sample is **Reachable**. Next set the URL path policy of the sample.
64+
### Configuring Cloud Connector
8665

87-
- Under **Resources Of localmock:3000** choose the **plus** button to add a resource
88-
- Enter the URL Path **/**
89-
- Choose the Access Policy **Path And All Sub-Paths**
90-
- Choose **Save**
66+
1. Open [Cloud Connector](https://localhost:8443/).
67+
2. Choose the relevant subaccount or add a new one.
68+
3. Choose **Cloud To On-Premise**.
69+
4. Under the **ACCESS CONTROL** tab, choose the **+** button to add a system.
70+
5. Set the following configuration options:
9171

92-
#### Deploy the Kyma Function
72+
| Parameter | Value |
73+
|-----------|-------|
74+
| Backend Type | **Non-SAP System** |
75+
| Protocol | **HTTP** |
76+
| Internal Host | **localhost** |
77+
| Internal Port | **3000** |
78+
| Virtual Host | **localhost** |
79+
| Virtual Port | **3000** |
80+
| Principle Type | **None** |
81+
82+
6. Choose the option to **Check Internal Host** and choose **Finish**.
9383

94-
The provided sample function calls the on-premise sample application by proxing the call via the **connectivity-proxy**. Within the function code you will 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 defined in the SAP Cloud Connector.
84+
**Result**
85+
The **Check Result** column should display that the sample is **Reachable**.
9586

96-
- Deploy the sample function and apirule found in the directory **k8s**
87+
7. Set the URL path policy of the sample.
9788

98-
```shell
99-
kubectl apply -f function.yaml -n <your namespace>
100-
kubectl apply -f apirule.yaml -n <your namespace>
101-
```
89+
Under **Resources Of localmock:3000** choose the **+** button to add a resource.
90+
- Enter the URL Path **/**.
91+
- Choose the Access Policy **Path And All Sub-Paths**.
92+
- Choose **Save**.
10293

103-
Open the apirule in the choosen namespace by choosing the menu option **Discovery and Network -> API Rules** and choosing the **host** of the
104-
**cc-sample** API Rule. The expected response should be similar to
94+
### Deploying the Kyma Function
10595

106-
```json
107-
{
108-
"OrderNo": "19",
109-
"createdBy": "Internal Inc.",
110-
"buyer": "The Buyer Co.",
111-
"currency": { "code": "EUR" },
112-
"Items": [
113-
{ "product_ID": "943735", "quantity": 6, "title": "familiar", "price": 12 }
114-
]
115-
}
116-
```
96+
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.
11797

118-
#### Using Curl to test the connection
98+
1. Deploy the sample Function and APIRule custom resources found in the **k8s** directory:
11999

120-
Using a curl pod to call the sample Nodejs application via the Connectivity Proxy can be accomplished by
100+
```shell
101+
kubectl apply -f function.yaml -n <your namespace>
102+
kubectl apply -f apirule.yaml -n <your namespace>
103+
```
121104

122-
- Create an interactive pod with curl installed
105+
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:
123106

124-
```shell
125-
kubectl run curl --image=radial/busyboxplus:curl -i --tty
126-
```
107+
```json
108+
{
109+
"OrderNo": "19",
110+
"createdBy": "Internal Inc.",
111+
"buyer": "The Buyer Co.",
112+
"currency": { "code": "EUR" },
113+
"Items": [
114+
{ "product_ID": "943735", "quantity": 6, "title": "familiar", "price": 12 }
115+
]
116+
}
117+
```
127118

128-
- Call the on premise connection by running
119+
### Using curl to Test the Connection
129120

130-
```
131-
curl --proxy http://connectivity-proxy.kyma-system.svc.cluster.local:20003 http://localhost:3000/orders?OrderNo=123
132-
```
121+
1. Create an interactive Pod with curl installed.
133122

134-
- To escape the pod
123+
```shell
124+
kubectl run curl --image=radial/busyboxplus:curl -i --tty
125+
```
135126

136-
```
137-
exit
138-
```
127+
2. Call the on-premise connection.
139128

140-
- To remove the pod
129+
```shell
130+
curl --proxy http://connectivity-proxy.kyma-system.svc.cluster.local:20003 http://localhost:3000/orders?OrderNo=123
131+
```
141132

142-
```
143-
kubectl delete pod curl
144-
```
133+
3. Escape the Pod.
145134

146-
### Principal propagation
135+
```shell
136+
exit
137+
```
147138

148-
The topic of principal propagation is covered in [this blog](https://blogs.sap.com/2022/04/07/veridisquo.-reaching-sap-lob-destinations-with-connectivity-proxy-and-principal-propagation./) post and [this sample](../principal-prop-on-prem).
139+
4. If you want to remove the Pod, run:
140+
141+
```shell
142+
kubectl delete pod curl
143+
```
144+
145+
## Related Information
146+
147+
For more information on principal propagation, see the [VeridisQuo. Reaching SAP LOB destinations with connectivity proxy and principal propagation](https://blogs.sap.com/2022/04/07/veridisquo.-reaching-sap-lob-destinations-with-connectivity-proxy-and-principal-propagation./) blog post and [this sample](../principal-prop-on-prem).

0 commit comments

Comments
 (0)