Skip to content

Commit dbf9935

Browse files
committed
Squash 20 commits
1 parent cf281d8 commit dbf9935

File tree

1,302 files changed

+160801
-1153582
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,302 files changed

+160801
-1153582
lines changed

Dockerfile

+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 --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

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

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

+5-19
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,8 @@ rules:
3434
- apiGroups: ["storage.k8s.io"]
3535
resources: ["storageclasses"]
3636
verbs: ["get", "list", "watch"]
37-
- apiGroups: ["storage.k8s.io/v1alpha1"]
38-
resources: ["volumeattributesclass"]
37+
- apiGroups: ["storage.k8s.io"]
38+
resources: ["volumeattributesclasses"]
3939
verbs: ["get", "list", "watch"]
4040
- apiGroups: [""]
4141
resources: ["events"]
@@ -146,8 +146,8 @@ rules:
146146
- apiGroups: [""]
147147
resources: ["persistentvolumeclaims/status"]
148148
verbs: ["update", "patch"]
149-
- apiGroups: ["storage.k8s.io/v1alpha1"]
150-
resources: ["volumeattributesclass"]
149+
- apiGroups: ["storage.k8s.io"]
150+
resources: ["volumeattributesclasses"]
151151
verbs: ["get", "list", "watch"]
152152
- apiGroups: [""]
153153
resources: ["events"]
@@ -318,18 +318,4 @@ subjects:
318318
roleRef:
319319
kind: Role
320320
name: csi-gce-pd-leaderelection-role
321-
apiGroup: rbac.authorization.k8s.io
322-
323-
---
324-
apiVersion: rbac.authorization.k8s.io/v1
325-
kind: ClusterRoleBinding
326-
metadata:
327-
name: csi-gce-pd-controller-sa-cluster-admin
328-
subjects:
329-
- kind: ServiceAccount
330-
name: csi-gce-pd-controller-sa
331-
namespace: gce-pd-csi-driver
332-
roleRef:
333-
kind: ClusterRole
334-
name: cluster-admin
335-
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-70
Original file line numberDiff line numberDiff line change
@@ -8,85 +8,27 @@ metadata:
88
spec:
99
template:
1010
spec:
11-
1211
containers:
1312
- name: gce-pd-driver
1413
imagePullPolicy: Always
15-
command: ["/go/src/sigs.k8s.io/gcp-compute-persistent-disk-csi-driver/bin/gce-pd-csi-driver"]
14+
command: ["/go/bin/dlv"]
1615
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+
- "--"
1726
- "--v=5"
1827
- "--endpoint=unix:/csi/csi.sock"
1928
ports:
2029
- containerPort: 2345
2130
securityContext:
2231
capabilities:
2332
add:
24-
- SYS_PTRACE
25-
26-
- name: csi-provisioner
27-
image: gcr.io/k8s-staging-sig-storage/csi-provisioner:canary
28-
args:
29-
- "--v=5"
30-
- "--csi-address=/csi/csi.sock"
31-
- "--feature-gates=Topology=true"
32-
- "--http-endpoint=:22011"
33-
- "--leader-election-namespace=$(PDCSI_NAMESPACE)"
34-
- "--timeout=250s"
35-
- "--extra-create-metadata"
36-
# - "--run-controller-service=false" # disable the controller service of the CSI driver
37-
# - "--run-node-service=false" # disable the node service of the CSI driver
38-
- "--leader-election"
39-
- "--default-fstype=ext4"
40-
- "--controller-publish-readonly=true"
41-
- "--feature-gates=VolumeAttributesClass=true"
42-
43-
- name: csi-resizer
44-
image: registry.k8s.io/sig-storage/csi-resizer
45-
imagePullPolicy: Always
46-
args:
47-
- "--v=5"
48-
- "--csi-address=/csi/csi.sock"
49-
- "--http-endpoint=:22013"
50-
- "--leader-election"
51-
- "--leader-election-namespace=$(PDCSI_NAMESPACE)"
52-
- "--handle-volume-inuse-error=false"
53-
- "--feature-gates=VolumeAttributesClass=true"
54-
55-
# used with vanilla K8s
56-
# imagePullSecrets:
57-
# - name: artifactory-cred
58-
59-
60-
- name: csi-provisioner
61-
image: gcr.io/k8s-staging-sig-storage/csi-provisioner:canary
62-
args:
63-
- "--v=5"
64-
- "--csi-address=/csi/csi.sock"
65-
- "--feature-gates=Topology=true"
66-
- "--http-endpoint=:22011"
67-
- "--leader-election-namespace=$(PDCSI_NAMESPACE)"
68-
- "--timeout=250s"
69-
- "--extra-create-metadata"
70-
# - "--run-controller-service=false" # disable the controller service of the CSI driver
71-
# - "--run-node-service=false" # disable the node service of the CSI driver
72-
- "--leader-election"
73-
- "--default-fstype=ext4"
74-
- "--controller-publish-readonly=true"
75-
- "--feature-gates=VolumeAttributesClass=true"
76-
77-
- name: csi-resizer
78-
image: registry.k8s.io/sig-storage/csi-resizer
79-
imagePullPolicy: Always
80-
args:
81-
- "--v=5"
82-
- "--csi-address=/csi/csi.sock"
83-
- "--http-endpoint=:22013"
84-
- "--leader-election"
85-
- "--leader-election-namespace=$(PDCSI_NAMESPACE)"
86-
- "--handle-volume-inuse-error=false"
87-
- "--feature-gates=VolumeAttributesClass=true"
88-
89-
# used with vanilla K8s
90-
# imagePullSecrets:
91-
# - name: artifactory-cred
33+
- SYS_PTRACE
9234

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
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
# Hyperdisk Storage Pools User Guide
2+
3+
Provisioning attached disks in Storage Pools is supported in the managed version of our driver which is automatically enabled on new GKE clusters, and in a manually deployed GCE PD CSI Driver. We recommend using this feature with the managed GCE PD CSI Driver. See the public documentation [here](https://cloud.google.com/kubernetes-engine/docs/how-to/persistent-volumes/hyperdisk-storage-pools).
4+
5+
If you would like to use Storage Pools with a manual deployment of the GCE PD CSI driver, you will need to do a couple additional things to enable the feature as described below.
6+
7+
### Enabling Storage Pools for a Manual Deployment of GCE PD CSI driver.
8+
9+
>**Attention:** Note that Storage Pools is only available in the driver version [v1.13.0+](https://github.com/kubernetes-sigs/gcp-compute-persistent-disk-csi-driver/releases/tag/v1.13.0).
10+
11+
In addition to the install instructions [here](driver-install.md), you need to specify the CSI driver command line flags, `--enable-storage-pools=true`.
12+
13+
### Provision Volumes in a Storage Pool
14+
15+
To provision volumes in a Storage Pool, follow the instructions [here](https://cloud.google.com/kubernetes-engine/docs/how-to/persistent-volumes/hyperdisk-storage-pools#provision-attached-disk). When using the feature in a manual deployment of the GCE PD CSI Driver, in the [Create a StorageClass](https://cloud.google.com/kubernetes-engine/docs/how-to/persistent-volumes/hyperdisk-storage-pools#create-storageclass) section, you must additionally set [`allowedTopologies`](https://kubernetes.io/docs/concepts/storage/storage-classes/#allowed-topologies) to restrict the topology of provisioned volumes to specific zones where Storage Pools exist as specified in the `storage-pools` StorageClass parameter.
16+
17+
For example, looking at the example in [Create a StorageClass](https://cloud.google.com/kubernetes-engine/docs/how-to/persistent-volumes/hyperdisk-storage-pools#create-storageclass), assuming you already created a Storage Pool in `us-east4-c` according to [Create a Hyperdisk Storage Pool](https://cloud.google.com/kubernetes-engine/docs/how-to/persistent-volumes/hyperdisk-storage-pools#create-sp), your `StorageClass` would need to specify `allowedTopologies` to restrict the topology of provisioned volumes to us-east4-c, where the Storage Pool exists.
18+
19+
```yaml
20+
apiVersion: storage.k8s.io/v1
21+
kind: StorageClass
22+
metadata:
23+
name: storage-pools-sc
24+
provisioner: pd.csi.storage.gke.io
25+
volumeBindingMode: WaitForFirstConsumer
26+
allowVolumeExpansion: true
27+
parameters:
28+
type: hyperdisk-balanced
29+
provisioned-throughput-on-create: "140Mi"
30+
provisioned-iops-on-create: "3000"
31+
storage-pools: projects/my-project/zones/us-east4-c/storagePools/pool-us-east4-c
32+
allowedTopologies:
33+
- matchLabelExpressions:
34+
- key: topology.gke.io/zone
35+
values:
36+
- us-east4-c
37+
```

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)