Skip to content

Commit c4c5fe4

Browse files
authored
Merge pull request #289 from Accenture/288-helm-v3
288 - Add helm v3 template and update deployment instructions
2 parents 710dccb + b89a14d commit c4c5fe4

File tree

29 files changed

+823
-437
lines changed

29 files changed

+823
-437
lines changed

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,3 +39,6 @@ erl_crash.dump
3939
/.elixir_ls/
4040
*~
4141
*.orig
42+
43+
# asdf
44+
.tool-versions

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,15 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1414
- Added basic distributed tracing support in [W3C Trace Context specification](https://www.w3.org/TR/trace-context/) with Jaeger and Openzipkin exporters. RIG opens a span at the API Gateway and emits trace context in Cloud Events following the [distributed tracing spec](https://github.com/cloudevents/spec/blob/v1.0/extensions/distributed-tracing.md). [#281](https://github.com/Accenture/reactive-interaction-gateway/issues/281)
1515
- Added possibility to set response code for `response_from` messages in reverse proxy (`kafka` and `http_async`). [#321](https://github.com/Accenture/reactive-interaction-gateway/pull/321)
1616
- Added new version - `v3` - for internal endpoints to support response code in the `/responses` endpoint
17+
- Added Helm v3 template to the `deployment` folder [#288](https://github.com/Accenture/reactive-interaction-gateway/issues/288)
1718

1819
### Changed
1920

2021
- Incorporated [cloudevents-ex](https://github.com/kevinbader/cloudevents-ex) to handle binary and structured modes for [Kafka protocol binding](https://github.com/cloudevents/spec/blob/v1.0/kafka-protocol-binding.md) in a proper way. This introduces some **breaking changes**:
2122
- Binary mode is now using `ce_` prefix for CloudEvents context attribute headers, before it was `ce-` - done according to the [Kafka protocol binding](https://github.com/cloudevents/spec/blob/v1.0/kafka-protocol-binding.md)
2223
- Change above affects also `"response_from": "kafka"` proxy functionality. RIG will forward to clients only Kafka body, no headers. This means, when using binary mode, clients receive only the data part, no CloudEvents context attributes.
2324
- Changed `response_from` handler to expect a message in binary format, **NOT** a cloud event (`kafka` and `http_async`). [#321](https://github.com/Accenture/reactive-interaction-gateway/pull/321)
25+
- Updated Helm v2 template, kubectl yaml file and instructions in the `deployment` folder [#288](https://github.com/Accenture/reactive-interaction-gateway/issues/288)
2426

2527
### Fixed
2628

deployment/README.md

Lines changed: 80 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,95 @@
1-
# Distributed deployment
1+
# Running RIG on Kubernetes
22

3-
Reactive Interaction Gateway (RIG) uses [Peerage library](https://github.com/mrluc/peerage) to do discovery in distributed mode (production Distillery release).
3+
## Kubectl
44

5-
**Note:** If you don't care about distributed mode and don't want to do discovery, follow just `General configuration` section and ignore rest of the text.
5+
```bash
6+
kubectl apply -f kubectl/rig.yaml
7+
```
68

7-
## Configuration
9+
## Helm
10+
11+
The Helm Charts are stored in [./helm2](./helm2) and [./helm3](./helm3) directory, which are essentially the same but only use a different `apiVersion` in the `Chart.yaml`.
12+
13+
### Version 2
14+
15+
```bash
16+
cd helm2
17+
# dry run to verify that everything is ok
18+
helm install --name=rig reactive-interaction-gateway --dry-run
19+
# install
20+
helm install --name=rig reactive-interaction-gateway
21+
```
22+
23+
### Version 3
24+
25+
```bash
26+
cd helm3
27+
# dry run to verify that everything is ok
28+
helm install rig reactive-interaction-gateway --dry-run
29+
# install
30+
helm install rig reactive-interaction-gateway
31+
```
32+
33+
## Communication
34+
35+
Both `kubectl` and `helm` deploy bunch of Kubernetes resources:
36+
37+
- deployment - manages pod(s)
38+
- service - provides the main communication point for other applications
39+
- headless service - takes care of DNS discovery used internally
840

9-
### General configuration
41+
To allow external communication (outside of your cluster) do:
1042

11-
1. Node host - Every node in cluster needs to be discoverable by other nodes. For that Elixir/Erlang uses so called `long name` or `short name`. We are using `long name` which is formed in the following way `app_name@node_host`. `app_name` is in our case set to `rig`, but `node_host` is taken from environment variable `NODE_HOST`. This can be either IP or container alias or whatever that is routable in network by other nodes.
43+
```bash
44+
# both helm versions
45+
helm upgrade --set service.type=LoadBalancer rig reactive-interaction-gateway
46+
# for kubectl update kubectl/rig.yaml to use a service of type LoadBalancer instead of ClusterIP
47+
```
1248

13-
1. Node cookie - Nodes in Erlang cluster use cookies as a form of authorization/authentication between them. Only nodes with the same cookie can communicate together. It should be ideally some generated hash, set it to `NODE_COOKIE` environment variable.
49+
## Scaling
1450

15-
### DNS discovery
51+
Scale the deployment and create multiple pods
1652

17-
RIG currently supports distributed deployment via DNS discovery. To make it work, you need to set two environment variables:
53+
```bash
54+
helm upgrade --set service.type=LoadBalancer --set replicaCount=<replicas> rig reactive-interaction-gateway
55+
# or
56+
kubectl scale deployment/<deployment_name> --replicas <replicas>
57+
```
1858

19-
1. Discovery type - Currently RIG supports only DNS discovery. To use DNS, set `DISCOVERY_TYPE` to `dns`.
59+
You can also inspect the logs of the pods with `kubectl logs <pod_name>` to see how they automatically re-balance Kafka consumers (if you are using Kafka) and adapt Proxy APIs from other nodes.
2060

21-
1. DNS name (address) - Address where peerage will do discovery for Node host addresses. Value is taken from environment variable `DNS_NAME`.
61+
## Configuration
62+
63+
### Node host
64+
65+
Every node in cluster needs to be discoverable by other nodes. For that Elixir/Erlang uses so called `long name` or `short name`. We are using `long name` which is formed in the following way `app_name@node_host`. `app_name` is in our case set to `rig` and `node_host` is taken from environment variable `NODE_HOST`. This can be either IP or container alias or whatever that is routable in network by other nodes.
66+
67+
We are using the pod IP with:
68+
69+
```yaml
70+
- name: NODE_HOST
71+
valueFrom:
72+
fieldRef:
73+
fieldPath: status.podIP
74+
```
2275
23-
DNS discovery is executed every 5 seconds.
76+
### Node cookie
77+
78+
Nodes in Erlang cluster use cookies as a form of authorization/authentication between them. Only nodes with the same cookie can communicate together. Ideally, it is some generated hash, that's why we recommend adapting `NODE_COOKIE` environment variable in the `values.yaml`.
2479

2580
### Additional configuration
2681

27-
When running in distributed mode, additional variables may be passed to the deployment in order to run the proper configuration.
28-
Changes to these variables are required in most production circumstances.
82+
You can configure bunch of environment variables, please check the [Operator's Guide](https://accenture.github.io/reactive-interaction-gateway/docs/rig-ops-guide.html).
83+
84+
## Cleanup
85+
86+
```bash
87+
# kubectl
88+
kubectl delete -f kubectl/rig.yaml
89+
90+
# Helm v3
91+
helm uninstall rig
2992
30-
For more information on configuration variables, please view the [Operator's Guide to the RIG](https://accenture.github.io/reactive-interaction-gateway/docs/rig-ops-guide.html)
93+
# Helm v2
94+
helm delete --purge rig
95+
```

deployment/helm/README.md

Lines changed: 0 additions & 67 deletions
This file was deleted.

deployment/helm/reactive-interaction-gateway/Chart.yaml

Lines changed: 0 additions & 5 deletions
This file was deleted.

deployment/helm/reactive-interaction-gateway/templates/deployment.yaml

Lines changed: 0 additions & 51 deletions
This file was deleted.

deployment/helm/reactive-interaction-gateway/templates/service.yaml

Lines changed: 0 additions & 31 deletions
This file was deleted.

deployment/helm/reactive-interaction-gateway/templates/service_headless.yaml

Lines changed: 0 additions & 32 deletions
This file was deleted.

0 commit comments

Comments
 (0)