-
Notifications
You must be signed in to change notification settings - Fork 39.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
implement InstanceShutdownByProviderID for azure #68033
implement InstanceShutdownByProviderID for azure #68033
Conversation
/sig azure |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/lgtm
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This doesn't work for vmss nodes and doesn't use caches which helps to reduces ARM API calls.
Could you add VMSS nodes support and use caches to get provisioning state? e.g. use getVmssVM()
for VMSS and getVirtualMachine()
for VMAS.
/lgtm cancel |
35edff3
to
023bed5
Compare
2ee943b
to
1752278
Compare
return false, cloudprovider.NotImplemented | ||
|
||
nodeName, err := az.vmSet.GetNodeNameByProviderID(providerID) | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: remove empty lines before if err != nil
.
same below
func (f *fakeVMSet) GetProvisioningStateByNodeName(name string) (string, error) { | ||
return "", fmt.Errorf("unimplemented") | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please gofmt this file
return false, err | ||
} | ||
|
||
return provisioningState == "Stopped" || provisioningState == "Deallocated", nil |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would suggest all using lower case to do string comparison, to prevent case change in the future.
@@ -346,6 +346,17 @@ func (as *availabilitySet) GetInstanceIDByNodeName(name string) (string, error) | |||
return *machine.ID, nil | |||
} | |||
|
|||
func (as *availabilitySet) GetProvisioningStateByNodeName(name string) (provisioningState string, err error) { | |||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
pls remove unncessary empty lines
1752278
to
7ecde43
Compare
7ecde43
to
5586108
Compare
@feiskyer @andyzhangx - fixe PTAL so we can ship this for 1.12, Thanks ! |
/retest pull-kubernetes-e2e-kops-aws |
@@ -346,6 +346,16 @@ func (as *availabilitySet) GetInstanceIDByNodeName(name string) (string, error) | |||
return *machine.ID, nil | |||
} | |||
|
|||
func (as *availabilitySet) GetProvisioningStateByNodeName(name string) (provisioningState string, err error) { | |||
vm, err := as.getVirtualMachine(types.NodeName(name)) | |||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
remove this line
@@ -128,6 +128,18 @@ func (ss *scaleSet) getVmssVM(nodeName string) (ssName, instanceID string, vm co | |||
return ssName, instanceID, *(cachedVM.(*compute.VirtualMachineScaleSetVM)), nil | |||
} | |||
|
|||
func (ss *scaleSet) GetProvisioningStateByNodeName(name string) (provisioningState string, err error) { | |||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
remove this line
func (ss *scaleSet) GetProvisioningStateByNodeName(name string) (provisioningState string, err error) { | ||
|
||
_, _, vm, err := ss.getVmssVM(name) | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
remove this line
} | ||
|
||
return *vm.ProvisioningState, nil | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
remove this line
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM now, please remove the unnecessary empty lines.
/milestone v1.12 |
5586108
to
0048b0e
Compare
/lgtm |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: andyzhangx, feiskyer, yastij The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
/priority critical-urgent |
/test all [submit-queue is verifying that this PR is safe to merge] |
Automatic merge from submit-queue. If you want to cherry-pick this change to another branch, please follow the instructions here: https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md. |
What this PR does / why we need it: implements #66265
Which issue(s) this PR fixes: Fixes #66265
Special notes for your reviewer:
Release note: