Skip to content

Commit caa3eae

Browse files
authored
Merge pull request kubernetes-sigs#1861 from travisyx/automated-cherry-pick-of-#1826-kubernetes-sigs#1836-kubernetes-sigs#1838-kubernetes-sigs#1841-upstream-release-1.15
Automated cherry pick of kubernetes-sigs#1826: Add ControllerModifyVolume E2E tests kubernetes-sigs#1836: Create documentation for ControllerModifyVolume and controller default kubernetes-sigs#1838: Enable VolumeAttributesClass feature gate for CI runs kubernetes-sigs#1841: Update logic to use SI for VACs
2 parents b038bcb + 547bc8b commit caa3eae

File tree

16 files changed

+331
-151
lines changed

16 files changed

+331
-151
lines changed

deploy/kubernetes/base/controller/controller.yaml

+2
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,8 @@ spec:
141141
args:
142142
- "--v=5"
143143
- "--endpoint=unix:/csi/csi.sock"
144+
- "--supports-dynamic-iops-provisioning=hyperdisk-balanced,hyperdisk-extreme"
145+
- "--supports-dynamic-throughput-provisioning=hyperdisk-balanced,hyperdisk-throughput,hyperdisk-ml"
144146
env:
145147
- name: GOOGLE_APPLICATION_CREDENTIALS
146148
value: "/etc/cloud-sa/cloud-sa.json"

deploy/kubernetes/images/prow-stable-sidecar-rc-master/image.yaml

+6-6
Original file line numberDiff line numberDiff line change
@@ -7,39 +7,39 @@ metadata:
77
name: imagetag-csi-provisioner-prow-rc
88
imageTag:
99
name: registry.k8s.io/sig-storage/csi-provisioner
10-
newTag: "v3.4.0"
10+
newTag: "v5.1.0"
1111
---
1212
apiVersion: builtin
1313
kind: ImageTagTransformer
1414
metadata:
1515
name: imagetag-csi-attacher-prow-rc
1616
imageTag:
1717
name: registry.k8s.io/sig-storage/csi-attacher
18-
newTag: "v4.2.0"
18+
newTag: "v4.4.3"
1919
---
2020
apiVersion: builtin
2121
kind: ImageTagTransformer
2222
metadata:
2323
name: imagetag-csi-resize-prow-rc
2424
imageTag:
2525
name: registry.k8s.io/sig-storage/csi-resizer
26-
newTag: "v1.7.0"
26+
newTag: "v1.11.1"
2727
---
2828
apiVersion: builtin
2929
kind: ImageTagTransformer
3030
metadata:
3131
name: imagetag-csi-snapshotter-prow-head
3232
imageTag:
3333
name: registry.k8s.io/sig-storage/csi-snapshotter
34-
newTag: "v6.1.0"
34+
newTag: "v6.3.3"
3535
---
3636
apiVersion: builtin
3737
kind: ImageTagTransformer
3838
metadata:
3939
name: imagetag-csi-node-registrar-prow-rc
4040
imageTag:
4141
name: registry.k8s.io/sig-storage/csi-node-driver-registrar
42-
newTag: "v2.7.0"
42+
newTag: "v2.9.3"
4343
---
4444
apiVersion: builtin
4545
kind: ImageTagTransformer
@@ -48,6 +48,6 @@ metadata:
4848
imageTag:
4949
name: registry.k8s.io/cloud-provider-gcp/gcp-compute-persistent-disk-csi-driver
5050
newName: gcr.io/k8s-staging-cloud-provider-gcp/gcp-compute-persistent-disk-csi-driver
51-
newTag: "v1.14.2-rc1"
51+
newTag: "v1.15.0-rc1"
5252
---
5353

deploy/kubernetes/overlays/dev/driver-args.yaml

-7
This file was deleted.

deploy/kubernetes/overlays/dev/kustomization.yaml

