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

Pass Pinned field to kubecontainer.Image #119986

Merged
merged 1 commit into from Aug 18, 2023

Conversation

ruiwen-zhao
Copy link
Contributor

@ruiwen-zhao ruiwen-zhao commented Aug 16, 2023

What type of PR is this?

/kind bug

What this PR does / why we need it:

#103299 added support for preventing GC on pinned images. However, it didn't pass the Pinned field from runtime's response to kubecontainer.Image. So when image_gc_manager calls

images, err := im.runtime.ListImages(ctx)

It will always get Pinned: false.

After this PR, with containerd 1.7.3, I verified that image gc manager can see images as pinned:

$ sudo journalctl -u kubelet | grep image_gc | grep pinned=true
Aug 17 17:58:00  kubelet[17433]: I0817 17:58:00.994176   17433 image_gc_manager.go:275] "Image ID is pinned" imageID="sha256:82fefae5c2805de53bbc7566532132fbfa98e685873b03691fbb743ff7a6aaad" pinned=true

Which issue(s) this PR fixes:

Fixes #

Special notes for your reviewer:

I will backport this to change to previous minor versions once this PR is approved.

Does this PR introduce a user-facing change?

Fixes the bug when images pinned by the container runtime can be garbage collected by kubelet

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


@k8s-ci-robot k8s-ci-robot added size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. kind/bug Categorizes issue or PR as related to a bug. do-not-merge/release-note-label-needed Indicates that a PR should not merge because it's missing one of the release note labels. 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 16, 2023
@ruiwen-zhao
Copy link
Contributor Author

/sig node

@k8s-ci-robot k8s-ci-robot added sig/node Categorizes an issue or PR as relevant to SIG Node. and removed do-not-merge/needs-sig Indicates an issue or PR lacks a `sig/foo` label and requires one. labels Aug 16, 2023
@ruiwen-zhao
Copy link
Contributor Author

/cc @pacoxu @endocrimes

@k8s-ci-robot k8s-ci-robot added release-note-none Denotes a PR that doesn't merit a release note. and removed do-not-merge/release-note-label-needed Indicates that a PR should not merge because it's missing one of the release note labels. labels Aug 16, 2023
@@ -111,6 +111,7 @@ func (m *kubeGenericRuntimeManager) ListImages(ctx context.Context) ([]kubeconta
RepoTags: img.RepoTags,
RepoDigests: img.RepoDigests,
Spec: toKubeContainerImageSpec(img),
Pinned: img.Pinned,
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we add a unit test for this?

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.

Signed-off-by: ruiwen-zhao <ruiwen@google.com>
@k8s-ci-robot k8s-ci-robot added size/M Denotes a PR that changes 30-99 lines, ignoring generated files. and removed size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. labels Aug 17, 2023
Copy link
Contributor

@samuelkarp samuelkarp left a comment

Choose a reason for hiding this comment

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

LGTM, thanks!

@bart0sh bart0sh added this to Triage in SIG Node PR Triage Aug 17, 2023
@bart0sh
Copy link
Contributor

bart0sh commented Aug 17, 2023

/retest

@bart0sh
Copy link
Contributor

bart0sh commented Aug 17, 2023

/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. labels Aug 17, 2023
@ruiwen-zhao
Copy link
Contributor Author

/cc @mrunalp

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

wow. How did we miss it =(

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

LGTM label has been added.

Git tree hash: ce1990e43b1b9982817d870072d4df115cbed23f

@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: mrunalp, ruiwen-zhao, samuelkarp, SergeyKanzhelev

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 Aug 18, 2023
@ruiwen-zhao
Copy link
Contributor Author

/retest

@SergeyKanzhelev
Copy link
Member

/release-note "Fixes the bug when images pinned by the container runtime can be garbage collected by kubelet"

@SergeyKanzhelev
Copy link
Member

/release-note-edit Fixes the bug when images pinned by the container runtime can be garbage collected by kubelet

@pacoxu
Copy link
Member

pacoxu commented Aug 28, 2023

/release-note-edit

Fixes the bug when images pinned by the container runtime can be garbage collected by kubelet

@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 Aug 28, 2023
k8s-ci-robot added a commit that referenced this pull request Aug 30, 2023
…#119986-upstream-release-1.28

Automated cherry pick of #119986: Pass Pinned field to kubecontainer.Image
k8s-ci-robot added a commit that referenced this pull request Aug 30, 2023
…#119986-upstream-release-1.26

Automated cherry pick of #119986: Pass Pinned field to kubecontainer.Image
k8s-ci-robot added a commit that referenced this pull request Aug 30, 2023
…#119986-upstream-release-1.25

Automated cherry pick of #119986: Pass Pinned field to kubecontainer.Image
k8s-ci-robot added a commit that referenced this pull request Aug 30, 2023
…#119986-upstream-release-1.27

Automated cherry pick of #119986: Pass Pinned field to kubecontainer.Image
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/kubelet 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. 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. 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.
Projects
Development

Successfully merging this pull request may close these issues.

None yet

7 participants