From 9c169a2122048d610e94ac7c4cf16f26e27c4bb4 Mon Sep 17 00:00:00 2001 From: Michelle Au Date: Thu, 25 Mar 2021 09:28:50 -0700 Subject: [PATCH] Revert "fix azure file secret not found issue" This reverts commit 8d43976b745ede2f96f85647801636a83194b7ae. Change-Id: Iefaa0e76489883830ba1c9bdcbc3101bcc33082c --- pkg/volume/azure_file/azure_file.go | 5 ++--- pkg/volume/azure_file/azure_provision.go | 2 +- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/pkg/volume/azure_file/azure_file.go b/pkg/volume/azure_file/azure_file.go index 08b02a782f6..77196a15e6c 100644 --- a/pkg/volume/azure_file/azure_file.go +++ b/pkg/volume/azure_file/azure_file.go @@ -56,7 +56,6 @@ var _ volume.ExpandableVolumePlugin = &azureFilePlugin{} const ( azureFilePluginName = "kubernetes.io/azure-file" - defaultSecretNamespace = "default" minimumPremiumShareSize = 100 // GB ) @@ -117,7 +116,7 @@ func (plugin *azureFilePlugin) newMounterInternal(spec *volume.Spec, pod *v1.Pod if err != nil { return nil, err } - secretName, secretNamespace, err := getSecretNameAndNamespace(spec, defaultSecretNamespace) + secretName, secretNamespace, err := getSecretNameAndNamespace(spec, pod.Namespace) if err != nil { // Log-and-continue instead of returning an error for now // due to unspecified backwards compatibility concerns (a subject to revise) @@ -175,7 +174,7 @@ func (plugin *azureFilePlugin) ExpandVolumeDevice( resourceGroup = spec.PersistentVolume.ObjectMeta.Annotations[resourceGroupAnnotation] } - secretName, secretNamespace, err := getSecretNameAndNamespace(spec, defaultSecretNamespace) + secretName, secretNamespace, err := getSecretNameAndNamespace(spec, spec.PersistentVolume.Spec.ClaimRef.Namespace) if err != nil { return oldSize, err } diff --git a/pkg/volume/azure_file/azure_provision.go b/pkg/volume/azure_file/azure_provision.go index a9dc31b6909..57e8cd17110 100644 --- a/pkg/volume/azure_file/azure_provision.go +++ b/pkg/volume/azure_file/azure_provision.go @@ -79,7 +79,7 @@ func (plugin *azureFilePlugin) newDeleterInternal(spec *volume.Spec, util azureU return nil, fmt.Errorf("invalid PV spec") } - secretName, secretNamespace, err := getSecretNameAndNamespace(spec, defaultSecretNamespace) + secretName, secretNamespace, err := getSecretNameAndNamespace(spec, spec.PersistentVolume.Spec.ClaimRef.Namespace) if err != nil { return nil, err }