Skip to content
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 sidecars to Tasks #1236

Merged
merged 1 commit into from Aug 29, 2019
Merged

Add sidecars to Tasks #1236

merged 1 commit into from Aug 29, 2019

Conversation

ghost
Copy link

@ghost ghost commented Aug 22, 2019

Changes

Closes #980

This commit adds user-defined sidecars to the TaskSpec. A sidecar is a
container intended to provide some auxiliary support to a pod's primary
containers. An example usecase is a mock API server for your app to hit
during testing.

This commit doesn't introduce any extra lifecycle management beyond that
added in #936 - sidecars will be stopped without any warning or cleanup
time. At the moment I'm thinking of leaving this as-is until the sidecars
KEP reaches general availability in Kubernetes.

Design doc: https://docs.google.com/document/d/1OiV75sIqwo77QbASiItBVFVsM5gWgxvtpuc4fLcbjBs/edit

Submitter Checklist

These are the criteria that every PR should meet, please check them off as you
review them:

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

Tasks can now define a list of sidecar containers to run alongside their steps

@tekton-robot tekton-robot added the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Aug 22, 2019
@googlebot googlebot added the cla: yes Trying to make the CLA bot happy with ppl from different companies work on one commit label Aug 22, 2019
@tekton-robot tekton-robot added the size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. label Aug 22, 2019
@tekton-robot
Copy link
Collaborator

The following is the coverage report on pkg/.
Say /test pull-tekton-pipeline-go-coverage to re-run this coverage report

File Old Coverage New Coverage Delta
pkg/reconciler/taskrun/resources/pod.go 88.9% 87.8% -1.1

@tekton-robot tekton-robot added size/S Denotes a PR that changes 10-29 lines, ignoring generated files. and removed size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. labels Aug 22, 2019
@tekton-robot
Copy link
Collaborator

The following is the coverage report on pkg/.
Say /test pull-tekton-pipeline-go-coverage to re-run this coverage report

File Old Coverage New Coverage Delta
pkg/reconciler/taskrun/resources/pod.go 88.9% 88.4% -0.5

@tekton-robot
Copy link
Collaborator

The following is the coverage report on pkg/.
Say /test pull-tekton-pipeline-go-coverage to re-run this coverage report

File Old Coverage New Coverage Delta
pkg/reconciler/taskrun/resources/pod.go 88.9% 88.4% -0.5

@@ -114,7 +114,7 @@ func TestSendCloudEvents(t *testing.T) {
SendSuccessfully: true,
}
err := SendCloudEvents(tc.taskRun, NewFakeClient(&successfulBehaviour), logger)
if err == nil {
if err != nil {
t.Fatalf("Unexpected error sending cloud events: %v", err)
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@afrittoli I'm a little confused by this fatal message and the if above it. Is it supposed to detect errors or nils? Reads to me like it should be if err != nil but want to check with you before I merge it like this.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hm this test must start failing if you change it right?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's right - I fixed a bug in the way errors were being returned related to CloudEvents and this test started failing. Changing this test got it passing after my bug fix was introduced but I wanted to double check what the actual expected behaviour was.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That was a silly double-error - mistake in the code, enforced by the test :S
Thanks for catching / fixing that!

@tekton-robot tekton-robot added size/M Denotes a PR that changes 30-99 lines, ignoring generated files. and removed size/S Denotes a PR that changes 10-29 lines, ignoring generated files. labels Aug 22, 2019
@tekton-robot
Copy link
Collaborator

The following is the coverage report on pkg/.
Say /test pull-tekton-pipeline-go-coverage to re-run this coverage report

File Old Coverage New Coverage Delta
pkg/reconciler/taskrun/resources/pod.go 88.9% 89.0% 0.2

@tekton-robot tekton-robot added size/L Denotes a PR that changes 100-499 lines, ignoring generated files. and removed size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Aug 22, 2019
@tekton-robot
Copy link
Collaborator

The following is the coverage report on pkg/.
Say /test pull-tekton-pipeline-go-coverage to re-run this coverage report

File Old Coverage New Coverage Delta
pkg/reconciler/taskrun/resources/pod.go 88.9% 89.0% 0.2

@ghost
Copy link
Author

ghost commented Aug 23, 2019

/test pull-tekton-pipeline-integration-tests

@tekton-robot tekton-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Aug 26, 2019
@tekton-robot
Copy link
Collaborator

The following is the coverage report on pkg/.
Say /test pull-tekton-pipeline-go-coverage to re-run this coverage report

File Old Coverage New Coverage Delta
pkg/reconciler/taskrun/resources/pod.go 88.9% 89.0% 0.2
test/builder/task.go 87.8% 85.6% -2.3

@tekton-robot
Copy link
Collaborator

The following is the coverage report on pkg/.
Say /test pull-tekton-pipeline-go-coverage to re-run this coverage report

File Old Coverage New Coverage Delta
pkg/reconciler/taskrun/resources/pod.go 88.9% 89.0% 0.2
test/builder/task.go 87.8% 85.6% -2.3

@tekton-robot
Copy link
Collaborator

The following is the coverage report on pkg/.
Say /test pull-tekton-pipeline-go-coverage to re-run this coverage report

File Old Coverage New Coverage Delta
pkg/reconciler/taskrun/resources/pod.go 88.9% 89.0% 0.2
pkg/status/taskrunpod.go 100.0% 97.1% -2.9
test/builder/task.go 87.8% 85.6% -2.3

@ghost
Copy link
Author

ghost commented Aug 27, 2019

/test pull-tekton-pipeline-integration-tests

@ghost ghost changed the title WIP Add sidecars to Tasks Add sidecars to Tasks Aug 27, 2019
@tekton-robot tekton-robot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Aug 27, 2019
@ghost
Copy link
Author

ghost commented Aug 27, 2019

2019-08-27_10-51-44

ಠ_ಠ

ಠ_ಠ

ಠ_ಠ

@dibyom
Copy link
Member

dibyom commented Aug 27, 2019

2019-08-27_10-51-44
ಠ_ಠ

Usually due to a YAML test failure!

@ghost
Copy link
Author

ghost commented Aug 27, 2019

/test pull-tekton-pipeline-integration-tests

@ghost
Copy link
Author

ghost commented Aug 27, 2019

I've run the failing yaml tests locally and didn't hit any issues.

Copy link
Collaborator

@bobcatfish bobcatfish left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking great! Just a few minor comments from me

docs/taskruns.md Show resolved Hide resolved
docs/tasks.md Show resolved Hide resolved
@@ -114,7 +114,7 @@ func TestSendCloudEvents(t *testing.T) {
SendSuccessfully: true,
}
err := SendCloudEvents(tc.taskRun, NewFakeClient(&successfulBehaviour), logger)
if err == nil {
if err != nil {
t.Fatalf("Unexpected error sending cloud events: %v", err)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hm this test must start failing if you change it right?

pkg/status/taskrunpod.go Show resolved Hide resolved
test/sidecar_test.go Show resolved Hide resolved
@ghost
Copy link
Author

ghost commented Aug 28, 2019

So the YAML tests were failing and are now fixed without intervention. I assume they were timing out because of limited resources or some similar problem 🤞

@tekton-robot
Copy link
Collaborator

The following is the coverage report on pkg/.
Say /test pull-tekton-pipeline-go-coverage to re-run this coverage report

File Old Coverage New Coverage Delta
pkg/reconciler/taskrun/resources/pod.go 88.9% 89.0% 0.2
test/builder/task.go 87.8% 85.6% -2.3

@tekton-robot
Copy link
Collaborator

The following is the coverage report on pkg/.
Say /test pull-tekton-pipeline-go-coverage to re-run this coverage report

File Old Coverage New Coverage Delta
pkg/reconciler/taskrun/resources/pod.go 88.9% 89.0% 0.2
test/builder/task.go 87.8% 85.6% -2.3

@ghost
Copy link
Author

ghost commented Aug 28, 2019

/test pull-tekton-pipeline-build-tests

docs/tasks.md Show resolved Hide resolved
pkg/status/taskrunpod_test.go Outdated Show resolved Hide resolved
@tekton-robot
Copy link
Collaborator

The following is the coverage report on pkg/.
Say /test pull-tekton-pipeline-go-coverage to re-run this coverage report

File Old Coverage New Coverage Delta
pkg/reconciler/taskrun/resources/pod.go 88.9% 89.0% 0.2
test/builder/task.go 87.8% 85.6% -2.3

pkg/status/taskrunpod_test.go Outdated Show resolved Hide resolved
examples/taskruns/task-sidecar-dind.yaml Outdated Show resolved Hide resolved
This commit adds user-defined sidecars to the TaskSpec. A sidecar is a
container intended to provide some auxiliary support to a pod's primary
containers. An example usecase is a mock API server for your app to hit
during testing.

This commit doesn't introduce any extra lifecycle management beyond that
added in #936 - sidecars will be stopped without any warning or cleanup
time. At the moment I'm thinking of leaving this as-is until the sidecars
KEP reaches general availability in Kubernetes.
@tekton-robot
Copy link
Collaborator

The following is the coverage report on pkg/.
Say /test pull-tekton-pipeline-go-coverage to re-run this coverage report

File Old Coverage New Coverage Delta
pkg/reconciler/taskrun/resources/pod.go 88.9% 89.0% 0.2
test/builder/task.go 87.8% 85.6% -2.3

Copy link
Member

@dibyom dibyom left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/lgtm

@tekton-robot tekton-robot added the lgtm Indicates that a PR is ready to be merged. label Aug 29, 2019
@tekton-robot
Copy link
Collaborator

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: dibyom, sbwsg

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 /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@tekton-robot tekton-robot merged commit 14425d1 into tektoncd:master Aug 29, 2019
Copy link
Member

@afrittoli afrittoli left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cool, nice work. It's really handy being able to specify a sidecar like this!
And thank you for catching the bug on the cloud_event code.

@@ -385,6 +433,7 @@ func TestMakePod(t *testing.T) {
}
})
}

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

NIT:?

@@ -454,3 +454,84 @@ func TestUpdateStatusFromPod(t *testing.T) {
})
}
}

func TestCountSidecars(t *testing.T) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. cla: yes Trying to make the CLA bot happy with ppl from different companies work on one commit lgtm Indicates that a PR is ready to be merged. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Specify sidecar containers to run inside a TaskRun's Pod
6 participants