Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
K
k3s
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Jacklull
k3s
Commits
c27b913f
Unverified
Commit
c27b913f
authored
Feb 26, 2019
by
Kubernetes Prow Robot
Committed by
GitHub
Feb 26, 2019
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #74486 from andyzhangx/automated-cherry-pick-of-#74191-upstream-release-1.13
Automated cherry pick of #74191: remove get azure accounts in the init process set timeout
parents
b1a3a651
63ee42e9
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
21 additions
and
32 deletions
+21
-32
azure.go
pkg/cloudprovider/providers/azure/azure.go
+2
-16
azure_blobDiskController.go
...cloudprovider/providers/azure/azure_blobDiskController.go
+15
-11
azure_managedDiskController.go
...udprovider/providers/azure/azure_managedDiskController.go
+0
-4
azure_dd.go
pkg/volume/azure_dd/azure_dd.go
+4
-1
No files found.
pkg/cloudprovider/providers/azure/azure.go
View file @
c27b913f
...
@@ -456,22 +456,8 @@ func initDiskControllers(az *Cloud) error {
...
@@ -456,22 +456,8 @@ func initDiskControllers(az *Cloud) error {
cloud
:
az
,
cloud
:
az
,
}
}
// BlobDiskController: contains the function needed to
az
.
BlobDiskController
=
&
BlobDiskController
{
common
:
common
}
// create/attach/detach/delete blob based (unmanaged disks)
az
.
ManagedDiskController
=
&
ManagedDiskController
{
common
:
common
}
blobController
,
err
:=
newBlobDiskController
(
common
)
if
err
!=
nil
{
return
fmt
.
Errorf
(
"AzureDisk - failed to init Blob Disk Controller with error (%s)"
,
err
.
Error
())
}
// ManagedDiskController: contains the functions needed to
// create/attach/detach/delete managed disks
managedController
,
err
:=
newManagedDiskController
(
common
)
if
err
!=
nil
{
return
fmt
.
Errorf
(
"AzureDisk - failed to init Managed Disk Controller with error (%s)"
,
err
.
Error
())
}
az
.
BlobDiskController
=
blobController
az
.
ManagedDiskController
=
managedController
az
.
controllerCommon
=
common
az
.
controllerCommon
=
common
return
nil
return
nil
...
...
pkg/cloudprovider/providers/azure/azure_blobDiskController.go
View file @
c27b913f
...
@@ -18,6 +18,7 @@ package azure
...
@@ -18,6 +18,7 @@ package azure
import
(
import
(
"bytes"
"bytes"
"context"
"encoding/binary"
"encoding/binary"
"fmt"
"fmt"
"net/url"
"net/url"
...
@@ -62,18 +63,19 @@ var (
...
@@ -62,18 +63,19 @@ var (
accountsLock
=
&
sync
.
Mutex
{}
accountsLock
=
&
sync
.
Mutex
{}
)
)
func
newBlobDiskController
(
common
*
controllerCommon
)
(
*
BlobDiskController
,
error
)
{
func
(
c
*
BlobDiskController
)
initStorageAccounts
()
{
c
:=
BlobDiskController
{
common
:
common
}
accountsLock
.
Lock
()
defer
accountsLock
.
Unlock
()
// get accounts
if
c
.
accounts
==
nil
{
accounts
,
err
:=
c
.
getAllStorageAccounts
()
// get accounts
if
err
!=
nil
{
accounts
,
err
:=
c
.
getAllStorageAccounts
()
klog
.
Errorf
(
"azureDisk - getAllStorageAccounts error: %v"
,
err
)
if
err
!=
nil
{
c
.
accounts
=
make
(
map
[
string
]
*
storageAccountState
)
klog
.
Errorf
(
"azureDisk - getAllStorageAccounts error: %v"
,
err
)
return
&
c
,
nil
c
.
accounts
=
make
(
map
[
string
]
*
storageAccountState
)
}
c
.
accounts
=
accounts
}
}
c
.
accounts
=
accounts
return
&
c
,
nil
}
}
// CreateVolume creates a VHD blob in a storage account that has storageType and location using the given storage account.
// CreateVolume creates a VHD blob in a storage account that has storageType and location using the given storage account.
...
@@ -217,6 +219,8 @@ func (c *BlobDiskController) deleteVhdBlob(accountName, accountKey, blobName str
...
@@ -217,6 +219,8 @@ func (c *BlobDiskController) deleteVhdBlob(accountName, accountKey, blobName str
func
(
c
*
BlobDiskController
)
CreateBlobDisk
(
dataDiskName
string
,
storageAccountType
storage
.
SkuName
,
sizeGB
int
)
(
string
,
error
)
{
func
(
c
*
BlobDiskController
)
CreateBlobDisk
(
dataDiskName
string
,
storageAccountType
storage
.
SkuName
,
sizeGB
int
)
(
string
,
error
)
{
klog
.
V
(
4
)
.
Infof
(
"azureDisk - creating blob data disk named:%s on StorageAccountType:%s"
,
dataDiskName
,
storageAccountType
)
klog
.
V
(
4
)
.
Infof
(
"azureDisk - creating blob data disk named:%s on StorageAccountType:%s"
,
dataDiskName
,
storageAccountType
)
c
.
initStorageAccounts
()
storageAccountName
,
err
:=
c
.
findSANameForDisk
(
storageAccountType
)
storageAccountName
,
err
:=
c
.
findSANameForDisk
(
storageAccountType
)
if
err
!=
nil
{
if
err
!=
nil
{
return
""
,
err
return
""
,
err
...
@@ -436,7 +440,7 @@ func (c *BlobDiskController) getDiskCount(SAName string) (int, error) {
...
@@ -436,7 +440,7 @@ func (c *BlobDiskController) getDiskCount(SAName string) (int, error) {
}
}
func
(
c
*
BlobDiskController
)
getAllStorageAccounts
()
(
map
[
string
]
*
storageAccountState
,
error
)
{
func
(
c
*
BlobDiskController
)
getAllStorageAccounts
()
(
map
[
string
]
*
storageAccountState
,
error
)
{
ctx
,
cancel
:=
getContextWithCancel
(
)
ctx
,
cancel
:=
context
.
WithTimeout
(
context
.
Background
(),
60
*
time
.
Second
)
defer
cancel
()
defer
cancel
()
accountListResult
,
err
:=
c
.
common
.
cloud
.
StorageAccountClient
.
ListByResourceGroup
(
ctx
,
c
.
common
.
resourceGroup
)
accountListResult
,
err
:=
c
.
common
.
cloud
.
StorageAccountClient
.
ListByResourceGroup
(
ctx
,
c
.
common
.
resourceGroup
)
if
err
!=
nil
{
if
err
!=
nil
{
...
...
pkg/cloudprovider/providers/azure/azure_managedDiskController.go
View file @
c27b913f
...
@@ -68,10 +68,6 @@ type ManagedDiskOptions struct {
...
@@ -68,10 +68,6 @@ type ManagedDiskOptions struct {
DiskMBpsReadWrite
string
DiskMBpsReadWrite
string
}
}
func
newManagedDiskController
(
common
*
controllerCommon
)
(
*
ManagedDiskController
,
error
)
{
return
&
ManagedDiskController
{
common
:
common
},
nil
}
//CreateManagedDisk : create managed disk
//CreateManagedDisk : create managed disk
func
(
c
*
ManagedDiskController
)
CreateManagedDisk
(
options
*
ManagedDiskOptions
)
(
string
,
error
)
{
func
(
c
*
ManagedDiskController
)
CreateManagedDisk
(
options
*
ManagedDiskOptions
)
(
string
,
error
)
{
var
err
error
var
err
error
...
...
pkg/volume/azure_dd/azure_dd.go
View file @
c27b913f
...
@@ -20,6 +20,7 @@ import (
...
@@ -20,6 +20,7 @@ import (
"context"
"context"
"fmt"
"fmt"
"strings"
"strings"
"time"
"github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2018-10-01/compute"
"github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2018-10-01/compute"
"github.com/Azure/azure-sdk-for-go/services/storage/mgmt/2018-07-01/storage"
"github.com/Azure/azure-sdk-for-go/services/storage/mgmt/2018-07-01/storage"
...
@@ -160,7 +161,9 @@ func (plugin *azureDataDiskPlugin) GetVolumeLimits() (map[string]int64, error) {
...
@@ -160,7 +161,9 @@ func (plugin *azureDataDiskPlugin) GetVolumeLimits() (map[string]int64, error) {
}
}
if
vmSizeList
==
nil
{
if
vmSizeList
==
nil
{
result
,
err
:=
az
.
VirtualMachineSizesClient
.
List
(
context
.
TODO
(),
az
.
Location
)
ctx
,
cancel
:=
context
.
WithTimeout
(
context
.
Background
(),
60
*
time
.
Second
)
defer
cancel
()
result
,
err
:=
az
.
VirtualMachineSizesClient
.
List
(
ctx
,
az
.
Location
)
if
err
!=
nil
||
result
.
Value
==
nil
{
if
err
!=
nil
||
result
.
Value
==
nil
{
klog
.
Errorf
(
"failed to list vm sizes in GetVolumeLimits, plugin.host: %s, location: %s"
,
plugin
.
host
.
GetHostName
(),
az
.
Location
)
klog
.
Errorf
(
"failed to list vm sizes in GetVolumeLimits, plugin.host: %s, location: %s"
,
plugin
.
host
.
GetHostName
(),
az
.
Location
)
return
volumeLimits
,
nil
return
volumeLimits
,
nil
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment