fix(host_network): retrieve proper hostname and next available bond id #182

Merged
letian merged 7 commits from network-manager into master 2025-11-05 23:38:25 +00:00
Owner

In order to query the current network state NodeNetworkState and to apply a NodeNetworkConfigurationPolicy for a given node, we first needed to find its hostname. As all we had was the UUID of a node.

We had different options available (e.g. updating the Harmony Inventory Agent to retrieve it, store it in the OKD installation pipeline on assignation, etc.). But for the sake of simplicity and for better flexibility (e.g. being able to run this score on a cluster that wasn't setup with Harmony), the hostname was retrieved directly in the cluster by running the equivalent of kubectl get nodes -o yaml and matching the nodes with the system UUID.

Other changes

  • Find the next available bond id for a node
  • Apply a network config policy for a node (configuring a bond in our case)
  • Adjust the CRDs for NMState

Note: to see a quick demo, watch the recording in https://git.nationtech.io/NationTech/harmony/pulls/183

In order to query the current network state `NodeNetworkState` and to apply a `NodeNetworkConfigurationPolicy` for a given node, we first needed to find its hostname. As all we had was the UUID of a node. We had different options available (e.g. updating the Harmony Inventory Agent to retrieve it, store it in the OKD installation pipeline on assignation, etc.). But for the sake of simplicity and for better flexibility (e.g. being able to run this score on a cluster that wasn't setup with Harmony), the `hostname` was retrieved directly in the cluster by running the equivalent of `kubectl get nodes -o yaml` and matching the nodes with the system UUID. ### Other changes * Find the next available bond id for a node * Apply a network config policy for a node (configuring a bond in our case) * Adjust the CRDs for NMState Note: to see a quick demo, watch the recording in https://git.nationtech.io/NationTech/harmony/pulls/183
letian added 4 commits 2025-11-04 22:57:57 +00:00
letian added 1 commit 2025-11-05 17:13:55 +00:00
Merge branch 'master' into network-manager
All checks were successful
Run Check Script / check (pull_request) Successful in 1m18s
ca026e1d9e
johnride approved these changes 2025-11-05 20:48:28 +00:00
johnride left a comment
Owner

LGTM, just make sure the bond checking logic is correct.

LGTM, just make sure the bond checking logic is correct.
@ -271,0 +329,4 @@
.and_then(|network_state| network_state.status.current_state.as_ref())
.map_or(&interfaces, |current_state| &current_state.interfaces)
.iter()
.filter(|i| i.r#type == nmstate::InterfaceType::Bond && i.link_aggregation.is_some())
Owner

Why type Bond AND link_aggregation ?

I would have thought type bond is enough here? The AND could cause us using an existing bond that has no aggregation (yet)?

Why `type Bond AND link_aggregation` ? I would have thought type bond is enough here? The AND could cause us using an existing bond that has no aggregation (yet)?
Author
Owner

good point, I'll remove the second part of the check

good point, I'll remove the second part of the check
letian marked this conversation as resolved
@ -568,0 +614,4 @@
&self,
list_params: Option<ListParams>,
) -> Result<ObjectList<Node>, Error> {
self.list_resources(None, list_params).await
Owner

Rust is so beautiful. Type K infered from return type, completely transparent, super powerful, super readable, super intuitive.

Rust is so beautiful. Type K infered from return type, completely transparent, super powerful, super readable, super intuitive.
letian marked this conversation as resolved
letian added 1 commit 2025-11-05 23:36:09 +00:00
Merge branch 'master' into network-manager
All checks were successful
Run Check Script / check (pull_request) Successful in 1m17s
ae6ab24e53
letian added 1 commit 2025-11-05 23:38:05 +00:00
remove extra check for filtering existing bonds
All checks were successful
Run Check Script / check (pull_request) Successful in 1m11s
db80dafa99
letian merged commit 9d4e6acac0 into master 2025-11-05 23:38:25 +00:00
letian deleted branch network-manager 2025-11-05 23:38:27 +00:00
Sign in to join this conversation.
No reviewers
No Milestone
No project
No Assignees
2 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: NationTech/harmony#182
No description provided.