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

Refactor Remote Host Collection #1633

Merged
merged 30 commits into from
Oct 9, 2024

Conversation

diamonwiggins
Copy link
Member

@diamonwiggins diamonwiggins commented Oct 2, 2024

Description, Motivation and Context

Uses a global function in the collect package collect.RemoteHostCollect instead of a method per collector. This prevents the need to make a change to each collector for now until we have a use case that justifies that level ofgranularity

Considerations

While this PR does prevent the need of having to maintain code for each collector, everything awkward about it i'd attribute to the remote collection code not being closely coupled with each collector. Some examples include:

  • The RBAC code added. Everywhere else in the codebase this is implemented on a specific type. This code just feels out of place in this implementation, but to be fair, because the same pod is created for each collector its not as dynamic as the other code for standard in-cluster collectors needs to be. We essentially always verify the same permissions(Can I create a Pod/ConfigMap?)
  • Host Collector file paths are being derived somewhat arbitrarily. Because this code isn't tightly coupled with each collector, the way the file path in the bundle is being determined is by taking the filename for the collector result, splitting it into directory and filename, inserting the node name between them, and then saving that. For example, host-collector/system/cpu.json becomes host-collector/system/node-name/cpu.json. This works, for now, but again feels strange, and not sure we'll want to do this longterm. Especially since some collector like run have the ability to completely change which file path they use.

TODO

  • Needs Tests

Checklist

  • New and existing tests pass locally with introduced changes.
  • Tests for the changes have been added (for bug fixes / features)
  • The commit message(s) are informative and highlight any breaking changes
  • Any documentation required has been added/updated. For changes to https://troubleshoot.sh/ create a PR here

Does this PR introduce a breaking change?

  • Yes
  • No

@diamonwiggins diamonwiggins marked this pull request as ready for review October 6, 2024 13:44
@diamonwiggins diamonwiggins requested a review from a team as a code owner October 6, 2024 13:44
…:replicatedhq/troubleshoot into diamonwiggins/refactor-remote-collectors
@diamonwiggins diamonwiggins added the type::feature New feature or request label Oct 6, 2024
pkg/supportbundle/collect.go Show resolved Hide resolved
pkg/collect/host_collector.go Outdated Show resolved Hide resolved
pkg/collect/host_collector.go Outdated Show resolved Hide resolved
@xavpaice xavpaice merged commit 8105fa0 into main Oct 9, 2024
27 checks passed
@xavpaice xavpaice deleted the diamonwiggins/refactor-remote-collectors branch October 9, 2024 05:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type::feature New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants