forked from opensearch-project/opensearch-migrations
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Mikayla Thompson <thomika@amazon.com>
- Loading branch information
1 parent
05ca0f1
commit 4c9257a
Showing
8 changed files
with
110 additions
and
22 deletions.
There are no files selected for viewing
80 changes: 80 additions & 0 deletions
80
...ture/dockerSolution/src/main/docker/migrationConsole/lib/console_link/README.md
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,80 @@ | ||
# Console_link Library | ||
|
||
The console link library is designed to provide a unified interface for the many possible backend services involved in a migration. The interface can be used by multiple frontends--a CLI app and a web API, for instance. | ||
|
||
![alt text](diagram.png) | ||
|
||
|
||
The user defines their migration services in a `migration_services.yaml` file, by default found at `/etc/migration_services.yaml`. | ||
|
||
Currently the supported services are a source and target cluster and a metrics source. For example: | ||
|
||
```yaml | ||
source_cluster: | ||
endpoint: "https://capture-proxy-es:9200" | ||
allow_insecure: true | ||
target_cluster: | ||
endpoint: "https://opensearchtarget:9200" | ||
allow_insecure: true | ||
authorization: | ||
type: "basic" | ||
details: | ||
username: "admin" | ||
password: "myStrongPassword123!" | ||
metrics_source: | ||
type: "prometheus" | ||
endpoint: "http://prometheus:9090" | ||
``` | ||
|
||
### Services.yaml spec | ||
|
||
#### Cluster | ||
|
||
Source and target clusters have the following options: | ||
- `endpoint`: required, the endpoint to reach the cluster. | ||
- `authorization`: optional, if it is provided, type is required. | ||
- `type`: required, the only currently implemented option is "basic", but "sigv4" should be available soon | ||
- `details`: for basic auth, the details should be a `username` and `password` | ||
|
||
Having a `source_cluster` and `target_cluster` is required. | ||
|
||
#### Metrics Source | ||
|
||
Currently, the two supported metrics source types are `prometheus` and `cloudwatch`. | ||
|
||
- `type`: required, `prometheus` or `cloudwatch` | ||
- `endpoint`: required for `prometheus` (ignored for `cloudwatch`) | ||
- `region`: optional for `cloudwatch` (ignored for `prometheus`). if not provided, the usual rules are followed for determining aws region (`AWS_DEFAULT_REGION`, `~/.aws/config`) | ||
|
||
# Usage | ||
### Library | ||
The library can be imported and used within another application. | ||
Use `pip install .` from the top-level `console_link` directory to install it locally and then import it as, e.g. `from console_link.models.metrics_source import MetricsSource` | ||
|
||
#### CLI | ||
The CLI comes installed on the migration console. If you'd like to install it elsewhere, `pip install .` from the top-level `console_link` directory will install it and setup a `console` executable to access it. | ||
|
||
Autocomplete can be enabled by adding `eval "$(_CONSOLE_COMPLETE=bash_source console)"` to your `.bashrc` file, or `eval "$(_FOO_BAR_COMPLETE=zsh_source foo-bar)"` to your `.zshrc` and re-sourcing your shell. | ||
|
||
The structure of cli commands is: | ||
`console [--global-options] OBJECT COMMAND [--options]` | ||
|
||
##### Global Options | ||
The available global options are: | ||
- `--config-file FILE` to specify the path to a config file (default is `/etc/migration_services.yaml`) | ||
- `--json` to get output in JSON designed for machine consumption instead of printing to the console | ||
|
||
##### Objects | ||
Currently, the two objects available are `cluster` and `metrics`. | ||
|
||
##### Commands & options | ||
Each object has its own commands available, and each command has its own options. To see the available commands and options, use: | ||
``` | ||
console OBJECT --help | ||
``` | ||
|
||
## Testing | ||
``` | ||
pip install -r tests/requirements.txt | ||
pytest | ||
``` |
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 |
---|---|---|
@@ -1,2 +0,0 @@ | ||
import console_link.logic.clusters # noqa: F401 | ||
import console_link.logic.metrics # noqa: F401 | ||
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
Binary file added
BIN
+43.6 KB
...re/dockerSolution/src/main/docker/migrationConsole/lib/console_link/diagram.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 2 additions & 3 deletions
5
...erSolution/src/main/docker/migrationConsole/lib/console_link/tests/test_metrics_source.py
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