Skip to content

Commit 92b0a60

Browse files
frhuelszCopilotCopilot
authored
engineering: Add gRPC server base (#412)
* Cleanup old grpc impl * loggers with UTs * dependencies * Cleanup deps * server components * middleware testing * further fd utils tests * Stream tests * Cleanup dep list * Integrate real server * Server code * simplify construction * clarification on termination * Copilot feedback * Copy protobufs into build container * Pipeline fixes * pr comments * Update crates/trident/src/server/activitytracker/tracker.rs Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * Update crates/trident/src/server/activitytracker/tracker.rs Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * Fix ordering of operations in servicing_request * Update crates/trident/src/server/activitytracker/middleware.rs Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * Comment * Unit lock type * Doc comment * Fix doc comment * Update crates/trident/src/server/tridentserver/mod.rs Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * Update crates/trident/src/server/support/stream.rs Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * default socket file permissions * Fix UT cleanup * Update crates/trident/src/server/activitytracker/tracker.rs Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * Update crates/trident/src/server/activitytracker/middleware.rs Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * Remove deletion to get a proper error on failed binds. * Thread safety clarification * Update crates/trident/src/server/mod.rs Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * nits and imports * imports * fix import * added todo * Update crates/trident/src/server/activitytracker/tracker.rs Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * Update crates/trident/src/server/support/fds.rs Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * nits * nits * Update crates/trident/src/server/activitytracker/middleware.rs Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * small cleanup * whitespace * Add test coverage for ServicingManager module (#425) * Initial plan * Add comprehensive tests for ServicingManager module Co-authored-by: frhuelsz <97629030+frhuelsz@users.noreply.github.com> --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: frhuelsz <97629030+frhuelsz@users.noreply.github.com> * fix verbose asserts * Update crates/trident/src/server/support/fds.rs Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * Update crates/trident/src/server/tridentserver/mod.rs Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * Update crates/trident/src/server/support/fds.rs Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * Update crates/trident/src/server/support/fds.rs Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * Update crates/trident/src/server/mod.rs Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * Update crates/trident/src/server/support/fds.rs Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * PR Comments * PR comments --------- Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> Co-authored-by: Copilot <198982749+Copilot@users.noreply.github.com>
1 parent 2752e89 commit 92b0a60

File tree

19 files changed

+2277
-21
lines changed

19 files changed

+2277
-21
lines changed
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
parameters:
2+
- name: protocVersion
3+
type: string
4+
default: "33.2"
5+
- name: protocArch
6+
type: string
7+
default: "x86_64"
8+
9+
steps:
10+
- script: |
11+
# The version of protoc in Ubuntu 22 is too old for our needs.
12+
# Install a recent version of protoc following the instructions
13+
# from their docs at https://protobuf.dev/installation/
14+
15+
PROTOC_FILE="protoc-${{ parameters.protocVersion }}-linux-${{ parameters.protocArch }}.zip"
16+
curl -LO "https://github.com/protocolbuffers/protobuf/releases/download/v${{ parameters.protocVersion }}/${PROTOC_FILE}"
17+
sudo unzip -o $PROTOC_FILE -d /usr/local
18+
rm -f $PROTOC_FILE
19+
displayName: Install Updated Protoc (${{ parameters.protocVersion }})
20+
retryCountOnTaskFailure: 3

.pipelines/templates/stages/testing_functional/functional-testing.yml

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -92,18 +92,11 @@ stages:
9292
sudo apt install -y clang bc unzip
9393
sudo apt remove python3-openssl
9494
pip install pytest assertpy paramiko pyopenssl
95-
96-
# The version of protoc in Ubuntu 22 is too old for our needs.
97-
# Install a recent version of protoc following the instructions
98-
# from their docs at https://protobuf.dev/installation/
99-
PROTOC_VERSION=33.2
100-
PROTOC_FILE="protoc-${PROTOC_VERSION}-linux-x86_64.zip"
101-
curl -LO "https://github.com/protocolbuffers/protobuf/releases/download/v${PROTOC_VERSION}/${PROTOC_FILE}"
102-
sudo unzip -o $PROTOC_FILE -d /usr/local
103-
rm -f $PROTOC_FILE
10495
displayName: Install dependencies
10596
retryCountOnTaskFailure: 3
10697
98+
- template: ../common_tasks/update-protoc.yml
99+
107100
- template: ../common_tasks/download-osmodifier.yml
108101
parameters:
109102
osModifierBranch: ${{ parameters.osModifierBranch }}

.pipelines/templates/stages/validate_makefile/dev-build.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,10 +46,11 @@ stages:
4646
# Proactively try to fix any possible issue from previous task failure
4747
sudo dpkg --configure -a
4848
49-
sudo apt install -y protobuf-compiler clang bc
49+
sudo apt install -y clang bc
5050
displayName: Install native dependencies
5151
retryCountOnTaskFailure: 3
5252
53+
- template: ../common_tasks/update-protoc.yml
5354
- template: ../common_tasks/rustup.yml
5455
- template: ../common_tasks/cargo-auth.yml
5556

Cargo.lock

Lines changed: 30 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -31,17 +31,20 @@ glob = "0.3.1"
3131
goblin = "0.10.0"
3232
hex = "0.4.0"
3333
hostname = "0.4.0"
34+
hyper = "1.8.1"
3435
indoc = "2.0.5"
3536
inventory = "0.3.15"
3637
itertools = "0.13.0"
3738
lazy_static = "1.5.0"
3839
libc = "0.2.167"
3940
log = "0.4.22"
4041
maplit = "1.0.2"
42+
mockito = "1.6.1"
4143
netplan-types = "0.5.0"
4244
nix = { version = "0.30.1", features = [
4345
"fs",
4446
"user",
47+
"socket",
4548
], default-features = false }
4649
oci-client = "0.15.0"
4750
once_cell = "1.19"
@@ -60,7 +63,7 @@ reqwest = { version = "0.12.9", features = [
6063
"blocking",
6164
"charset",
6265
"default-tls",
63-
], default-features = false }
66+
], default-features = false } # "http2" is enabled by default but causes a (false positive) CG alert
6467
schemars = { version = "0.8.21", features = ["url", "uuid1"] }
6568
semver = "1.0.23"
6669
serde = { version = "1.0.215", features = ["derive"] }
@@ -72,22 +75,25 @@ strum = "0.26.3"
7275
strum_macros = "0.26.4"
7376
svg = "0.18.0"
7477
syn = { version = "2.0.90", features = ["full"] }
75-
sys-mount = { version = "3.0.1", default-features = false }
78+
sys-mount = { version = "3.0.1", default-features = false } # Disable loop device feature
7679
sysinfo = "0.30.13"
7780
systemd-journal-logger = "2.2.2"
7881
tar = "0.4.43"
7982
tempfile = "3.14.0"
8083
tera = "1.20.0"
8184
textwrap = "0.16.2"
8285
thiserror = "1.0.69"
83-
tokio = { version = "1.47.1", features = ["full", "rt-multi-thread"] }
86+
tokio = { version = "1.48.0", features = ["full"] }
87+
tokio-stream = { version = "0.1.17", features = ["net"] }
88+
tokio-util = "0.7.17"
8489
tonic = "0.14.2"
90+
tonic-middleware = "0.4.0"
8591
tonic-prost = "0.14.2"
92+
tonic-prost-build = "0.14.2"
93+
tower = "0.5.2"
8694
tracing = "0.1.41"
8795
tracing-subscriber = { version = "0.3.19", features = ["json"] }
8896
url = { version = "2.5.4", features = ["serde"] }
8997
uuid = { version = "1.11.0", features = ["serde", "v4"] }
9098
which = "6.0.3"
9199
zstd = "0.13.3"
92-
mockito = "1.6.1"
93-
tonic-prost-build = "0.14.2"

crates/trident/Cargo.toml

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -29,15 +29,15 @@ oci-client = { workspace = true }
2929
procfs = { workspace = true }
3030
rayon = { workspace = true }
3131
regex = { workspace = true }
32-
reqwest = { workspace = true } # "http2" is enabled by default but causes a (false positive) CG alert
32+
reqwest = { workspace = true }
3333
serde = { workspace = true }
3434
serde_json = { workspace = true }
3535
serde_yaml = { workspace = true }
3636
sha2 = { workspace = true }
3737
sqlite = { workspace = true }
3838
strum = { workspace = true }
3939
strum_macros = { workspace = true }
40-
sys-mount = { workspace = true } # Disable loop device feature
40+
sys-mount = { workspace = true }
4141
sysinfo = { workspace = true }
4242
systemd-journal-logger = { workspace = true }
4343
tar = { workspace = true }
@@ -50,12 +50,20 @@ url = { workspace = true }
5050
uuid = { workspace = true }
5151
zstd = { workspace = true }
5252

53+
# gRPC API Dependencies
54+
hyper = { workspace = true }
55+
prost-types = { workspace = true }
56+
tokio = { workspace = true }
57+
tokio-stream = { workspace = true }
58+
tokio-util = { workspace = true }
59+
tonic = { workspace = true }
60+
tonic-middleware = { workspace = true }
61+
62+
# Local Crate Dependencies
5363
sysdefs = { path = "../sysdefs" }
5464
osutils = { path = "../osutils" }
5565
trident_api = { path = "../trident_api" }
56-
57-
# gRPC API Dependencies
58-
tokio = { workspace = true, features = ["full"] }
66+
harpoon = { path = "../harpoon" }
5967

6068
# Optional dependencies used by functional tests
6169
indoc = { workspace = true, optional = true }
@@ -72,9 +80,10 @@ osutils = { path = "../osutils" }
7280
indoc = { workspace = true }
7381
maplit = { workspace = true }
7482
mockito = { workspace = true }
75-
osutils = { path = "../osutils", features = ["test-utilities"] }
7683
sha2 = { workspace = true }
84+
tower = { workspace = true }
7785

86+
osutils = { path = "../osutils", features = ["test-utilities"] }
7887

7988
[features]
8089
dangerous-options = ["trident_api/dangerous-options", "docker_credential"]

crates/trident/src/lib.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,11 @@ pub mod stream;
3737
mod subsystems;
3838
pub mod validation;
3939

40+
// TODO: Fully enable as part of #399.
41+
#[cfg(test)]
42+
#[allow(dead_code, unused)]
43+
mod server;
44+
4045
use engine::{rollback, storage::rebuild};
4146

4247
pub use datastore::DataStore;

0 commit comments

Comments
 (0)