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
Windows: Fixes subpath volume persistance on container restart #92869
Conversation
045b499
to
a1e2074
Compare
Pods can have volume subpaths mounted inside the containers. Those subpaths can be based on expressions based on expanded environment variables, which can also be based on Pod annotations. Kubernetes expects that the mounted volume subpaths to remain consistent across container restarts even if the Pod annotation it was based on changed. This behaviour is checked by the E2E test "should not change the subpath mount on a container restart if the environment variable change" This test fails on Windows because the subpath itself is always mounted (which is based on the Pod Annotation), while on Linux, on the first first, the volume subpath is created and mounted under kubelet/pods/<uid>/volume-subpaths/<volume>/<container-name> and cached, then on restart, it is going to use the same mount path that already exists, keeping the same subpath mounted in the container. This commit addresses the issue on Windows, following a similar approach to the Linux implementation. Refactors some of the code, which can be used on both Linux and Windows.
a1e2074
to
bbc6d07
Compare
bbc6d07
to
da4c6b1
Compare
/cc @jsturtevant /sig-windows |
@adelina-t: GitHub didn't allow me to request PR reviews from the following users: jsturtevant. Note that only kubernetes members and repo collaborators can review this PR, and authors cannot review their own PRs. In response to this:
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. |
684947e
to
5836efb
Compare
@claudiubelu: PR needs rebase. 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. |
@claudiubelu: The following tests failed, say
Full PR test history. Your PR dashboard. Please help us cut down on flakes by linking to an open issue when you hit one in your PR. 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. I understand the commands that are listed here. |
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.
/lgtm
/approve
@ddebroy can you PTAL?
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: claudiubelu, michmike The full list of commands accepted by this bot can be found here.
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
/assign @jingxu97 |
I think this PR is no longer relevant due to #89629 which changed the behavior of mounting subpath's on restarts and removed this requirement from the conformance tests. @claudiubelu can you confirm? |
That is correct. The behaviour that this PR was adding is no longer valid in Kubernetes. The test that was verifying this behaviour was also removed in the PR mentioned above. Because of this, we no longer need this, we are already doing what is currently expected regarding volume subpaths on container restart. |
What type of PR is this?
/kind bug
/sig windows
/sig storage
/priority important-soon
What this PR does / why we need it:
Pods can have volume subpaths mounted inside the containers. Those subpaths can be based on expressions based on expanded environment variables, which can also be based on Pod annotations.
Kubernetes expects that the mounted volume subpaths to remain consistent across container restarts even if the Pod annotation it was based on changed. This behaviour is checked by the E2E test
should not change the subpath mount on a container restart if the environment variable change
.This test fails on Windows because the subpath itself is always mounted (which is based on the Pod Annotation), while on Linux, on the first first, the volume subpath is created and mounted under
kubelet/pods/<uid>/volume-subpaths/<volume>/<container-name>
and cached, then on restart, it is going to use the same mount path that already exists, keeping the same subpath mounted in the container.This commit addresses the issue on Windows, following a similar approach to the Linux implementation.
Refactors some of the code, which can be used on both Linux and Windows.
Which issue(s) this PR fixes:
Fixes #90336
Special notes for your reviewer:
Does this PR introduce a user-facing change?:
Additional documentation e.g., KEPs (Kubernetes Enhancement Proposals), usage docs, etc.: