@@ -460,7 +460,7 @@ func (d *Driver) GetAuthEnv(ctx context.Context, volumeID, protocol string, attr
460
460
if secretName != "" && ! strings .EqualFold (azureStorageAuthType , "msi" ) {
461
461
// read from k8s secret first
462
462
var name string
463
- name , accountKey , err = d .GetStorageAccountFromSecret (secretName , secretNamespace )
463
+ name , accountKey , err = d .GetStorageAccountFromSecret (ctx , secretName , secretNamespace )
464
464
if name != "" {
465
465
accountName = name
466
466
}
@@ -695,7 +695,7 @@ func getContainerReference(containerName string, secrets map[string]string, env
695
695
return container , nil
696
696
}
697
697
698
- func setAzureCredentials (kubeClient kubernetes.Interface , accountName , accountKey , secretNamespace string ) (string , error ) {
698
+ func setAzureCredentials (ctx context. Context , kubeClient kubernetes.Interface , accountName , accountKey , secretNamespace string ) (string , error ) {
699
699
if kubeClient == nil {
700
700
klog .Warningf ("could not create secret: kubeClient is nil" )
701
701
return "" , nil
@@ -715,7 +715,7 @@ func setAzureCredentials(kubeClient kubernetes.Interface, accountName, accountKe
715
715
},
716
716
Type : "Opaque" ,
717
717
}
718
- _ , err := kubeClient .CoreV1 ().Secrets (secretNamespace ).Create (context . TODO () , secret , metav1.CreateOptions {})
718
+ _ , err := kubeClient .CoreV1 ().Secrets (secretNamespace ).Create (ctx , secret , metav1.CreateOptions {})
719
719
if errors .IsAlreadyExists (err ) {
720
720
err = nil
721
721
}
@@ -738,7 +738,7 @@ func (d *Driver) GetStorageAccesskey(ctx context.Context, accountOptions *azure.
738
738
if secretName == "" {
739
739
secretName = fmt .Sprintf (secretNameTemplate , accountOptions .Name )
740
740
}
741
- _ , accountKey , err := d .GetStorageAccountFromSecret (secretName , secretNamespace )
741
+ _ , accountKey , err := d .GetStorageAccountFromSecret (ctx , secretName , secretNamespace )
742
742
if err != nil {
743
743
klog .V (2 ).Infof ("could not get account(%s) key from secret(%s) namespace(%s), error: %v, use cluster identity to get account key instead" , accountOptions .Name , secretName , secretNamespace , err )
744
744
accountKey , err = d .cloud .GetStorageAccesskey (ctx , accountOptions .SubscriptionID , accountOptions .Name , accountOptions .ResourceGroup )
@@ -748,12 +748,12 @@ func (d *Driver) GetStorageAccesskey(ctx context.Context, accountOptions *azure.
748
748
749
749
// GetStorageAccountFromSecret get storage account key from k8s secret
750
750
// return <accountName, accountKey, error>
751
- func (d * Driver ) GetStorageAccountFromSecret (secretName , secretNamespace string ) (string , string , error ) {
751
+ func (d * Driver ) GetStorageAccountFromSecret (ctx context. Context , secretName , secretNamespace string ) (string , string , error ) {
752
752
if d .cloud .KubeClient == nil {
753
753
return "" , "" , fmt .Errorf ("could not get account key from secret(%s): KubeClient is nil" , secretName )
754
754
}
755
755
756
- secret , err := d .cloud .KubeClient .CoreV1 ().Secrets (secretNamespace ).Get (context . TODO () , secretName , metav1.GetOptions {})
756
+ secret , err := d .cloud .KubeClient .CoreV1 ().Secrets (secretNamespace ).Get (ctx , secretName , metav1.GetOptions {})
757
757
if err != nil {
758
758
return "" , "" , fmt .Errorf ("could not get secret(%v): %w" , secretName , err )
759
759
}
0 commit comments