Skip to content

Commit

Permalink
Merge pull request #97450 from andyzhangx/automated-cherry-pick-of-#9…
Browse files Browse the repository at this point in the history
…7417-upstream-release-1.19

Automated cherry pick of #97417: fix azure file secret not found issue
  • Loading branch information
k8s-ci-robot committed Jan 6, 2021
2 parents 7ba1601 + d9b827f commit 49b1bd0
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
7 changes: 4 additions & 3 deletions pkg/volume/azure_file/azure_file.go
Expand Up @@ -55,7 +55,8 @@ var _ volume.PersistentVolumePlugin = &azureFilePlugin{}
var _ volume.ExpandableVolumePlugin = &azureFilePlugin{}

const (
azureFilePluginName = "kubernetes.io/azure-file"
azureFilePluginName = "kubernetes.io/azure-file"
defaultSecretNamespace = "default"
)

func getPath(uid types.UID, volName string, host volume.VolumeHost) string {
Expand Down Expand Up @@ -115,7 +116,7 @@ func (plugin *azureFilePlugin) newMounterInternal(spec *volume.Spec, pod *v1.Pod
if err != nil {
return nil, err
}
secretName, secretNamespace, err := getSecretNameAndNamespace(spec, pod.Namespace)
secretName, secretNamespace, err := getSecretNameAndNamespace(spec, defaultSecretNamespace)
if err != nil {
// Log-and-continue instead of returning an error for now
// due to unspecified backwards compatibility concerns (a subject to revise)
Expand Down Expand Up @@ -173,7 +174,7 @@ func (plugin *azureFilePlugin) ExpandVolumeDevice(
resourceGroup = spec.PersistentVolume.ObjectMeta.Annotations[resourceGroupAnnotation]
}

secretName, secretNamespace, err := getSecretNameAndNamespace(spec, spec.PersistentVolume.Spec.ClaimRef.Namespace)
secretName, secretNamespace, err := getSecretNameAndNamespace(spec, defaultSecretNamespace)
if err != nil {
return oldSize, err
}
Expand Down
2 changes: 1 addition & 1 deletion pkg/volume/azure_file/azure_provision.go
Expand Up @@ -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, spec.PersistentVolume.Spec.ClaimRef.Namespace)
secretName, secretNamespace, err := getSecretNameAndNamespace(spec, defaultSecretNamespace)
if err != nil {
return nil, err
}
Expand Down

0 comments on commit 49b1bd0

Please sign in to comment.