Skip to content

Commit fdd6812

Browse files
mayastor-borstiagolobocastro
mayastor-bors
andcommitted
Merge #680
680: refactor(ctrl-plane): tidy up the control-plane r=tiagolobocastro a=tiagolobocastro Reorganize the control-plane components in the repo by moving them to a separate control-plane directory. Rename the services into agents. Build the control plane components as a separate derivation with a lot less dependencies which reduces the build type. Create unique derivation for each control plane component. Make use of these components on the container image which reduces the image size. Co-authored-by: Tiago Castro <tiago.castro@mayadata.io>
2 parents 0f24ac9 + d313cc5 commit fdd6812

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

83 files changed

+289
-211
lines changed

Cargo.lock

+52-39
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

+6-5
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,11 @@ members = [
1414
"nvmeadm",
1515
"rpc",
1616
"sysfs",
17-
"services",
18-
"mbus-api",
17+
"control-plane/agents",
18+
"control-plane/mbus-api",
1919
"composer",
20-
"rest",
21-
"operators",
22-
"mayastor-macros"
20+
"control-plane/rest",
21+
"control-plane/operators",
22+
"control-plane/macros",
23+
"control-plane/deployer"
2324
]

composer/Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ ipnetwork = "0.17.0"
1616
bollard = "0.8.0"
1717
tracing = "0.1.22"
1818
tracing-subscriber = "0.2.15"
19-
mbus_api = { path = "../mbus-api" }
19+
mbus_api = { path = "../control-plane/mbus-api" }
2020

2121
[dev-dependencies]
2222
tokio = { version = "0.2", features = ["full"] }

services/Cargo.toml control-plane/agents/Cargo.toml

+5-10
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
[package]
2-
name = "services"
2+
name = "agents"
33
version = "0.1.0"
44
authors = ["Tiago Castro <tiago.castro@mayadata.io>"]
55
edition = "2018"
@@ -20,10 +20,6 @@ path = "pool/src/server.rs"
2020
name = "volume"
2121
path = "volume/src/server.rs"
2222

23-
[[bin]]
24-
name = "deployer"
25-
path = "deployer/src/bin.rs"
26-
2723
[[bin]]
2824
name = "jsongrpc"
2925
path = "jsongrpc/src/server.rs"
@@ -35,7 +31,6 @@ path = "common/src/lib.rs"
3531

3632
[dependencies]
3733
mbus_api = { path = "../mbus-api" }
38-
composer = { path = "../composer" }
3934
nats = "0.8"
4035
structopt = "0.3.15"
4136
tokio = { version = "0.2", features = ["full"] }
@@ -52,12 +47,12 @@ state = "0.4.2"
5247
tracing = "0.1"
5348
tracing-subscriber = "0.2"
5449
tracing-futures = "0.2.4"
55-
rpc = { path = "../rpc" }
50+
rpc = { path = "../../rpc" }
5651
url = "2.2.0"
5752
http = "0.2.1"
58-
strum = "0.19"
59-
strum_macros = "0.19"
60-
paste = "1.0.4"
53+
54+
[dev-dependencies]
55+
composer = { path = "../../composer" }
6156

6257
[dependencies.serde]
6358
features = ["derive"]
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

control-plane/deployer/Cargo.toml

+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
[package]
2+
name = "deployer"
3+
version = "0.1.0"
4+
authors = ["Tiago Castro <tiago.castro@mayadata.io>"]
5+
edition = "2018"
6+
7+
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
8+
9+
[[bin]]
10+
name = "deployer"
11+
path = "src/bin.rs"
12+
13+
[dependencies]
14+
mbus_api = { path = "../mbus-api" }
15+
composer = { path = "../../composer" }
16+
nats = "0.8"
17+
structopt = "0.3.15"
18+
tokio = { version = "0.2", features = ["full"] }
19+
async-trait = "0.1.36"
20+
rpc = { path = "../../rpc" }
21+
strum = "0.19"
22+
strum_macros = "0.19"
23+
paste = "1.0.4"

services/deployer/README.md control-plane/deployer/README.md

+7-7
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,19 @@
11
# Control Plane Deployer
22

3-
Deploying all the `control plane services` with all the trimmings is not an entirely straightforward exercise as there
3+
Deploying all the `control plane agents` with all the trimmings is not an entirely straightforward exercise as there
44
are many parts to it, including the additional configuration steps to be able to run multiple `mayastor` instances
55
alongside each other.
66

77
The `deployer` tool facilitates this by creating a composable docker `"cluster"` which allows us to run any number of
8-
`mayastor` instances, the `control plane services` and any other pluggable components.
8+
`mayastor` instances, the `control plane agents` and any other pluggable components.
99

1010
## Examples
1111

1212
**Using the help**
1313
```textmate
1414
[nix-shell:~/git/Mayastor]$ cargo run --bin deployer -- --help
1515
deployer --help
16-
services 0.1.0
16+
agents 0.1.0
1717
Deployment actions
1818
1919
USAGE:
@@ -37,15 +37,15 @@ The help can also be used on each subcommand.
3737
[nix-shell:~/git/Mayastor]$ cargo run --bin deployer -- start -m 2
3838
Finished dev [unoptimized + debuginfo] target(s) in 0.13s
3939
Running `sh /home/tiago/git/myconfigs/maya/test_as_sudo.sh target/debug/deployer start`
40-
Using options: CliArgs { action: Start(StartOptions { services: [Node(Node), Pool(Pool), Volume(Volume)], base_image: None, jaeger: false, no_rest: false, mayastors: 2, jaeger_image: None, build: false, dns: false, show_info: false, cluster_name: "cluster" }) }
40+
Using options: CliArgs { action: Start(StartOptions { agents: [Node(Node), Pool(Pool), Volume(Volume)], base_image: None, jaeger: false, no_rest: false, mayastors: 2, jaeger_image: None, build: false, dns: false, show_info: false, cluster_name: "cluster" }) }
4141
```
4242

4343
Notice the options which are printed out. They can be overridden - more on this later.
4444

4545
We could also use the `deploy` tool to inspect the components:
4646
```textmate
4747
[nix-shell:~/git/Mayastor]$ cargo run --bin deployer -- list
48-
Compiling services v0.1.0 (/home/tiago/git/Mayastor/services)
48+
Compiling agents v0.1.0 (/home/tiago/git/Mayastor/agents)
4949
Finished dev [unoptimized + debuginfo] target(s) in 5.50s
5050
Running `sh /home/tiago/git/myconfigs/maya/test_as_sudo.sh target/debug/deployer list`
5151
Using options: CliArgs { action: List(ListOptions { no_docker: false, format: None }) }
@@ -92,10 +92,10 @@ For more information, please refer to the help argument on every command/subcomm
9292
For example, to debug the rest server, we'd create a `cluster` without the rest server:
9393
```textmate
9494
[nix-shell:~/git/Mayastor]$ cargo run --bin deployer -- start --no-rest --show-info
95-
Compiling services v0.1.0 (/home/tiago/git/Mayastor/services)
95+
Compiling agents v0.1.0 (/home/tiago/git/Mayastor/agents)
9696
Finished dev [unoptimized + debuginfo] target(s) in 5.86s
9797
Running `sh /home/tiago/git/myconfigs/maya/test_as_sudo.sh target/debug/deployer start --no-rest --show-info`
98-
Using options: CliArgs { action: Start(StartOptions { services: [Node(Node), Pool(Pool), Volume(Volume)], base_image: None, jaeger: false, no_rest: true, mayastors: 1, jaeger_image: None, build: false, dns: false, show_info: true, cluster_name: "cluster" }) }
98+
Using options: CliArgs { action: Start(StartOptions { agents: [Node(Node), Pool(Pool), Volume(Volume)], base_image: None, jaeger: false, no_rest: true, mayastors: 1, jaeger_image: None, build: false, dns: false, show_info: true, cluster_name: "cluster" }) }
9999
[20994b0098d6] [/volume] /home/tiago/git/Mayastor/target/debug/volume -n nats.cluster:4222
100100
[f4884e343756] [/pool] /home/tiago/git/Mayastor/target/debug/pool -n nats.cluster:4222
101101
[fb6e78a0b6ef] [/node] /home/tiago/git/Mayastor/target/debug/node -n nats.cluster:4222

services/deployer/src/bin.rs control-plane/deployer/src/bin.rs

+6-6
Original file line numberDiff line numberDiff line change
@@ -47,20 +47,20 @@ pub(crate) struct ListOptions {
4747
#[derive(Debug, Clone, StructOpt)]
4848
#[structopt(about = "Create and start all components")]
4949
pub(crate) struct StartOptions {
50-
/// Use the following Control Plane Services
51-
/// Specify one service at a time or as a list.
52-
/// ( "" for no services )
50+
/// Use the following Control Plane Agents
51+
/// Specify one agent at a time or as a list.
52+
/// ( "" for no agents )
5353
/// todo: specify start arguments, eg: Node="-v"
5454
#[structopt(
5555
short,
5656
long,
5757
default_value = "Node, Pool, Volume",
5858
value_delimiter = ","
5959
)]
60-
services: Vec<ControlPlaneService>,
60+
agents: Vec<ControlPlaneAgent>,
6161

6262
/// Use the following Control Plane Operators
63-
/// Specify one service at a time or as a list
63+
/// Specify one operator at a time or as a list
6464
#[structopt(short, long, value_delimiter = ",")]
6565
operators: Option<Vec<ControlPlaneOperator>>,
6666

@@ -99,7 +99,7 @@ pub(crate) struct StartOptions {
9999
dns: bool,
100100

101101
/// Show information from the cluster after creation
102-
#[structopt(long)]
102+
#[structopt(short, long)]
103103
show_info: bool,
104104

105105
/// Name of the cluster - currently only one allowed at a time
File renamed without changes.
File renamed without changes.

0 commit comments

Comments
 (0)