diff --git a/clickhouse-admin/src/http_entrypoints.rs b/clickhouse-admin/src/http_entrypoints.rs index 782b2b4790..fb3ce733fc 100644 --- a/clickhouse-admin/src/http_entrypoints.rs +++ b/clickhouse-admin/src/http_entrypoints.rs @@ -31,7 +31,7 @@ impl ClickhouseAdminApi for ClickhouseAdminImpl { let ctx = rqctx.context(); let server_settings = body.into_inner(); let output = ctx.clickward().generate_server_config(server_settings)?; - // TODO: Do something with the generation number + // TODO(https://github.com/oxidecomputer/omicron/issues/5999): Do something with the generation number println!("{path:?}"); Ok(HttpResponseCreated(output)) } @@ -44,7 +44,7 @@ impl ClickhouseAdminApi for ClickhouseAdminImpl { let ctx = rqctx.context(); let keeper_settings = body.into_inner(); let output = ctx.clickward().generate_keeper_config(keeper_settings)?; - // TODO: Do something with the generation number + // TODO(https://github.com/oxidecomputer/omicron/issues/5999): Do something with the generation number println!("{path:?}"); Ok(HttpResponseCreated(output)) } diff --git a/clickhouse-admin/types/src/config.rs b/clickhouse-admin/types/src/config.rs index a31295834a..f0f04a8aa3 100644 --- a/clickhouse-admin/types/src/config.rs +++ b/clickhouse-admin/types/src/config.rs @@ -29,14 +29,24 @@ pub fn path_schema(gen: &mut SchemaGenerator) -> Schema { /// Configuration for a ClickHouse replica server #[derive(Debug, Clone, PartialEq, Eq, JsonSchema, Serialize, Deserialize)] pub struct ReplicaConfig { + /// Logging settings pub logger: LogConfig, + /// Parameter substitutions for replicated tables pub macros: Macros, + /// Address the server is listening on pub listen_host: Ipv6Addr, + /// Port for HTTP connections pub http_port: u16, + /// Port for TCP connections pub tcp_port: u16, + /// Port for interserver HTTP connections pub interserver_http_port: u16, + /// Configuration of clusters used by the Distributed table engine and bythe cluster + /// table function pub remote_servers: RemoteServers, + /// Contains settings that allow ClickHouse servers to interact with a Keeper cluster pub keepers: KeeperConfigsForReplica, + /// Directory for all files generated by ClickHouse itself #[schemars(schema_with = "path_schema")] pub data_path: Utf8PathBuf, } @@ -444,15 +454,23 @@ impl RaftServerConfig { /// Configuration for a ClickHouse keeper #[derive(Debug, Clone, PartialEq, Eq, JsonSchema, Serialize, Deserialize)] pub struct KeeperConfig { + /// Logging settings pub logger: LogConfig, + /// Address the keeper is listening on pub listen_host: Ipv6Addr, + /// Port for TCP connections pub tcp_port: u16, + /// Unique ID for this keeper node pub server_id: KeeperId, + /// Directory for coordination logs #[schemars(schema_with = "path_schema")] pub log_storage_path: Utf8PathBuf, + /// Directory for coordination snapshot storage #[schemars(schema_with = "path_schema")] pub snapshot_storage_path: Utf8PathBuf, + /// Internal coordination settings pub coordination_settings: KeeperCoordinationSettings, + /// Settings for each server in the keeper cluster pub raft_config: RaftServers, } diff --git a/clickhouse-admin/types/src/lib.rs b/clickhouse-admin/types/src/lib.rs index d5e401c66a..555fbc6d31 100644 --- a/clickhouse-admin/types/src/lib.rs +++ b/clickhouse-admin/types/src/lib.rs @@ -58,13 +58,19 @@ pub struct ServerId(pub u64); #[derive(Debug, Clone, PartialEq, Eq, Deserialize, Serialize, JsonSchema)] #[serde(rename_all = "snake_case")] pub struct ServerSettings { + /// Directory for the generated server configuration XML file #[schemars(schema_with = "path_schema")] pub config_dir: Utf8PathBuf, + /// Unique ID of the server pub node_id: ServerId, + /// Directory for all files generated by ClickHouse itself #[schemars(schema_with = "path_schema")] pub datastore_path: Utf8PathBuf, + /// Address the server is listening on pub listen_addr: Ipv6Addr, + /// Addresses for each of the individual nodes in the Keeper cluster pub keepers: Vec, + /// Addresses for each of the individual replica servers pub remote_servers: Vec, } @@ -127,12 +133,17 @@ impl ServerSettings { #[derive(Debug, Clone, PartialEq, Eq, Deserialize, Serialize, JsonSchema)] #[serde(rename_all = "snake_case")] pub struct KeeperSettings { + /// Directory for the generated keeper configuration XML file #[schemars(schema_with = "path_schema")] pub config_dir: Utf8PathBuf, + /// Unique ID of the keeper pub node_id: KeeperId, + /// ID and host of each server in the keeper cluster pub raft_servers: Vec, + /// Directory for all files generated by ClickHouse itself #[schemars(schema_with = "path_schema")] pub datastore_path: Utf8PathBuf, + /// Address the keeper is listening on pub listen_addr: Ipv6Addr, } diff --git a/openapi/clickhouse-admin.json b/openapi/clickhouse-admin.json index c1342cbfec..5afe4b906d 100644 --- a/openapi/clickhouse-admin.json +++ b/openapi/clickhouse-admin.json @@ -171,30 +171,54 @@ "type": "object", "properties": { "coordination_settings": { - "$ref": "#/components/schemas/KeeperCoordinationSettings" + "description": "Internal coordination settings", + "allOf": [ + { + "$ref": "#/components/schemas/KeeperCoordinationSettings" + } + ] }, "listen_host": { + "description": "Address the keeper is listening on", "type": "string", "format": "ipv6" }, "log_storage_path": { + "description": "Directory for coordination logs", "type": "string", "format": "Utf8PathBuf" }, "logger": { - "$ref": "#/components/schemas/LogConfig" + "description": "Logging settings", + "allOf": [ + { + "$ref": "#/components/schemas/LogConfig" + } + ] }, "raft_config": { - "$ref": "#/components/schemas/RaftServers" + "description": "Settings for each server in the keeper cluster", + "allOf": [ + { + "$ref": "#/components/schemas/RaftServers" + } + ] }, "server_id": { - "$ref": "#/components/schemas/KeeperId" + "description": "Unique ID for this keeper node", + "allOf": [ + { + "$ref": "#/components/schemas/KeeperId" + } + ] }, "snapshot_storage_path": { + "description": "Directory for coordination snapshot storage", "type": "string", "format": "Utf8PathBuf" }, "tcp_port": { + "description": "Port for TCP connections", "type": "integer", "format": "uint16", "minimum": 0 @@ -275,21 +299,30 @@ "type": "object", "properties": { "config_dir": { + "description": "Directory for the generated keeper configuration XML file", "type": "string", "format": "Utf8PathBuf" }, "datastore_path": { + "description": "Directory for all files generated by ClickHouse itself", "type": "string", "format": "Utf8PathBuf" }, - "id": { - "$ref": "#/components/schemas/KeeperId" - }, "listen_addr": { + "description": "Address the keeper is listening on", "type": "string", "format": "ipv6" }, + "node_id": { + "description": "Unique ID of the keeper", + "allOf": [ + { + "$ref": "#/components/schemas/KeeperId" + } + ] + }, "raft_servers": { + "description": "ID and host of each server in the keeper cluster", "type": "array", "items": { "$ref": "#/components/schemas/RaftServerSettings" @@ -299,8 +332,8 @@ "required": [ "config_dir", "datastore_path", - "id", "listen_addr", + "node_id", "raft_servers" ] }, @@ -442,36 +475,61 @@ "type": "object", "properties": { "data_path": { + "description": "Directory for all files generated by ClickHouse itself", "type": "string", "format": "Utf8PathBuf" }, "http_port": { + "description": "Port for HTTP connections", "type": "integer", "format": "uint16", "minimum": 0 }, "interserver_http_port": { + "description": "Port for interserver HTTP connections", "type": "integer", "format": "uint16", "minimum": 0 }, "keepers": { - "$ref": "#/components/schemas/KeeperConfigsForReplica" + "description": "Contains settings that allow ClickHouse servers to interact with a Keeper cluster", + "allOf": [ + { + "$ref": "#/components/schemas/KeeperConfigsForReplica" + } + ] }, "listen_host": { + "description": "Address the server is listening on", "type": "string", "format": "ipv6" }, "logger": { - "$ref": "#/components/schemas/LogConfig" + "description": "Logging settings", + "allOf": [ + { + "$ref": "#/components/schemas/LogConfig" + } + ] }, "macros": { - "$ref": "#/components/schemas/Macros" + "description": "Parameter substitutions for replicated tables", + "allOf": [ + { + "$ref": "#/components/schemas/Macros" + } + ] }, "remote_servers": { - "$ref": "#/components/schemas/RemoteServers" + "description": "Configuration of clusters used by the Distributed table engine and bythe cluster table function", + "allOf": [ + { + "$ref": "#/components/schemas/RemoteServers" + } + ] }, "tcp_port": { + "description": "Port for TCP connections", "type": "integer", "format": "uint16", "minimum": 0 @@ -516,27 +574,37 @@ "type": "object", "properties": { "config_dir": { + "description": "Directory for the generated server configuration XML file", "type": "string", "format": "Utf8PathBuf" }, "datastore_path": { + "description": "Directory for all files generated by ClickHouse itself", "type": "string", "format": "Utf8PathBuf" }, "keepers": { + "description": "Addresses for each of the individual nodes in the Keeper cluster", "type": "array", "items": { "$ref": "#/components/schemas/ClickhouseHost" } }, "listen_addr": { + "description": "Address the server is listening on", "type": "string", "format": "ipv6" }, "node_id": { - "$ref": "#/components/schemas/ServerId" + "description": "Unique ID of the server", + "allOf": [ + { + "$ref": "#/components/schemas/ServerId" + } + ] }, "remote_servers": { + "description": "Addresses for each of the individual replica servers", "type": "array", "items": { "$ref": "#/components/schemas/ClickhouseHost"