Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[reconfigurator] ClickHouse XML generation types (#6412)
## Overview This commit adds a library to generate ClickHouse replica server and keeper configuration files. A lot of the code in the `clickhouse-admin/types` directory has been copied over from [clickward](https://github.com/oxidecomputer/clickward), but there are several additions and modifications: - New `new()` and `default()` methods that set default Oxide values. - File generation is per node, as opposed to all files generated in a single directory like clickward. ## Usage To generate a replica server configuration file: ```rust let keepers = vec![ KeeperNodeConfig::new("ff::01".to_string()), KeeperNodeConfig::new("ff::02".to_string()), KeeperNodeConfig::new("ff::03".to_string()), ]; let servers = vec![ ServerNodeConfig::new("ff::08".to_string()), ServerNodeConfig::new("ff::09".to_string()), ]; let config = ClickhouseServerConfig::new( Utf8PathBuf::from(config_dir.path()), ServerId(1), Utf8PathBuf::from_str("./").unwrap(), Ipv6Addr::from_str("ff::08").unwrap(), keepers, servers, ); config.generate_xml_file().unwrap(); ``` To generate a keeper configuration file: ```rust let keepers = vec![ RaftServerConfig::new(KeeperId(1), "ff::01".to_string()), RaftServerConfig::new(KeeperId(2), "ff::02".to_string()), RaftServerConfig::new(KeeperId(3), "ff::03".to_string()), ]; let config = ClickhouseKeeperConfig::new( Utf8PathBuf::from(config_dir.path()), KeeperId(1), keepers, Utf8PathBuf::from_str("./").unwrap(), Ipv6Addr::from_str("ff::08").unwrap(), ); config.generate_xml_file().unwrap(); ``` ## Purpose As part of the work to roll out replicated ClickHouse, we'll need to dynamically generate the node configuration files via the `clickhouse-admin` service. This commit is part of the work necessary to do so. Related: #5999 , #3824
- Loading branch information