Skip to content

Commit

Permalink
Clickhouse cluster reconfigurator execution (oxidecomputer#6762)
Browse files Browse the repository at this point in the history
Create a clickhouse-admin-client and use it in reconfigurator execution
for clickhouse keepers and servers.

Note that since the policy is disabled, there won't be a
`Some(clickhouse_cluster_config)` in the blueprint and the execution
will be skipped.
  • Loading branch information
andrewjstone authored Oct 4, 2024
1 parent 62c7672 commit ba21231
Show file tree
Hide file tree
Showing 9 changed files with 586 additions and 3 deletions.
20 changes: 20 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ members = [
"clickhouse-admin",
"clickhouse-admin/api",
"clients/bootstrap-agent-client",
"clients/clickhouse-admin-client",
"clients/cockroach-admin-client",
"clients/ddm-admin-client",
"clients/dns-service-client",
Expand Down Expand Up @@ -126,6 +127,7 @@ default-members = [
"clickhouse-admin/api",
"clickhouse-admin/types",
"clients/bootstrap-agent-client",
"clients/clickhouse-admin-client",
"clients/cockroach-admin-client",
"clients/ddm-admin-client",
"clients/dns-service-client",
Expand Down Expand Up @@ -314,6 +316,7 @@ chrono = { version = "0.4", features = [ "serde" ] }
ciborium = "0.2.2"
clap = { version = "4.5", features = ["cargo", "derive", "env", "wrap_help"] }
clickhouse-admin-api = { path = "clickhouse-admin/api" }
clickhouse-admin-client = { path = "clients/clickhouse-admin-client" }
clickhouse-admin-types = { path = "clickhouse-admin/types" }
clickward = { git = "https://github.com/oxidecomputer/clickward", rev = "ceec762e6a87d2a22bf56792a3025e145caa095e" }
cockroach-admin-api = { path = "cockroach-admin/api" }
Expand Down
6 changes: 3 additions & 3 deletions clickhouse-admin/api/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,17 +12,17 @@ use dropshot::{
};
use omicron_common::api::external::Generation;
use schemars::JsonSchema;
use serde::Deserialize;
use serde::{Deserialize, Serialize};

#[derive(Debug, Deserialize, JsonSchema)]
#[derive(Debug, Serialize, Deserialize, JsonSchema)]
pub struct ServerConfigurableSettings {
/// A unique identifier for the configuration generation.
pub generation: Generation,
/// Configurable settings for a ClickHouse replica server node.
pub settings: ServerSettings,
}

#[derive(Debug, Deserialize, JsonSchema)]
#[derive(Debug, Serialize, Deserialize, JsonSchema)]
pub struct KeeperConfigurableSettings {
/// A unique identifier for the configuration generation.
pub generation: Generation,
Expand Down
19 changes: 19 additions & 0 deletions clients/clickhouse-admin-client/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
[package]
name = "clickhouse-admin-client"
version = "0.1.0"
edition = "2021"

[dependencies]
chrono.workspace = true
clickhouse-admin-types.workspace = true
clickhouse-admin-api.workspace = true
omicron-uuid-kinds.workspace = true
progenitor.workspace = true
reqwest = { workspace = true, features = [ "json", "rustls-tls", "stream" ] }
schemars.workspace = true
serde.workspace = true
slog.workspace = true
omicron-workspace-hack.workspace = true

[lints]
workspace = true
27 changes: 27 additions & 0 deletions clients/clickhouse-admin-client/src/lib.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
// file, You can obtain one at https://mozilla.org/MPL/2.0/.

//! Interface for making API requests to a clickhouse-admin server running in
//! an omicron zone.
progenitor::generate_api!(
spec = "../../openapi/clickhouse-admin.json",
inner_type = slog::Logger,
pre_hook = (|log: &slog::Logger, request: &reqwest::Request| {
slog::debug!(log, "client request";
"method" => %request.method(),
"uri" => %request.url(),
"body" => ?&request.body(),
);
}),
post_hook = (|log: &slog::Logger, result: &Result<_, _>| {
slog::debug!(log, "client response"; "result" => ?result);
}),
derives = [schemars::JsonSchema],
replace = {
TypedUuidForOmicronZoneKind = omicron_uuid_kinds::OmicronZoneUuid,
KeeperConfigurableSettings = clickhouse_admin_api::KeeperConfigurableSettings,
ServerConfigurableSettings = clickhouse_admin_api::ServerConfigurableSettings,
}
);
4 changes: 4 additions & 0 deletions nexus/reconfigurator/execution/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@ omicron-rpaths.workspace = true

[dependencies]
anyhow.workspace = true
camino.workspace = true
clickhouse-admin-api.workspace = true
clickhouse-admin-client.workspace = true
clickhouse-admin-types.workspace = true
cockroach-admin-client.workspace = true
dns-service-client.workspace = true
chrono.workspace = true
Expand Down
Loading

0 comments on commit ba21231

Please sign in to comment.