Skip to content
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

Merged
merged 3 commits into from Jul 9, 2020

Conversation

fatedier
Copy link
Contributor

@fatedier fatedier commented Mar 29, 2020

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?:

Fix an issue with container restarts using a modified configmap or secret subpath volume mount.

Additional documentation e.g., KEPs (Kubernetes Enhancement Proposals), usage docs, etc.:


@k8s-ci-robot k8s-ci-robot added release-note-none Denotes a PR that doesn't merit a release note. kind/bug Categorizes issue or PR as related to a bug. size/S Denotes a PR that changes 10-29 lines, ignoring generated files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. needs-sig Indicates an issue or PR lacks a `sig/foo` label and requires one. needs-priority Indicates a PR lacks a `priority/foo` label and requires one. needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels Mar 29, 2020
@k8s-ci-robot
Copy link
Contributor

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 /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

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.

@k8s-ci-robot k8s-ci-robot added sig/storage Categorizes an issue or PR as relevant to SIG Storage. and removed needs-sig Indicates an issue or PR lacks a `sig/foo` label and requires one. labels Mar 29, 2020
@fatedier
Copy link
Contributor Author

/assign @saad-ali

@msau42
Copy link
Member

msau42 commented Jun 16, 2020

/ok-to-test
/assign @msau42 @jsafrane

@k8s-ci-robot k8s-ci-robot added the ok-to-test Indicates a non-member PR verified by an org member that is safe to test. label Jun 16, 2020
@k8s-ci-robot k8s-ci-robot added needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. and removed needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels Jun 16, 2020
@k8s-ci-robot k8s-ci-robot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Jun 16, 2020
@fatedier
Copy link
Contributor Author

/retest

@fatedier
Copy link
Contributor Author

The test case Variable Expansion should not change the subpath mount on a container restart if the environment variable changes failed with this change.

It seems that SubPathExpr rely on this to ensure subpath mount not changed on a container restart. I'm not sure if it's appropriate.

@msau42
Copy link
Member

msau42 commented Jun 16, 2020

It seems that SubPathExpr rely on this to ensure subpath mount not changed on a container restart. I'm not sure if it's appropriate.

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.

@kevtaylor
Copy link
Contributor

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.

@msau42
Copy link
Member

msau42 commented Jun 16, 2020

/assign @johnbelamaric
for conformance test question. Basically, this test case was enforcing a bit of a corner case to begin with. I can't think of a strong reason why we would want this current behavior, especially as we see this behavior as problematic for other volume types (not part of conformance atm)

@fatedier fatedier requested a review from msau42 July 6, 2020 11:48
@msau42
Copy link
Member

msau42 commented Jul 7, 2020

/lgtm
/approve

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?

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Jul 7, 2020
@msau42
Copy link
Member

msau42 commented Jul 7, 2020

/assign @johnbelamaric
for removal of conformance test

@k8s-ci-robot k8s-ci-robot added release-note Denotes a PR that will be considered when it comes time to generate release notes. and removed release-note-none Denotes a PR that doesn't merit a release note. labels Jul 7, 2020
@johnbelamaric
Copy link
Member

/approve

@k8s-ci-robot
Copy link
Contributor

[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 /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@k8s-ci-robot k8s-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Jul 8, 2020
@msau42
Copy link
Member

msau42 commented Jul 8, 2020

/priority important-soon

@k8s-ci-robot k8s-ci-robot added priority/important-soon Must be staffed and worked on either currently, or very soon, ideally in time for the next release. and removed needs-priority Indicates a PR lacks a `priority/foo` label and requires one. labels Jul 8, 2020
@msau42
Copy link
Member

msau42 commented Jul 8, 2020

/retest

2 similar comments
@msau42
Copy link
Member

msau42 commented Jul 9, 2020

/retest

@fatedier
Copy link
Contributor Author

fatedier commented Jul 9, 2020

/retest

@fatedier
Copy link
Contributor Author

fatedier commented Jul 9, 2020

/test pull-kubernetes-e2e-kind

@k8s-ci-robot k8s-ci-robot merged commit d9b084a into kubernetes:master Jul 9, 2020
@k8s-ci-robot k8s-ci-robot added this to the v1.19 milestone Jul 9, 2020
k8s-ci-robot added a commit that referenced this pull request Aug 2, 2020
…-upstream-release-1.18

Automated cherry pick of #89629: fix 68211: modified subpath configmap mount fails when
msau42 added a commit to msau42/kubernetes that referenced this pull request Aug 4, 2020
k8s-ci-robot added a commit that referenced this pull request Aug 12, 2020
…ick-of-#89629-upstream-release-1.18

Revert "Automated cherry pick of #89629: fix 68211: modified subpath configmap mount fails when"
@verult
Copy link
Contributor

verult commented Apr 3, 2021

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 {
Copy link

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

Copy link

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

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. area/conformance Issues or PRs related to kubernetes conformance tests area/test cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. kind/bug Categorizes issue or PR as related to a bug. lgtm "Looks good to me", indicates that a PR is ready to be merged. ok-to-test Indicates a non-member PR verified by an org member that is safe to test. priority/important-soon Must be staffed and worked on either currently, or very soon, ideally in time for the next release. release-note Denotes a PR that will be considered when it comes time to generate release notes. sig/architecture Categorizes an issue or PR as relevant to SIG Architecture. sig/storage Categorizes an issue or PR as relevant to SIG Storage. sig/testing Categorizes an issue or PR as relevant to SIG Testing. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

modified subpath configmap mount fails when container restarts
9 participants