Skip to content

Commit

Permalink
update volume init for new volume spec
Browse files Browse the repository at this point in the history
  • Loading branch information
tgross committed Mar 31, 2021
1 parent b75bd67 commit 8048048
Showing 1 changed file with 79 additions and 23 deletions.
102 changes: 79 additions & 23 deletions command/volume_init.go
Original file line number Diff line number Diff line change
Expand Up @@ -105,23 +105,59 @@ func (c *VolumeInitCommand) Run(args []string) int {
}

var defaultHclVolumeSpec = strings.TrimSpace(`
id = "ebs_prod_db1"
name = "database"
type = "csi"
external_id = "vol-23452345"
access_mode = "single-node-writer"
attachment_mode = "file-system"
id = "ebs_prod_db1"
name = "database"
type = "csi"
plugin_id = "plugin_id"
# For 'nomad volume register', provide the external ID from the storage
# provider. This field should be omitted when creating a volume with
# 'nomad volume create'
external_id = "vol-23452345"
# For 'nomad volume create', specify a snapshot ID or volume to clone. You can
# specify only one of these two fields.
snapshot_id = "snap-12345"
# clone_id = "vol-abcdef"
# Optional: for 'nomad volume create', specify a maximum and minimum capacity.
# Registering an existing volume will record but ignore these fields.
capacity_min = "10GiB"
capacity_max = "20G"
# Optional: for 'nomad volume create', specify one or more capabilities to
# validate. Registering an existing volume will record but ignore these fields.
capability {
access_mode = "single-node-writer"
attachment_mode = "file-system"
}
capability {
access_mode = "single-node-reader"
attachment_mode = "block-device"
}
# Optional: for 'nomad volume create', specify mount options to
# validate. Registering an existing volume will record but ignore these
# fields.
mount_options {
fs_type = "ext4"
mount_flags = ["ro"]
}
# Optional: provide any secrets specified by the plugin.
secrets {
example_secret = "xyzzy"
}
# Optional: provide a map of keys to string values expected by the plugin.
parameters {
skuname = "Premium_LRS"
}
# Optional: for 'nomad volume register', provide a map of keys to string
# values expected by the plugin. This field will populated automatically by
# 'nomad volume create'.
context {
endpoint = "http://192.168.1.101:9425"
}
Expand All @@ -132,23 +168,43 @@ var defaultJsonVolumeSpec = strings.TrimSpace(`
"id": "ebs_prod_db1",
"name": "database",
"type": "csi",
"plugin_id": "plugin_id",
"external_id": "vol-23452345",
"access_mode": "single-node-writer",
"attachment_mode": "file-system",
"mount_options": {
"fs_type": "ext4",
"mount_flags": [
"ro"
]
},
"secrets": {
"example_secret": "xyzzy"
},
"parameters": {
"skuname": "Premium_LRS"
},
"context": {
"endpoint": "http://192.168.1.101:9425"
}
"snapshot_id": "snap-12345",
"capacity_min": "10GiB",
"capacity_max": "20G",
"capability": [
{
"access_mode": "single-node-writer",
"attachment_mode": "file-system"
},
{
"access_mode": "single-node-reader",
"attachment_mode": "block-device"
}
],
"context": [
{
"endpoint": "http://192.168.1.101:9425"
}
],
"mount_options": [
{
"fs_type": "ext4",
"mount_flags": [
"ro"
]
}
],
"parameters": [
{
"skuname": "Premium_LRS"
}
],
"secrets": [
{
"example_secret": "xyzzy"
}
]
}
`)

0 comments on commit 8048048

Please sign in to comment.