fix(collector): only declare hostPath volumes when needed (LOG-9713) - #3387
Conversation
Move hostPath volume declarations for audit, journal, OVN, and API server logs inside the same input-source conditions that already control the volumeMounts. This prevents unnecessary hostPath access on collectors Signed-off-by: Vitalii Parfonov <vparfono@redhat.com>
📝 WalkthroughWalkthroughThe collector now adds DaemonSet hostPath volumes only for enabled application, infrastructure, audit, Kubernetes, OpenShift, OAuth, and OVN sources. The pod-spec test provides the corresponding input specifications. ChangesConditional volume wiring
Estimated code review effort: 2 (Simple) | ~10 minutes 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
PR Summary by QodoCollector: gate hostPath volume declarations on enabled input sources
AI Description
Diagram
High-Level Assessment
Files changed (2)
|
There was a problem hiding this comment.
🧹 Nitpick comments (1)
internal/collector/collector_test.go (1)
80-84: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winAdd a negative volume-selection test.
This fixture enables every hostPath group. Empty
Infrastructure.SourcesandAudit.Sourcesmean all sources. The existing test therefore checks only the positive case. A regression that restores unconditional hostPath volumes could still pass.Add cases with no inputs and with selected source lists. Assert that both
podSpec.Volumesandcollector.VolumeMountsomit disabled source names.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@internal/collector/collector_test.go` around lines 80 - 84, Extend the collector volume-selection tests around the existing Inputs fixture with cases for no inputs and explicitly selected infrastructure/audit sources. Assert that disabled source names are absent from both podSpec.Volumes and collector.VolumeMounts, while preserving coverage for enabled sources.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Nitpick comments:
In `@internal/collector/collector_test.go`:
- Around line 80-84: Extend the collector volume-selection tests around the
existing Inputs fixture with cases for no inputs and explicitly selected
infrastructure/audit sources. Assert that disabled source names are absent from
both podSpec.Volumes and collector.VolumeMounts, while preserving coverage for
enabled sources.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Enterprise
Run ID: f453f819-2aae-4ff4-927d-5571b52a6cd7
📒 Files selected for processing (2)
internal/collector/collector.gointernal/collector/collector_test.go
Code Review by Qodo🐞 Bugs (0) 📘 Rule violations (0) 📎 Requirement gaps (0)
Great, no issues found!Qodo reviewed your code and found no material issues that require reviewTo customize comments, go to the Qodo configuration screen, or learn more in the docs. |
|
@vparfonov: The following test failed, say
Full PR test history. Your PR dashboard. DetailsInstructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. I understand the commands that are listed here. |
|
/approve |
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: jcantrill, vparfonov The full list of commands accepted by this bot can be found here. The pull request process is described here DetailsNeeds approval from an approver in each of these files:
Approvers can indicate their approval by writing |
03eee53
into
openshift:master
Description
/cc @Clee2691
/assign @jcantrill
Links
Summary by CodeRabbit