@@ -41,8 +41,8 @@ func NewReservationManager(instanceTypes map[string][]*cloudprovider.InstanceTyp
41
41
// If we have multiple offerings with the same reservation ID, track the one with the least capacity. This could be
42
42
// the result of multiple nodepools referencing the same capacity reservation, and there being an update to the
43
43
// capacity between calls to GetInstanceTypes.
44
- if current , ok := capacity [o .ReservationID ]; ! ok || current > o .ReservationCapacity {
45
- capacity [o .ReservationID ] = o .ReservationCapacity
44
+ if current , ok := capacity [o .ReservationID () ]; ! ok || current > o .ReservationCapacity {
45
+ capacity [o .ReservationID () ] = o .ReservationCapacity
46
46
}
47
47
}
48
48
}
@@ -55,31 +55,31 @@ func NewReservationManager(instanceTypes map[string][]*cloudprovider.InstanceTyp
55
55
56
56
func (rm * ReservationManager ) Reserve (hostname string , offering * cloudprovider.Offering ) bool {
57
57
reservations , ok := rm .reservations [hostname ]
58
- if ok && reservations .Has (offering .ReservationID ) {
58
+ if ok && reservations .Has (offering .ReservationID () ) {
59
59
return true
60
60
}
61
61
if ! ok {
62
62
reservations = sets .New [string ]()
63
63
rm .reservations [hostname ] = reservations
64
64
}
65
- capacity , ok := rm .capacity [offering .ReservationID ]
65
+ capacity , ok := rm .capacity [offering .ReservationID () ]
66
66
if ! ok {
67
67
// Note: this panic should never occur, and would indicate a serious bug in the scheduling code.
68
- panic (fmt .Sprintf ("attempted to reserve non-existent offering with reservation id %q" , offering .ReservationID ))
68
+ panic (fmt .Sprintf ("attempted to reserve non-existent offering with reservation id %q" , offering .ReservationID () ))
69
69
}
70
70
if capacity == 0 {
71
71
return false
72
72
}
73
- rm .capacity [offering .ReservationID ] -= 1
74
- reservations .Insert (offering .ReservationID )
73
+ rm .capacity [offering .ReservationID () ] -= 1
74
+ reservations .Insert (offering .ReservationID () )
75
75
return true
76
76
}
77
77
78
78
func (rm * ReservationManager ) Release (hostname string , offerings ... * cloudprovider.Offering ) {
79
79
for _ , o := range offerings {
80
- if reservations , ok := rm .reservations [hostname ]; ok && reservations .Has (o .ReservationID ) {
81
- reservations .Delete (o .ReservationID )
82
- rm .capacity [o .ReservationID ] += 1
80
+ if reservations , ok := rm .reservations [hostname ]; ok && reservations .Has (o .ReservationID () ) {
81
+ reservations .Delete (o .ReservationID () )
82
+ rm .capacity [o .ReservationID () ] += 1
83
83
}
84
84
}
85
85
}
0 commit comments