Skip to content

26824 refactor list host software #27304

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

Closed
wants to merge 19 commits into from

Conversation

ksykulev
Copy link
Contributor

Checklist for submitter

If some of the following don't apply, delete the relevant line.

  • Changes file added for user-visible changes in changes/, orbit/changes/ or ee/fleetd-chrome/changes.
    See Changes files for more information.
  • Input data is properly validated, SELECT * is avoided, SQL injection is prevented (using placeholders for values in statements)
  • Added support on fleet's osquery simulator cmd/osquery-perf for new osquery data ingestion features.
  • If paths of existing endpoints are modified without backwards compatibility, checked the frontend/CLI for any necessary changes
  • If database migrations are included, checked table schema to confirm autoupdate
  • For database migrations:
    • Checked schema for all modified table for columns that will auto-update timestamps during migration.
    • Confirmed that updating the timestamps is acceptable, and will not cause unwanted side effects.
    • Ensured the correct collation is explicitly set for character columns (COLLATE utf8mb4_unicode_ci).
  • Added/updated automated tests
  • A detailed QA plan exists on the associated ticket (if it isn't there, work with the product group's QA engineer to add it)
  • Manual QA for all new/changed functionality
  • For Orbit and Fleet Desktop changes:
    • Make sure fleetd is compatible with the latest released version of Fleet (see Must rule).
    • Orbit runs on macOS, Linux and Windows. Check if the orbit feature/bugfix should only apply to one platform (runtime.GOOS).
    • Manual QA must be performed in the three main OSs, macOS, Windows and Linux.
    • Auto-update manual QA, from released version of component to new version (see tools/tuf/test).
  • For unreleased bug fixes in a release candidate, confirmed that the fix is not expected to adversely impact load test results or alerted the release DRI if additional load testing is needed.

last_uninstall_script_execution_id,
status
`

var globalOrTeamID uint
Copy link
Contributor Author

@ksykulev ksykulev Mar 19, 2025

Choose a reason for hiding this comment

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

This method is too long and needs to be broken down better.

It does have a few logical parts.

  1. get installed software
  2. get upcoming installs
  3. get upcoming uninstalls
  4. get vpp installs
  5. get available software for installs
  6. get information about all those software titles using IN (...ids...)
  7. some post processing to adjust to required object to be returned from method

SELECT
*
FROM
(SELECT * FROM upcoming_vpp_install UNION SELECT * FROM last_vpp_install) AS lvia
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I don't believe we need to add vulnerabilities joins for this. After VPP software is installed on the host we track those through host software.

// Clear out all the previous software titles as we are only filtering for available software
if opts.OnlyAvailableForInstall {
bySoftwareID = make(map[uint]*hostSoftware, len(availableSoftwareTitles))
}
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I don't like this approach, since we still fire off all the queries above but just discard the results. Should figure out a way to optimize here, and only fire off the available software query.

AND true
` + vppOnlySelfServiceClause + `
-- GROUP BY for vpp apps
%s
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Do we need this second query just for VPP apps? Can we merge this with the query above and avoid the union?

} else {
namedArgs["host_compatible_platforms"] = []string{host.FleetPlatform()}
}
stmtAvailable = `
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Need to fact check this query. Does it need to contain all this stuff to pull up "available to install software". Can we break it down into two pieces software/vpp to reduce complexity.

@ksykulev
Copy link
Contributor Author

One other matter I have been slightly ignore is labels.

@ksykulev ksykulev force-pushed the 26824-refactor-list-host-software branch 2 times, most recently from 1c1c994 to bf7d259 Compare March 25, 2025 02:16
@ksykulev ksykulev force-pushed the 26824-refactor-list-host-software branch from bf7d259 to d0a1ec7 Compare March 25, 2025 02:18
@ksykulev ksykulev closed this Mar 25, 2025
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