Skip to content

Conversation

@ruiwen-zhao
Copy link
Member

@ruiwen-zhao ruiwen-zhao commented Feb 4, 2022

This is part of the support of In-place Pod Vertical Scaling feature.

This PR handles an extension to the ContainerStatus CRI API and returns the Resources field as part of the response message to ContainerStatus API.

This PR also adds a fake container.Container for the purpose of unit testing. (I am not entirely sure which dir I should put the fake_container.go, so happy to take some suggestion on that)

See kubernetes/kubernetes#107911 for more details.

Note that this PR is still WIP and blocked by:
a) CRI changes in kubernetes/kubernetes#102884, which adds Resources field to ContainerStatus, and
b) containerd updating cri-api version.

@ruiwen-zhao ruiwen-zhao marked this pull request as draft February 4, 2022 23:41
@k8s-ci-robot
Copy link

Hi @ruiwen-zhao. Thanks for your PR.

I'm waiting for a containerd 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.

Details

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.

Copy link
Member

@mikebrow mikebrow left a comment

Choose a reason for hiding this comment

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

see comments

@ruiwen-zhao ruiwen-zhao force-pushed the return-resource branch 3 times, most recently from f1c6dbb to b404a27 Compare June 9, 2022 23:59
@ruiwen-zhao ruiwen-zhao force-pushed the return-resource branch 3 times, most recently from de9d960 to 063f0fe Compare June 27, 2022 22:01
@mikebrow
Copy link
Member

/ok-to-test

@mikebrow
Copy link
Member

mikebrow commented Jul 5, 2022

@ruiwen-zhao looking good just some cleanup now I think..

@ruiwen-zhao
Copy link
Member Author

@ruiwen-zhao looking good just some cleanup now I think..

Thanks Mike! I just updated the case of CPU (i.e. CpuPeriod -> CPUPeriod) to try to appease linter check. But since this PR is based on a manually copied CRI API proto, Project Checks will probably still fail.

One more thing that I need some input: there is a new field rootfs_size_in_bytes under WindowsContainerResources [1], which was added to CRI API proto 4 months ago. Looking at containerd, I don't think containerd supports this yet [2]. I am going to leave this field out of the scope of this PR, and probably I should go create a separate issue to support that in containerd?

[1] https://github.com/kubernetes/kubernetes/blob/master/staging/src/k8s.io/cri-api/pkg/apis/runtime/v1/api.proto#L912

[2] https://github.com/containerd/containerd/blob/main/pkg/cri/opts/spec_windows.go#L179

@ruiwen-zhao
Copy link
Member Author

Another thing I missed and just found out is that UpdateContainerResources now needs to write the updated status onto disk, because with this change container status will be modified after UpdateContainerResources and therefore needs to be written on disk. See my most recent change in this PR [1].

[1] https://github.com/containerd/containerd/pull/6517/files#diff-20c3b4bac3cd2c386c84613ee18867ef77e6496ed0001672795c325707a954e8R48

@samuelkarp samuelkarp added the area/cri Container Runtime Interface (CRI) label Jul 18, 2022
@ruiwen-zhao ruiwen-zhao marked this pull request as ready for review July 18, 2022 20:34
@ruiwen-zhao ruiwen-zhao changed the title [WIP] ContainerStatus to return container resources ContainerStatus to return container resources Jul 18, 2022
@mikebrow
Copy link
Member

good catch on the sync to store of status now that it holds spec updates, otherwise on restart...

yes pls, on opening a new issue for windows cri for the new field!

@ruiwen-zhao
Copy link
Member Author

ruiwen-zhao commented Aug 8, 2022

/cc @samuelkarp

@ruiwen-zhao ruiwen-zhao force-pushed the return-resource branch 3 times, most recently from 30251b0 to ab50753 Compare August 9, 2022 23:17
Copy link
Member

@mikebrow mikebrow left a comment

Choose a reason for hiding this comment

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

just the one question / nit really .. should we use the cri definition of container resources containing one of linux or windows resources as defined in cri... (probably z, mac, .. others later on) or should we keep our version in containerd sandboxed containers as a mirror but separately defined... Wiling to go either way as I see benefits to either.. but if we keep separate we should at least document in the code the desire to keep them in sync over disparate spans.

@ruiwen-zhao
Copy link
Member Author

/retest

@ruiwen-zhao ruiwen-zhao force-pushed the return-resource branch 2 times, most recently from ebaa0f8 to 963c65c Compare August 24, 2022 17:19
Signed-off-by: ruiwen-zhao <ruiwen@google.com>
Copy link
Member

@mikebrow mikebrow left a comment

Choose a reason for hiding this comment

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

LGTM on green

@samuelkarp samuelkarp merged commit 36d0cfd into containerd:main Aug 24, 2022
@samuelkarp samuelkarp added this to the 1.7 milestone Aug 30, 2022
@mikebrow mikebrow modified the milestones: 1.7, 1.6.9 Sep 20, 2022
@mikebrow
Copy link
Member

modified this to be in service milestone per discussions at community meeting for putting in certain lower risk / higher priority features into service, if the 1.7 release schedule continues moving right..

@mikebrow
Copy link
Member

if needs discussion we can yank the cherry tag

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/cri Container Runtime Interface (CRI) cherry-picked/1.6.x PR commits are cherry-picked into release/1.6 branch impact/changelog ok-to-test

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants