Skip to content

Commit 382229a

Browse files
authored
Merge pull request #1066 from jenting/jenting/images-support-snapshot-labels
Support add the snapshot labels to images
2 parents b4f6d95 + caa7f4d commit 382229a

File tree

4 files changed

+7
-0
lines changed

4 files changed

+7
-0
lines changed

pkg/gce-cloud-provider/compute/fake-gce.go

+1
Original file line numberDiff line numberDiff line change
@@ -424,6 +424,7 @@ func (cloud *FakeCloudProvider) CreateImage(ctx context.Context, project string,
424424
SourceType: "RAW",
425425
Status: "PENDING",
426426
StorageLocations: snapshotParams.StorageLocations,
427+
Labels: snapshotParams.Labels,
427428
}
428429

429430
switch volKey.Type() {

pkg/gce-cloud-provider/compute/gce-compute.go

+1
Original file line numberDiff line numberDiff line change
@@ -924,6 +924,7 @@ func (cloud *CloudProvider) CreateImage(ctx context.Context, project string, vol
924924
Name: imageName,
925925
StorageLocations: snapshotParams.StorageLocations,
926926
Description: description,
927+
Labels: snapshotParams.Labels,
927928
}
928929

929930
_, err = cloud.service.Images.Insert(project, image).Context(ctx).ForceCreate(true).Do()

test/k8s-integration/config/image-volumesnapshotclass.yaml

+2
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,5 @@ deletionPolicy: Delete
77
parameters:
88
snapshot-type: images
99
image-family: integration-test
10+
# Add labels for testing.
11+
labels: key1=value1,key2=value2

test/k8s-integration/config/pd-volumesnapshotclass.yaml

+3
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,6 @@ metadata:
44
name: csi-gce-pd-snapshot-class
55
driver: pd.csi.storage.gke.io
66
deletionPolicy: Delete
7+
parameters:
8+
# Add labels for testing.
9+
labels: key1=value1,key2=value2

0 commit comments

Comments
 (0)