Skip to content
This repository has been archived by the owner on Jan 8, 2024. It is now read-only.

Commit

Permalink
Merge pull request #4157 from hashicorp/b-nomad-csi-params
Browse files Browse the repository at this point in the history
Use CSI params on Nomad server install
  • Loading branch information
paladin-devops authored Nov 2, 2022
2 parents 1355fb5 + a368630 commit 1e39110
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 1 deletion.
3 changes: 3 additions & 0 deletions .changelog/4157.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
```release-note:bug
install/nomad: Update installation with Nomad to use CSI parameters.
```
3 changes: 2 additions & 1 deletion internal/installutil/nomad/nomad.go
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ func CreatePersistentVolume(
client *api.Client,
id, name, csiPluginId, csiVolumeProvider, csiFS, csiExternalId string,
csiVolumeCapacityMin, csiVolumeCapacityMax int64,
csiTopologies, csiSecrets map[string]string,
csiTopologies, csiSecrets, csiParams map[string]string,
) error {
vol := api.CSIVolume{
ID: id,
Expand All @@ -187,6 +187,7 @@ func CreatePersistentVolume(
RequestedCapacityMin: DefaultCSIVolumeCapacityMin,
RequestedCapacityMax: DefaultCSIVolumeCapacityMax,
PluginID: csiPluginId,
Parameters: csiParams,
Provider: csiVolumeProvider,
RequestedTopologies: &api.CSITopologyRequest{
Required: nil,
Expand Down
8 changes: 8 additions & 0 deletions internal/runnerinstall/nomad.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ type NomadConfig struct {
CsiFS string `hcl:"csi_fs,optional"`
CsiTopologies map[string]string `hcl:"nomad_csi_topologies,optional"`
CsiExternalId string `hcl:"nomad_csi_external_id,optional"`
CsiParams map[string]string `hcl:"nomad_csi_params,optional"`
CsiPluginId string `hcl:"nomad_csi_plugin_id"`
CsiSecrets map[string]string `hcl:"nomad_csi_secrets,optional"`
CsiVolume string `hcl:"nomad_csi_volume,optional"`
Expand Down Expand Up @@ -101,6 +102,7 @@ func (i *NomadRunnerInstaller) Install(ctx context.Context, opts *InstallOpts) e
i.Config.CsiVolumeCapacityMax,
i.Config.CsiTopologies,
i.Config.CsiSecrets,
i.Config.CsiParams,
)
if err != nil {
return fmt.Errorf("error creating Nomad persistent volume: %s", clierrors.Humanize(err))
Expand Down Expand Up @@ -280,6 +282,12 @@ func (i *NomadRunnerInstaller) InstallFlags(set *flag.Set) {
Default: nomadutil.DefaultCSIVolumeMountFS,
})

set.StringMapVar(&flag.StringMapVar{
Name: "nomad-csi-params",
Target: &i.Config.CsiParams,
Usage: "Parameters passed directly to the CSI plugin to configure the volume.",
})

set.StringMapVar(&flag.StringMapVar{
Name: "nomad-csi-topologies",
Target: &i.Config.CsiTopologies,
Expand Down
2 changes: 2 additions & 0 deletions internal/serverinstall/nomad.go
Original file line number Diff line number Diff line change
Expand Up @@ -226,6 +226,7 @@ func (i *NomadInstaller) Install(
i.config.csiVolumeCapacityMax,
i.config.csiTopologies,
i.config.csiSecrets,
i.config.csiParams,
)
if err != nil {
return nil, "", status.Errorf(codes.Internal, "Failed creating Nomad persistent volume: %s", err)
Expand Down Expand Up @@ -641,6 +642,7 @@ func (i *NomadInstaller) InstallRunner(
CsiFS: i.config.csiFS,
CsiTopologies: i.config.csiTopologies,
CsiExternalId: i.config.csiExternalId,
CsiParams: i.config.csiParams,
CsiPluginId: i.config.csiPluginId,
CsiSecrets: i.config.csiSecrets,
CsiVolume: i.config.runnerCsiVolume,
Expand Down
1 change: 1 addition & 0 deletions website/content/commands/runner-install.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ the install, the command would be:
- `-nomad-csi-volume-capacity-min=<int>` - Nomad CSI volume capacity minimum, in bytes. The default is 1073741824.
- `-nomad-csi-volume-capacity-max=<int>` - Nomad CSI volume capacity maximum, in bytes. The default is 2147483648.
- `-nomad-csi-fs=<string>` - Nomad CSI volume mount option file system. The default is xfs.
- `-nomad-csi-params=<key=value>` - Parameters passed directly to the CSI plugin to configure the volume.
- `-nomad-csi-topologies=<key=value>` - Locations from which the Nomad Volume will be accessible.
- `-nomad-csi-external-id=<string>` - The ID of the physical volume from the Nomad storage provider.
- `-nomad-csi-secrets=<key=value>` - Credentials for publishing volume for Waypoint runner.
Expand Down

0 comments on commit 1e39110

Please sign in to comment.