-
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
WIP: Add "volume" PipelineResource #1087
Conversation
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: abayer If they are not already assigned, you can assign the PR to them by writing 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 |
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 Yes! Right now, we use a git resource for that, but if/when the volume resource is available, we'll use that instead. |
Yesss amazing, this lines up perfectly! :D 😈 |
Yay! |
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.
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.
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 |
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.
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 |
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.
i think this comment is out of date
name string | ||
volumeResource *v1alpha1.VolumeResource | ||
wantContainers []corev1.Container | ||
wantErr bool |
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.
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", |
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.
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) { |
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.
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
@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. =) |
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 :-) |
closing in favor of #1184 - reopen if i am mistaken! |
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 thePipelineRun
, 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:
cmd
dir, please updatethe release Task and TaskRun to build and release this image
Release Notes