Skip to content

🐛 OCPBUGS-76380: fix(deploymentConfig): merge volumes/volumeMounts by name instead of appending#2582

Merged
openshift-merge-bot[bot] merged 1 commit intooperator-framework:mainfrom
camilamacedo86:fix-duplicate
Mar 24, 2026
Merged

🐛 OCPBUGS-76380: fix(deploymentConfig): merge volumes/volumeMounts by name instead of appending#2582
openshift-merge-bot[bot] merged 1 commit intooperator-framework:mainfrom
camilamacedo86:fix-duplicate

Conversation

@camilamacedo86
Copy link
Contributor

@camilamacedo86 camilamacedo86 commented Mar 20, 2026

Problem
When a ClusterExtension’s deploymentConfig defined volumes or volumeMounts with names that already existed in the bundle’s CSV deployment, the implementation would simply append them. This caused duplicate entries with identical names, which is invalid in Kubernetes since volume and volumeMount names must be unique within a pod spec.

Solution
Switch from a naive append approach to a merge-by-name strategy. If a volume or volumeMount from the deploymentConfig matches an existing one by name, it replaces the original entry instead of creating a duplicate. Entries with new names are appended as usual.

This PR implements the same behvaiour of OLMv0 , see:

Example

Before (on main) — append causes duplicates (INVALID)

volumes:
  - name: "data-vol"
    emptyDir: {}
  - name: "data-vol"        # DUPLICATE! Kubernetes rejects this.
    configMap:
      name: "my-configmap"

volumeMounts:
  - name: "data-vol"
    mountPath: "/old/path"
  - name: "data-vol"        # DUPLICATE!
    mountPath: "/new/path"

After (this fix) — merge-by-name overrides (VALID)

volumes:
  - name: "data-vol"        # Overridden in place by the config value
    configMap:
      name: "my-configmap"

volumeMounts:
  - name: "data-vol"        # Overridden in place
    mountPath: "/new/path"

Motivated by: https://redhat.atlassian.net/browse/OCPBUGS-76380

Copilot AI review requested due to automatic review settings March 20, 2026 14:41
@netlify
Copy link

netlify bot commented Mar 20, 2026

Deploy Preview for olmv1 ready!

Name Link
🔨 Latest commit 6b57386
🔍 Latest deploy log https://app.netlify.com/projects/olmv1/deploys/69c16cf33ece1500089b8a60
😎 Deploy Preview https://deploy-preview-2582--olmv1.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@camilamacedo86 camilamacedo86 changed the title 🐛 fix(deploymentConfig): merge volumes/volumeMounts by name instead of appending 🐛 OCPBUGS-76380: fix(deploymentConfig): merge volumes/volumeMounts by name instead of appending Mar 20, 2026
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR updates the operator-controller’s DeploymentConfig rendering logic to merge volumes and volumeMounts by name (overriding existing entries) rather than blindly appending, aligning behavior with legacy OLM injection semantics. It also adds unit and e2e coverage around the expected volume/volumeMount application.

Changes:

  • Change DeploymentConfig rendering to merge volumes and volumeMounts by name (override on collision).
  • Add unit tests verifying override-vs-append behavior for volumes and volumeMounts.
  • Add an e2e scenario intended to validate that configured volumes/volumeMounts appear on the operator Deployment.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.

File Description
test/e2e/features/install.feature Adds an e2e scenario asserting DeploymentConfig volumes/volumeMounts are applied.
internal/operator-controller/rukpak/render/registryv1/generators/generators_test.go Adds unit tests to validate merge behavior for volumes and volumeMounts.
internal/operator-controller/rukpak/render/registryv1/generators/generators.go Implements merge-by-name logic for volumes and volumeMounts and wires it into DeploymentConfig application.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@codecov
Copy link

codecov bot commented Mar 20, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 67.78%. Comparing base (a307a6d) to head (6b57386).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2582      +/-   ##
==========================================
+ Coverage   65.84%   67.78%   +1.94%     
==========================================
  Files         137      137              
  Lines        9560     9574      +14     
==========================================
+ Hits         6295     6490     +195     
+ Misses       2795     2585     -210     
- Partials      470      499      +29     
Flag Coverage Δ
e2e 38.10% <0.00%> (+26.91%) ⬆️
experimental-e2e 50.95% <0.00%> (-0.12%) ⬇️
unit 52.87% <100.00%> (+0.06%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copilot AI review requested due to automatic review settings March 23, 2026 13:19
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 2 out of 2 changed files in this pull request and generated 4 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copy link
Contributor

@pedjak pedjak left a comment

Choose a reason for hiding this comment

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

/lgtm

@openshift-ci openshift-ci bot added the lgtm Indicates that a PR is ready to be merged. label Mar 23, 2026
@tmshort
Copy link
Contributor

tmshort commented Mar 24, 2026

/approve

@openshift-ci openshift-ci bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Mar 24, 2026
Copy link
Member

@rashmigottipati rashmigottipati left a comment

Choose a reason for hiding this comment

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

/lgtm

@openshift-ci
Copy link

openshift-ci bot commented Mar 24, 2026

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: rashmigottipati, tmshort

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

The pull request process is described 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

@openshift-merge-bot openshift-merge-bot bot merged commit 627ce43 into operator-framework:main Mar 24, 2026
26 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved Indicates a PR has been approved by an approver from all required OWNERS files. lgtm Indicates that a PR is ready to be merged.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants