Skip to content

Commit ede29bf

Browse files
authored
Merge pull request #23961 from wuchenjun/master
Update to APIRule V2 and update packages dependencies.
2 parents 3f021b9 + 54dd215 commit ede29bf

31 files changed

+249
-175
lines changed
197 KB
Loading

tutorials/create-configure-approuter-multitenant-application/create-configure-approuter-multitenant-application.md

Lines changed: 27 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,12 @@ primary_tag: software-product>sap-btp\, kyma-runtime
1010
<!-- description --> Use the tenant-aware approuter application in SAP BTP, Kyma runtime.
1111

1212
## Prerequisites
13-
- You have finished the tutorials [Create a Basic Node.js Application with Express Generator](basic-nodejs-application-create) and [Deploy a Node.js Application in the Kyma Runtime](deploy-nodejs-application-kyma), or cloned the repository: [btp-kyma-runtime-multitenancy-tutorial](https://github.com/SAP-samples/btp-kyma-runtime-multitenancy-tutorial) to find the source for both missions.
13+
- You have finished the tutorials [Create a Basic Node.js Application with Express Generator](basic-nodejs-application-create) and [Deploy a Node.js Application in SAP BTP, Kyma runtime](deploy-nodejs-application-kyma), or cloned the repository: [btp-kyma-runtime-multitenancy-tutorial](https://github.com/SAP-samples/btp-kyma-runtime-multitenancy-tutorial) to find the source for both missions.
1414

1515
## You will learn
1616
- What is SAP Application Router
1717
- How to create and configure Application Router
18-
- How to configure Destination for Application Router in Kyma Runtime
18+
- How to configure Destination for Application Router in Kyma runtime
1919
- How to describe Kubernetes objects for Application Router
2020

2121

@@ -45,8 +45,8 @@ cd kyma-multitenant-approuter
4545
{
4646
"name": "kyma_multitenant_approuter",
4747
"dependencies": {
48-
"@sap/xsenv": "^3",
49-
"@sap/approuter": "^8"
48+
"@sap/xsenv": "^5",
49+
"@sap/approuter": "^20"
5050
},
5151
"scripts": {
5252
"start": "node node_modules/@sap/approuter/approuter.js"
@@ -77,6 +77,18 @@ In the folder `kyma-multitenant-approuter`, create a file `xs-app.json` with the
7777
}
7878
```
7979

80+
### Determine SAP BTP Subaccount Subdomain and Cluster Domain
81+
82+
Open your subaccount in SAP BTP cockpit. In the overview page, find the subaccount's subdomain.
83+
84+
Find your cluster domain in the APIServerURL field. It contains the URL in the following format:
85+
> Example: https://api.xxxxx.kyma.ondemand.com
86+
87+
Your `clusterdomain` is `xxxxx.kyma.ondemand.com`.
88+
89+
`subdomain` and `clusterdomain` will be quoted in subsequent deployment definition.
90+
91+
<!-- border -->![check_subdomain_clusterdomain](./check_subdomain_clusterdomain.png)
8092

8193

8294

@@ -85,7 +97,7 @@ In the folder `kyma-multitenant-approuter`, create a file `xs-app.json` with the
8597

8698
The destinations configuration can be provided by the `destinations` environment variable or by destination service.
8799

88-
In order to provide `destinations` environment variable to the approuter application, you should create a `ConfigMap` object for the approuter's reference.
100+
In order to provide the `destinations` environment variable to the approuter application, create a `ConfigMap` object that can be referenced later.
89101

90102
Create a new deployment YAML file named `k8s-deployment-approuter.yaml` for the approuter app with the following content:
91103

@@ -98,7 +110,7 @@ metadata:
98110
data:
99111
destinations: |
100112
[
101-
{"name":"dest_kyma_multitenant_node","url":"https://<subaccount-subdomain>-node.<cluster-domain>","forwardAuthToken" : true}
113+
{"name":"dest_kyma_multitenant_node","url":"https://<subaccount-subdomain>-node.<clusterdomain>","forwardAuthToken" : true}
102114
]
103115
```
104116
@@ -115,7 +127,7 @@ data:
115127
### Define Deployment
116128

117129

118-
Define the deployment object by adding the following code snippets in the file `k8s-deployment-approuter.yaml`:
130+
Create a YAML file for the approuter app called `k8s-deployment-approuter.yaml`:
119131

120132
```YAML
121133
---
@@ -140,6 +152,7 @@ spec:
140152
labels:
141153
app: kyma-multitenant-approuter-multitenancy
142154
release: multitenancy
155+
sidecar.istio.io/inject: "true" # Enable Istio sidecar injection on Deployment and all Pods
143156
spec:
144157
automountServiceAccountToken: false
145158
imagePullSecrets:
@@ -237,7 +250,7 @@ spec:
237250
app: kyma-multitenant-approuter-multitenancy
238251
release: multitenancy
239252
---
240-
apiVersion: gateway.kyma-project.io/v1alpha1
253+
apiVersion: gateway.kyma-project.io/v2
241254
kind: APIRule
242255
metadata:
243256
creationTimestamp: null
@@ -246,20 +259,14 @@ metadata:
246259
release: multitenancy
247260
name: kyma-multitenant-approuter-multitenancy
248261
spec:
249-
gateway: kyma-gateway.kyma-system.svc.cluster.local
262+
gateway: kyma-system/kyma-gateway
263+
hosts:
264+
- <subaccount-subdomain>-approuter.<clusterdomain> # Replace <subaccount-subdomain> with the subdomain of your subaccount, and <clusterdomain> with the domain of your Kyma cluster
250265
rules:
251-
- accessStrategies:
252-
- handler: allow
253-
methods:
254-
- GET
255-
- POST
256-
- PUT
257-
- PATCH
258-
- DELETE
259-
- HEAD
260-
path: /.*
266+
- path: /*
267+
methods: ["GET", "POST", "PUT", "PATCH", "DELETE", "HEAD"]
268+
noAuth: true
261269
service:
262-
host: <subaccount-subdomain>-approuter.<cluster-domain>
263270
name: kyma-multitenant-approuter-multitenancy
264271
port: 8080
265272
```
87.6 KB
Loading

tutorials/deploy-multitenant-app-kyma/deploy-multitenant-app-kyma.md

Lines changed: 47 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,10 @@ primary_tag: software-product>sap-btp\, kyma-runtime
77
---
88

99
# Deploy a Multitenant Application to a Provider subaccount, Kyma Runtime
10-
<!-- description --> Build a Node.js application into OCI image and push it into Docker registry. Based on that, deploy the application into the Kyma runtime.
10+
<!-- description --> Build a Node.js application into OCI image and push it into Docker registry. Based on that, deploy the application into SAP BTP, Kyma runtime.
1111

1212
## Prerequisites
13-
- You have a Kyma runtime environment on SAP Business Technology Platform (BTP) and the relevant command line tools. If not, please follow the tutorials [Enable SAP BTP, Kyma Runtime](cp-kyma-getting-started) and [Install the Kubernetes Command Line Tool](cp-kyma-download-cli).
13+
- You have a Kyma runtime environment on SAP Business Technology Platform (BTP) and the relevant command line tools. If not, please follow the tutorials [Enable SAP BTP, Kyma runtime](cp-kyma-getting-started) and [Install the Kubernetes Command Line Tool](cp-kyma-download-cli).
1414
- You have installed [Docker](https://docs.docker.com/get-started/#download-and-install-docker).
1515
- You have [Docker Hub](https://hub.docker.com/) account.
1616
- You have finished the tutorial [Register a Multitenant Application to the SAP SaaS Provisioning Service](register-multitenant-app-saas-provisioning-service).
@@ -27,33 +27,21 @@ primary_tag: software-product>sap-btp\, kyma-runtime
2727

2828
### Determine SAP BTP Subaccount Subdomain
2929

30+
Open your subaccount in SAP BTP cockpit. Make sure you've already enabled SAP BTP, Kyma runtime on your cluster.
3031

31-
Open your subaccount in the Cockpit. In the overview page, find the subdomain for your deployment.
3232

33-
For example:
3433

35-
<!-- border -->![image-20211214133316133](image-20211214133316133.png)
3634

37-
38-
### Determine Kyma Cluster Domain
39-
40-
41-
Find the full Kyma cluster domain in the downloaded `kubeconfig.yml` file. For example: `e6803e4.kyma.shoot.live.k8s-hana.ondemand.com`.
42-
43-
44-
45-
46-
47-
### Build Application to OCI Image
35+
### Build Application as OCI Image
4836

4937

5038
1. Install tool
5139
<p> </p>
52-
In order to run your code on the Kyma Runtime (or on any Kubernetes-based platform), you need to provide an OCI image (aka Docker image) for your application. While you are in principle free to choose your image building tool, we recommend using [Cloud Native Buildpacks (CNB)](https://buildpacks.io/).
40+
In order to run your code on Kyma runtime (or on any Kubernetes-based platform), you need to provide an OCI image (aka Docker image) for your application. While you are in principle free to choose your image building tool, we recommend using [Cloud Native Buildpacks (CNB)](https://buildpacks.io/).
5341
<p> </p>
5442
The command-line tool `pack` supports providing a buildpack and your local source code and creating an OCI image from it. We are working on a process to provide recommended and supported buildpacks. In the meantime, you can use the community-supported [Paketo Buildpacks](https://paketo.io/).
5543
<p> </p>
56-
If you followed the tutorials [Create a Basic Node.js Application with Express Generator](basic-nodejs-application-create) and [Deploy a Node.js Application in the Kyma Runtime](deploy-nodejs-application-kyma), you have installed the command-line tool `pack`, if not, please follow this official guide: [Install Pack](https://buildpacks.io/docs/tools/pack/).
44+
If you followed the tutorials [Create a Basic Node.js Application with Express Generator](basic-nodejs-application-create) and [Deploy a Node.js Application in SAP BTP, Kyma runtime](deploy-nodejs-application-kyma), you have installed the command-line tool `pack`. If not, please follow this official guide: [Install Pack](https://buildpacks.io/docs/tools/pack/).
5745

5846
For example (macOS):
5947
```Shell / Bash
@@ -64,17 +52,19 @@ brew install buildpacks/tap/pack
6452
<p> </p>
6553
When we speak about repository name, we mean the combination of account and repo name that is usual with Docker Hub: `<docker-hub-account>/<repo-name>`. An example would be `tiaxu/multitenant-kyma-backend`.
6654
<p> </p>
67-
As you can only create one private repository in a free Docker hub account, Docker images stored in Docker hub will have different tag names so that they can be stored in one repository. Thus, addressing an image will include the tag name:`<docker-hub-account>/<repo-name>:<tag-name>`. An example would be `tiaxu/multitenant-kyma-backend:v1`.
55+
As you can only create one private repository in a free Docker hub account, Docker images stored in Docker hub will have different tag names so that they can be stored in one repository. Thus, addressing an image will include the tag name:`<docker-hub-account>/<repo-name>:<tag-name>`. An example would be `tiaxu/multitenant-kyma-backend:v2`.
6856
<p> </p>
69-
In the directory `kyma-multitenant-approuter`, build the image for the approuter app from source, for example:
70-
```Shell / Bash
71-
pack build <docker-hub-account>/multitenant-approuter:v1 --builder paketobuildpacks/builder-jammy-full
72-
```
57+
In the directory `kyma-multitenant-approuter`, build the image for the approuter app from source, for example:
7358

74-
In the directory `kyma-multitenant-node`, build the image for the approuter app from source, for example:
75-
```Shell / Bash
76-
pack build <docker-hub-account>/multitenant-kyma-backend:v1 --builder paketobuildpacks/builder-jammy-full
77-
```
59+
```Shell / Bash
60+
pack build <docker-hub-account>/multitenant-approuter:v1 --builder paketobuildpacks/builder-jammy-full
61+
```
62+
<p> </p>
63+
In the directory `kyma-multitenant-node`, build the image for the multitenant backend app from source, for example:
64+
65+
```Shell / Bash
66+
pack build <docker-hub-account>/multitenant-kyma-backend:v2 --builder paketobuildpacks/builder-jammy-full
67+
```
7868

7969

8070

@@ -92,7 +82,7 @@ docker login -u <docker-id> -p <password>
9282

9383
```Shell / Bash
9484
docker push <docker-hub-account>/multitenant-approuter:v1
95-
docker push <docker-hub-account>/multitenant-kyma-backend:v1
85+
docker push <docker-hub-account>/multitenant-kyma-backend:v2
9686
```
9787

9888
> For more details, see the [Kubernetes documentation](https://kubernetes.io/docs/tasks/configure-pod-container/pull-image-private-registry/).
@@ -103,10 +93,25 @@ docker push <docker-hub-account>/multitenant-kyma-backend:v1
10393

10494
### Create Namespace
10595

96+
If you followed the tutorials [Create a Basic Node.js Application with Express Generator](basic-nodejs-application-create) and [Deploy a Node.js Application in the Kyma Runtime](deploy-nodejs-application-kyma), you have created a namespace in Kyma dashboard called `multitenancy-ns`. If not, create a new namespace `multitenancy-ns` through Kyma dashboard or `kubectl` CLI:
10697

107-
If you followed the tutorials [Create a Basic Node.js Application with Express Generator](basic-nodejs-application-create) and [Deploy a Node.js Application in the Kyma Runtime](deploy-nodejs-application-kyma), you have created a namespace in the Kyma environment called `multitenancy-ns`. If not, create a new namespace through the Kyma dashboard or `kubectl` CLI, for example, called `multitenancy-ns`:
10898

109-
<!-- border -->![image-20220214150615225](image-20220214150615225.png)
99+
**1.** Select the `Link to dashboard` to open Kyma dashboard.
100+
101+
<!-- border -->![image-20220112154735200](image-20220112154735200.png)
102+
103+
**2.** Create a new namespace through Kyma dashboard or `kubectl` CLI, for example, called `multitenancy-ns`:
104+
105+
<!-- border -->![create_namespace](create_namespace.png)
106+
107+
108+
**3.** Enable Istio Sidecar Proxy Injection
109+
Enabling Istio sidecar proxy injection for a namespace allows istiod to watch all Pod creation operations in this namespace and automatically inject newly created Pods with an Istio sidecar proxy.
110+
Switch the toggle to enable Istio sidecar proxy injection. Click `Create` to finish namespace creation.
111+
112+
<!-- border -->![enable_ns_sidecar](enable_ns_sidecar.png)
113+
114+
> For more details, refer to the [Enable Istio Sidecar Proxy Injection](https://kyma-project.io/#/istio/user/tutorials/01-40-enable-sidecar-injection?id=enable-sidecar-injection-for-a-namespace)
110115
111116

112117

@@ -117,7 +122,7 @@ If you followed the tutorials [Create a Basic Node.js Application with Express G
117122

118123
Since the OCI image is stored in your Docker hub, you need to provide the access information to your Kyma cluster that you can pull the images from those repositories.
119124

120-
If you followed the tutorials [Create a Basic Node.js Application with Express Generator](basic-nodejs-application-create) and [Deploy a Node.js Application in the Kyma Runtime](deploy-nodejs-application-kyma), you have configured the credential of your Docker Hub as a Secret. If not, create a new Secret with the following command, replace the placeholder values according to your account:
125+
If you followed the tutorials [Create a Basic Node.js Application with Express Generator](basic-nodejs-application-create) and [Deploy a Node.js Application in SAP BTP, Kyma runtime](deploy-nodejs-application-kyma), you have configured the credential of your Docker Hub as a Secret. If not, create a new Secret with the following command, replace the placeholder values according to your account:
121126

122127
```Shell / Bash
123128
kubectl -n multitenancy-ns create secret docker-registry registry-secret --docker-server=https://index.docker.io/v1/ --docker-username=<docker-id> --docker-password=<password> --docker-email=<email>
@@ -135,7 +140,7 @@ imagePullSecrets:
135140
136141
137142
138-
### Deploy Application into Kyma Runtime
143+
### Deploy Application into SAP BTP, Kyma runtime
139144
140145
141146
**1.** Deploy consumed services by executing this command:
@@ -157,6 +162,16 @@ kubectl -n multitenancy-ns apply -f k8s-deployment-backend.yaml
157162
```
158163

159164

165+
### Check Application Deployment state
166+
167+
168+
Launch Kyma dashboard from SAP BTP cockpit, then navigate to the `multitenancy-ns` namespace.
169+
170+
Go to `Workloads`, and then select `Deployments`. You will see deployments of **kyma-multitenant-approuter-multitenancy** and **kyma-multitenant-node-multitenancy** displayed, with their `Pods` statuses shown in green. At this point, your multitenant application has been deployed successfully.
171+
172+
<!-- border -->![deploy_multi_succeed](deploy_multi_succeed.png)
173+
174+
160175

161176

162177

94 KB
Loading
161 KB
Loading
Binary file not shown.
Binary file not shown.
205 KB
Loading
Binary file not shown.

0 commit comments

Comments
 (0)