Repository navigation
fix: Avoid endless Deployment updates when mounting Secrets/ConfigMaps as subpath - #2227
Conversation
…s as subpath Iterate over Secret/ConfigMap data keys in sorted order when mounting them as subpath, so the generated VolumeMounts are stable across reconciles and do not trigger repeated Deployment rollouts. Also: - keep the existing ImagePullPolicy unless the image or policy is overridden - initialize nil resource lists before applying resource overrides - list Secrets/ConfigMaps in the CheCluster namespace via ClientWrapper - reuse listed objects instead of re-fetching them for env mounts Fixes eclipse-che/che#23988 Assisted-by: Claude Opus 5.5 Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: Anatolii Bazko <[email protected]>
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 16 minutes. View limit details
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
🐳 New images available:
|
|
Hi! I'm che-ai-assistant — I help with your pull requests. I check for new comments every 10m0s, so there may be a short delay before I respond. Available commands:
|
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: akurinnoy, tolusha The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
What does this PR do?
Fixes a reconciliation loop where Deployments (e.g.
che-dashboard) are updated over and over, creating many ReplicaSets, when a Secret or ConfigMap is mounted withcontroller.devfile.io/mount-as: subpathand holds more than one key.Root cause:
MountSecrets/MountConfigMapsiterated overData(a Go map) in random order, so the generatedVolumeMountsorder changed between reconciles. The diff then reported a change and the operator updated the Deployment each time.Changes in
pkg/deploy/deployment.go:Datakeys in sorted order when mounting as subpath, soVolumeMountsare stable (main fix).envmount: use the listed object directly instead of fetching it again.ClientWrapperandcheCtx.Context.OverrideContainer: keep the existingImagePullPolicyunless the image or the pull policy is overridden. This avoids flipping the policy on every sync.OverrideContainer: create nilRequests/Limitsmaps before applying resource overrides, so it no longer panics on a nil map.Screenshot/screencast of this PR
N/A
What issues does this PR fix or reference?
Fixes eclipse-che/che#23988
How to test this PR?
OpenShift
on Minikube
kubectl delete pod -n eclipse-che -l app.kubernetes.io/component=che-dashboard).kubectl get rs -n eclipse-che -l app.kubernetes.io/component=che-dashboard), and that the operator logs show no repeatedVolumeMountsdiffs forche-dashboard.Unit tests:
make test(addsTestMountAsSubpathShouldSortVolumeMounts,TestOverrideContainerResourcesWhenNotSet,TestOverrideContainerImagePullPolicy).Common Test Scenarios
PR Checklist
As the author of this Pull Request I made sure that:
Reviewers
Reviewers, please comment how you tested the PR when approving it.
🤖 Generated with Claude Code