Skip to content

Commit

Permalink
fixup: volume init spec
Browse files Browse the repository at this point in the history
  • Loading branch information
tgross committed Feb 28, 2022
1 parent 7b20b55 commit e6e2b04
Show file tree
Hide file tree
Showing 3 changed files with 166 additions and 15 deletions.
52 changes: 37 additions & 15 deletions command/volume_init.go
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ capacity_max = "20G"
# capabilities to validate. Registering an existing volume will record but
# ignore these fields.
capability {
access_mode = "single-node-writer"
access_mode = "single-node-writer"
attachment_mode = "file-system"
}
Expand All @@ -152,12 +152,14 @@ mount_options {
# Optional: specify one or more locations where the volume must be accessible
# from. Refer to the plugin documentation for what segment values are supported.
required_topology {
segments {rack = "R1", zone = "us-east-1a"}
}
required_topology {
segments {rack = "R2", zone = "us-east-1b"}
topology_request {
preferred {
topology { segments { rack = "R1" } }
}
required {
topology { segments { rack = "R1" } }
topology { segments { rack = "R2", zone = "us-east-1a" } }
}
}
# Optional: provide any secrets specified by the plugin.
Expand Down Expand Up @@ -211,14 +213,34 @@ var defaultJsonVolumeSpec = strings.TrimSpace(`
]
}
],
"require_topologies": [
{
"segments": {"rack": "R1", "zone": "us-east-1a"}
},
{
"segments": {"rack": "R2", "zone": "us-east-1b"}
}
]
"topology_request": {
"preferred": [
{
"topology": {
"segments": {
"rack": "R1"
}
}
}
],
"required": [
{
"topology": {
"segments": {
"rack": "R1"
}
}
},
{
"topology": {
"segments": {
"rack": "R2",
"zone": "us-east-1a"
}
}
}
]
},
"parameters": [
{
"skuname": "Premium_LRS"
Expand Down
58 changes: 58 additions & 0 deletions volume-0.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
{
"id": "ebs_prod_db1",
"name": "database",
"type": "csi",
"plugin_id": "plugin_id",
"external_id": "vol-23452345",
"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"
]
}
],
"topology_request": {
"preferred": [
"topology": {
"segments": {"rack": "R1"}
}
],
"required": [
"topology": {
"segments": {"rack": "R1"}
},
"topology": {
"segments": {"rack": "R2", "zone": "us-east-1a" }
}
]
},
"parameters": [
{
"skuname": "Premium_LRS"
}
],
"secrets": [
{
"example_secret": "xyzzy"
}
]
}
71 changes: 71 additions & 0 deletions volume.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
{
"id": "ebs_prod_db1",
"name": "database",
"type": "csi",
"plugin_id": "plugin_id",
"external_id": "vol-23452345",
"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"
]
}
],
"topology_request": {
"preferred": [
{
"topology": {
"segments": {
"rack": "R1"
}
}
}
],
"required": [
{
"topology": {
"segments": {
"rack": "R1"
}
}
},
{
"topology": {
"segments": {
"rack": "R2",
"zone": "us-east-1a"
}
}
}
]
},
"parameters": [
{
"skuname": "Premium_LRS"
}
],
"secrets": [
{
"example_secret": "xyzzy"
}
]
}

0 comments on commit e6e2b04

Please sign in to comment.