[WIP] DUP: use Erlang clustering and allow autoscaling#1037
Draft
Annopaolo wants to merge 2 commits intoastarte-platform:masterfrom
Draft
[WIP] DUP: use Erlang clustering and allow autoscaling#1037Annopaolo wants to merge 2 commits intoastarte-platform:masterfrom
Annopaolo wants to merge 2 commits intoastarte-platform:masterfrom
Conversation
a6d4c08 to
063668e
Compare
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #1037 +/- ##
==========================================
- Coverage 69.23% 69.22% -0.01%
==========================================
Files 275 276 +1
Lines 7193 7201 +8
==========================================
+ Hits 4980 4985 +5
- Misses 2213 2216 +3 ☔ View full report in Codecov by Sentry. |
b132c41 to
22d3fd0
Compare
22d3fd0 to
b4b23f2
Compare
Add the DATA_UPDATER_PLANT_CLUSTERING_STRATEGY env to allow choosing which Erlang cluster topology to use. At the moment, two options are available: - `none` (default): every instance is a single-node cluster - `kubernetes`: multi-nodes cluster using k8s API. The `kubernetes` strategy requires a service account with permissions to list endpoints. Instances in the `astarte` namespace having label `app=astarte-data_updater_plant` will form an Erlang cluster. Under the hood, we have libcluster's Cluster.Strategy.Kubernetes with `:ip` option. Moreover, to support distributed Erlang (over k8s), the DUP release name includes the `MY_POD_IP` env var when it is set. If `MY_POD_IP` is not set, DUP will run in local mode, without distribution, as if it was before. Signed-off-by: Arnaldo Cesco <arnaldo.cesco@secomind.com>
Introduce two configuration options for the formation of DUP clusters on k8s. They can be set via two env vars: - `DATA_UPDATER_PLANT_CLUSTERING_KUBERNETES_SELECTOR`, defaulting to `app=astarte-data-updater-plant` - `DATA_UPDATER_PLANT_CLUSTERING_KUBERNETES_NAMESPACE`, defaulting to `astarte` Signed-off-by: Arnaldo Cesco <arnaldo.cesco@secomind.com>
b4b23f2 to
1995c24
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Create an Erlang cluster of DUPs which are able to autoscale and share load.
Add the
DATA_UPDATER_PLANT_CLUSTERING_STRATEGYenv to allow choosing which Erlang cluster topology to use.At the moment, two options are available:
none(default): every instance is a single-node clusterkubernetes: multi-nodes cluster using k8s API. Thekubernetesstrategy requires a service account with permissions to list endpoints.The DUP release name now includes the k8s pod IP, which can be supplied via the
MY_POD_IPenv var.When
nonestrategy is usedNothing changes w.r.t previous releases. The service will still run as not clustered.
When
kubernetesstrategy is usedA cluster of DUPs will be created - under the hood, we have libcluster's
Cluster.Strategy.Kuberneteswith:ipoption. By default, it will comprise instances in theastartenamespace having labelapp=astarte-data_updater_plant.These two values can be customized by setting the related env vars:
DATA_UPDATER_PLANT_CLUSTERING_KUBERNETES_NAMESPACEDATA_UPDATER_PLANT_CLUSTERING_KUBERNETES_SELECTORImportant
In order to form clusters, kubernetes discovery is used. Therefore, the ServiceAccount of DUP pods should have permissions to
getandlistresources of typeendpointsin the""API group.What this PR does / why we need it:
Autoscale DUP, wohoo
Which issue(s) this PR fixes:
Fixes #
Special notes for your reviewer:
Does this PR introduce a user-facing change?
Additional documentation e.g. usage docs, diagrams, etc.: