Skip to content

Commit

Permalink
Allow subPath in PipelineRun for volumeClaimTemplate as well
Browse files Browse the repository at this point in the history
  • Loading branch information
jlpettersson committed Apr 27, 2020
1 parent bd8cfa3 commit 9f9d1bd
Show file tree
Hide file tree
Showing 4 changed files with 0 additions and 43 deletions.
4 changes: 0 additions & 4 deletions pkg/apis/pipeline/v1beta1/pipelinerun_validation.go
Original file line number Diff line number Diff line change
Expand Up @@ -81,10 +81,6 @@ func (ps *PipelineRunSpec) Validate(ctx context.Context) *apis.FieldError {
}
}
wsNames[ws.Name] = idx

if err := ws.Validate(ctx); err != nil {
return err
}
}
}

Expand Down
16 changes: 0 additions & 16 deletions pkg/apis/pipeline/v1beta1/pipelinerun_validation_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -196,22 +196,6 @@ func TestPipelineRunSpec_Invalidate(t *testing.T) {
Message: `workspace "ws" provided by pipelinerun more than once, at index 0 and 1`,
Paths: []string{"spec.workspaces"},
},
}, {
name: "workspace with volumeClaimTemplate can not contain subPath field",
spec: v1beta1.PipelineRunSpec{
PipelineRef: &v1beta1.PipelineRef{
Name: "pipelinerefname",
},
Workspaces: []v1beta1.WorkspaceBinding{{
Name: "ws",
VolumeClaimTemplate: &corev1.PersistentVolumeClaim{},
SubPath: "subdir",
}},
},
wantErr: &apis.FieldError{
Message: `must not set the field(s)`,
Paths: []string{"workspaces.volumeclaimtemplate.subpath"},
},
}}
for _, ps := range tests {
t.Run(ps.name, func(t *testing.T) {
Expand Down
4 changes: 0 additions & 4 deletions pkg/apis/pipeline/v1beta1/workspace_validation.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,10 +56,6 @@ func (b *WorkspaceBinding) Validate(ctx context.Context) *apis.FieldError {
return apis.ErrMissingField("workspace.persistentvolumeclaim.claimname")
}

if b.VolumeClaimTemplate != nil && b.SubPath != "" {
return apis.ErrDisallowedFields("workspaces.volumeclaimtemplate.subpath")
}

// For a ConfigMap to work, you must provide the name of the ConfigMap to use.
if b.ConfigMap != nil && b.ConfigMap.LocalObjectReference.Name == "" {
return apis.ErrMissingField("workspace.configmap.name")
Expand Down
19 changes: 0 additions & 19 deletions pkg/apis/pipeline/v1beta1/workspace_validation_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -105,25 +105,6 @@ func TestWorkspaceBindingValidateInvalid(t *testing.T) {
ClaimName: "pool-party",
},
},
}, {
name: "Provided volumeClaimTemplate with subPath field set",
binding: &WorkspaceBinding{
Name: "beth",
SubPath: "notallowed-when-using-volumeclaimtemplate-in-pipeline",
VolumeClaimTemplate: &corev1.PersistentVolumeClaim{
ObjectMeta: metav1.ObjectMeta{
Name: "mypvc",
},
Spec: corev1.PersistentVolumeClaimSpec{
AccessModes: []corev1.PersistentVolumeAccessMode{corev1.ReadWriteOnce},
Resources: corev1.ResourceRequirements{
Requests: corev1.ResourceList{
"storage": resource.MustParse("1Gi"),
},
},
},
},
},
}, {
name: "Provided neither pvc nor emptydir",
binding: &WorkspaceBinding{
Expand Down

0 comments on commit 9f9d1bd

Please sign in to comment.