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
0048b0e8
Commit
0048b0e8
authored
Aug 29, 2018
by
Yassine TIJANI
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
implement InstanceShutdownByProviderID for azure
parent
d97ece0f
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
36 additions
and
1 deletion
+36
-1
azure_fakes.go
pkg/cloudprovider/providers/azure/azure_fakes.go
+4
-0
azure_instances.go
pkg/cloudprovider/providers/azure/azure_instances.go
+11
-1
azure_standard.go
pkg/cloudprovider/providers/azure/azure_standard.go
+9
-0
azure_vmsets.go
pkg/cloudprovider/providers/azure/azure_vmsets.go
+3
-0
azure_vmss.go
pkg/cloudprovider/providers/azure/azure_vmss.go
+9
-0
No files found.
pkg/cloudprovider/providers/azure/azure_fakes.go
View file @
0048b0e8
...
@@ -893,3 +893,7 @@ func (f *fakeVMSet) DetachDiskByName(diskName, diskURI string, nodeName types.No
...
@@ -893,3 +893,7 @@ func (f *fakeVMSet) DetachDiskByName(diskName, diskURI string, nodeName types.No
func
(
f
*
fakeVMSet
)
GetDataDisks
(
nodeName
types
.
NodeName
)
([]
compute
.
DataDisk
,
error
)
{
func
(
f
*
fakeVMSet
)
GetDataDisks
(
nodeName
types
.
NodeName
)
([]
compute
.
DataDisk
,
error
)
{
return
nil
,
fmt
.
Errorf
(
"unimplemented"
)
return
nil
,
fmt
.
Errorf
(
"unimplemented"
)
}
}
func
(
f
*
fakeVMSet
)
GetProvisioningStateByNodeName
(
name
string
)
(
string
,
error
)
{
return
""
,
fmt
.
Errorf
(
"unimplemented"
)
}
pkg/cloudprovider/providers/azure/azure_instances.go
View file @
0048b0e8
...
@@ -121,7 +121,17 @@ func (az *Cloud) InstanceExistsByProviderID(ctx context.Context, providerID stri
...
@@ -121,7 +121,17 @@ func (az *Cloud) InstanceExistsByProviderID(ctx context.Context, providerID stri
// InstanceShutdownByProviderID returns true if the instance is in safe state to detach volumes
// InstanceShutdownByProviderID returns true if the instance is in safe state to detach volumes
func
(
az
*
Cloud
)
InstanceShutdownByProviderID
(
ctx
context
.
Context
,
providerID
string
)
(
bool
,
error
)
{
func
(
az
*
Cloud
)
InstanceShutdownByProviderID
(
ctx
context
.
Context
,
providerID
string
)
(
bool
,
error
)
{
return
false
,
cloudprovider
.
NotImplemented
nodeName
,
err
:=
az
.
vmSet
.
GetNodeNameByProviderID
(
providerID
)
if
err
!=
nil
{
return
false
,
err
}
provisioningState
,
err
:=
az
.
vmSet
.
GetProvisioningStateByNodeName
(
string
(
nodeName
))
if
err
!=
nil
{
return
false
,
err
}
return
strings
.
ToLower
(
provisioningState
)
==
"stopped"
||
strings
.
ToLower
(
provisioningState
)
==
"deallocated"
,
nil
}
}
// getComputeMetadata gets compute information from instance metadata.
// getComputeMetadata gets compute information from instance metadata.
...
...
pkg/cloudprovider/providers/azure/azure_standard.go
View file @
0048b0e8
...
@@ -346,6 +346,15 @@ func (as *availabilitySet) GetInstanceIDByNodeName(name string) (string, error)
...
@@ -346,6 +346,15 @@ func (as *availabilitySet) GetInstanceIDByNodeName(name string) (string, error)
return
*
machine
.
ID
,
nil
return
*
machine
.
ID
,
nil
}
}
func
(
as
*
availabilitySet
)
GetProvisioningStateByNodeName
(
name
string
)
(
provisioningState
string
,
err
error
)
{
vm
,
err
:=
as
.
getVirtualMachine
(
types
.
NodeName
(
name
))
if
err
!=
nil
{
return
provisioningState
,
err
}
return
*
vm
.
ProvisioningState
,
nil
}
// GetNodeNameByProviderID gets the node name by provider ID.
// GetNodeNameByProviderID gets the node name by provider ID.
func
(
as
*
availabilitySet
)
GetNodeNameByProviderID
(
providerID
string
)
(
types
.
NodeName
,
error
)
{
func
(
as
*
availabilitySet
)
GetNodeNameByProviderID
(
providerID
string
)
(
types
.
NodeName
,
error
)
{
// NodeName is part of providerID for standard instances.
// NodeName is part of providerID for standard instances.
...
...
pkg/cloudprovider/providers/azure/azure_vmsets.go
View file @
0048b0e8
...
@@ -64,4 +64,7 @@ type VMSet interface {
...
@@ -64,4 +64,7 @@ type VMSet interface {
DetachDiskByName
(
diskName
,
diskURI
string
,
nodeName
types
.
NodeName
)
error
DetachDiskByName
(
diskName
,
diskURI
string
,
nodeName
types
.
NodeName
)
error
// GetDataDisks gets a list of data disks attached to the node.
// GetDataDisks gets a list of data disks attached to the node.
GetDataDisks
(
nodeName
types
.
NodeName
)
([]
compute
.
DataDisk
,
error
)
GetDataDisks
(
nodeName
types
.
NodeName
)
([]
compute
.
DataDisk
,
error
)
// GetProvisioningStateByNodeName gets the provisioning state by node name.
GetProvisioningStateByNodeName
(
name
string
)
(
string
,
error
)
}
}
pkg/cloudprovider/providers/azure/azure_vmss.go
View file @
0048b0e8
...
@@ -128,6 +128,15 @@ func (ss *scaleSet) getVmssVM(nodeName string) (ssName, instanceID string, vm co
...
@@ -128,6 +128,15 @@ func (ss *scaleSet) getVmssVM(nodeName string) (ssName, instanceID string, vm co
return
ssName
,
instanceID
,
*
(
cachedVM
.
(
*
compute
.
VirtualMachineScaleSetVM
)),
nil
return
ssName
,
instanceID
,
*
(
cachedVM
.
(
*
compute
.
VirtualMachineScaleSetVM
)),
nil
}
}
func
(
ss
*
scaleSet
)
GetProvisioningStateByNodeName
(
name
string
)
(
provisioningState
string
,
err
error
)
{
_
,
_
,
vm
,
err
:=
ss
.
getVmssVM
(
name
)
if
err
!=
nil
{
return
provisioningState
,
err
}
return
*
vm
.
ProvisioningState
,
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
(
resourceGroup
,
scaleSetName
,
instanceID
string
)
(
vm
compute
.
VirtualMachineScaleSetVM
,
err
error
)
{
func
(
ss
*
scaleSet
)
getVmssVMByInstanceID
(
resourceGroup
,
scaleSetName
,
instanceID
string
)
(
vm
compute
.
VirtualMachineScaleSetVM
,
err
error
)
{
...
...
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