From d470688be70723e653eda7e50ec8e16583f8e2e4 Mon Sep 17 00:00:00 2001 From: Allen Bai Date: Wed, 15 Jul 2020 16:07:18 -0400 Subject: [PATCH] fcos-*: modify ports to prevent conflict with dumnati Signed-off-by: Allen Bai --- fcos-graph-builder/src/main.rs | 4 ++-- fcos-policy-engine/src/main.rs | 4 ++-- fcos-policy-engine/src/utils.rs | 10 ++++------ 3 files changed, 8 insertions(+), 10 deletions(-) diff --git a/fcos-graph-builder/src/main.rs b/fcos-graph-builder/src/main.rs index 76c7580..e6ff034 100644 --- a/fcos-graph-builder/src/main.rs +++ b/fcos-graph-builder/src/main.rs @@ -73,7 +73,7 @@ fn main() -> Fallible<()> { .data(gb_service.clone()) .route("/v1/graph", web::get().to(gb_serve_graph)) }) - .bind((IpAddr::from(Ipv4Addr::UNSPECIFIED), 8080))? + .bind((IpAddr::from(Ipv4Addr::UNSPECIFIED), 5050))? .run(); // Graph-builder status service. @@ -83,7 +83,7 @@ fn main() -> Fallible<()> { .data(gb_status.clone()) .route("/metrics", web::get().to(metrics::serve_metrics)) }) - .bind((IpAddr::from(Ipv4Addr::UNSPECIFIED), 9080))? + .bind((IpAddr::from(Ipv4Addr::UNSPECIFIED), 6060))? .run(); sys.run()?; diff --git a/fcos-policy-engine/src/main.rs b/fcos-policy-engine/src/main.rs index dc42bb4..6fe6576 100644 --- a/fcos-policy-engine/src/main.rs +++ b/fcos-policy-engine/src/main.rs @@ -63,7 +63,7 @@ fn main() -> Fallible<()> { .data(pe_service.clone()) .route("/v1/graph", web::get().to(pe_serve_graph)) }) - .bind((IpAddr::from(Ipv4Addr::UNSPECIFIED), 8081))? + .bind((IpAddr::from(Ipv4Addr::UNSPECIFIED), 5051))? .run(); // Policy-engine status service. @@ -73,7 +73,7 @@ fn main() -> Fallible<()> { .data(pe_status.clone()) .route("/metrics", web::get().to(metrics::serve_metrics)) }) - .bind((IpAddr::from(Ipv4Addr::UNSPECIFIED), 9081))? + .bind((IpAddr::from(Ipv4Addr::UNSPECIFIED), 6061))? .run(); sys.run()?; diff --git a/fcos-policy-engine/src/utils.rs b/fcos-policy-engine/src/utils.rs index ba581f5..66bec6e 100644 --- a/fcos-policy-engine/src/utils.rs +++ b/fcos-policy-engine/src/utils.rs @@ -7,13 +7,10 @@ use std::time::Duration; /// Default timeout for HTTP requests (30 minutes). const DEFAULT_HTTP_REQ_TIMEOUT: Duration = Duration::from_secs(30 * 60); /// Default address of fcos-graph-builder, which is the same as fcos-policy-builer -const DEFAULT_GB_ADDR: &str = "http://127.0.0.1:8080/v1/graph"; +const DEFAULT_GB_ADDR: &str = "http://127.0.0.1:5050/v1/graph"; /// Return a request builder with base URL and parameters set. -fn new_request( - method: reqwest::Method, - url: reqwest::Url, -) -> Fallible { +fn new_request(method: reqwest::Method, url: reqwest::Url) -> Fallible { let client = reqwest::ClientBuilder::new() .timeout(DEFAULT_HTTP_REQ_TIMEOUT) .build()?; @@ -21,8 +18,9 @@ fn new_request( Ok(builder) } +/// Fetch the graph from the fcos-graph-builder instance with the query specified. pub(crate) fn fetch_graph_from_gb( - query: String + query: String, ) -> impl Future> { async move { let mut target = reqwest::Url::parse(DEFAULT_GB_ADDR)?;