Skip to content

OCPBUGS-64626: fix the files in pvc getting overwritten on each MG run#324

Open
praveencodes wants to merge 2 commits intoopenshift:masterfrom
praveencodes:OCPBUGS-64626
Open

OCPBUGS-64626: fix the files in pvc getting overwritten on each MG run#324
praveencodes wants to merge 2 commits intoopenshift:masterfrom
praveencodes:OCPBUGS-64626

Conversation

@praveencodes
Copy link
Contributor

OCPBUGS-64626:

  • Updated subPath with subPathExpr to use $(POD_NAME)

  • Added the conditional env variable POD_NAME to both gather and upload containers mount the same PVC-backed output volume using volumeMount.subPathExpr.

  • Added a new example CR examples/mustgather_with_pvc_subpath.yaml showing how to configure PVC storage with subPath.

  • Updated unit + e2e tests and refreshed related comments to match the new behavior.

@openshift-ci-robot openshift-ci-robot added jira/severity-moderate Referenced Jira bug's severity is moderate for the branch this PR is targeting. jira/valid-reference Indicates that this PR references a valid Jira ticket of any type. labels Feb 6, 2026
@openshift-ci-robot
Copy link

@praveencodes: This pull request references Jira Issue OCPBUGS-64626, which is invalid:

  • expected the bug to target the "4.22.0" version, but no target version was set

Comment /jira refresh to re-evaluate validity if changes to the Jira bug are made, or edit the title of this pull request to link to a different bug.

The bug has been updated to refer to the pull request using the external bug tracker.

Details

In response to this:

OCPBUGS-64626:

  • Updated subPath with subPathExpr to use $(POD_NAME)

  • Added the conditional env variable POD_NAME to both gather and upload containers mount the same PVC-backed output volume using volumeMount.subPathExpr.

  • Added a new example CR examples/mustgather_with_pvc_subpath.yaml showing how to configure PVC storage with subPath.

  • Updated unit + e2e tests and refreshed related comments to match the new behavior.

Instructions 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 openshift-eng/jira-lifecycle-plugin repository.

@openshift-ci-robot openshift-ci-robot added the jira/invalid-bug Indicates that a referenced Jira bug is invalid for the branch this PR is targeting. label Feb 6, 2026
@coderabbitai
Copy link

coderabbitai bot commented Feb 6, 2026

No actionable comments were generated in the recent review. 🎉


Walkthrough

This change adds pod-scoped subpath handling for PVC storage in the must-gather controller. New functions compute SubPathExpr from PVC subPaths with pod name placeholders and inject POD_NAME environment variables. Container construction is updated to use SubPathExpr, and storage information is propagated through templates. Tests and example manifests are added for PVC scenarios.

Changes

Cohort / File(s) Summary
PVC SubPath Logic
controllers/mustgather/template.go
Introduces outputSubPathExpr() function to compute SubPathExpr from PVC SubPath with pod name placeholder; introduces podNameEnvVars() to expose POD_NAME environment variable. Updates getGatherContainer() and getUploadContainer() to use SubPathExpr instead of direct SubPath and conditionally inject POD_NAME env vars. Adds storage parameter to getUploadContainer() signature.
Test Coverage
controllers/mustgather/template_test.go, test/e2e/must_gather_operator_test.go
Adds test cases for PVC SubPath behavior (empty, whitespace, slash-only values) in gather and upload container tests. Updates assertions to verify SubPathExpr computation and POD_NAME environment variable injection. Modifies e2e test to validate SubPathExpr instead of direct SubPath.
Manifest Files
deploy/must-gather-pvc.yaml, examples/mustgather_with_pvc_subpath.yaml
Adds new PersistentVolumeClaim manifest for must-gather-pvc (5Gi, ReadWriteOnce). Adds example MustGather resource demonstrating PVC-backed storage with subPath configuration.
Dependencies
go.mod
Updates module dependencies to support new functionality.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

✨ Finishing Touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

Tip

Issue Planner is now in beta. Read the docs and try it out! Share your feedback on Discord.


Comment @coderabbitai help to get the list of available commands and usage tips.

@praveencodes
Copy link
Contributor Author

/cc @shivprakashmuley @swghosh

@openshift-ci
Copy link
Contributor

openshift-ci bot commented Feb 6, 2026

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: praveencodes
Once this PR has been reviewed and has the lgtm label, please assign bergmannf for approval. For more information see the Code Review Process.

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@codecov-commenter
Copy link

codecov-commenter commented Feb 6, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 59.80%. Comparing base (2ba0426) to head (28d43fd).

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #324      +/-   ##
==========================================
+ Coverage   58.56%   59.80%   +1.24%     
==========================================
  Files           8        8              
  Lines         806      831      +25     
==========================================
+ Hits          472      497      +25     
  Misses        322      322              
  Partials       12       12              
Files with missing lines Coverage Δ
controllers/mustgather/template.go 90.82% <100.00%> (+1.12%) ⬆️
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@openshift-merge-robot openshift-merge-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Feb 11, 2026
@openshift-merge-robot openshift-merge-robot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Feb 19, 2026
@openshift-ci
Copy link
Contributor

openshift-ci bot commented Feb 19, 2026

@praveencodes: The following tests failed, say /retest to rerun all failed tests or /retest-required to rerun all mandatory failed tests:

Test name Commit Details Required Rerun command
ci/prow/lint 28d43fd link true /test lint
ci/prow/validate-boilerplate 28d43fd link false /test validate-boilerplate

Full PR test history. Your PR dashboard.

Details

Instructions 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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

jira/invalid-bug Indicates that a referenced Jira bug is invalid for the branch this PR is targeting. jira/severity-moderate Referenced Jira bug's severity is moderate for the branch this PR is targeting. jira/valid-reference Indicates that this PR references a valid Jira ticket of any type.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants