Skip to content

Commit c2c0ee0

Browse files
authored
Merge pull request #565 from andyzhangx/disable-volume-stat
feat: disable GET_VOLUME_STATS by default
2 parents 542e9e4 + 541b31c commit c2c0ee0

File tree

7 files changed

+18
-7
lines changed

7 files changed

+18
-7
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ This driver allows Kubernetes to access Azure Storage through one of following m
1515
### Container Images & Kubernetes Compatibility:
1616
|driver version |Image | supported k8s version | built-in blobfuse version |
1717
|----------------|-------------------------------------------|-----------------------|---------------------------|
18-
|master branch |mcr.microsoft.com/k8s/csi/blob-csi:latest | 1.18+ | 1.4.1 |
18+
|master branch |mcr.microsoft.com/k8s/csi/blob-csi:latest | 1.19+ | 1.4.1 |
1919
|v1.6.0 |mcr.microsoft.com/k8s/csi/blob-csi:v1.6.0 | 1.18+ | 1.4.1 |
2020
|v1.5.0 |mcr.microsoft.com/k8s/csi/blob-csi:v1.5.0 | 1.18+ | 1.4.1 |
2121
|v1.4.0 |mcr.microsoft.com/k8s/csi/blob-csi:v1.4.0 | 1.18+ | 1.3.8 |

charts/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ The following table lists the configurable parameters of the latest Azure Blob S
5959
| `driver.customUserAgent` | custom userAgent | `` |
6060
| `driver.userAgentSuffix` | userAgent suffix | `OSS-helm` |
6161
| `feature.enableFSGroupPolicy` | enable `fsGroupPolicy` on a k8s 1.20+ cluster | `false` |
62+
| `feature.enableGetVolumeStats` | allow GET_VOLUME_STATS on agent node | `false` |
6263
| `image.baseRepo` | base repository of driver images | `mcr.microsoft.com` |
6364
| `image.blob.repository` | blob-csi-driver docker image | `mcr.microsoft.com/k8s/csi/blob-csi` |
6465
| `image.blob.tag` | blob-csi-driver docker image tag | `latest` |
38 Bytes
Binary file not shown.

charts/latest/blob-csi-driver/templates/csi-blob-node.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,7 @@ spec:
122122
- "--custom-user-agent={{ .Values.driver.customUserAgent }}"
123123
- "--user-agent-suffix={{ .Values.driver.userAgentSuffix }}"
124124
- "--allow-empty-cloud-config={{ .Values.node.allowEmptyCloudConfig }}"
125+
- "--enable-get-volume-stats={{ .Values.feature.enableGetVolumeStats }}"
125126
ports:
126127
- containerPort: {{ .Values.node.livenessProbe.healthPort }}
127128
name: healthz

charts/latest/blob-csi-driver/values.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,7 @@ node:
138138

139139
feature:
140140
enableFSGroupPolicy: false
141+
enableGetVolumeStats: false
141142

142143
driver:
143144
name: blob.csi.azure.com

pkg/blob/blob.go

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,7 @@ type DriverOptions struct {
119119
BlobfuseProxyConnTimout int
120120
EnableBlobMockMount bool
121121
AllowEmptyCloudConfig bool
122+
EnableGetVolumeStats bool
122123
}
123124

124125
// Driver implements all interfaces of CSI drivers
@@ -134,6 +135,7 @@ type Driver struct {
134135
enableBlobMockMount bool
135136
enableBlobfuseProxy bool
136137
allowEmptyCloudConfig bool
138+
enableGetVolumeStats bool
137139
blobfuseProxyConnTimout int
138140
mounter *mount.SafeFormatAndMount
139141
volLockMap *util.LockMap
@@ -164,6 +166,7 @@ func NewDriver(options *DriverOptions) *Driver {
164166
blobfuseProxyConnTimout: options.BlobfuseProxyConnTimout,
165167
enableBlobMockMount: options.EnableBlobMockMount,
166168
allowEmptyCloudConfig: options.AllowEmptyCloudConfig,
169+
enableGetVolumeStats: options.EnableGetVolumeStats,
167170
}
168171
d.Name = options.DriverName
169172
d.Version = driverVersion
@@ -216,11 +219,14 @@ func (d *Driver) Run(endpoint, kubeconfig string, testBool bool) {
216219
csi.VolumeCapability_AccessMode_MULTI_NODE_MULTI_WRITER,
217220
})
218221

219-
d.AddNodeServiceCapabilities([]csi.NodeServiceCapability_RPC_Type{
222+
nodeCap := []csi.NodeServiceCapability_RPC_Type{
220223
csi.NodeServiceCapability_RPC_STAGE_UNSTAGE_VOLUME,
221-
csi.NodeServiceCapability_RPC_GET_VOLUME_STATS,
222224
csi.NodeServiceCapability_RPC_SINGLE_NODE_MULTI_WRITER,
223-
})
225+
}
226+
if d.enableGetVolumeStats {
227+
nodeCap = append(nodeCap, csi.NodeServiceCapability_RPC_GET_VOLUME_STATS)
228+
}
229+
d.AddNodeServiceCapabilities(nodeCap)
224230

225231
s := csicommon.NewNonBlockingGRPCServer()
226232
// Driver d act as IdentityServer, ControllerServer and NodeServer

pkg/blobplugin/main.go

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,14 +43,15 @@ var (
4343
metricsAddress = flag.String("metrics-address", "0.0.0.0:29634", "export the metrics")
4444
kubeconfig = flag.String("kubeconfig", "", "Absolute path to the kubeconfig file. Required only when running out of cluster.")
4545
driverName = flag.String("drivername", blob.DefaultDriverName, "name of the driver")
46-
enableBlobfuseProxy = flag.Bool("enable-blobfuse-proxy", false, "Whether using blobfuse proxy for mounts")
46+
enableBlobfuseProxy = flag.Bool("enable-blobfuse-proxy", false, "using blobfuse proxy for mounts")
4747
blobfuseProxyConnTimout = flag.Int("blobfuse-proxy-connect-timeout", 5, "blobfuse proxy connection timeout(seconds)")
48-
enableBlobMockMount = flag.Bool("enable-blob-mock-mount", false, "Whether enable mock mount(only for testing)")
48+
enableBlobMockMount = flag.Bool("enable-blob-mock-mount", false, "enable mock mount(only for testing)")
4949
cloudConfigSecretName = flag.String("cloud-config-secret-name", "azure-cloud-provider", "secret name of cloud config")
5050
cloudConfigSecretNamespace = flag.String("cloud-config-secret-namespace", "kube-system", "secret namespace of cloud config")
5151
customUserAgent = flag.String("custom-user-agent", "", "custom userAgent")
5252
userAgentSuffix = flag.String("user-agent-suffix", "", "userAgent suffix")
53-
allowEmptyCloudConfig = flag.Bool("allow-empty-cloud-config", true, "Whether allow running driver without cloud config")
53+
allowEmptyCloudConfig = flag.Bool("allow-empty-cloud-config", true, "allow running driver without cloud config")
54+
enableGetVolumeStats = flag.Bool("enable-get-volume-stats", false, "allow GET_VOLUME_STATS on agent node")
5455
)
5556

5657
func main() {
@@ -83,6 +84,7 @@ func handle() {
8384
CustomUserAgent: *customUserAgent,
8485
UserAgentSuffix: *userAgentSuffix,
8586
AllowEmptyCloudConfig: *allowEmptyCloudConfig,
87+
EnableGetVolumeStats: *enableGetVolumeStats,
8688
}
8789
driver := blob.NewDriver(&driverOptions)
8890
if driver == nil {

0 commit comments

Comments
 (0)