Skip to content

Commit b684fc3

Browse files
authored
Merge pull request #574 from nataliasitko/apirule-update
Update commerce mock APIRule
2 parents f44dea6 + 75d6770 commit b684fc3

File tree

4 files changed

+60
-33
lines changed

4 files changed

+60
-33
lines changed

commerce-mock-lite/README.md

Lines changed: 24 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
# Light Commerce Mock
22

3-
The light commerce mock emulates SAP Commerce Cloud on base of a reduced event and API catalog. It uses the **varkes-api-server** to connect to `SAP Business Technology Platform, Kyma Runtime` and register the bundled commerce APIs, which are also mocked using the **varkes-openapi-mock**. For the list of mocked APIs, see [`varkes_config.json`](varkes_config.json).
3+
The light commerce mock emulates SAP Commerce Cloud on base of a reduced event and API catalog. It uses the **varkes-api-server** to connect to SAP BTP, Kyma runtime and register the bundled commerce APIs, which are also mocked using the **varkes-openapi-mock**. For the list of mocked APIs, see [`varkes_config.json`](varkes_config.json).
44

5-
## Run locally using Docker
5+
## Run Commerce Mock Locally Using Docker
66

77
To run the mock locally, run:
88

@@ -14,7 +14,7 @@ docker run -d \
1414
ghcr.io/sap-samples/xf-application-mocks/commerce-mock-lite:latest
1515
```
1616

17-
### Access the mock locally
17+
### Access Commerce Mock Locally
1818

1919
* For the API to pair the mock, see `http://localhost:10000/console`
2020
* For mocked APIs, see:
@@ -24,40 +24,53 @@ docker run -d \
2424
* `http://localhost:10000/couponwebservices/console`
2525
* `http://localhost:10000/warehousingwebservices/console`
2626

27-
## Run mock using `SAP Business Technology Platform, Kyma Runtime`
27+
## Run Commerce Mock Using SAP BTP, Kyma Runtime
2828

2929
To run the mock using `SAP Business Technology Platform, Kyma Runtime` as a runtime environment, perform the following steps:
3030

31-
1. Set up the Namespace:
31+
1. Set up the namespace:
3232

3333
```bash
3434
kubectl create namespace mocks
35+
kubectl label namespace mocks istio-injection=enabled --overwrite
3536
```
3637

3738
2. Deploy the mock:
3839

3940
```bash
40-
kubectl apply -f https://raw.githubusercontent.com/SAP/xf-application-mocks/main/commerce-mock-lite/deployment/k8s.yaml -n mocks
41-
kubectl apply -f https://raw.githubusercontent.com/SAP/xf-application-mocks/main/commerce-mock-lite/deployment/kyma.yaml -n mocks
41+
kubectl apply -f https://raw.githubusercontent.com/SAP-samples/kyma-runtime-samples/main/commerce-mock-lite/deployment/k8s.yaml -n mocks
42+
kubectl apply -f https://raw.githubusercontent.com/SAP-samples/kyma-runtime-samples/main/commerce-mock-lite/deployment/kyma.yaml -n mocks
4243
```
4344

4445
These commands expose the API of the mock via an `APIRule` resource and makes it accessible at `https://commerce-lite.{yourDomain}`.
4546

46-
## Run mock on Kubernetes
47+
## Run Commerce Mock on Kubernetes
4748

48-
1. Set up the Namespace:
49+
1. Add the Istio and API Gateway modules:
50+
51+
```bash
52+
kubectl create ns kyma-system
53+
kubectl label namespace kyma-system istio-injection=enabled --overwrite
54+
kubectl apply -f https://github.com/kyma-project/istio/releases/latest/download/istio-manager.yaml
55+
kubectl apply -f https://github.com/kyma-project/istio/releases/latest/download/istio-default-cr.yaml
56+
kubectl apply -f https://github.com/kyma-project/api-gateway/releases/latest/download/api-gateway-manager.yaml
57+
kubectl apply -f https://github.com/kyma-project/api-gateway/releases/latest/download/apigateway-default-cr.yaml
58+
```
59+
60+
2. Set up the namespace:
4961

5062
```bash
5163
kubectl create namespace mocks
64+
kubectl label namespace mocks istio-injection=enabled --overwrite
5265
```
5366

5467
2. Deploy the mock:
5568

5669
```bash
57-
kubectl apply -f https://raw.githubusercontent.com/SAP/xf-application-mocks/main/commerce-mock-lite/deployment/k8s.yaml -n mocks
70+
kubectl apply -f https://raw.githubusercontent.com/SAP-samples/kyma-runtime-samples/main/commerce-mock-lite/deployment/k8s.yaml -n mocks
5871
```
5972

60-
This command deploys a `Service` of a ClusterIP type. You need to expose it manually using any Ingress type.
73+
This command deploys a Service of a `ClusterIP` type. You need to expose it manually using any Ingress type.
6174

