-
Notifications
You must be signed in to change notification settings - Fork 1.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add ContainerState and ContainerName for Sidecars #2075
Add ContainerState and ContainerName for Sidecars #2075
Conversation
5642b7b
to
606340f
Compare
This looks great @danielhelfand thanks for adding this! I'm really glad to see the new unit tests, could we add another level of test as well? A couple options:
|
Looking into TaskRuns at the reconciler level, I don't see any testing for sidecars, so this might be a good chance to add some testing there. |
606340f
to
0022149
Compare
The following is the coverage report on pkg/.
|
0022149
to
7a7eb32
Compare
The following is the coverage report on pkg/.
|
7a7eb32
to
f2794e7
Compare
The following is the coverage report on pkg/.
|
f2794e7
to
787b30b
Compare
The following is the coverage report on pkg/.
|
787b30b
to
1124ca1
Compare
The following is the coverage report on pkg/.
|
1124ca1
to
0b70dc5
Compare
The following is the coverage report on pkg/.
|
0b70dc5
to
faded10
Compare
The following is the coverage report on pkg/.
|
faded10
to
23d9d1d
Compare
The following is the coverage report on pkg/.
|
23d9d1d
to
e924c73
Compare
The following is the coverage report on pkg/.
|
/hold Unfortunately, there are issues related to #1347 with this approach. If a sidecar runs longer than all the Steps, the ContainerStatus is left as running for the SidecarStatus on the TaskRunStatus. I'll need to look into how to update the ContainerStatus for Sidecars in this situation. |
e924c73
to
52f4f9f
Compare
The following is the coverage report on pkg/.
|
The integration test failures are all similar to as follows:
My guess is that showing this ContainerStatus information now when a Sidecar has been stopped using the nop-image is showing the failure of trying to run What could be done, in order to avoid this is, is to set a Terminated status for the SidecarStatus that explains the Sidecar was stopped successfully using the nop-image. |
pkg/reconciler/taskrun/taskrun.go
Outdated
|
||
// update SidecarStatuses based on Pod ContainerStatuses when Sidecars | ||
// have been stopped. | ||
func updateSidecarStatus(pod *corev1.Pod, tr *v1alpha1.TaskRun, c *Reconciler) error { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Instead of using current State (s.State
) from ContainerStatus on Pod with stopped Sidecars, what could be done is to create a Terminated Status with the following information:
corev1.ContainerState{
Terminated: &corev1.ContainerStateTerminated{
ExitCode: 0,
Reason: "Completed",
Message: "Sidecar container successfully stopped by nop-image",
StartedAt: <Use value from LastTerminationState instead of current State (s.LastTerminatedState.Terminated.StartedAt)>,
FinishedAt: <Use value from LastTerminationState instead of current State (s.LastTerminatedState.Terminated.FinishedAt)>,
ContainerID: <Use value from LastTerminationState instead of current State (s.LastTerminatedState.Terminated.ContainerID)>,
}
Using the LastTerminationStatus, if exit code == 137, it can be assumed that the sidecar was killed.
Using the LastTerminationStatus would also provide more accurate information about the Start/End time of the Sidecar as well as information about the actual image that was used for the Sidecar.
52f4f9f
to
6e36bb3
Compare
The following is the coverage report on pkg/.
|
6e36bb3
to
e35ed7c
Compare
The following is the coverage report on pkg/.
|
e35ed7c
to
6c4c37b
Compare
The following is the coverage report on pkg/.
|
6c4c37b
to
338bbf3
Compare
The following is the coverage report on pkg/.
|
/hold cancel Should be ready for another look |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me
/cc @chmouel
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/lgtm
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: sbwsg, vdemeester The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
Closes #2074
Changes
Aligns the SidecarState with StepState to make the ContainerState and ContainerName available on TaskRun statuses for sidecars. I can add documentation as well under TaskRun Status if there would be a good place for it.
Submitter Checklist
Reviewer Notes
If API changes are included, additive changes must be approved by at least two OWNERS and backwards incompatible changes must be approved by more than 50% of the OWNERS, and they must first be added in a backwards compatible way.
Release Notes