Skip to content

Commit 28c62f6

Browse files
authored
Merge pull request kubernetes#2618 from verb/ec-1.22-pod-api
KEP-277: Use Pod for /ephemeralcontainers
2 parents f4124c7 + 20cf0f0 commit 28c62f6

File tree

1 file changed

+19
-12
lines changed
  • keps/sig-node/277-ephemeral-containers

1 file changed

+19
-12
lines changed

keps/sig-node/277-ephemeral-containers/README.md

Lines changed: 19 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -186,16 +186,24 @@ restrictions:
186186

187187
### Creating Ephemeral Containers
188188

189-
1. A client fetches the current list of Ephemeral Containers in a pod using
190-
`GetEphemeralContainers` in the generated client. This returns a
191-
`v1.EphemeralContainers` to which the client appends a new
192-
`EphemeralContainer` and then calls `UpdateEphemeralContainers`.
193-
1. The apiserver validates and performs the pod update, copying the new
194-
ephemeral container into `Pod.Spec.EphemeralContainers`.
189+
Ephemeral containers are described in the `EphemeralContainers` field of
190+
`Pod.Spec`. This must be updated using the `/ephemeralcontainers` subresource,
191+
similarly to updating `Pod.Status` via `/status`.
192+
193+
The end-to-end process for creating an ephemeral container is:
194+
195+
1. Fetch a `Pod` object from the `/pods` resource.
196+
1. Modify `spec.ephemeralContainers` and write it back to the Pod's
197+
`/ephemeralcontainers` subresource, for example using `UpdateEphemeralContainers`
198+
in the generated client. (Patching is also supported on `/ephemeralcontainers`.)
199+
1. The apiserver discards all changes except those to `spec.ephemeralContainers`.
200+
That is, only `spec.ephemeralContainers` may be changed via `/ephemeralcontainers`.
201+
1. The apiserver validates the update.
195202
1. Pod validation fails if container spec contains fields disallowed for
196203
Ephemeral Containers or the same name as a container in the spec or
197204
`EphemeralContainers`.
198-
1. API resource versioning resolves update races.
205+
1. Registered admission controllers receive an `AdmissionReview` request
206+
containing the entire `Pod`.
199207
1. The kubelet's pod watcher notices the update and triggers a `syncPod()`.
200208
During the sync, the kubelet calls `kuberuntime.StartEphemeralContainer()`
201209
for any new Ephemeral Container.
@@ -303,7 +311,7 @@ ephemeral container creation in a cluster.
303311

304312
Ephemeral Containers will stop when their command exits, such as exiting a
305313
shell, and they will not be restarted. Unlike `kubectl exec`, processes in
306-
Ephemeral Containers will not receive an EOF if their connection is
314+
Ephemeral Containers will not receive an EOF if their connections are
307315
interrupted, so shells won't automatically exit on disconnect. Without the
308316
ability to remove an Ephemeral Container via the API, the only way to exit the
309317
container is to send it an OS signal.
@@ -629,10 +637,8 @@ via this subresource. `EphemeralContainerStatuses` is updated in the same manner
629637
as everything else in `Pod.Status` via `/status`.
630638

631639
`Pod.Spec.EphemeralContainers` may be updated via `/ephemeralcontainers` as per
632-
normal (using PUT, PATCH, etc) except that existing Ephemeral Containers may not
633-
be modified or deleted. Deleting Ephemeral Containers is not supported in the
634-
initial implementation to reduce complexity. It could be added in the future,
635-
but see *Killing Ephemeral Containers* below for additional constraints.
640+
normal (using PUT, PATCH, etc) except that existing Ephemeral Containers may
641+
not be modified.
636642

637643
The subresources `attach`, `exec`, `log`, and `portforward` are available for
638644
Ephemeral Containers and will be forwarded by the apiserver. This means `kubectl
@@ -1039,6 +1045,7 @@ _This section must be completed when targeting beta graduation to a release._
10391045
- *2019-04-24*: Added notes on Windows feature compatibility
10401046
- *2020-09-29*: Ported KEP to directory-based template.
10411047
- *2021-01-07*: Updated KEP for beta release in 1.21 and completed PRR section.
1048+
- *2021-04-12*: Switched `/ephemeralcontainers` API to use `Pod`.
10421049

10431050
## Drawbacks
10441051

0 commit comments

Comments
 (0)