Skip to content

Commit 5e538b5

Browse files
committed
feat: add cloudConfigSecret in helm install
fix
1 parent 6862328 commit 5e538b5

File tree

9 files changed

+58
-36
lines changed

9 files changed

+58
-36
lines changed

charts/README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,8 @@ The following table lists the configurable parameters of the latest Azure Blob S
7979
| `serviceAccount.node` | name of service account for csi-blob-node | `csi-blob-node-sa` |
8080
| `rbac.create` | whether create rbac of csi-blob-controller | `true` |
8181
| `controller.name` | name of driver deployment | `csi-blob-controller`
82+
| `controller.cloudConfigSecretName` | cloud config secret name of controller driver | `azure-cloud-provider`
83+
| `controller.cloudConfigSecretNamespace` | cloud config secret namespace of controller driver | `kube-system`
8284
| `controller.replicas` | the replicas of csi-blob-controller | `2` |
8385
| `controller.metricsPort` | metrics port of csi-blob-controller | `29634` |
8486
| `controller.livenessProbe.healthPort ` | health check port for liveness probe | `29632` |
@@ -104,6 +106,8 @@ The following table lists the configurable parameters of the latest Azure Blob S
104106
| `controller.nodeSelector` | controller pod node selector | {} |
105107
| `controller.tolerations` | controller pod tolerations | [] |
106108
| `node.name` | name of driver daemonset | `csi-blob-node`
109+
| `node.cloudConfigSecretName` | cloud config secret name of node driver | `azure-cloud-provider`
110+
| `node.cloudConfigSecretNamespace` | cloud config secret namespace of node driver | `kube-system`
107111
| `node.metricsPort` | metrics port of csi-blob-node | `29635` |
108112
| `node.livenessProbe.healthPort ` | health check port for liveness probe | `29633` |
109113
| `node.logLevel` | node driver log level | `5` |
73 Bytes
Binary file not shown.

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,8 @@ spec:
7979
- "--endpoint=$(CSI_ENDPOINT)"
8080
- "--metrics-address=0.0.0.0:{{ .Values.controller.metricsPort }}"
8181
- "--drivername={{ .Values.driver.name }}"
82+
- "--cloud-config-secret-name={{ .Values.controller.cloudConfigSecretName }}"
83+
- "--cloud-config-secret-namespace={{ .Values.controller.cloudConfigSecretNamespace }}"
8284
ports:
8385
- containerPort: {{ .Values.controller.livenessProbe.healthPort }}
8486
name: healthz

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,8 @@ spec:
9393
- "--nodeid=$(KUBE_NODE_NAME)"
9494
- "--metrics-address=0.0.0.0:{{ .Values.node.metricsPort }}"
9595
- "--drivername={{ .Values.driver.name }}"
96+
- "--cloud-config-secret-name={{ .Values.node.cloudConfigSecretName }}"
97+
- "--cloud-config-secret-namespace={{ .Values.node.cloudConfigSecretNamespace }}"
9698
ports:
9799
- containerPort: {{ .Values.node.livenessProbe.healthPort }}
98100
name: healthz

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,8 @@ rbac:
3636

3737
controller:
3838
name: csi-blob-controller
39+
cloudConfigSecretName: azure-cloud-provider
40+
cloudConfigSecretNamespace: kube-system
3941
metricsPort: 29634
4042
livenessProbe:
4143
healthPort: 29632
@@ -83,6 +85,8 @@ controller:
8385

8486
node:
8587
name: csi-blob-node
88+
cloudConfigSecretName: azure-cloud-provider
89+
cloudConfigSecretNamespace: kube-system
8690
metricsPort: 29635
8791
livenessProbe:
8892
healthPort: 29633

pkg/blob/azure.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,11 +49,11 @@ func IsAzureStackCloud(cloud *azureprovider.Cloud) bool {
4949
}
5050

