diff --git a/pkg/gce-cloud-provider/compute/fake-gce.go b/pkg/gce-cloud-provider/compute/fake-gce.go index 42e4d41da..0f51640e1 100644 --- a/pkg/gce-cloud-provider/compute/fake-gce.go +++ b/pkg/gce-cloud-provider/compute/fake-gce.go @@ -424,6 +424,7 @@ func (cloud *FakeCloudProvider) CreateImage(ctx context.Context, project string, SourceType: "RAW", Status: "PENDING", StorageLocations: snapshotParams.StorageLocations, + Labels: snapshotParams.Labels, } switch volKey.Type() { diff --git a/pkg/gce-cloud-provider/compute/gce-compute.go b/pkg/gce-cloud-provider/compute/gce-compute.go index 1c14e6001..8f2512806 100644 --- a/pkg/gce-cloud-provider/compute/gce-compute.go +++ b/pkg/gce-cloud-provider/compute/gce-compute.go @@ -924,6 +924,7 @@ func (cloud *CloudProvider) CreateImage(ctx context.Context, project string, vol Name: imageName, StorageLocations: snapshotParams.StorageLocations, Description: description, + Labels: snapshotParams.Labels, } _, err = cloud.service.Images.Insert(project, image).Context(ctx).ForceCreate(true).Do() diff --git a/test/k8s-integration/config/image-volumesnapshotclass.yaml b/test/k8s-integration/config/image-volumesnapshotclass.yaml index ee62f2150..fe704885f 100644 --- a/test/k8s-integration/config/image-volumesnapshotclass.yaml +++ b/test/k8s-integration/config/image-volumesnapshotclass.yaml @@ -7,3 +7,5 @@ deletionPolicy: Delete parameters: snapshot-type: images image-family: integration-test + # Add labels for testing. + labels: key1=value1,key2=value2 diff --git a/test/k8s-integration/config/pd-volumesnapshotclass.yaml b/test/k8s-integration/config/pd-volumesnapshotclass.yaml index bff9c3cde..427d4ebca 100644 --- a/test/k8s-integration/config/pd-volumesnapshotclass.yaml +++ b/test/k8s-integration/config/pd-volumesnapshotclass.yaml @@ -4,3 +4,6 @@ metadata: name: csi-gce-pd-snapshot-class driver: pd.csi.storage.gke.io deletionPolicy: Delete +parameters: + # Add labels for testing. + labels: key1=value1,key2=value2