Skip to content

Commit

Permalink
Filters terminated Vms in getInstance
Browse files Browse the repository at this point in the history
Signed-off-by: Maxime Dufour <[email protected]>
  • Loading branch information
outscale-mdr committed Jul 8, 2024
1 parent f650a39 commit 6eb7538
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 1 deletion.
17 changes: 16 additions & 1 deletion cloud-controller-manager/osc/ccm_cloud.go
Original file line number Diff line number Diff line change
Expand Up @@ -1946,7 +1946,15 @@ func (c *Cloud) getInstancesByNodeNames(nodeNames []string, states ...string) ([
names := nodeNames
oscInstances := []*osc.Vm{}

filters := osc.FiltersVm{}
filters := osc.FiltersVm{
VmStateNames: &[]string{
"pending",
"running",
"stopping",
"stopped",
"shutting-down",
},
}

instances, err := c.describeInstances(&filters)
if err != nil {
Expand Down Expand Up @@ -2006,6 +2014,13 @@ func (c *Cloud) findInstanceByNodeName(nodeName types.NodeName) (*osc.Vm, error)
Tags: &[]string{
fmt.Sprintf("%s=%s", TagNameClusterNode, privateDNSName),
},
VmStateNames: &[]string{
"pending",
"running",
"stopping",
"stopped",
"shutting-down",
},
}

instances, err := c.describeInstances(&filters)
Expand Down
7 changes: 7 additions & 0 deletions cloud-controller-manager/osc/instances_v2.go
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,13 @@ func (i *instancesV2) getInstance(ctx context.Context, node *v1.Node) (*osc.Vm,
request = &osc.ReadVmsRequest{
Filters: &osc.FiltersVm{
VmIds: &[]string{instanceID},
VmStateNames: &[]string{
"pending",
"running",
"stopping",
"stopped",
"shutting-down",
},
},
}
klog.V(4).Infof("looking for node by provider ID %v", node.Spec.ProviderID)
Expand Down

0 comments on commit 6eb7538

Please sign in to comment.