Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
937 changes: 937 additions & 0 deletions Cargo.lock

Large diffs are not rendered by default.

96 changes: 96 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

[workspace]
resolver = "2"
members = [
"crates/genproto",
]

[workspace.package]
version = "0.1.0"
edition = "2021"
authors = ["Apache Spark <dev@spark.apache.org>"]
license = "Apache-2.0"
repository = "https://github.com/apache/spark-connect-gateway"
readme = "README.md"
keywords = ["spark", "spark-connect", "gateway", "proxy", "grpc"]
categories = ["network-programming", "database"]
description = "Stateless gRPC proxy fronting Apache Spark Connect servers: session affinity, multi-tenant routing, auth, observability."
publish = false
rust-version = "1.82"

[workspace.dependencies]
# Async + gRPC
tokio = { version = "1.41", features = ["full"] }
tokio-stream = "0.1"
tonic = "0.14"
tonic-prost = "0.14"
tonic-prost-build = "0.14"
tonic-health = "0.14"
tower = "0.5"
prost = "0.14"
prost-types = "0.14"

# Logging + telemetry
tracing = "0.1"
tracing-subscriber = { version = "0.3", features = ["env-filter", "json"] }
opentelemetry = "0.31"
opentelemetry_sdk = { version = "0.31", features = ["rt-tokio"] }
opentelemetry-otlp = { version = "0.31", default-features = false, features = ["trace", "grpc-tonic", "tls-ring", "tls-webpki-roots"] }
opentelemetry-semantic-conventions = "0.31"
opentelemetry-stdout = "0.31"
opentelemetry-proto = { version = "0.31", default-features = false, features = ["gen-tonic", "trace"] }
tracing-opentelemetry = "0.32"

# Config + utilities
serde = { version = "1", features = ["derive"] }
serde_yaml = "0.9"
clap = { version = "4", features = ["derive"] }
anyhow = "1"
thiserror = "2"
async-trait = "0.1"
futures = "0.3"
parking_lot = "0.12"

# K8s
kube = { version = "3.1", features = ["runtime", "client"] }
k8s-openapi = { version = "0.27", features = ["latest"] }

# Affinity store backings
redis = { version = "1", default-features = false, features = ["tokio-comp", "connection-manager"] }

# Auth
jsonwebtoken = "9"
reqwest = { version = "0.12", default-features = false, features = ["rustls-tls", "json"] }
subtle = "2"

# Observability
prometheus = "0.14"
uuid = { version = "1", features = ["v4"] }
hyper = { version = "1", features = ["server", "http1"] }
hyper-util = { version = "0.1", features = ["tokio"] }
http-body-util = "0.1"
bytes = "1"

# Test-only
tempfile = "3"
hdrhistogram = { version = "7", default-features = false }
testcontainers-modules = { version = "0.15", features = ["redis"] }

[profile.release]
lto = "thin"
codegen-units = 1
strip = "debuginfo"
36 changes: 36 additions & 0 deletions crates/genproto/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

[package]
name = "scg-genproto"
version.workspace = true
edition.workspace = true
license.workspace = true
authors.workspace = true
repository.workspace = true
readme.workspace = true
keywords.workspace = true
categories.workspace = true
description = "tonic-generated Rust bindings for the Apache Spark Connect protobufs."
publish = false

[dependencies]
tonic = { workspace = true }
tonic-prost = { workspace = true }
prost = { workspace = true }
prost-types = { workspace = true }

[build-dependencies]
tonic-prost-build = { workspace = true }
40 changes: 40 additions & 0 deletions crates/genproto/build.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
// Licensed to the Apache Software Foundation (ASF) under one or more
// contributor license agreements. See the NOTICE file distributed with
// this work for additional information regarding copyright ownership.
// The ASF licenses this file to You under the Apache License, Version 2.0
// (the "License"); you may not use this file except in compliance with
// the License. You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

use std::path::PathBuf;

fn main() {
let proto_root = PathBuf::from(env!("CARGO_MANIFEST_DIR"))
.join("..")
.join("..")
.join("proto");
let connect_dir = proto_root.join("spark").join("connect");
let entries: Vec<PathBuf> = std::fs::read_dir(&connect_dir)
.expect("read proto dir")
.filter_map(|e| e.ok())
.map(|e| e.path())
.filter(|p| p.extension().is_some_and(|x| x == "proto"))
.collect();

for p in &entries {
println!("cargo:rerun-if-changed={}", p.display());
}

tonic_prost_build::configure()
.build_server(true)
.build_client(true)
.compile_protos(&entries, &[proto_root])
.expect("tonic-prost-build compile_protos");
}
39 changes: 39 additions & 0 deletions crates/genproto/src/lib.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
// Licensed to the Apache Software Foundation (ASF) under one or more
// contributor license agreements. See the NOTICE file distributed with
// this work for additional information regarding copyright ownership.
// The ASF licenses this file to You under the Apache License, Version 2.0
// (the "License"); you may not use this file except in compliance with
// the License. You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

//! Generated tonic bindings for the upstream `spark.connect.*` proto surface.
//!
//! The proto files under `proto/spark/connect/` are a read-only mirror of the
//! corresponding files in `apache/spark`. Bindings are regenerated at build
//! time by `build.rs`.
//!
//! Lints disabled here are intrinsic to prost-generated code, not bugs we
//! should fix:
//! * `large_enum_variant` — Spark Connect oneofs are inherently sized by
//! their largest variant; boxing every variant would be invasive and
//! would make the proto API noticeably worse to use.
//! * `clippy::all` more broadly: generated code is not human-authored, so
//! lint findings are not actionable.

#![allow(clippy::all)]
#![allow(clippy::pedantic)]

pub mod spark {
pub mod connect {
tonic::include_proto!("spark.connect");
}
}

pub use spark::connect as pb;
Loading
Loading