Skip to content

Commit

Permalink
Edge sc (#18)
Browse files Browse the repository at this point in the history
* feat: Make k8 feature available in fluvio-run (infinyon#3446)

similar approach to infinyon#3444

* add feature flags for k8-related features

---------

Co-authored-by: morenol <[email protected]>
  • Loading branch information
morenol and morenol committed Aug 4, 2023
1 parent 3443d0b commit ea11687
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 3 deletions.
8 changes: 7 additions & 1 deletion crates/fluvio-sc/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,15 @@ name = "fluvio-sc-k8"
path = "src/bin/k8.rs"
required-features = ["k8"]

[[bin]]
name = "fluvio-sc-edge"
path = "src/bin/edge.rs"
required-features = ["edge"]

[features]
default = ["k8"]
k8 = ["k8-client", "k8-types", "k8-metadata-client"]
edge = []

[dependencies]
rand = { workspace = true }
Expand Down Expand Up @@ -69,4 +75,4 @@ flv-tls-proxy = { workspace = true }
rand = { workspace = true }
fluvio-future = { workspace = true, features = ["fixture"] }
flv-util = { workspace = true, features = ["fixture"] }
fluvio-stream-model = { workspace = true, features = ["fixture"] }
fluvio-stream-model = { workspace = true, features = ["fixture"] }
11 changes: 11 additions & 0 deletions crates/fluvio-sc/src/bin/edge.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
use clap::Parser;

use fluvio_sc::cli::ScOpt;
use fluvio_sc::start::main_loop;

fn main() {
fluvio_future::subscriber::init_tracer(None);

let opt = ScOpt::parse();
main_loop(opt);
}
3 changes: 3 additions & 0 deletions crates/fluvio-sc/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
#[cfg(all(feature = "k8", feature = "edge"))]
compile_error!("features `fluvio-sc/k8` and `fluvio-sc/edge` are mutually exclusive");

#[macro_use]
pub mod config;
#[cfg(feature = "k8")]
Expand Down
4 changes: 2 additions & 2 deletions crates/fluvio-sc/src/services/public_api/topic/create.rs
Original file line number Diff line number Diff line change
Expand Up @@ -69,14 +69,14 @@ pub(crate) async fn handle_create_topics_request<AC: AuthContext>(
status = process_topic_request(auth_ctx, name, topic).await;
}

trace!("create topics request response {:#?}", status);
trace!(?status, "create topics request response");

Ok(status)
}

/// Validate topic, takes advantage of the validation routines inside topic action workflow
async fn validate_topic_request(name: &str, topic_spec: &TopicSpec, metadata: &Context) -> Status {
debug!("validating topic: {}", name);
debug!(topic_name = %name, "validating topic");

if let Err(err) = validate_resource_name(name) {
return Status::new(
Expand Down

0 comments on commit ea11687

Please sign in to comment.