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
Modified subpath configmap mount fails when container restarts #89629
Conversation
Hi @fatedier. Thanks for your PR. I'm waiting for a kubernetes member to verify that this patch is reasonable to test. If it is, they should reply with Once the patch is verified, the new status will be reflected by the I understand the commands that are listed here. 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/test-infra repository. |
/assign @saad-ali |
/retest |
The test case It seems that |
I'm open to changing that behavior to be consistent with configmap/secret update behavior. cc @jsafrane @kevtaylor for thoughts. I think the only consideration is that it's a conformance test so we would have to intentionally break it. There's probably a process for it. |
So the idea was always to preserve the original file mount when the container might fail and not restart on a new host location. If someone did alter the environment value in between you could consider this is quite an edge case and potentially intentional change, so relaxing it doesn't seem drastic. |
/assign @johnbelamaric |
/lgtm Thank you! Can you also add a release note, that this fixes an issue with container restarts using a modified configmap or secret subpath volume mount? |
/assign @johnbelamaric |
/approve |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: fatedier, johnbelamaric, msau42 The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
/priority important-soon |
/retest |
2 similar comments
/retest |
/retest |
/test pull-kubernetes-e2e-kind |
…-upstream-release-1.18 Automated cherry pick of #89629: fix 68211: modified subpath configmap mount fails when
…d subpath configmap mount fails when"
…ick-of-#89629-upstream-release-1.18 Revert "Automated cherry pick of #89629: fix 68211: modified subpath configmap mount fails when"
The e2e test started to flake: #100194 |
if err != nil { | ||
return false, "", fmt.Errorf("error calling findMountInfo for %s: %s", bindPathTarget, err) | ||
} | ||
if mntInfo.Root != subpath.Path { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
in my env, /proc/self/mountinfo
like this ,
523 47 253:16 /kubelet/pods/d166411c-ea15-11eb-abc8-525400f80eae/volumes/kubernetes.io~configmap/extra-cfg/..2021_07_21_11_21_39.969349293/extra.ini /data/kubelet/pods/d166411c-ea15-11eb-abc8-525400f80eae/volume-subpaths/extra-cfg/test/0 rw,noatime shared:29 - xfs /dev/vdb rw,attr2,inode64,prjquota
mntInfo.Root is /kubelet/pods/d166411c-ea15-11eb-abc8-525400f80eae/volumes/kubernetes.io~configmap/extra-cfg/..2021_07_21_11_21_39.969349293/extra.ini
is always not equal subpath.Path
because miss /data
prefix.
kubelet root path in /data
/dev/vdb 1000G 11G 989G 2% /data
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@fatedier
I tested it . If kubelet mounts an extra data disk, it will cause the missing prefix of mntInfo.Root
What type of PR is this?
/kind bug
What this PR does / why we need it:
When a container uses a configmap which is mounted with the subPath option, the configmap is changed and then the container (but not the pod) restarts the mounting of the configmap fails.
Since #82784 is not active and not rebased, i submit this PR to continue this work or someone can provide another solution?
Which issue(s) this PR fixes:
Fixes #68211
Special notes for your reviewer:
Does this PR introduce a user-facing change?:
Additional documentation e.g., KEPs (Kubernetes Enhancement Proposals), usage docs, etc.: