-
Notifications
You must be signed in to change notification settings - Fork 40k
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
API changes for client-initiated termination reason #45504
Conversation
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: yguo0905 Assign the PR to them by writing
Needs approval from an approver in each of these OWNERS Files:
You can indicate your approval by writing |
f931492
to
b1b6e4d
Compare
b1b6e4d
to
c1003f2
Compare
@@ -160,7 +160,7 @@ func TestDefaulting(t *testing.T) { | |||
if !expectedChanged || changedOnce { | |||
break | |||
} | |||
if iter > 300 { | |||
if iter > 500 { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why this change?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The test generated 300 objects, which were enough to cover all the fields with default values. Since this change added nested fields to Lifecycle
, we now need more permutations to be generated for the test objects in order to ensure that the additional fields with default values are covered. This happened before in #39181. I will create a separate issue for a real fix.
pkg/api/types.go
Outdated
@@ -1595,6 +1595,45 @@ type Handler struct { | |||
TCPSocket *TCPSocketAction | |||
} | |||
|
|||
// DeleteExecAction describes a "run in container" action that will be invoked | |||
// inside of a container prior to sending the TERM signal to the container's |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note that now that #45236 has merged, the PID namespace is shared by default. I don't know that saying it sends TERM to the container's entrypoint makes sense any more. WDYT?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you please elaborate on what the shared PID namespace implies here? How does it relate to the termination procedure?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It means that if you have a pod with multiple containers, the PID namespace is shared among all the containers. Before this change, each container's PID 1 was its entrypoint, and if you killed PID 1 in a single container, that container would die, but the other containers in the pod would be unaffected. With a shared PID namespace, PID 1 is owned by the pod sandbox (is that the right terminology @derekwaynecarr?), and each container's entrypoint has some unique PID other than 1. If you kill PID 1 in the shared PID namespace, you will bring down all the containers for that pod.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks. So the issue here is the "entrypoint"? Removed it in the latest commit.
pkg/api/types.go
Outdated
@@ -1595,6 +1595,45 @@ type Handler struct { | |||
TCPSocket *TCPSocketAction | |||
} | |||
|
|||
// DeleteExecAction describes a "run in container" action that will be invoked |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since the type is DeleteExecAction do you want to say that it describes an "exec in container" action?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The Delete
indicates it's an ExecAction
plus a deletion reason string. Made it clear in the comment.
pkg/api/types.go
Outdated
ReasonHeader string | ||
} | ||
|
||
// PreStopHandler invokes either a DeleteExecAction, a DeleteHTTPGetAction or a |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
comma after DeleteHTTPGetAction
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
pkg/api/types.go
Outdated
|
||
// PreStopHandler invokes either a DeleteExecAction, a DeleteHTTPGetAction or a | ||
// TCPSocketAction prior to the graceful termination of a Pod. One and only one | ||
// of the fields should be specified. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
s/should/may/
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
pkg/api/v1/meta.go
Outdated
@@ -51,6 +51,9 @@ func (meta *ObjectMeta) GetDeletionGracePeriodSeconds() *int64 { return meta.Del | |||
func (meta *ObjectMeta) SetDeletionGracePeriodSeconds(deletionGracePeriodSeconds *int64) { | |||
meta.DeletionGracePeriodSeconds = deletionGracePeriodSeconds | |||
} | |||
func (meta *ObjectMeta) GetDeletionReason() string { return "" } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are these supposed to be left unimplemented?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think so. The ObjectMeta
in pkg/api/v1/meta.go
is deprecated and we add the two function here to make it satisfy the interface.
pkg/api/validation/validation.go
Outdated
allErrors := field.ErrorList{} | ||
if handler.Exec != nil { | ||
if numHandlers > 0 { | ||
allErrors = append(allErrors, field.Forbidden(fldPath.Child("exec"), "may not specify more than 1 handler type")) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure how you'd ever hit this
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removed this condition.
pkg/kubelet/pleg/generic.go
Outdated
@@ -186,8 +186,6 @@ func (g *GenericPLEG) relist() { | |||
} | |||
|
|||
timestamp := g.clock.Now() | |||
// Update the relist time. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why did you move this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this is a mistake introduced during rebase.
7516887
to
49b2b83
Compare
/unassign |
49b2b83
to
1974104
Compare
@yguo0905: The following tests failed, say
Full PR test history. Your PR dashboard. Please help us cut down on flakes by linking to an open issue when you hit one in your PR. 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. I understand the commands that are listed here. |
1974104
to
c82fa55
Compare
@yguo0905 PR needs rebase |
@yguo0905 Do we need this for 1.9? please rebase if so. |
[MILESTONENOTIFIER] Milestone Removed From Pull Request @dchen1107 @derekwaynecarr @yguo0905 @yujuhong Important: This pull request was missing labels required for the v1.9 milestone for more than 3 days: kind: Must specify exactly one of |
Issues go stale after 90d of inactivity. If this issue is safe to close now please do so with Send feedback to sig-testing, kubernetes/test-infra and/or fejta. |
Stale issues rot after 30d of inactivity. If this issue is safe to close now please do so with Send feedback to sig-testing, kubernetes/test-infra and/or fejta. |
/do-not-merge |
Rotten issues close after 30d of inactivity. Send feedback to sig-testing, kubernetes/test-infra and/or fejta. |
What this PR does / why we need it:
This PR contains the API changes for kubernetes/community#541.
Special notes for your reviewer:
The logic that generates and delivers the termination reason in kubectl and kubelet will be in separate PRs.
Release note: