|
@@ -776,14 +776,14 @@ type GCPReservedInstance struct {
|
|
|
Region string
|
|
Region string
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-type ReservedCounter struct {
|
|
|
|
|
|
|
+type GCPReservedCounter struct {
|
|
|
RemainingCPU int64
|
|
RemainingCPU int64
|
|
|
RemainingRAM int64
|
|
RemainingRAM int64
|
|
|
Instance *GCPReservedInstance
|
|
Instance *GCPReservedInstance
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-func newReservedCounter(instance *GCPReservedInstance) *ReservedCounter {
|
|
|
|
|
- return &ReservedCounter{
|
|
|
|
|
|
|
+func newReservedCounter(instance *GCPReservedInstance) *GCPReservedCounter {
|
|
|
|
|
+ return &GCPReservedCounter{
|
|
|
RemainingCPU: instance.ReservedCPU,
|
|
RemainingCPU: instance.ReservedCPU,
|
|
|
RemainingRAM: instance.ReservedRAM,
|
|
RemainingRAM: instance.ReservedRAM,
|
|
|
Instance: instance,
|
|
Instance: instance,
|
|
@@ -815,7 +815,7 @@ func (gcp *GCP) ApplyReservedInstancePricing(nodes map[string]*Node) {
|
|
|
|
|
|
|
|
now := time.Now()
|
|
now := time.Now()
|
|
|
|
|
|
|
|
- counters := make(map[string][]*ReservedCounter)
|
|
|
|
|
|
|
+ counters := make(map[string][]*GCPReservedCounter)
|
|
|
for _, r := range gcp.ReservedInstances {
|
|
for _, r := range gcp.ReservedInstances {
|
|
|
if now.Before(r.StartDate) || now.After(r.EndDate) {
|
|
if now.Before(r.StartDate) || now.After(r.EndDate) {
|
|
|
klog.V(1).Infof("[Reserved] Skipped Reserved Instance due to dates")
|
|
klog.V(1).Infof("[Reserved] Skipped Reserved Instance due to dates")
|
|
@@ -825,7 +825,7 @@ func (gcp *GCP) ApplyReservedInstancePricing(nodes map[string]*Node) {
|
|
|
_, ok := counters[r.Region]
|
|
_, ok := counters[r.Region]
|
|
|
counter := newReservedCounter(r)
|
|
counter := newReservedCounter(r)
|
|
|
if !ok {
|
|
if !ok {
|
|
|
- counters[r.Region] = []*ReservedCounter{counter}
|
|
|
|
|
|
|
+ counters[r.Region] = []*GCPReservedCounter{counter}
|
|
|
} else {
|
|
} else {
|
|
|
counters[r.Region] = append(counters[r.Region], counter)
|
|
counters[r.Region] = append(counters[r.Region], counter)
|
|
|
}
|
|
}
|