Skip to content

Commit

Permalink
change to sidecar field in container spec
Browse files Browse the repository at this point in the history
  • Loading branch information
Joseph-Irving committed May 16, 2018
1 parent 68e4e68 commit 5dcd48b
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions keps/sig-apps/0008-sidecarcontainer.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ authors:
owning-sig: sig-apps
participating-sigs:
- sig-apps
- sig-node
reviewers:
- TBD
approvers:
Expand Down Expand Up @@ -34,7 +35,7 @@ status: provisional

## Summary

To solve the issue of sidecars not being well supported we can create a new class of container in the Pod Spec called sidecarContainers which are handled like normal containers but with the caveat that a normal container's status could take precedence over the sidecar's status. This will solve the problem of Jobs not completing/failing when a sidecar container never exits due to it having no awareness of the 'primary' container.
To solve the issue of sidecars not being well supported we can create a new type of container called a sidecar which are handled like normal containers but with the caveat that a normal container's status could take precedence over the sidecar's status. This will solve the problem of Jobs not completing/failing when a sidecar container never exits due to it having no awareness of the 'primary' container.

## Motivation

Expand All @@ -50,8 +51,8 @@ Changing the way jobs are handled

## Proposal

Create a new class of containers called sidecarContainers, this will be an additional field to the Pod Spec.
e.g
Create a way to define containers as sidecars, this will be an additional field to the Container Spec: `sidecar: true`.
e.g:
```yaml
apiVersion: v1
kind: Pod
Expand All @@ -64,13 +65,13 @@ spec:
- name: myapp
image: myapp
command: ['do something']
sidecarContainers:
- name: sidecar
image: sidecar-image
sidecar: true
command: ["do something to help my app"]

```
These sidecar containers will be handled the same way as a normal container is almost all respects apart from the fact that in certain situations their status will be ignored:
These sidecar containers will be handled the same way as a normal container in almost all respects apart from the fact that in certain situations their status will be ignored:
* When all normal containers are in `Completed` State
* When all normal containers are in `Error` State
In a job for example this means that you can have as many sidecars as you like and they will all get terminated when the normal containers all Complete or if all normal containers error.
Expand All @@ -83,7 +84,8 @@ This model assumes that the sidecars are not intended to reliant on your other c

### Risks and Mitigations

//WIP
You could set all containers to be `sidecar: true`, this seems wrong, so maybe the api should do a validation check that at least one container is not a sidecar.
Init containers would be able to have `sidecar: true` applied to them as it's an additional field to the container spec, there's no situation where this would make sense as init containers are executed sequentially. We could get around this by having the api throw a validation error if you try to use this field on an init container.

## Graduation Criteria

Expand All @@ -106,5 +108,5 @@ Major milestones might include

## Alternatives

One alternative would be to have a new field in the Container Spec of `sidecar: true` however this could be quite inefficient if you had a lot of sidecars.
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 a lot more work in terms of updating tooling to support this.
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.

0 comments on commit 5dcd48b

Please sign in to comment.