api changes

This commit is contained in:
AxeZhan 2023-08-18 13:20:52 +08:00
parent 8e8ac86cf1
commit 9327f3a173
3 changed files with 29 additions and 0 deletions

View File

@ -2150,6 +2150,12 @@ type ExecAction struct {
Command []string Command []string
} }
// SleepAction describes a "sleep" action.
type SleepAction struct {
// Seconds is the number of seconds to sleep.
Seconds int64
}
// Probe describes a health check to be performed against a container to determine whether it is // Probe describes a health check to be performed against a container to determine whether it is
// alive or ready to receive traffic. // alive or ready to receive traffic.
type Probe struct { type Probe struct {
@ -2432,6 +2438,10 @@ type LifecycleHandler struct {
// lifecycle hooks will fail in runtime when tcp handler is specified. // lifecycle hooks will fail in runtime when tcp handler is specified.
// +optional // +optional
TCPSocket *TCPSocketAction TCPSocket *TCPSocketAction
// Sleep represents the duration that the container should sleep before being terminated.
// +featureGate=PodLifecycleSleepAction
// +optional
Sleep *SleepAction
} }
type GRPCAction struct { type GRPCAction struct {

View File

@ -636,6 +636,13 @@ const (
// Adds pod.status.hostIPs and downward API // Adds pod.status.hostIPs and downward API
PodHostIPs featuregate.Feature = "PodHostIPs" PodHostIPs featuregate.Feature = "PodHostIPs"
// owner: @AxeZhan
// kep: http://kep.k8s.io/3960
// alpha: v1.29
//
// Enables SleepAction in container lifecycle hooks
PodLifecycleSleepAction featuregate.Feature = "PodLifecycleSleepAction"
// owner: @Huang-Wei // owner: @Huang-Wei
// kep: https://kep.k8s.io/3521 // kep: https://kep.k8s.io/3521
// alpha: v1.26 // alpha: v1.26
@ -1063,6 +1070,8 @@ var defaultKubernetesFeatureGates = map[featuregate.Feature]featuregate.FeatureS
PodHostIPs: {Default: false, PreRelease: featuregate.Alpha}, PodHostIPs: {Default: false, PreRelease: featuregate.Alpha},
PodLifecycleSleepAction: {Default: false, PreRelease: featuregate.Alpha},
PodSchedulingReadiness: {Default: true, PreRelease: featuregate.Beta}, PodSchedulingReadiness: {Default: true, PreRelease: featuregate.Beta},
ProbeTerminationGracePeriod: {Default: true, PreRelease: featuregate.GA, LockToDefault: true}, // remove in 1.29 ProbeTerminationGracePeriod: {Default: true, PreRelease: featuregate.GA, LockToDefault: true}, // remove in 1.29

View File

@ -2272,6 +2272,12 @@ type ExecAction struct {
Command []string `json:"command,omitempty" protobuf:"bytes,1,rep,name=command"` Command []string `json:"command,omitempty" protobuf:"bytes,1,rep,name=command"`
} }
// SleepAction describes a "sleep" action.
type SleepAction struct {
// Seconds is the number of seconds to sleep.
Seconds int64 `json:"seconds" protobuf:"bytes,1,opt,name=seconds"`
}
// Probe describes a health check to be performed against a container to determine whether it is // Probe describes a health check to be performed against a container to determine whether it is
// alive or ready to receive traffic. // alive or ready to receive traffic.
type Probe struct { type Probe struct {
@ -2667,6 +2673,10 @@ type LifecycleHandler struct {
// lifecycle hooks will fail in runtime when tcp handler is specified. // lifecycle hooks will fail in runtime when tcp handler is specified.
// +optional // +optional
TCPSocket *TCPSocketAction `json:"tcpSocket,omitempty" protobuf:"bytes,3,opt,name=tcpSocket"` TCPSocket *TCPSocketAction `json:"tcpSocket,omitempty" protobuf:"bytes,3,opt,name=tcpSocket"`
// Sleep represents the duration that the container should sleep before being terminated.
// +featureGate=PodLifecycleSleepAction
// +optional
Sleep *SleepAction `json:"sleep,omitempty" protobuf:"bytes,4,opt,name=sleep"`
} }
// Lifecycle describes actions that the management system should take in response to container lifecycle // Lifecycle describes actions that the management system should take in response to container lifecycle