diff --git a/CHANGELOG.md b/CHANGELOG.md index 336f3766..d18537b5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -19,6 +19,8 @@ [[GH-143]](https://github.com/digitalocean/csi-digitalocean/pull/143) * Fix race in snapshot integration test. [[GH-146]](https://github.com/digitalocean/csi-digitalocean/pull/146) +* Add tagging support for Volume snapshots via the new `--do-tag` flag + [[GH-145]](https://github.com/digitalocean/csi-digitalocean/pull/145) ## v1.0.0 - 2018.12.19 diff --git a/driver/controller.go b/driver/controller.go index fb948a3b..0faf0d1e 100644 --- a/driver/controller.go +++ b/driver/controller.go @@ -629,11 +629,16 @@ func (d *Driver) CreateSnapshot(ctx context.Context, req *csi.CreateSnapshotRequ } } - snap, resp, err := d.storage.CreateSnapshot(ctx, &godo.SnapshotCreateRequest{ + snapReq := &godo.SnapshotCreateRequest{ VolumeID: req.GetSourceVolumeId(), Name: req.GetName(), Description: createdByDO, - }) + } + if d.doTag != "" { + snapReq.Tags = append(snapReq.Tags, d.doTag) + } + + snap, resp, err := d.storage.CreateSnapshot(ctx, snapReq) if err != nil { if resp != nil && resp.StatusCode == http.StatusConflict { // 409 is returned when we try to snapshot a volume with the same