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

KEP-1967: promote size backed memory volumes to stable #126981

Merged
merged 2 commits into from
Oct 29, 2024

Conversation

kannon92
Copy link
Contributor

What type of PR is this?

/kind feature

What this PR does / why we need it:

Promote KEP-1967 to stable.

Which issue(s) this PR fixes:

Fixes #

Special notes for your reviewer:

Does this PR introduce a user-facing change?

Promote SizeMemoryBackedVolumes to stable

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


@k8s-ci-robot k8s-ci-robot added release-note Denotes a PR that will be considered when it comes time to generate release notes. size/M Denotes a PR that changes 30-99 lines, ignoring generated files. kind/feature Categorizes issue or PR as related to a new feature. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. do-not-merge/needs-sig Indicates an issue or PR lacks a `sig/foo` label and requires one. needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. needs-priority Indicates a PR lacks a `priority/foo` label and requires one. labels Aug 28, 2024
@kannon92
Copy link
Contributor Author

/hold

This is dependent on the KEP outcome.

@k8s-ci-robot k8s-ci-robot added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Aug 28, 2024
@k8s-ci-robot k8s-ci-robot requested review from dims and saad-ali August 28, 2024 20:47
@k8s-ci-robot k8s-ci-robot added area/test sig/node Categorizes an issue or PR as relevant to SIG Node. sig/storage Categorizes an issue or PR as relevant to SIG Storage. sig/testing Categorizes an issue or PR as relevant to SIG Testing. and removed do-not-merge/needs-sig Indicates an issue or PR lacks a `sig/foo` label and requires one. labels Aug 28, 2024
@kannon92
Copy link
Contributor Author

/triage accepted
/priority important-soon

@k8s-ci-robot k8s-ci-robot added triage/accepted Indicates an issue or PR is ready to be actively worked on. priority/important-soon Must be staffed and worked on either currently, or very soon, ideally in time for the next release. and removed needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. needs-priority Indicates a PR lacks a `priority/foo` label and requires one. labels Aug 28, 2024
@kannon92 kannon92 force-pushed the stable-empty-dir-promotion branch from a36c6bb to de67d25 Compare August 30, 2024 00:48
@k8s-ci-robot k8s-ci-robot added size/L Denotes a PR that changes 100-499 lines, ignoring generated files. and removed size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Aug 30, 2024
@kannon92
Copy link
Contributor Author

/retest

1 similar comment
@kannon92
Copy link
Contributor Author

/retest

@k8s-ci-robot k8s-ci-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Sep 4, 2024
@kannon92 kannon92 force-pushed the stable-empty-dir-promotion branch from de67d25 to ee07a3f Compare September 11, 2024 16:42
@k8s-ci-robot k8s-ci-robot added size/M Denotes a PR that changes 30-99 lines, ignoring generated files. and removed size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Sep 11, 2024
@thockin
Copy link
Member

thockin commented Oct 13, 2024

What happens if the container crashes and is restarted?

I don't really understand how this is related to this feature. What exactly are you concerned about? This feature uses cgroup of the container to set a max memory limit. I don't see how that would be impacted by restarts.

