Skip to content
This repository was archived by the owner on Apr 20, 2026. It is now read-only.

sidecar ordering: handle case where there is no known container state#36

Merged
abhinavdahiya merged 2 commits into
release-1.16.15-lyft.3from
fix_container_wait
May 4, 2023
Merged

sidecar ordering: handle case where there is no known container state#36
abhinavdahiya merged 2 commits into
release-1.16.15-lyft.3from
fix_container_wait

Conversation

@abhinavdahiya
Copy link
Copy Markdown

@abhinavdahiya abhinavdahiya commented May 4, 2023

Bring #35 to 1.16

Based on the api documentation
https://pkg.go.dev/k8s.io/api/core/v1#ContainerState
```
ContainerState holds a possible state of container. Only one of its members may be specified.
If none of them is specified, the default one is ContainerStateWaiting.
```

There is a case where no explicit state is known for a container and it must be
treated as waiting state.

So we must check for nil value (since the State is a value and pointer we have to check
that all possible fields are nil , :( ) and treat it as Waiting state.

Also fixes the `Restart running non-sidecars despite sidecar becoming not ready` test.
A pod if needs to be restarted (i.e it had existed and has run at least one) the state
of the container should be set to last running state.
@abhinavdahiya
Copy link
Copy Markdown
Author

ptal #compute @tomwans

@abhinavdahiya
Copy link
Copy Markdown
Author

/merge

@abhinavdahiya abhinavdahiya merged commit 8c8e9db into release-1.16.15-lyft.3 May 4, 2023
@abhinavdahiya abhinavdahiya deleted the fix_container_wait branch May 4, 2023 17:15
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants