-
Notifications
You must be signed in to change notification settings - Fork 459
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[targetallocator] PrometheusOperator CRD MVC (#653)
* feat(target-allocator): allow custom config file path * feat(target-allocator): move CLI config options to config package * feat(target-allocator): allow running outside of cluster for debugging * introduce meta watcher * add event source * fix: log panics * fix: race condition * fixup! fix: log panics * feat: implement promCR retrieval * feat: functioning * refactor: some cleanup * feat(target-allocator): escape job names in query parameters * feat(target-allocator): make prometheusCR lookup optional and allow using kubernetes_sd outside of cluster * refactor(target-allocator): improve memory usage and comments * chore(target-allocator): update PromOperator and Kubernetes deps * refactor(target-allocator): use exclude instead of replace directive * ci: add Makefile targets for target allocator * tests: add kuttl tests for PrometheusCR feature of target allocator * docs(targetAllocator): add README.md * fixup CRD docs * fix(Makefile): add missing PHONY tags * implement change requests * go mod tidy and fix linting
- Loading branch information
Showing
23 changed files
with
2,119 additions
and
274 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,85 @@ | ||
# Target Allocator | ||
|
||
The TargetAllocator is an optional separately deployed component of an OpenTelemetry Collector setup, which is used to | ||
distribute targets of the PrometheusReceiver on all deployed Collector instances. | ||
|
||
# Design | ||
|
||
If the Allocator is activated, all Prometheus configurations will be transferred in a separate ConfigMap which get in | ||
turn mounted to the Allocator. | ||
This configuration will be resolved to target configurations and then split across all OpenTelemetryCollector instances. | ||
|
||
TargetAllocators expose the results as [HTTP_SD endpoints](https://prometheus.io/docs/prometheus/latest/http_sd/) | ||
split by collector. | ||
|
||
#### Endpoints | ||
`/jobs`: | ||
|
||
```json | ||
{ | ||
"job1": { | ||
"_link": "/jobs/job1/targets" | ||
}, | ||
"job2": { | ||
"_link": "/jobs/job1/targets" | ||
} | ||
} | ||
|
||
``` | ||
|
||
`/jobs/{jobID}/targets`: | ||
|
||
```json | ||
{ | ||
"collector-1": { | ||
"_link": "/jobs/job1/targets?collector_id=collector-1", | ||
"targets": [ | ||
{ | ||
"Targets": [ | ||
"10.100.100.100", | ||
"10.100.100.101", | ||
"10.100.100.102" | ||
], | ||
"Labels": { | ||
"namespace": "a_namespace", | ||
"pod": "a_pod" | ||
} | ||
} | ||
] | ||
} | ||
} | ||
``` | ||
|
||
`/jobs/{jobID}/targets?collector_id={collectorID}`: | ||
|
||
```json | ||
[ | ||
{ | ||
"targets": [ | ||
"10.100.100.100", | ||
"10.100.100.101", | ||
"10.100.100.102" | ||
], | ||
"labels": { | ||
"namespace": "a_namespace", | ||
"pod": "a_pod" | ||
} | ||
} | ||
] | ||
``` | ||
|
||
|
||
## Packages | ||
### Watchers | ||
Watchers are responsible for the translation of external sources into Prometheus readable scrape configurations and | ||
triggers updates to the DiscoveryManager | ||
|
||
### DiscoveryManager | ||
Watches the Prometheus service discovery for new targets and sets targets to the Allocator | ||
|
||
### Allocator | ||
Shards the received targets based on the discovered Collector instances | ||
|
||
### Collector | ||
Client to watch for deployed Collector instances which will then provided to the Allocator. | ||
|
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Oops, something went wrong.