Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

e2e: refactor FilterNonRestartablePods function #127071

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
Loading
from

Conversation

bouaouda-achraf
Copy link
Contributor

@bouaouda-achraf bouaouda-achraf commented Sep 2, 2024

/kind cleanup
/kind e2e

What this PR does / why we need it:

  • Refactors and renames the FilterNonRestartablePods function to FilterNonRecreatablePods to better reflect its purpose of filtering out pods that will not be recreated if deleted after termination.
  • Adds a safeguard in the isPodNotRecreatedIfDeleted function by introducing a condition to exclude naked pods (those not managed by a controller) from being considered for recreation after deletion ( mirror (static) pods are handled separately).

Which issue(s) this PR fixes:

*Automatically closes linked issue when PR is merged.
Usage: `Fixes #109703.

Fixes #

Special notes for your reviewer:

Does this PR introduce a user-facing change?

NONE

@k8s-ci-robot k8s-ci-robot added release-note Denotes a PR that will be considered when it comes time to generate release notes. kind/cleanup Categorizes issue or PR as related to cleaning up code, process, or technical debt. size/S Denotes a PR that changes 10-29 lines, ignoring generated files. labels Sep 2, 2024
@k8s-ci-robot
Copy link
Contributor

@bouaouda-achraf: The label(s) kind/e2e cannot be applied, because the repository doesn't have them.

In response to this:

/kind cleanup
/kind e2e

What this PR does / why we need it:

refactor FilterNonRestartablePods function

Which issue(s) this PR fixes:

*Automatically closes linked issue when PR is merged.
#109703

Fixes #

Special notes for your reviewer:

Does this PR introduce a user-facing change?

no

refactor FilterNonRestartablePods function and add naked pod condition

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-sigs/prow repository.

@k8s-ci-robot k8s-ci-robot added 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-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels Sep 2, 2024
@k8s-ci-robot
Copy link
Contributor

Hi @bouaouda-achraf. 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-sigs/prow repository.

@k8s-ci-robot k8s-ci-robot added needs-priority Indicates a PR lacks a `priority/foo` label and requires one. area/e2e-test-framework Issues or PRs related to refactoring the kubernetes e2e test framework area/test sig/cloud-provider Categorizes an issue or PR as relevant to SIG Cloud Provider. 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 Sep 2, 2024
@bouaouda-achraf
Copy link
Contributor Author

/sig node
/sig testing

@k8s-ci-robot k8s-ci-robot added the sig/node Categorizes an issue or PR as relevant to SIG Node. label Sep 2, 2024
@kannon92
Copy link
Contributor

kannon92 commented Sep 4, 2024

/ok-to-test

@k8s-ci-robot k8s-ci-robot added ok-to-test Indicates a non-member PR verified by an org member that is safe to test. and removed needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels Sep 4, 2024
@kannon92
Copy link
Contributor

kannon92 commented Sep 4, 2024

/cc @tallclair

As you posted the issue, can you check if this resolves your concerns?

@bouaouda-achraf
Copy link
Contributor Author

/retest-required

@bouaouda-achraf
Copy link
Contributor Author

bouaouda-achraf commented Sep 19, 2024

/cc @bart0sh
Adding on the loop

@SergeyKanzhelev
Copy link
Member

Release notes as written do not make sense. Relnotes needs to be useful for end user, not for k8s developer. Please rephrase.

Also it seems that there will be a change in behavior, but I didn't dig into what behavior will change. If we change any behavior, it needs to be tested and explained.

@k8s-ci-robot k8s-ci-robot added release-note-none Denotes a PR that doesn't merit a release note. and removed release-note Denotes a PR that will be considered when it comes time to generate release notes. labels Oct 8, 2024
@bouaouda-achraf bouaouda-achraf force-pushed the 109703-Review-FilterNonRestartablePods branch from 12d8cef to fb2a88a Compare October 11, 2024 09:35
@k8s-ci-robot k8s-ci-robot added size/L Denotes a PR that changes 100-499 lines, ignoring generated files. and removed size/S Denotes a PR that changes 10-29 lines, ignoring generated files. labels Oct 11, 2024
@bouaouda-achraf
Copy link
Contributor Author

@SergeyKanzhelev , I have updated the release notes and the PR description. Additionally, I’ve added tests covering different cases.

@k8s-triage-robot
Copy link

The Kubernetes project currently lacks enough contributors to adequately respond to all PRs.

This bot triages PRs according to the following rules:

  • After 90d of inactivity, lifecycle/stale is applied
  • After 30d of inactivity since lifecycle/stale was applied, lifecycle/rotten is applied
  • After 30d of inactivity since lifecycle/rotten was applied, the PR is closed

You can:

  • Mark this PR as fresh with /remove-lifecycle stale
  • Close this PR with /close
  • Offer to help out with Issue Triage

Please send feedback to sig-contributor-experience at kubernetes/community.

/lifecycle stale

@k8s-ci-robot k8s-ci-robot added the lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. label Jan 9, 2025
@SergeyKanzhelev
Copy link
Member

/triage accepted
/priority backlog
/remove-lifecycle stale

@k8s-ci-robot k8s-ci-robot added triage/accepted Indicates an issue or PR is ready to be actively worked on. priority/backlog Higher priority than priority/awaiting-more-evidence. and removed lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. 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 Jan 22, 2025
@SergeyKanzhelev
Copy link
Member

/assign

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

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Feb 12, 2025
// Check if the pod is a mirror pod
if _, ok := p.Annotations[v1.MirrorPodAnnotationKey]; !ok {
return false
func isPodNotRecreatedIfDeleted(p *v1.Pod) bool {
Copy link
Member

Choose a reason for hiding this comment

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

nit: avoid "not" in function names. Better to invert the logic and call this isPodRecreatedIfDeleted

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yep , fixed

if !isMirrorPod {
// normal pod will be recreated if deleted (managed by the controller)
// naked pod will not be recreated
return len(p.OwnerReferences) == 0
Copy link
Member

Choose a reason for hiding this comment

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

I don't think job pods are recreated if deleted?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

A condition has been added to check if the pod was created by a Job

// Mirror pods with restart policy != v1.RestartPolicyAlways will not get
// recreated if they are deleted after the pods have
// terminated. For now, we discount such pods.
// https://github.com/kubernetes/kubernetes/issues/34003
Copy link
Member

Choose a reason for hiding this comment

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

A static pod without RestartPolicyAlways doesn't make any sense to me. Maybe reference #130288 instead?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yep , fixed

@SergeyKanzhelev SergeyKanzhelev moved this from PRs - Needs Reviewer to PRs - Needs Approver in SIG Node CI/Test Board Mar 5, 2025
@SergeyKanzhelev
Copy link
Member

/lgtm cancel
/approve cancel

to follow up on @tallclair 's comments.

@k8s-ci-robot k8s-ci-robot removed the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Mar 19, 2025
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: bouaouda-achraf
Once this PR has been reviewed and has the lgtm label, please assign justinsb, sataqiu for approval. For more information see the Code Review Process.

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

@SergeyKanzhelev SergeyKanzhelev moved this from PRs - Needs Approver to PRs Waiting on Author in SIG Node CI/Test Board Mar 19, 2025
@bouaouda-achraf bouaouda-achraf force-pushed the 109703-Review-FilterNonRestartablePods branch from fb2a88a to cbd48a3 Compare April 6, 2025 13:36
@bouaouda-achraf
Copy link
Contributor Author

/retest-required

@haircommander haircommander moved this from PRs Waiting on Author to PRs - Needs Reviewer in SIG Node CI/Test Board Apr 30, 2025
@haircommander
Copy link
Contributor

/assign @tallclair

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/e2e-test-framework Issues or PRs related to refactoring the kubernetes e2e test framework area/test cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. kind/cleanup Categorizes issue or PR as related to cleaning up code, process, or technical debt. ok-to-test Indicates a non-member PR verified by an org member that is safe to test. priority/backlog Higher priority than priority/awaiting-more-evidence. release-note-none Denotes a PR that doesn't merit a release note. sig/cloud-provider Categorizes an issue or PR as relevant to SIG Cloud Provider. sig/node Categorizes an issue or PR as relevant to SIG Node. 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. triage/accepted Indicates an issue or PR is ready to be actively worked on.
Projects
Status: PRs - Needs Reviewer
Development

Successfully merging this pull request may close these issues.

[E2E] Review FilterNonRestartablePods
7 participants
Morty Proxy This is a proxified and sanitized view of the page, visit original site.