Skip to content

Commit

Permalink
feat(NODE-1474): refine config tool and add config versioning (#2299)
Browse files Browse the repository at this point in the history
**Changes:**

- Rename and change type to bool: nns_public_key_exists,
node_operator_private_key_path, use_ssh_authorized_keys,
inject_ic_crypto, inject_ic_state, inject_ic_registry_local_store,
- Add GuestOSDevSettings fields: hostname (will be used to manually set
hostname in testing), generate_ic_boundary_tls_cert ([used for creating
a testnet with API BNs](#2290))
- Add config commands: GenerateGuestosConfig, GenerateTestnetConfig
- Add config_version field, config version unit tests, and defined
protocol for updating config
- Uncouple domain_name from ipv4_config
  • Loading branch information
andrewbattat authored Nov 13, 2024
1 parent 156ad35 commit 4e83be1
Show file tree
Hide file tree
Showing 6 changed files with 993 additions and 97 deletions.
8 changes: 6 additions & 2 deletions rs/ic_os/config/README.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,15 @@
# IC-OS Config

IC-OS Config is responsible for managing the configuration of IC-OS images.
IC-OS Config is responsible for managing the configuration of IC-OS images.

SetupOS transforms user-facing configuration files (like `config.ini`, `deployment.json`, etc.) into a SetupOSConfig struct. Then, in production, configuration is propagated from SetupOS → HostOS → GuestOS (→ replica) via the HostOSConfig and GuestOSConfig structures.

All access to configuration and the config partition should go through the config structures.

For testing, IC-OS Config is also used to create HostOS and GuestOS configuration directly.
For testing, IC-OS Config is also used to create GuestOS configuration directly.

When updating the IC-OS configuration, it's crucial to ensure backwards compatibility.
For detailed guidelines on updating the configuration, please refer to the documentation in [`types.rs`](src/types.rs).
Any changes to the configuration should undergo a thorough review process to ensure they follow the guidlines.

For details on the IC-OS configuration mechanism, refer to [ic-os/docs/Configuration.adoc](../../../ic-os/docs/Configuration.adoc)
11 changes: 7 additions & 4 deletions rs/ic_os/config/src/config_ini.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ pub struct ConfigIniSettings {
pub ipv4_address: Option<Ipv4Addr>,
pub ipv4_gateway: Option<Ipv4Addr>,
pub ipv4_prefix_length: Option<u8>,
pub domain: Option<String>,
pub domain_name: Option<String>,
pub verbose: bool,
}

Expand Down Expand Up @@ -82,7 +82,7 @@ pub fn get_config_ini_settings(config_file_path: &Path) -> Result<ConfigIniSetti
})
.transpose()?;

let domain = config_map.get("domain").cloned();
let domain_name = config_map.get("domain").cloned();

let verbose = config_map
.get("verbose")
Expand All @@ -95,7 +95,7 @@ pub fn get_config_ini_settings(config_file_path: &Path) -> Result<ConfigIniSetti
ipv4_address,
ipv4_gateway,
ipv4_prefix_length,
domain,
domain_name,
verbose,
})
}
Expand Down Expand Up @@ -265,7 +265,10 @@ mod tests {
"212.71.124.177".parse::<Ipv4Addr>()?
);
assert_eq!(config_ini_settings.ipv4_prefix_length.unwrap(), 28);
assert_eq!(config_ini_settings.domain, Some("example.com".to_string()));
assert_eq!(
config_ini_settings.domain_name,
Some("example.com".to_string())
);
assert!(!config_ini_settings.verbose);

// Test missing ipv6
Expand Down
Loading

0 comments on commit 4e83be1

Please sign in to comment.