Skip to content

Commit

Permalink
Add config option to configure the advertised_ingress_endpoint in the…
Browse files Browse the repository at this point in the history
… admin configuration. This will be used by the Web UI.
  • Loading branch information
slinkydeveloper committed Jan 31, 2025
1 parent c3e4ac5 commit 57679c9
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 0 deletions.
7 changes: 7 additions & 0 deletions crates/admin-rest-model/src/version.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
// the Business Source License, use of this software will be governed
// by the Apache License, Version 2.0.

use http::Uri;
use serde::{Deserialize, Serialize};
use std::ops::RangeInclusive;

Expand Down Expand Up @@ -63,6 +64,12 @@ pub struct VersionInformation {
///
/// Maximum supported admin API version by the admin server
pub max_admin_api_version: u16,
/// # Ingress endpoint
///
/// Ingress endpoint that the Web UI should use to interact with.
#[serde(with = "serde_with::As::<Option<serde_with::DisplayFromStr>>")]
#[cfg_attr(feature = "schema", schemars(with = "String", url))]
pub ingress_endpoint: Option<Uri>,
}

#[cfg(test)]
Expand Down
5 changes: 5 additions & 0 deletions crates/admin/src/rest_api/version.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
use axum::Json;
use okapi_operation::*;
use restate_admin_rest_model::version::{AdminApiVersion, VersionInformation};
use restate_types::config::Configuration;

/// Min/max supported admin api versions by the server
pub const MIN_ADMIN_API_VERSION: AdminApiVersion = AdminApiVersion::V1;
Expand All @@ -28,5 +29,9 @@ pub async fn version() -> Json<VersionInformation> {
version: env!("CARGO_PKG_VERSION").to_owned(),
min_admin_api_version: MIN_ADMIN_API_VERSION.as_repr(),
max_admin_api_version: MAX_ADMIN_API_VERSION.as_repr(),
ingress_endpoint: Configuration::pinned()
.admin
.advertised_ingress_endpoint
.clone(),
})
}
9 changes: 9 additions & 0 deletions crates/types/src/config/admin.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
use crate::partition_table::PartitionReplication;

use super::QueryEngineOptions;
use http::Uri;
use serde::{Deserialize, Serialize};
use serde_with::serde_as;
use std::net::SocketAddr;
Expand Down Expand Up @@ -75,6 +76,13 @@ pub struct AdminOptions {

#[cfg(any(test, feature = "test-util"))]
pub disable_cluster_controller: bool,

/// # Ingress endpoint
///
/// Ingress endpoint that the Web UI should use to interact with.
#[serde(with = "serde_with::As::<Option<serde_with::DisplayFromStr>>")]
#[cfg_attr(feature = "schemars", schemars(with = "String", url))]
pub advertised_ingress_endpoint: Option<Uri>,
}

impl AdminOptions {
Expand Down Expand Up @@ -114,6 +122,7 @@ impl Default for AdminOptions {
#[cfg(any(test, feature = "test-util"))]
disable_cluster_controller: false,
log_tail_update_interval: Duration::from_secs(5 * 60).into(),
advertised_ingress_endpoint: Some("http://localhost:8080/".parse().unwrap()),
}
}
}

0 comments on commit 57679c9

Please sign in to comment.