Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(fleet-cmdr): FM-210 initial implementation of fleet-cmdr daemon #363

Merged
merged 8 commits into from
Feb 4, 2025

Conversation

paulquinn00
Copy link
Contributor

Fleet Commander (fleet-cmdr) is a daemon which permanently connects to the Orb Relay to receive job commands from the Orb Fleet Backend. This initial implementation of the fleet-cmdr daemon includes the following changes:

  • fleet command basic implementation
  • integration of relay-client and basic command parsing
  • endpoint updates to include relay urls

Copy link
Contributor

@Michael-Preibisch Michael-Preibisch left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Generally LGTM. I was nit-picky with comments. I will leave it up to orb-software experts to give the final stamp

endpoints/src/v1.rs Show resolved Hide resolved
fleet-cmdr/src/handlers/cmd_orb_details.rs Outdated Show resolved Hide resolved
fleet-cmdr/src/handlers/cmd_reboot.rs Outdated Show resolved Hide resolved
fleet-cmdr/src/handlers/mod.rs Outdated Show resolved Hide resolved
fleet-cmdr/src/handlers/cmd_reboot.rs Outdated Show resolved Hide resolved
fleet-cmdr/src/main.rs Show resolved Hide resolved
fleet-cmdr/src/settings.rs Outdated Show resolved Hide resolved
Copy link
Collaborator

@TheButlah TheButlah left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

review wip, will discuss more in our meeting. Overall very good.

fleet-cmdr/src/handlers/cmd_reboot.rs Outdated Show resolved Hide resolved
endpoints/src/v1.rs Show resolved Hide resolved
fleet-cmdr/src/main.rs Outdated Show resolved Hide resolved
fleet-cmdr/src/main.rs Show resolved Hide resolved
fleet-cmdr/src/main.rs Outdated Show resolved Hide resolved
fleet-cmdr/src/main.rs Show resolved Hide resolved
fleet-cmdr/src/orb_info.rs Show resolved Hide resolved
fleet-cmdr/src/settings.rs Outdated Show resolved Hide resolved
fleet-cmdr/src/handlers/mod.rs Outdated Show resolved Hide resolved
fleet-cmdr/src/handlers/mod.rs Outdated Show resolved Hide resolved
fleet-cmdr/src/handlers/mod.rs Outdated Show resolved Hide resolved
fleet-cmdr/src/handlers/mod.rs Show resolved Hide resolved
fleet-cmdr/src/handlers/cmd_orb_details.rs Show resolved Hide resolved
let _request = OrbDetailsRequest::decode(command.payload.as_slice()).unwrap();
// TODO(paulquinn00): Consult with @oldgalileo and @sfikastheo to determine where to get this info from.
let response = OrbDetailsResponse {
orb_id: "".to_string(),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should usually be fetched through an environment variable which is populated with the /usr/local/bin/orb-id command.

// TODO(paulquinn00): Consult with @oldgalileo and @sfikastheo to determine where to get this info from.
let response = OrbDetailsResponse {
orb_id: "".to_string(),
orb_name: "".to_string(),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/usr/persistent/orb-name

let response = OrbDetailsResponse {
orb_id: "".to_string(),
orb_name: "".to_string(),
jabil_id: "".to_string(),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/usr/persistent/jabil-id

orb_id: "".to_string(),
orb_name: "".to_string(),
jabil_id: "".to_string(),
hardware_version: "".to_string(),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Get this information from the MCUs or over DBus

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can't we just use mcu-util?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, that's fine too. @TheButlah we should probably honestly normalize the collection of all of this early-boot.

hardware_version: "".to_string(),
software_version: "".to_string(),
software_update_version: "".to_string(),
os_release_type: "".to_string(),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What does this mean?

software_version: "".to_string(),
software_update_version: "".to_string(),
os_release_type: "".to_string(),
active_slot: "".to_string(),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Environment variable filled in by orb-slot-ctrl, or through the orb-slot-ctrl library.

software_update_version: "".to_string(),
os_release_type: "".to_string(),
active_slot: "".to_string(),
uptime_seconds: 0,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When should the uptime be counted?

fleet-cmdr/src/handlers/cmd_orb_details.rs Show resolved Hide resolved
fleet-cmdr/src/main.rs Outdated Show resolved Hide resolved
Copy link
Collaborator

@TheButlah TheButlah left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

approving, assuming that @paulquinn00 removes signal handlers and also reworks to get rid of the trait objects (probably using a match statement)

orb_id: "".to_string(),
orb_name: "".to_string(),
jabil_id: "".to_string(),
hardware_version: "".to_string(),
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can't we just use mcu-util?

let opts = ClientOpts::entity(EntityType::Orb)
.id(args.orb_id.clone().unwrap())
.endpoint(endpoints.clone())
.namespace(args.relay_namespace.clone().unwrap())
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
.namespace(args.relay_namespace.clone().unwrap())
.namespace(args.relay_namespace.clone().unwrap())
// TODO: FM-369

@paulquinn00 paulquinn00 enabled auto-merge (squash) February 4, 2025 21:30
@paulquinn00 paulquinn00 disabled auto-merge February 4, 2025 21:31
msg: &RecvMessage,
) -> Result<(), OrbCommandError> {
let any = Any::decode(msg.payload.as_slice()).unwrap();
if any.type_url == OrbDetailsRequest::type_url() {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it works, although maybe this is better:

match any.type_url {
  u if u == OrbDetailsRequest::type_url() =>  /* ... */ ,
  u if u == OrbRebootRequest::type_url() => /* .. */,
}

@TheButlah
Copy link
Collaborator

Dismissing @oldgalileo's review as stale, since @paulquinn00 has agreed to implement the following subsequent PRs:

  • PR to add token refresh via dbus
  • PR to add the other orb info that @oldgalileo has listed out in his comments
  • Final cleanup PR to tie up any loose ends (packaging, robustness to failure, etc)

@TheButlah TheButlah dismissed oldgalileo’s stale review February 4, 2025 22:40

paul will address feedback in subsequent PRs

@TheButlah TheButlah merged commit b78da83 into main Feb 4, 2025
14 checks passed
@TheButlah TheButlah deleted the FM-210-orb-fleet-cmdr branch February 4, 2025 22:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants