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

pod.spec.terminationGracePeriodSeconds is a negative then convert to 1 #115606

Merged

Conversation

wzshiming
Copy link
Member

@wzshiming wzshiming commented Feb 8, 2023

What type of PR is this?

/kind feature

What this PR does / why we need it:

It's been 4 releases since it was allowed to change from negative to 1, so I think it's time to just set it to the default conversion

Which issue(s) this PR fixes:

Continue #98866
xref #103476

Special notes for your reviewer:

Does this PR introduce a user-facing change?

Pods which have an invalid negative `spec.terminationGracePeriodSeconds` value will be treated as having terminationGracePeriodSeconds of 1

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

NONE

@k8s-ci-robot k8s-ci-robot added kind/feature Categorizes issue or PR as related to a new feature. size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. 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. labels Feb 8, 2023
@k8s-ci-robot k8s-ci-robot added sig/apps Categorizes an issue or PR as relevant to SIG Apps. 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 Feb 8, 2023
@wzshiming
Copy link
Member Author

/assign @liggitt

@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 Feb 8, 2023
@liggitt liggitt added this to Assigned in API Reviews Feb 8, 2023
@liggitt liggitt moved this from Assigned to In progress in API Reviews Feb 16, 2023
@@ -306,6 +307,9 @@ func Convert_core_PodSpec_To_v1_PodSpec(in *core.PodSpec, out *v1.PodSpec, s con
out.HostUsers = in.SecurityContext.HostUsers
}

Copy link
Member

Choose a reason for hiding this comment

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

This change will affect all objects that contain PodSpec (like deployments, replicasets, etc).

Can we scope this change to only pod objects (move this to Convert_v1_Pod_To_core_Pod / Convert_core_Pod_To_v1_Pod)

For non-pod objects, adding a warning to warningsForPodSpecAndMeta for negative TerminationGracePeriodSeconds (like "negative spec.terminationGracePeriodSeconds values are invalid and will be treated as a value of 1") would avoid breaking those controllers while still surfacing the issue with their request or manifest

Copy link
Member

Choose a reason for hiding this comment

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

Along with those changes, we need test coverage of behavior when creating and updating a pod

Copy link
Member Author

Choose a reason for hiding this comment

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

Done

@liggitt liggitt moved this from In progress to Changes requested in API Reviews Feb 16, 2023
@wzshiming wzshiming force-pushed the fix/termination_grace_period_seconds branch from f321e73 to ee4c7f8 Compare February 20, 2023 03:08
@k8s-ci-robot k8s-ci-robot added size/S Denotes a PR that changes 10-29 lines, ignoring generated files. and removed size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. labels Feb 20, 2023
@wzshiming wzshiming force-pushed the fix/termination_grace_period_seconds branch 2 times, most recently from c81f6d4 to 7c6cf05 Compare February 20, 2023 04:00
@k8s-ci-robot k8s-ci-robot added size/L Denotes a PR that changes 100-499 lines, ignoring generated files. area/test sig/node Categorizes an issue or PR as relevant to SIG Node. sig/testing Categorizes an issue or PR as relevant to SIG Testing. and removed size/S Denotes a PR that changes 10-29 lines, ignoring generated files. labels Feb 20, 2023
@wzshiming wzshiming force-pushed the fix/termination_grace_period_seconds branch from 7c6cf05 to 2f2466f Compare February 20, 2023 04:11
@wzshiming wzshiming force-pushed the fix/termination_grace_period_seconds branch from 95a7639 to e0be725 Compare February 22, 2023 05:35
@wzshiming wzshiming force-pushed the fix/termination_grace_period_seconds branch from e0be725 to b70d137 Compare February 22, 2023 05:36
@wzshiming
Copy link
Member Author

Done

@liggitt liggitt moved this from Changes requested to Assigned in API Reviews Feb 22, 2023
@liggitt liggitt moved this from Assigned to In progress in API Reviews Feb 22, 2023
@bart0sh
Copy link
Contributor

bart0sh commented Feb 23, 2023

/triage accepted
/priority important-longterm

@bart0sh bart0sh moved this from Triage to Needs Reviewer in SIG Node PR Triage Feb 23, 2023
@k8s-ci-robot k8s-ci-robot added triage/accepted Indicates an issue or PR is ready to be actively worked on. priority/important-longterm Important over the long term, but may not be staffed and/or may need multiple releases to complete. release-note Denotes a PR that will be considered when it comes time to generate release notes. 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. release-note-none Denotes a PR that doesn't merit a release note. labels Feb 23, 2023
@liggitt
Copy link
Member

liggitt commented Feb 23, 2023

/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 23, 2023
@liggitt liggitt moved this from In progress to API review completed, 1.27 in API Reviews Feb 23, 2023
@k8s-ci-robot
Copy link
Contributor

LGTM label has been added.

Git tree hash: f9a2d3a9c15e86c64f154bad89cd406f7bbdf3e4

@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: liggitt, wzshiming

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 Feb 23, 2023
@k8s-ci-robot k8s-ci-robot merged commit aa98f6f into kubernetes:master Feb 23, 2023
SIG Node PR Triage automation moved this from Needs Reviewer to Done Feb 23, 2023
@k8s-ci-robot k8s-ci-robot added this to the v1.27 milestone Feb 23, 2023
@thockin
Copy link
Member

thockin commented Feb 23, 2023

Won't this potentially cause apply-loops? If that changed value gets stored, it's not what the user sent, so they could retry and retry and retry..

Admittedly, it's rare to use Pod directly, so limited impact, but I don't think this is a pattern we can follow elsewhere?

@liggitt
Copy link
Member

liggitt commented Feb 23, 2023

I don't think this is a pattern we can follow elsewhere?

Not without a lot of hard thinking, yeah. It's certainly easier to reason about on pods only, which is why I asked it to be scoped to that at #115606 (comment)

PodSpecs are 99% immutable, and fields are defaulted by API defaulting or mutating webhooks, so apply loops are not ~ever going to work on pods

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-longterm Important over the long term, but may not be staffed and/or may need multiple releases to complete. release-note Denotes a PR that will be considered when it comes time to generate release notes. sig/apps Categorizes an issue or PR as relevant to SIG Apps. 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: API review completed, 1.27
Archived in project
Development

Successfully merging this pull request may close these issues.

None yet

5 participants