Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 15 additions & 13 deletions hypershift-operator/controllers/nodepool_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -204,19 +204,7 @@ func generateScalableResources(client ctrlclient.Client, ctx context.Context, in
return nil, nil, fmt.Errorf("error finding AMI. Found: %v. Error: %v", found, err)
}

// TODO (alberto): remove hardcoded "a" zone and come up with a solution
// for automation across az
// e.g have a "locations" field in the nodeGroup or expose the subnet in the nodeGroup
subnet := &capiaws.AWSResourceReference{
Filters: []capiaws.Filter{
{
Name: "tag:Name",
Values: []string{
fmt.Sprintf("%s-private-%sa", infraName, region),
},
},
},
}
subnet := &capiaws.AWSResourceReference{}
if nodePool.Spec.Platform.AWS.Subnet != nil {
subnet.ID = nodePool.Spec.Platform.AWS.Subnet.ID
subnet.ARN = nodePool.Spec.Platform.AWS.Subnet.ARN
Expand All @@ -227,6 +215,20 @@ func generateScalableResources(client ctrlclient.Client, ctx context.Context, in
}
subnet.Filters = append(subnet.Filters, filter)
}
} else {
// TODO (alberto): remove hardcoded "a" zone and come up with a solution
// for automation across az
// e.g have a "locations" field in the nodeGroup or expose the subnet in the nodeGroup
subnet = &capiaws.AWSResourceReference{
Filters: []capiaws.Filter{
{
Name: "tag:Name",
Values: []string{
fmt.Sprintf("%s-private-%sa", infraName, region),
},
},
},
}
}

instanceProfile := fmt.Sprintf("%s-worker-profile", infraName)
Expand Down