diff --git a/config/config-artifact-pvc.yaml b/config/config-artifact-pvc.yaml new file mode 100644 index 00000000000..d40b176ef69 --- /dev/null +++ b/config/config-artifact-pvc.yaml @@ -0,0 +1,23 @@ +# Copyright 2018 The Knative Authors +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +apiVersion: v1 +kind: ConfigMap +metadata: + name: config-artifact-pvc + namespace: tekton-pipelines +data: + # size of the PVC volume + # size: 5Gi + diff --git a/docs/install.md b/docs/install.md index ae8ad031043..166c75fbb19 100644 --- a/docs/install.md +++ b/docs/install.md @@ -104,8 +104,13 @@ Pipelines need a way to share resources between tasks. The alternatives are a [Persistent volume](https://kubernetes.io/docs/concepts/storage/persistent-volumes/) or a [GCS storage bucket](https://cloud.google.com/storage/) -The PVC option does not require any configuration, but the GCS storage bucket -can be configured using a ConfigMap with the name `config-artifact-bucket` with +The PVC option can be configured using a ConfigMap with the name +`config-artifact-pvc` and the following attributes: + +- size: the size of the volume (5Gi by default) + +The GCS storage bucket can be configured +using a ConfigMap with the name `config-artifact-bucket` with the following attributes: - location: the address of the bucket (for example gs://mybucket) diff --git a/pkg/apis/pipeline/v1alpha1/artifact_pvc.go b/pkg/apis/pipeline/v1alpha1/artifact_pvc.go index b4763fa23bb..24f95bcd321 100644 --- a/pkg/apis/pipeline/v1alpha1/artifact_pvc.go +++ b/pkg/apis/pipeline/v1alpha1/artifact_pvc.go @@ -33,7 +33,8 @@ var ( // ArtifactPVC represents the pvc created by the pipelinerun // for artifacts temporary storage type ArtifactPVC struct { - Name string + Name string + PersistentVolumeClaim *corev1.PersistentVolumeClaim } // GetType returns the type of the artifact storage diff --git a/pkg/apis/pipeline/v1alpha1/zz_generated.deepcopy.go b/pkg/apis/pipeline/v1alpha1/zz_generated.deepcopy.go index f5c65d37be2..23a40e40ace 100644 --- a/pkg/apis/pipeline/v1alpha1/zz_generated.deepcopy.go +++ b/pkg/apis/pipeline/v1alpha1/zz_generated.deepcopy.go @@ -21,8 +21,8 @@ limitations under the License. package v1alpha1 import ( - core_v1 "k8s.io/api/core/v1" - v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + v1 "k8s.io/api/core/v1" + meta_v1 "k8s.io/apimachinery/pkg/apis/meta/v1" runtime "k8s.io/apimachinery/pkg/runtime" ) @@ -50,6 +50,15 @@ func (in *ArtifactBucket) DeepCopy() *ArtifactBucket { // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *ArtifactPVC) DeepCopyInto(out *ArtifactPVC) { *out = *in + if in.PersistentVolumeClaim != nil { + in, out := &in.PersistentVolumeClaim, &out.PersistentVolumeClaim + if *in == nil { + *out = nil + } else { + *out = new(v1.PersistentVolumeClaim) + (*in).DeepCopyInto(*out) + } + } return } @@ -689,7 +698,7 @@ func (in *PipelineRunSpec) DeepCopyInto(out *PipelineRunSpec) { if *in == nil { *out = nil } else { - *out = new(v1.Duration) + *out = new(meta_v1.Duration) **out = **in } } @@ -702,7 +711,7 @@ func (in *PipelineRunSpec) DeepCopyInto(out *PipelineRunSpec) { } if in.Tolerations != nil { in, out := &in.Tolerations, &out.Tolerations - *out = make([]core_v1.Toleration, len(*in)) + *out = make([]v1.Toleration, len(*in)) for i := range *in { (*in)[i].DeepCopyInto(&(*out)[i]) } @@ -712,7 +721,7 @@ func (in *PipelineRunSpec) DeepCopyInto(out *PipelineRunSpec) { if *in == nil { *out = nil } else { - *out = new(core_v1.Affinity) + *out = new(v1.Affinity) (*in).DeepCopyInto(*out) } } @@ -747,7 +756,7 @@ func (in *PipelineRunStatus) DeepCopyInto(out *PipelineRunStatus) { if *in == nil { *out = nil } else { - *out = new(v1.Time) + *out = new(meta_v1.Time) (*in).DeepCopyInto(*out) } } @@ -756,7 +765,7 @@ func (in *PipelineRunStatus) DeepCopyInto(out *PipelineRunStatus) { if *in == nil { *out = nil } else { - *out = new(v1.Time) + *out = new(meta_v1.Time) (*in).DeepCopyInto(*out) } } @@ -1334,7 +1343,7 @@ func (in *TaskRunSpec) DeepCopyInto(out *TaskRunSpec) { if *in == nil { *out = nil } else { - *out = new(v1.Duration) + *out = new(meta_v1.Duration) **out = **in } } @@ -1347,7 +1356,7 @@ func (in *TaskRunSpec) DeepCopyInto(out *TaskRunSpec) { } if in.Tolerations != nil { in, out := &in.Tolerations, &out.Tolerations - *out = make([]core_v1.Toleration, len(*in)) + *out = make([]v1.Toleration, len(*in)) for i := range *in { (*in)[i].DeepCopyInto(&(*out)[i]) } @@ -1357,7 +1366,7 @@ func (in *TaskRunSpec) DeepCopyInto(out *TaskRunSpec) { if *in == nil { *out = nil } else { - *out = new(core_v1.Affinity) + *out = new(v1.Affinity) (*in).DeepCopyInto(*out) } } @@ -1392,7 +1401,7 @@ func (in *TaskRunStatus) DeepCopyInto(out *TaskRunStatus) { if *in == nil { *out = nil } else { - *out = new(v1.Time) + *out = new(meta_v1.Time) (*in).DeepCopyInto(*out) } } @@ -1401,7 +1410,7 @@ func (in *TaskRunStatus) DeepCopyInto(out *TaskRunStatus) { if *in == nil { *out = nil } else { - *out = new(v1.Time) + *out = new(meta_v1.Time) (*in).DeepCopyInto(*out) } } @@ -1455,14 +1464,14 @@ func (in *TaskSpec) DeepCopyInto(out *TaskSpec) { } if in.Steps != nil { in, out := &in.Steps, &out.Steps - *out = make([]core_v1.Container, len(*in)) + *out = make([]v1.Container, len(*in)) for i := range *in { (*in)[i].DeepCopyInto(&(*out)[i]) } } if in.Volumes != nil { in, out := &in.Volumes, &out.Volumes - *out = make([]core_v1.Volume, len(*in)) + *out = make([]v1.Volume, len(*in)) for i := range *in { (*in)[i].DeepCopyInto(&(*out)[i]) } @@ -1472,7 +1481,7 @@ func (in *TaskSpec) DeepCopyInto(out *TaskSpec) { if *in == nil { *out = nil } else { - *out = new(core_v1.Container) + *out = new(v1.Container) (*in).DeepCopyInto(*out) } } diff --git a/pkg/artifacts/artifact_storage_test.go b/pkg/artifacts/artifact_storage_test.go index e1922e5cf13..23a5573e8d5 100644 --- a/pkg/artifacts/artifact_storage_test.go +++ b/pkg/artifacts/artifact_storage_test.go @@ -22,14 +22,40 @@ import ( "k8s.io/apimachinery/pkg/api/errors" "github.com/google/go-cmp/cmp" + "github.com/google/go-cmp/cmp/cmpopts" logtesting "github.com/knative/pkg/logging/testing" "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1alpha1" "github.com/tektoncd/pipeline/pkg/system" corev1 "k8s.io/api/core/v1" + "k8s.io/apimachinery/pkg/api/resource" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" fakek8s "k8s.io/client-go/kubernetes/fake" ) +var ( + pipelinerun = &v1alpha1.PipelineRun{ + ObjectMeta: metav1.ObjectMeta{ + Namespace: "foo", + Name: "pipelineruntest", + }, + } + persistentVolumeClaim = GetPersistentVolumeClaim(DefaultPvcSize) + quantityComparer = cmp.Comparer(func(x, y resource.Quantity) bool { + return x.Cmp(y) == 0 + }) +) + +func GetPersistentVolumeClaim(size string) *corev1.PersistentVolumeClaim { + pvc := &corev1.PersistentVolumeClaim{ + ObjectMeta: metav1.ObjectMeta{Name: "pipelineruntest-pvc", Namespace: "foo", OwnerReferences: pipelinerun.GetOwnerReference()}, + Spec: corev1.PersistentVolumeClaimSpec{ + AccessModes: []corev1.PersistentVolumeAccessMode{corev1.ReadWriteOnce}, + Resources: corev1.ResourceRequirements{Requests: corev1.ResourceList{corev1.ResourceStorage: resource.MustParse(size)}}, + }, + } + return pvc +} + func TestNeedsPVC(t *testing.T) { logger := logtesting.TestLogger(t) for _, c := range []struct { @@ -109,6 +135,7 @@ func TestNeedsPVC(t *testing.T) { } }) } + } func TestInitializeArtifactStorageWithConfigMap(t *testing.T) { @@ -120,6 +147,23 @@ func TestInitializeArtifactStorageWithConfigMap(t *testing.T) { expectedArtifactStorage ArtifactStorageInterface storagetype string }{{ + desc: "pvc configmap", + configMap: &corev1.ConfigMap{ + ObjectMeta: metav1.ObjectMeta{ + Namespace: system.GetNamespace(), + Name: PvcConfigName, + }, + Data: map[string]string{ + PvcSizeKey: "10Gi", + }, + }, + pipelinerun: pipelinerun, + expectedArtifactStorage: &v1alpha1.ArtifactPVC{ + Name: "pipelineruntest", + PersistentVolumeClaim: GetPersistentVolumeClaim("10Gi"), + }, + storagetype: "pvc", + }, { desc: "valid bucket", configMap: &corev1.ConfigMap{ ObjectMeta: metav1.ObjectMeta{ @@ -132,12 +176,7 @@ func TestInitializeArtifactStorageWithConfigMap(t *testing.T) { v1alpha1.BucketServiceAccountSecretKey: "sakey", }, }, - pipelinerun: &v1alpha1.PipelineRun{ - ObjectMeta: metav1.ObjectMeta{ - Namespace: "foo", - Name: "pipelineruntest", - }, - }, + pipelinerun: pipelinerun, expectedArtifactStorage: &v1alpha1.ArtifactBucket{ Location: "gs://fake-bucket", Secrets: []v1alpha1.SecretParam{{ @@ -160,14 +199,10 @@ func TestInitializeArtifactStorageWithConfigMap(t *testing.T) { v1alpha1.BucketServiceAccountSecretKey: "sakey", }, }, - pipelinerun: &v1alpha1.PipelineRun{ - ObjectMeta: metav1.ObjectMeta{ - Namespace: "foo", - Name: "pipelineruntest", - }, - }, + pipelinerun: pipelinerun, expectedArtifactStorage: &v1alpha1.ArtifactPVC{ - Name: "pipelineruntest", + Name: "pipelineruntest", + PersistentVolumeClaim: persistentVolumeClaim, }, storagetype: "pvc", }, { @@ -182,14 +217,10 @@ func TestInitializeArtifactStorageWithConfigMap(t *testing.T) { v1alpha1.BucketServiceAccountSecretKey: "sakey", }, }, - pipelinerun: &v1alpha1.PipelineRun{ - ObjectMeta: metav1.ObjectMeta{ - Namespace: "foo", - Name: "pipelineruntest", - }, - }, + pipelinerun: pipelinerun, expectedArtifactStorage: &v1alpha1.ArtifactPVC{ - Name: "pipelineruntest", + Name: "pipelineruntest", + PersistentVolumeClaim: persistentVolumeClaim, }, storagetype: "pvc", }, { @@ -200,14 +231,10 @@ func TestInitializeArtifactStorageWithConfigMap(t *testing.T) { Name: v1alpha1.BucketConfigName, }, }, - pipelinerun: &v1alpha1.PipelineRun{ - ObjectMeta: metav1.ObjectMeta{ - Namespace: "foo", - Name: "pipelineruntest", - }, - }, + pipelinerun: pipelinerun, expectedArtifactStorage: &v1alpha1.ArtifactPVC{ - Name: "pipelineruntest", + Name: "pipelineruntest", + PersistentVolumeClaim: persistentVolumeClaim, }, storagetype: "pvc", }, { @@ -221,12 +248,7 @@ func TestInitializeArtifactStorageWithConfigMap(t *testing.T) { v1alpha1.BucketLocationKey: "gs://fake-bucket", }, }, - pipelinerun: &v1alpha1.PipelineRun{ - ObjectMeta: metav1.ObjectMeta{ - Namespace: "foo", - Name: "pipelineruntest", - }, - }, + pipelinerun: pipelinerun, expectedArtifactStorage: &v1alpha1.ArtifactBucket{ Location: "gs://fake-bucket", }, @@ -234,7 +256,7 @@ func TestInitializeArtifactStorageWithConfigMap(t *testing.T) { }} { t.Run(c.desc, func(t *testing.T) { fakekubeclient := fakek8s.NewSimpleClientset(c.configMap) - bucket, err := InitializeArtifactStorage(c.pipelinerun, fakekubeclient, logger) + artifactStorage, err := InitializeArtifactStorage(c.pipelinerun, fakekubeclient, logger) if err != nil { t.Fatalf("Somehow had error initializing artifact storage run out of fake client: %s", err) } @@ -250,11 +272,11 @@ func TestInitializeArtifactStorageWithConfigMap(t *testing.T) { if err := CleanupArtifactStorage(c.pipelinerun, fakekubeclient, logger); err != nil { t.Fatalf("Error cleaning up artifact storage: %s", err) } - if diff := cmp.Diff(bucket.GetType(), c.storagetype); diff != "" { - t.Fatalf("want %v, but got %v", c.storagetype, bucket.GetType()) + if diff := cmp.Diff(artifactStorage.GetType(), c.storagetype); diff != "" { + t.Fatalf("want %v, but got %v", c.storagetype, artifactStorage.GetType()) } - if diff := cmp.Diff(bucket, c.expectedArtifactStorage); diff != "" { - t.Fatalf("want %v, but got %v", c.expectedArtifactStorage, bucket) + if diff := cmp.Diff(artifactStorage, c.expectedArtifactStorage, quantityComparer); diff != "" { + t.Fatalf("want %v, but got %v", c.expectedArtifactStorage, artifactStorage) } }) } @@ -319,7 +341,7 @@ func TestCleanupArtifactStorage(t *testing.T) { }, }} { t.Run(c.desc, func(t *testing.T) { - fakekubeclient := fakek8s.NewSimpleClientset(c.configMap, GetPVCSpec(c.pipelinerun)) + fakekubeclient := fakek8s.NewSimpleClientset(c.configMap, GetPVCSpec(c.pipelinerun, persistentVolumeClaim.Spec.Resources.Requests["storage"])) _, err := fakekubeclient.CoreV1().PersistentVolumeClaims(c.pipelinerun.Namespace).Get(GetPVCName(c.pipelinerun), metav1.GetOptions{}) if err != nil { t.Fatalf("Error getting expected PVC %s for PipelineRun %s: %s", GetPVCName(c.pipelinerun), c.pipelinerun.Name, err) @@ -340,12 +362,6 @@ func TestCleanupArtifactStorage(t *testing.T) { func TestInitializeArtifactStorageWithoutConfigMap(t *testing.T) { logger := logtesting.TestLogger(t) fakekubeclient := fakek8s.NewSimpleClientset() - pipelinerun := &v1alpha1.PipelineRun{ - ObjectMeta: metav1.ObjectMeta{ - Namespace: "foo", - Name: "pipelineruntest", - }, - } pvc, err := InitializeArtifactStorage(pipelinerun, fakekubeclient, logger) if err != nil { @@ -353,17 +369,17 @@ func TestInitializeArtifactStorageWithoutConfigMap(t *testing.T) { } expectedArtifactPVC := &v1alpha1.ArtifactPVC{ - Name: "pipelineruntest", + Name: "pipelineruntest", + PersistentVolumeClaim: persistentVolumeClaim, } - if diff := cmp.Diff(pvc, expectedArtifactPVC); diff != "" { + if diff := cmp.Diff(pvc, expectedArtifactPVC, cmpopts.IgnoreUnexported(resource.Quantity{})); diff != "" { t.Fatalf("want %v, but got %v", expectedArtifactPVC, pvc) } } func TestGetArtifactStorageWithConfigMap(t *testing.T) { logger := logtesting.TestLogger(t) - prName := "pipelineruntest" for _, c := range []struct { desc string configMap *corev1.ConfigMap @@ -402,7 +418,7 @@ func TestGetArtifactStorageWithConfigMap(t *testing.T) { v1alpha1.BucketServiceAccountSecretKey: "sakey", }, }, - expectedArtifactStorage: &v1alpha1.ArtifactPVC{Name: prName}, + expectedArtifactStorage: &v1alpha1.ArtifactPVC{Name: pipelinerun.Name}, }, { desc: "missing location", configMap: &corev1.ConfigMap{ @@ -415,7 +431,9 @@ func TestGetArtifactStorageWithConfigMap(t *testing.T) { v1alpha1.BucketServiceAccountSecretKey: "sakey", }, }, - expectedArtifactStorage: &v1alpha1.ArtifactPVC{Name: prName}, + expectedArtifactStorage: &v1alpha1.ArtifactPVC{ + Name: pipelinerun.Name, + }, }, { desc: "no config map data", configMap: &corev1.ConfigMap{ @@ -424,18 +442,18 @@ func TestGetArtifactStorageWithConfigMap(t *testing.T) { Name: v1alpha1.BucketConfigName, }, }, - expectedArtifactStorage: &v1alpha1.ArtifactPVC{Name: prName}, + expectedArtifactStorage: &v1alpha1.ArtifactPVC{Name: pipelinerun.Name}, }} { t.Run(c.desc, func(t *testing.T) { fakekubeclient := fakek8s.NewSimpleClientset(c.configMap) - bucket, err := GetArtifactStorage(prName, fakekubeclient, logger) + artifactStorage, err := GetArtifactStorage(pipelinerun.Name, fakekubeclient, logger) if err != nil { t.Fatalf("Somehow had error initializing artifact storage run out of fake client: %s", err) } - if diff := cmp.Diff(bucket, c.expectedArtifactStorage); diff != "" { - t.Fatalf("want %v, but got %v", c.expectedArtifactStorage, bucket) + if diff := cmp.Diff(artifactStorage, c.expectedArtifactStorage); diff != "" { + t.Fatalf("want %v, but got %v", c.expectedArtifactStorage, artifactStorage) } }) } @@ -457,3 +475,41 @@ func TestGetArtifactStorageWithoutConfigMap(t *testing.T) { t.Fatalf("want %v, but got %v", expectedArtifactPVC, pvc) } } + +func TestGetArtifactStorageWithPvcConfigMap(t *testing.T) { + logger := logtesting.TestLogger(t) + prName := "pipelineruntest" + for _, c := range []struct { + desc string + configMap *corev1.ConfigMap + expectedArtifactStorage ArtifactStorageInterface + }{{ + desc: "valid pvc", + configMap: &corev1.ConfigMap{ + ObjectMeta: metav1.ObjectMeta{ + Namespace: system.GetNamespace(), + Name: PvcConfigName, + }, + Data: map[string]string{ + PvcSizeKey: "10Gi", + }, + }, + expectedArtifactStorage: &v1alpha1.ArtifactPVC{ + Name: "pipelineruntest", + }, + }, + } { + t.Run(c.desc, func(t *testing.T) { + fakekubeclient := fakek8s.NewSimpleClientset(c.configMap) + + artifactStorage, err := GetArtifactStorage(prName, fakekubeclient, logger) + if err != nil { + t.Fatalf("Somehow had error initializing artifact storage run out of fake client: %s", err) + } + + if diff := cmp.Diff(artifactStorage, c.expectedArtifactStorage); diff != "" { + t.Fatalf("want %v, but got %v", c.expectedArtifactStorage, artifactStorage) + } + }) + } +} diff --git a/pkg/artifacts/artifacts_storage.go b/pkg/artifacts/artifacts_storage.go index d553c4f5634..c2cc19c1093 100644 --- a/pkg/artifacts/artifacts_storage.go +++ b/pkg/artifacts/artifacts_storage.go @@ -30,6 +30,18 @@ import ( "k8s.io/client-go/kubernetes" ) +const ( + // PvcConfigName is the name of the configmap containing all + // customizations for the storage PVC. + PvcConfigName = "config-artifact-pvc" + + // PvcSizeKey is the name of the configmap entry that specifies the size of the PVC to create + PvcSizeKey = "size" + + // DefaultPvcSize is the default size of the PVC to create + DefaultPvcSize = "5Gi" +) + // ArtifactStorageInterface is an interface to define the steps to copy // an pipeline artifact to/from temporary storage type ArtifactStorageInterface interface { @@ -49,11 +61,11 @@ func InitializeArtifactStorage(pr *v1alpha1.PipelineRun, c kubernetes.Interface, return nil, err } if shouldCreatePVC { - err = createPVC(pr, c) + pvc, err := createPVC(pr, c) if err != nil { return nil, err } - return &v1alpha1.ArtifactPVC{Name: pr.Name}, nil + return &v1alpha1.ArtifactPVC{Name: pr.Name, PersistentVolumeClaim: pvc}, nil } return NewArtifactBucketConfigFromConfigMap(configMap) @@ -141,18 +153,35 @@ func NewArtifactBucketConfigFromConfigMap(configMap *corev1.ConfigMap) (*v1alpha return c, nil } -func createPVC(pr *v1alpha1.PipelineRun, c kubernetes.Interface) error { +func createPVC(pr *v1alpha1.PipelineRun, c kubernetes.Interface) (*corev1.PersistentVolumeClaim, error) { if _, err := c.CoreV1().PersistentVolumeClaims(pr.Namespace).Get(GetPVCName(pr), metav1.GetOptions{}); err != nil { if errors.IsNotFound(err) { - pvc := GetPVCSpec(pr) - if _, err := c.CoreV1().PersistentVolumeClaims(pr.Namespace).Create(pvc); err != nil { - return fmt.Errorf("failed to claim Persistent Volume %q due to error: %s", pr.Name, err) + + configMap, err := c.CoreV1().ConfigMaps(system.GetNamespace()).Get(PvcConfigName, metav1.GetOptions{}) + if err != nil && !errors.IsNotFound(err) { + return nil, fmt.Errorf("failed to get PVC ConfigMap %s for %q due to error: %s", PvcConfigName, pr.Name, err) } - return nil + var pvcSizeStr string + if configMap != nil { + pvcSizeStr = configMap.Data[PvcSizeKey] + } + if pvcSizeStr == "" { + pvcSizeStr = DefaultPvcSize + } + pvcSize, err := resource.ParseQuantity(pvcSizeStr) + if err != nil { + return nil, fmt.Errorf("failed to create Persistent Volume spec for %q due to error: %s", pr.Name, err) + } + pvcSpec := GetPVCSpec(pr, pvcSize) + pvc, err := c.CoreV1().PersistentVolumeClaims(pr.Namespace).Create(pvcSpec) + if err != nil { + return nil, fmt.Errorf("failed to claim Persistent Volume %q due to error: %s", pr.Name, err) + } + return pvc, nil } - return fmt.Errorf("failed to get claim Persistent Volume %q due to error: %s", pr.Name, err) + return nil, fmt.Errorf("failed to get claim Persistent Volume %q due to error: %s", pr.Name, err) } - return nil + return nil, nil } func deletePVC(pr *v1alpha1.PipelineRun, c kubernetes.Interface) error { @@ -167,9 +196,7 @@ func deletePVC(pr *v1alpha1.PipelineRun, c kubernetes.Interface) error { } // GetPVCSpec returns the PVC to create for a given PipelineRun -func GetPVCSpec(pr *v1alpha1.PipelineRun) *corev1.PersistentVolumeClaim { - // TODO(shashwathi): make this value configurable - pvcSizeBytes := int64(5 * 1024 * 1024 * 1024) // 5 GBs +func GetPVCSpec(pr *v1alpha1.PipelineRun, pvcSize resource.Quantity) *corev1.PersistentVolumeClaim { return &corev1.PersistentVolumeClaim{ ObjectMeta: metav1.ObjectMeta{ Namespace: pr.Namespace, @@ -180,7 +207,7 @@ func GetPVCSpec(pr *v1alpha1.PipelineRun) *corev1.PersistentVolumeClaim { AccessModes: []corev1.PersistentVolumeAccessMode{corev1.ReadWriteOnce}, Resources: corev1.ResourceRequirements{ Requests: map[corev1.ResourceName]resource.Quantity{ - corev1.ResourceStorage: *resource.NewQuantity(pvcSizeBytes, resource.BinarySI), + corev1.ResourceStorage: pvcSize, }, }, },