Skip to content

Commit 57bf42d

Browse files
authored
Merge pull request #206 from jwcesign/release
fix: consider vs zones when creating types offerings
2 parents bde22fe + b85bd95 commit 57bf42d

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
@@ -169,9 +169,7 @@ func (p *DefaultProvider) List(ctx context.Context, kc *v1alpha1.KubeletConfigur
169169
// We don't use this in the cache key since this is produced from our instanceTypesOfferings which we do cache
170170
allZones := sets.New[string]()
171171
for _, offeringZones := range p.instanceTypesOfferings {
172-
for zone := range offeringZones {
173-
allZones.Insert(zone)
174-
}
172+
allZones.Insert(offeringZones.UnsortedList()...)
175173
}
176174

177175
if p.cm.HasChanged("zones", allZones) {
@@ -185,11 +183,13 @@ func (p *DefaultProvider) List(ctx context.Context, kc *v1alpha1.KubeletConfigur
185183

186184
result := lo.Map(p.instanceTypesInfo, func(i *ecsclient.DescribeInstanceTypesResponseBodyInstanceTypesInstanceType, _ int) *cloudprovider.InstanceType {
187185
zoneData := lo.Map(allZones.UnsortedList(), func(zoneID string, _ int) ZoneData {
188-
ret := ZoneData{ID: zoneID, Available: true}
186+
ret := ZoneData{ID: zoneID, Available: true, SpotAvailable: true}
189187
if !p.instanceTypesOfferings[lo.FromPtr(i.InstanceTypeId)].Has(zoneID) || !vSwitchsZones.Has(zoneID) {
190188
ret.Available = false
191189
}
192-
ret.SpotAvailable = p.spotInstanceTypesOfferings[lo.FromPtr(i.InstanceTypeId)].Has(zoneID)
190+
if !p.spotInstanceTypesOfferings[lo.FromPtr(i.InstanceTypeId)].Has(zoneID) || !vSwitchsZones.Has(zoneID) {
191+
ret.SpotAvailable = false
192+
}
193193
return ret
194194
})
195195

0 commit comments

Comments
 (0)