mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-25 04:33:26 +00:00
make GetStorageAccesskey public as a lib
This commit is contained in:
parent
8f7405ec92
commit
14ad73eaa8
@ -108,7 +108,7 @@ func (c *BlobDiskController) DeleteVolume(diskURI string) error {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("failed to parse vhd URI %v", err)
|
return fmt.Errorf("failed to parse vhd URI %v", err)
|
||||||
}
|
}
|
||||||
key, err := c.common.cloud.getStorageAccesskey(accountName, c.common.resourceGroup)
|
key, err := c.common.cloud.GetStorageAccesskey(accountName, c.common.resourceGroup)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("no key for storage account %s, err %v", accountName, err)
|
return fmt.Errorf("no key for storage account %s, err %v", accountName, err)
|
||||||
}
|
}
|
||||||
|
@ -64,8 +64,8 @@ func (az *Cloud) getStorageAccounts(matchingAccountType, matchingAccountKind, re
|
|||||||
return accounts, nil
|
return accounts, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// getStorageAccesskey gets the storage account access key
|
// GetStorageAccesskey gets the storage account access key
|
||||||
func (az *Cloud) getStorageAccesskey(account, resourceGroup string) (string, error) {
|
func (az *Cloud) GetStorageAccesskey(account, resourceGroup string) (string, error) {
|
||||||
ctx, cancel := getContextWithCancel()
|
ctx, cancel := getContextWithCancel()
|
||||||
defer cancel()
|
defer cancel()
|
||||||
|
|
||||||
@ -137,7 +137,7 @@ func (az *Cloud) ensureStorageAccount(accountName, accountType, accountKind, res
|
|||||||
}
|
}
|
||||||
|
|
||||||
// find the access key with this account
|
// find the access key with this account
|
||||||
accountKey, err := az.getStorageAccesskey(accountName, resourceGroup)
|
accountKey, err := az.GetStorageAccesskey(accountName, resourceGroup)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return "", "", fmt.Errorf("could not get storage key for storage account %s: %v", accountName, err)
|
return "", "", fmt.Errorf("could not get storage key for storage account %s: %v", accountName, err)
|
||||||
}
|
}
|
||||||
|
@ -64,7 +64,7 @@ func TestGetStorageAccessKeys(t *testing.T) {
|
|||||||
expectedKey := test.expectedKey
|
expectedKey := test.expectedKey
|
||||||
fake.Keys = test.results
|
fake.Keys = test.results
|
||||||
fake.Err = test.err
|
fake.Err = test.err
|
||||||
key, err := cloud.getStorageAccesskey("acct", "rg")
|
key, err := cloud.GetStorageAccesskey("acct", "rg")
|
||||||
if test.expectErr && err == nil {
|
if test.expectErr && err == nil {
|
||||||
t.Errorf("Unexpected non-error")
|
t.Errorf("Unexpected non-error")
|
||||||
continue
|
continue
|
||||||
|
Loading…
Reference in New Issue
Block a user