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

WIP: Add "volume" PipelineResource #1087

Closed
wants to merge 1 commit into from

Conversation

abayer
Copy link
Contributor

@abayer abayer commented Jul 16, 2019

Changes

fixes #1062

This will allow copying content either into or out of a TaskRun, either to an existing volume or a newly created volume. The immediate use case is for copying a pipeline's workspace to be made available as the input for another pipeline's workspace without needing to deal with uploading everything to a bucket. The volume, whether already existing or created, will not be deleted at the end of the PipelineRun, unlike the artifact storage PVC.

This is just the initial work - the unit tests are not complete, and there need to be e2e tests, obviously, but I just wanted to get this initial work up for evaluation.

Submitter Checklist

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

See the contribution guide for more details.

Double check this list of stuff that's easy to miss:

Release Notes

TODO

Examples of user facing changes:
- API changes
- Bug fixes
- Any changes in behavior

@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 Jul 16, 2019
@googlebot googlebot added the cla: yes Trying to make the CLA bot happy with ppl from different companies work on one commit label Jul 16, 2019
@tekton-robot
Copy link
Collaborator

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: abayer
To fully approve this pull request, please assign additional approvers.
We suggest the following additional approver: imjasonh

If they are not already assigned, you can assign the PR to them by writing /assign @imjasonh in a comment when ready.

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 added the size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. label Jul 16, 2019
fixes tektoncd#1062

This will allow copying content either into or out of a `TaskRun`,
either to an existing volume or a newly created volume. The immediate
use case is for copying a pipeline's workspace to be made available as
the input for another pipeline's workspace without needing to deal
with uploading everything to a bucket. The volume, whether already
existing or created, will not be deleted at the end of the
`PipelineRun`, unlike the artifact storage PVC.

This is just the initial work - the unit tests are not complete, and
there need to be e2e tests, obviously, but I just wanted to get this
initial work up for evaluation.

Signed-off-by: Andrew Bayer <andrew.bayer@gmail.com>
@bobcatfish
Copy link
Collaborator

Amazing!!!! @dlorenc and I were just talking about needing something like this :D (re. #1076)

Side question: @abayer I think jenkins x uses input output linking - if you have this resource, would this be the main Resource type you'd be linking, or do you use linking for other types as well?

@abayer
Copy link
Contributor Author

abayer commented Jul 16, 2019

@bobcatfish Yes! Right now, we use a git resource for that, but if/when the volume resource is available, we'll use that instead.

@bobcatfish
Copy link
Collaborator

Yesss amazing, this lines up perfectly! :D 😈

@dlorenc
Copy link
Contributor

dlorenc commented Jul 17, 2019

Yesss amazing, this lines up perfectly! :D 😈

Yay!

dlorenc added a commit to dlorenc/build-pipeline that referenced this pull request Jul 22, 2019
The cluster type currently has no defined behavior as output resources, and
the git type behaves incorrectly. The new Volume type should be used instead
for the use-cases supported by the old Git resource.

This is part of the large cleanup in tektoncd#1076, and should not be submitted until
after tektoncd#1087.
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.

I'm very excited to add this! I added some minor feedback, also a request: can this PR include docs at https://github.com/tektoncd/pipeline/blob/master/docs/resources.md explaining how to use the new resource?

side note, in slack i think we (@dlorenc @abayer me) discussed adding a flag that would allow a user to specify their own PVC that they previously created, instead of always making one? could be a feature we add later tho :D

func (s *VolumeResource) GetPvcMount() corev1.VolumeMount {
return corev1.VolumeMount{
Name: s.Name, // resource pvc name
MountPath: VolumeMountDir, // nothing should be mounted here
Copy link
Collaborator

Choose a reason for hiding this comment

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

i'm a bit confused by the "nothing should be mounted here" comment (maybe it means there will be an error if something is already mounted there?)

}}, nil
}

// GetDownloadContainerSpec returns an array of container specs to download gcs storage object
Copy link
Collaborator

Choose a reason for hiding this comment

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

i think this comment is out of date

name string
volumeResource *v1alpha1.VolumeResource
wantContainers []corev1.Container
wantErr bool
Copy link
Collaborator

Choose a reason for hiding this comment

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

if possible i think tests end up a bit easier to read and update if instead of having wantErr we create separate tests for error cases (and in this case we're not actually using wantErr)

wantContainers []corev1.Container
wantErr bool
}{{
name: "valid volume resource config",
Copy link
Collaborator

Choose a reason for hiding this comment

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

in cases where we only have one test case, the test might be a bit easier to read without the table driven logic

@@ -146,6 +157,33 @@ func AddInputResource(
return taskSpec, nil
}

func addVolumeFetchStep(kubeClient kubernetes.Interface, taskRun *v1alpha1.TaskRun, volumeResource *v1alpha1.VolumeResource, sourcePaths []string) ([]corev1.Container, []corev1.Volume, error) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

would be great to have unit tests for addVolumeFetchStep and addVolumeUploadStep (in fact i think it would also probably make a bit more sense if we put functions like this in the same package/file with the associated resources if we can? e.g. functions inside of pkg/apis/pipeline/v1alpha1/volume_resource.go

@abayer
Copy link
Contributor Author

abayer commented Aug 5, 2019

@bobcatfish - oh yeah, so many tests to add. =) I should be able to get back to this after DevOps World next week, if @dlorenc doesn't snap and drive this to the finish line before I get a chance. =)

@hferentschik
Copy link

Is this still the PR to watch for this feature or is there some other parallel work I should look at. Would love to see this feature getting into the next release of Tekton :-)

@dlorenc dlorenc mentioned this pull request Aug 12, 2019
3 tasks
@bobcatfish
Copy link
Collaborator

closing in favor of #1184 - reopen if i am mistaken!

@bobcatfish bobcatfish closed this Aug 12, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cla: yes Trying to make the CLA bot happy with ppl from different companies work on one commit do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. size/XL Denotes a PR that changes 500-999 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add "volume" input/output resource
6 participants