The Learn Layer5 sample application is to be available for use across all service meshes that Meshery supports and is to used as:
- a learning device (for service mesh workshops)
- for Service Mesh Interface conformance
The Learn Layer5 application includes three services: app-a
, app-b
, and app-c
. Though they are different services, they are defines using the same app (source code in ./service). Each service is listening on port 9091/tcp
.
The following are the routes defined by the service
app and their functionality.
This route makes the service make requests to another service. Metrics are collected for this route. sample usage given below:
# Command
curl --location --request POST 'http://service-a:9091/call' \
--header 'Content-Type: application/json' \
--data-raw '{
"url": "http://service-b:9091/call",
"body": "{\r\n\"url\": \"http:\/\/service-c:9091\/echo\",\r\n\"body\": \"\",\r\n\"method\": \"GET\"\r\n}",
"method": "POST",
"headers": {
"h1":"v1"
}
}'
# No Output
GET /echo HTTP/1.1
Host: service-c:9091
User-Agent: Go-http-client/1.1
Accept-Encoding: gzip
Servicename: Service-B
In the above example, we are making a post request from service-a
with the body:
{
"url": "http://service-b:9091/call",
"body": "{\r\n\"url\": \"http:\/\/service-c:9091\/echo\",\r\n\"body\": \"\",\r\n\"method\": \"GET\"\r\n}",
"method": "POST",
"headers": {
"h1":"v1"
}
}
This will make service-a
to make a POST
request to http://service-b:9091/call
with the headers specified above, and the body:
{
"url": "http://service-c:9091/echo",
"body":"",
"method": "GET"
}
This inturn will make service-b
to make a GET
request to http://service-c:9091/echo
.
Gets the metrics from service-a
# Command
curl --location --request GET 'http://service-b:9091/metrics'
# Output
{
"ReqReceived": [
"Service-A"
],
"RespSucceeded": [
{
"URL": "http://service-c:9091/echo",
"Method": "GET",
"Headers": null
}
],
"RespFailed": []
}
- In ReqReceived we see list of requests
service-b
received and from whom it received. Here we seeservice-A
. Actually each of the service sets a headerServiceName
which is read by the service to determine the sender. - As
service-b
made a request toservice-c
and the request succeeded, we can see the details in the list of successful responses (RespSucceeded).
Clears the counters in service
# Command
curl --location --request DELETE 'http://34.68.35.174:9091/metrics'
# No Output
Note: metrics are collected only for
/call
and/echo
.
The learn-layer5
application serves as a sample application to validate the conformance of any service mesh with the SMI specifications. To verfiy SMI conformance, run Meshery and invoke the suite of SMI tests specific to the service mesh you would like to validate.
Meshery allows you to sechedule tests and invoke them programmatically. Meshery will store these test results and allow you to retrieve them later.
To manually invoke SMI Conformance test for a deployed service mesh, you can apply tests from the smi-test
directory of this repository. Execute the following command to run the smi-conformace tests:
We use kuttl to check for SMI conformance. All the tests are writtten in smi-test directory of this repository.
Execute the following command in ./smi-conformance
to run the smi-conformace tests:-
go run main.go
If you’re using Learn Layer5 or if you like the project, please ★ star this repository to show your support! 🤩
Our projects are community-built and welcome collaboration. 👍 Be sure to see the Layer5 Community Welcome Guide for a tour of resources available to you and jump into our Slack! Contributors are expected to adhere to the CNCF Code of Conduct.
✔️ Join any or all of the weekly meetings on the community calendar.
✔️ Watch community meeting recordings.
✔️ Access the community drive.
Not sure where to start? Grab an open issue with the help-wanted label.
Community First
The Layer5 community represents the largest collection of service mesh projects and their maintainers in the world.
Open Source First
We build projects to provide learning environments, deployment and operational best practices, performance benchmarks, create documentation, share networking opportunities, and more. Our shared commitment to the open source spirit pushes Layer5 projects forward.
License
This repository and site are available as open source under the terms of the Apache 2.0 License.