Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[CLI] Add advertised ingress address in restate whoami #2661

Merged
Merged
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
4 changes: 4 additions & 0 deletions cli/src/clients/admin_client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,7 @@ pub struct AdminClient {
pub(crate) request_timeout: Duration,
pub(crate) admin_api_version: AdminApiVersion,
pub(crate) restate_server_version: Option<String>,
pub(crate) advertised_ingress_address: Option<String>,
}

impl AdminClient {
Expand All @@ -139,6 +140,7 @@ impl AdminClient {
request_timeout: CliContext::get().request_timeout(),
admin_api_version: AdminApiVersion::Unknown,
restate_server_version: None,
advertised_ingress_address: None,
};

if let Ok(envelope) = client.version().await {
Expand Down Expand Up @@ -195,6 +197,8 @@ impl AdminClient {
) {
client.restate_server_version = Some(version_information.version);
client.admin_api_version = admin_api_version;
client.advertised_ingress_address =
version_information.ingress_endpoint.map(|u| u.to_string());
Ok(client)
} else {
bail!("The CLI is not compatible with the Restate server '{}'. Please update the CLI to match the Restate server version '{}'.", client.base_url, version_information.version);
Expand Down
9 changes: 9 additions & 0 deletions cli/src/commands/whoami.rs
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,15 @@ pub async fn run(State(env): State<CliEnv>) {
match client.health().await {
Ok(envelope) if envelope.status_code().is_success() => {
c_success!("Admin Service '{}' is healthy!", client.base_url);
if let Some(advertised_ingress_address) = client.advertised_ingress_address {
let mut table = Table::new();
table.load_preset(comfy_table::presets::NOTHING);
table.add_row(vec![
"Advertised ingress address",
&advertised_ingress_address,
]);
c_println!("{}", table);
}
}
Ok(envelope) => {
c_error!("Admin Service '{}' is unhealthy:", client.base_url);
Expand Down
Loading