Skip to content

Commit 416b51a

Browse files
committed
fix: only use pod.Namespace in inline volume support
1 parent 7aa2453 commit 416b51a

File tree

2 files changed

+1
-10
lines changed

2 files changed

+1
-10
lines changed

deploy/example/nginx-blobfuse-inline-volume.yaml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,4 +23,3 @@ spec:
2323
volumeAttributes:
2424
containerName: EXISTING_CONTAINER_NAME
2525
secretName: azure-secret
26-
secretNamespace: default # optional, if it's empty, use pod.Namespace by default

pkg/blob/nodeserver.go

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -70,15 +70,7 @@ func (d *Driver) NodePublishVolume(ctx context.Context, req *csi.NodePublishVolu
7070

7171
context := req.GetVolumeContext()
7272
if context != nil && context["csi.storage.k8s.io/ephemeral"] == "true" {
73-
// if secretNamespace is not set, set same namespace as pod
74-
secretNamespace := context["csi.storage.k8s.io/pod.namespace"]
75-
for k, v := range context {
76-
switch strings.ToLower(k) {
77-
case secretNamespaceField:
78-
secretNamespace = v
79-
}
80-
}
81-
context[secretNamespaceField] = secretNamespace
73+
context[secretNamespaceField] = context["csi.storage.k8s.io/pod.namespace"]
8274
klog.V(2).Infof("NodePublishVolume: ephemeral volume(%s) mount on %s, VolumeContext: %v", volumeID, target, context)
8375
_, err := d.NodeStageVolume(ctx, &csi.NodeStageVolumeRequest{
8476
StagingTargetPath: target,

0 commit comments

Comments
 (0)