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

Move osquery extension management into osquery instance #1927

Merged
merged 3 commits into from
Oct 30, 2024

Conversation

RebeccaMahany
Copy link
Contributor

@RebeccaMahany RebeccaMahany commented Oct 30, 2024

Relates to #1827

Relates to #1936.

Per ADR, moves extension management into osquery instance.

This adds two new goroutines to the osquery instance's errgroup. To simplify a bit, this PR has also added the following:

  • Standardize how we add goroutines to the errgroup, ensuring they are logged and that shutdown goroutines are always created in the same way
  • Remove kolide extension, adding all tables to kolide_grpc instead

@RebeccaMahany RebeccaMahany marked this pull request as ready for review October 30, 2024 19:42

// addShutdownGoroutineToErrgroup adds the given goroutine to the errgroup, ensuring that we log its start and exit.
// The goroutine will not execute until the instance has received a signal to exit.
func (i *OsqueryInstance) addShutdownGoroutineToErrgroup(ctx context.Context, goroutineName string, goroutine func() error) {
Copy link
Contributor

Choose a reason for hiding this comment

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

these are very nice 🔥


// addShutdownGoroutineToErrgroup adds the given goroutine to the errgroup, ensuring that we log its start and exit.
// The goroutine will not execute until the instance has received a signal to exit.
func (i *OsqueryInstance) addShutdownGoroutineToErrgroup(ctx context.Context, goroutineName string, goroutine func() error) {
Copy link
Contributor

Choose a reason for hiding this comment

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

these are very nice 🔥

@RebeccaMahany RebeccaMahany added this pull request to the merge queue Oct 30, 2024
Merged via the queue into kolide:main with commit 9262ceb Oct 30, 2024
29 checks passed
@RebeccaMahany RebeccaMahany deleted the becca/move-extension branch October 30, 2024 21:17
Comment on lines -378 to -382
// Here be dragons
//
// There are two thorny issues. First, we "invert" control of
// the osquery process. We don't really know when osquery will
// be running, so we need a bunch of retries on these connections
Copy link
Contributor

Choose a reason for hiding this comment

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

This part might still be true?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This part didn't seem relevant to keep here anymore because we don't have the retries below this method -- the code was refactored (previously) to move those retries inside the StartOsqueryClient and StartOsqueryExtensionManagerServer methods.

Copy link
Contributor

Choose a reason for hiding this comment

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

Fair... the inverted control part is true, but maybe better elsewhere.

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'll add it back as a comment in next PR!

// the osquery process. We don't really know when osquery will
// be running, so we need a bunch of retries on these connections
//
// Second, because launcher supplements the enroll
Copy link
Contributor

Choose a reason for hiding this comment

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

This part is slain.

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.

4 participants