Skip to content

Commit cc167ba

Browse files
authored
tag snapshots at creation (#145)
* tag snapshots at creation
1 parent fb1c08d commit cc167ba

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

CHANGELOG.md

+2
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@
1919
[[GH-143]](https://github.com/digitalocean/csi-digitalocean/pull/143)
2020
* Fix race in snapshot integration test.
2121
[[GH-146]](https://github.com/digitalocean/csi-digitalocean/pull/146)
22+
* Add tagging support for Volume snapshots via the new `--do-tag` flag
23+
[[GH-145]](https://github.com/digitalocean/csi-digitalocean/pull/145)
2224

2325
## v1.0.0 - 2018.12.19
2426

driver/controller.go

+7-2
Original file line numberDiff line numberDiff line change
@@ -629,11 +629,16 @@ func (d *Driver) CreateSnapshot(ctx context.Context, req *csi.CreateSnapshotRequ
629629
}
630630
}
631631

632-
snap, resp, err := d.storage.CreateSnapshot(ctx, &godo.SnapshotCreateRequest{
632+
snapReq := &godo.SnapshotCreateRequest{
633633
VolumeID: req.GetSourceVolumeId(),
634634
Name: req.GetName(),
635635
Description: createdByDO,
636-
})
636+
}
637+
if d.doTag != "" {
638+
snapReq.Tags = append(snapReq.Tags, d.doTag)
639+
}
640+
641+
snap, resp, err := d.storage.CreateSnapshot(ctx, snapReq)
637642
if err != nil {
638643
if resp != nil && resp.StatusCode == http.StatusConflict {
639644
// 409 is returned when we try to snapshot a volume with the same

0 commit comments

Comments
 (0)