IIUC A write to tmpfs creates dirty anonymous pages (can't be flushed to disk for reclaim) attributed to the container's cgroup. If that cgroup were to get torn down for any reason, those pages are still anonymous and dirty, so they get accounted by the next-parent cgroup (I think?). If this happens, you can imagine a situation where the container tries to restart and immediately OOMs because those tmpfs files are accounted to the pod.

What I am asking is whether we have thought through those sorts of failure modes. Do we ever tear down the container cgroup? Are we confident that the accounting stays with the container? If you all say we are satisfied with the testing of that, I'm satisfied, but I wanted to call it out as an area where I know there are traps :)

@kannon92 kannon92 force-pushed the stable-empty-dir-promotion branch from bdaebb4 to d667b7c Compare October 14, 2024 12:47
// Enables kubelet support to size memory backed volumes
SizeMemoryBackedVolumes featuregate.Feature = "SizeMemoryBackedVolumes"
SizeMemoryBackedVolumes featuregate.Feature = "SizeMemoryBackedVolumes" // remove in 1.35
Copy link
Member

Choose a reason for hiding this comment

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

can you please add a comment saying that this FG is only used in kubelet and not needed for emulated version so in couple releases it will be easier to understand that we can just remove it

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I will do this tonight or tomorrow.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done.

@kannon92
Copy link
Contributor Author

@thockin
As far as I can tell, we are not using pod c groups to track memory. I looked into the pod cgroup of a pod to see if we report memory cgroup settings for the containers. I don’t think we use the chorus for tracking (memory.current is set to 0 even though container memory.current is nonzero). Memory.max for pods was set to max.

So I don’t think we are tracking anything in the pod c group.

Copy link
Member

@SergeyKanzhelev SergeyKanzhelev left a comment

Choose a reason for hiding this comment

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

/lgtm
/approve

I think we resolved all the questions here.

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Oct 16, 2024
@k8s-ci-robot
Copy link
Contributor

LGTM label has been added.

Git tree hash: c83d2e73530fa93baacae24f1164c091409c09a3

@k8s-ci-robot k8s-ci-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Oct 16, 2024
@kannon92 kannon92 force-pushed the stable-empty-dir-promotion branch from 4eb7301 to b690c4f Compare October 16, 2024 21:15
@k8s-ci-robot k8s-ci-robot removed the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Oct 16, 2024
@k8s-ci-robot k8s-ci-robot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Oct 16, 2024
@kannon92
Copy link
Contributor Author

/retest

@kannon92
Copy link
Contributor Author

@thockin I asked @ndixita her thoughts on the pod tracking. This is not a concern because we haven't been using placing tracking information into the pod cgroup.

What I am asking is whether we have thought through those sorts of failure modes. Do we ever tear down the container cgroup? Are we confident that the accounting stays with the container? If you all say we are satisfied with the testing of that, I'm satisfied, but I wanted to call it out as an area where I know there are traps :)

I took this item because of its long outstanding status as a beta feature (quote is from you).

This gate has been Beta since 1.22 - is there any reason not to just set it to GA? Seems like something any contributor can do to score some brownie points, and since it has been beta so long, I doubt we can change any behavior, even if we want to?

I am paraphrasing you here but this feature has been in beta on since 1.22. At this stage, I think any new issue related to emptyDir and tmpfs should be considered separate from this issue. This feature was about setting a size limit to node allocatable or pod limit. It didn't change anything around how the cgroups are tracked from container restarts. I think the feature works as intended and we have e2e tests that verify the limits.

@kannon92
Copy link
Contributor Author

@thockin

What happens if the container has requests: {memory: 1Gi}, limits: {memory: 1Gi} and the volume has a size-limit of 2Gi ? If I write to the volume, can I cause the pod to fail to start?

#128339

Yes. It looks like if a container hits an OOM limit with tmpfs than it will be stuck in an error state. I don't think this feature introduced this though.

@SergeyKanzhelev
Copy link
Member

Even if we want to say that memory backed volume must have limit set and it must be lower than container limit, we will not be able to enforce it on API side without breaking existing Pods.

So the only option would be for kubelet to override the memory-backed volume size limit to the container's limit (when defined). This may help. But it also will not guarantee we out of the "OOMLoopBackoff" as code bootstrap can be quite memory-heavy.

I would see this as to be outside of the KEP scope, but it can be a good future enhancement. @thockin do you agree?

Copy link
Member

@thockin thockin left a comment

Choose a reason for hiding this comment

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

Thanks for doing the homework. I know how baroque some of the corner-cases are.

@thockin
Copy link
Member

thockin commented Oct 28, 2024

Thanks!

/lgtm
/approve

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Oct 28, 2024
@k8s-ci-robot
Copy link
Contributor

LGTM label has been added.

Git tree hash: 475bc53422b98905d0504291c826b62bd334a5a3

@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: kannon92, SergeyKanzhelev, thockin

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 Oct 28, 2024
@k8s-ci-robot k8s-ci-robot merged commit 685b8b3 into kubernetes:master Oct 29, 2024
20 checks passed
@k8s-ci-robot k8s-ci-robot added this to the v1.32 milestone Oct 29, 2024
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/test cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. kind/feature Categorizes issue or PR as related to a new feature. lgtm "Looks good to me", indicates that a PR is ready to be merged. 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/node Categorizes an issue or PR as relevant to SIG Node. 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/M Denotes a PR that changes 30-99 lines, ignoring generated files. triage/accepted Indicates an issue or PR is ready to be actively worked on.
Development

Successfully merging this pull request may close these issues.

6 participants