Files
Dimitar Mirchev ff78235e1d feat(server): add per-driver cargo features
Introduce driver-kubernetes, driver-docker, driver-podman, and driver-vm
cargo features on openshell-server, all enabled by default. Building with
--no-default-features and selecting a subset produces a gateway that only
carries the requested drivers.

The three container-driver crates flip to optional dependencies. The VM
driver runs out-of-process already, so driver-vm gates the in-server
launcher and match arm rather than a Cargo dep.

Feature gates cover:
- driver crate imports and re-exports in compute/mod.rs
- ComputeRuntime::new_docker / new_kubernetes / new_podman
- Docker's ShutdownCleanup / StartupResume trait impls
- the compute::vm module and VmComputeConfig re-export
- driver-specific *_config_from_context and apply_*_runtime_defaults
- the K8s ServiceAccount authenticator bootstrap in ServerState
- the auth::k8s_sa module and state field
- authenticator-chain construction in multiplex.rs
- SupervisorReadiness impl for SupervisorSessionRegistry
- driver-specific unit tests in cli.rs, lib.rs, driver_config.rs

A zero-driver build is a supported extension-only gateway shape: it
carries no in-tree driver code and speaks compute_driver.proto over
a Unix socket to an out-of-tree driver named in compute_drivers with
a matching [openshell.drivers.<name>].socket_path. The runtime gate
in resolve_configured_compute_driver (see the follow-up commit)
still rejects a built-in that was compiled out with the "rebuild
with --features driver-X" message, so silent misconfiguration is
impossible.

Default builds are byte-equivalent to before. Each of the four
single-driver builds compiles cleanly under -D warnings, as does the
docker + podman combo and the zero-driver extension-only build.

Signed-off-by: Dimitar Mirchev <28221091+dimityrmirchev@users.noreply.github.com>
2026-07-07 14:26:08 +03:00

133 lines
4.0 KiB
TOML

# SPDX-FileCopyrightText: Copyright (c) 2025-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
# SPDX-License-Identifier: Apache-2.0
[package]
name = "openshell-server"
description = "OpenShell gRPC/HTTP server with protocol multiplexing"
version.workspace = true
edition.workspace = true
rust-version.workspace = true
license.workspace = true
repository.workspace = true
[[bin]]
name = "openshell-gateway"
path = "src/main.rs"
[dependencies]
openshell-bootstrap = { path = "../openshell-bootstrap" }
openshell-core = { path = "../openshell-core", default-features = false }
# Compute driver crates are gated by the `driver-*` features below.
openshell-driver-docker = { path = "../openshell-driver-docker", optional = true }
openshell-driver-kubernetes = { path = "../openshell-driver-kubernetes", optional = true }
openshell-driver-podman = { path = "../openshell-driver-podman", optional = true }
openshell-ocsf = { path = "../openshell-ocsf" }
openshell-policy = { path = "../openshell-policy" }
openshell-prover = { path = "../openshell-prover" }
openshell-providers = { path = "../openshell-providers" }
openshell-router = { path = "../openshell-router" }
openshell-server-macros = { path = "../openshell-server-macros" }
# Kubernetes client (used by the `generate-certs` subcommand)
kube = { workspace = true }
k8s-openapi = { workspace = true }
# Async runtime
tokio = { workspace = true }
# gRPC
tonic = { workspace = true, features = ["channel", "tls-native-roots"] }
prost = { workspace = true }
prost-types = { workspace = true }
# HTTP server
axum = { workspace = true }
tower = { workspace = true }
tower-http = { workspace = true }
hyper = { workspace = true }
hyper-util = { workspace = true, features = ["client", "http1", "http2"] }
http = { workspace = true }
http-body = { workspace = true }
http-body-util = { workspace = true }
# TLS
tokio-rustls = { workspace = true }
rustls = { workspace = true }
rustls-pemfile = { workspace = true }
# CLI
clap = { workspace = true }
# Error handling
miette = { workspace = true }
thiserror = { workspace = true }
anyhow = { workspace = true }
# Logging
tracing = { workspace = true }
tracing-subscriber = { workspace = true }
# Metrics
metrics = { workspace = true }
metrics-exporter-prometheus = { workspace = true }
# Utilities
futures = { workspace = true }
bytes = { workspace = true }
pin-project-lite = { workspace = true }
serde = { workspace = true }
serde_json = { workspace = true }
toml = { workspace = true }
tokio-stream = { workspace = true }
sqlx = { workspace = true }
reqwest = { workspace = true }
uuid = { workspace = true }
hmac = "0.12"
sha2 = { workspace = true }
jsonwebtoken = { workspace = true }
async-trait = "0.1"
url = { workspace = true }
glob = { workspace = true }
hex = "0.4"
russh = "0.57"
rand = { workspace = true }
petname = "2"
ipnet = "2"
tempfile = "3"
rustix = { workspace = true }
x509-parser = "0.16"
arc-swap = "1"
notify = "8"
[features]
default = [
"telemetry",
"driver-kubernetes",
"driver-docker",
"driver-podman",
"driver-vm",
]
## Compile in anonymous telemetry emission (forwards to openshell-core/telemetry).
## On by default; build with `--no-default-features` for a telemetry-free gateway
## that contains no telemetry endpoint, HTTP client, or emission code.
telemetry = ["openshell-core/telemetry"]
## Compile in the in-tree compute drivers.
driver-kubernetes = ["dep:openshell-driver-kubernetes"]
driver-docker = ["dep:openshell-driver-docker"]
driver-podman = ["dep:openshell-driver-podman"]
## The VM driver itself runs out-of-process;
## this feature gates the in-server code that spawns and speaks gRPC to it.
driver-vm = []
bundled-z3 = ["openshell-prover/bundled-z3"]
test-support = []
[dev-dependencies]
hyper-rustls = { version = "0.27", default-features = false, features = ["native-tokio", "http1", "tls12", "logging", "ring", "webpki-tokio"] }
rcgen = { version = "0.13", features = ["crypto", "pem"] }
tokio-tungstenite = { workspace = true }
futures-util = "0.3"
wiremock = "0.6"
[lints]
workspace = true