Skip to content

Commit ea5b26a

Browse files
committed
Cleanup ControllerModifyVolume logic and run upstream E2E tests
1 parent 09405db commit ea5b26a

File tree

1,059 files changed

+98780
-85871
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

1,059 files changed

+98780
-85871
lines changed

.gitignore

-3
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,3 @@ test/k8s-integration/config/test-config.yaml
4949
*.un~
5050
Session.vim
5151
.netrwhist
52-
53-
# Credentials
54-
creds/

.vscode/launch.json

-33
This file was deleted.

Dockerfile

+2-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
1414

15-
FROM --platform=$BUILDPLATFORM golang:1.22.4 as builder
15+
FROM --platform=$BUILDPLATFORM golang:1.23.0 as builder
1616

1717
ARG STAGINGVERSION
1818
ARG TARGETPLATFORM
@@ -96,6 +96,7 @@ COPY --from=debian /lib/${LIB_DIR_PREFIX}-linux-gnu/libselinux.so.1 \
9696
/lib/${LIB_DIR_PREFIX}-linux-gnu/libnvme-mi.so.1 \
9797
/lib/${LIB_DIR_PREFIX}-linux-gnu/libnvme.so.1 \
9898
/lib/${LIB_DIR_PREFIX}-linux-gnu/libsystemd.so.0 \
99+
/lib/${LIB_DIR_PREFIX}-linux-gnu/libgpg-error.so.0 \
99100
/lib/${LIB_DIR_PREFIX}-linux-gnu/libzstd.so.1 /lib/${LIB_DIR_PREFIX}-linux-gnu/
100101

101102
COPY --from=debian /usr/lib/${LIB_DIR_PREFIX}-linux-gnu/libblkid.so.1 \

Dockerfile.Windows

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
# limitations under the License.
1414

1515
ARG BASE_IMAGE
16-
FROM --platform=$BUILDPLATFORM golang:1.22.4 AS builder
16+
FROM --platform=$BUILDPLATFORM golang:1.23.0 AS builder
1717

1818
ARG TARGETPLATFORM
1919
ARG STAGINGVERSION

Dockerfile.debug

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
1414

15-
FROM golang:1.22.4 as builder
15+
FROM golang:1.23.0 as builder
1616
WORKDIR /go/src/sigs.k8s.io/gcp-compute-persistent-disk-csi-driver
1717
ADD . .
1818

Makefile

+1-1
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ init-buildx:
126126
$(DOCKER) run --rm --privileged multiarch/qemu-user-static --reset --credential yes --persistent yes
127127
# Ensure we use a builder that can leverage it (the default on linux will not)
128128
-$(DOCKER) buildx rm multiarch-multiplatform-builder
129-
$(DOCKER) buildx create --use --name=multiarch-multiplatform-builder --driver-opt network=host --driver-opt image=moby/buildkit:v0.11.3
129+
$(DOCKER) buildx create --use --name=multiarch-multiplatform-builder --driver-opt network=host --driver-opt image=moby/buildkit:v0.14.1
130130
# Register gcloud as a Docker credential helper.
131131
# Required for "docker buildx build --push".
132132
gcloud auth configure-docker --quiet

cmd/gce-pd-csi-driver/main.go

