...
1 package testingutil
2
3 import (
4 "k8s.io/apimachinery/pkg/api/resource"
5
6 corev1 "k8s.io/api/core/v1"
7 metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
8 )
9
10 func FakePVC(pvcName, size string, labels map[string]string) *corev1.PersistentVolumeClaim {
11 quantity, err := resource.ParseQuantity(size)
12 if err != nil {
13 return nil
14 }
15
16 return &corev1.PersistentVolumeClaim{
17 ObjectMeta: metav1.ObjectMeta{
18 Name: pvcName,
19 Labels: labels,
20 },
21 Spec: corev1.PersistentVolumeClaimSpec{
22 Resources: corev1.ResourceRequirements{
23 Requests: corev1.ResourceList{
24 corev1.ResourceStorage: quantity,
25 },
26 },
27 },
28 }
29 }
30
View as plain text