mirror of
https://github.com/containers/podman.git
synced 2025-10-16 10:43:52 +08:00
Merge pull request #26491 from ArthurWuTW/25389
Pod YAML: Add support for `lifecycle.stopSignal`
This commit is contained in:
@ -1331,6 +1331,13 @@ type Lifecycle struct {
|
||||
// More info: https://kubernetes.io/docs/concepts/containers/container-lifecycle-hooks/#container-hooks
|
||||
// +optional
|
||||
PreStop *Handler `json:"preStop,omitempty"`
|
||||
// StopSignal defines the signal to be sent to the container when stopping.
|
||||
// This value is configured via the container's Lifecycle and overrides any
|
||||
// stop signal defined in the container image. If no StopSignal is specified,
|
||||
// the default signal (SIGTERM) will be used.
|
||||
// More info: https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle/#defining-custom-stop-signals
|
||||
// +optional
|
||||
StopSignal *string `json:"stopSignal,omitempty"`
|
||||
}
|
||||
|
||||
type ConditionStatus string
|
||||
|
@ -656,6 +656,14 @@ func ToSpecGen(ctx context.Context, opts *CtrSpecGenOptions) (*specgen.SpecGener
|
||||
s.StopTimeout = &timeout
|
||||
}
|
||||
|
||||
if lifecycle := opts.Container.Lifecycle; lifecycle != nil && lifecycle.StopSignal != nil {
|
||||
stopSignal, err := util.ParseSignal(*lifecycle.StopSignal)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
s.StopSignal = &stopSignal
|
||||
}
|
||||
|
||||
return s, nil
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user