diff --git a/.changelog/3546.txt b/.changelog/3546.txt new file mode 100644 index 00000000000..a281381a972 --- /dev/null +++ b/.changelog/3546.txt @@ -0,0 +1,4 @@ +```release-note:improvement +CLI: Nomad CSI volumes names can be specified during installation and upgrades for both Waypoint runners and Waypoint server installations +``` + diff --git a/internal/runnerinstall/nomad.go b/internal/runnerinstall/nomad.go index 43051d699f3..c97ba9a71be 100644 --- a/internal/runnerinstall/nomad.go +++ b/internal/runnerinstall/nomad.go @@ -43,6 +43,7 @@ type NomadConfig struct { CsiExternalId string `hcl:"nomad_csi_external_id,optional"` CsiPluginId string `hcl:"nomad_csi_plugin_id,required"` CsiSecrets map[string]string `hcl:"nomad_csi_secrets,optional"` + CsiVolume string `hcl:"nomad_csi_volume,optional"` NomadHost string `hcl:"nomad_host,optional"` } @@ -73,13 +74,16 @@ func (i *NomadRunnerInstaller) Install(ctx context.Context, opts *InstallOpts) e if i.Config.HostVolume != "" { return fmt.Errorf("choose either CSI or host volume, not both") } + if i.Config.CsiVolume == "" { + i.Config.CsiVolume = defaultRunnerName(opts.Id) + } s = sg.Add("Creating persistent volume") err = nomadutil.CreatePersistentVolume( ctx, client, - "waypoint-"+opts.Id+"-runner", - "waypoint-"+opts.Id+"-runner", + defaultRunnerName(opts.Id), + i.Config.CsiVolume, i.Config.CsiPluginId, i.Config.CsiVolumeProvider, i.Config.CsiFS, @@ -284,6 +288,12 @@ func (i *NomadRunnerInstaller) InstallFlags(set *flag.Set) { Target: &i.Config.CsiSecrets, Usage: "Credentials for publishing volume for Waypoint runner.", }) + + set.StringVar(&flag.StringVar{ + Name: "nomad-csi-volume", + Target: &i.Config.CsiVolume, + Usage: fmt.Sprintf("The name of the volume to initialize within the CSI provider. The default is %s.", defaultRunnerName("[runner_id]")), + }) } func (i *NomadRunnerInstaller) Uninstall(ctx context.Context, opts *InstallOpts) error { diff --git a/internal/serverinstall/nomad.go b/internal/serverinstall/nomad.go index 01de8e45b55..95f020d6c3a 100644 --- a/internal/serverinstall/nomad.go +++ b/internal/serverinstall/nomad.go @@ -67,6 +67,7 @@ type nomadConfig struct { csiTopologies map[string]string `hcl:"nomad_csi_topologies,optional"` csiSecrets map[string]string `hcl:"nomad_csi_secrets,optional"` csiParams map[string]string `hcl:"csi_parameters,optional"` + csiVolume string `hcl:"nomad_csi_volume,optional"` nomadHost string `hcl:"nomad_host,optional"` runnerResourcesCPU string `hcl:"runner_resources_cpu,optional"` @@ -75,6 +76,7 @@ type nomadConfig struct { runnerCsiVolumeProvider string `hcl:"runner_csi_volume_provider,optional"` runnerCsiVolumeCapacityMin int64 `hcl:"runner_csi_volume_capacity_min,optional"` runnerCsiVolumeCapacityMax int64 `hcl:"runner_csi_volume_capacity_max,optional"` + runnerCsiVolume string `hcl:"runner_csi_volume,optional"` } var ( @@ -209,7 +211,7 @@ func (i *NomadInstaller) Install( ctx, client, "waypoint-server", - "waypoint-server", + i.config.csiVolume, i.config.csiPluginId, i.config.csiVolumeProvider, i.config.csiFS, @@ -642,6 +644,7 @@ func (i *NomadInstaller) InstallRunner( CsiExternalId: i.config.csiExternalId, CsiPluginId: i.config.csiPluginId, CsiSecrets: i.config.csiSecrets, + CsiVolume: i.config.runnerCsiVolume, NomadHost: i.config.nomadHost, }, } @@ -1159,6 +1162,12 @@ func (i *NomadInstaller) InstallFlags(set *flag.Set) { Usage: "Name of the CSI volume provider to use for the Waypoint runner.", }) + set.StringVar(&flag.StringVar{ + Name: "nomad-runner-csi-volume", + Target: &i.config.runnerCsiVolume, + Usage: "The name of the volume to initialize for the Waypoint runner within the CSI provider.", + }) + // TODO: Update default values for runner - less space is needed for runner compared to server set.Int64Var(&flag.Int64Var{ Name: "nomad-runner-csi-volume-capacity-min", @@ -1295,6 +1304,13 @@ func (i *NomadInstaller) InstallFlags(set *flag.Set) { Target: &i.config.csiTopologies, Usage: "Locations from which the Nomad Volume will be accessible.", }) + + set.StringVar(&flag.StringVar{ + Name: "nomad-csi-volume", + Target: &i.config.csiVolume, + Usage: "The name of the volume to initialize for Waypoint server within the CSI provider.", + Default: "waypoint-server", + }) } func (i *NomadInstaller) UpgradeFlags(set *flag.Set) { @@ -1394,6 +1410,12 @@ func (i *NomadInstaller) UpgradeFlags(set *flag.Set) { Usage: "Name of the CSI volume provider to use for the Waypoint runner.", }) + set.StringVar(&flag.StringVar{ + Name: "nomad-runner-csi-volume", + Target: &i.config.runnerCsiVolume, + Usage: "The name of the volume to initialize for the Waypoint runner within the CSI provider.", + }) + // TODO: Update default values for runner - less space is needed for runner compared to server set.Int64Var(&flag.Int64Var{ Name: "nomad-runner-csi-volume-capacity-min", diff --git a/website/content/commands/install.mdx b/website/content/commands/install.mdx index 7cf27a75119..6f34ce61a19 100644 --- a/website/content/commands/install.mdx +++ b/website/content/commands/install.mdx @@ -115,6 +115,7 @@ and disable the UI, the command would be: - `-nomad-runner-memory=` - MB of Memory to allocate to the runner job task. The default is 600. - `-nomad-runner-host-volume=` - Name of the host volume to use for the Waypoint runner. - `-nomad-runner-csi-volume-provider=` - Name of the CSI volume provider to use for the Waypoint runner. +- `-nomad-runner-csi-volume=` - The name of the volume to initialize for the Waypoint runner within the CSI provider. - `-nomad-runner-csi-volume-capacity-min=` - Waypoint runner Nomad CSI volume capacity minimum, in bytes. The default is 1073741824. - `-nomad-runner-csi-volume-capacity-max=` - Waypoint runner Nomad CSI volume capacity maximum, in bytes. The default is 2147483648. - `-nomad-server-image=` - Docker image for the Waypoint server. The default is hashicorp/waypoint:latest. @@ -135,5 +136,6 @@ and disable the UI, the command would be: - `-nomad-csi-plugin-id=` - The ID of the CSI plugin that manages the volume, required for volume type 'csi'. - `-nomad-csi-external-id=` - The ID of the physical volume from the Nomad storage provider. - `-nomad-csi-topologies=` - Locations from which the Nomad Volume will be accessible. +- `-nomad-csi-volume=` - The name of the volume to initialize for Waypoint server within the CSI provider. The default is waypoint-server. @include "commands/install_more.mdx" diff --git a/website/content/commands/runner-install.mdx b/website/content/commands/runner-install.mdx index 0bc5d50658d..f608f685fc5 100644 --- a/website/content/commands/runner-install.mdx +++ b/website/content/commands/runner-install.mdx @@ -82,5 +82,6 @@ unless the '-skip-adopt' flag is set to true. - `-nomad-csi-topologies=` - Locations from which the Nomad Volume will be accessible. - `-nomad-csi-external-id=` - The ID of the physical volume from the Nomad storage provider. - `-nomad-csi-secrets=` - Credentials for publishing volume for Waypoint runner. +- `-nomad-csi-volume=` - The name of the volume to initialize within the CSI provider. The default is waypoint-[runner_id]-runner. @include "commands/runner-install_more.mdx" diff --git a/website/content/commands/server-install.mdx b/website/content/commands/server-install.mdx index 7ba1bf907ce..aa18e7d5afc 100644 --- a/website/content/commands/server-install.mdx +++ b/website/content/commands/server-install.mdx @@ -115,6 +115,7 @@ and disable the UI, the command would be: - `-nomad-runner-memory=` - MB of Memory to allocate to the runner job task. The default is 600. - `-nomad-runner-host-volume=` - Name of the host volume to use for the Waypoint runner. - `-nomad-runner-csi-volume-provider=` - Name of the CSI volume provider to use for the Waypoint runner. +- `-nomad-runner-csi-volume=` - The name of the volume to initialize for the Waypoint runner within the CSI provider. - `-nomad-runner-csi-volume-capacity-min=` - Waypoint runner Nomad CSI volume capacity minimum, in bytes. The default is 1073741824. - `-nomad-runner-csi-volume-capacity-max=` - Waypoint runner Nomad CSI volume capacity maximum, in bytes. The default is 2147483648. - `-nomad-server-image=` - Docker image for the Waypoint server. The default is hashicorp/waypoint:latest. @@ -135,5 +136,6 @@ and disable the UI, the command would be: - `-nomad-csi-plugin-id=` - The ID of the CSI plugin that manages the volume, required for volume type 'csi'. - `-nomad-csi-external-id=` - The ID of the physical volume from the Nomad storage provider. - `-nomad-csi-topologies=` - Locations from which the Nomad Volume will be accessible. +- `-nomad-csi-volume=` - The name of the volume to initialize for Waypoint server within the CSI provider. The default is waypoint-server. @include "commands/server-install_more.mdx" diff --git a/website/content/commands/server-upgrade.mdx b/website/content/commands/server-upgrade.mdx index d0829ae65fb..a93dcb64cd1 100644 --- a/website/content/commands/server-upgrade.mdx +++ b/website/content/commands/server-upgrade.mdx @@ -84,6 +84,7 @@ manually installed runners will not be automatically upgraded. - `-nomad-runner-memory=` - MB of Memory to allocate to the runner job task. The default is 600. - `-nomad-runner-host-volume=` - Name of the host volume to use for the Waypoint runner. - `-nomad-runner-csi-volume-provider=` - Name of the CSI volume provider to use for the Waypoint runner. +- `-nomad-runner-csi-volume=` - The name of the volume to initialize for the Waypoint runner within the CSI provider. - `-nomad-runner-csi-volume-capacity-min=` - Waypoint runner Nomad CSI volume capacity minimum, in bytes. The default is 1073741824. - `-nomad-runner-csi-volume-capacity-max=` - Waypoint runner Nomad CSI volume capacity maximum, in bytes. The default is 2147483648. - `-nomad-server-image=` - Docker image for the Waypoint server. The default is hashicorp/waypoint:latest.