-8
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,6 @@ resources:
99
# Here dev overlay is using the same image as alpha
1010
transformers:
1111
- ../../images/stable-master
12-
# Apply patches to support dynamic provisioning for hyperdisks
13-
patches:
14-
- path: ./driver-args.yaml
15-
target:
16-
group: apps
17-
version: v1
18-
kind: Deployment
19-
name: csi-gce-pd-controller
2012
# To change the dev image, add something like the following.
2113
#images:
2214
#- name: gke.gcr.io/gcp-compute-persistent-disk-csi-driver
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
# VolumeAttributesClass User Guide
2+
3+
>**Attention:** VolumeAttributesClass is a Kubernetes Beta feature since v1.31, but was initially introduced as an alpha feature in v1.29. See [this blog post](https://kubernetes.io/docs/concepts/storage/volume-attributes-classes/) for more information on VolumeAttributesClasses and how to enable the feature gate.
4+
5+
### VolumeAttributesClass Example
6+
7+
This example provisions a hyperdisk-balanced and then updates its IOPS and throughput.
8+
9+
1. Create the VolumeAttributesClasses (VACs), PVC, Storage Classes, and Pod
10+
```
11+
$ kubectl apply -f ./examples/kubernetes/demo-vol-create.yaml
12+
```
13+
14+
This creates the VACs silver and gold, with the VAC for silver being the initial metadata for the PV and gold representing the update. This file also create a storage class test-sc. Note that the IOPS/throughput takes priority from the VACs if they are different. Then, a PVC is created, specifying the storage class for the PV being test-sc and the VAC being silver. Finally, a pod is created with the volume being created from the PVC we defined.
15+
16+
2. Verify the PV is properly created
17+
```
18+
$ kubectl get pvc
19+
NAME STATUS VOLUME CAPACITY ACCESS MODES STORAGECLASS VOLUMEATTRIBUTESCLASS AGE
20+
test-pvc Bound {pv-name} 64Gi RWO test-sc silver {some-time}
21+
```
22+
23+
3. Update the IOPS/throughput for the created PV
24+
```
25+
$ kubectl apply -f ./examples/kubernetes/demo-vol-update.yaml
26+
```
27+
28+
4. Verify the PV VAC is properly updated
29+
```
30+
$ kubectl get pvc
31+
NAME STATUS VOLUME CAPACITY ACCESS MODES STORAGECLASS VOLUMEATTRIBUTESCLASS AGE
32+
test-pvc Bound {pv-name} 64Gi RWO test-sc gold {some-time}
33+
```
34+
35+
After verifying the VAC is updated from the PV, we can check that the IOPS and throughput are properly updated.
36+
37+
```
38+
$ gcloud compute disks describe {pv-name} --zone={pv-zone}
39+
```
40+
41+
Ensure that the provisionedIops and provisionedThroughput fields match those from the gold VAC. Note that it will take a few minutes for the value updates to be reflected
+59
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
apiVersion: storage.k8s.io/v1
2+
kind: StorageClass
3+
metadata:
4+
name: test-sc
5+
provisioner: pd.csi.storage.gke.io
6+
parameters:
7+
type: "hyperdisk-balanced"
8+
provisioned-iops-on-create: "3000"
9+
provisioned-throughput-on-create: "150Mi"
10+
volumeBindingMode: WaitForFirstConsumer
11+
---
12+
apiVersion: storage.k8s.io/v1beta1
13+
kind: VolumeAttributesClass
14+
metadata:
15+
name: silver
16+
driverName: pd.csi.storage.gke.io
17+
parameters:
18+
iops: "3000"
19+
throughput: "150Mi"
20+
---
21+
apiVersion: storage.k8s.io/v1beta1
22+
kind: VolumeAttributesClass
23+
metadata:
24+
name: gold
25+
driverName: pd.csi.storage.gke.io
26+
parameters:
27+
iops: "3013"
28+
throughput: "151Mi"
29+
---
30+
apiVersion: v1
31+
kind: PersistentVolumeClaim
32+
metadata:
33+
name: test-pvc
34+
spec:
35+
storageClassName: test-sc
36+
volumeAttributesClassName: silver
37+
accessModes:
38+
- ReadWriteOnce
39+
resources:
40+
requests:
41+
storage: 64Gi
42+
---
43+
apiVersion: v1
44+
kind: Pod
45+
metadata:
46+
name: nginx
47+
spec:
48+
volumes:
49+
- name: vol
50+
persistentVolumeClaim:
51+
claimName: test-pvc
52+
containers:
53+
- name: nginx
54+
image: nginx:1.14.2
55+
ports:
56+
- containerPort: 80
57+
volumeMounts:
58+
- mountPath: "/vol"
59+
name: vol
+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
apiVersion: v1
2+
kind: PersistentVolumeClaim
3+
metadata:
4+
name: test-pvc
5+
spec:
6+
storageClassName: test-sc
7+
volumeAttributesClassName: gold
8+
accessModes:
9+
- ReadWriteOnce
10+
resources:
11+
requests:
12+
storage: 64Gi

examples/kubernetes/demo-vol-update.yml

-99
This file was deleted.

pkg/common/parameters.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -343,7 +343,7 @@ func ExtractModifyVolumeParameters(parameters map[string]string) (ModifyVolumePa
343343
}
344344
modifyVolumeParams.IOPS = &iops
345345
case "throughput":
346-
throughput, err := ConvertStringToInt64(value)
346+
throughput, err := ConvertMiStringToInt64(value)
347347
if err != nil {
348348
return ModifyVolumeParameters{}, fmt.Errorf("parameters contain invalid throughput parameter: %w", err)
349349
}

pkg/common/parameters_test.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -485,7 +485,7 @@ func TestSnapshotParameters(t *testing.T) {
485485
func TestExtractModifyVolumeParameters(t *testing.T) {
486486
parameters := map[string]string{
487487
"iops": "1000",
488-
"throughput": "500",
488+
"throughput": "500Mi",
489489
}
490490

491491
iops := int64(1000)

pkg/gce-pd-csi-driver/controller_test.go

+7-7
Original file line numberDiff line numberDiff line change
@@ -1789,7 +1789,7 @@ func TestCreateVolumeWithVolumeAttributeClassParameters(t *testing.T) {
17891789
},
17901790
},
17911791
},
1792-
MutableParameters: map[string]string{"iops": "20000", "throughput": "600"},
1792+
MutableParameters: map[string]string{"iops": "20000", "throughput": "600Mi"},
17931793
},
17941794
expIops: 20000,
17951795
expThroughput: 600,
@@ -1822,7 +1822,7 @@ func TestCreateVolumeWithVolumeAttributeClassParameters(t *testing.T) {
18221822
},
18231823
},
18241824
},
1825-
MutableParameters: map[string]string{"iops": "20000", "throughput": "600"},
1825+
MutableParameters: map[string]string{"iops": "20000", "throughput": "600Mi"},
18261826
},
18271827
expIops: 0,
18281828
expThroughput: 0,
@@ -1890,7 +1890,7 @@ func TestVolumeModifyOperation(t *testing.T) {
18901890
name: "Update volume with valid parameters",
18911891
req: &csi.ControllerModifyVolumeRequest{
18921892
VolumeId: testVolumeID,
1893-
MutableParameters: map[string]string{"iops": "20000", "throughput": "600"},
1893+
MutableParameters: map[string]string{"iops": "20000", "throughput": "600Mi"},
18941894
},
18951895
diskType: "hyperdisk-balanced",
18961896
params: &common.DiskParameters{
@@ -1906,7 +1906,7 @@ func TestVolumeModifyOperation(t *testing.T) {
19061906
name: "Update volume with invalid parameters",
19071907
req: &csi.ControllerModifyVolumeRequest{
19081908
VolumeId: testVolumeID,
1909-
MutableParameters: map[string]string{"iops": "0", "throughput": "0"},
1909+
MutableParameters: map[string]string{"iops": "0", "throughput": "0Mi"},
19101910
},
19111911
diskType: "hyperdisk-balanced",
19121912
params: &common.DiskParameters{
@@ -1922,7 +1922,7 @@ func TestVolumeModifyOperation(t *testing.T) {
19221922
name: "Update volume with valid parameters but invalid disk type",
19231923
req: &csi.ControllerModifyVolumeRequest{
19241924
VolumeId: testVolumeID,
1925-
MutableParameters: map[string]string{"iops": "20000", "throughput": "600"},
1925+
MutableParameters: map[string]string{"iops": "20000", "throughput": "600Mi"},
19261926
},
19271927
diskType: "pd-ssd",
19281928
params: &common.DiskParameters{
@@ -2053,7 +2053,7 @@ func TestVolumeModifyErrorHandling(t *testing.T) {
20532053
},
20542054
},
20552055
modifyReq: &csi.ControllerModifyVolumeRequest{
2056-
MutableParameters: map[string]string{"iops": "3001", "throughput": "151"},
2056+
MutableParameters: map[string]string{"iops": "3001", "throughput": "151Mi"},
20572057
},
20582058
modifyVolumeErrors: map[*meta.Key]error{
20592059
meta.ZonalKey(name, "us-central1-a"): &googleapi.Error{
@@ -2089,7 +2089,7 @@ func TestVolumeModifyErrorHandling(t *testing.T) {
20892089
},
20902090
},
20912091
modifyReq: &csi.ControllerModifyVolumeRequest{
2092-
MutableParameters: map[string]string{"iops": "10000", "throughput": "2400"},
2092+
MutableParameters: map[string]string{"iops": "10000", "throughput": "2400Mi"},
20932093
},
20942094
modifyVolumeErrors: map[*meta.Key]error{
20952095
meta.ZonalKey(name, "us-central1-a"): &googleapi.Error{Code: int(codes.InvalidArgument), Message: "InvalidArgument"},

0 commit comments

Comments
 (0)