5151
// getCloudProvider get Azure Cloud Provider
52-
func getCloudProvider(kubeconfig, nodeID string) (*azureprovider.Cloud, error) {
52+
func getCloudProvider(kubeconfig, nodeID, secretName, secretNamespace string) (*azureprovider.Cloud, error) {
5353
az := &azureprovider.Cloud{
5454
InitSecretConfig: azureprovider.InitSecretConfig{
55-
SecretName: "azure-cloud-provider",
56-
SecretNamespace: "kube-system",
55+
SecretName: secretName,
56+
SecretNamespace: secretNamespace,
5757
CloudConfigKey: "cloud-config",
5858
},
5959
}

pkg/blob/azure_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@ users:
150150
}
151151
os.Setenv(DefaultAzureCredentialFileEnv, fakeCredFile)
152152
}
153-
cloud, err := getCloudProvider(test.kubeconfig, test.nodeID)
153+
cloud, err := getCloudProvider(test.kubeconfig, test.nodeID, "", "")
154154
if !reflect.DeepEqual(err, test.expectedErr) {
155155
t.Errorf("desc: %s,\n input: %q, GetCloudProvider err: %v, expectedErr: %v", test.desc, test.kubeconfig, err, test.expectedErr)
156156
}

pkg/blob/blob.go

