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
-[Add a pod.spec.SidecarContainers array](#add-a-podspecsidecarcontainers-array)
59
+
-[Mark one container as the Primary Container](#mark-one-container-as-the-primary-container)
60
+
-[Boolean flag on container, Sidecar: true](#boolean-flag-on-container-sidecar-true)
61
+
-[Mark containers whose termination kills the pod, terminationFatalToPod: true](#mark-containers-whose-termination-kills-the-pod-terminationfataltopod-true)
62
+
-[Add "Depends On" semantics to containers](#add-depends-on-semantics-to-containers)
63
+
-[Pre-defined phases for container startup/shutdown or arbitrary numbers for ordering](#pre-defined-phases-for-container-startupshutdown-or-arbitrary-numbers-for-ordering)
58
64
<!-- /toc -->
59
65
60
66
## Release Signoff Checklist
@@ -314,9 +320,96 @@ Older Kubelets should still be able to schedule Pods that have sidecar container
This section contains ideas that were originally discussed but then dismissed in favour of the current design.
324
+
It also includes some links to related discussion on each topic to give some extra context, however not all decisions are documented in Github prs and may have been discussed in sig-meetings or in slack etc.
325
+
### Add a pod.spec.SidecarContainers array
326
+
An early idea was to have a separate list of containers in a similar style to init containers, they would have behaved in the same way that the current KEP details. The reason this was dismissed was due to it being considered too large a change to the API that would require a lot of updates to tooling, for a feature that in most respects would act the same as a normal container.
317
327
318
-
One alternative would be to have a new field in the Pod Spec of `sidecarContainers:` where you could define a list of sidecar containers, however this would require more work in terms of updating tooling/kubelet to support this.
The primary container idea was specific to solving the issue of Jobs that don't complete with a sidecar, the suggestion was to have one container marked as the primary so that the Job would get completed when that container has finished. This was dismissed as it was too specific to Jobs whereas the more generic issues of sidecars could be useful in other places.
Another alternative would be to change the Job Spec to have a `primaryContainer` field to tell it which containers are important. However I feel this is perhaps too specific to job when this Sidecar concept could be useful in other scenarios.
358
+
### Boolean flag on container, Sidecar: true
359
+
```yaml
360
+
containers:
361
+
- name: myApp
362
+
- name: mySidecar
363
+
sidecar: true
364
+
```
365
+
A boolean flag of `sidecar: true` could be used to indicate which pods are sidecars, this was dismissed as it was considered too specific and potentially other types of container lifecycle may want to be added in the future.
321
366
322
-
A boolean flag of `sidecar: true` could be used to indicate which pods are sidecars, however this prevents additional ContainerLifecycles from being added in the future.
367
+
### Mark containers whose termination kills the pod, terminationFatalToPod: true
368
+
This suggestion was to have the ability to mark certain containers as critical to the pod, if they exited it would cause the other containers to exit. While this helped solve things like Jobs it didn't solve the wider issue of ordering startup and shutdown.
Similar to [systemd](https://www.freedesktop.org/wiki/Software/systemd/) this would allow you to specify that a container depends on another container, preventing that container from starting until the container it depends on has also started. This could also be used in shutdown to ensure that the containers which have dependent containers are only terminated after their dependents have all safely shut down.
381
+
```yaml
382
+
containers:
383
+
- name: myApp
384
+
dependsOn: mySidecar
385
+
- name: mySidecar
386
+
```
387
+
This was rejected as the UX was considered to be overly complicated for the use cases that we were trying to solve. It also doesn't solve the problem of Job termination where you want the sidecars to be terminated once the main containers have exited, to do that you would require some additional fields that would further complicate the UX.
### Pre-defined phases for container startup/shutdown or arbitrary numbers for ordering
392
+
There were a few variations of this but they all had a similar idea which was the ability to order both the shutdown and startup of containers using phases or numbers to determine the ordering.
393
+
examples:
394
+
```yaml
395
+
containers:
396
+
- name: myApp
397
+
StartupPhase: default
398
+
- name: mySidecar
399
+
StartupPhase: post-init
400
+
```
401
+
402
+
```yaml
403
+
containers:
404
+
- name: myApp
405
+
startupOrder: 2
406
+
shutdownOrder: 1
407
+
- name: mySidecar
408
+
startupOrder: 2
409
+
shutdownOrder: 1
410
+
```
411
+
This was dismissed as the UX was considered overly complex for the use cases we were trying to enable and also lacked the semantics around container shutdown triggering for things like Jobs.
0 commit comments