Skip to content

Support add the snapshot labels to images #1066

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions pkg/gce-cloud-provider/compute/fake-gce.go
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down
1 change: 1 addition & 0 deletions pkg/gce-cloud-provider/compute/gce-compute.go
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
2 changes: 2 additions & 0 deletions test/k8s-integration/config/image-volumesnapshotclass.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,5 @@ deletionPolicy: Delete
parameters:
snapshot-type: images
image-family: integration-test
# Add labels for testing.
labels: key1=value1,key2=value2
3 changes: 3 additions & 0 deletions test/k8s-integration/config/pd-volumesnapshotclass.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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