Skip to content

Commit 442bdde

Browse files
Add provisionedIops for pd-extreme
1 parent 8ce6579 commit 442bdde

File tree

3 files changed

+41
-16
lines changed

3 files changed

+41
-16
lines changed

README.md

+8-6
Original file line numberDiff line numberDiff line change
@@ -58,12 +58,14 @@ See Github [Issues](https://github.com/kubernetes-sigs/gcp-compute-persistent-di
5858

5959
### CreateVolume Parameters
6060

61-
| Parameter | Values | Default | Description |
62-
|------------------|---------------------------|---------------|----------------------------------------------------------------------------------------------------|
63-
| type | Any PD type (see [GCP documentation](https://cloud.google.com/compute/docs/disks#disk-types)), eg `pd-ssd` `pd-balanced` | `pd-standard` | Type allows you to choose between standard Persistent Disks or Solid State Drive Persistent Disks |
64-
| replication-type | `none` OR `regional-pd` | `none` | Replication type allows you to choose between Zonal Persistent Disks or Regional Persistent Disks |
65-
| disk-encryption-kms-key | Fully qualified resource identifier for the key to use to encrypt new disks. | Empty string. | Encrypt disk using Customer Managed Encryption Key (CMEK). See [GKE Docs](https://cloud.google.com/kubernetes-engine/docs/how-to/using-cmek#create_a_cmek_protected_attached_disk) for details. |
66-
| labels | `key1=value1,key2=value2` | | Labels allow you to assign custom [GCE Disk labels](https://cloud.google.com/compute/docs/labeling-resources). |
61+
| Parameter | Values | Default | Description |
62+
|-----------------------------|---------------------------|---------------|----------------------------------------------------------------------------------------------------|
63+
| type | Any PD type (see [GCP documentation](https://cloud.google.com/compute/docs/disks#disk-types)), eg `pd-ssd` `pd-balanced` | `pd-standard` | Type allows you to choose between standard Persistent Disks or Solid State Drive Persistent Disks |
64+
| replication-type | `none` OR `regional-pd` | `none` | Replication type allows you to choose between Zonal Persistent Disks or Regional Persistent Disks |
65+
| disk-encryption-kms-key | Fully qualified resource identifier for the key to use to encrypt new disks. | Empty string. | Encrypt disk using Customer Managed Encryption Key (CMEK). See [GKE Docs](https://cloud.google.com/kubernetes-engine/docs/how-to/using-cmek#create_a_cmek_protected_attached_disk) for details. |
66+
| labels | `key1=value1,key2=value2` | | Labels allow you to assign custom [GCE Disk labels](https://cloud.google.com/compute/docs/labeling-resources). |
67+
| provisioned-iops-on-create | string (int64 format). Values must be between 10,000 and 120,000 | | Indicates how many IOPS to provision for the disk. See the [Extreme persistent disk documentation](https://cloud.google.com/compute/docs/disks/extreme-persistent-disk). |
68+
6769

6870
### Topology
6971

pkg/common/parameters.go

+16-9
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,11 @@ import (
2323

2424
const (
2525
// Parameters for StorageClass
26-
ParameterKeyType = "type"
27-
ParameterKeyReplicationType = "replication-type"
28-
ParameterKeyDiskEncryptionKmsKey = "disk-encryption-kms-key"
29-
ParameterKeyLabels = "labels"
26+
ParameterKeyType = "type"
27+
ParameterKeyReplicationType = "replication-type"
28+
ParameterKeyDiskEncryptionKmsKey = "disk-encryption-kms-key"
29+
ParameterKeyLabels = "labels"
30+
ParameterKeyProvisionedIOPSOnCreate = "provisioned-iops-on-create"
3031

3132
// Parameters for VolumeSnapshotClass
3233
ParameterKeyStorageLocations = "storage-locations"
@@ -75,6 +76,9 @@ type DiskParameters struct {
7576
// Values: {map[string]string}
7677
// Default: ""
7778
Labels map[string]string
79+
// Values: {string}
80+
// Default: ""
81+
ProvisionedIOPSOnCreate string
7882
}
7983

8084
// SnapshotParameters contains normalized and defaulted parameters for snapshots
@@ -92,11 +96,12 @@ type SnapshotParameters struct {
9296
// parameters, any matching extraVolumeLabels will be overridden.
9397
func ExtractAndDefaultParameters(parameters map[string]string, driverName string, extraVolumeLabels map[string]string) (DiskParameters, error) {
9498
p := DiskParameters{
95-
DiskType: "pd-standard", // Default
96-
ReplicationType: replicationTypeNone, // Default
97-
DiskEncryptionKMSKey: "", // Default
98-
Tags: make(map[string]string), // Default
99-
Labels: make(map[string]string), // Default
99+
DiskType: "pd-standard", // Default
100+
ReplicationType: replicationTypeNone, // Default
101+
DiskEncryptionKMSKey: "", // Default
102+
Tags: make(map[string]string), // Default
103+
Labels: make(map[string]string), // Default
104+
ProvisionedIOPSOnCreate: "", // Default
100105
}
101106

102107
for k, v := range extraVolumeLabels {
@@ -135,6 +140,8 @@ func ExtractAndDefaultParameters(parameters map[string]string, driverName string
135140
for labelKey, labelValue := range paramLabels {
136141
p.Labels[labelKey] = labelValue
137142
}
143+
case ParameterKeyProvisionedIOPSOnCreate:
144+
p.ProvisionedIOPSOnCreate = v
138145
default:
139146
return p, fmt.Errorf("parameters contains invalid option %q", k)
140147
}

pkg/common/parameters_test.go

+17-1
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ func TestExtractAndDefaultParameters(t *testing.T) {
5555
},
5656
{
5757
name: "random keys",
58-
parameters: map[string]string{ParameterKeyType: "", "foo": "", ParameterKeyDiskEncryptionKmsKey: "", ParameterKeyLabels: ""},
58+
parameters: map[string]string{ParameterKeyType: "", "foo": "", ParameterKeyDiskEncryptionKmsKey: "", ParameterKeyLabels: "", ParameterKeyProvisionedIOPSOnCreate: ""},
5959
labels: map[string]string{},
6060
expectErr: true,
6161
},
@@ -74,6 +74,22 @@ func TestExtractAndDefaultParameters(t *testing.T) {
7474
},
7575
},
7676
},
77+
{
78+
name: "values from parameters, checking pd-extreme",
79+
parameters: map[string]string{ParameterKeyType: "pd-extreme", ParameterKeyReplicationType: "none", ParameterKeyDiskEncryptionKmsKey: "foo/key", ParameterKeyLabels: "key1=value1,key2=value2", ParameterKeyProvisionedIOPSOnCreate: "10000"},
80+
labels: map[string]string{},
81+
expectParams: DiskParameters{
82+
DiskType: "pd-extreme",
83+
ReplicationType: "none",
84+
DiskEncryptionKMSKey: "foo/key",
85+
Tags: map[string]string{},
86+
Labels: map[string]string{
87+
"key1": "value1",
88+
"key2": "value2",
89+
},
90+
ProvisionedIOPSOnCreate: "10000",
91+
},
92+
},
7793
{
7894
name: "values from parameters, checking balanced pd",
7995
parameters: map[string]string{ParameterKeyType: "pd-balanced", ParameterKeyReplicationType: "regional-pd", ParameterKeyDiskEncryptionKmsKey: "foo/key"},

0 commit comments

Comments
 (0)