You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: keps/sig-node/4960-container-stop-signals/README.md
+14-6Lines changed: 14 additions & 6 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -65,21 +65,22 @@ Items marked with (R) are required *prior to targeting to a milestone / release*
65
65
66
66
## Summary
67
67
68
-
Container runtimes let you define a STOPSIGNAL to let your container images change which signal is delivered to kill the container. Currently you can only configure this by defining STOPSIGNAL in the container image definition file before you build the image. This becomes difficult to change when you’re using prebuilt images. This KEP proposes to add support to configure custom stop signals for containers from the ContainerSpec. Kubernetes has no equivalent for STOPSIGNAL as part of Pod or Container APIs. This KEP proposes to add support to configure custom stop signals for containers from the ContainerSpec.
68
+
Container runtimes let you define a [STOPSIGNAL](https://docs.docker.com/reference/dockerfile/#stopsignal) to let your container images change which signal is delivered to kill the container. Currently you can only configure this by defining STOPSIGNAL in the container image definition file before you build the image. This becomes difficult to change when you’re using prebuilt images. This KEP proposes to add support to configure custom stop signals for containers from the ContainerSpec. Kubernetes has no equivalent for STOPSIGNAL as part of Pod or Container APIs. This KEP proposes to add support to configure custom stop signals for containers from the ContainerSpec.
69
69
70
70
## Motivation
71
71
72
-
Container runtimes like Docker lets you configure the stop signal with which a container would be killed when you start a container. This can be configured either from the container image definition file itself with the STOPSIGNAL instruction or by using the `--stop-signal` flag when starting a container with the respective CLI tool for your runtime. Currently there is no equivalent to this in the Kubernetes APIs.
72
+
Container runtimes like Docker let you configure the stop signal with which a container would be killed when you start a container. This can be configured either from the container image definition file itself with the STOPSIGNAL instruction or by using the `--stop-signal` flag when starting a container with the respective CLI tool for your runtime. Currently there is no equivalent to this in the Kubernetes APIs.
73
73
74
74
While managing containers with Kubernetes, if you want to customize an existing image by changing its predefined stop signal or override the default stop signal of SIGTERM, currently you would have to rebuild the container image and update the stop signal at the image definition level.
75
75
76
-
Having stop signal as a first class citizen in the container specification would make it easier for users to set custom stop signals for their containers across all types of workloads.
76
+
Having stop signal as a first class citizen in the Pod's container specification would make it easier for users to set custom stop signals for their containers across all types of workloads.
77
77
78
78
### Goals
79
79
80
80
- Add a new StopSignal field to ContainerSpec
81
81
- Update the CRI API to take StopSignal as a field in the StopContainerRequest and pass it down to the container runtime via the StopContainer method of remoteRuntimeService
82
-
- Update StopContainer implementation in container runtimes to use the container’s StopSignal, if defined as the stop signal when killing containers.
82
+
- Update StopContainer implementation in container runtimes to use the container’s StopSignal, if defined as the stop signal when killing containers
83
+
- Add support for sending stop signal as a parameter with the `crictl stop` command
83
84
84
85
### Non-Goals
85
86
@@ -151,7 +152,7 @@ Kubernetes by default sends a SIGTERM to all containers while killing them. When
151
152
152
153
### Risks and Mitigations
153
154
154
-
I don't see any issues with adding a new field for the stop signal because this is an optional feature that users.
155
+
I don't see any issues with adding a new field for the stop signal because this is an optional feature.
155
156
156
157
## Design Details
157
158
@@ -185,19 +186,26 @@ Alpha:
185
186
186
187
- Test that containers are killed with the right stop signal when StopSignal is passed
187
188
- Test that containers are killed with SIGTERM when no StopSignal is passed
189
+
- Test that the Status returns the correct StopSignal in all the following cases:
190
+
- When StopSignal is defined in the Container Spec (Status should have signal is defined in the Spec)
191
+
- When StopSignal is only defined in the container image (Status should have the signal defined in the image)
192
+
- When no StopSignal is defined (StopSignal in Status should be SIGTERM)
193
+
- Test that the StopSignal is gracefully degraded when StopSignal is specifed but the container runtime is on a version that doesn't support the implementation
194
+
- Test that the feature is gracefully degraded when StopSignal is not supported in Kubelet but is supported in the container runtime
188
195
189
196
### Graduation Criteria
190
197
191
198
#### Alpha
192
199
193
200
- Feature implemented behind a feature flag
194
201
- CRI API implementation completed in containerd marked as experimental
202
+
- CRI API implementation completed for CRI-O
195
203
- Initial e2e tests completed and enabled, testing the feature against containerd
196
204
- Unit tests for validation, e2e tests for version skew
0 commit comments