From 31c4f35050f0f3139ef4bc448e853d6ee9c26a1c Mon Sep 17 00:00:00 2001 From: Cody Baker Date: Mon, 22 Apr 2019 09:34:03 -0400 Subject: [PATCH 1/2] tag snapshots at creation --- driver/controller.go | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/driver/controller.go b/driver/controller.go index fb948a3b2..0faf0d1e5 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 From 8856ef320110da85c9aaa675599a89ed90963d57 Mon Sep 17 00:00:00 2001 From: Cody Baker Date: Mon, 22 Apr 2019 14:21:54 -0400 Subject: [PATCH 2/2] update changelog --- CHANGELOG.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 336f3766d..d18537b5c 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