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

134: add inventory service and clients (sans auth) #86

Merged
merged 8 commits into from
Mar 5, 2025

Conversation

JettTech
Copy link
Contributor

@JettTech JettTech commented Feb 28, 2025

Closes #134

NB: In the name of smaller PRs, I've separated out the tests from this PR. To review the tests, checkout out pr #87.

@JettTech JettTech changed the title add add inventory service and clients 134: add inventory service and clients (sans auth) Mar 1, 2025
@JettTech JettTech marked this pull request as ready for review March 1, 2025 00:06
@JettTech JettTech requested a review from a team as a code owner March 1, 2025 00:06
// Store latest inventory record in memory
let mut in_memory_cache = HoloInventory::from_host();

let one_hour_interval = tokio::time::Duration::from_secs(3600); // 1 hour in seconds
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@Holo-Host/developers - I'd like to open a discussion about what duration we think is appropriate for a regular inventory check. I put it to 1hr to start.. but would like to surface this as a question and come to an agreement as a team.

Copy link
Contributor

Choose a reason for hiding this comment

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

An hour is fine. It'll surface the changes we're looking for within a reasonable timeframe. We're not looking for realtime updates, and given that we're only sending the inventory when it changes from the last run, we're not wasting any capacity storing redundant copies. Ideally, we'd have a configuration file for the agent and this would be tunable. A constant is fine til we have that I guess.

Copy link
Collaborator

@zeeshan595 zeeshan595 left a comment

Choose a reason for hiding this comment

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

Can you just remove the for loop when calling mongodb and then I can approve this :)

@JettTech
Copy link
Contributor Author

JettTech commented Mar 4, 2025

Can you just remove the for loop when calling mongodb and then I can approve this :)
...Nice one, This will speed up this function quite a lot!

Was on the same page and did so over the weekend. Glad to see you like the update! :D

// Store latest inventory record in memory
let mut in_memory_cache = HoloInventory::from_host();

let one_hour_interval = tokio::time::Duration::from_secs(3600); // 1 hour in seconds
Copy link
Contributor

Choose a reason for hiding this comment

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

An hour is fine. It'll surface the changes we're looking for within a reasonable timeframe. We're not looking for realtime updates, and given that we're only sending the inventory when it changes from the last run, we're not wasting any capacity storing redundant copies. Ideally, we'd have a configuration file for the agent and this would be tunable. A constant is fine til we have that I guess.

})
.await?;

inventory_service
Copy link
Contributor

Choose a reason for hiding this comment

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

There's no point in sending the inventory back unauthenticated. We need to be able to tie it back to the registration info in a consistent/programmatic manner.

We'll have the migration pre-check tests/results to provide info on legacy systems in a bad state. I don't want us to collect legacy cases in the new codebase. The pre-check stuff can contain all of that and we can just ditch the whole crate at a later point.

Copy link
Contributor Author

@JettTech JettTech Mar 4, 2025

Choose a reason for hiding this comment

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

Got it. I understood from the last talk between you and @steveej, that there would be cases wherein we would send unauthenticated info about the host. Is this a misunderstanding, or has there been an update?

Either way, I'll remove this unauthenticated call. 👍

Copy link
Contributor

Choose a reason for hiding this comment

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

@steveej was going to write a list of calls he felt needed to be unauthenticated a few weeks ago so that we could review it in tangible terms, rather than the abstract terms we were talking on the call. That didn't happen, so I've made the executive decision that the inventory will be authenticated and that the results of the pre-migration checks (yet to be developed) may be unauthenticated (especially as the latter has a limited shelf life).

@JettTech
Copy link
Contributor Author

JettTech commented Mar 4, 2025

Ideally, we'd have a configuration file for the agent and this would be tunable. A constant is fine til we have that I guess.

Yes, I agree that we should probably have this be configurable from the onset. I'll add an env var for this. :)

@JettTech JettTech requested review from mattgeddes and a team March 4, 2025 06:08
@JettTech JettTech merged commit d9ff222 into main Mar 5, 2025
3 checks passed
@JettTech JettTech deleted the 134-add-inventory-sans-auth branch March 5, 2025 18:25
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.

3 participants