Skip to content

Commit

Permalink
dynamic host volumes: set namespace from volume spec when monitoring (#…
Browse files Browse the repository at this point in the history
…24586)

In #24528 we added monitoring to the CLI for dynamic host volume creation. But
when the volume's namespace is set by the volume specification instead of the
`-namespace` flag, the API client doesn't have the right namespace and gets a
404 when setting up the monitoring. The specification always overrides the
`-namespace` flag, so use that when available for all subsequent API calls.

Ref: #24479
  • Loading branch information
tgross committed Dec 19, 2024
1 parent f0b89fc commit df258ac
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions command/volume_create_host.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,10 @@ func (c *VolumeCreateCommand) hostVolumeCreate(
lastIndex = vol.ModifyIndex
}

if vol.Namespace != "" {
client.SetNamespace(vol.Namespace)
}

err = c.monitorHostVolume(client, volID, lastIndex, verbose)
if err != nil {
c.Ui.Error(fmt.Sprintf("==> %s: %v", formatTime(time.Now()), err.Error()))
Expand Down

0 comments on commit df258ac

Please sign in to comment.