File tree Expand file tree Collapse file tree 2 files changed +27
-1
lines changed
pkg/providers/instancetype Expand file tree Collapse file tree 2 files changed +27
-1
lines changed Original file line number Diff line number Diff line change @@ -165,7 +165,6 @@ func (p *DefaultProvider) createOfferings(
165
165
offering .Requirements .Add (scheduling .NewRequirement (v1 .LabelTopologyZoneID , corev1 .NodeSelectorOpIn , id ))
166
166
}
167
167
cachedOfferings = append (cachedOfferings , offering )
168
- offerings = append (cachedOfferings , offering )
169
168
}
170
169
}
171
170
p .cache .SetDefault (p .cacheKeyFromInstanceType (it ), cachedOfferings )
Original file line number Diff line number Diff line change @@ -2383,6 +2383,33 @@ var _ = Describe("InstanceTypeProvider", func() {
2383
2383
})
2384
2384
})
2385
2385
})
2386
+ Context ("Offerings" , func () {
2387
+ It ("should create a single offering per instance pool" , func () {
2388
+ ExpectApplied (ctx , env .Client , nodeClass )
2389
+ // Test twice to ensure we get the same result for a cache miss and hit
2390
+ for range 2 {
2391
+ instanceTypes , err := cloudProvider .GetInstanceTypes (ctx , nodePool )
2392
+ Expect (err ).ToNot (HaveOccurred ())
2393
+ type instancePool struct {
2394
+ instanceType string
2395
+ zone string
2396
+ capacityType string
2397
+ }
2398
+ pools := sets .New [instancePool ]()
2399
+ for _ , it := range instanceTypes {
2400
+ for _ , o := range it .Offerings {
2401
+ pool := instancePool {
2402
+ instanceType : it .Name ,
2403
+ zone : o .Zone (),
2404
+ capacityType : o .CapacityType (),
2405
+ }
2406
+ Expect (pools .Has (pool )).To (BeFalse ())
2407
+ pools .Insert (pool )
2408
+ }
2409
+ }
2410
+ }
2411
+ })
2412
+ })
2386
2413
Context ("Provider Cache" , func () {
2387
2414
// Keeping the Cache testing in one IT block to validate the combinatorial expansion of instance types generated by different configs
2388
2415
It ("changes to kubelet configuration fields should result in a different set of instances types" , func () {
You can’t perform that action at this time.
0 commit comments