Sign inSign up

dbenque/kchain

By dbenque

•Updated almost 9 years ago

chaining http call

Image
0

1.5K

dbenque/kchain repository overview

⁠KChain

Fake server to chain call. It support HTTP 1.1 and H2c. This help to simulate microservice calls, in a kubernetes environment.

⁠Artifacts for Kubernetes

KChain also generate the artifacts for kubernetes to deploy the chain of server.

If you plan to chain calls between services foo, bar and xyz, here is the line to generate the artifacts:

kchain artifact foo bar xyz

If you want your pods to be versioned (label) you can add the version

kchain artifact foo:v2 bar:v1 xyz

⁠Usage

Note that the produced service are not expose out of the cluster. If your injector is running out of the cluster, you may need to expose them (change type to LoadBalancer or NodePort). Within the cluster the injector can target any of the service and ask for a specific chain of calls:

curl http://bar:80/?chain=foo-xyz-foo-bar
⁠H2C

The :80 is to be used if your injector does http1.1, the calls in the chain depends on the parameters given to kchain at launch time. To active calls chain in h2c then pass the argument h2c=y to the initial request.

curl http://bar:80/?chain=foo-xyz-foo-bar&h2c=y

Inside the container the port 8080 is used for HTTP/1.1 and port 8081 is used for h2c (if the h2c option is activated).

⁠Return Code

Then env variable response affect the HTTP response of the last server of the chain:

  • For values 500,ko,KO,error,ERROR, the server will return 500.
  • For value RANDOM, the server will alternate between 500 and 200.
  • For any other value the server return 200.
⁠Payload size

To add some Paylod inside the query, the parameter size can be used, the value is in bytes:

curl http://bar:80/?chain=foo-xyz-foo-bar&size=1024
⁠Prometheus instrumentation

The server also listen on port 9102 and serve prometheus metrics about the call made: Summary: ms_rpc_durations_seconds call duration per service and response code Counter: ms_rpc_count number of call per service and response code

Tag summary

Content type

Image

Digest

Size

3.5 MB

Last updated

almost 9 years ago

docker pull dbenque/kchain