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
079f9b85
Commit
079f9b85
authored
Apr 24, 2018
by
Pengfei Ni
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use new clients in azure cloud provider
parent
8a0cae86
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
19 changed files
with
127 additions
and
134 deletions
+127
-134
BUILD
pkg/cloudprovider/providers/azure/BUILD
+2
-5
azure_backoff.go
pkg/cloudprovider/providers/azure/azure_backoff.go
+10
-33
azure_blobDiskController.go
...cloudprovider/providers/azure/azure_blobDiskController.go
+15
-8
azure_controller_common.go
pkg/cloudprovider/providers/azure/azure_controller_common.go
+1
-1
azure_controller_standard.go
...loudprovider/providers/azure/azure_controller_standard.go
+9
-9
azure_controller_vmss.go
pkg/cloudprovider/providers/azure/azure_controller_vmss.go
+7
-8
azure_fakes.go
pkg/cloudprovider/providers/azure/azure_fakes.go
+0
-0
azure_loadbalancer.go
pkg/cloudprovider/providers/azure/azure_loadbalancer.go
+3
-3
azure_managedDiskController.go
...udprovider/providers/azure/azure_managedDiskController.go
+22
-18
azure_standard.go
pkg/cloudprovider/providers/azure/azure_standard.go
+1
-1
azure_storage.go
pkg/cloudprovider/providers/azure/azure_storage.go
+1
-1
azure_storage_test.go
pkg/cloudprovider/providers/azure/azure_storage_test.go
+1
-1
azure_storageaccount.go
pkg/cloudprovider/providers/azure/azure_storageaccount.go
+12
-7
azure_storageaccount_test.go
...loudprovider/providers/azure/azure_storageaccount_test.go
+1
-1
azure_test.go
pkg/cloudprovider/providers/azure/azure_test.go
+7
-5
azure_vmsets.go
pkg/cloudprovider/providers/azure/azure_vmsets.go
+1
-1
azure_vmss.go
pkg/cloudprovider/providers/azure/azure_vmss.go
+20
-20
azure_vmss_test.go
pkg/cloudprovider/providers/azure/azure_vmss_test.go
+10
-10
azure_wrap.go
pkg/cloudprovider/providers/azure/azure_wrap.go
+4
-2
No files found.
pkg/cloudprovider/providers/azure/BUILD
View file @
079f9b85
...
@@ -42,11 +42,9 @@ go_library(
...
@@ -42,11 +42,9 @@ go_library(
"//pkg/controller:go_default_library",
"//pkg/controller:go_default_library",
"//pkg/version:go_default_library",
"//pkg/version:go_default_library",
"//pkg/volume:go_default_library",
"//pkg/volume:go_default_library",
"//vendor/github.com/Azure/azure-sdk-for-go/arm/compute:go_default_library",
"//vendor/github.com/Azure/azure-sdk-for-go/arm/disk:go_default_library",
"//vendor/github.com/Azure/azure-sdk-for-go/arm/storage:go_default_library",
"//vendor/github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2017-12-01/compute:go_default_library",
"//vendor/github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2017-12-01/compute:go_default_library",
"//vendor/github.com/Azure/azure-sdk-for-go/services/network/mgmt/2017-09-01/network:go_default_library",
"//vendor/github.com/Azure/azure-sdk-for-go/services/network/mgmt/2017-09-01/network:go_default_library",
"//vendor/github.com/Azure/azure-sdk-for-go/services/storage/mgmt/2017-10-01/storage:go_default_library",
"//vendor/github.com/Azure/azure-sdk-for-go/storage:go_default_library",
"//vendor/github.com/Azure/azure-sdk-for-go/storage:go_default_library",
"//vendor/github.com/Azure/go-autorest/autorest:go_default_library",
"//vendor/github.com/Azure/go-autorest/autorest:go_default_library",
"//vendor/github.com/Azure/go-autorest/autorest/adal:go_default_library",
"//vendor/github.com/Azure/go-autorest/autorest/adal:go_default_library",
...
@@ -89,10 +87,9 @@ go_test(
...
@@ -89,10 +87,9 @@ go_test(
"//pkg/cloudprovider:go_default_library",
"//pkg/cloudprovider:go_default_library",
"//pkg/cloudprovider/providers/azure/auth:go_default_library",
"//pkg/cloudprovider/providers/azure/auth:go_default_library",
"//pkg/kubelet/apis:go_default_library",
"//pkg/kubelet/apis:go_default_library",
"//vendor/github.com/Azure/azure-sdk-for-go/arm/compute:go_default_library",
"//vendor/github.com/Azure/azure-sdk-for-go/arm/storage:go_default_library",
"//vendor/github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2017-12-01/compute:go_default_library",
"//vendor/github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2017-12-01/compute:go_default_library",
"//vendor/github.com/Azure/azure-sdk-for-go/services/network/mgmt/2017-09-01/network:go_default_library",
"//vendor/github.com/Azure/azure-sdk-for-go/services/network/mgmt/2017-09-01/network:go_default_library",
"//vendor/github.com/Azure/azure-sdk-for-go/services/storage/mgmt/2017-10-01/storage:go_default_library",
"//vendor/github.com/Azure/go-autorest/autorest:go_default_library",
"//vendor/github.com/Azure/go-autorest/autorest:go_default_library",
"//vendor/github.com/Azure/go-autorest/autorest/to:go_default_library",
"//vendor/github.com/Azure/go-autorest/autorest/to:go_default_library",
"//vendor/github.com/stretchr/testify/assert:go_default_library",
"//vendor/github.com/stretchr/testify/assert:go_default_library",
...
...
pkg/cloudprovider/providers/azure/azure_backoff.go
View file @
079f9b85
...
@@ -20,8 +20,7 @@ import (
...
@@ -20,8 +20,7 @@ import (
"context"
"context"
"net/http"
"net/http"
"github.com/Azure/azure-sdk-for-go/arm/compute"
"github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2017-12-01/compute"
computepreview
"github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2017-12-01/compute"
"github.com/Azure/azure-sdk-for-go/services/network/mgmt/2017-09-01/network"
"github.com/Azure/azure-sdk-for-go/services/network/mgmt/2017-09-01/network"
"github.com/Azure/go-autorest/autorest"
"github.com/Azure/go-autorest/autorest"
"github.com/golang/glog"
"github.com/golang/glog"
...
@@ -72,10 +71,11 @@ func (az *Cloud) GetVirtualMachineWithRetry(name types.NodeName) (compute.Virtua
...
@@ -72,10 +71,11 @@ func (az *Cloud) GetVirtualMachineWithRetry(name types.NodeName) (compute.Virtua
// VirtualMachineClientListWithRetry invokes az.VirtualMachinesClient.List with exponential backoff retry
// VirtualMachineClientListWithRetry invokes az.VirtualMachinesClient.List with exponential backoff retry
func
(
az
*
Cloud
)
VirtualMachineClientListWithRetry
()
([]
compute
.
VirtualMachine
,
error
)
{
func
(
az
*
Cloud
)
VirtualMachineClientListWithRetry
()
([]
compute
.
VirtualMachine
,
error
)
{
allNodes
:=
[]
compute
.
VirtualMachine
{}
allNodes
:=
[]
compute
.
VirtualMachine
{}
var
result
compute
.
VirtualMachineListResult
err
:=
wait
.
ExponentialBackoff
(
az
.
requestBackoff
(),
func
()
(
bool
,
error
)
{
err
:=
wait
.
ExponentialBackoff
(
az
.
requestBackoff
(),
func
()
(
bool
,
error
)
{
var
retryErr
error
var
retryErr
error
result
,
retryErr
=
az
.
VirtualMachinesClient
.
List
(
az
.
ResourceGroup
)
ctx
,
cancel
:=
getContextWithCancel
()
defer
cancel
()
allNodes
,
retryErr
=
az
.
VirtualMachinesClient
.
List
(
ctx
,
az
.
ResourceGroup
)
if
retryErr
!=
nil
{
if
retryErr
!=
nil
{
glog
.
Errorf
(
"VirtualMachinesClient.List(%v) - backoff: failure, will retry,err=%v"
,
glog
.
Errorf
(
"VirtualMachinesClient.List(%v) - backoff: failure, will retry,err=%v"
,
az
.
ResourceGroup
,
az
.
ResourceGroup
,
...
@@ -89,30 +89,6 @@ func (az *Cloud) VirtualMachineClientListWithRetry() ([]compute.VirtualMachine,
...
@@ -89,30 +89,6 @@ func (az *Cloud) VirtualMachineClientListWithRetry() ([]compute.VirtualMachine,
return
nil
,
err
return
nil
,
err
}
}
appendResults
:=
(
result
.
Value
!=
nil
&&
len
(
*
result
.
Value
)
>
0
)
for
appendResults
{
allNodes
=
append
(
allNodes
,
*
result
.
Value
...
)
appendResults
=
false
// follow the next link to get all the vms for resource group
if
result
.
NextLink
!=
nil
{
err
:=
wait
.
ExponentialBackoff
(
az
.
requestBackoff
(),
func
()
(
bool
,
error
)
{
var
retryErr
error
result
,
retryErr
=
az
.
VirtualMachinesClient
.
ListNextResults
(
az
.
ResourceGroup
,
result
)
if
retryErr
!=
nil
{
glog
.
Errorf
(
"VirtualMachinesClient.ListNextResults(%v) - backoff: failure, will retry,err=%v"
,
az
.
ResourceGroup
,
retryErr
)
return
false
,
retryErr
}
glog
.
V
(
2
)
.
Infof
(
"VirtualMachinesClient.ListNextResults(%v): success"
,
az
.
ResourceGroup
)
return
true
,
nil
})
if
err
!=
nil
{
return
allNodes
,
err
}
appendResults
=
(
result
.
Value
!=
nil
&&
len
(
*
result
.
Value
)
>
0
)
}
}
return
allNodes
,
err
return
allNodes
,
err
}
}
...
@@ -352,16 +328,17 @@ func (az *Cloud) DeleteRouteWithRetry(routeName string) error {
...
@@ -352,16 +328,17 @@ func (az *Cloud) DeleteRouteWithRetry(routeName string) error {
// CreateOrUpdateVMWithRetry invokes az.VirtualMachinesClient.CreateOrUpdate with exponential backoff retry
// CreateOrUpdateVMWithRetry invokes az.VirtualMachinesClient.CreateOrUpdate with exponential backoff retry
func
(
az
*
Cloud
)
CreateOrUpdateVMWithRetry
(
vmName
string
,
newVM
compute
.
VirtualMachine
)
error
{
func
(
az
*
Cloud
)
CreateOrUpdateVMWithRetry
(
vmName
string
,
newVM
compute
.
VirtualMachine
)
error
{
return
wait
.
ExponentialBackoff
(
az
.
requestBackoff
(),
func
()
(
bool
,
error
)
{
return
wait
.
ExponentialBackoff
(
az
.
requestBackoff
(),
func
()
(
bool
,
error
)
{
respChan
,
errChan
:=
az
.
VirtualMachinesClient
.
CreateOrUpdate
(
az
.
ResourceGroup
,
vmName
,
newVM
,
nil
)
ctx
,
cancel
:=
getContextWithCancel
()
resp
:=
<-
respChan
defer
cancel
()
err
:=
<-
errChan
resp
,
err
:=
az
.
VirtualMachinesClient
.
CreateOrUpdate
(
ctx
,
az
.
ResourceGroup
,
vmName
,
newVM
)
glog
.
V
(
10
)
.
Infof
(
"VirtualMachinesClient.CreateOrUpdate(%s): end"
,
vmName
)
glog
.
V
(
10
)
.
Infof
(
"VirtualMachinesClient.CreateOrUpdate(%s): end"
,
vmName
)
return
process
RetryResponse
(
resp
.
Response
,
err
)
return
process
HTTPRetryResponse
(
resp
,
err
)
})
})
}
}
// UpdateVmssVMWithRetry invokes az.VirtualMachineScaleSetVMsClient.Update with exponential backoff retry
// UpdateVmssVMWithRetry invokes az.VirtualMachineScaleSetVMsClient.Update with exponential backoff retry
func
(
az
*
Cloud
)
UpdateVmssVMWithRetry
(
ctx
context
.
Context
,
resourceGroupName
string
,
VMScaleSetName
string
,
instanceID
string
,
parameters
compute
preview
.
VirtualMachineScaleSetVM
)
error
{
func
(
az
*
Cloud
)
UpdateVmssVMWithRetry
(
ctx
context
.
Context
,
resourceGroupName
string
,
VMScaleSetName
string
,
instanceID
string
,
parameters
compute
.
VirtualMachineScaleSetVM
)
error
{
return
wait
.
ExponentialBackoff
(
az
.
requestBackoff
(),
func
()
(
bool
,
error
)
{
return
wait
.
ExponentialBackoff
(
az
.
requestBackoff
(),
func
()
(
bool
,
error
)
{
resp
,
err
:=
az
.
VirtualMachineScaleSetVMsClient
.
Update
(
ctx
,
resourceGroupName
,
VMScaleSetName
,
instanceID
,
parameters
)
resp
,
err
:=
az
.
VirtualMachineScaleSetVMsClient
.
Update
(
ctx
,
resourceGroupName
,
VMScaleSetName
,
instanceID
,
parameters
)
glog
.
V
(
10
)
.
Infof
(
"VirtualMachinesClient.CreateOrUpdate(%s,%s): end"
,
VMScaleSetName
,
instanceID
)
glog
.
V
(
10
)
.
Infof
(
"VirtualMachinesClient.CreateOrUpdate(%s,%s): end"
,
VMScaleSetName
,
instanceID
)
...
...
pkg/cloudprovider/providers/azure/azure_blobDiskController.go
View file @
079f9b85
...
@@ -27,7 +27,7 @@ import (
...
@@ -27,7 +27,7 @@ import (
"sync/atomic"
"sync/atomic"
"time"
"time"
storage
"github.com/Azure/azure-sdk-for-go/arm
/storage"
"github.com/Azure/azure-sdk-for-go/services/storage/mgmt/2017-10-01
/storage"
azstorage
"github.com/Azure/azure-sdk-for-go/storage"
azstorage
"github.com/Azure/azure-sdk-for-go/storage"
"github.com/Azure/go-autorest/autorest/to"
"github.com/Azure/go-autorest/autorest/to"
"github.com/golang/glog"
"github.com/golang/glog"
...
@@ -277,7 +277,10 @@ func (c *BlobDiskController) getStorageAccountKey(SAName string) (string, error)
...
@@ -277,7 +277,10 @@ func (c *BlobDiskController) getStorageAccountKey(SAName string) (string, error)
if
account
,
exists
:=
c
.
accounts
[
SAName
];
exists
&&
account
.
key
!=
""
{
if
account
,
exists
:=
c
.
accounts
[
SAName
];
exists
&&
account
.
key
!=
""
{
return
c
.
accounts
[
SAName
]
.
key
,
nil
return
c
.
accounts
[
SAName
]
.
key
,
nil
}
}
listKeysResult
,
err
:=
c
.
common
.
cloud
.
StorageAccountClient
.
ListKeys
(
c
.
common
.
resourceGroup
,
SAName
)
ctx
,
cancel
:=
getContextWithCancel
()
defer
cancel
()
listKeysResult
,
err
:=
c
.
common
.
cloud
.
StorageAccountClient
.
ListKeys
(
ctx
,
c
.
common
.
resourceGroup
,
SAName
)
if
err
!=
nil
{
if
err
!=
nil
{
return
""
,
err
return
""
,
err
}
}
...
@@ -432,7 +435,9 @@ func (c *BlobDiskController) getDiskCount(SAName string) (int, error) {
...
@@ -432,7 +435,9 @@ func (c *BlobDiskController) getDiskCount(SAName string) (int, error) {
}
}
func
(
c
*
BlobDiskController
)
getAllStorageAccounts
()
(
map
[
string
]
*
storageAccountState
,
error
)
{
func
(
c
*
BlobDiskController
)
getAllStorageAccounts
()
(
map
[
string
]
*
storageAccountState
,
error
)
{
accountListResult
,
err
:=
c
.
common
.
cloud
.
StorageAccountClient
.
ListByResourceGroup
(
c
.
common
.
resourceGroup
)
ctx
,
cancel
:=
getContextWithCancel
()
defer
cancel
()
accountListResult
,
err
:=
c
.
common
.
cloud
.
StorageAccountClient
.
ListByResourceGroup
(
ctx
,
c
.
common
.
resourceGroup
)
if
err
!=
nil
{
if
err
!=
nil
{
return
nil
,
err
return
nil
,
err
}
}
...
@@ -484,12 +489,12 @@ func (c *BlobDiskController) createStorageAccount(storageAccountName string, sto
...
@@ -484,12 +489,12 @@ func (c *BlobDiskController) createStorageAccount(storageAccountName string, sto
cp
:=
storage
.
AccountCreateParameters
{
cp
:=
storage
.
AccountCreateParameters
{
Sku
:
&
storage
.
Sku
{
Name
:
storageAccountType
},
Sku
:
&
storage
.
Sku
{
Name
:
storageAccountType
},
Tags
:
&
map
[
string
]
*
string
{
"created-by"
:
to
.
StringPtr
(
"azure-dd"
)},
Tags
:
map
[
string
]
*
string
{
"created-by"
:
to
.
StringPtr
(
"azure-dd"
)},
Location
:
&
location
}
Location
:
&
location
}
cancel
:=
make
(
chan
struct
{})
ctx
,
cancel
:=
getContextWithCancel
()
defer
cancel
()
_
,
errChan
:=
c
.
common
.
cloud
.
StorageAccountClient
.
Create
(
c
.
common
.
resourceGroup
,
storageAccountName
,
cp
,
cancel
)
_
,
err
:=
c
.
common
.
cloud
.
StorageAccountClient
.
Create
(
ctx
,
c
.
common
.
resourceGroup
,
storageAccountName
,
cp
)
err
:=
<-
errChan
if
err
!=
nil
{
if
err
!=
nil
{
return
fmt
.
Errorf
(
fmt
.
Sprintf
(
"Create Storage Account: %s, error: %s"
,
storageAccountName
,
err
))
return
fmt
.
Errorf
(
fmt
.
Sprintf
(
"Create Storage Account: %s, error: %s"
,
storageAccountName
,
err
))
}
}
...
@@ -584,7 +589,9 @@ func (c *BlobDiskController) findSANameForDisk(storageAccountType storage.SkuNam
...
@@ -584,7 +589,9 @@ func (c *BlobDiskController) findSANameForDisk(storageAccountType storage.SkuNam
//Gets storage account exist, provisionStatus, Error if any
//Gets storage account exist, provisionStatus, Error if any
func
(
c
*
BlobDiskController
)
getStorageAccountState
(
storageAccountName
string
)
(
bool
,
storage
.
ProvisioningState
,
error
)
{
func
(
c
*
BlobDiskController
)
getStorageAccountState
(
storageAccountName
string
)
(
bool
,
storage
.
ProvisioningState
,
error
)
{
account
,
err
:=
c
.
common
.
cloud
.
StorageAccountClient
.
GetProperties
(
c
.
common
.
resourceGroup
,
storageAccountName
)
ctx
,
cancel
:=
getContextWithCancel
()
defer
cancel
()
account
,
err
:=
c
.
common
.
cloud
.
StorageAccountClient
.
GetProperties
(
ctx
,
c
.
common
.
resourceGroup
,
storageAccountName
)
if
err
!=
nil
{
if
err
!=
nil
{
return
false
,
""
,
err
return
false
,
""
,
err
}
}
...
...
pkg/cloudprovider/providers/azure/azure_controller_common.go
View file @
079f9b85
...
@@ -20,7 +20,7 @@ import (
...
@@ -20,7 +20,7 @@ import (
"fmt"
"fmt"
"time"
"time"
"github.com/Azure/azure-sdk-for-go/
arm
/compute"
"github.com/Azure/azure-sdk-for-go/
services/compute/mgmt/2017-12-01
/compute"
"k8s.io/apimachinery/pkg/types"
"k8s.io/apimachinery/pkg/types"
kwait
"k8s.io/apimachinery/pkg/util/wait"
kwait
"k8s.io/apimachinery/pkg/util/wait"
...
...
pkg/cloudprovider/providers/azure/azure_controller_standard.go
View file @
079f9b85
...
@@ -20,7 +20,7 @@ import (
...
@@ -20,7 +20,7 @@ import (
"fmt"
"fmt"
"strings"
"strings"
"github.com/Azure/azure-sdk-for-go/
arm
/compute"
"github.com/Azure/azure-sdk-for-go/
services/compute/mgmt/2017-12-01
/compute"
"github.com/golang/glog"
"github.com/golang/glog"
"k8s.io/apimachinery/pkg/types"
"k8s.io/apimachinery/pkg/types"
...
@@ -70,10 +70,10 @@ func (as *availabilitySet) AttachDisk(isManagedDisk bool, diskName, diskURI stri
...
@@ -70,10 +70,10 @@ func (as *availabilitySet) AttachDisk(isManagedDisk bool, diskName, diskURI stri
}
}
vmName
:=
mapNodeNameToVMName
(
nodeName
)
vmName
:=
mapNodeNameToVMName
(
nodeName
)
glog
.
V
(
2
)
.
Infof
(
"azureDisk - update(%s): vm(%s) - attach disk"
,
as
.
resourceGroup
,
vmName
)
glog
.
V
(
2
)
.
Infof
(
"azureDisk - update(%s): vm(%s) - attach disk"
,
as
.
resourceGroup
,
vmName
)
respChan
,
errChan
:=
as
.
VirtualMachinesClient
.
CreateOrUpdate
(
as
.
resourceGroup
,
vmName
,
newVM
,
nil
)
ctx
,
cancel
:=
getContextWithCancel
(
)
resp
:=
<-
respChan
defer
cancel
()
err
=
<-
errChan
resp
,
err
:=
as
.
VirtualMachinesClient
.
CreateOrUpdate
(
ctx
,
as
.
resourceGroup
,
vmName
,
newVM
)
if
as
.
CloudProviderBackoff
&&
shouldRetry
APIRequest
(
resp
.
Response
,
err
)
{
if
as
.
CloudProviderBackoff
&&
shouldRetry
HTTPRequest
(
resp
,
err
)
{
glog
.
V
(
2
)
.
Infof
(
"azureDisk - update(%s) backing off: vm(%s)"
,
as
.
resourceGroup
,
vmName
)
glog
.
V
(
2
)
.
Infof
(
"azureDisk - update(%s) backing off: vm(%s)"
,
as
.
resourceGroup
,
vmName
)
retryErr
:=
as
.
CreateOrUpdateVMWithRetry
(
vmName
,
newVM
)
retryErr
:=
as
.
CreateOrUpdateVMWithRetry
(
vmName
,
newVM
)
if
retryErr
!=
nil
{
if
retryErr
!=
nil
{
...
@@ -135,10 +135,10 @@ func (as *availabilitySet) DetachDiskByName(diskName, diskURI string, nodeName t
...
@@ -135,10 +135,10 @@ func (as *availabilitySet) DetachDiskByName(diskName, diskURI string, nodeName t
}
}
vmName
:=
mapNodeNameToVMName
(
nodeName
)
vmName
:=
mapNodeNameToVMName
(
nodeName
)
glog
.
V
(
2
)
.
Infof
(
"azureDisk - update(%s): vm(%s) - detach disk"
,
as
.
resourceGroup
,
vmName
)
glog
.
V
(
2
)
.
Infof
(
"azureDisk - update(%s): vm(%s) - detach disk"
,
as
.
resourceGroup
,
vmName
)
respChan
,
errChan
:=
as
.
VirtualMachinesClient
.
CreateOrUpdate
(
as
.
resourceGroup
,
vmName
,
newVM
,
nil
)
ctx
,
cancel
:=
getContextWithCancel
(
)
resp
:=
<-
respChan
defer
cancel
()
err
=
<-
errChan
resp
,
err
:=
as
.
VirtualMachinesClient
.
CreateOrUpdate
(
ctx
,
as
.
resourceGroup
,
vmName
,
newVM
)
if
as
.
CloudProviderBackoff
&&
shouldRetry
APIRequest
(
resp
.
Response
,
err
)
{
if
as
.
CloudProviderBackoff
&&
shouldRetry
HTTPRequest
(
resp
,
err
)
{
glog
.
V
(
2
)
.
Infof
(
"azureDisk - update(%s) backing off: vm(%s)"
,
as
.
resourceGroup
,
vmName
)
glog
.
V
(
2
)
.
Infof
(
"azureDisk - update(%s) backing off: vm(%s)"
,
as
.
resourceGroup
,
vmName
)
retryErr
:=
as
.
CreateOrUpdateVMWithRetry
(
vmName
,
newVM
)
retryErr
:=
as
.
CreateOrUpdateVMWithRetry
(
vmName
,
newVM
)
if
retryErr
!=
nil
{
if
retryErr
!=
nil
{
...
...
pkg/cloudprovider/providers/azure/azure_controller_vmss.go
View file @
079f9b85
...
@@ -20,8 +20,7 @@ import (
...
@@ -20,8 +20,7 @@ import (
"fmt"
"fmt"
"strings"
"strings"
"github.com/Azure/azure-sdk-for-go/arm/compute"
"github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2017-12-01/compute"
computepreview
"github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2017-12-01/compute"
"github.com/golang/glog"
"github.com/golang/glog"
"k8s.io/apimachinery/pkg/types"
"k8s.io/apimachinery/pkg/types"
...
@@ -39,24 +38,24 @@ func (ss *scaleSet) AttachDisk(isManagedDisk bool, diskName, diskURI string, nod
...
@@ -39,24 +38,24 @@ func (ss *scaleSet) AttachDisk(isManagedDisk bool, diskName, diskURI string, nod
disks
:=
*
vm
.
StorageProfile
.
DataDisks
disks
:=
*
vm
.
StorageProfile
.
DataDisks
if
isManagedDisk
{
if
isManagedDisk
{
disks
=
append
(
disks
,
disks
=
append
(
disks
,
compute
preview
.
DataDisk
{
compute
.
DataDisk
{
Name
:
&
diskName
,
Name
:
&
diskName
,
Lun
:
&
lun
,
Lun
:
&
lun
,
Caching
:
compute
preview
.
CachingTypes
(
cachingMode
),
Caching
:
compute
.
CachingTypes
(
cachingMode
),
CreateOption
:
"attach"
,
CreateOption
:
"attach"
,
ManagedDisk
:
&
compute
preview
.
ManagedDiskParameters
{
ManagedDisk
:
&
compute
.
ManagedDiskParameters
{
ID
:
&
diskURI
,
ID
:
&
diskURI
,
},
},
})
})
}
else
{
}
else
{
disks
=
append
(
disks
,
disks
=
append
(
disks
,
compute
preview
.
DataDisk
{
compute
.
DataDisk
{
Name
:
&
diskName
,
Name
:
&
diskName
,
Vhd
:
&
compute
preview
.
VirtualHardDisk
{
Vhd
:
&
compute
.
VirtualHardDisk
{
URI
:
&
diskURI
,
URI
:
&
diskURI
,
},
},
Lun
:
&
lun
,
Lun
:
&
lun
,
Caching
:
compute
preview
.
CachingTypes
(
cachingMode
),
Caching
:
compute
.
CachingTypes
(
cachingMode
),
CreateOption
:
"attach"
,
CreateOption
:
"attach"
,
})
})
}
}
...
...
pkg/cloudprovider/providers/azure/azure_fakes.go
View file @
079f9b85
This diff is collapsed.
Click to expand it.
pkg/cloudprovider/providers/azure/azure_loadbalancer.go
View file @
079f9b85
...
@@ -438,7 +438,7 @@ func (az *Cloud) ensurePublicIPExists(service *v1.Service, pipName string, domai
...
@@ -438,7 +438,7 @@ func (az *Cloud) ensurePublicIPExists(service *v1.Service, pipName string, domai
DomainNameLabel
:
&
domainNameLabel
,
DomainNameLabel
:
&
domainNameLabel
,
}
}
}
}
pip
.
Tags
=
&
map
[
string
]
*
string
{
"service"
:
&
serviceName
}
pip
.
Tags
=
map
[
string
]
*
string
{
"service"
:
&
serviceName
}
if
az
.
useStandardLoadBalancer
()
{
if
az
.
useStandardLoadBalancer
()
{
pip
.
Sku
=
&
network
.
PublicIPAddressSku
{
pip
.
Sku
=
&
network
.
PublicIPAddressSku
{
Name
:
network
.
PublicIPAddressSkuNameStandard
,
Name
:
network
.
PublicIPAddressSkuNameStandard
,
...
@@ -1202,8 +1202,8 @@ func (az *Cloud) reconcilePublicIP(clusterName string, service *v1.Service, want
...
@@ -1202,8 +1202,8 @@ func (az *Cloud) reconcilePublicIP(clusterName string, service *v1.Service, want
for
_
,
pip
:=
range
pips
{
for
_
,
pip
:=
range
pips
{
if
pip
.
Tags
!=
nil
&&
if
pip
.
Tags
!=
nil
&&
(
*
pip
.
Tags
)[
"service"
]
!=
nil
&&
(
pip
.
Tags
)[
"service"
]
!=
nil
&&
*
(
*
pip
.
Tags
)[
"service"
]
==
serviceName
{
*
(
pip
.
Tags
)[
"service"
]
==
serviceName
{
// We need to process for pips belong to this service
// We need to process for pips belong to this service
pipName
:=
*
pip
.
Name
pipName
:=
*
pip
.
Name
if
wantLb
&&
!
isInternal
&&
pipName
==
desiredPipName
{
if
wantLb
&&
!
isInternal
&&
pipName
==
desiredPipName
{
...
...
pkg/cloudprovider/providers/azure/azure_managedDiskController.go
View file @
079f9b85
...
@@ -20,8 +20,8 @@ import (
...
@@ -20,8 +20,8 @@ import (
"path"
"path"
"strings"
"strings"
"github.com/Azure/azure-sdk-for-go/
arm/disk
"
"github.com/Azure/azure-sdk-for-go/
services/compute/mgmt/2017-12-01/compute
"
storage
"github.com/Azure/azure-sdk-for-go/arm
/storage"
"github.com/Azure/azure-sdk-for-go/services/storage/mgmt/2017-10-01
/storage"
"github.com/golang/glog"
"github.com/golang/glog"
kwait
"k8s.io/apimachinery/pkg/util/wait"
kwait
"k8s.io/apimachinery/pkg/util/wait"
)
)
...
@@ -54,18 +54,19 @@ func (c *ManagedDiskController) CreateManagedDisk(diskName string, storageAccoun
...
@@ -54,18 +54,19 @@ func (c *ManagedDiskController) CreateManagedDisk(diskName string, storageAccoun
}
}
diskSizeGB
:=
int32
(
sizeGB
)
diskSizeGB
:=
int32
(
sizeGB
)
model
:=
disk
.
Model
{
model
:=
compute
.
Disk
{
Location
:
&
c
.
common
.
location
,
Location
:
&
c
.
common
.
location
,
Tags
:
&
newTags
,
Tags
:
newTags
,
Properties
:
&
disk
.
Properties
{
Sku
:
&
compute
.
DiskSku
{
AccountType
:
disk
.
StorageAccountTypes
(
storageAccountType
),
Name
:
compute
.
StorageAccountTypes
(
storageAccountType
),
},
DiskProperties
:
&
compute
.
DiskProperties
{
DiskSizeGB
:
&
diskSizeGB
,
DiskSizeGB
:
&
diskSizeGB
,
CreationData
:
&
disk
.
CreationData
{
CreateOption
:
disk
.
Empty
},
CreationData
:
&
compute
.
CreationData
{
CreateOption
:
compute
.
Empty
},
}}
}}
cancel
:=
make
(
chan
struct
{})
ctx
,
cancel
:=
getContextWithCancel
()
respChan
,
errChan
:=
c
.
common
.
cloud
.
DisksClient
.
CreateOrUpdate
(
c
.
common
.
resourceGroup
,
diskName
,
model
,
cancel
)
defer
cancel
()
<-
respChan
_
,
err
:=
c
.
common
.
cloud
.
DisksClient
.
CreateOrUpdate
(
ctx
,
c
.
common
.
resourceGroup
,
diskName
,
model
)
err
:=
<-
errChan
if
err
!=
nil
{
if
err
!=
nil
{
return
""
,
err
return
""
,
err
}
}
...
@@ -99,10 +100,10 @@ func (c *ManagedDiskController) CreateManagedDisk(diskName string, storageAccoun
...
@@ -99,10 +100,10 @@ func (c *ManagedDiskController) CreateManagedDisk(diskName string, storageAccoun
//DeleteManagedDisk : delete managed disk
//DeleteManagedDisk : delete managed disk
func
(
c
*
ManagedDiskController
)
DeleteManagedDisk
(
diskURI
string
)
error
{
func
(
c
*
ManagedDiskController
)
DeleteManagedDisk
(
diskURI
string
)
error
{
diskName
:=
path
.
Base
(
diskURI
)
diskName
:=
path
.
Base
(
diskURI
)
c
ancel
:=
make
(
chan
struct
{}
)
c
tx
,
cancel
:=
getContextWithCancel
(
)
respChan
,
errChan
:=
c
.
common
.
cloud
.
DisksClient
.
Delete
(
c
.
common
.
resourceGroup
,
diskName
,
cancel
)
defer
cancel
(
)
<-
respChan
err
:=
<-
errChan
_
,
err
:=
c
.
common
.
cloud
.
DisksClient
.
Delete
(
ctx
,
c
.
common
.
resourceGroup
,
diskName
)
if
err
!=
nil
{
if
err
!=
nil
{
return
err
return
err
}
}
...
@@ -116,13 +117,16 @@ func (c *ManagedDiskController) DeleteManagedDisk(diskURI string) error {
...
@@ -116,13 +117,16 @@ func (c *ManagedDiskController) DeleteManagedDisk(diskURI string) error {
// return: disk provisionState, diskID, error
// return: disk provisionState, diskID, error
func
(
c
*
ManagedDiskController
)
getDisk
(
diskName
string
)
(
string
,
string
,
error
)
{
func
(
c
*
ManagedDiskController
)
getDisk
(
diskName
string
)
(
string
,
string
,
error
)
{
result
,
err
:=
c
.
common
.
cloud
.
DisksClient
.
Get
(
c
.
common
.
resourceGroup
,
diskName
)
ctx
,
cancel
:=
getContextWithCancel
()
defer
cancel
()
result
,
err
:=
c
.
common
.
cloud
.
DisksClient
.
Get
(
ctx
,
c
.
common
.
resourceGroup
,
diskName
)
if
err
!=
nil
{
if
err
!=
nil
{
return
""
,
""
,
err
return
""
,
""
,
err
}
}
if
result
.
Properties
!=
nil
&&
(
*
result
.
Properties
)
.
ProvisioningState
!=
nil
{
if
result
.
DiskProperties
!=
nil
&&
(
*
result
.
Disk
Properties
)
.
ProvisioningState
!=
nil
{
return
*
(
*
result
.
Properties
)
.
ProvisioningState
,
*
result
.
ID
,
nil
return
*
(
*
result
.
Disk
Properties
)
.
ProvisioningState
,
*
result
.
ID
,
nil
}
}
return
""
,
""
,
err
return
""
,
""
,
err
...
...
pkg/cloudprovider/providers/azure/azure_standard.go
View file @
079f9b85
...
@@ -28,7 +28,7 @@ import (
...
@@ -28,7 +28,7 @@ import (
"k8s.io/api/core/v1"
"k8s.io/api/core/v1"
"k8s.io/kubernetes/pkg/cloudprovider"
"k8s.io/kubernetes/pkg/cloudprovider"
"github.com/Azure/azure-sdk-for-go/
arm
/compute"
"github.com/Azure/azure-sdk-for-go/
services/compute/mgmt/2017-12-01
/compute"
"github.com/Azure/azure-sdk-for-go/services/network/mgmt/2017-09-01/network"
"github.com/Azure/azure-sdk-for-go/services/network/mgmt/2017-09-01/network"
"github.com/Azure/go-autorest/autorest/to"
"github.com/Azure/go-autorest/autorest/to"
"github.com/golang/glog"
"github.com/golang/glog"
...
...
pkg/cloudprovider/providers/azure/azure_storage.go
View file @
079f9b85
...
@@ -19,7 +19,7 @@ package azure
...
@@ -19,7 +19,7 @@ package azure
import
(
import
(
"fmt"
"fmt"
"github.com/Azure/azure-sdk-for-go/
arm
/storage"
"github.com/Azure/azure-sdk-for-go/
services/storage/mgmt/2017-10-01
/storage"
"github.com/golang/glog"
"github.com/golang/glog"
)
)
...
...
pkg/cloudprovider/providers/azure/azure_storage_test.go
View file @
079f9b85
...
@@ -19,7 +19,7 @@ package azure
...
@@ -19,7 +19,7 @@ package azure
import
(
import
(
"testing"
"testing"
"github.com/Azure/azure-sdk-for-go/
arm
/storage"
"github.com/Azure/azure-sdk-for-go/
services/storage/mgmt/2017-10-01
/storage"
)
)
func
TestCreateFileShare
(
t
*
testing
.
T
)
{
func
TestCreateFileShare
(
t
*
testing
.
T
)
{
...
...
pkg/cloudprovider/providers/azure/azure_storageaccount.go
View file @
079f9b85
...
@@ -20,7 +20,7 @@ import (
...
@@ -20,7 +20,7 @@ import (
"fmt"
"fmt"
"strings"
"strings"
"github.com/Azure/azure-sdk-for-go/
arm
/storage"
"github.com/Azure/azure-sdk-for-go/
services/storage/mgmt/2017-10-01
/storage"
"github.com/Azure/go-autorest/autorest/to"
"github.com/Azure/go-autorest/autorest/to"
"github.com/golang/glog"
"github.com/golang/glog"
)
)
...
@@ -31,7 +31,9 @@ type accountWithLocation struct {
...
@@ -31,7 +31,9 @@ type accountWithLocation struct {
// getStorageAccounts gets name, type, location of all storage accounts in a resource group which matches matchingAccountType, matchingLocation
// getStorageAccounts gets name, type, location of all storage accounts in a resource group which matches matchingAccountType, matchingLocation
func
(
az
*
Cloud
)
getStorageAccounts
(
matchingAccountType
,
matchingLocation
string
)
([]
accountWithLocation
,
error
)
{
func
(
az
*
Cloud
)
getStorageAccounts
(
matchingAccountType
,
matchingLocation
string
)
([]
accountWithLocation
,
error
)
{
result
,
err
:=
az
.
StorageAccountClient
.
ListByResourceGroup
(
az
.
ResourceGroup
)
ctx
,
cancel
:=
getContextWithCancel
()
defer
cancel
()
result
,
err
:=
az
.
StorageAccountClient
.
ListByResourceGroup
(
ctx
,
az
.
ResourceGroup
)
if
err
!=
nil
{
if
err
!=
nil
{
return
nil
,
err
return
nil
,
err
}
}
...
@@ -60,7 +62,10 @@ func (az *Cloud) getStorageAccounts(matchingAccountType, matchingLocation string
...
@@ -60,7 +62,10 @@ func (az *Cloud) getStorageAccounts(matchingAccountType, matchingLocation string
// getStorageAccesskey gets the storage account access key
// getStorageAccesskey gets the storage account access key
func
(
az
*
Cloud
)
getStorageAccesskey
(
account
string
)
(
string
,
error
)
{
func
(
az
*
Cloud
)
getStorageAccesskey
(
account
string
)
(
string
,
error
)
{
result
,
err
:=
az
.
StorageAccountClient
.
ListKeys
(
az
.
ResourceGroup
,
account
)
ctx
,
cancel
:=
getContextWithCancel
()
defer
cancel
()
result
,
err
:=
az
.
StorageAccountClient
.
ListKeys
(
ctx
,
az
.
ResourceGroup
,
account
)
if
err
!=
nil
{
if
err
!=
nil
{
return
""
,
err
return
""
,
err
}
}
...
@@ -108,12 +113,12 @@ func (az *Cloud) ensureStorageAccount(accountName, accountType, location, genAcc
...
@@ -108,12 +113,12 @@ func (az *Cloud) ensureStorageAccount(accountName, accountType, location, genAcc
accountName
,
az
.
ResourceGroup
,
location
,
accountType
)
accountName
,
az
.
ResourceGroup
,
location
,
accountType
)
cp
:=
storage
.
AccountCreateParameters
{
cp
:=
storage
.
AccountCreateParameters
{
Sku
:
&
storage
.
Sku
{
Name
:
storage
.
SkuName
(
accountType
)},
Sku
:
&
storage
.
Sku
{
Name
:
storage
.
SkuName
(
accountType
)},
Tags
:
&
map
[
string
]
*
string
{
"created-by"
:
to
.
StringPtr
(
"azure"
)},
Tags
:
map
[
string
]
*
string
{
"created-by"
:
to
.
StringPtr
(
"azure"
)},
Location
:
&
location
}
Location
:
&
location
}
cancel
:=
make
(
chan
struct
{})
_
,
errchan
:=
az
.
StorageAccountClient
.
Create
(
az
.
ResourceGroup
,
accountName
,
cp
,
cancel
)
ctx
,
cancel
:=
getContextWithCancel
()
err
:=
<-
errchan
defer
cancel
()
_
,
err
:=
az
.
StorageAccountClient
.
Create
(
ctx
,
az
.
ResourceGroup
,
accountName
,
cp
)
if
err
!=
nil
{
if
err
!=
nil
{
return
""
,
""
,
fmt
.
Errorf
(
fmt
.
Sprintf
(
"Failed to create storage account %s, error: %s"
,
accountName
,
err
))
return
""
,
""
,
fmt
.
Errorf
(
fmt
.
Sprintf
(
"Failed to create storage account %s, error: %s"
,
accountName
,
err
))
}
}
...
...
pkg/cloudprovider/providers/azure/azure_storageaccount_test.go
View file @
079f9b85
...
@@ -20,7 +20,7 @@ import (
...
@@ -20,7 +20,7 @@ import (
"fmt"
"fmt"
"testing"
"testing"
"github.com/Azure/azure-sdk-for-go/
arm
/storage"
"github.com/Azure/azure-sdk-for-go/
services/storage/mgmt/2017-10-01
/storage"
)
)
func
TestGetStorageAccessKeys
(
t
*
testing
.
T
)
{
func
TestGetStorageAccessKeys
(
t
*
testing
.
T
)
{
...
...
pkg/cloudprovider/providers/azure/azure_test.go
View file @
079f9b85
...
@@ -35,7 +35,7 @@ import (
...
@@ -35,7 +35,7 @@ import (
"k8s.io/kubernetes/pkg/cloudprovider/providers/azure/auth"
"k8s.io/kubernetes/pkg/cloudprovider/providers/azure/auth"
kubeletapis
"k8s.io/kubernetes/pkg/kubelet/apis"
kubeletapis
"k8s.io/kubernetes/pkg/kubelet/apis"
"github.com/Azure/azure-sdk-for-go/
arm
/compute"
"github.com/Azure/azure-sdk-for-go/
services/compute/mgmt/2017-12-01
/compute"
"github.com/Azure/azure-sdk-for-go/services/network/mgmt/2017-09-01/network"
"github.com/Azure/azure-sdk-for-go/services/network/mgmt/2017-09-01/network"
"github.com/Azure/go-autorest/autorest/to"
"github.com/Azure/go-autorest/autorest/to"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/assert"
...
@@ -1067,8 +1067,10 @@ func getClusterResources(az *Cloud, vmCount int, availabilitySetCount int) (clus
...
@@ -1067,8 +1067,10 @@ func getClusterResources(az *Cloud, vmCount int, availabilitySetCount int) (clus
},
},
}
}
_
,
errChan
:=
az
.
VirtualMachinesClient
.
CreateOrUpdate
(
az
.
Config
.
ResourceGroup
,
vmName
,
newVM
,
nil
)
ctx
,
cancel
:=
getContextWithCancel
()
if
err
:=
<-
errChan
;
err
!=
nil
{
defer
cancel
()
_
,
err
:=
az
.
VirtualMachinesClient
.
CreateOrUpdate
(
ctx
,
az
.
Config
.
ResourceGroup
,
vmName
,
newVM
)
if
err
!=
nil
{
}
}
// add to kubernetes
// add to kubernetes
newNode
:=
&
v1
.
Node
{
newNode
:=
&
v1
.
Node
{
...
@@ -1314,12 +1316,12 @@ func validatePublicIP(t *testing.T, publicIP *network.PublicIPAddress, service *
...
@@ -1314,12 +1316,12 @@ func validatePublicIP(t *testing.T, publicIP *network.PublicIPAddress, service *
t
.
Errorf
(
"Expected publicIP resource exists, when it is not an internal service"
)
t
.
Errorf
(
"Expected publicIP resource exists, when it is not an internal service"
)
}
}
if
publicIP
.
Tags
==
nil
||
(
*
publicIP
.
Tags
)
[
"service"
]
==
nil
{
if
publicIP
.
Tags
==
nil
||
publicIP
.
Tags
[
"service"
]
==
nil
{
t
.
Errorf
(
"Expected publicIP resource has tags[service]"
)
t
.
Errorf
(
"Expected publicIP resource has tags[service]"
)
}
}
serviceName
:=
getServiceName
(
service
)
serviceName
:=
getServiceName
(
service
)
if
serviceName
!=
*
(
*
publicIP
.
Tags
)[
"service"
]
{
if
serviceName
!=
*
(
publicIP
.
Tags
[
"service"
])
{
t
.
Errorf
(
"Expected publicIP resource has matching tags[service]"
)
t
.
Errorf
(
"Expected publicIP resource has matching tags[service]"
)
}
}
// We cannot use service.Spec.LoadBalancerIP to compare with
// We cannot use service.Spec.LoadBalancerIP to compare with
...
...
pkg/cloudprovider/providers/azure/azure_vmsets.go
View file @
079f9b85
...
@@ -17,7 +17,7 @@ limitations under the License.
...
@@ -17,7 +17,7 @@ limitations under the License.
package
azure
package
azure
import
(
import
(
"github.com/Azure/azure-sdk-for-go/
arm
/compute"
"github.com/Azure/azure-sdk-for-go/
services/compute/mgmt/2017-12-01
/compute"
"github.com/Azure/azure-sdk-for-go/services/network/mgmt/2017-09-01/network"
"github.com/Azure/azure-sdk-for-go/services/network/mgmt/2017-09-01/network"
"k8s.io/api/core/v1"
"k8s.io/api/core/v1"
...
...
pkg/cloudprovider/providers/azure/azure_vmss.go
View file @
079f9b85
...
@@ -24,7 +24,7 @@ import (
...
@@ -24,7 +24,7 @@ import (
"strconv"
"strconv"
"strings"
"strings"
computepreview
"github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2017-12-01/compute"
"github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2017-12-01/compute"
"github.com/Azure/azure-sdk-for-go/services/network/mgmt/2017-09-01/network"
"github.com/Azure/azure-sdk-for-go/services/network/mgmt/2017-09-01/network"
"github.com/Azure/go-autorest/autorest/to"
"github.com/Azure/go-autorest/autorest/to"
"github.com/golang/glog"
"github.com/golang/glog"
...
@@ -91,7 +91,7 @@ func newScaleSet(az *Cloud) (VMSet, error) {
...
@@ -91,7 +91,7 @@ func newScaleSet(az *Cloud) (VMSet, error) {
// getVmssVM gets virtualMachineScaleSetVM by nodeName from cache.
// getVmssVM gets virtualMachineScaleSetVM by nodeName from cache.
// It returns cloudprovider.InstanceNotFound if node does not belong to any scale sets.
// It returns cloudprovider.InstanceNotFound if node does not belong to any scale sets.
func
(
ss
*
scaleSet
)
getVmssVM
(
nodeName
string
)
(
ssName
,
instanceID
string
,
vm
compute
preview
.
VirtualMachineScaleSetVM
,
err
error
)
{
func
(
ss
*
scaleSet
)
getVmssVM
(
nodeName
string
)
(
ssName
,
instanceID
string
,
vm
compute
.
VirtualMachineScaleSetVM
,
err
error
)
{
instanceID
,
err
=
getScaleSetVMInstanceID
(
nodeName
)
instanceID
,
err
=
getScaleSetVMInstanceID
(
nodeName
)
if
err
!=
nil
{
if
err
!=
nil
{
return
ssName
,
instanceID
,
vm
,
err
return
ssName
,
instanceID
,
vm
,
err
...
@@ -117,12 +117,12 @@ func (ss *scaleSet) getVmssVM(nodeName string) (ssName, instanceID string, vm co
...
@@ -117,12 +117,12 @@ func (ss *scaleSet) getVmssVM(nodeName string) (ssName, instanceID string, vm co
return
ssName
,
instanceID
,
vm
,
cloudprovider
.
InstanceNotFound
return
ssName
,
instanceID
,
vm
,
cloudprovider
.
InstanceNotFound
}
}
return
ssName
,
instanceID
,
*
(
cachedVM
.
(
*
compute
preview
.
VirtualMachineScaleSetVM
)),
nil
return
ssName
,
instanceID
,
*
(
cachedVM
.
(
*
compute
.
VirtualMachineScaleSetVM
)),
nil
}
}
// getCachedVirtualMachineByInstanceID gets scaleSetVMInfo from cache.
// getCachedVirtualMachineByInstanceID gets scaleSetVMInfo from cache.
// The node must belong to one of scale sets.
// The node must belong to one of scale sets.
func
(
ss
*
scaleSet
)
getVmssVMByInstanceID
(
scaleSetName
,
instanceID
string
)
(
vm
compute
preview
.
VirtualMachineScaleSetVM
,
err
error
)
{
func
(
ss
*
scaleSet
)
getVmssVMByInstanceID
(
scaleSetName
,
instanceID
string
)
(
vm
compute
.
VirtualMachineScaleSetVM
,
err
error
)
{
vmName
:=
ss
.
makeVmssVMName
(
scaleSetName
,
instanceID
)
vmName
:=
ss
.
makeVmssVMName
(
scaleSetName
,
instanceID
)
cachedVM
,
err
:=
ss
.
vmssVMCache
.
Get
(
vmName
)
cachedVM
,
err
:=
ss
.
vmssVMCache
.
Get
(
vmName
)
if
err
!=
nil
{
if
err
!=
nil
{
...
@@ -134,7 +134,7 @@ func (ss *scaleSet) getVmssVMByInstanceID(scaleSetName, instanceID string) (vm c
...
@@ -134,7 +134,7 @@ func (ss *scaleSet) getVmssVMByInstanceID(scaleSetName, instanceID string) (vm c
return
vm
,
cloudprovider
.
InstanceNotFound
return
vm
,
cloudprovider
.
InstanceNotFound
}
}
return
*
(
cachedVM
.
(
*
compute
preview
.
VirtualMachineScaleSetVM
)),
nil
return
*
(
cachedVM
.
(
*
compute
.
VirtualMachineScaleSetVM
)),
nil
}
}
// GetInstanceIDByNodeName gets the cloud provider ID by node name.
// GetInstanceIDByNodeName gets the cloud provider ID by node name.
...
@@ -265,7 +265,7 @@ func (ss *scaleSet) GetIPByNodeName(nodeName, vmSetName string) (string, string,
...
@@ -265,7 +265,7 @@ func (ss *scaleSet) GetIPByNodeName(nodeName, vmSetName string) (string, string,
}
}
// This returns the full identifier of the primary NIC for the given VM.
// This returns the full identifier of the primary NIC for the given VM.
func
(
ss
*
scaleSet
)
getPrimaryInterfaceID
(
machine
compute
preview
.
VirtualMachineScaleSetVM
)
(
string
,
error
)
{
func
(
ss
*
scaleSet
)
getPrimaryInterfaceID
(
machine
compute
.
VirtualMachineScaleSetVM
)
(
string
,
error
)
{
if
len
(
*
machine
.
NetworkProfile
.
NetworkInterfaces
)
==
1
{
if
len
(
*
machine
.
NetworkProfile
.
NetworkInterfaces
)
==
1
{
return
*
(
*
machine
.
NetworkProfile
.
NetworkInterfaces
)[
0
]
.
ID
,
nil
return
*
(
*
machine
.
NetworkProfile
.
NetworkInterfaces
)[
0
]
.
ID
,
nil
}
}
...
@@ -327,12 +327,12 @@ func (ss *scaleSet) listScaleSets() ([]string, error) {
...
@@ -327,12 +327,12 @@ func (ss *scaleSet) listScaleSets() ([]string, error) {
}
}
// listScaleSetVMs lists VMs belonging to the specified scale set.
// listScaleSetVMs lists VMs belonging to the specified scale set.
func
(
ss
*
scaleSet
)
listScaleSetVMs
(
scaleSetName
string
)
([]
compute
preview
.
VirtualMachineScaleSetVM
,
error
)
{
func
(
ss
*
scaleSet
)
listScaleSetVMs
(
scaleSetName
string
)
([]
compute
.
VirtualMachineScaleSetVM
,
error
)
{
var
err
error
var
err
error
ctx
,
cancel
:=
getContextWithCancel
()
ctx
,
cancel
:=
getContextWithCancel
()
defer
cancel
()
defer
cancel
()
allVMs
,
err
:=
ss
.
VirtualMachineScaleSetVMsClient
.
List
(
ctx
,
ss
.
ResourceGroup
,
scaleSetName
,
""
,
""
,
string
(
compute
preview
.
InstanceView
))
allVMs
,
err
:=
ss
.
VirtualMachineScaleSetVMsClient
.
List
(
ctx
,
ss
.
ResourceGroup
,
scaleSetName
,
""
,
""
,
string
(
compute
.
InstanceView
))
if
err
!=
nil
{
if
err
!=
nil
{
glog
.
Errorf
(
"VirtualMachineScaleSetVMsClient.List failed: %v"
,
err
)
glog
.
Errorf
(
"VirtualMachineScaleSetVMsClient.List failed: %v"
,
err
)
return
nil
,
err
return
nil
,
err
...
@@ -469,8 +469,8 @@ func (ss *scaleSet) GetPrimaryInterface(nodeName, vmSetName string) (network.Int
...
@@ -469,8 +469,8 @@ func (ss *scaleSet) GetPrimaryInterface(nodeName, vmSetName string) (network.Int
}
}
// getScaleSetWithRetry gets scale set with exponential backoff retry
// getScaleSetWithRetry gets scale set with exponential backoff retry
func
(
ss
*
scaleSet
)
getScaleSetWithRetry
(
name
string
)
(
compute
preview
.
VirtualMachineScaleSet
,
bool
,
error
)
{
func
(
ss
*
scaleSet
)
getScaleSetWithRetry
(
name
string
)
(
compute
.
VirtualMachineScaleSet
,
bool
,
error
)
{
var
result
compute
preview
.
VirtualMachineScaleSet
var
result
compute
.
VirtualMachineScaleSet
var
exists
bool
var
exists
bool
err
:=
wait
.
ExponentialBackoff
(
ss
.
requestBackoff
(),
func
()
(
bool
,
error
)
{
err
:=
wait
.
ExponentialBackoff
(
ss
.
requestBackoff
(),
func
()
(
bool
,
error
)
{
...
@@ -483,7 +483,7 @@ func (ss *scaleSet) getScaleSetWithRetry(name string) (computepreview.VirtualMac
...
@@ -483,7 +483,7 @@ func (ss *scaleSet) getScaleSetWithRetry(name string) (computepreview.VirtualMac
if
cached
!=
nil
{
if
cached
!=
nil
{
exists
=
true
exists
=
true
result
=
*
(
cached
.
(
*
compute
preview
.
VirtualMachineScaleSet
))
result
=
*
(
cached
.
(
*
compute
.
VirtualMachineScaleSet
))
}
}
return
true
,
nil
return
true
,
nil
...
@@ -493,7 +493,7 @@ func (ss *scaleSet) getScaleSetWithRetry(name string) (computepreview.VirtualMac
...
@@ -493,7 +493,7 @@ func (ss *scaleSet) getScaleSetWithRetry(name string) (computepreview.VirtualMac
}
}
// getPrimaryNetworkConfiguration gets primary network interface configuration for scale sets.
// getPrimaryNetworkConfiguration gets primary network interface configuration for scale sets.
func
(
ss
*
scaleSet
)
getPrimaryNetworkConfiguration
(
networkConfigurationList
*
[]
compute
preview
.
VirtualMachineScaleSetNetworkConfiguration
,
scaleSetName
string
)
(
*
computepreview
.
VirtualMachineScaleSetNetworkConfiguration
,
error
)
{
func
(
ss
*
scaleSet
)
getPrimaryNetworkConfiguration
(
networkConfigurationList
*
[]
compute
.
VirtualMachineScaleSetNetworkConfiguration
,
scaleSetName
string
)
(
*
compute
.
VirtualMachineScaleSetNetworkConfiguration
,
error
)
{
networkConfigurations
:=
*
networkConfigurationList
networkConfigurations
:=
*
networkConfigurationList
if
len
(
networkConfigurations
)
==
1
{
if
len
(
networkConfigurations
)
==
1
{
return
&
networkConfigurations
[
0
],
nil
return
&
networkConfigurations
[
0
],
nil
...
@@ -509,7 +509,7 @@ func (ss *scaleSet) getPrimaryNetworkConfiguration(networkConfigurationList *[]c
...
@@ -509,7 +509,7 @@ func (ss *scaleSet) getPrimaryNetworkConfiguration(networkConfigurationList *[]c
return
nil
,
fmt
.
Errorf
(
"failed to find a primary network configuration for the scale set %q"
,
scaleSetName
)
return
nil
,
fmt
.
Errorf
(
"failed to find a primary network configuration for the scale set %q"
,
scaleSetName
)
}
}
func
(
ss
*
scaleSet
)
getPrimaryIPConfigForScaleSet
(
config
*
compute
preview
.
VirtualMachineScaleSetNetworkConfiguration
,
scaleSetName
string
)
(
*
computepreview
.
VirtualMachineScaleSetIPConfiguration
,
error
)
{
func
(
ss
*
scaleSet
)
getPrimaryIPConfigForScaleSet
(
config
*
compute
.
VirtualMachineScaleSetNetworkConfiguration
,
scaleSetName
string
)
(
*
compute
.
VirtualMachineScaleSetIPConfiguration
,
error
)
{
ipConfigurations
:=
*
config
.
IPConfigurations
ipConfigurations
:=
*
config
.
IPConfigurations
if
len
(
ipConfigurations
)
==
1
{
if
len
(
ipConfigurations
)
==
1
{
return
&
ipConfigurations
[
0
],
nil
return
&
ipConfigurations
[
0
],
nil
...
@@ -526,7 +526,7 @@ func (ss *scaleSet) getPrimaryIPConfigForScaleSet(config *computepreview.Virtual
...
@@ -526,7 +526,7 @@ func (ss *scaleSet) getPrimaryIPConfigForScaleSet(config *computepreview.Virtual
}
}
// createOrUpdateVMSSWithRetry invokes ss.VirtualMachineScaleSetsClient.CreateOrUpdate with exponential backoff retry.
// createOrUpdateVMSSWithRetry invokes ss.VirtualMachineScaleSetsClient.CreateOrUpdate with exponential backoff retry.
func
(
ss
*
scaleSet
)
createOrUpdateVMSSWithRetry
(
virtualMachineScaleSet
compute
preview
.
VirtualMachineScaleSet
)
error
{
func
(
ss
*
scaleSet
)
createOrUpdateVMSSWithRetry
(
virtualMachineScaleSet
compute
.
VirtualMachineScaleSet
)
error
{
return
wait
.
ExponentialBackoff
(
ss
.
requestBackoff
(),
func
()
(
bool
,
error
)
{
return
wait
.
ExponentialBackoff
(
ss
.
requestBackoff
(),
func
()
(
bool
,
error
)
{
ctx
,
cancel
:=
getContextWithCancel
()
ctx
,
cancel
:=
getContextWithCancel
()
defer
cancel
()
defer
cancel
()
...
@@ -537,7 +537,7 @@ func (ss *scaleSet) createOrUpdateVMSSWithRetry(virtualMachineScaleSet computepr
...
@@ -537,7 +537,7 @@ func (ss *scaleSet) createOrUpdateVMSSWithRetry(virtualMachineScaleSet computepr
}
}
// updateVMSSInstancesWithRetry invokes ss.VirtualMachineScaleSetsClient.UpdateInstances with exponential backoff retry.
// updateVMSSInstancesWithRetry invokes ss.VirtualMachineScaleSetsClient.UpdateInstances with exponential backoff retry.
func
(
ss
*
scaleSet
)
updateVMSSInstancesWithRetry
(
scaleSetName
string
,
vmInstanceIDs
compute
preview
.
VirtualMachineScaleSetVMInstanceRequiredIDs
)
error
{
func
(
ss
*
scaleSet
)
updateVMSSInstancesWithRetry
(
scaleSetName
string
,
vmInstanceIDs
compute
.
VirtualMachineScaleSetVMInstanceRequiredIDs
)
error
{
return
wait
.
ExponentialBackoff
(
ss
.
requestBackoff
(),
func
()
(
bool
,
error
)
{
return
wait
.
ExponentialBackoff
(
ss
.
requestBackoff
(),
func
()
(
bool
,
error
)
{
ctx
,
cancel
:=
getContextWithCancel
()
ctx
,
cancel
:=
getContextWithCancel
()
defer
cancel
()
defer
cancel
()
...
@@ -611,7 +611,7 @@ func (ss *scaleSet) ensureHostsInVMSetPool(serviceName string, backendPoolID str
...
@@ -611,7 +611,7 @@ func (ss *scaleSet) ensureHostsInVMSetPool(serviceName string, backendPoolID str
// Update primary IP configuration's LoadBalancerBackendAddressPools.
// Update primary IP configuration's LoadBalancerBackendAddressPools.
foundPool
:=
false
foundPool
:=
false
newBackendPools
:=
[]
compute
preview
.
SubResource
{}
newBackendPools
:=
[]
compute
.
SubResource
{}
if
primaryIPConfiguration
.
LoadBalancerBackendAddressPools
!=
nil
{
if
primaryIPConfiguration
.
LoadBalancerBackendAddressPools
!=
nil
{
newBackendPools
=
*
primaryIPConfiguration
.
LoadBalancerBackendAddressPools
newBackendPools
=
*
primaryIPConfiguration
.
LoadBalancerBackendAddressPools
}
}
...
@@ -641,7 +641,7 @@ func (ss *scaleSet) ensureHostsInVMSetPool(serviceName string, backendPoolID str
...
@@ -641,7 +641,7 @@ func (ss *scaleSet) ensureHostsInVMSetPool(serviceName string, backendPoolID str
}
}
newBackendPools
=
append
(
newBackendPools
,
newBackendPools
=
append
(
newBackendPools
,
compute
preview
.
SubResource
{
compute
.
SubResource
{
ID
:
to
.
StringPtr
(
backendPoolID
),
ID
:
to
.
StringPtr
(
backendPoolID
),
})
})
primaryIPConfiguration
.
LoadBalancerBackendAddressPools
=
&
newBackendPools
primaryIPConfiguration
.
LoadBalancerBackendAddressPools
=
&
newBackendPools
...
@@ -665,7 +665,7 @@ func (ss *scaleSet) ensureHostsInVMSetPool(serviceName string, backendPoolID str
...
@@ -665,7 +665,7 @@ func (ss *scaleSet) ensureHostsInVMSetPool(serviceName string, backendPoolID str
}
}
// Update instances to latest VMSS model.
// Update instances to latest VMSS model.
vmInstanceIDs
:=
compute
preview
.
VirtualMachineScaleSetVMInstanceRequiredIDs
{
vmInstanceIDs
:=
compute
.
VirtualMachineScaleSetVMInstanceRequiredIDs
{
InstanceIds
:
&
instanceIDs
,
InstanceIds
:
&
instanceIDs
,
}
}
ctx
,
cancel
:=
getContextWithCancel
()
ctx
,
cancel
:=
getContextWithCancel
()
...
@@ -758,7 +758,7 @@ func (ss *scaleSet) ensureScaleSetBackendPoolDeleted(poolID, ssName string) erro
...
@@ -758,7 +758,7 @@ func (ss *scaleSet) ensureScaleSetBackendPoolDeleted(poolID, ssName string) erro
return
nil
return
nil
}
}
existingBackendPools
:=
*
primaryIPConfiguration
.
LoadBalancerBackendAddressPools
existingBackendPools
:=
*
primaryIPConfiguration
.
LoadBalancerBackendAddressPools
newBackendPools
:=
[]
compute
preview
.
SubResource
{}
newBackendPools
:=
[]
compute
.
SubResource
{}
foundPool
:=
false
foundPool
:=
false
for
i
:=
len
(
existingBackendPools
)
-
1
;
i
>=
0
;
i
--
{
for
i
:=
len
(
existingBackendPools
)
-
1
;
i
>=
0
;
i
--
{
curPool
:=
existingBackendPools
[
i
]
curPool
:=
existingBackendPools
[
i
]
...
@@ -794,7 +794,7 @@ func (ss *scaleSet) ensureScaleSetBackendPoolDeleted(poolID, ssName string) erro
...
@@ -794,7 +794,7 @@ func (ss *scaleSet) ensureScaleSetBackendPoolDeleted(poolID, ssName string) erro
// Update instances to latest VMSS model.
// Update instances to latest VMSS model.
instanceIDs
:=
[]
string
{
"*"
}
instanceIDs
:=
[]
string
{
"*"
}
vmInstanceIDs
:=
compute
preview
.
VirtualMachineScaleSetVMInstanceRequiredIDs
{
vmInstanceIDs
:=
compute
.
VirtualMachineScaleSetVMInstanceRequiredIDs
{
InstanceIds
:
&
instanceIDs
,
InstanceIds
:
&
instanceIDs
,
}
}
instanceCtx
,
instanceCancel
:=
getContextWithCancel
()
instanceCtx
,
instanceCancel
:=
getContextWithCancel
()
...
...
pkg/cloudprovider/providers/azure/azure_vmss_test.go
View file @
079f9b85
...
@@ -20,7 +20,7 @@ import (
...
@@ -20,7 +20,7 @@ import (
"fmt"
"fmt"
"testing"
"testing"
compute
preview
"github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2017-12-01/compute"
compute
"github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2017-12-01/compute"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/assert"
)
)
...
@@ -37,8 +37,8 @@ func newTestScaleSet(scaleSetName string, vmList []string) (*scaleSet, error) {
...
@@ -37,8 +37,8 @@ func newTestScaleSet(scaleSetName string, vmList []string) (*scaleSet, error) {
func
setTestVirtualMachineCloud
(
ss
*
Cloud
,
scaleSetName
string
,
vmList
[]
string
)
{
func
setTestVirtualMachineCloud
(
ss
*
Cloud
,
scaleSetName
string
,
vmList
[]
string
)
{
virtualMachineScaleSetsClient
:=
newFakeVirtualMachineScaleSetsClient
()
virtualMachineScaleSetsClient
:=
newFakeVirtualMachineScaleSetsClient
()
scaleSets
:=
make
(
map
[
string
]
map
[
string
]
compute
preview
.
VirtualMachineScaleSet
)
scaleSets
:=
make
(
map
[
string
]
map
[
string
]
compute
.
VirtualMachineScaleSet
)
scaleSets
[
"rg"
]
=
map
[
string
]
compute
preview
.
VirtualMachineScaleSet
{
scaleSets
[
"rg"
]
=
map
[
string
]
compute
.
VirtualMachineScaleSet
{
scaleSetName
:
{
scaleSetName
:
{
Name
:
&
scaleSetName
,
Name
:
&
scaleSetName
,
},
},
...
@@ -46,24 +46,24 @@ func setTestVirtualMachineCloud(ss *Cloud, scaleSetName string, vmList []string)
...
@@ -46,24 +46,24 @@ func setTestVirtualMachineCloud(ss *Cloud, scaleSetName string, vmList []string)
virtualMachineScaleSetsClient
.
setFakeStore
(
scaleSets
)
virtualMachineScaleSetsClient
.
setFakeStore
(
scaleSets
)
virtualMachineScaleSetVMsClient
:=
newFakeVirtualMachineScaleSetVMsClient
()
virtualMachineScaleSetVMsClient
:=
newFakeVirtualMachineScaleSetVMsClient
()
ssVMs
:=
make
(
map
[
string
]
map
[
string
]
compute
preview
.
VirtualMachineScaleSetVM
)
ssVMs
:=
make
(
map
[
string
]
map
[
string
]
compute
.
VirtualMachineScaleSetVM
)
ssVMs
[
"rg"
]
=
make
(
map
[
string
]
compute
preview
.
VirtualMachineScaleSetVM
)
ssVMs
[
"rg"
]
=
make
(
map
[
string
]
compute
.
VirtualMachineScaleSetVM
)
for
i
:=
range
vmList
{
for
i
:=
range
vmList
{
ID
:=
fmt
.
Sprintf
(
"/subscriptions/script/resourceGroups/rg/providers/Microsoft.Compute/virtualMachineScaleSets/%s/virtualMachines/%d"
,
scaleSetName
,
i
)
ID
:=
fmt
.
Sprintf
(
"/subscriptions/script/resourceGroups/rg/providers/Microsoft.Compute/virtualMachineScaleSets/%s/virtualMachines/%d"
,
scaleSetName
,
i
)
nodeName
:=
vmList
[
i
]
nodeName
:=
vmList
[
i
]
instanceID
:=
fmt
.
Sprintf
(
"%d"
,
i
)
instanceID
:=
fmt
.
Sprintf
(
"%d"
,
i
)
vmName
:=
fmt
.
Sprintf
(
"%s_%s"
,
scaleSetName
,
instanceID
)
vmName
:=
fmt
.
Sprintf
(
"%s_%s"
,
scaleSetName
,
instanceID
)
networkInterfaces
:=
[]
compute
preview
.
NetworkInterfaceReference
{
networkInterfaces
:=
[]
compute
.
NetworkInterfaceReference
{
{
{
ID
:
&
nodeName
,
ID
:
&
nodeName
,
},
},
}
}
ssVMs
[
"rg"
][
vmName
]
=
compute
preview
.
VirtualMachineScaleSetVM
{
ssVMs
[
"rg"
][
vmName
]
=
compute
.
VirtualMachineScaleSetVM
{
VirtualMachineScaleSetVMProperties
:
&
compute
preview
.
VirtualMachineScaleSetVMProperties
{
VirtualMachineScaleSetVMProperties
:
&
compute
.
VirtualMachineScaleSetVMProperties
{
OsProfile
:
&
compute
preview
.
OSProfile
{
OsProfile
:
&
compute
.
OSProfile
{
ComputerName
:
&
nodeName
,
ComputerName
:
&
nodeName
,
},
},
NetworkProfile
:
&
compute
preview
.
NetworkProfile
{
NetworkProfile
:
&
compute
.
NetworkProfile
{
NetworkInterfaces
:
&
networkInterfaces
,
NetworkInterfaces
:
&
networkInterfaces
,
},
},
},
},
...
...
pkg/cloudprovider/providers/azure/azure_wrap.go
View file @
079f9b85
...
@@ -22,7 +22,7 @@ import (
...
@@ -22,7 +22,7 @@ import (
"strings"
"strings"
"time"
"time"
"github.com/Azure/azure-sdk-for-go/
arm
/compute"
"github.com/Azure/azure-sdk-for-go/
services/compute/mgmt/2017-12-01
/compute"
"github.com/Azure/azure-sdk-for-go/services/network/mgmt/2017-09-01/network"
"github.com/Azure/azure-sdk-for-go/services/network/mgmt/2017-09-01/network"
"github.com/Azure/go-autorest/autorest"
"github.com/Azure/go-autorest/autorest"
...
@@ -174,7 +174,9 @@ func (az *Cloud) newVMCache() (*timedCache, error) {
...
@@ -174,7 +174,9 @@ func (az *Cloud) newVMCache() (*timedCache, error) {
// case we do get instance view every time to fulfill the azure_zones requirement without hitting
// case we do get instance view every time to fulfill the azure_zones requirement without hitting
// throttling.
// throttling.
// Consider adding separate parameter for controlling 'InstanceView' once node update issue #56276 is fixed
// Consider adding separate parameter for controlling 'InstanceView' once node update issue #56276 is fixed
vm
,
err
:=
az
.
VirtualMachinesClient
.
Get
(
az
.
ResourceGroup
,
key
,
compute
.
InstanceView
)
ctx
,
cancel
:=
getContextWithCancel
()
defer
cancel
()
vm
,
err
:=
az
.
VirtualMachinesClient
.
Get
(
ctx
,
az
.
ResourceGroup
,
key
,
compute
.
InstanceView
)
exists
,
realErr
:=
checkResourceExistsFromError
(
err
)
exists
,
realErr
:=
checkResourceExistsFromError
(
err
)
if
realErr
!=
nil
{
if
realErr
!=
nil
{
return
nil
,
realErr
return
nil
,
realErr
...
...
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