6275
## Development
6376

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
1-
apiVersion: gateway.kyma-project.io/v1alpha1
1+
apiVersion: gateway.kyma-project.io/v2
22
kind: APIRule
33
metadata:
44
labels:
55
app: commerce-mock-lite
66
name: commerce-mock-lite
77
spec:
8-
gateway: kyma-gateway.kyma-system.svc.cluster.local
8+
hosts:
9+
- commerce-lite
910
service:
1011
name: commerce-mock-lite
1112
port: 10000
12-
host: commerce-lite
13+
gateway: kyma-system/kyma-gateway
1314
rules:
14-
- path: /.*
15+
- path: /*
1516
methods: ["GET","POST","PUT","DELETE","HEAD"]
16-
accessStrategies:
17-
- handler: allow
17+
noAuth: true

commerce-mock/README.md

Lines changed: 24 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
# Commerce Mock
22

3-
The commerce mock emulates SAP Commerce Cloud. It uses the **varkes-api-server** to connect to `SAP Business Technology Platform, Kyma Runtime` and register the bundled commerce APIs, which are also mocked using the **varkes-openapi-mock**. For the list of mocked APIs, see [`varkes_config.json`](varkes_config.json).
3+
The commerce mock emulates SAP Commerce Cloud. It uses the **varkes-api-server** to connect to SAP BTP, Kyma runtime and register the bundled commerce APIs, which are also mocked using the **varkes-openapi-mock**. For the list of mocked APIs, see [`varkes_config.json`](varkes_config.json).
44

5-
## Run locally using Docker
5+
## Run Commerce Mock Locally Using Docker
66

77
To run the mock locally, run:
88

@@ -14,7 +14,7 @@ docker run -d \
1414
ghcr.io/sap-samples/xf-application-mocks/commerce-mock:latest
1515
```
1616

17-
### Access the mock locally
17+
### Access Commerce Mock Locally
1818

1919
* For mock UI, see `http://localhost:10000`
2020
* For the API to pair the mock, see `http://localhost:10000/console`
@@ -25,40 +25,54 @@ docker run -d \
2525
* `http://localhost:10000/couponwebservices/console`
2626
* `http://localhost:10000/warehousingwebservices/console`
2727

28-
## Run mock using `SAP Business Technology Platform, Kyma Runtime`
28+
## Run Commerce Mock Using SAP BTP, Kyma Runtime
2929

3030
To run the mock using `SAP Business Technology Platform, Kyma Runtime` as a runtime environment, perform the following steps:
3131

3232
1. Set up the Namespace:
3333

3434
```bash
3535
kubectl create namespace mocks
36+
kubectl label namespace mocks istio-injection=enabled --overwrite
3637
```
3738

3839
2. Deploy the mock:
3940

4041
```bash
41-
kubectl apply -f https://raw.githubusercontent.com/SAP/xf-application-mocks/main/commerce-mock/deployment/k8s.yaml -n mocks
42-
kubectl apply -f https://raw.githubusercontent.com/SAP/xf-application-mocks/main/commerce-mock/deployment/kyma.yaml -n mocks
42+
kubectl apply -f https://raw.githubusercontent.com/SAP-samples/kyma-runtime-samples/main/commerce-mock/deployment/k8s.yaml -n mocks
43+
kubectl apply -f https://raw.githubusercontent.com/SAP-samples/kyma-runtime-samples/main/commerce-mock/deployment/kyma.yaml -n mocks
4344
```
4445

4546
These commands expose the UI and API of the mock via an `APIRule` resource and makes the UI accessible at `https://commerce.{yourDomain}`.
4647

47-
## Run mock on Kubernetes
48+
## Run Commerce Mock on Kubernetes
4849

49-
1. Set up the Namespace:
50+
51+
1. Add the Istio and API Gateway modules:
52+
53+
```bash
54+
kubectl create ns kyma-system
55+
kubectl label namespace kyma-system istio-injection=enabled --overwrite
56+
kubectl apply -f https://github.com/kyma-project/istio/releases/latest/download/istio-manager.yaml
57+
kubectl apply -f https://github.com/kyma-project/istio/releases/latest/download/istio-default-cr.yaml
58+
kubectl apply -f https://github.com/kyma-project/api-gateway/releases/latest/download/api-gateway-manager.yaml
59+
kubectl apply -f https://github.com/kyma-project/api-gateway/releases/latest/download/apigateway-default-cr.yaml
60+
```
61+
62+
2. Set up the namespace:
5063

5164
```bash
5265
kubectl create namespace mocks
66+
kubectl label namespace mocks istio-injection=enabled --overwrite
5367
```
5468

5569
2. Deploy the mock:
5670

5771
```bash
58-
kubectl apply -f https://raw.githubusercontent.com/SAP/xf-application-mocks/main/commerce-mock/deployment/k8s.yaml -n mocks
72+
kubectl apply -f https://raw.githubusercontent.com/SAP-samples/kyma-runtime-samples/main/commerce-mock/deployment/k8s.yaml -n mocks
5973
```
6074

61-
This command deploys a `Service` of a ClusterIP type. You need to expose it manually using any Ingress type.
75+
This command deploys a Service of a `ClusterIP` type. You need to expose it manually using any Ingress type.
6276

6377
## Development
6478

commerce-mock/deployment/kyma.yaml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
1-
apiVersion: gateway.kyma-project.io/v1alpha1
1+
apiVersion: gateway.kyma-project.io/v2
22
kind: APIRule
33
metadata:
44
labels:
55
app: commerce-mock
66
name: commerce-mock
77
spec:
8-
gateway: kyma-gateway.kyma-system.svc.cluster.local
8+
hosts:
9+
- commerce
910
service:
1011
name: commerce-mock
1112
port: 10000
12-
host: commerce
13+
gateway: kyma-system/kyma-gateway
1314
rules:
14-
- path: /.*
15+
- path: /*
1516
methods: ["GET","POST","PUT","DELETE","HEAD"]
16-
accessStrategies:
17-
- handler: allow
17+
noAuth: true

0 commit comments

Comments
 (0)