Merge pull request #130556 from sreeram-venkitesh/kep-4960-container-stop-signals

KEP 4960: Container Stop Signals

Kubernetes-commit: ff25881bc1fe9da1dda4ec82d294b92078ae2763
This commit is contained in:
Kubernetes Publisher 2025-03-24 16:36:32 -07:00
commit e359642e7c
5 changed files with 33 additions and 5 deletions

View File

@ -39,6 +39,7 @@ type ContainerStatusApplyConfiguration struct {
VolumeMounts []VolumeMountStatusApplyConfiguration `json:"volumeMounts,omitempty"`
User *ContainerUserApplyConfiguration `json:"user,omitempty"`
AllocatedResourcesStatus []ResourceStatusApplyConfiguration `json:"allocatedResourcesStatus,omitempty"`
StopSignal *corev1.Signal `json:"stopSignal,omitempty"`
}
// ContainerStatusApplyConfiguration constructs a declarative configuration of the ContainerStatus type for use with
@ -168,3 +169,11 @@ func (b *ContainerStatusApplyConfiguration) WithAllocatedResourcesStatus(values
}
return b
}
// WithStopSignal sets the StopSignal field in the declarative configuration to the given value
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
// If called multiple times, the StopSignal field is set to the value of the last call.
func (b *ContainerStatusApplyConfiguration) WithStopSignal(value corev1.Signal) *ContainerStatusApplyConfiguration {
b.StopSignal = &value
return b
}

View File

@ -18,11 +18,16 @@ limitations under the License.
package v1
import (
corev1 "k8s.io/api/core/v1"
)
// LifecycleApplyConfiguration represents a declarative configuration of the Lifecycle type for use
// with apply.
type LifecycleApplyConfiguration struct {
PostStart *LifecycleHandlerApplyConfiguration `json:"postStart,omitempty"`
PreStop *LifecycleHandlerApplyConfiguration `json:"preStop,omitempty"`
PostStart *LifecycleHandlerApplyConfiguration `json:"postStart,omitempty"`
PreStop *LifecycleHandlerApplyConfiguration `json:"preStop,omitempty"`
StopSignal *corev1.Signal `json:"stopSignal,omitempty"`
}
// LifecycleApplyConfiguration constructs a declarative configuration of the Lifecycle type for use with
@ -46,3 +51,11 @@ func (b *LifecycleApplyConfiguration) WithPreStop(value *LifecycleHandlerApplyCo
b.PreStop = value
return b
}
// WithStopSignal sets the StopSignal field in the declarative configuration to the given value
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
// If called multiple times, the StopSignal field is set to the value of the last call.
func (b *LifecycleApplyConfiguration) WithStopSignal(value corev1.Signal) *LifecycleApplyConfiguration {
b.StopSignal = &value
return b
}

View File

@ -5330,6 +5330,9 @@ var schemaYAML = typed.YAMLObject(`types:
type:
namedType: io.k8s.api.core.v1.ContainerState
default: {}
- name: stopSignal
type:
scalar: string
- name: user
type:
namedType: io.k8s.api.core.v1.ContainerUser
@ -6045,6 +6048,9 @@ var schemaYAML = typed.YAMLObject(`types:
- name: preStop
type:
namedType: io.k8s.api.core.v1.LifecycleHandler
- name: stopSignal
type:
scalar: string
- name: io.k8s.api.core.v1.LifecycleHandler
map:
fields:

2
go.mod
View File

@ -25,7 +25,7 @@ require (
golang.org/x/time v0.9.0
google.golang.org/protobuf v1.36.5
gopkg.in/evanphx/json-patch.v4 v4.12.0
k8s.io/api v0.0.0-20250324212032-f9401a3a8005
k8s.io/api v0.0.0-20250325022028-118546df3998
k8s.io/apimachinery v0.0.0-20250319092800-e8a77bd768fd
k8s.io/klog/v2 v2.130.1
k8s.io/kube-openapi v0.0.0-20250318190949-c8a335a9a2ff

4
go.sum
View File

@ -146,8 +146,8 @@ gopkg.in/inf.v0 v0.9.1/go.mod h1:cWUDdTG/fYaXco+Dcufb5Vnc6Gp2YChqWtbxRZE0mXw=
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
k8s.io/api v0.0.0-20250324212032-f9401a3a8005 h1:M2eL3JOyPe7U39v/efK58x2RpYv+MYfUS1lRbSrxDhk=
k8s.io/api v0.0.0-20250324212032-f9401a3a8005/go.mod h1:JO0tyTI0qSXXaGVhLdqwfi3RMbS2g9hcYvzBmZP5wVk=
k8s.io/api v0.0.0-20250325022028-118546df3998 h1:Q9cW2ZmeYMoE64u1/4EfbuhwuGzGUUQSdW1dx3FZYUs=
k8s.io/api v0.0.0-20250325022028-118546df3998/go.mod h1:JO0tyTI0qSXXaGVhLdqwfi3RMbS2g9hcYvzBmZP5wVk=
k8s.io/apimachinery v0.0.0-20250319092800-e8a77bd768fd h1:KoXgjwEokLM8o95kMxowg5vp5iQ4v46Kk+zobsqeTgU=
k8s.io/apimachinery v0.0.0-20250319092800-e8a77bd768fd/go.mod h1:D2UW665TVSpInyOuG6C+PMtC1MZheP0KQz65UPQEiI4=
k8s.io/klog/v2 v2.130.1 h1:n9Xl7H1Xvksem4KFG4PYbdQCQxqc/tTUyrgXaOhHSzk=