Skip to content

Commit ceabea1

Browse files
committed
Merge branch 'disable-default-pd-csi-install' of github.com:leiyiz/gcp-compute-persistent-disk-csi-driver into disable-default-pd-csi-install
2 parents 4c3cdd0 + a293bf0 commit ceabea1

33 files changed

+310
-447
lines changed

README.md

+7-14
Original file line numberDiff line numberDiff line change
@@ -33,19 +33,14 @@ This plugin is compatible with CSI versions [v1.2.0](https://github.com/containe
3333
The following table captures the compatibility matrix of the core persistent disk driver binary
3434
`gke.gcr.io/gcp-compute-persistent-disk-csi-driver`
3535

36-
| GCE PD CSI Driver\Kubernetes Version | 1.15 | 1.16 | 1.17+ |
37-
|--------------------------------------|------|-------|-------|
38-
| v0.2.x (alpha) | no | no | no |
39-
| v0.3.x (beta) | yes | yes | yes |
40-
| v0.4.x (beta) | yes | yes | yes |
41-
| v0.5.x (beta) | yes | yes | yes |
42-
| v0.6.x (beta) | yes | yes | yes |
43-
| v0.7.x (beta) | yes | yes | yes |
44-
| v1.0.x (ga) | yes | yes | yes |
45-
| dev | yes | yes | yes |
36+
| GCE PD CSI Driver\Kubernetes Version | 1.17+ |
37+
|--------------------------------------|-------|
38+
| v0.7.x (beta) | yes |
39+
| v1.0.x (ga) | yes |
40+
| dev | yes |
4641

4742
The manifest bundle which captures all the driver components (driver pod which includes the containers csi-provisioner, csi-resizer, csi-snapshotter, gce-pd-driver, csi-driver-registrar;
48-
csi driver object, rbacs, pod security policies etc) can be picked up from the master branch [overlays](deploy/kubernetes/overlays) directory. We structure the overlays directory, per minor version of kubernetes because not all driver components can be used with all kubernetes versions. For example volume snapshots are supported 1.17+ kubernetes versions thus [stable-1-16](deploy/kubernetes/overlays/stable-1-16) driver manifests does not contain the snapshotter sidecar.
43+
csi driver object, rbacs, pod security policies etc) can be picked up from the master branch [overlays](deploy/kubernetes/overlays) directory. We structure the overlays directory, per minor version of kubernetes because not all driver components can be used with all kubernetes versions. For example, v1 CSIDriver resources are supported in 1.18+ only, so [stable-1-17](deploy/kubernetes/overlays/stable-1-17) driver manifests use the v1beta1 version.
4944

5045
Example:
5146

@@ -84,10 +79,8 @@ GCE PD driver starts to support CSI Windows with [CSI Proxy] (https://github.com
8479

8580
| Feature | Stage | Min Kubernetes Master Version | Min Kubernetes Nodes Version | Min Driver Version | Deployment Overlay |
8681
|-----------------|-------|-------------------------------|------------------------------|--------------------|--------------------|
87-
| Snapshots | Alpha | 1.13 | Any | v0.3.0 | Alpha |
8882
| Snapshots | Beta | 1.17 | Any | v1.0.0 | stable-1-17, stable-1-18, stable-1-19, stable-master |
89-
| Resize (Expand) | Alpha | 1.14 | 1.14 | v0.6.0 | Alpha |
90-
| Resize (Expand) | Beta | 1.16 | 1.16 | v0.7.0 | stable-1-16, stable-1-17, stable-1-18, stable-1-19, stable-master |
83+
| Resize (Expand) | Beta | 1.16 | 1.16 | v0.7.0 | stable-1-17, stable-1-18, stable-1-19, stable-master |
9184
| Windows* | Beta | 1.18 | 1.18 | v1.1.0 | stable-1-18, stable-1-19, stable-master |
9285

9386
\* For Windows, it is recommended to use this driver with CSI proxy v0.2.2+. The master version of driver requires disk v1beta2 group, which is only available in CSI proxy v0.2.2+

deploy/kubernetes/base/controller/kustomization.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,5 @@ namespace:
55
resources:
66
- cluster_setup.yaml
77
- controller.yaml
8-
- csidriver_info.yaml
98
- psp.yaml
9+
- v1_csidriver.yaml
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
apiVersion: storage.k8s.io/v1
2+
kind: CSIDriver
3+
metadata:
4+
name: pd.csi.storage.gke.io
5+
spec:
6+
attachRequired: true
7+
podInfoOnMount: false

deploy/kubernetes/overlays/prow-gke-release-staging-rc-1-15/README.md

-1
This file was deleted.

deploy/kubernetes/overlays/prow-gke-release-staging-rc-1-15/kustomization.yaml

-6
This file was deleted.

deploy/kubernetes/overlays/prow-gke-release-staging-rc-1-16/README.md

-1
This file was deleted.

deploy/kubernetes/overlays/prow-gke-release-staging-rc-1-16/kustomization.yaml

-6
This file was deleted.

deploy/kubernetes/overlays/prow-gke-release-staging-rc-1-17/kustomization.yaml

+3
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,8 @@ apiVersion: kustomize.config.k8s.io/v1beta1
22
kind: Kustomization
33
resources:
44
- ../stable-1-17
5+
- v1beta1_csidriver.yaml
6+
patchesStrategicMerge:
7+
- no_v1_csidriver.yaml
58
transformers:
69
- ../../images/prow-gke-release-staging-rc-1-17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
$patch: delete
2+
apiVersion: storage.k8s.io/v1
3+
kind: CSIDriver
4+
metadata:
5+
name: pd.csi.storage.gke.io

deploy/kubernetes/base/controller/csidriver_info.yaml renamed to deploy/kubernetes/overlays/prow-gke-release-staging-rc-1-17/v1beta1_csidriver.yaml

-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
#### TODO: This need to be updated to v1 once we official support 1.18+
21
apiVersion: storage.k8s.io/v1beta1
32
kind: CSIDriver
43
metadata:

deploy/kubernetes/overlays/stable-1-15/kustomization.yaml

-20
This file was deleted.

deploy/kubernetes/overlays/stable-1-15/metrics_leaderelection_endpoint.yaml

-22
This file was deleted.

deploy/kubernetes/overlays/stable-1-15/no_resizer_snapshotter_roles.yaml

-25
This file was deleted.

deploy/kubernetes/overlays/stable-1-15/no_resizer_snapshotter_sidecar.yaml

-12
This file was deleted.

deploy/kubernetes/overlays/stable-1-15/no_win_roles.yaml

-17
This file was deleted.

deploy/kubernetes/overlays/stable-1-16/kustomization.yaml

-20
This file was deleted.

deploy/kubernetes/overlays/stable-1-16/metrics_leaderelection_endpoint.yaml

-30
This file was deleted.

deploy/kubernetes/overlays/stable-1-16/no_snapshotter_roles.yaml

-13
This file was deleted.

deploy/kubernetes/overlays/stable-1-16/no_snapshotter_sidecar.yaml

-10
This file was deleted.

deploy/kubernetes/overlays/stable-1-16/no_win_roles.yaml

-17
This file was deleted.

deploy/kubernetes/overlays/stable-1-17/kustomization.yaml

+2
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,9 @@ namespace:
55
resources:
66
- ../../base/controller
77
- ../../base/node_linux
8+
- v1beta1_csidriver.yaml
89
patchesStrategicMerge:
910
- no_win_roles.yaml
11+
- no_v1_csidriver.yaml
1012
transformers:
1113
- ../../images/stable-1-17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
$patch: delete
2+
apiVersion: storage.k8s.io/v1
3+
kind: CSIDriver
4+
metadata:
5+
name: pd.csi.storage.gke.io
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
apiVersion: storage.k8s.io/v1beta1
2+
kind: CSIDriver
3+
metadata:
4+
name: pd.csi.storage.gke.io
5+
spec:
6+
attachRequired: true
7+
podInfoOnMount: false

pkg/common/utils.go

+11-9
Original file line numberDiff line numberDiff line change
@@ -39,10 +39,12 @@ const (
3939
// Snapshot ID
4040
snapshotTotalElements = 5
4141
snapshotTopologyKey = 2
42+
snapshotProjectKey = 1
4243

4344
// Node ID Expected Format
4445
// "projects/{projectName}/zones/{zoneName}/disks/{diskName}"
4546
nodeIDFmt = "projects/%s/zones/%s/instances/%s"
47+
nodeIDProjectValue = 1
4648
nodeIDZoneValue = 3
4749
nodeIDNameValue = 5
4850
nodeIDTotalElements = 6
@@ -68,17 +70,17 @@ func GbToBytes(Gb int64) int64 {
6870
return Gb * 1024 * 1024 * 1024
6971
}
7072

71-
func VolumeIDToKey(id string) (*meta.Key, error) {
73+
func VolumeIDToKey(id string) (string, *meta.Key, error) {
7274
splitId := strings.Split(id, "/")
7375
if len(splitId) != volIDTotalElements {
74-
return nil, fmt.Errorf("failed to get id components. Expected projects/{project}/zones/{zone}/disks/{name}. Got: %s", id)
76+
return "", nil, fmt.Errorf("failed to get id components. Expected projects/{project}/zones/{zone}/disks/{name}. Got: %s", id)
7577
}
7678
if splitId[volIDToplogyKey] == "zones" {
77-
return meta.ZonalKey(splitId[volIDDiskNameValue], splitId[volIDToplogyValue]), nil
79+
return splitId[nodeIDProjectValue], meta.ZonalKey(splitId[volIDDiskNameValue], splitId[volIDToplogyValue]), nil
7880
} else if splitId[volIDToplogyKey] == "regions" {
79-
return meta.RegionalKey(splitId[volIDDiskNameValue], splitId[volIDToplogyValue]), nil
81+
return splitId[nodeIDProjectValue], meta.RegionalKey(splitId[volIDDiskNameValue], splitId[volIDToplogyValue]), nil
8082
} else {
81-
return nil, fmt.Errorf("could not get id components, expected either zones or regions, got: %v", splitId[volIDToplogyKey])
83+
return "", nil, fmt.Errorf("could not get id components, expected either zones or regions, got: %v", splitId[volIDToplogyKey])
8284
}
8385
}
8486

@@ -100,15 +102,15 @@ func GenerateUnderspecifiedVolumeID(diskName string, isZonal bool) string {
100102
return fmt.Sprintf(volIDRegionalFmt, UnspecifiedValue, UnspecifiedValue, diskName)
101103
}
102104

103-
func SnapshotIDToKey(id string) (string, error) {
105+
func SnapshotIDToProjectKey(id string) (string, string, error) {
104106
splitId := strings.Split(id, "/")
105107
if len(splitId) != snapshotTotalElements {
106-
return "", fmt.Errorf("failed to get id components. Expected projects/{project}/global/snapshot/{name}. Got: %s", id)
108+
return "", "", fmt.Errorf("failed to get id components. Expected projects/{project}/global/snapshot/{name}. Got: %s", id)
107109
}
108110
if splitId[snapshotTopologyKey] == "global" {
109-
return splitId[snapshotTotalElements-1], nil
111+
return splitId[snapshotProjectKey], splitId[snapshotTotalElements-1], nil
110112
} else {
111-
return "", fmt.Errorf("could not get id components, expected global, got: %v", splitId[snapshotTopologyKey])
113+
return "", "", fmt.Errorf("could not get id components, expected global, got: %v", splitId[snapshotTopologyKey])
112114
}
113115
}
114116

0 commit comments

Comments
 (0)