+12-1
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,9 @@ var (
8484
useInstanceAPIForListVolumesPublishedNodesFlag = flag.Bool("use-instance-api-to-list-volumes-published-nodes", false, "Enables using the instances.list API to determine published_node_ids in ListVolumes. When false (default), the disks.list API is used")
8585
instancesListFiltersFlag = flag.String("instances-list-filters", "", "Comma separated list of filters to use when calling the instances.list API. By default instances.list fetches all instances in a region")
8686

87+
diskSupportsIopsChangeFlag = flag.String("supports-dynamic-iops-provisioning", "", "Comma separated list of disk types that support dynamic IOPS provisioning")
88+
diskSupportsThroughputChangeFlag = flag.String("supports-dynamic-throughput-provisioning", "", "Comma separated list of disk types that support dynamic throughput provisioning")
89+
8790
extraTagsStr = flag.String("extra-tags", "", "Extra tags to attach to each Compute Disk, Image, Snapshot created. It is a comma separated list of parent id, key and value like '<parent_id1>/<tag_key1>/<tag_value1>,...,<parent_idN>/<tag_keyN>/<tag_valueN>'. parent_id is the Organization or the Project ID or Project name where the tag key and the tag value resources exist. A maximum of 50 tags bindings is allowed for a resource. See https://cloud.google.com/resource-manager/docs/tags/tags-overview, https://cloud.google.com/resource-manager/docs/tags/tags-creating-and-managing for details")
8891

8992
version string
@@ -200,6 +203,14 @@ func handle() {
200203
UseInstancesAPIForPublishedNodes: *useInstanceAPIForListVolumesPublishedNodesFlag,
201204
}
202205

206+
// Initialize provisionableDisks config
207+
supportsIopsChange := parseCSVFlag(*diskSupportsIopsChangeFlag)
208+
supportsThroughputChange := parseCSVFlag(*diskSupportsThroughputChangeFlag)
209+
provisionableDisksConfig := driver.ProvisionableDisksConfig{
210+
SupportsIopsChange: supportsIopsChange,
211+
SupportsThroughputChange: supportsThroughputChange,
212+
}
213+
203214
// Initialize requirements for the controller service
204215
var controllerServer *driver.GCEControllerServer
205216
if *runControllerService {
@@ -209,7 +220,7 @@ func handle() {
209220
}
210221
initialBackoffDuration := time.Duration(*errorBackoffInitialDurationMs) * time.Millisecond
211222
maxBackoffDuration := time.Duration(*errorBackoffMaxDurationMs) * time.Millisecond
212-
controllerServer = driver.NewControllerServer(gceDriver, cloudProvider, initialBackoffDuration, maxBackoffDuration, fallbackRequisiteZones, *enableStoragePoolsFlag, multiZoneVolumeHandleConfig, listVolumesConfig)
223+
controllerServer = driver.NewControllerServer(gceDriver, cloudProvider, initialBackoffDuration, maxBackoffDuration, fallbackRequisiteZones, *enableStoragePoolsFlag, multiZoneVolumeHandleConfig, listVolumesConfig, provisionableDisksConfig)
213224
} else if *cloudConfigFilePath != "" {
214225
klog.Warningf("controller service is disabled but cloud config given - it has no effect")
215226
}

deploy/kubernetes/base/controller/cluster_setup.yaml

+8-27
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,9 @@ rules:
3434
- apiGroups: ["storage.k8s.io"]
3535
resources: ["storageclasses"]
3636
verbs: ["get", "list", "watch"]
37+
- apiGroups: ["storage.k8s.io"]
38+
resources: ["volumeattributesclasses"]
39+
verbs: ["get", "list", "watch"]
3740
- apiGroups: [""]
3841
resources: ["events"]
3942
verbs: ["list", "watch", "create", "update", "patch"]
@@ -69,7 +72,7 @@ roleRef:
6972
kind: ClusterRole
7073
name: csi-gce-pd-provisioner-role
7174
apiGroup: rbac.authorization.k8s.io
72-
75+
7376
---
7477
# xref: https://github.com/kubernetes-csi/external-attacher/blob/master/deploy/kubernetes/rbac.yaml
7578
kind: ClusterRole
@@ -143,6 +146,9 @@ rules:
143146
- apiGroups: [""]
144147
resources: ["persistentvolumeclaims/status"]
145148
verbs: ["update", "patch"]
149+
- apiGroups: ["storage.k8s.io"]
150+
resources: ["volumeattributesclasses"]
151+
verbs: ["get", "list", "watch"]
146152
- apiGroups: [""]
147153
resources: ["events"]
148154
verbs: ["list", "watch", "create", "update", "patch"]
@@ -312,29 +318,4 @@ subjects:
312318
roleRef:
313319
kind: Role
314320
name: csi-gce-pd-leaderelection-role
315-
apiGroup: rbac.authorization.k8s.io
316-
317-
---
318-
apiVersion: rbac.authorization.k8s.io/v1
319-
kind: ClusterRole
320-
metadata:
321-
name: cluster-admin
322-
rules:
323-
- apiGroups: ["*"]
324-
resources: ["*"]
325-
verbs: ["*"]
326-
- nonResourceURLs: ["*"]
327-
verbs: ["*"]
328-
---
329-
apiVersion: rbac.authorization.k8s.io/v1
330-
kind: ClusterRoleBinding
331-
metadata:
332-
name: csi-gce-pd-controller-sa-cluster-admin
333-
subjects:
334-
- kind: ServiceAccount
335-
name: csi-gce-pd-controller-sa
336-
namespace: gce-pd-csi-driver
337-
roleRef:
338-
kind: ClusterRole
339-
name: cluster-admin
340-
apiGroup: rbac.authorization.k8s.io
321+
apiGroup: rbac.authorization.k8s.io

deploy/kubernetes/base/controller/controller.yaml

+2
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ spec:
3737
- "--leader-election"
3838
- "--default-fstype=ext4"
3939
- "--controller-publish-readonly=true"
40+
- "--feature-gates=VolumeAttributesClass=true"
4041
env:
4142
- name: PDCSI_NAMESPACE
4243
valueFrom:
@@ -95,6 +96,7 @@ spec:
9596
- "--leader-election"
9697
- "--leader-election-namespace=$(PDCSI_NAMESPACE)"
9798
- "--handle-volume-inuse-error=false"
99+
- "--feature-gates=VolumeAttributesClass=true"
98100
env:
99101
- name: PDCSI_NAMESPACE
100102
valueFrom:

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

+1-1
Original file line numberDiff line numberDiff line change
@@ -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.13.3-rc1"
51+
newTag: "v1.14.2-rc1"
5252
---
5353

deploy/kubernetes/images/stable-master/image.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ metadata:
44
name: imagetag-csi-provisioner
55
imageTag:
66
name: registry.k8s.io/sig-storage/csi-provisioner
7-
newTag: "v3.6.3"
7+
newTag: "v5.1.0"
88

99
---
1010
apiVersion: builtin

deploy/kubernetes/install-kustomize.sh

+4-4
Original file line numberDiff line numberDiff line change
@@ -31,11 +31,11 @@ if [[ ! "$tmpDir" || ! -d "$tmpDir" ]]; then
3131
exit 1
3232
fi
3333

34-
# function cleanup {
35-
# rm -rf "$tmpDir"
36-
# }
34+
function cleanup {
35+
rm -rf "$tmpDir"
36+
}
3737

38-
# trap cleanup EXIT
38+
trap cleanup EXIT
3939

4040
pushd $tmpDir >& /dev/null
4141

deploy/kubernetes/overlays/dev/controller_always_pull.yaml

+1-2
Original file line numberDiff line numberDiff line change
@@ -7,5 +7,4 @@ spec:
77
spec:
88
containers:
99
- name: gce-pd-driver
10-
imagePullPolicy: Always
11-
10+
imagePullPolicy: Always
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
- op: add
2+
path: /spec/template/spec/containers/0/args/-
3+
value: --supports-dynamic-throughput-provisioning=hyperdisk-balanced,hyperdisk-throughput,hyperdisk-ml
4+
5+
- op: add
6+
path: /spec/template/spec/containers/0/args/-
7+
value: --supports-dynamic-iops-provisioning=hyperdisk-balanced,hyperdisk-extreme

deploy/kubernetes/overlays/dev/kustomization.yaml

+8
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,14 @@ 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
1220
# To change the dev image, add something like the following.
1321
#images:
1422
#- name: gke.gcr.io/gcp-compute-persistent-disk-csi-driver

deploy/kubernetes/overlays/noauth-debug/controller-overlay.yaml

+12-36
Original file line numberDiff line numberDiff line change
@@ -11,48 +11,24 @@ spec:
1111
containers:
1212
- name: gce-pd-driver
1313
imagePullPolicy: Always
14-
command: ["/go/src/sigs.k8s.io/gcp-compute-persistent-disk-csi-driver/bin/gce-pd-csi-driver"]
14+
command: ["/go/bin/dlv"]
1515
args:
16+
- "--listen=:2345"
17+
- "--headless=true"
18+
- "--api-version=2"
19+
# https://github.com/go-delve/delve/blob/master/Documentation/usage/dlv_exec.md#options
20+
- "--accept-multiclient"
21+
- "--continue"
22+
- "--log"
23+
- "exec"
24+
- "/go/src/sigs.k8s.io/gcp-compute-persistent-disk-csi-driver/bin/gce-pd-csi-driver"
25+
- "--"
1626
- "--v=5"
1727
- "--endpoint=unix:/csi/csi.sock"
1828
ports:
1929
- containerPort: 2345
2030
securityContext:
2131
capabilities:
2232
add:
23-
- SYS_PTRACE
24-
25-
- name: csi-provisioner
26-
image: gcr.io/k8s-staging-sig-storage/csi-provisioner:canary
27-
args:
28-
- "--v=5"
29-
- "--csi-address=/csi/csi.sock"
30-
- "--feature-gates=Topology=true"
31-
- "--http-endpoint=:22011"
32-
- "--leader-election-namespace=$(PDCSI_NAMESPACE)"
33-
- "--timeout=250s"
34-
- "--extra-create-metadata"
35-
# - "--run-controller-service=false" # disable the controller service of the CSI driver
36-
# - "--run-node-service=false" # disable the node service of the CSI driver
37-
- "--leader-election"
38-
- "--default-fstype=ext4"
39-
- "--controller-publish-readonly=true"
40-
- "--feature-gates=VolumeAttributesClass=true"
41-
42-
- name: csi-resizer
43-
image: registry.k8s.io/sig-storage/csi-resizer
44-
imagePullPolicy: Always
45-
args:
46-
- "--v=5"
47-
- "--csi-address=/csi/csi.sock"
48-
- "--http-endpoint=:22013"
49-
- "--leader-election"
50-
- "--leader-election-namespace=$(PDCSI_NAMESPACE)"
51-
- "--handle-volume-inuse-error=false"
52-
- "--feature-gates=VolumeAttributesClass=true"
53-
54-
# used with vanilla K8s
55-
# imagePullSecrets:
56-
# - name: artifactory-cred
57-
33+
- SYS_PTRACE
5834

deploy/kubernetes/overlays/noauth-debug/kustomization.yaml

+5-4
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,8 @@ patchesStrategicMerge:
1010
- controller-overlay.yaml
1111
- node-overlay.yaml
1212
namespace: gce-pd-csi-driver
13-
images:
14-
- name: gke.gcr.io/gcp-compute-persistent-disk-csi-driver
15-
newName: us-central1-docker.pkg.dev/travisx-joonix/csi-dev/gce-pd-csi-driver
16-
newTag: dev_linux
13+
# To change the dev image, add something like the following.
14+
# images:
15+
# - name: gke.gcr.io/gcp-compute-persistent-disk-csi-driver
16+
# newName: gcr.io/mauriciopoppe-gke-dev/gcp-compute-persistent-disk-csi-driver
17+
# newTag: latest

examples/kubernetes/demo-vol-update.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
apiVersion: storage.k8s.io/v1alpha1
1+
apiVersion: storage.k8s.io/v1beta1
22
kind: VolumeAttributesClass
33
metadata:
44
name: silver
@@ -7,7 +7,7 @@ parameters:
77
throughput: "350"
88
iops: "6000"
99
---
10-
apiVersion: storage.k8s.io/v1alpha1
10+
apiVersion: storage.k8s.io/v1beta1
1111
kind: VolumeAttributesClass
1212
metadata:
1313
name: gold

0 commit comments

Comments
 (0)