Skip to content

Commit af08074

Browse files
committed
Add fallback if subnets not provided on AWSMachinePool
1 parent 98cc901 commit af08074

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

pkg/cloud/services/autoscaling/autoscalinggroup.go

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -144,10 +144,12 @@ func (s *Service) CreateASG(scope *scope.MachinePoolScope) (*expinfrav1.AutoScal
144144
for i, v := range scope.AWSMachinePool.Spec.Subnets {
145145
subnetIDs[i] = aws.StringValue(v.ID)
146146
}
147-
// subnetIDs := []string{}
148-
// for _, v := range scope.AWSMachinePool.Spec.Subnets {
149-
// subnetIDs = append(subnetIDs, aws.StringValue(v.ID))
150-
// }
147+
148+
if len(subnetIDs) == 0 {
149+
for _, subnet := range scope.InfraCluster.Subnets() {
150+
subnetIDs = append(subnetIDs, subnet.ID)
151+
}
152+
}
151153

152154
input := &expinfrav1.AutoScalingGroup{
153155
Name: scope.Name(),

0 commit comments

Comments
 (0)