Skip to content

Commit

Permalink
address comments from code review
Browse files Browse the repository at this point in the history
  • Loading branch information
tgross committed Mar 1, 2022
1 parent 0e94b8f commit 8e731af
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 6 deletions.
1 change: 1 addition & 0 deletions .changelog/12144.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@ api: CSI secrets for list and delete snapshots are now passed in HTTP headers

```release-note:improvement
cli: CSI secrets argument for `volume snapshot list` has been made consistent with `volume snapshot delete`
```
8 changes: 4 additions & 4 deletions api/csi.go
Original file line number Diff line number Diff line change
Expand Up @@ -239,15 +239,15 @@ func (q *QueryOptions) SetHeadersFromCSISecrets(secrets CSISecrets) {
q.Headers["X-Nomad-CSI-Secrets"] = strings.Join(pairs, ",")
}

func (q *WriteOptions) SetHeadersFromCSISecrets(secrets CSISecrets) {
func (w *WriteOptions) SetHeadersFromCSISecrets(secrets CSISecrets) {
pairs := []string{}
for k, v := range secrets {
pairs = append(pairs, fmt.Sprintf("%v=%v", k, v))
}
if q.Headers == nil {
q.Headers = map[string]string{}
if w.Headers == nil {
w.Headers = map[string]string{}
}
q.Headers["X-Nomad-CSI-Secrets"] = strings.Join(pairs, ",")
w.Headers["X-Nomad-CSI-Secrets"] = strings.Join(pairs, ",")
}

// CSIVolume is used for serialization, see also nomad/structs/csi.go
Expand Down
4 changes: 2 additions & 2 deletions website/content/docs/commands/volume/snapshot-list.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@ Nomad.
there is an exact match based on the provided plugin, then that specific
plugin will be queried. Otherwise, a list of matching plugins will be
displayed.
- `-secret`: Secrets to pass to the plugin to delete the
snapshot. Accepts multiple flags in the form `-secret key=value`
- `-secret`: Secrets to pass to the plugin to list snapshots. Accepts
multiple flags in the form `-secret key=value`

When ACLs are enabled, this command requires a token with the
`csi-list-volumes` capability for the plugin's namespace.
Expand Down

0 comments on commit 8e731af

Please sign in to comment.