Skip to content
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

CSI: use HTTP headers for passing CSI secrets #12144

Merged
merged 2 commits into from
Mar 1, 2022
Merged
Changes from 1 commit
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
Prev Previous commit
address comments from code review
tgross committed Mar 1, 2022
commit 8e731af1920ca6087566b0535398b260676fe283
1 change: 1 addition & 0 deletions .changelog/12144.txt
Original file line number Diff line number Diff line change
@@ -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
@@ -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
4 changes: 2 additions & 2 deletions website/content/docs/commands/volume/snapshot-list.mdx
Original file line number Diff line number Diff line change
@@ -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.