Skip to content

Commit 2656757

Browse files
committed
fix: consider vs zones when creating types offerings
Signed-off-by: jwcesign <[email protected]>
1 parent f9e5d88 commit 2656757

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

pkg/providers/instancetype/instancetype.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -166,9 +166,7 @@ func (p *DefaultProvider) List(ctx context.Context, kc *v1alpha1.KubeletConfigur
166166
// We don't use this in the cache key since this is produced from our instanceTypesOfferings which we do cache
167167
allZones := sets.New[string]()
168168
for _, offeringZones := range p.instanceTypesOfferings {
169-
for zone := range offeringZones {
170-
allZones.Insert(zone)
171-
}
169+
allZones.Insert(offeringZones.UnsortedList()...)
172170
}
173171

174172
if p.cm.HasChanged("zones", allZones) {
@@ -182,11 +180,13 @@ func (p *DefaultProvider) List(ctx context.Context, kc *v1alpha1.KubeletConfigur
182180

183181
result := lo.Map(p.instanceTypesInfo, func(i *ecsclient.DescribeInstanceTypesResponseBodyInstanceTypesInstanceType, _ int) *cloudprovider.InstanceType {
184182
zoneData := lo.Map(allZones.UnsortedList(), func(zoneID string, _ int) ZoneData {
185-
ret := ZoneData{ID: zoneID, Available: true}
183+
ret := ZoneData{ID: zoneID, Available: true, SpotAvailable: true}
186184
if !p.instanceTypesOfferings[lo.FromPtr(i.InstanceTypeId)].Has(zoneID) || !vSwitchsZones.Has(zoneID) {
187185
ret.Available = false
188186
}
189-
ret.SpotAvailable = p.spotInstanceTypesOfferings[lo.FromPtr(i.InstanceTypeId)].Has(zoneID)
187+
if !p.spotInstanceTypesOfferings[lo.FromPtr(i.InstanceTypeId)].Has(zoneID) || !vSwitchsZones.Has(zoneID) {
188+
ret.SpotAvailable = false
189+
}
190190
return ret
191191
})
192192

0 commit comments

Comments
 (0)