Skip to content

Commit 1f7ea9f

Browse files
committed
fix instance id may be empty issue
1 parent a8f5979 commit 1f7ea9f

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

cluster-autoscaler/cloudprovider/huaweicloud/huaweicloud_service_manager.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -179,6 +179,11 @@ func (csm *cloudServiceManager) GetInstances(groupID string) ([]cloudprovider.In
179179

180180
instances := make([]cloudprovider.Instance, 0, len(*response.ScalingGroupInstances))
181181
for _, sgi := range *response.ScalingGroupInstances {
182+
// When a new instance joining to the scaling group, the instance id maybe empty(nil).
183+
if sgi.InstanceId == nil {
184+
klog.Infof("ignore instance without instance id, maybe instance is joining.")
185+
continue
186+
}
182187
instance := cloudprovider.Instance{
183188
Id: *sgi.InstanceId,
184189
Status: csm.transformInstanceState(*sgi.LifeCycleState, *sgi.HealthStatus),

0 commit comments

Comments
 (0)