Lines changed: 22 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -103,19 +103,23 @@ var (
103103

104104
// DriverOptions defines driver parameters specified in driver deployment
105105
type DriverOptions struct {
106-
NodeID string
107-
DriverName string
108-
BlobfuseProxyEndpoint string
109-
EnableBlobfuseProxy bool
110-
BlobfuseProxyConnTimout int
111-
EnableBlobMockMount bool
106+
NodeID string
107+
DriverName string
108+
CloudConfigSecretName string
109+
CloudConfigSecretNamespace string
110+
BlobfuseProxyEndpoint string
111+
EnableBlobfuseProxy bool
112+
BlobfuseProxyConnTimout int
113+
EnableBlobMockMount bool
112114
}
113115

114116
// Driver implements all interfaces of CSI drivers
115117
type Driver struct {
116118
csicommon.CSIDriver
117-
cloud *azure.Cloud
118-
blobfuseProxyEndpoint string
119+
cloud *azure.Cloud
120+
cloudConfigSecretName string
121+
cloudConfigSecretNamespace string
122+
blobfuseProxyEndpoint string
119123
// enableBlobMockMount is only for testing, DO NOT set as true in non-testing scenario
120124
enableBlobMockMount bool
121125
enableBlobfuseProxy bool
@@ -133,13 +137,15 @@ type Driver struct {
133137
// does not support optional driver plugin info manifest field. Refer to CSI spec for more details.
134138
func NewDriver(options *DriverOptions) *Driver {
135139
d := Driver{
136-
volLockMap: util.NewLockMap(),
137-
subnetLockMap: util.NewLockMap(),
138-
volumeLocks: newVolumeLocks(),
139-
blobfuseProxyEndpoint: options.BlobfuseProxyEndpoint,
140-
enableBlobfuseProxy: options.EnableBlobfuseProxy,
141-
blobfuseProxyConnTimout: options.BlobfuseProxyConnTimout,
142-
enableBlobMockMount: options.EnableBlobMockMount,
140+
volLockMap: util.NewLockMap(),
141+
subnetLockMap: util.NewLockMap(),
142+
volumeLocks: newVolumeLocks(),
143+
cloudConfigSecretName: options.CloudConfigSecretName,
144+
cloudConfigSecretNamespace: options.CloudConfigSecretNamespace,
145+
blobfuseProxyEndpoint: options.BlobfuseProxyEndpoint,
146+
enableBlobfuseProxy: options.EnableBlobfuseProxy,
147+
blobfuseProxyConnTimout: options.BlobfuseProxyConnTimout,
148+
enableBlobMockMount: options.EnableBlobMockMount,
143149
}
144150
d.Name = options.DriverName
145151
d.Version = driverVersion
@@ -155,7 +161,7 @@ func (d *Driver) Run(endpoint, kubeconfig string, testBool bool) {
155161
}
156162
klog.Infof("\nDRIVER INFORMATION:\n-------------------\n%s\n\nStreaming logs below:", versionMeta)
157163

158-
d.cloud, err = getCloudProvider(kubeconfig, d.NodeID)
164+
d.cloud, err = getCloudProvider(kubeconfig, d.NodeID, d.cloudConfigSecretName, d.cloudConfigSecretNamespace)
159165
if err != nil {
160166
klog.Fatalf("failed to get Azure Cloud Provider, error: %v", err)
161167
}

pkg/blobplugin/main.go

Lines changed: 20 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -36,16 +36,18 @@ func init() {
3636
}
3737

3838
var (
39-
endpoint = flag.String("endpoint", "unix://tmp/csi.sock", "CSI endpoint")
40-
blobfuseProxyEndpoint = flag.String("blobfuse-proxy-endpoint", "unix://tmp/blobfuse-proxy.sock", "blobfuse-proxy endpoint")
41-
nodeID = flag.String("nodeid", "", "node id")
42-
version = flag.Bool("version", false, "Print the version and exit.")
43-
metricsAddress = flag.String("metrics-address", "0.0.0.0:29634", "export the metrics")
44-
kubeconfig = flag.String("kubeconfig", "", "Absolute path to the kubeconfig file. Required only when running out of cluster.")
45-
driverName = flag.String("drivername", blob.DefaultDriverName, "name of the driver")
46-
enableBlobfuseProxy = flag.Bool("enable-blobfuse-proxy", false, "Whether using blobfuse proxy for mounts")
47-
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)")
39+
endpoint = flag.String("endpoint", "unix://tmp/csi.sock", "CSI endpoint")
40+
blobfuseProxyEndpoint = flag.String("blobfuse-proxy-endpoint", "unix://tmp/blobfuse-proxy.sock", "blobfuse-proxy endpoint")
41+
nodeID = flag.String("nodeid", "", "node id")
42+
version = flag.Bool("version", false, "Print the version and exit.")
43+
metricsAddress = flag.String("metrics-address", "0.0.0.0:29634", "export the metrics")
44+
kubeconfig = flag.String("kubeconfig", "", "Absolute path to the kubeconfig file. Required only when running out of cluster.")
45+
driverName = flag.String("drivername", blob.DefaultDriverName, "name of the driver")
46+
enableBlobfuseProxy = flag.Bool("enable-blobfuse-proxy", false, "Whether using blobfuse proxy for mounts")
47+
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)")
49+
cloudConfigSecretName = flag.String("cloud-config-secret-name", "azure-cloud-provider", "secret name of cloud config")
50+
cloudConfigSecretNamespace = flag.String("cloud-config-secret-namespace", "kube-system", "secret namespace of cloud config")
4951
)
5052

5153
func main() {
@@ -67,12 +69,14 @@ func main() {
6769

6870
func handle() {
6971
driverOptions := blob.DriverOptions{
70-
NodeID: *nodeID,
71-
DriverName: *driverName,
72-
BlobfuseProxyEndpoint: *blobfuseProxyEndpoint,
73-
EnableBlobfuseProxy: *enableBlobfuseProxy,
74-
BlobfuseProxyConnTimout: *blobfuseProxyConnTimout,
75-
EnableBlobMockMount: *enableBlobMockMount,
72+
NodeID: *nodeID,
73+
DriverName: *driverName,
74+
CloudConfigSecretName: *cloudConfigSecretName,
75+
CloudConfigSecretNamespace: *cloudConfigSecretNamespace,
76+
BlobfuseProxyEndpoint: *blobfuseProxyEndpoint,
77+
EnableBlobfuseProxy: *enableBlobfuseProxy,
78+
BlobfuseProxyConnTimout: *blobfuseProxyConnTimout,
79+
EnableBlobMockMount: *enableBlobMockMount,
7680
}
7781
driver := blob.NewDriver(&driverOptions)
7882
if driver == nil {

0 commit comments

Comments
 (0)